Changeset d44cf5 in indico
- Timestamp:
- 09/11/09 14:49:18 (4 years ago)
- Branches:
- master, burotel, hello-world-walkthrough, ipv6, new-improved-taskdaemon, new-webex, prov-dual-interface, v0.97-series, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 0da0c1403bae8e51d8229f460181c71b9e6dda72
- Children:
- e64ab6
- Parents:
- 6228d9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
indico/MaKaC/plugins/Collaboration/CERNMCU/pages.py
rfd0c10 rd44cf5 33 33 34 34 class WNewBookingForm(WCSPageTemplateBase): 35 35 36 36 def getVars(self): 37 37 vars = WCSPageTemplateBase.getVars( self ) 38 38 39 39 vars["EventTitle"] = self._conf.getTitle() 40 40 vars["EventDescription"] = unescape_html(strip_ml_tags( self._conf.getDescription())).strip() … … 43 43 vars["MinStartDate"] = formatDateTime(self._conf.getAdjustedStartDate()) 44 44 vars["MaxEndDate"] = formatDateTime(self._conf.getAdjustedEndDate()) 45 45 46 46 return vars 47 47 48 48 class WMain (WJSBase): 49 49 50 50 def getVars(self): 51 51 vars = WJSBase.getVars( self ) 52 52 53 53 vars["MinStartDate"] = formatDateTime(self._conf.getAdjustedStartDate()) 54 54 vars["MaxEndDate"] = formatDateTime(self._conf.getAdjustedEndDate()) 55 55 56 56 location = self._conf.getLocation() 57 57 room = self._conf.getRoom() … … 64 64 else: 65 65 vars["InitialRoomInstitution"] = "" 66 66 67 67 # TODO: get IP of room from a plugin option instead of querying RB DB every time 68 68 try: … … 72 72 CrossLocationDB.connect() 73 73 Logger.get("CERNMCU").info("Connection successful") 74 74 75 75 attName = getCERNMCUOptionValueByName("H323_IP_att_name") 76 76 77 77 returnedRooms = CrossLocationQueries.getRooms( location = location.getName(), roomName = room.getName() ) 78 78 79 if isinstance(returnedRooms, list): 79 returnedRoom = returnedRooms[0] 80 if len(returnedRooms) == 0: 81 returnedRoom = None 82 else: 83 returnedRoom = returnedRooms[0] 80 84 else: 81 85 returnedRoom = returnedRooms 82 if attName in returnedRoom.customAtts: 86 87 if (returnedRoom != None) and \ 88 (attName in returnedRoom.customAtts): 89 83 90 initialRoomIp = returnedRoom.customAtts[attName] 84 91 if (initialRoomIp.strip() == ""): 85 92 vars["IPRetrievalResult"] = 1 86 93 elif not validIP(initialRoomIp): 87 vars["IPRetrievalResult"] = 2 94 vars["IPRetrievalResult"] = 2 88 95 else: 89 96 vars["IPRetrievalResult"] = 0 90 97 91 98 else: 92 99 initialRoomIp = "IP not defined for this room." … … 96 103 vars["IPRetrievalResult"] = 3 97 104 Logger.get("CERNMCU").info("Tried to retrieve a room's H323 IP, but Room Booking module was not active.") 98 105 99 106 except MaKaCError, e: 100 107 initialRoomIp = "IP not found." 101 108 vars["IPRetrievalResult"] = 4 102 109 Logger.get("CERNMCU").warning("Problem when retrieving a room's H.323 IP: " + e.getMsg()) 103 104 110 111 105 112 vars["InitialRoomIP"] = initialRoomIp 106 113 107 114 else: 108 115 vars["IncludeInitialRoom"] = False … … 111 118 vars["InitialRoomInstitution"] = "" 112 119 vars["InitialRoomIP"] = "" 113 120 114 121 vars["CERNGatekeeperPrefix"] = getCERNMCUOptionValueByName("CERNGatekeeperPrefix") 115 122 vars["GDSPrefix"] = getCERNMCUOptionValueByName("GDSPrefix") 116 123 vars["MCU_IP"] = getCERNMCUOptionValueByName("MCU_IP") 117 124 vars["Phone_number"] = getCERNMCUOptionValueByName("Phone_number") 118 119 return vars 120 125 126 return vars 127 121 128 class WIndexing(WJSBase): 122 129 pass 123 130 124 131 class WExtra (WJSBase): 125 132 def getVars(self): 126 133 vars = WJSBase.getVars( self ) 127 134 128 135 roomsWithH323IP = [] 129 136 130 137 if self._conf: 131 location = self._conf.getLocation() 132 138 location = self._conf.getLocation() 139 133 140 if location: 134 141 135 142 # TODO: get list of room from a plugin option instead of querying the RB DB everytime 136 143 try: … … 140 147 CrossLocationDB.connect() 141 148 Logger.get("CERNMCU").info("Connection successful") 142 149 143 150 attName = getCERNMCUOptionValueByName("H323_IP_att_name") 144 145 151 152 146 153 returnedRooms = CrossLocationQueries.getRooms( location = location.getName(), 147 154 customAtts = [{"name":attName, "allowEmpty":False, … … 149 156 if not isinstance(returnedRooms, list): 150 157 returnedRooms = [returnedRooms] 151 158 152 159 for room in returnedRooms: 153 160 roomsWithH323IP.append(RoomWithH323(location.getName(), room._getName(), room.customAtts[attName])) 154 161 155 162 except MaKaCError, e: 156 163 Logger.get("CERNMCU").warning("Problem when retrieving the list of all rooms with a H323 IP: " + e.getMsg()) 157 164 158 165 vars["RoomsWithH323IP"] = roomsWithH323IP 159 166 return vars 160 167 161 168 class WStyle (WCSCSSBase): 162 169 pass 163 170 164 171 class WInformationDisplay(WCSPageTemplateBase): 165 172 166 173 def __init__(self, booking, displayTz): 167 174 WCSPageTemplateBase.__init__(self, booking.getConference(), 'CERNMCU', None) 168 175 self._booking = booking 169 176 self._displayTz = displayTz 170 177 171 178 def getVars(self): 172 179 vars = WCSPageTemplateBase.getVars( self ) 173 180 174 181 vars["Booking"] = self._booking 175 182 176 183 vars["CERNGatekeeperPrefix"] = getCERNMCUOptionValueByName("CERNGatekeeperPrefix") 177 184 vars["GDSPrefix"] = getCERNMCUOptionValueByName("GDSPrefix") 178 185 vars["MCU_IP"] = getCERNMCUOptionValueByName("MCU_IP") 179 186 vars["Phone_number"] = getCERNMCUOptionValueByName("Phone_number") 180 187 181 188 return vars 182 189 183 190 184 191 class XMLGenerator(object): 185 192 186 193 @classmethod 187 194 def getDisplayName(cls): 188 195 return "MCU" 189 196 190 197 @classmethod 191 198 def getCustomBookingXML(cls, booking, displayTz, out): 192 199 193 200 out.openTag("information") 194 201 195 202 if booking.getHasPin(): 196 203 out.openTag("section") … … 198 205 out.writeTag("line", _('This conference is protected by a PIN')) 199 206 out.closeTag("section") 200 207 201 208 out.openTag("section") 202 209 out.writeTag("title", _('Description:')) 203 210 out.writeTag("line", booking._bookingParams["description"]) 204 211 out.closeTag("section") 205 212 206 213 out.openTag("section") 207 214 out.writeTag("title", _('Participants:')) … … 212 219 out.writeTag("line", _("No participants yet")) 213 220 out.closeTag("section") 214 221 215 222 bookingIdInMCU = str(booking._bookingParams["id"]) 216 223 out.openTag("section") … … 241 248 ])) 242 249 out.closeTag("section") 243 250 244 251 out.closeTag("information") 245 252
Note: See TracChangeset
for help on using the changeset viewer.
