Ignore:
Timestamp:
10/21/09 15:00:04 (4 years ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, 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:
9881d7
Parents:
924ae4 (diff), 242192 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Pedro Ferreira <jose.pedro.ferreira@…> (10/21/09 14:59:13)
git-committer:
Pedro Ferreira <jose.pedro.ferreira@…> (10/21/09 15:00:04)
Message:

Merge branch 'v0.97-series'

  • Timetable management, etc;

Conflicts:

indico/MaKaC/conference.py
indico/MaKaC/webinterface/pages/conferences.py
indico/MaKaC/webinterface/rh/base.py
indico/MaKaC/webinterface/rh/conferenceModif.py
indico/htdocs/css/Default.css
indico/htdocs/js/indico/Core/Effects.js
indico/htdocs/js/indico/Management/RoomBooking.js

File:
1 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/PDFinterface/conference.py

    r9033fd r0c8aad  
    8080 
    8181class ProgrammeToPDF(PDFBase): 
    82      
     82 
    8383    def __init__(self, conf, doc=None, story=None, tz=None): 
    8484        self._conf = conf 
     
    8989        PDFBase.__init__(self, doc, story) 
    9090        self._title = _("Conference Scientific Programme") 
    91              
     91 
    9292    def firstPage(self, c, doc): 
    9393        c.saveState() 
     
    114114        c.drawRightString(self._PAGE_WIDTH - inch, 0.75 * inch, nowutc().strftime("%A %d %B %Y")) 
    115115        c.restoreState() 
    116      
     116 
    117117    def laterPages(self, c, doc): 
    118118        c.saveState() 
     
    121121        c.drawRightString(self._PAGE_WIDTH - inch, self._PAGE_HEIGHT - 0.75 * inch, nowutc().strftime("%A %d %B %Y")) 
    122122        c.restoreState() 
    123      
     123 
    124124    def getBody(self, story=None): 
    125125        if not story: 
     
    128128        style.alignment = TA_JUSTIFY 
    129129        for track in self._conf.getTrackList(): 
    130          
     130 
    131131            bogustext = track.getTitle() 
    132132            p = Paragraph(bogustext, styles["Heading1"]) 
     
    140140 
    141141class AbstractToPDF(PDFBase): 
    142      
     142 
    143143    def __init__(self, conf, abstract, doc=None, story=None, tz=None): 
    144144        self._conf = conf 
     
    154154        self._PAGE_HEIGHT = defaultPageSize[1] 
    155155        self._PAGE_WIDTH = defaultPageSize[0] 
    156      
     156 
    157157    def firstPage(self, c, doc): 
    158158        c.saveState() 
     
    172172        if not showLogo: 
    173173            self._drawWrappedString(c, escape(self._conf.getTitle()), height=self._PAGE_HEIGHT - 2*inch) 
    174              
     174 
    175175        c.setFont('Times-Bold', 25) 
    176176        #c.drawCentredString(self._PAGE_WIDTH/2, self._PAGE_HEIGHT - inch - 5*cm, self._abstract.getTitle()) 
     
    203203            text= _("""<b> _("Contribution type")</b> : %s""")%escape(str(self._abstract.getContribType())) 
    204204        return text 
    205      
     205 
    206206    def getBody(self, story=None, indexedFlowable={}, level=1 ): 
    207207        if not story: 
    208208            story = self._story 
    209          
     209 
    210210        style = ParagraphStyle({}) 
    211211        style.fontSize = 12 
     
    213213        p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
    214214        story.append(p) 
    215          
     215 
    216216        story.append(Spacer(inch, 0.5*cm, part=escape(self._abstract.getTitle()))) 
    217          
    218         style = ParagraphStyle({})         
     217 
     218        style = ParagraphStyle({}) 
    219219        style.alignment = TA_CENTER 
    220220        style.fontSize = 25 
     
    223223        p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
    224224        story.append(p) 
    225          
     225 
    226226        indexedFlowable[p] = {"text":escape(self._abstract.getTitle()), "level":1} 
    227          
     227 
    228228        style = ParagraphStyle({}) 
    229229        style.fontName = "LinuxLibertine" 
     
    237237        #p = Preformatted(escape(res), style, part=escape(self._abstract.getTitle())) 
    238238        #story.append(p) 
    239          
     239 
    240240        story.append(Spacer(inch, 0.5*cm, part=escape(self._abstract.getTitle()))) 
    241241 
     
    244244            name = field.getName() 
    245245            value = self._abstract.getField(id).strip() 
    246             if value: #id not in ["content"] and  
     246            if value: #id not in ["content"] and 
    247247                styleHead = ParagraphStyle({}) 
    248248                styleHead.firstLineIndent = -45 
     
    250250                text = "<b>%s</b> :" % name 
    251251                p = Paragraph(text, styleHead, part=escape(self._abstract.getTitle())) 
    252                 story.append(p)     
     252                story.append(p) 
    253253                l=value.split("\n") 
    254254                res=[] 
     
    259259                story.append(p) 
    260260                story.append(Spacer(inch, 0.2*cm, part=escape(self._abstract.getTitle()))) 
    261          
     261 
    262262        style = ParagraphStyle({}) 
    263263        style.firstLineIndent = -80 
     
    270270        p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
    271271        story.append(p) 
    272          
     272 
    273273        story.append(Spacer(inch, 0.2*cm)) 
    274          
     274 
    275275        style = ParagraphStyle({}) 
    276276        style.firstLineIndent = -35 
     
    281281            listAuthor.append( "%s (%s)"%(escape(author.getFullName()), escape(author.getAffiliation()) )  ) 
    282282        text += " ; ".join(listAuthor) 
    283          
     283 
    284284        p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
    285285        story.append(p) 
    286          
     286 
    287287        story.append(Spacer(inch, 0.2*cm, part=escape(self._abstract.getTitle()))) 
    288          
     288 
    289289        style = ParagraphStyle({}) 
    290290        style.firstLineIndent = -45 
     
    297297        p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
    298298        story.append(p) 
    299          
     299 
    300300        story.append(Spacer(inch, 0.5*cm, part=escape(self._abstract.getTitle()))) 
    301301        style = ParagraphStyle({}) 
     
    304304        p = Paragraph(self._getTrackText(), style, part=escape(self._abstract.getTitle())) 
    305305        story.append(p) 
    306          
     306 
    307307        story.append(Spacer(inch, 0.2*cm, part=escape(self._abstract.getTitle()))) 
    308308        tmp= _("""--_("not specified")--""") 
     
    312312        p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
    313313        story.append(p) 
    314          
     314 
    315315        story.append(Spacer(inch, 0.2*cm, part=escape(self._abstract.getTitle()))) 
    316          
     316 
    317317        text = _("""<b> _("Submitted by")</b> : %s""")%escape(self._abstract.getSubmitter().getFullName()) 
    318318        p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
    319319        story.append(p) 
    320          
     320 
    321321        story.append(Spacer(inch, 0.2*cm, part=escape(self._abstract.getTitle()))) 
    322          
     322 
    323323        text = _("""<b> _("Submitted on")</b> %s""")%self._abstract.getSubmissionDate().strftime("%A %d %B %Y") 
    324324        p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
    325325        story.append(p) 
    326          
     326 
    327327        story.append(Spacer(inch, 0.2*cm, part=escape(self._abstract.getTitle()))) 
    328          
     328 
    329329        text = _("""<b> _("Last modified on")</b> : %s""")%self._abstract.getModificationDate().strftime("%A %d %B %Y") 
    330330        p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
    331331        story.append(p) 
    332          
     332 
    333333        story.append(Spacer(inch, 0.2*cm, part=escape(self._abstract.getTitle()))) 
    334          
     334 
    335335        text = _("""<b> _("Comments")</b> : """) 
    336336        p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
    337337        story.append(p) 
    338          
     338 
    339339        style = ParagraphStyle({}) 
    340340        style.leftIndent = 40 
     
    342342        p = Preformatted(text, style, part=escape(self._abstract.getTitle())) 
    343343        story.append(p) 
    344          
     344 
    345345        return story 
    346          
     346 
    347347 
    348348class AbstractsToPDF(PDFWithTOC): 
    349      
     349 
    350350    def __init__(self, conf, abstractList, tz=None): 
    351351        self._conf = conf 
     
    357357        self._title = _("Abstracts book") 
    358358        PDFWithTOC.__init__(self) 
    359          
     359 
    360360    def firstPage(self, c, doc): 
    361361        c.saveState() 
     
    375375        if not showLogo: 
    376376            self._drawWrappedString(c, escape(self._conf.getTitle()), height=self._PAGE_HEIGHT - 2*inch) 
    377              
     377 
    378378        c.setFont('Times-Bold', 35) 
    379379        c.drawCentredString(self._PAGE_WIDTH/2, self._PAGE_HEIGHT/2, self._title) 
     
    383383        c.drawString(0.5*inch, 0.5*inch, str(urlHandlers.UHConferenceDisplay.getURL(self._conf))) 
    384384        c.restoreState() 
    385      
     385 
    386386    def laterPages(self, c, doc): 
    387          
     387 
    388388        c.saveState() 
    389389        c.setFont('Times-Roman', 9) 
     
    400400        c.drawString(inch,  0.75 * inch, nowutc().strftime("%A %d %B %Y")) 
    401401        c.restoreState() 
    402      
    403      
     402 
     403 
    404404    def getBody(self): 
    405405        for abstract in self._abstracts: 
     
    410410 
    411411class ConfManagerAbstractToPDF(AbstractToPDF): 
    412      
     412 
    413413    def _getTrackText(self): 
    414414        text = _("""<b> _("Track classification")</b> : """) 
     
    453453        p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
    454454        story.append(p) 
    455          
     455 
    456456        for track in self._abstract.getTrackListSorted(): 
    457457            status = self._abstract.getTrackJudgement(track) 
     
    482482                modifier = "" 
    483483                comments = "" 
    484              
     484 
    485485            story.append(Spacer(inch, 0.5*cm, part=escape(self._abstract.getTitle()))) 
    486              
     486 
    487487            status = self._abstract.getCurrentStatus() 
    488488            style = ParagraphStyle({}) 
     
    492492            p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
    493493            story.append(p) 
    494              
     494 
    495495            story.append(Spacer(inch, 0.1*cm, part=escape(self._abstract.getTitle()))) 
    496              
     496 
    497497            status = self._abstract.getCurrentStatus() 
    498498            style = ParagraphStyle({}) 
     
    502502            p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
    503503            story.append(p) 
    504              
     504 
    505505            #story.append(Spacer(inch, 0.1*cm, part=self._abstract.getTitle())) 
    506              
     506 
    507507            status = self._abstract.getCurrentStatus() 
    508508            style = ParagraphStyle({}) 
     
    512512            p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
    513513            story.append(p) 
    514              
     514 
    515515            #story.append(Spacer(inch, 0.1*cm, part=self._abstract.getTitle())) 
    516              
     516 
    517517            status = self._abstract.getCurrentStatus() 
    518518            style = ParagraphStyle({}) 
     
    522522            p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
    523523            story.append(p) 
    524              
     524 
    525525            #story.append(Spacer(inch, 0.1*cm, part=self._abstract.getTitle())) 
    526              
     526 
    527527            status = self._abstract.getCurrentStatus() 
    528528            style = ParagraphStyle({}) 
     
    535535 
    536536class ConfManagerAbstractsToPDF(AbstractsToPDF): 
    537      
     537 
    538538    def getBody(self): 
    539539        for abstract in self._abstracts: 
     
    544544 
    545545class TrackManagerAbstractToPDF(AbstractToPDF): 
    546      
     546 
    547547    def __init__(self, conf, abstract, track, doc=None, story=None, tz=None): 
    548548        AbstractToPDF.__init__(self, conf, abstract, doc, story, tz=tz) 
     
    562562        text= _("""<b> _("Contribution type")</b> : %s""")%escape(str(self._abstract.getContribType())) 
    563563        return text 
    564      
     564 
    565565    def getBody(self, story=None, indexedFlowable={}, level=1 ): 
    566566        if not story: 
     
    568568        #get the common abstract content from parent 
    569569        AbstractToPDF.getBody(self, story, indexedFlowable, level ) 
    570          
     570 
    571571        #add info for the track manager 
    572572        status=AbstractStatusTrackViewFactory.getStatus(self._track,self._abstract) 
     
    621621            if modifier or modifDate: 
    622622                text += " (%s)"%" - ".join( [modifier, modifDate]) 
    623              
     623 
    624624        else: 
    625625            text = _("""<b> _("Status")</b> : _("SUBMITTED")""") 
    626626        p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
    627627        story.append(p) 
    628          
    629          
    630          
     628 
     629 
     630 
    631631        #story.append(Spacer(inch, 0.1*cm, part=self._abstract.getTitle())) 
    632          
     632 
    633633        if res: 
    634634            status = self._abstract.getCurrentStatus() 
     
    638638            p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
    639639            story.append(p) 
    640          
    641          
     640 
     641 
    642642        if comments: 
    643643            status = self._abstract.getCurrentStatus() 
     
    647647            p = Paragraph(text, style, part=escape(self._abstract.getTitle())) 
    648648            story.append(p) 
    649          
     649 
    650650        story.append(Spacer(inch, 0.2*cm, part=escape(self._abstract.getTitle()))) 
    651          
     651 
    652652        if conflictText: 
    653653            style = ParagraphStyle({}) 
     
    655655            p = Paragraph( _(""" _("In conflict with"): """), style, part=escape(self._abstract.getTitle())) 
    656656            story.append(p) 
    657              
     657 
    658658            style = ParagraphStyle({}) 
    659659            style.leftIndent = 60 
     
    663663 
    664664class TrackManagerAbstractsToPDF(AbstractsToPDF): 
    665      
     665 
    666666    def __init__(self, conf, track, abstractList, tz=None): 
    667667        AbstractsToPDF.__init__(self, conf, abstractList, tz) 
    668668        self._track = track 
    669      
     669 
    670670    def getBody(self): 
    671671        for abstract in self._abstracts: 
     
    676676 
    677677class ContribToPDF(PDFBase): 
    678      
     678 
    679679    def __init__(self, conf, contrib, doc=None, story=None, tz=None): 
    680680        self._conf = conf 
     
    690690        self._PAGE_HEIGHT = defaultPageSize[1] 
    691691        self._PAGE_WIDTH = defaultPageSize[0] 
    692      
     692 
    693693    def firstPage(self, c, doc): 
    694694        c.saveState() 
     
    717717        #c.drawString(0.5*inch, 0.5*inch, Config.getInstance().getBaseURL()) 
    718718        c.restoreState() 
    719      
     719 
    720720    def getBody(self, story=None, indexedFlowable={}, level=1 ): 
    721721        if not story: 
    722722            story = self._story 
    723          
     723 
    724724        style = ParagraphStyle({}) 
    725725        style.fontSize = 12 
     
    727727        p = Paragraph(text, style, part=escape(self._contrib.getTitle())) 
    728728        story.append(p) 
    729          
     729 
    730730        story.append(Spacer(inch, 0.5*cm, part=escape(self._contrib.getTitle()))) 
    731          
    732         style = ParagraphStyle({})         
     731 
     732        style = ParagraphStyle({}) 
    733733        style.alignment = TA_CENTER 
    734734        style.fontSize = 25 
     
    737737        p = Paragraph(text, style, part=escape(self._contrib.getTitle())) 
    738738        story.append(p) 
    739          
     739 
    740740        if self._contrib.isScheduled(): 
    741             style = ParagraphStyle({})         
     741            style = ParagraphStyle({}) 
    742742            style.alignment = TA_CENTER 
    743743            style.fontSize = 12 
     
    746746            p = Paragraph(text, style, part=escape(self._contrib.getTitle())) 
    747747            story.append(p) 
    748          
     748 
    749749        indexedFlowable[p] = {"text":escape(self._contrib.getTitle()), "level":1} 
    750          
     750 
    751751        story.append(Spacer(inch, 1*cm, part=escape(self._contrib.getTitle()))) 
    752          
     752 
    753753        style = ParagraphStyle({}) 
    754754        style.fontName = "LinuxLibertine" 
    755755        style.fontSize = 9 
    756         p = Paragraph(escape(self._contrib.getDescription()), style, part=escape(self._contrib.getTitle())) 
    757         story.append(p) 
    758          
    759         story.append(Spacer(inch, 0.2*cm, part=escape(self._contrib.getTitle()))) 
    760          
     756        #p = Paragraph(escape(self._contrib.getDescription()), style, part=escape(self._contrib.getTitle())) 
     757        #story.append(p) 
     758 
     759        #story.append(Spacer(inch, 0.2*cm, part=escape(self._contrib.getTitle()))) 
     760 
    761761        for field in self._conf.getAbstractMgr().getAbstractFieldsMgr().getActiveFields(): 
    762762            fid = field.getId() 
    763763            name = field.getName() 
    764764            value = self._contrib.getField(fid).strip() 
    765             if value: #id not in ["content"] and  
     765            if value: #id not in ["content"] and 
    766766                styleHead = ParagraphStyle({}) 
    767767                styleHead.firstLineIndent = -55 
    768768                styleHead.leftIndent = 45 
    769                 text = "<b>%s</b> :" % name  
     769                text = "<b>%s</b> :" % name 
    770770                p = Paragraph(text, styleHead, part=escape(self._contrib.getTitle())) 
    771                 story.append(p)     
     771                story.append(p) 
    772772                l=value.split("\n") 
    773773                res=[] 
     
    778778                story.append(p) 
    779779                story.append(Spacer(inch, 0.2*cm, part=escape(self._contrib.getTitle()))) 
    780          
     780 
    781781        story.append(Spacer(inch, 0.5*cm, part=escape(self._contrib.getTitle()))) 
    782          
     782 
    783783        style = ParagraphStyle({}) 
    784784        style.firstLineIndent = -80 
     
    791791        p = Paragraph(text, style, part=escape(self._contrib.getTitle())) 
    792792        story.append(p) 
    793          
     793 
    794794        story.append(Spacer(inch, 0.2*cm)) 
    795          
     795 
    796796        style = ParagraphStyle({}) 
    797797        style.firstLineIndent = -35 
     
    802802            listAuthor.append( "%s (%s)"%(escape(author.getFullName()), escape(author.getAffiliation()) )  ) 
    803803        text += " ; ".join(listAuthor) 
    804          
     804 
    805805        p = Paragraph(text, style, part=escape(self._contrib.getTitle())) 
    806806        story.append(p) 
    807          
     807 
    808808        story.append(Spacer(inch, 0.2*cm, part=escape(self._contrib.getTitle()))) 
    809          
     809 
    810810        style = ParagraphStyle({}) 
    811811        style.firstLineIndent = -45 
     
    818818        p = Paragraph(text, style, part=escape(self._contrib.getTitle())) 
    819819        story.append(p) 
    820          
     820 
    821821        story.append(Spacer(inch, 0.5*cm, part=escape(self._contrib.getTitle()))) 
    822822        style = ParagraphStyle({}) 
     
    831831        p = Paragraph(text, style, part=escape(self._contrib.getTitle())) 
    832832        story.append(p) 
    833          
     833 
    834834        story.append(Spacer(inch, 0.5*cm, part=escape(self._contrib.getTitle()))) 
    835          
     835 
    836836        style = ParagraphStyle({}) 
    837837        style.firstLineIndent = -90 
     
    845845        p = Paragraph(text, style, part=escape(self._contrib.getTitle())) 
    846846        story.append(p) 
    847          
     847 
    848848        story.append(Spacer(inch, 0.2*cm, part=escape(self._contrib.getTitle()))) 
    849          
     849 
    850850        tmp=_("""--_("not specified")--""") 
    851851        if self._contrib.getType(): 
     
    854854        p = Paragraph(text, style, part=escape(self._contrib.getTitle())) 
    855855        story.append(p) 
    856          
     856 
    857857        # TB: Do we really need to display the submitssion info of a contribution? 
    858858        #story.append(Spacer(inch, 0.2*cm, part=escape(self._contrib.getTitle()))) 
    859          
     859 
    860860        #text = "<b>Submitted by</b> : %s"%escape(self._contrib.getSubmitter().getFullName()) 
    861861        #p = Paragraph(text, style, part=escape(self._contrib.getTitle())) 
    862862        #story.append(p) 
    863          
     863 
    864864        return story 
    865          
     865 
    866866class ConfManagerContribToPDF(ContribToPDF): 
    867      
     867 
    868868    def getBody(self, story=None, indexedFlowable={}, level=1 ): 
    869869        if not story: 
    870870            story = self._story 
    871              
     871 
    872872        #get the common contribution content from parent 
    873873        ContribToPDF.getBody(self, story, indexedFlowable, level ) 
    874          
     874 
    875875        #add info for the conference manager 
    876876 
    877877 
    878878class ContributionBook(PDFBase): 
    879      
     879 
    880880    def __init__(self,conf,contribList,aw,tz=None): 
    881881        self._conf=conf 
     
    892892        self._doc.topMargin=1.5*cm 
    893893        self._doc.bottomMargin=1*cm 
    894              
     894 
    895895    def firstPage(self,c,doc): 
    896896        c.saveState() 
     
    909909        height-=2*cm 
    910910        c.drawCentredString(self._PAGE_WIDTH/2.0,height, 
    911                 "%s - %s"%(self._conf.getAdjustedStartDate(self._tz).strftime("%A %d %B %Y"),  
     911                "%s - %s"%(self._conf.getAdjustedStartDate(self._tz).strftime("%A %d %B %Y"), 
    912912                self._conf.getAdjustedEndDate(self._tz).strftime("%A %d %B %Y"))) 
    913913        if self._conf.getLocation(): 
     
    919919        c.drawCentredString(self._PAGE_WIDTH/2.0,height,\ 
    920920                self._title) 
    921         self._drawWrappedString(c, "%s / %s"%(self._conf.getTitle(),self._title), width=inch, height=0.75*inch, font='Times-Roman', size=9, color=(0.5,0.5,0.5), align="left", maximumWidth=self._PAGE_WIDTH-3.5*inch, measurement=inch, lineSpacing=0.15)      
     921        self._drawWrappedString(c, "%s / %s"%(self._conf.getTitle(),self._title), width=inch, height=0.75*inch, font='Times-Roman', size=9, color=(0.5,0.5,0.5), align="left", maximumWidth=self._PAGE_WIDTH-3.5*inch, measurement=inch, lineSpacing=0.15) 
    922922        c.drawRightString(self._PAGE_WIDTH-inch,0.75*inch, 
    923923                nowutc().strftime("%A %d %B %Y")) 
    924924        c.restoreState() 
    925      
     925 
    926926    def laterPages(self,c,doc): 
    927927        c.saveState() 
     
    10081008 
    10091009class ContribsToPDF(PDFWithTOC): 
    1010      
     1010 
    10111011    def __init__(self, conf, contribList, tz=None): 
    10121012        self._conf = conf 
     
    10181018        self._title = _("Contributions book") 
    10191019        PDFWithTOC.__init__(self) 
    1020          
     1020 
    10211021    def firstPage(self, c, doc): 
    10221022        c.saveState() 
     
    10451045        c.drawString(0.5*inch, 0.5*inch, str(urlHandlers.UHConferenceDisplay.getURL(self._conf))) 
    10461046        c.restoreState() 
    1047      
     1047 
    10481048    def laterPages(self, c, doc): 
    1049          
     1049 
    10501050        c.saveState() 
    10511051        c.setFont('Times-Roman', 9) 
     
    10621062        c.drawString(inch,  0.75 * inch, nowutc().strftime("%A %d %B %Y")) 
    10631063        c.restoreState() 
    1064      
    1065      
     1064 
     1065 
    10661066    def getBody(self): 
    10671067        for contrib in self._contribs: 
     
    10691069            temp.getBody(self._story, indexedFlowable=self._indexedFlowable, level=1) 
    10701070            self._story.append(PageBreak()) 
    1071          
     1071 
    10721072class ConfManagerContribsToPDF(ContribsToPDF): 
    1073      
     1073 
    10741074    def getBody(self): 
    10751075        for contrib in self._contribs: 
    10761076            temp = ConfManagerContribToPDF(self._conf, contrib,tz=self._tz) 
    10771077            temp.getBody(self._story, indexedFlowable=self._indexedFlowable, level=1) 
    1078             self._story.append(PageBreak())         
     1078            self._story.append(PageBreak()) 
    10791079 
    10801080class TimetablePDFFormat: 
     
    11021102        if not params.has_key("showContribId"): 
    11031103            self.contribId = False 
    1104              
     1104 
    11051105        self.speakerTitle = True 
    11061106        if not params.has_key("showSpeakerTitle"): 
    11071107            self.speakerTitle = False 
    1108              
     1108 
    11091109        self.contribAbstract = False 
    11101110        if params.has_key("showAbstract"): 
    11111111            self.contribAbstract = True 
    1112              
     1112 
    11131113        self.contribPosterAbstract = True 
    11141114        if params.has_key("dontShowPosterAbstract"): 
    11151115            self.contribPosterAbstract = False 
    1116          
     1116 
    11171117        self.newPagePerSession = False 
    11181118        if params.has_key("newPagePerSession"): 
     
    11461146        if not params.has_key("showCoverPage"): 
    11471147            self.coverPage = False 
    1148          
     1148 
    11491149        self.tableContents=True 
    11501150        if not params.has_key("showTableContents"): 
    11511151            self.tableContents = False 
    1152              
     1152 
    11531153        self.logo = False 
    11541154 
     
    11611161    def showContribAbstract(self): 
    11621162        return self.contribAbstract 
    1163      
     1163 
    11641164    def showContribPosterAbstract(self): 
    11651165        return self.contribPosterAbstract 
     
    11941194    def showTableContents(self): 
    11951195        return self.tableContents 
    1196         
     1196 
    11971197 
    11981198def sortEntries(x,y): 
     
    12061206 
    12071207class TimeTablePlain(PDFWithTOC): 
    1208      
     1208 
    12091209    def __init__(self,conf,aw,showSessions=[],showDays=[],sortingCrit=None, ttPDFFormat=None, 
    12101210                 pagesize='A4', fontsize = 'normal', firstPageNumber = '1', showSpeakerAffiliation=False, tz=None): 
     
    12581258            self._story.append(self._toc) 
    12591259            self._story.append(PageBreak()) 
    1260              
     1260 
    12611261    def firstPage(self,c,doc): 
    12621262        if self._ttPDFFormat.showCoverPage(): 
     
    12761276            height-=2*cm 
    12771277            c.drawCentredString(self._PAGE_WIDTH/2.0,height, 
    1278                     "%s - %s"%(self._conf.getAdjustedStartDate(self._tz).strftime("%A %d %B %Y"),  
     1278                    "%s - %s"%(self._conf.getAdjustedStartDate(self._tz).strftime("%A %d %B %Y"), 
    12791279                    self._conf.getAdjustedEndDate(self._tz).strftime("%A %d %B %Y"))) 
    12801280            if self._conf.getLocation(): 
     
    12891289                    nowutc().strftime("%A %d %B %Y")) 
    12901290            c.restoreState() 
    1291      
     1291 
    12921292    def laterPages(self,c,doc): 
    1293          
     1293 
    12941294        c.saveState() 
    12951295        maxi=self._PAGE_WIDTH-2*cm 
     
    13031303    def _defineStyles(self): 
    13041304        self._styles={} 
    1305          
     1305 
    13061306        dayStyle=getSampleStyleSheet()["Heading1"] 
    13071307        dayStyle.fontSize = modifiedFontSize(dayStyle.fontSize, self._fontsize) 
    13081308        self._styles["day"]=dayStyle 
    1309          
     1309 
    13101310        sessionTitleStyle=getSampleStyleSheet()["Heading2"] 
    13111311        sessionTitleStyle.fontSize = modifiedFontSize(12.0, self._fontsize) 
    13121312        self._styles["session_title"]=sessionTitleStyle 
    1313          
     1313 
    13141314        sessionDescriptionStyle=getSampleStyleSheet()["Heading2"] 
    13151315        sessionDescriptionStyle.fontSize = modifiedFontSize(10.0, self._fontsize) 
    13161316        self._styles["session_description"] = sessionDescriptionStyle 
    1317          
     1317 
    13181318        self._styles["table_body"]=getSampleStyleSheet()["Normal"] 
    1319          
     1319 
    13201320        convenersStyle=getSampleStyleSheet()["Normal"] 
    13211321        convenersStyle.fontSize = modifiedFontSize(10.0, self._fontsize) 
    13221322        convenersStyle.leftIndent=10 
    13231323        self._styles["conveners"]=convenersStyle 
    1324          
     1324 
    13251325        subContStyle=getSampleStyleSheet()["Normal"] 
    13261326        subContStyle.fontSize=modifiedFontSize(10.0, self._fontsize) 
     
    14051405        for subc in contrib.getSubContributionList(): 
    14061406            if not subc.canAccess(self._aw): 
    1407                 return             
     1407                return 
    14081408            lt=[] 
    14091409            captionText="- [%s] %s"%(escape(subc.getId()),escape(subc.getTitle())) 
     
    14401440                else: 
    14411441                    l.append(["",caption,speakers]) 
    1442              
     1442 
    14431443 
    14441444    def _processPosterContribution(self,contrib,l): 
     
    15561556        entriesOnDay=self._conf.getSchedule().getEntriesOnDay(day) 
    15571557        entriesOnDay.sort(sortEntries) 
    1558         for entry in entriesOnDay:     
     1558        for entry in entriesOnDay: 
    15591559            #Session slot 
    15601560            if isinstance(entry,schedule.LinkedTimeSchEntry) and \ 
     
    16181618                l=[] 
    16191619                ts = deepcopy(originalts) 
    1620                 if sessionSlot.getSession().getScheduleType()=="poster":  
     1620                if sessionSlot.getSession().getScheduleType()=="poster": 
    16211621                    if self._sortingCrit is not None: 
    16221622                        cl=[] 
     
    16611661                            date="%s"%escape(sEntry.getAdjustedStartDate(self._tz).strftime("%H:%M")) 
    16621662                            date=self._fontify(date,10) 
    1663                              
     1663 
    16641664                            lt=[] 
    16651665                            captionText="%s"%escape(sEntry.getTitle()) 
     
    17711771                    if self._ttPDFFormat.showNewPagePerSession(): 
    17721772                        res.append(PageBreak()) 
    1773                          
     1773 
    17741774        return res 
    17751775 
     
    17791779        if not story: 
    17801780            story=self._story 
    1781         if not self._ttPDFFormat.showCoverPage():  
     1781        if not self._ttPDFFormat.showCoverPage(): 
    17821782            s = ParagraphStyle({}) 
    17831783            s.fontName = "Times-Bold" 
     
    17881788            story.append(p) 
    17891789            story.append(Spacer(1,0.4*inch)) 
    1790              
     1790 
    17911791        currentDay=self._conf.getSchedule().getAdjustedStartDate(self._tz) 
    17921792        while currentDay.strftime("%Y-%m-%d")<=self._conf.getSchedule().getAdjustedEndDate(self._tz).strftime("%Y-%m-%d"): 
     
    18041804            self._indexedFlowable[p]={"text":currentDay.strftime("%A %d %B %Y"), "level":1} 
    18051805            for entry in dayEntries: 
    1806                 story.append(entry)  
     1806                story.append(entry) 
    18071807            if not self._ttPDFFormat.showNewPagePerSession(): 
    18081808                story.append(PageBreak()) 
     
    18101810 
    18111811class SimplifiedTimeTablePlain(PDFBase): 
    1812      
     1812 
    18131813    def __init__(self,conf,aw,showSessions=[],showDays=[],sortingCrit=None, ttPDFFormat=None, pagesize = 'A4', fontsize = 'normal', tz=None): 
    18141814        self._conf=conf 
     
    19631963            story.append(Spacer(1,0.4*inch)) 
    19641964            for entry in dayEntries: 
    1965                 story.append(entry)  
     1965                story.append(entry) 
    19661966            currentDay+=timedelta(days=1) 
    1967      
     1967 
    19681968class AbstractBook(PDFBase): 
    1969      
     1969 
    19701970    def __init__(self,conf,aw,sortBy,tz=None): 
    19711971        self._conf=conf 
     
    19851985        self._doc.topMargin=1.5*cm 
    19861986        self._doc.bottomMargin=1*cm 
    1987              
     1987 
    19881988    def firstPage(self,c,doc): 
    19891989        c.saveState() 
     
    20012001        height-=2*cm 
    20022002        c.drawCentredString(self._PAGE_WIDTH/2.0,height, 
    2003                 "%s - %s"%(self._conf.getAdjustedStartDate(self._tz).strftime("%A %d %B %Y"),  
     2003                "%s - %s"%(self._conf.getAdjustedStartDate(self._tz).strftime("%A %d %B %Y"), 
    20042004                self._conf.getAdjustedEndDate(self._tz).strftime("%A %d %B %Y"))) 
    20052005        if self._conf.getLocation(): 
     
    20112011        c.drawCentredString(self._PAGE_WIDTH/2.0,height,\ 
    20122012                self._title) 
    2013         self._drawWrappedString(c, "%s / %s"%(self._conf.getTitle(),self._title), width=inch, height=0.75*inch, font='Times-Roman', size=9, color=(0.5,0.5,0.5), align="left", maximumWidth=self._PAGE_WIDTH-3.5*inch, measurement=inch, lineSpacing=0.15)      
     2013        self._drawWrappedString(c, "%s / %s"%(self._conf.getTitle(),self._title), width=inch, height=0.75*inch, font='Times-Roman', size=9, color=(0.5,0.5,0.5), align="left", maximumWidth=self._PAGE_WIDTH-3.5*inch, measurement=inch, lineSpacing=0.15) 
    20142014        c.drawRightString(self._PAGE_WIDTH-inch,0.75*inch, 
    20152015                nowutc().strftime("%A %d %B %Y")) 
    20162016        c.restoreState() 
    2017      
     2017 
    20182018    def laterPages(self,c,doc): 
    20192019        c.saveState() 
     
    21212121 
    21222122class ProceedingsTOC(PDFBase): 
    2123      
     2123 
    21242124    def __init__(self, conf, trackDict=None, trackOrder=None, contribList=None, npages=None, doc=None, story=None, tz=None): 
    21252125        self._conf = conf 
     
    21372137        self._title = _("Proceedings") 
    21382138        self._PAGE_HEIGHT = defaultPageSize[1] 
    2139         self._PAGE_WIDTH = defaultPageSize[0]  
    2140      
     2139        self._PAGE_WIDTH = defaultPageSize[0] 
     2140 
    21412141    def firstPage(self,c,doc): 
    21422142        c.saveState() 
     
    21552155        height-=2*cm 
    21562156        c.drawCentredString(self._PAGE_WIDTH/2.0,height, 
    2157                 "%s - %s"%(self._conf.getAdjustedStartDate(self._tz).strftime("%A %d %B %Y"),  
     2157                "%s - %s"%(self._conf.getAdjustedStartDate(self._tz).strftime("%A %d %B %Y"), 
    21582158                self._conf.getAdjustedEndDate(self._tz).strftime("%A %d %B %Y"))) 
    21592159        if self._conf.getLocation(): 
     
    21662166        c.setFillColorRGB(0.5,0.5,0.5) 
    21672167        c.restoreState() 
    2168      
     2168 
    21692169    def laterPages(self,c,doc): 
    21702170        c.saveState() 
     
    21752175        c.drawCentredString(self._PAGE_WIDTH/2.0,0.5*cm,"%s "%Int2Romans.int_to_roman(doc.page-1)) 
    21762176        c.restoreState() 
    2177      
     2177 
    21782178    def getBody(self, story=None, indexedFlowable={}, level=1 ): 
    21792179        if not story: 
     
    21902190        p = Paragraph(text, style) 
    21912191        story.append(p) 
    2192          
     2192 
    21932193        story.append(Spacer(inch, 0.5*cm)) 
    2194                  
     2194 
    21952195        styleAuthor = ParagraphStyle({}) 
    21962196        styleAuthor.leading = 10 
     
    22132213        styleContrib.firstLineIndent=0 
    22142214        styleContrib.leftIndent=0 
    2215          
     2215 
    22162216        styleTrack = ParagraphStyle({}) 
    22172217        styleTrack.fontName = "Times-Bold" 
     
    22542254                self._story.append(t) 
    22552255        self._story.append(Spacer(inch, 2*cm)) 
    2256          
     2256 
    22572257        return story 
    22582258 
     
    22742274        l.append(["", ""]) 
    22752275        return i 
    2276      
     2276 
    22772277    def _getAbrName(self, author): 
    22782278        res = author.getFamilyName() 
     
    22872287 
    22882288class ProceedingsChapterSeparator(PDFBase): 
    2289      
     2289 
    22902290    def __init__(self, track, doc=None, story=None): 
    22912291        self._track = track 
     
    22962296        self._title = _("Proceedings") 
    22972297        self._PAGE_HEIGHT = defaultPageSize[1] 
    2298         self._PAGE_WIDTH = defaultPageSize[0]  
    2299      
     2298        self._PAGE_WIDTH = defaultPageSize[0] 
     2299 
    23002300    def firstPage(self,c,doc): 
    23012301        c.saveState() 
     
    23092309        c.setFillColorRGB(0.5,0.5,0.5) 
    23102310        c.restoreState() 
    2311      
     2311 
    23122312    def laterPages(self,c,doc): 
    23132313        c.saveState() 
     
    23182318        #c.drawCentredString(self._PAGE_WIDTH/2.0,0.5*cm,"Page %d "%doc.page) 
    23192319        c.restoreState() 
    2320      
     2320 
    23212321    def getBody(self, story=None, indexedFlowable={}, level=1 ): 
    23222322        if not story: 
     
    23452345        return result 
    23462346    int_to_roman = staticmethod(int_to_roman) 
    2347      
     2347 
    23482348 
    23492349class RegistrantsListToPDF(PDFBase): 
    2350      
     2350 
    23512351    def __init__(self, conf,doc=None, story=[],list=None, display=["Institution", "Phone", "City", "Country"]): 
    23522352        self._conf = conf 
     
    23582358        self._PAGE_HEIGHT = landscape(A4)[1] 
    23592359        self._PAGE_WIDTH = landscape(A4)[0] 
    2360      
     2360 
    23612361    def firstPage(self, c, doc): 
    23622362        c.saveState() 
     
    23712371        c.drawRightString(self._PAGE_WIDTH - inch,self._PAGE_HEIGHT-1*cm, "%s"%(nowutc().strftime("%d %B %Y, %H:%M"))) 
    23722372        c.restoreState() 
    2373      
     2373 
    23742374    def getBody(self, story=None, indexedFlowable={}, level=1 ): 
    23752375        if not story: 
     
    23832383        p.spaceAfter = 30 
    23842384        story.append(p) 
    2385          
     2385 
    23862386        styleRegistrant = ParagraphStyle({}) 
    23872387        styleRegistrant.leading = 10 
     
    23932393        styleRegistrant.leftIndent=10 
    23942394        styleRegistrant.firstLineIndent=0 
    2395          
     2395 
    23962396        tsRegs=TableStyle([('VALIGN',(0,0),(-1,-1),"MIDDLE"), 
    23972397                        ('LINEBELOW',(0,0),(-1,0), 1, colors.black), 
     
    24012401        lp = [] 
    24022402        lp.append(Paragraph( _("""<b> _("Name")</b>"""), styleRegistrant)) 
    2403          
     2403 
    24042404        for key in self._display: 
    24052405            if key in ["Email", "Position", "LastName", "FirstName", "Institution", "Phone", "City", "Country", "Address", "RegistrationDate"]: 
     
    25402540    Class used to print the Badges for the registrants 
    25412541    """ 
    2542      
     2542 
    25432543    """ 
    25442544    The following dictionary maps the names of the fonts, as returned by the javascript in WConfModifBadgeDesign.tpl, 
     
    25562556           #,'Bitstream Cyberbit':['Bitstream-Cyberbit', 'Bitstream-Cyberbit', 'Bitstream-Cyberbit', 'Bitstream-Cyberbit'] 
    25572557               } 
    2558      
     2558 
    25592559    """ The following dictionary maps the sizes of the items, as returned by the javascript in WConfModifBadgeDesign.tpl, 
    25602560    to actual font sizes in points, as ReportLab needs. 
     
    25682568                   'xx-large':24 
    25692569                   } 
    2570      
     2570 
    25712571    """ The following dictionary maps the possible text alignments, as returned by the javascript in WConfModifBadgeDesign.tpl, 
    25722572    to ReportLab constants. 
     
    25772577                    'Justified':TA_JUSTIFY 
    25782578                    } 
    2579      
     2579 
    25802580    """ The following dictionary maps the possible text colors, as returned by the javascript in WConfModifBadgeDesign.tpl, 
    25812581    to ReportLab color constants. 
     
    25932593                'white': colors.white 
    25942594                } 
    2595      
    2596      
    2597     def __init__(self, conf, badgeTemplate, marginTop, marginBottom, marginLeft, marginRight, marginColumns, marginRows, pagesize, registrantList): 
     2595 
     2596 
     2597    def __init__(self, conf, badgeTemplate, marginTop, marginBottom, marginLeft, marginRight, marginColumns, marginRows, pagesize, drawDashedRectangles, registrantList): 
    25982598        """ Constructor 
    25992599                conf: the conference for which the badges are printed, as a Conference object. 
     
    26092609            The badges will be drawn aligned to the left. 
    26102610        """ 
    2611          
     2611 
    26122612        self.__conf = conf 
    26132613        self.__badgeTemplate = badgeTemplate 
     
    26232623        else: 
    26242624            self.__registrantList = [self.__conf.getRegistrantById(id) for id in registrantList] 
    2625          
     2625 
    26262626        self.__size = PDFSizes().PDFpagesizes[pagesize] 
    26272627        self.__width, self.__height = self.__size 
    2628          
     2628 
     2629        self.__drawDashedRectangles = drawDashedRectangles 
     2630 
    26292631        setTTFonts() 
    2630          
    2631      
     2632 
     2633 
    26322634    def getPDFBin(self): 
    26332635        """ Returns the data of the PDF file to be printed 
    26342636        """ 
    2635          
     2637 
    26362638        self.__fileDummy = FileDummy() 
    26372639        self.__canvas = canvas.Canvas(self.__fileDummy, pagesize = self.__size) 
     
    26392641        nBadgesHorizontal = int((self.__width - self.__marginLeft * cm - self.__marginRight * cm + self.__marginColumns * cm  + 0.01*cm) / 
    26402642                                ((self.__badgeTemplate.getWidthInCm() + self.__marginColumns)  * cm)) 
    2641          
    2642          
     2643 
     2644 
    26432645        nBadgesVertical = int((self.__height - self.__marginTop * cm - self.__marginBottom * cm + self.__marginRows * cm + 0.01*cm) / 
    26442646                              ((self.__badgeTemplate.getHeightInCm() + self.__marginRows) * cm)) 
    2645          
     2647 
    26462648        # We get an instance of the position generator 
    26472649        p = RegistrantsListToBadgesPDF.__position_generator( 
     
    26492651                               self.__badgeTemplate.getWidthInCm() * cm, self.__badgeTemplate.getHeightInCm() * cm, 
    26502652                               self.__marginLeft * cm, self.__marginTop * cm, self.__marginColumns * cm, self.__marginRows * cm) 
    2651          
     2653 
    26522654        if nBadgesHorizontal == 0 or nBadgesVertical == 0: 
    26532655            raise NoReportError( _("The template dimensions are too large for the page size you selected")) 
    2654          
     2656 
    26552657        # We print a badge for each registrant 
    26562658        for registrant in self.__registrantList: 
     
    26672669                posx, posy = p.next() 
    26682670                self.__draw_badge(registrant, posx, posy) 
    2669          
     2671 
    26702672        self.__canvas.save() 
    26712673        return self.__fileDummy.getData() 
    26722674 
    2673     def __position_generator(cls,  
    2674                              nBadgesHorizontal, nBadgesVertical,  
    2675                              badgeWidth, badgeHeight,  
     2675    def __position_generator(cls, 
     2676                             nBadgesHorizontal, nBadgesVertical, 
     2677                             badgeWidth, badgeHeight, 
    26762678                             marginLeft, marginTop, 
    26772679                             interColumnMargin, interRowMargin): 
     
    26802682        When there are no more positions available in a page, it throws a StopIteration exception. 
    26812683        """ 
    2682          
     2684 
    26832685        nx = 0 
    26842686        ny = 0 
     
    26992701        (posx, posy) is the position of the top left corner of a badge. 
    27002702        """ 
    2701          
     2703 
    27022704        # We draw a dashed rectangle around the badge 
    2703         self.__canvas.saveState() 
    2704         self.__canvas.setDash(1,5) 
    2705         self.__canvas.rect(posx, self.__height - posy - self.__badgeTemplate.getHeightInCm() * cm, 
    2706                            self.__badgeTemplate.getWidthInCm() * cm, self.__badgeTemplate.getHeightInCm() * cm) 
    2707         self.__canvas.restoreState() 
    2708          
     2705        if self.__drawDashedRectangles: 
     2706            self.__canvas.saveState() 
     2707            self.__canvas.setDash(1,5) 
     2708            self.__canvas.rect(posx, self.__height - posy - self.__badgeTemplate.getHeightInCm() * cm, 
     2709                               self.__badgeTemplate.getWidthInCm() * cm, self.__badgeTemplate.getHeightInCm() * cm) 
     2710            self.__canvas.restoreState() 
     2711 
    27092712        # We draw the background if we find it. 
    27102713        usedBackgroundId = self.__badgeTemplate.getUsedBackgroundId() 
     
    27132716                                    posx, self.__height - posy - self.__badgeTemplate.getHeightInCm() * cm, 
    27142717                                    self.__badgeTemplate.getWidthInCm() * cm, self.__badgeTemplate.getHeightInCm() * cm) 
    2715          
    2716          
     2718 
     2719 
    27172720        # We draw the items of the badge 
    27182721        for item in self.__badgeTemplate.getItems(): 
    2719              
     2722 
    27202723            # First we determine the actual text that has to be drawed. 
    27212724            action = BadgeDesignConfiguration().items_actions[item.getName()] 
     
    27242727                text = action 
    27252728            elif isinstance(action, types.MethodType): 
    2726                 # If the action is a method, depending on which class owns the method, we pass a  
     2729                # If the action is a method, depending on which class owns the method, we pass a 
    27272730                # different object to the method. 
    27282731                if action.im_class == Registrant: 
     
    27512754            else: 
    27522755                text = _("Error") 
    2753                  
     2756 
    27542757            if not isinstance(text, basestring): 
    27552758                text = str(text) 
     
    27622765            style.fontSize = RegistrantsListToBadgesPDF.__fontSizes[item.getFontSize()] 
    27632766            style.leading = style.fontSize 
    2764              
     2767 
    27652768            if item.isBold() and item.isItalic(): 
    27662769                style.fontName = style.fontName = RegistrantsListToBadgesPDF.__fonts[item.getFont()][3] 
     
    27712774            else: 
    27722775                style.fontName = style.fontName = RegistrantsListToBadgesPDF.__fonts[item.getFont()][0] 
    2773              
     2776 
    27742777            p = Paragraph(text, style) 
    2775      
     2778 
    27762779            itemx = self.__badgeTemplate.pixelsToCm(item.getX()) * cm 
    27772780            itemy = self.__badgeTemplate.pixelsToCm(item.getY()) * cm 
    2778              
     2781 
    27792782            availableWidth = self.__badgeTemplate.pixelsToCm(item.getWidth()) * cm 
    27802783            availableHeight = (self.__badgeTemplate.getHeightInCm() 
    27812784                               - self.__badgeTemplate.pixelsToCm(item.getY()) \ 
    27822785                              ) * cm 
    2783      
     2786 
    27842787            w,h = p.wrap(availableWidth, availableHeight) 
    2785        
     2788 
    27862789            if w > availableWidth or h > availableHeight: 
    27872790                ## TODO: give warnings 
    27882791                pass 
    2789      
     2792 
    27902793            p.drawOn(self.__canvas, posx + itemx, self.__height - posy - itemy - h) 
    27912794 
     
    27952798    Class used to print a lecture's poster 
    27962799    """ 
    2797      
     2800 
    27982801    """ The following dictionary maps the names of the fonts, as returned by the javascript in WConfModifPosterDesign.tpl, 
    27992802    to actual TTF font names. 
     
    28102813           #,'Bitstream Cyberbit':['Bitstream-Cyberbit', 'Bitstream-Cyberbit', 'Bitstream-Cyberbit', 'Bitstream-Cyberbit'] 
    28112814               } 
    2812      
    2813      
     2815 
     2816 
    28142817    """ The following dictionary maps the possible text alignments, as returned by the javascript in WConfModifPosterDesign.tpl, 
    28152818    to ReportLab constants. 
     
    28202823                    'Justified':TA_JUSTIFY 
    28212824                    } 
    2822      
     2825 
    28232826    """ The following dictionary maps the possible text colors, as returned by the javascript in WConfModifPosterDesign.tpl, 
    28242827    to ReportLab color constants. 
     
    28362839                'white': colors.white 
    28372840                } 
    2838      
    2839      
     2841 
     2842 
    28402843    def __init__(self, conf, posterTemplate, marginH, marginV, pagesize, tz=None): 
    28412844        """ Constructor 
     
    28482851                        either a list of registrant id's 
    28492852        """ 
    2850          
     2853 
    28512854        self.__conf = conf 
    28522855        if not tz: 
     
    28572860        self.__marginH = marginH 
    28582861        self.__marginV = marginV 
    2859          
     2862 
    28602863        self.__size = PDFSizes().PDFpagesizes[pagesize] 
    28612864        self.__width, self.__height = self.__size 
    2862          
     2865 
    28632866        setTTFonts() 
    2864        
     2867 
    28652868    """ The following function maps the sizes of the items, as returned by the javascript in WConfModifPosterDesign.tpl, 
    28662869    to actual font sizes in points, as ReportLab needs. 
     
    28742877        return None 
    28752878    __extract_size = classmethod (__extract_size) 
    2876          
    2877      
     2879 
     2880 
    28782881    def getPDFBin(self): 
    28792882        """ Returns the data of the PDF file to be printed 
    28802883        """ 
    2881          
     2884 
    28822885        self.__fileDummy = FileDummy() 
    28832886        self.__canvas = canvas.Canvas(self.__fileDummy, pagesize = self.__size) 
    28842887 
    28852888        self.__draw_poster(self.__marginH * cm, self.__marginV * cm) 
    2886          
     2889 
    28872890        self.__canvas.save() 
    28882891        return self.__fileDummy.getData() 
    28892892 
    28902893    def __draw_background(self, file, position, posx, posy): 
    2891          
     2894 
    28922895        img = Image.open(file) 
    2893          
     2896 
    28942897        imgWidth, imgHeight = img.size 
    28952898 
     
    29062909            height = self.__posterTemplate.pixelsToCm(imgHeight) 
    29072910            width = self.__posterTemplate.pixelsToCm(imgWidth) 
    2908              
     2911 
    29092912            posterWidth = self.__posterTemplate.getWidthInCm() 
    29102913            posterHeight = self.__posterTemplate.getHeightInCm() 
    2911              
    2912             if width > posterWidth or height > posterHeight:      
    2913                  
    2914                 if width > posterWidth:                     
    2915                     ratio = float(posterWidth)/width;                     
     2914 
     2915            if width > posterWidth or height > posterHeight: 
     2916 
     2917                if width > posterWidth: 
     2918                    ratio = float(posterWidth)/width; 
    29162919                    width = posterWidth; 
    29172920                    height = height*ratio 
    2918                                          
     2921 
    29192922                    x_1 = posx; 
    29202923                    y_1 = posy + (posterHeight - height)/2.0; 
    29212924 
    2922                  
     2925 
    29232926                if  height > posterHeight: 
    2924                     ratio = float(posterHeight)/height;                     
     2927                    ratio = float(posterHeight)/height; 
    29252928                    height = posterHeight; 
    29262929                    width = width*ratio 
    2927                     x_1 = posx + (posterWidth - width)/2.0;                 
     2930                    x_1 = posx + (posterWidth - width)/2.0; 
    29282931                    y_1 = posy; 
    29292932            else: 
    29302933                x_1 = posx + (posterWidth - self.__posterTemplate.pixelsToCm(imgWidth))/2.0 
    29312934                y_1 = posy + (posterHeight - self.__posterTemplate.pixelsToCm(imgHeight))/2.0 
    2932          
     2935 
    29332936        self.__canvas.drawImage(file, 
    29342937             x_1 * cm, y_1 * cm, 
     
    29392942        """ Draws a poster, for a given registrant, at the position (posx, posy). 
    29402943        (posx, posy) is the position of the top left corner of a poster. 
    2941         """        
    2942          
     2944        """ 
     2945 
    29432946        # We draw the background if we find it. 
    29442947        usedBackgroundId = self.__posterTemplate.getUsedBackgroundId() 
    2945          
     2948 
    29462949        if usedBackgroundId != -1 and self.__posterTemplate.getBackground(usedBackgroundId)[1] is not None: 
    2947              
     2950 
    29482951            self.__draw_background(self.__posterTemplate.getBackground(usedBackgroundId)[1].getFilePath(), 
    2949                              self.__posterTemplate.getBackgroundPosition(usedBackgroundId),posx,posy)         
    2950          
     2952                             self.__posterTemplate.getBackgroundPosition(usedBackgroundId),posx,posy) 
     2953 
    29512954        # We draw the items of the poster 
    29522955        for item in self.__posterTemplate.getItems(): 
    2953              
     2956 
    29542957            # First we determine the actual text that has to be drawed. 
    29552958            action = PosterDesignConfiguration().items_actions[item.getName()] 
    2956                          
     2959 
    29572960            if isinstance(action, str): 
    29582961                # If for this kind of item we have to draw always the same string, let's draw it. 
     
    29602963                text = [action] 
    29612964            elif isinstance(action, types.MethodType): 
    2962                 # If the action is a method, depending on which class owns the method, we pass a  
     2965                # If the action is a method, depending on which class owns the method, we pass a 
    29632966                # different object to the method. 
    29642967                if action.im_class == conference.Conference: 
     
    29742977                #  -it must have a getValue(object) method, to which a Conference instance or a 
    29752978                #  PosterTemplateItem instance must be passed, depending on the result of the getArgumentType() method. 
    2976                 argumentType = action.getArgumentType()               
     2979                argumentType = action.getArgumentType() 
    29772980                if action.__name__ == "ConferenceChairperson": 
    29782981                    #this specific case may need more than one line 
    29792982                    chairList = action.getValue(self.__conf) 
    2980                      
     2983 
    29812984                    # 'text' is a list of lines 
    29822985                    text = [] 
     
    29872990                        else: 
    29882991                            text.append(chair.getDirectFullName()) 
    2989                          
     2992 
    29902993                elif argumentType == conference.Conference: 
    29912994                    text = [action.getValue(self.__conf)] 
     
    29962999            else: 
    29973000                text = [_("Error")] 
    2998                
     3001 
    29993002            text = map(escape,text) 
    3000              
     3003 
    30013004            #style definition for the Paragraph used to draw the text. 
    30023005            style = ParagraphStyle({}) 
     
    30053008            style.fontSize = LectureToPosterPDF.__extract_size(item.getFontSize()) 
    30063009            style.leading = style.fontSize 
    3007              
     3010 
    30083011            if item.isBold() and item.isItalic(): 
    30093012                style.fontName = style.fontName = LectureToPosterPDF.__fonts[item.getFont()][3] 
     
    30143017            else: 
    30153018                style.fontName = style.fontName = LectureToPosterPDF.__fonts[item.getFont()][0] 
    3016              
     3019 
    30173020            availableWidth = self.__posterTemplate.pixelsToCm(item.getWidth()) * cm 
    30183021            availableHeight = (self.__posterTemplate.getHeightInCm() 
    30193022                               - self.__posterTemplate.pixelsToCm(item.getY()) \ 
    30203023                              ) * cm 
    3021                   
     3024 
    30223025            w,h = 0,0 
    30233026            itemx = self.__posterTemplate.pixelsToCm(item.getX()) * cm 
    30243027            itemy = self.__posterTemplate.pixelsToCm(item.getY()) * cm 
    3025              
     3028 
    30263029            # now, we iterate over the line set 
    30273030            for line in text: 
     
    30323035 
    30333036                    itemy += h 
    3034               
     3037 
    30353038                    w,h = p.wrap(availableWidth, availableHeight) 
    3036        
     3039 
    30373040                    if w > availableWidth or h > availableHeight: 
    30383041                        ## TODO: warnings 
    3039                         pass                 
    3040                              
     3042                        pass 
     3043 
    30413044                    # finally, draw 
    30423045                    p.drawOn(self.__canvas, posx + itemx, self.__height - posy - itemy - h) 
Note: See TracChangeset for help on using the changeset viewer.