Changeset 843480 in indico


Ignore:
Timestamp:
07/28/11 11:30:26 (22 months ago)
Author:
Jose Benito <jose.benito.gonzalez@…>
Branches:
master, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 0da0c1403bae8e51d8229f460181c71b9e6dda72
Children:
4bf83c
Parents:
39b7d0
git-author:
Alexis Castilla Hernandez <alexis.castilla.hernandez@…> (05/17/11 11:04:06)
git-committer:
Jose Benito <jose.benito.gonzalez@…> (07/28/11 11:30:26)
Message:

[IMP] Allow Co-Authors as CC in Notification TPLs

  • Included checkbox in CC Addresses field to enable/disable co-authors as CC addresses
  • Deleted line of code not needed (it caused an error) in ConfModCFANotifTplEditData.tpl
  • Included new attribute in NotificationTemplate? class
  • Closes #452
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • bin/recovery/recovery.py

    r9f7b3f6 r843480  
    14461446                ntpl.setFromAddr(nt.getFromAddr()) 
    14471447                ntpl.setCCAddrList(nt.getCCAddrList()) 
     1448                ntpl.setCAasCCAddr(nt.getCAasCCAddr()) 
    14481449                for a in nt.getToAddrList(): 
    14491450                    add = TrashCanManager().getById(a._p_oid) 
  • indico/MaKaC/review.py

    r39b7d0 r843480  
    16371637        return self._coAuthors 
    16381638 
     1639    def getCoAuthorEmailList(self): 
     1640        emailList = [] 
     1641        for coAuthor in self.getCoAuthorList(): 
     1642            emailList.append(coAuthor.getEmail()) 
     1643        return emailList 
     1644 
    16391645    def clearCoAuthors(self): 
    16401646        while len(self._coAuthors)>0: 
     
    31953201        self._tplBody="" 
    31963202        self._fromAddr = "" 
     3203        self._CAasCCAddr = False 
    31973204        self._ccAddrList=PersistentList() 
    31983205        self._toAddrs = PersistentList() 
     
    32083215        tpl.setTplBody(self.getTplBody()) 
    32093216        tpl.setFromAddr(self.getFromAddr()) 
     3217        tpl.setCAasCCAddr(self.getCAasCCAddr()) 
    32103218 
    32113219        for cc in self.getCCAddrList() : 
     
    33173325            self.addCCAddr(addr) 
    33183326 
     3327    def setCAasCCAddr(self, CAasCCAddr): 
     3328        self._CAasCCAddr = CAasCCAddr. 
     3329 
     3330    def getCAasCCAddr(self): 
     3331        try: 
     3332            if self._CAasCCAddr: 
     3333                pass 
     3334        except AttributeError: 
     3335            self._CAasCCAddr = False 
     3336        return self._CAasCCAddr 
     3337 
    33193338    def clearCCAddrList(self): 
    33203339        self._ccAddrList=PersistentList() 
  • indico/MaKaC/webinterface/common/abstractNotificator.py

    r34d140 r843480  
    230230        fa=tpl.getFromAddr() 
    231231        cc=tpl.getCCAddrList() 
     232        # Add Co-authors addresses if needed 
     233        if tpl.getCAasCCAddr(): 
     234            ccList = cc + abstract.getCoAuthorEmailList() 
     235        else: 
     236            ccList = cc 
     237 
    232238        tl = [] 
    233239        for user in tpl.getToAddrs(abstract): 
    234240            if not user.getEmail() in tl: 
    235241                tl.append(user.getEmail()) 
    236         return Notification(subject=subj,body=b,fromAddr=fa,toList=tl,ccList=cc) 
     242        return Notification(subject=subj,body=b,fromAddr=fa,toList=tl,ccList=ccList) 
    237243 
    238244    def notify(self,abstract,tpl): 
  • indico/MaKaC/webinterface/pages/abstractReviewing.py

    r208058 r843480  
    235235        vars["notifTpl"] = self._notifTpl 
    236236        if not vars.has_key("ccList"): 
    237             vars["CCAddrs"] = quoteattr(str(",".join(self._notifTpl.getCCAddrList()))) 
    238         else: 
    239             vars["CCAddrs"] = quoteattr(str(",".join(vars["ccList"]))) 
     237            vars["CCAddrs"] = quoteattr(str(", ".join(self._notifTpl.getCCAddrList()))) 
     238        else: 
     239            vars["CCAddrs"] = quoteattr(str(", ".join(vars["ccList"]))) 
     240        vars["CAasCCAddr"] = self._notifTpl.getCAasCCAddr() 
    240241        return vars 
    241242 
     
    492493        vars["From"] = self._notifTpl.getFromAddr() 
    493494        vars["toAddrs"] = self._getToAddrsHTML() 
    494         vars["CCAddrs"] = ", ".join(self._notifTpl.getCCAddrList()) 
     495        ccAddrs = ", ".join(self._notifTpl.getCCAddrList()) 
     496        if self._notifTpl.getCAasCCAddr(): 
     497            if ccAddrs == "": 
     498                ccAddrs = "Co-Authors" 
     499            else: 
     500                ccAddrs += ", Co-Authors" 
     501        vars["CCAddrs"] = ccAddrs 
    495502        vars["subject"] = self._notifTpl.getTplSubjectShow(EmailNotificator.getVarList()) 
    496503        vars["body"] = self._notifTpl.getTplBodyShow(EmailNotificator.getVarList()) 
  • indico/MaKaC/webinterface/rh/abstractReviewing.py

    r208058 r843480  
    6161        self._fromAddr = params.get("fromAddr","") 
    6262        self._toList = self._normaliseListParam(params.get("toAddrs",[])) 
    63         self._ccList = params.get("CCAddrs","").split(",") 
     63        auxCCList = params.get("CCAddrs","") 
     64        # replace to have only one separator 
     65        auxCCList = auxCCList.replace(" ", ",").replace(";", ",").split(",") 
     66        # clean the list in order to avoid empty emails, for instance, comma at the end 
     67        cleanList = [] 
     68        for email in auxCCList: 
     69            if email != "": 
     70                cleanList.append(email) 
     71        self._ccList = cleanList 
     72        self._CAasCCAddr = params.has_key("CAasCCAddr") 
    6473        self._cancel = params.get("cancel", None) 
    6574        self._save = params.get("save", None) 
     
    99108                tpl.setFromAddr(self._fromAddr) 
    100109                tpl.setCCAddrList(self._ccList) 
     110                tpl.setCAasCCAddr(self._CAasCCAddr) 
     111 
    101112                for toAddr in self._toList: 
    102113                    toAddrWrapper = NotifTplToAddrsFactory.getToAddrById(toAddr) 
     
    186197            self._fromAddr=params.get("fromAddr","") 
    187198            self._toList=self._normaliseListParam(params.get("toAddrs",[])) 
    188             self._ccList=params.get("CCAddrs","").split(",") 
     199            auxCCList = params.get("CCAddrs","") 
     200            # replace to have only one separator 
     201            auxCCList = auxCCList.replace(" ", ",").replace(";", ",").split(",") 
     202            # clean the list in order to avoid empty emails, for instance, comma at the end 
     203            cleanList = [] 
     204            for email in auxCCList: 
     205                if email != "": 
     206                    cleanList.append(email) 
     207            self._ccList = cleanList 
     208            self._CAasCCAddr = params.get("CAasCCAddr","") 
    189209 
    190210    def _process(self): 
     
    211231                self._notifTpl.setFromAddr(self._fromAddr) 
    212232                self._notifTpl.setCCAddrList(self._ccList) 
     233                self._notifTpl.setCAasCCAddr(self._CAasCCAddr) 
    213234                self._notifTpl.clearToAddrs() 
    214235                for toAddr in self._toList: 
  • indico/MaKaC/webinterface/tpls/ConfModCFANotifTplEditData.tpl

    r39b7d0 r843480  
    6666        <td nowrap class="titleCellTD"><span class="titleCellFormat"> ${ _("CC addresses")}</span></td> 
    6767        <td colspan="2" bgcolor="white" width="100%"> 
    68             <input id="notificationTplCCAddress" type="text" name="CCAddrs"  style="width: 61%;" value=${ CCAddrs } onfocus="selected('notificationTplCCAddress')"> 
     68            <input id="notificationTplCCAddress" type="text" name="CCAddrs"  style="width: 61%;" value=${ CCAddrs } onfocus="selected('notificationTplCCAddress')"><br> 
     69            <% checked = "" %> 
     70            % if CAasCCAddr: 
     71                <% checked = "checked" %> 
     72            % endif 
     73            <input name="CAasCCAddr" type="checkbox" ${ checked } id="CAasCCAddr" value="coAuthors"><span>${ _("Co-Authors") }</span> 
    6974        </td> 
    7075    </tr> 
     
    119124notifTplManager.addToPM($E('notificationTplBody')); 
    120125 
    121 //Check when the page is loaded 
    122 notifTplManager.checkSelectCondition($E('condTypeSelect'), $E('contribTypeSelect'), $E('trackSelect')); 
    123  
    124126</script> 
  • indico/MaKaC/webinterface/tpls/ConfModCFANotifTplNew.tpl

    r39b7d0 r843480  
    5656        <td nowrap class="titleCellTD"><span class="titleCellFormat"> ${ _("CC addresses")}</span></td> 
    5757        <td colspan="2" bgcolor="white" width="100%"> 
    58             <input id="notificationTplCCAddress" type="text" name="CCAddrs"  style="width: 61%;" value=${ CCAddrs } onfocus="selected('notificationTplCCAddress')"> 
     58            <input id="notificationTplCCAddress" type="text" name="CCAddrs"  style="width: 61%;" value=${ CCAddrs } onfocus="selected('notificationTplCCAddress')"><br> 
     59            <input name="CAasCCAddr" type="checkbox" id="CAasCCAddr" value="coAuthors"><span>${ _("Co-Authors") }</span> 
    5960        </td> 
    6061    </tr> 
Note: See TracChangeset for help on using the changeset viewer.