Changeset 1372
- Timestamp:
- 01/04/11 15:59:45 (17 months ago)
- Location:
- HelpIM3/branches/chatgroups/HelpIM/chatgroup
- Files:
-
- 3 modified
-
db/databaseMetadata.py (modified) (2 diffs)
-
db/services.py (modified) (2 diffs)
-
pages/ChatLog.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
HelpIM3/branches/chatgroups/HelpIM/chatgroup/db/databaseMetadata.py
r1367 r1372 90 90 Column('created_at', 91 91 DateTime, 92 default=func.now() 93 ), 92 default=func.now()), 94 93 95 94 UniqueConstraint('group_id', 'email'), … … 147 146 ForeignKey('conv_Participants.conv_participant_id'), 148 147 primary_key=True), 149 Column( 150 'meeting_id', 151 Integer, 152 ForeignKey('chatgroup_meeting.id') 153 ), 154 Column( 155 'member_id', 156 Integer, 157 ForeignKey('chatgroup_member.id') 158 ) 148 Column('meeting_id', 149 Integer, 150 ForeignKey('chatgroup_meeting.id')), 151 Column('member_id', 152 Integer, 153 ForeignKey('chatgroup_member.id')), 154 Column('is_admin', 155 Boolean, 156 nullable=False, 157 default=False), 158 Column('joined_at', 159 DateTime, 160 default=func.now()), 161 Column('left_at', 162 DateTime, 163 nullable=True), 159 164 ) 160 165 -
HelpIM3/branches/chatgroups/HelpIM/chatgroup/db/services.py
r1367 r1372 166 166 raise 167 167 168 """ iterates through meetings for members groups. if there's a 169 meeting today checks whether now is within window """ 168 """ ChatgroupMeetingParticipant """ 169 170 def getChatgroupMeetingParticipantsByMeetingId(self, site, meeting_id, is_admin=None): 171 session = site.database.getSession() 172 query = session.query(ChatgroupMeetingParticipant).filter_by(meeting_id=meeting_id) 173 if (is_admin is not None): 174 query = query.filter_by(is_admin=is_admin) 175 try: 176 meeting = query.all() 177 return meeting 178 except NoResultFound: 179 if raiseError: 180 raise 181 182 170 183 def getChatgroupMeetingByMember(self, site, member): 184 """ iterates through meetings for members groups. if there's a 185 meeting today checks whether now is within window """ 171 186 from HelpIM.utils import today 172 187 from datetime import timedelta, datetime … … 192 207 participant.conv_participant_conv_id = meeting.id 193 208 participant.conv_participant_name = member.nickname 209 participant.is_admin = member.is_admin 194 210 meeting.participants.append(participant) 195 211 session.flush() -
HelpIM3/branches/chatgroups/HelpIM/chatgroup/pages/ChatLog.py
r1371 r1372 80 80 } 81 81 82 83 chatLogTable = self.getChatLogTableDef() 84 panelDef = [ chat_conv_detail_panel, 85 chatLogTable ] 86 return panelDef 82 return [ chat_conv_detail_panel, 83 self.getParticipantsDef('Facilitators', 'ChatgroupFacilitators'), 84 self.getParticipantsDef('Participants', 'ChatgroupParticipants'), 85 self.getChatLogTableDef() ] 86 87 def getParticipantsDef(self, panelName, dataTable): 88 return { 89 'table_panel': [ 90 {'panelName': panelName, 91 'dataTable': dataTable, 92 'dataRecord': 'ChatgroupMeetingParticipant'}, 93 [{'table_column': [ 94 {'heading': 'Naam', 95 'valueAttr': 'conv_participant_name'} 96 ]}, 97 {'table_column': [ 98 {'heading': 'joined', 99 'valueAttr': 'joined_at'} 100 ]}, 101 {'table_column': [ 102 {'heading': 'left', 103 'valueAttr': 'left_at'} 104 ]}, 105 {'table_column': [ 106 {'heading': 'lines', 107 'valueAttr': 'conv_participant_nbr_lines'} 108 ]}, 109 {'table_column': [ 110 {'heading': 'words', 111 'valueAttr': 'conv_participant_nbr_words'} 112 ]} 113 ] 114 ] 115 } 87 116 88 117 def getChatLogTableDef(self): … … 125 154 chatData = self.site.pythonObjectAsTuple( 126 155 chat, 127 self.chatConv_DataElements, 128 escape=['conv_Question_answerText']) 156 self.chatConv_DataElements) 129 157 130 158 chatData['ChatgroupMeeting'][0]['chat_lines_total'] = len(chat.conv_messages) … … 136 164 self.dbg(chatData) 137 165 138 panel_data = { 'panel_data': [ [chatData] ] } 139 fieldErrors = { 'fieldErrors': [ self.errors ] } 140 panelMessage = { 'panelMessage': self.panelMessage} 166 participantDataElements = ['conv_participant_name', 'joined_at', 'left_at', 'conv_participant_nbr_lines', 'conv_participant_nbr_words'] 167 168 facilitators = self.site.listOfPythonObjectsAsTuple( 169 'ChatgroupFacilitators', 170 self.site.getChatgroupMeetingParticipantsByMeetingId( 171 self.site, 172 self.getParam('conv_id'), 173 True), 174 participantDataElements 175 ) 176 177 self.dbg(facilitators) 178 179 participants = self.site.listOfPythonObjectsAsTuple( 180 'ChatgroupParticipants', 181 self.site.getChatgroupMeetingParticipantsByMeetingId( 182 self.site, 183 self.getParam('conv_id'), 184 False), 185 participantDataElements 186 ) 187 188 self.dbg(participants) 189 190 panel_data = {'panel_data' : [[chatData, facilitators, participants]]} 191 fieldErrors = {'fieldErrors' : [self.errors]} 192 panelMessage = {'panelMessage': self.panelMessage} 141 193 142 194 return [panel_data, fieldErrors, panelMessage]
