Exemple #1
0
 def _process(self):
     error=[]
     if self._cancel:
         self._redirect(urlHandlers.UHAbstractModNotifTplDisplay.getURL(self._target))
         return
     elif self._save:
         if len(self._toList)<=0:
             error.append( _("""At least one "To Address" must be seleted """))
             p=WPModCFANotifTplEdit(self, self._target)
             return p.display(errorList=error, \
                                 title=self._title, \
                                 subject=self._subject, \
                                 body=self._body, \
                                 fromAddr=self._fromAddr, \
                                 toList=self._toList, \
                                 ccList=self._ccList)
         else:
             self._notifTpl.setName(self._title)
             self._notifTpl.setDescription(self._description)
             self._notifTpl.setTplSubject(self._subject, EmailNotificator.getVarList())
             self._notifTpl.setTplBody(self._body, EmailNotificator.getVarList())
             self._notifTpl.setFromAddr(self._fromAddr)
             self._notifTpl.setCCAddrList(self._ccList)
             self._notifTpl.setCAasCCAddr(self._CAasCCAddr)
             self._notifTpl.clearToAddrs()
             for toAddr in self._toList:
                 toAddrWrapper=NotifTplToAddrsFactory.getToAddrById(toAddr)
                 if toAddrWrapper:
                     toAddrWrapper.addToAddr(self._notifTpl)
             self._redirect(urlHandlers.UHAbstractModNotifTplDisplay.getURL(self._target))
             return
     else:
         p=WPModCFANotifTplEdit(self, self._target)
         return p.display()
 def _setValues(self):
     self._notifTpl.setName(self._title)
     self._notifTpl.setDescription(self._description)
     self._notifTpl.setTplSubject(self._subject, EmailNotificator.getVarList())
     self._notifTpl.setTplBody(self._body, EmailNotificator.getVarList())
     self._notifTpl.setFromAddr(self._fromAddr)
     self._notifTpl.setCCAddrList(self._ccList)
     self._notifTpl.setCAasCCAddr(self._CAasCCAddr)
     self._notifTpl.clearToAddrs()
     for toAddr in self._toList:
         toAddrWrapper=NotifTplToAddrsFactory.getToAddrById(toAddr)
         if toAddrWrapper:
             toAddrWrapper.addToAddr(self._notifTpl)
Exemple #3
0
    def _process(self):
        if self._cancel:
            self._redirect(
                urlHandlers.UHAbstractReviewingNotifTpl.getURL(self._conf))
            return
        elif self._save:
            if len(self._toList) <= 0:
                raise NoReportError(
                    _("""At least one "To Address" must be selected"""))
            elif self._tplCondition is None:
                #TODO: translate
                raise NoReportError(_("Choose a condition"))
            else:
                tpl = review.NotificationTemplate()
                tpl.setName(self._title)
                tpl.setDescription(self._description)
                tpl.setTplSubject(self._subject, EmailNotificator.getVarList())
                tpl.setTplBody(self._body, EmailNotificator.getVarList())
                tpl.setFromAddr(self._fromAddr)
                tpl.setCCAddrList(self._ccList)
                tpl.setCAasCCAddr(self._CAasCCAddr)

                for toAddr in self._toList:
                    toAddrWrapper = NotifTplToAddrsFactory.getToAddrById(
                        toAddr)
                    if toAddrWrapper:
                        toAddrWrapper.addToAddr(tpl)
                self._conf.getAbstractMgr().addNotificationTpl(tpl)

                # Add the condition
                condWrapper = NotifTplConditionsFactory.getConditionById(
                    self._tplCondition)
                if condWrapper:
                    condWrapper.addCondition(tpl, **self._otherData)
                self._redirect(
                    urlHandlers.UHAbstractModNotifTplDisplay.getURL(tpl))
                return
        p = WPModCFANotifTplNew(self, self._target)
        return p.display(title = self._title,\
                        description = self._description,\
                        subject = self._subject,\
                        body = self._body,\
                        fromAddr = self._fromAddr,\
                        toList = self._toList,\
                        ccList = self._ccList)
Exemple #4
0
    def _process(self):
        error = []
        if self._cancel:
            self._redirect(urlHandlers.UHAbstractReviewingNotifTpl.getURL( self._conf )  )
            return
        elif self._save:
            if len(self._toList) <= 0:
                error.append( _("""At least one "To Address" must be selected"""))
            elif self._tplCondition is None:
                #TODO: translate
                error.append( _("Choose a condition"))
            else:
                tpl = review.NotificationTemplate()
                tpl.setName(self._title)
                tpl.setDescription(self._description)
                tpl.setTplSubject(self._subject, EmailNotificator.getVarList())
                tpl.setTplBody(self._body, EmailNotificator.getVarList())
                tpl.setFromAddr(self._fromAddr)
                tpl.setCCAddrList(self._ccList)
                tpl.setCAasCCAddr(self._CAasCCAddr)

                for toAddr in self._toList:
                    toAddrWrapper = NotifTplToAddrsFactory.getToAddrById(toAddr)
                    if toAddrWrapper:
                        toAddrWrapper.addToAddr(tpl)
                self._conf.getAbstractMgr().addNotificationTpl(tpl)

                # Add the condition
                condWrapper = NotifTplConditionsFactory.getConditionById(self._tplCondition)
                if condWrapper:
                    condWrapper.addCondition(tpl, **self._otherData)
                self._redirect(urlHandlers.UHAbstractModNotifTplDisplay.getURL(tpl))
                return
        p = WPModCFANotifTplNew(self,self._target)
        return p.display(title = self._title,\
                        description = self._description,\
                        subject = self._subject,\
                        body = self._body,\
                        fromAddr = self._fromAddr,\
                        toList = self._toList,\
                        ccList = self._ccList,\
                        errorList = error)
Exemple #5
0
 def _process(self):
     if self._cancel:
         self._redirect(
             urlHandlers.UHAbstractModNotifTplDisplay.getURL(self._target))
         return
     elif self._save:
         if len(self._toList) <= 0:
             raise NoReportError(
                 _("""At least one "To Address" must be seleted """))
             p = WPModCFANotifTplEdit(self, self._target)
             return p.display(title=self._title,
                              subject=self._subject,
                              body=self._body,
                              fromAddr=self._fromAddr,
                              toList=self._toList,
                              ccList=self._ccList)
         else:
             self._notifTpl.setName(self._title)
             self._notifTpl.setDescription(self._description)
             self._notifTpl.setTplSubject(self._subject,
                                          EmailNotificator.getVarList())
             self._notifTpl.setTplBody(self._body,
                                       EmailNotificator.getVarList())
             self._notifTpl.setFromAddr(self._fromAddr)
             self._notifTpl.setCCAddrList(self._ccList)
             self._notifTpl.setCAasCCAddr(self._CAasCCAddr)
             self._notifTpl.clearToAddrs()
             for toAddr in self._toList:
                 toAddrWrapper = NotifTplToAddrsFactory.getToAddrById(
                     toAddr)
                 if toAddrWrapper:
                     toAddrWrapper.addToAddr(self._notifTpl)
             self._redirect(
                 urlHandlers.UHAbstractModNotifTplDisplay.getURL(
                     self._target))
             return
     else:
         p = WPModCFANotifTplEdit(self, self._target)
         return p.display()