Ejemplo n.º 1
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:
                self._notifTpl = review.NotificationTemplate()
                self._setValues()
                self._conf.getAbstractMgr().addNotificationTpl(self._notifTpl)

                # Add the condition
                condWrapper = NotifTplConditionsFactory.getConditionById(
                    self._tplCondition)
                if condWrapper:
                    condWrapper.addCondition(self._notifTpl, **self._otherData)
                self._redirect(
                    urlHandlers.UHAbstractModNotifTplDisplay.getURL(
                        self._notifTpl))
                return
        p = WPModCFANotifTplNew(self, self._target)
        return p.display()
Ejemplo n.º 2
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)
Ejemplo n.º 3
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)
Ejemplo n.º 4
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:
                self._notifTpl = review.NotificationTemplate()
                self._setValues()
                self._conf.getAbstractMgr().addNotificationTpl(self._notifTpl)

                # Add the condition
                condWrapper = NotifTplConditionsFactory.getConditionById(self._tplCondition)
                if condWrapper:
                    condWrapper.addCondition(self._notifTpl, **self._otherData)
                self._redirect(urlHandlers.UHAbstractModNotifTplDisplay.getURL(self._notifTpl))
                return
        p = WPModCFANotifTplNew(self,self._target)
        return p.display()