コード例 #1
0
 def _checkParams( self, params ):
     RHTrackAbstractsBase._checkParams(self,params)
     self._conf=self._track.getConference()
     filterUsed=params.has_key("OK")
     #sorting
     self._sortingCrit=ContribSortingCrit([params.get("sortBy","number").strip()])
     self._order = params.get("order","down")
     #filtering
     filter = {"author":params.get("authSearch","")}
     ltypes = []
     if not filterUsed:
         for type in self._conf.getContribTypeList():
             ltypes.append(type.getId())
     else:
         for id in self._normaliseListParam(params.get("types",[])):
             ltypes.append(id)
     filter["type"]=ltypes
     lsessions= []
     if not filterUsed:
         for session in self._conf.getSessionList():
             lsessions.append( session.getId() )
     filter["session"]=self._normaliseListParam(params.get("sessions",lsessions))
     lstatus=[]
     if not filterUsed:
         for status in ContribStatusList().getList():
             lstatus.append(ContribStatusList().getId(status))
     filter["status"]=self._normaliseListParam(params.get("status",lstatus))
     self._filterCrit=ContribFilterCrit(self._conf,filter)
     typeShowNoValue,sessionShowNoValue=True,True
     if filterUsed:
         typeShowNoValue =  params.has_key("typeShowNoValue")
         sessionShowNoValue =  params.has_key("sessionShowNoValue")
     self._filterCrit.getField("type").setShowNoValue(typeShowNoValue)
     self._filterCrit.getField("session").setShowNoValue(sessionShowNoValue)
コード例 #2
0
 def satisfies(self, contribution):
     """
     """
     if len(ContribStatusList().getList()) == len(self._values):
         return True
     stKlass = contribution.getCurrentStatus().__class__
     return ContribStatusList().getId(stKlass) in self._values
コード例 #3
0
 def _getStatusItemsHTML(self):
     res = []
     for st in ContribStatusList().getList():
         id = ContribStatusList().getId(st)
         checked = ""
         if id in self._filterCrit.getField("status").getValues():
             checked = " checked"
         code = ContribStatusList().getCode(st)
         caption = ContribStatusList().getCaption(st)
         res.append(
             """<input type="checkbox" name="status" value=%s%s> (%s) %s"""
             % (quoteattr(str(id)), checked, self.htmlText(code),
                self.htmlText(caption)))
     return "<br>".join(res)
コード例 #4
0
    def getExcelFile(self):
        excelGen = ExcelGenerator()
        excelGen.addValue("Id")
        excelGen.addValue("Date")
        excelGen.addValue("Duration")
        excelGen.addValue("Type")
        excelGen.addValue("Title")
        excelGen.addValue("Presenter")
        excelGen.addValue("Session")
        excelGen.addValue("Track")
        excelGen.addValue("Status")
        excelGen.addValue("Material")
        excelGen.newLine()

        for contrib in self._contribList:
            excelGen.addValue(contrib.getId())
            startDate = contrib.getAdjustedStartDate(self._tz)
            if startDate:
                excelGen.addValue(startDate.strftime("%A %d %b %Y at %H:%M"))
            else:
                excelGen.addValue("")
            excelGen.addValue((datetime(1900, 1, 1) +
                               contrib.getDuration()).strftime("%Hh%M'"))
            type = contrib.getType()
            if type:
                excelGen.addValue(type.getName())
            else:
                excelGen.addValue("")
            excelGen.addValue(contrib.getTitle())
            listSpeaker = []
            for speaker in contrib.getSpeakerList():
                listSpeaker.append(speaker.getFullName())
            excelGen.addValue("\n".join(listSpeaker))
            session = contrib.getSession()
            if session:
                excelGen.addValue(session.getTitle())
            else:
                excelGen.addValue("")
            track = contrib.getTrack()
            if track:
                excelGen.addValue(track.getTitle())
            else:
                excelGen.addValue("")
            status = contrib.getCurrentStatus()
            excelGen.addValue(ContribStatusList().getCaption(status.__class__))

            resource_list = []

            for attachment in contrib.attached_items.get('files', []):
                resource_list.append(attachment.absolute_download_url)

            for folder in contrib.attached_items.get('folders', []):
                for attachment in folder.attachments:
                    resource_list.append(attachment.absolute_download_url)

            excelGen.addValue("\n".join(resource_list))
            excelGen.newLine()

        return excelGen.getExcelContent()
コード例 #5
0
ファイル: excel.py プロジェクト: sylvestre/indico
    def getExcelFile(self):
        excelGen = ExcelGenerator()
        excelGen.addValue("Id")
        excelGen.addValue("Date")
        excelGen.addValue("Duration")
        excelGen.addValue("Type")
        excelGen.addValue("Title")
        excelGen.addValue("Presenter")
        excelGen.addValue("Session")
        excelGen.addValue("Track")
        excelGen.addValue("Status")
        excelGen.addValue("Material")
        excelGen.newLine()

        for contrib in self._contribList:
            excelGen.addValue(contrib.getId())
            startDate = contrib.getAdjustedStartDate(self._tz)
            if startDate:
                excelGen.addValue(startDate.strftime("%A %d %b %Y at %H:%M"))
            else:
                excelGen.addValue("")
            excelGen.addValue((datetime(1900, 1, 1) +
                               contrib.getDuration()).strftime("%Hh%M'"))
            type = contrib.getType()
            if type:
                excelGen.addValue(type.getName())
            else:
                excelGen.addValue("")
            excelGen.addValue(contrib.getTitle())
            listSpeaker = []
            for speaker in contrib.getSpeakerList():
                listSpeaker.append(speaker.getFullName())
            excelGen.addValue("\n".join(listSpeaker))
            session = contrib.getSession()
            if session:
                excelGen.addValue(session.getTitle())
            else:
                excelGen.addValue("")
            track = contrib.getTrack()
            if track:
                excelGen.addValue(track.getTitle())
            else:
                excelGen.addValue("")
            status = contrib.getCurrentStatus()
            excelGen.addValue(ContribStatusList().getCaption(status.__class__))
            listResource = []
            for material in contrib.getAllMaterialList():
                for resource in material.getResourceList():
                    if isinstance(resource, Link):
                        listResource.append(resource.getURL())
                    else:
                        listResource.append(
                            str(urlHandlers.UHFileAccess.getURL(resource)))
            excelGen.addValue("\n".join(listResource))
            excelGen.newLine()

        return excelGen.getExcelContent()
コード例 #6
0
 def _checkParams(self, params):
     RHSessionModCoordinationBase._checkParams(self, params)
     filterUsed = params.has_key("OK")
     #sorting
     self._sortingCrit = ContribSortingCrit(
         [params.get("sortBy", "number").strip()])
     self._order = params.get("order", "down")
     #filtering
     filter = {"author": params.get("authSearch", "")}
     ltypes = []
     if not filterUsed:
         for type in self._conf.getContribTypeList():
             ltypes.append(type.getId())
     else:
         for id in self._normaliseListParam(params.get("types", [])):
             ltypes.append(id)
     filter["type"] = ltypes
     ltracks = []
     if not filterUsed:
         for track in self._conf.getTrackList():
             ltracks.append(track.getId())
     filter["track"] = self._normaliseListParam(
         params.get("tracks", ltracks))
     lstatus = []
     if not filterUsed:
         for status in ContribStatusList().getList():
             lstatus.append(ContribStatusList().getId(status))
     filter["status"] = self._normaliseListParam(
         params.get("status", lstatus))
     lmaterial = []
     if not filterUsed:
         paperId = materialFactories.PaperFactory().getId()
         slidesId = materialFactories.SlidesFactory().getId()
         for matId in ["--other--", "--none--", paperId, slidesId]:
             lmaterial.append(matId)
     filter["material"] = self._normaliseListParam(
         params.get("material", lmaterial))
     self._filterCrit = ContribFilterCrit(self._conf, filter)
     typeShowNoValue, trackShowNoValue = True, True
     if filterUsed:
         typeShowNoValue = params.has_key("typeShowNoValue")
         trackShowNoValue = params.has_key("trackShowNoValue")
     self._filterCrit.getField("type").setShowNoValue(typeShowNoValue)
     self._filterCrit.getField("track").setShowNoValue(trackShowNoValue)
コード例 #7
0
 def _getContribHTML(self, contrib):
     sdate = ""
     if contrib.getAdjustedStartDate() is not None:
         sdate = contrib.getAdjustedStartDate().strftime("%Y-%b-%d %H:%M")
     title = """<a href=%s>%s</a>""" % (quoteattr(
         str(urlHandlers.UHContributionModification.getURL(contrib))),
                                        self.htmlText(contrib.getTitle()))
     strdur = ""
     if contrib.getDuration(
     ) is not None and contrib.getDuration().seconds != 0:
         strdur = (datetime(1900, 1, 1) +
                   contrib.getDuration()).strftime("%Hh%M'")
         dur = contrib.getDuration()
         self._totaldur = self._totaldur + dur
     l = []
     for spk in contrib.getSpeakerList():
         l.append(self.htmlText(spk.getFullName()))
     speaker = "<br>".join(l)
     track = ""
     if contrib.getTrack():
         track = self.htmlText(contrib.getTrack().getCode())
     cType = ""
     if contrib.getType() is not None:
         cType = contrib.getType().getName()
     status = ContribStatusList().getCode(
         contrib.getCurrentStatus().__class__)
     modify = self._session.canCoordinate(
         self._aw, "modifContribs") or self._session.canModify(self._aw)
     html = """
         <tr>
             <td><input type="checkbox" name="contributions" value=%s></td>
             <td valign="top" class="abstractLeftDataCell" nowrap>%s</td>
             <td valign="top" nowrap class="abstractDataCell">%s</td>
             <td valign="top" class="abstractDataCell">%s</td>
             <td valign="top" class="abstractDataCell">%s</td>
             <td valign="top" class="abstractDataCell">%s</td>
             <td valign="top" class="abstractDataCell">%s</td>
             <td valign="top" class="abstractDataCell">%s</td>
             <td valign="top" class="abstractDataCell">%s</td>
             <td valign="top" class="abstractDataCell">%s</td>
         </tr>
             """%(quoteattr(str(contrib.getId())),\
                 self.htmlText(contrib.getId()),sdate or "&nbsp;",\
                 strdur or "&nbsp;",cType or "&nbsp;",title or "&nbsp;", speaker or "&nbsp;",\
                 track or "&nbsp;", status or "&nbsp;", self._getMaterialsHTML(contrib, modify) or "&nbsp;")
     return html
コード例 #8
0
 def _getContribHTML(self, contrib):
     sdate = ""
     if contrib.getAdjustedStartDate() is not None:
         sdate = contrib.getAdjustedStartDate().strftime("%Y-%b-%d %H:%M")
     strdur = ""
     if contrib.getDuration(
     ) is not None and contrib.getDuration().seconds != 0:
         strdur = (datetime(1900, 1, 1) +
                   contrib.getDuration()).strftime("%Hh%M'")
         dur = contrib.getDuration()
         self._totaldur = self._totaldur + dur
     title = """<a href=%s>%s</a>""" % (quoteattr(
         str(urlHandlers.UHContributionModification.getURL(contrib))),
                                        self.htmlText(contrib.getTitle()))
     l = []
     for spk in contrib.getSpeakerList():
         l.append(self.htmlText(spk.getFullName()))
     speaker = "<br>".join(l)
     track = ""
     if contrib.getTrack():
         track = self.htmlText(contrib.getTrack().getCode())
     cType = ""
     if contrib.getType() is not None:
         cType = contrib.getType().getName()
     status = ContribStatusList().getCode(
         contrib.getCurrentStatus().__class__)
     attached_items = contrib.attached_items
     materials = None
     if attached_items:
         num_files = len(attached_items['files']) + sum(
             len(f.attachments) for f in attached_items['folders'])
         materials = '<a href="{}">{}</a>'.format(
             url_for('attachments.management', contrib),
             ngettext('1 file', '{num} files',
                      num_files).format(num=num_files))
     editURL = urlHandlers.UHSessionModContribListEditContrib.getURL(
         contrib)
     if self._currentSorting != "":
         editURL.addParam("sortBy", self._currentSorting)
     editIconURL = Config.getInstance().getSystemIconURL("modify")
     html = """
         <tr>
             <td><input type="checkbox" name="contributions" value=%s></td>
             <td valign="top" class="abstractLeftDataCell" nowrap>%s</td>
             <td valign="top" nowrap class="abstractDataCell">%s</td>
             <td valign="top" class="abstractDataCell">%s</td>
             <td valign="top" class="abstractDataCell">%s</td>
             <td valign="top" class="abstractDataCell"><a href=%s><img src=%s border="0" alt=""></a>%s</td>
             <td valign="top" class="abstractDataCell">%s</td>
             <td valign="top" class="abstractDataCell">%s</td>
             <td valign="top" class="abstractDataCell">%s</td>
             <td valign="top" class="abstractDataCell">%s</td>
             <td valign="top" class="abstractDataCell">%s</td>
         </tr>
             """ % (quoteattr(str(
         contrib.getId())), self.htmlText(contrib.getId()), sdate
                    or "&nbsp;", strdur or "&nbsp;", cType or "&nbsp;",
                    quoteattr(str(editURL)), quoteattr(str(editIconURL)),
                    title or "&nbsp;", speaker or "&nbsp;", track
                    or "&nbsp;", status or "&nbsp;", materials or "&nbsp;",
                    self.htmlText(contrib.getBoardNumber()) or "&nbsp;")
     return html
コード例 #9
0
 def satisfies(self, contribution):
     """
     """
     stKlass = contribution.getCurrentStatus().__class__
     return ContribStatusList().getId(stKlass) in self._values