Changeset 16926f in indico
- Timestamp:
- 04/13/10 18:13:47 (3 years ago)
- Branches:
- master, burotel, hello-world-walkthrough, ipv6, new-webex, v0.97-series, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, b8c30da8ebdbdcbd675a873997cc3e95f567de49, 4287315ec967a3da168d83963c14001db8487d53
- Children:
- bdd862
- Parents:
- 1db73e
- git-author:
- Pedro Ferreira <jose.pedro.ferreira@…> (04/13/10 18:10:59)
- git-committer:
- Pedro Ferreira <jose.pedro.ferreira@…> (04/13/10 18:13:47)
- Location:
- indico
- Files:
-
- 3 added
- 7 edited
-
MaKaC/common/filters.py (modified) (1 diff)
-
MaKaC/registration.py (modified) (7 diffs)
-
MaKaC/webinterface/common/regFilters.py (modified) (2 diffs)
-
MaKaC/webinterface/pages/registrants.py (modified) (7 diffs)
-
MaKaC/webinterface/rh/registrantsModif.py (modified) (6 diffs)
-
MaKaC/webinterface/tpls/ConfModifRegistrants.tpl (modified) (1 diff)
-
MaKaC/webinterface/tpls/FilterCriteria.tpl (added)
-
MaKaC/webinterface/tpls/FilterCriterionOptions.tpl (added)
-
MaKaC/webinterface/tpls/FilterSessionCriterionOptions.tpl (added)
-
htdocs/css/Default.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
indico/MaKaC/common/filters.py
r9033fd r16926f 185 185 satisfy in order to make it pass the filter. 186 186 """ 187 187 188 self._conf=conf 188 189 self._fields = {} -
indico/MaKaC/registration.py
ra0203b r16926f 844 844 class BaseForm(Persistent): 845 845 846 """ 847 Base class for registration forms 848 849 It includes iterators/getters, provided if the class attribute 850 _iterableContainer is present. _iterableContainer is a simple workaround for 851 the problem of having a generic iterator interface over all the forms, even 852 if the initial design didn't unify the form container into a BaseForm 853 attribute. Since it is too late now for redesigning the DB schema, this 854 attribute kind of fixes it. 855 856 """ 857 858 # should be overloaded if iteration is to be provided 859 _iterableContainer = None 860 846 861 def __init__(self): 847 862 self._enabled = True # it means that the form cannot be used either in the registration display or in the management area. … … 857 872 self._enabled = True 858 873 return self._enabled 874 875 def __iter__(self): 876 return getattr(self, self._iterableContainer).__iter__(); 877 878 def __getitem__(self, key): 879 return getattr(self, self._iterableContainer)[key] 880 859 881 860 882 class FieldInputType(Persistent): … … 2173 2195 class AccommodationForm(BaseForm): 2174 2196 2197 _iterableContainer = '_accommodationTypes' 2198 2175 2199 def __init__(self, regForm, data=None): 2176 2200 BaseForm.__init__(self) … … 2353 2377 self.removeAccommodationType(at) 2354 2378 2379 2355 2380 class ReasonParticipationForm(BaseForm): 2356 2381 … … 2481 2506 def getTitle(self): 2482 2507 return self._session.getTitle() 2508 2509 # for compatibility with other fields 2510 getCaption = getTitle 2483 2511 2484 2512 def getStartDate(self): … … 2499 2527 2500 2528 class SessionsForm(BaseForm): 2529 2530 _iterableContainer = '_sessions' 2501 2531 2502 2532 def __init__(self, data=None): … … 2775 2805 2776 2806 class SocialEventForm(BaseForm): 2807 2808 _iterableContainer = '_socialEvents' 2777 2809 2778 2810 def __init__(self, regForm, data=None): -
indico/MaKaC/webinterface/common/regFilters.py
r5997aa r16926f 54 54 55 55 def satisfies( self, reg ): 56 57 """ 58 """ 56 """ 57 """ 58 59 59 if reg.getSessionList(): 60 60 for sess in reg.getSessionList(): … … 76 76 """ 77 77 """ 78 78 79 if len(reg.getSessionList()) > 0: 79 80 sess=reg.getSessionList()[0] -
indico/MaKaC/webinterface/pages/registrants.py
rfb1fc8 r16926f 101 101 self._dispopts["more"]=["RegistrationDate"] 102 102 for sect in self._conf.getRegistrationForm().getGeneralSectionFormsList(): 103 #if sect.isEnabled():104 103 self._dispopts[sect.getId()]=[] 105 ################ 106 #jmf-start 107 # 108 #for fld in sect.getFields(): 109 # self._dispopts[sect.getId()].append("%s-%s"%(sect.getId(),fld.getId())) 104 110 105 for fld in sect.getSortedFields(): 111 106 self._dispopts[sect.getId()].append("%s-%s"%(sect.getId(),fld.getId())) 112 #113 #jmf-end114 ################115 107 116 108 def _getKeyDispOpts(self, value): … … 197 189 return url 198 190 199 def _getSessHTML(self): 191 192 def _getFilterBoxesHTML(self): 200 193 regForm = self._conf.getRegistrationForm() 201 sessform =regForm.getSessionsForm() 202 sesstypes = sessform.getSessionList() 203 checked="" 204 if self._filterCrit.getField(self._sessionFilterName).getShowNoValue(): 205 checked=" checked" 206 res=[ _("""<input type="checkbox" name="sessionShowNoValue" value="--none--"%s> --_("not specified")--""")%checked] 207 for sess in sesstypes: 208 checked="" 209 if sess.getId() in self._filterCrit.getField(self._sessionFilterName).getValues(): 210 checked=" checked" 211 res.append("""<input type="checkbox" name="session" value=%s%s>%s"""%(quoteattr(str(sess.getId())),checked,self.htmlText(sess.getTitle()))) 212 if sessform.getType() == "2priorities": 213 checked="" 214 if self._sessionFilterName == "sessionfirstpriority": 215 checked=" checked" 216 res.append( _("""<b>------</b><br><input type="checkbox" name="firstChoice" value="firstChoice"%s><i> _("Only by first choice")</i>""")%checked) 217 return "<br>".join(res) 218 219 def _getAcomHTML(self): 220 regForm = self._conf.getRegistrationForm() 221 accommform = regForm.getAccommodationForm() 222 accommtypes = accommform.getAccommodationTypesList() 223 checked="" 224 if self._filterCrit.getField("accomm").getShowNoValue(): 225 checked=" checked" 226 res=[ _("""<input type="checkbox" name="accommShowNoValue" value="--none--"%s> --_("not specified")--""")%checked] 227 for accomm in accommtypes: 228 checked="" 229 if accomm.getId() in self._filterCrit.getField("accomm").getValues(): 230 checked=" checked" 231 res.append("""<input type="checkbox" name="accomm" value=%s%s>%s"""%(quoteattr(str(accomm.getId())),checked,self.htmlText(accomm.getCaption()))) 232 return "<br>".join(res) 233 234 def _getEventHTML(self): 235 regForm = self._conf.getRegistrationForm() 236 eventForm = regForm.getSocialEventForm() 237 events = eventForm.getSocialEventList() 238 checked="" 239 if self._filterCrit.getField("event").getShowNoValue(): 240 checked=" checked" 241 res=[ _("""<input type="checkbox" name="eventShowNoValue" value="--none--"%s> --_("not specified")--""")%checked] 242 for event in events: 243 checked="" 244 if event.getId() in self._filterCrit.getField("event").getValues(): 245 checked=" checked" 246 res.append("""<input type="checkbox" name="event" value=%s%s>%s"""%(quoteattr(str(event.getId())),checked,self.htmlText(event.getCaption()))) 247 return "<br>".join(res) 194 195 options = [ 196 ('accomm', regForm.getAccommodationForm()), 197 ('event', regForm.getSocialEventForm()), 198 (self._sessionFilterName, regForm.getSessionsForm()) 199 ] 200 201 p = WFilterCriteria(options, self._filterCrit) 202 203 return p.getHTML() 248 204 249 205 def _getStatusesHTML(self): … … 503 459 504 460 def _getFilterMenu(self): 505 menu = _("""<div class="CRLDiv" style="display: none;" id="filterMenu"><table width="95%%" align="center" border="0"> 506 <tr> 507 <td> 508 <table width="100%%"> 509 <tr> 510 </tr> 511 <tr> 512 <td> 513 <table align="center" cellspacing="0" width="100%%"> 514 <tr> 515 <td width="33%%" class="titleCellFormat" style="border-bottom: 1px solid #888;">%(accomtitle)s %(checkAcco)s%(uncheckAcco)s</td> 516 <td width="33%%"class="titleCellFormat" style="border-bottom: 1px solid #888;">%(eventtitle)s %(checkEvent)s%(uncheckEvent)s</td> 517 <td width="33%%"class="titleCellFormat" style="border-bottom: 1px solid #888;">%(sesstitle)s %(checkSession)s%(uncheckSession)s</td> 518 </tr> 519 <tr> 520 <td valign="top" >%(acom)s</td> 521 <td valign="top" >%(eve)s</td> 522 <td valign="top">%(ses)s</td> 523 </tr> 524 </table> 525 </td> 526 </tr> 461 menu = _("""<div class="CRLDiv" style="display: none;" id="filterMenu"> 462 %(filterBoxes)s 527 463 """) 528 464 if self._conf.getRegistrationForm().getStatusesList(): 529 menu += _("""<tr> 530 <td> 531 <table align="center" cellspacing="0" width="100%%"> 465 menu += _("""<table align="center" cellspacing="0" width="100%%"> 532 466 <tr> 533 467 <td align="left" class="titleCellFormat" style="border-bottom: 1px solid #888; padding-right:10px"> _("Statuses") %(checkStatuses)s%(uncheckStatuses)s</td> … … 537 471 </tr> 538 472 </table> 539 </td> 540 </tr>""") 541 menu += _(""" 542 <tr> 543 <td align="center" ><input type="submit" class="btn" name="OK" value= _("apply filter")></td> 544 </tr> 545 </table> 546 </td> 547 </tr> 548 </table></div>""") 473 """) 474 menu += _("""<div style="text-align: center;"><input type="submit" class="btn" name="OK" value= _("Apply filter")></div></div>""") 549 475 550 476 return menu … … 620 546 vars["pdfUrl"] = quoteattr(str(Config.getInstance().getSystemIconURL("pdf"))) 621 547 vars["excelUrl"] = quoteattr(str(Config.getInstance().getSystemIconURL("excel"))) 622 vars ["acom"] = self._getAcomHTML() 623 vars ["ses"]=self._getSessHTML() 624 vars ["eve"]+=self._getEventHTML() 548 vars ["filterBoxes"] = self._getFilterBoxesHTML() 625 549 vars ["status"]= self._getStatusesHTML() 626 550 vars ["disp"]= self._getDispHTML() … … 661 585 662 586 class WRegistrantsFilterStatuses (wcomponents.WTemplated): 587 663 588 def __init__(self, statuses, filter, statusObjects): 664 589 wcomponents.WTemplated.__init__(self) … … 676 601 677 602 return vars 603 604 605 606 class WFilterCriteria(wcomponents.WTemplated): 607 """ 608 Draws the options for a filter criteria object 609 This means rendering the actual table that contains 610 all the HTML for the several criteria 611 """ 612 613 def __init__(self, options, filterCrit): 614 wcomponents.WTemplated.__init__(self) 615 self._filterCrit = filterCrit 616 self._options = options 617 618 def _drawFieldOptions(self, formName, form): 619 620 # since sessions have a special extra checkbox ("only by first choice"), 621 # we need to use a different template 622 623 if formName in ['session', 'sessionfirstpriority']: 624 page = WFilterSessionCriterionOptions(formName, form, self._filterCrit) 625 else: 626 page = WFilterCriterionOptions(formName, form, self._filterCrit) 627 628 # TODO: remove when we have a better template system 629 return page.getHTML().replace('%','%%') 630 631 def getVars(self): 632 633 vars = wcomponents.WTemplated.getVars( self ) 634 635 vars["content"] = list((name, self._drawFieldOptions(name, form)) 636 for (name, form) in self._options) 637 return vars 638 639 640 class WFilterCriterionOptions(wcomponents.WTemplated): 641 """ 642 Draws the list of options (and checkboxes) for a specific filter criterion, 643 with all the checkboxes (properly checked if necessary) 644 """ 645 646 def __init__(self, formName, formData, filterCrit): 647 self._formName = formName 648 self._formData = formData 649 self._filterCrit = filterCrit 650 651 def getVars(self): 652 parentVars = wcomponents.WTemplated.getVars( self ) 653 parentVars["critFormName"] = self._formName 654 parentVars["htmlFormName"] = self._formName 655 parentVars["form"] = self._formData 656 parentVars["filterCrit"] = self._filterCrit 657 658 return parentVars 659 660 661 class WFilterSessionCriterionOptions(WFilterCriterionOptions): 662 """ 663 Sub-class for the session "criterion", since it requires an 664 extra checkbox. 665 """ 666 667 def getVars(self): 668 parentVars = WFilterCriterionOptions.getVars( self ) 669 parentVars["htmlFormName"] = "session" 670 671 return parentVars 672 678 673 679 674 class WRegSentMail (wcomponents.WTemplated): -
indico/MaKaC/webinterface/rh/registrantsModif.py
rb03b51 r16926f 67 67 68 68 class RHRegistrantListModif( RHRegistrantListModifBase ): 69 """ 70 Registrant List - management area 71 Handles filtering and display of different columns 72 """ 73 69 74 _uh = urlHandlers.UHConfModifRegistrantList 70 75 71 76 def _resetFilters( self, sessionData ): 77 """ 78 Brings the filter data to a consistent state (websession), 79 marking everything as "checked" 80 """ 72 81 73 82 regForm = self._conf.getRegistrationForm() 74 accomm form = regForm.getAccommodationForm()75 laccomm= map(lambda accom: accom.getId(),76 accommform.getAccommodationTypesList())83 accommTypes = regForm.getAccommodationForm().getAccommodationTypesList() 84 sessionData["accomm"] = map(lambda accom: accom.getId(), 85 accommTypes) 77 86 78 87 lstatuses = [] 79 for st in self._conf.getRegistrationForm().getStatusesList():80 lstatuses.append(st.getCaption() +st.getId()+"-NoValue")88 for st in regForm.getStatusesList(): 89 lstatuses.append(st.getCaption() + st.getId() + "-NoValue") 81 90 for stInt in st.getStatusValues(): 82 lstatuses.append(st.getCaption()+st.getId()+"-"+st.getStatusValues()[stInt].getCaption()) 83 84 sessform =regForm.getSessionsForm() 85 sesstypes = sessform.getSessionList() 86 lsessions = map(lambda session: session.getId(), sesstypes) 87 88 eventForm = regForm.getSocialEventForm() 89 events = eventForm.getSocialEventList() 90 levents = map(lambda event: event.getId(), events) 91 92 sessionData["accomm"] = laccomm 91 lstatuses.append(st.getCaption() + st.getId() + "-" + 92 st.getStatusValues()[stInt].getCaption()) 93 93 sessionData["statuses"] = lstatuses 94 sessionData[self._sessionFilterName] = lsessions 95 sessionData["event"] = levents 96 94 95 sessTypes = regForm.getSessionsForm().getSessionList() 96 sessionData["session"] = map(lambda session: session.getId(), sessTypes) 97 98 socialEvents = regForm.getSocialEventForm().getSocialEventList() 99 sessionData["event"] = map(lambda event: event.getId(), socialEvents) 100 101 # By default, check '--none--' 97 102 sessionData["accommShowNoValue"] = True 98 103 sessionData["sessionShowNoValue"] = True 99 104 sessionData["eventShowNoValue"] = True 100 sessionData["statusesShowNoValue"] = True101 105 102 106 return sessionData 103 107 104 108 def _updateFilters( self, sessionData, params ): 109 """ 110 Updates the filter parameters in the websession with those 111 coming from the HTTP request 112 """ 105 113 106 114 sessionData['event'] = [] 107 115 sessionData['accomm'] = [] 108 116 sessionData['statuses'] = [] 109 sessionData['session'] = []110 sessionData['sessionfirstpriority'] = []111 117 112 118 sessionData.update(params) 113 sessionData[ self._sessionFilterName] = params.get('session',[])119 sessionData['session'] = utils.normalizeToList(params.get('session',[])) 114 120 115 121 # update these elements in the session so that the parameters that are … … 121 127 sessionData['eventShowNoValue'] = params.has_key('eventShowNoValue') 122 128 sessionData['sessionShowNoValue'] = params.has_key('sessionShowNoValue') 123 sessionData[' statusesShowNoValue'] = params.has_key('statusesShowNoValue')129 sessionData['firstChoice'] = params.has_key("firstChoice") 124 130 125 131 return sessionData 126 132 127 def _checkFilterParams( self, params, filtersActive, sessionData, operation ): 133 def _buildFilteringCriteria(self, sessionData): 134 """ 135 Creates the Filtering Criteria object, without changint the existing 136 session data (sessionData is cloned, not directly changed) 137 """ 138 sessionCopy = sessionData.copy() 139 140 # filtering criteria needs a proper "filter name" 141 del sessionCopy['session'] 142 sessionCopy[self._sessionFilterName] = sessionData['session'] 143 144 # Build the filtering criteria 145 filterCrit = regFilters.RegFilterCrit(self._conf, sessionCopy) 146 147 filterCrit.getField("accomm").setShowNoValue( 148 sessionCopy.get("accommShowNoValue") ) 149 filterCrit.getField(self._sessionFilterName).setShowNoValue( 150 sessionCopy.get("sessionShowNoValue") ) 151 filterCrit.getField("event").setShowNoValue( 152 sessionCopy.get("eventShowNoValue") ) 153 154 return filterCrit 155 156 def _checkAction( self, params, filtersActive, sessionData, operation ): 157 """ 158 Decides what to do with the request parameters, depending 159 on the type of operation that is requested 160 """ 128 161 129 162 # user chose to reset the filters … … 131 164 self._filterUsed = False 132 165 sessionData = self._resetFilters(sessionData) 166 133 167 # user set the filters 134 168 elif operation == 'setFilters': 135 169 self._filterUsed = True 136 170 sessionData = self._updateFilters(sessionData, params) 171 137 172 # user has changed the display options 138 173 elif operation == 'setDisplay': 139 174 self._filterUsed = filtersActive 140 175 sessionData['disp'] = params.get('disp',[]) 176 141 177 # session is empty (first time) 142 178 elif not filtersActive: … … 153 189 154 190 def _checkParams( self, params ): 191 """ 192 Main parameter checking routine 193 """ 155 194 156 195 RHRegistrantListModifBase._checkParams(self, params) … … 191 230 self._sessionFilterName="session" 192 231 193 sessionData = self._checkFilterParams(params, filtersActive, sessionData, operation) 194 195 196 self._filterCrit = regFilters.RegFilterCrit(self._conf, sessionData) 197 198 199 self._filterCrit.getField("accomm").setShowNoValue( 200 sessionData.get("accommShowNoValue") ) 201 self._filterCrit.getField(self._sessionFilterName).setShowNoValue( 202 sessionData.get("sessionShowNoValue") ) 203 self._filterCrit.getField("event").setShowNoValue( 204 sessionData.get("eventShowNoValue") ) 205 self._filterCrit.getField("statuses").setShowNoValue( 206 sessionData.get("statusesShowNoValue") ) 232 sessionData = self._checkAction(params, filtersActive, sessionData, operation) 233 234 # Maintain the state abotu filter usage 235 sessionData['filtersActive'] = self._filterUsed; 236 237 # Save the web session 238 websession.setVar("registrantsFilterAndSortingConf%s"%self._conf.getId(), sessionData) 239 240 self._filterCrit = self._buildFilteringCriteria(sessionData) 207 241 208 242 self._sortingCrit = regFilters.SortingCriteria( [sessionData.get( "sortBy", "Name" ).strip()] ) 209 243 210 211 244 self._order = sessionData.get("order","down") 212 245 213 self._display = sessionData.get("disp",[]) 214 215 # normalize ? 216 if not isinstance(self._display, list): 217 self._display = [self._display] 218 219 sessionData['filtersActive'] = self._filterUsed; 220 websession.setVar("registrantsFilterAndSortingConf%s"%self._conf.getId(), sessionData) 246 self._display = utils.normalizeToList(sessionData.get("disp",[])) 221 247 222 248 … … 227 253 228 254 class RHRegistrantListModifAction( RHRegistrantListModifBase ): 229 230 255 def _checkParams( self, params ): 231 256 RHRegistrantListModifBase._checkParams(self, params) -
indico/MaKaC/webinterface/tpls/ConfModifRegistrants.tpl
r553e39 r16926f 2 2 <!-- 3 3 var newUser = false; 4 5 function selectAcco()6 {7 document.filterOptionForm.accommShowNoValue.checked=true8 if (!document.filterOptionForm.accomm.length)9 {10 document.filterOptionForm.accomm.checked=true11 }else{12 for (i = 0; i < document.filterOptionForm.accomm.length; i++)13 {14 document.filterOptionForm.accomm[i].checked=true15 }16 }17 }18 19 function unselectAcco()20 {21 document.filterOptionForm.accommShowNoValue.checked=false22 if (!document.filterOptionForm.accomm.length)23 {24 document.filterOptionForm.accomm.checked=false25 }else{26 for (i = 0; i < document.filterOptionForm.accomm.length; i++)27 {28 document.filterOptionForm.accomm[i].checked=false29 }30 }31 }32 function selectEvent()33 {34 document.filterOptionForm.eventShowNoValue.checked=true35 if (!document.filterOptionForm.event.length)36 {37 document.filterOptionForm.event.checked=true38 }else{39 for (i = 0; i < document.filterOptionForm.event.length; i++)40 {41 document.filterOptionForm.event[i].checked=true42 }43 }44 }45 46 function unselectEvent()47 {48 document.filterOptionForm.eventShowNoValue.checked=false49 if (!document.filterOptionForm.event.length)50 {51 document.filterOptionForm.event.checked=false52 }else{53 for (i = 0; i < document.filterOptionForm.event.length; i++)54 {55 document.filterOptionForm.event[i].checked=false56 }57 }58 }59 function selectSession()60 {61 document.filterOptionForm.sessionShowNoValue.checked=true62 if (!document.filterOptionForm.session.length)63 {64 document.filterOptionForm.session.checked=true65 }else{66 for (i = 0; i < document.filterOptionForm.session.length; i++)67 {68 document.filterOptionForm.session[i].checked=true69 }70 }71 }72 73 function unselectSession()74 {75 document.filterOptionForm.sessionShowNoValue.checked=false76 if (!document.filterOptionForm.session.length)77 {78 document.filterOptionForm.session.checked=false79 }else{80 for (i = 0; i < document.filterOptionForm.session.length; i++)81 {82 document.filterOptionForm.session[i].checked=false;83 }84 }85 }86 4 87 5 function selectStatuses() -
indico/htdocs/css/Default.css
r9e3b7ff r16926f 5879 5879 right:0px; 5880 5880 } 5881 5882 .filterTable { 5883 border-collapse: collapse; 5884 }
Note: See TracChangeset
for help on using the changeset viewer.
