Пример #1
0
    def _process(self):
        if self._target.isClosed():
            return conferences.WPConferenceModificationClosed(
                self, self._target).display()
        else:
            if self.__templateId and self.__templateData and not self.__deleteTemplateId:

                if self.__new:
                    self._target.getBadgeTemplateManager().storeTemplate(
                        self.__templateId, self.__templateData)
                    key = "tempBackground-%s-%s" % (self._conf.id,
                                                    self.__templateId)
                    filePaths = session.get(key)
                    if filePaths:
                        cfg = Config.getInstance()
                        tempPath = cfg.getUploadedFilesSharedTempDir()
                        for filePath in filePaths:
                            self._target.getBadgeTemplateManager(
                            ).getTemplateById(
                                self.__templateId).addTempBackgroundFilePath(
                                    filePath)
                            self._tempFilesToDelete.append(
                                os.path.join(tempPath, filePath))
                        self._target.getBadgeTemplateManager().getTemplateById(
                            self.__templateId).archiveTempBackgrounds(
                                self._conf)
                else:
                    self._target.getBadgeTemplateManager().storeTemplate(
                        self.__templateId, self.__templateData)

            elif self.__deleteTemplateId:
                self._target.getBadgeTemplateManager().deleteTemplate(
                    self.__deleteTemplateId)

            elif self.__copyTemplateId:
                self._target.getBadgeTemplateManager().copyTemplate(
                    self.__copyTemplateId)
            elif self.__cancel:
                if self._target.getBadgeTemplateManager().hasTemplate(
                        self.__templateId):
                    self._target.getBadgeTemplateManager().getTemplateById(
                        self.__templateId).deleteTempBackgrounds()
                else:
                    key = "tempBackground-%s-%s" % (self._conf.id,
                                                    self.__templateId)
                    session.pop(key, None)

            if self._target.getId() == "default":
                p = admins.WPBadgeTemplates(self)
                url = urlHandlers.UHBadgeTemplates.getURL()
            else:
                p = conferences.WPConfModifBadgePrinting(self, self._target)
                url = urlHandlers.UHConfModifBadgePrinting.getURL(self._target)
            if request.method == 'POST':
                self._redirect(url)
            else:
                return p.display()
Пример #2
0
 def _process( self ):
     p = adminPages.WPBadgeTemplates(self)
     return p.display()