Changeset bd2819 in indico


Ignore:
Timestamp:
03/25/11 15:32:26 (2 years ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, d9941f8582b36b24821a11ea5ba16fda6a457fb1
Children:
7247b6
Parents:
9afeb6
Message:

[FIX] Removed _v_ attributes from system links

  • Found better way to handle name changes;
Location:
indico/MaKaC/webinterface
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/webinterface/displayMgr.py

    ra7cf56 rbd2819  
    294294            link = self.getLinkByName(name) 
    295295            if link: 
    296                 link.setCaption(data["caption"]) 
     296                # only update the caption if it has been already customized 
     297                if not link.wasChanged(): 
     298                    link.setCaption(data["caption"], silent=True) 
    297299                link.setURL(data["URL"]) 
    298                 link.setStaticURL(data["staticURL"]) 
    299300            else: 
    300301                #we must create the link 
     
    308309            #create the link at the fisrt level 
    309310            link = SystemLink(name) 
    310             link.setCaption(data["caption"]) 
     311            link.setCaption(data["caption"], silent=True) 
    311312            link.setURL(data["URL"]) 
    312             link.setStaticURL(data["staticURL"]) 
    313313            self.addLink(link) 
    314314            link.disable() 
     
    323323            #We can create the link under the parent 
    324324            link = SystemLink(name) 
    325             link.setCaption(data["caption"]) 
     325            link.setCaption(data["caption"], silent=True) 
    326326            link.setURL(data["URL"]) 
    327             link.setStaticURL(data["staticURL"]) 
    328327            parent.addLink(link) 
    329328            link.disable() 
     
    750749    Type = "system" 
    751750 
     751    def __init__(self, name, parent=None, changed=False): 
     752        Link.__init__(self, name, parent) 
     753 
     754        # by default, this link will be updated when there are version 
     755        # changes that modify its default name 
     756        self._changed = changed 
     757 
    752758    def clone(self, newMenu): 
    753         newLink = SystemLink(self.getName(), newMenu) 
     759        newLink = SystemLink(self.getName(), parent=newMenu, changed=self.wasChanged()) 
    754760        newLink.setEnabled(self.isEnabled()) 
    755761        newLink.setVisible(self.isVisible()) 
    756762        newLink.setId(self.getId()) 
    757763        newLink.setDisplayTarget(self.getDisplayTarget()) 
    758         newLink.setCaption(self.getCaption(), store = True) 
     764        newLink.setCaption(self.getCaption(), silent=True) 
    759765        newLink.setURL(self.getURL()) 
    760         newLink.setStaticURL(self.getStaticURL()) 
    761766 
    762767        listLink = [] 
     
    768773        return newLink 
    769774 
     775    def wasChanged(self): 
     776        # old conferences, before `_changed` was introduced 
     777        if hasattr(self, '_changed'): 
     778            return self._changed 
     779        else: 
     780            # for old conferences, just keeps things as people 
     781            # left them 
     782            return True 
     783 
    770784    def getURL(self): 
    771785        return self._v_URL 
     
    774788        self._v_URL = url 
    775789 
    776     def getStaticURL(self): 
    777         return self._v_staticURL 
    778  
    779     def setStaticURL(self, url): 
    780         self._v_staticURL = url 
    781  
    782790    def getCaption(self): 
    783         if self._caption != "": 
    784             return self._caption 
    785         return self._v_caption 
    786  
    787     def setCaption(self, caption, store=False): 
    788         if store: 
    789             self._caption = caption 
    790         self._v_caption = caption 
     791        return self._caption 
     792 
     793    def setCaption(self, caption, silent=False): 
     794        self._caption = caption 
     795 
     796        if not silent: 
     797            # if the caption was changed, do not update it when the default 
     798            # value get an update 
     799            self._changed = True 
    791800 
    792801 
     
    801810                "caption": _("Overview"), \ 
    802811                "URL": str(urlHandlers.UHConferenceOverview.getURL(conf)), \ 
    803                 "staticURL": str(urlHandlers.UHStaticConferenceDisplay.getRelativeURL()), \ 
    804812                "parent": ""}, \ 
    805813            "programme": { \ 
    806814                "caption": _("Scientific Programme"), \ 
    807815                "URL": str(urlHandlers.UHConferenceProgram.getURL(conf)), \ 
    808                 "staticURL": str(urlHandlers.UHStaticConferenceProgram.getRelativeURL()), \ 
    809816                "parent": ""}, \ 
    810817            "CFA": { \ 
    811818                "caption": _("Call for Abstracts"), \ 
    812819                "URL": str(urlHandlers.UHConferenceCFA.getURL(conf)), \ 
    813                 "staticURL": "", \ 
    814820                "parent": ""}, \ 
    815821            "ViewAbstracts": { \ 
    816822                "caption": _("View my abstracts"), \ 
    817823                "URL": str(urlHandlers.UHUserAbstracts.getURL(conf)), \ 
    818                 "staticURL": "", \ 
    819824                "parent": "CFA"}, \ 
    820825            "SubmitAbstract": { \ 
    821826                "caption": _("Submit a new abstract"), \ 
    822827                "URL": str(urlHandlers.UHAbstractSubmission.getURL(conf)), \ 
    823                 "staticURL": "", \ 
    824828                "parent": "CFA"}, \ 
    825829            "manageTrack": { \ 
    826830                "caption": _("Manage my track"), \ 
    827831                "URL": str(urlHandlers.UHTrackModifAbstracts.getURL(conf)), \ 
    828                 "staticURL": "", \ 
    829832                "parent": "programme"}, \ 
    830833            "timetable": { \ 
    831834                "caption": _("Timetable"), \ 
    832835                "URL": str(urlHandlers.UHConferenceTimeTable.getURL( conf )), \ 
    833                 "staticURL": str(urlHandlers.UHStaticConferenceTimeTable.getRelativeURL()), \ 
    834836                "parent": ""}, \ 
    835837            "contributionList": { \ 
    836838                "caption": _("Contribution List"), \ 
    837839                "URL": str(urlHandlers.UHContributionList.getURL( conf )), \ 
    838                 "staticURL": str(urlHandlers.UHStaticContributionList.getRelativeURL()), \ 
    839840                "parent": ""}, \ 
    840841            "authorIndex": { \ 
    841842                "caption": _("Author index"), \ 
    842843                "URL": str(urlHandlers.UHConfAuthorIndex.getURL( conf )), \ 
    843                 "staticURL": str(urlHandlers.UHStaticConfAuthorIndex.getRelativeURL()), \ 
    844844                "parent": ""} ,\ 
    845845            "speakerIndex": { \ 
    846846                "caption": _("Speaker index"), \ 
    847847                "URL": str(urlHandlers.UHConfSpeakerIndex.getURL( conf )), \ 
    848                 "staticURL": "", \ 
    849848                "parent": "", \ 
    850849                "visibilityByDefault": False}, \ 
     
    852851                "caption": _("My conference"), \ 
    853852                "URL": str(urlHandlers.UHConfMyStuff.getURL(conf)), \ 
    854                 "staticURL": "", \ 
    855853                "parent": ""}, \ 
    856854            "mytracks": { \ 
    857855                "caption": _("My tracks"), \ 
    858856                "URL": str(str(urlHandlers.UHConfMyStuffMyTracks.getURL(conf))), \ 
    859                 "staticURL": "", \ 
    860857                "parent": "mystuff"}, \ 
    861858            "mysessions": { \ 
    862859                "caption": _("My sessions"), \ 
    863860                "URL": str(str(urlHandlers.UHConfMyStuffMySessions.getURL(conf))), \ 
    864                 "staticURL": "", \ 
    865861                "parent": "mystuff"}, \ 
    866862            "mycontribs": { \ 
    867863                "caption": _("My contributions"), \ 
    868864                "URL": str(str(urlHandlers.UHConfMyStuffMyContributions.getURL(conf))), \ 
    869                 "staticURL": "", \ 
    870865                "parent": "mystuff"}, \ 
    871866            "paperreviewing": { \ 
    872867                "caption": _("Paper Reviewing"), \ 
    873868                "URL": str(urlHandlers.UHPaperReviewingDisplay.getURL(conf)), \ 
    874                 "staticURL": "", \ 
    875869                "parent": ""}, \ 
    876870            "managepaperreviewing": { \ 
    877871                "caption": _("Manage Paper Reviewing"), \ 
    878872                "URL": str(str(urlHandlers.UHConfModifReviewingPaperSetup.getURL(conf))), \ 
    879                 "staticURL": "", \ 
    880873                "parent": "paperreviewing"}, \ 
    881874            "assigncontributions": { \ 
    882875                "caption": _("Assign papers"), \ 
    883876                "URL": str(str(urlHandlers.UHConfModifReviewingAssignContributionsList.getURL(conf))), \ 
    884                 "staticURL": "", \ 
    885877                "parent": "paperreviewing"}, \ 
    886878            "judgelist": { \ 
    887879                "caption": _("Referee Area"), \ 
    888880                "URL": str(str(urlHandlers.UHConfModifListContribToJudge.getURL(conf))), \ 
    889                 "staticURL": "", \ 
    890881                "parent": "paperreviewing"}, \ 
    891882            "judgelistreviewer": { \ 
    892883                "caption": _("Content Reviewer Area"), \ 
    893884                "URL": str(str(urlHandlers.UHConfModifListContribToJudgeAsReviewer.getURL(conf))), \ 
    894                 "staticURL": "", \ 
    895885                "parent": "paperreviewing"}, \ 
    896886            "judgelisteditor": { \ 
    897887                "caption": _("Layout Reviewer Area"), \ 
    898888                "URL": str(str(urlHandlers.UHConfModifListContribToJudgeAsEditor.getURL(conf))), \ 
    899                 "staticURL": "", \ 
    900889                "parent": "paperreviewing"}, \ 
    901890            "uploadpaper": { \ 
    902891                "caption": _("Upload paper"), \ 
    903892                "URL": str(str(urlHandlers.UHUploadPaper.getURL(conf))), \ 
    904                 "staticURL": "", \ 
    905893                "parent": "paperreviewing"}, \ 
    906894            "downloadtemplate": { \ 
    907895                "caption": _("Download template"), \ 
    908896                "URL": str(str(urlHandlers.UHDownloadPRTemplate.getURL(conf))), \ 
    909                 "staticURL": "", \ 
    910897                "parent": "paperreviewing"}, \ 
    911898            "abstractsBook": { \ 
    912899                "caption": _("Book of abstracts"), \ 
    913900                "URL": str(urlHandlers.UHConfAbstractBook.getURL(conf)), \ 
    914                 "staticURL": str(urlHandlers.UHStaticConfAbstractBook.getRelativeURL()), \ 
    915901                "parent": ""}, \ 
    916902            "registrationForm": { \ 
    917903                "caption": _("Registration"), \ 
    918904                "URL": str(urlHandlers.UHConfRegistrationForm.getURL(conf)), \ 
    919                 "staticURL": "", \ 
    920905                "parent": ""}, \ 
    921906            "ViewMyRegistration": { \ 
    922907                "caption": _("Modify my registration"), \ 
    923908                "URL": str(urlHandlers.UHConfRegistrationFormModify.getURL(conf)), \ 
    924                 "staticURL": "", \ 
    925909                "parent": "registrationForm"}, \ 
    926910            "NewRegistration": { \ 
    927911                "caption": _("Registration Form"), \ 
    928912                "URL": str(urlHandlers.UHConfRegistrationFormDisplay.getURL(conf)), \ 
    929                 "staticURL": "", \ 
    930913                "parent": "registrationForm"}, \ 
    931914            "registrants": { \ 
    932915                "caption": _("List of registrants"), \ 
    933916                "URL": str(urlHandlers.UHConfRegistrantsList.getURL(conf)), \ 
    934                 "staticURL": "", \ 
    935917                "parent": "", \ 
    936918                "visibilityByDefault": False}, \ 
     
    938920                "caption": _("Evaluation"), \ 
    939921                "URL": str(urlHandlers.UHConfEvaluationMainInformation.getURL(conf)), \ 
    940                 "staticURL": "", \ 
    941922                "parent": ""}, \ 
    942923            "newEvaluation": { \ 
    943924                "caption": _("Evaluation Form"), \ 
    944925                "URL": str(urlHandlers.UHConfEvaluationDisplay.getURL(conf)), \ 
    945                 "staticURL": "", \ 
    946926                "parent": "evaluation"}, \ 
    947927            "viewMyEvaluation": { \ 
    948928                "caption": _("Modify my evaluation"), \ 
    949929                "URL": str(urlHandlers.UHConfEvaluationDisplayModif.getURL(conf)), \ 
    950                 "staticURL": "", \ 
    951930                "parent": "evaluation"}, 
    952931            "collaboration": { \ 
    953932                "caption": _("Video Services"), \ 
    954933                "URL": str(urlHandlers.UHCollaborationDisplay.getURL(conf)), \ 
    955                 "staticURL": "", \ 
    956934                "parent": ""} \ 
    957935            } 
  • indico/MaKaC/webinterface/rh/conferenceModif.py

    rd71e61 rbd2819  
    50245024                if name.strip()=="": 
    50255025                    name="[empty name]" 
    5026                 link.setCaption(name, True) 
     5026                link.setCaption(name) 
    50275027        else: 
    50285028            menu = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getMenu() 
Note: See TracChangeset for help on using the changeset viewer.