def _getContribItems(self): res = [] #available contributions to a session are those contributions which: # 1) are not included in any session # 2) are not withdrawn # 3) are not scheduled sc = contribFilters.SortingCriteria(["number"]) contribList = filters.SimpleFilter(None, sc).apply( self._session.getConference().getContributionList()) for contrib in contribList: if contrib.getSession() is not None or isinstance( contrib.getCurrentStatus(), conference. ContribStatusWithdrawn) or contrib.isScheduled(): continue cType = "" if contrib.getType() is not None: cType = "%s" % contrib.getType().getName() spks = [ self.htmlText(spk.getFullName()) for spk in contrib.getSpeakerList() ] res.append(""" <tr> <td valgin="top"><input type="checkbox" name="manSelContribs" value=%s></td> <td valgin="top">%s</td> <td valgin="top">[%s]</td> <td valgin="top"><i>%s</i></td> <td valgin="top">%s</td> </tr> """%(quoteattr(str(contrib.getId())), \ self.htmlText(contrib.getId()),\ self.htmlText(cType), \ self.htmlText(contrib.getTitle()),\ "<br>".join(spks))) return "".join(res)
def _checkParams(self, params): RHConferenceTimeTable._checkParams(self, params) self._showSessions = self._normaliseListParam( params.get("showSessions", [])) if "all" in self._showSessions: self._showSessions.remove("all") self._showDays = self._normaliseListParam(params.get("showDays", [])) if "all" in self._showDays: self._showDays.remove("all") self._sortingCrit = None if params.has_key("sortBy") and params["sortBy"].strip() != "": self._sortingCrit = contribFilters.SortingCriteria( [params.get("sortBy", "number").strip()]) self._pagesize = params.get('pagesize', 'A4') self._fontsize = params.get('fontsize', 'normal') try: self._firstPageNumber = int(params.get('firstPageNumber', '1')) except ValueError: self._firstPageNumber = 1 self._showSpeakerAffiliation = False if params.has_key("showSpeakerAffiliation"): self._showSpeakerAffiliation = True # Keep track of the used layout for getting back after cancelling # the export. self._view = params.get( "view", displayMgr.ConfDisplayMgrRegistery().getDisplayMgr( self._target).getDefaultStyle())
def _handleGet(self): contributions = self._conf.getContributionList() filter = {} #filtering if the active user is a referee: he can only see his own contribs isOnlyReferee = RCReferee.hasRights(self) \ and not RCPaperReviewManager.hasRights(self) \ and not self._conf.canModify(self.getAW()) if isOnlyReferee: filter["referee"] = self._getUser() elif self._showWithReferee: filter["referee"] = "any" else: filter["referee"] = None if self._showWithEditor: filter["editor"] = "any" else: filter["editor"] = None if self._showWithReviewer: filter["reviewer"] = "any" else: filter["reviewer"] = None #note by David: I added "if self._selTypes..." and the other ifs after this line, #in order to make the recording request load contributions work #but, it may break the paper reviewing module -> assign contributions filter if self._selTypes: filter["type"] = self._selTypes if self._selTracks: filter["track"] = self._selTracks if self._selSessions: filter["session"] = self._selSessions if self._poster: filter["poster"] = self._poster filterCrit = ContributionsReviewingFilterCrit(self._conf, filter) sortingCrit = contribFilters.SortingCriteria(["number"]) if self._selTypes: filterCrit.getField("type").setShowNoValue(self._typeShowNoValue) if self._selTracks: filterCrit.getField("track").setShowNoValue(self._trackShowNoValue) if self._selSessions: filterCrit.getField("session").setShowNoValue( self._sessionShowNoValue) if self._poster: filterCrit.getField("poster").setShowNoValue( self._posterShowNoValue) filterCrit.getField("referee").setShowNoValue(not isOnlyReferee) f = filters.SimpleFilter(filterCrit, sortingCrit) contributions = f.apply(contributions) return DictPickler.pickle(contributions)
def _handleGet(self): contributions = (Contribution.find( event_new=self._conf.as_event, is_deleted=False).options(joinedload('timetable_entry'), joinedload('paper_reviewing_roles'))) filter = {} #filtering if the active user is a referee: he can only see his own contribs isOnlyReferee = RCReferee.hasRights(self) \ and not RCPaperReviewManager.hasRights(self) \ and not self._conf.canModify(self.getAW()) # We want to make an 'or', not an 'and' of the reviewing assign status filter["reviewing"] = {} if isOnlyReferee: filter["reviewing"]["referee"] = self._getUser() elif self._showWithReferee: filter["reviewing"]["referee"] = "any" if self._showWithEditor: filter["reviewing"]["editor"] = "any" if self._showWithReviewer: filter["reviewing"]["reviewer"] = "any" filter["type"] = self._selTypes filter["track"] = self._selTracks filter["session"] = self._selSessions filter["materialsubmitted"] = self._showWithMaterial filterCrit = ContributionsReviewingFilterCrit(self._conf, filter) sortingCrit = contribFilters.SortingCriteria(["number"]) filterCrit.getField("type").setShowNoValue(self._typeShowNoValue) filterCrit.getField("track").setShowNoValue(self._trackShowNoValue) filterCrit.getField("session").setShowNoValue(self._sessionShowNoValue) filterCrit.getField("reviewing").setShowNoValue(self._showWithoutTeam) filterCrit.getField("materialsubmitted").setShowNoValue( self._showWithoutMaterial) f = filters.SimpleFilter(filterCrit, sortingCrit) contributions = f.apply(contributions) return [_serialize_contribution(contrib) for contrib in contributions]
def testSorting( self ): from MaKaC.conference import Contribution, ContributionType, Session, Track from MaKaC.webinterface.common import contribFilters from MaKaC.common.filters import SimpleFilter contrib1 = Contribution() contrib2 = Contribution() contrib3 = Contribution() self._conf.addContribution( contrib1 ) self._conf.addContribution( contrib2 ) self._conf.addContribution( contrib3 ) # Sorting by ID sortingCrit = contribFilters.SortingCriteria( ["number"] ) f = SimpleFilter( None, sortingCrit ) contribList = f.apply(self._conf.getContributionList()) self.assert_( len(contribList) == 3 ) self.assert_( contribList[0] == contrib1 ) self.assert_( contribList[1] == contrib2 ) self.assert_( contribList[2] == contrib3 ) #Sorting by Date contrib1.setStartDate(datetime(2004, 5, 1, 10, 30,tzinfo=timezone('UTC'))) contrib2.setStartDate(datetime(2003, 5, 1, 10, 30,tzinfo=timezone('UTC'))) sortingCrit = contribFilters.SortingCriteria( ["date"] ) f = SimpleFilter( None, sortingCrit ) contribList = f.apply(self._conf.getContributionList()) self.assert_( len(contribList) == 3 ) self.assert_( contribList[0] == contrib2 ) self.assert_( contribList[1] == contrib1 ) self.assert_( contribList[2] == contrib3 ) # Sorting by Contribution Type contribType1 = ContributionType("oral presentation", "no description", self._conf) contribType2 = ContributionType("poster", "no description", self._conf) contrib1.setType(contribType1) contrib2.setType(contribType2) sortingCrit = contribFilters.SortingCriteria( ["type"] ) f = SimpleFilter( None, sortingCrit ) contribList = f.apply(self._conf.getContributionList()) self.assert_( len(contribList) == 3 ) self.assert_( contribList[0] == contrib1 ) self.assert_( contribList[1] == contrib2 ) self.assert_( contribList[2] == contrib3 ) # Sorting by Session session1 = Session() self._conf.addSession(session1) session2 = Session() self._conf.addSession(session2) contrib1.setSession(session1) contrib2.setSession(session2) sortingCrit = contribFilters.SortingCriteria( ["session"] ) f = SimpleFilter( None, sortingCrit ) contribList = f.apply(self._conf.getContributionList()) self.assert_( len(contribList) == 3 ) self.assert_(contrib1 in contribList) self.assert_(contrib2 in contribList) self.assert_(contrib3 in contribList) # Sorting by Track track1 = Track() track1.setTitle("3") track1.setConference(self._conf) track2 = Track() track2.setTitle("1") track2.setConference(self._conf) contrib1.setTrack(track1) contrib2.setTrack(track2) sortingCrit = contribFilters.SortingCriteria( ["track"] ) f = SimpleFilter( None, sortingCrit ) contribList = f.apply(self._conf.getContributionList()) self.assert_( len(contribList) == 3 ) self.assert_( contribList[0] == contrib2 ) self.assert_( contribList[1] == contrib1 ) self.assert_( contribList[2] == contrib3 )