def _getSectionsHTML(self): modPay=self._conf.getModPay() html=[] enabledBulb = Configuration.Config.getInstance().getSystemIconURL( "enabledSection" ) notEnabledBulb = Configuration.Config.getInstance().getSystemIconURL( "disabledSection" ) enabledText = _("Click to disable") disabledText = _("Click to enable") for gs in modPay.getSortedModPay(): urlStatus = urlHandlers.UHConfModifEPaymentEnableSection.getURL(self._conf) urlStatus.addParam("epayment", gs.getId()) urlModif = gs.getConfModifEPaymentURL(self._conf) img = enabledBulb text = enabledText if not gs.isEnabled(): img = notEnabledBulb text = disabledText pluginHTML = gs.getPluginSectionHTML(self._conf, self._user, urlStatus, urlModif, img, text) html.append(pluginHTML) html.insert(0, """<a href="" name="sections"></a><input type="hidden" name="oldpos"><table align="left">""") html.append("</table>") return "".join(html)
def getVars( self ): vars = wcomponents.WTemplated.getVars(self) modPay=self._conf.getModPay() vars["setStatusURL"]=urlHandlers.UHConfModifEPaymentChangeStatus.getURL(self._conf) vars["enablePic"]=quoteattr(str(Configuration.Config.getInstance().getSystemIconURL( "enabledSection" ))) vars["disablePic"]=quoteattr(str(Configuration.Config.getInstance().getSystemIconURL( "disabledSection" ))) if modPay.isActivated(): vars["changeTo"] = "False" vars["status"] = _("ENABLED") vars["changeStatus"] = _("DISABLE") vars["disabled"] = "" vars["detailPayment"] = self._conf.getModPay().getPaymentDetails() vars["conditionsPayment"] = self._conf.getModPay().getPaymentConditions() vars["specificConditionsPayment"] = self._conf.getModPay().getPaymentSpecificConditions() vars["successMsgPayment"] = self._conf.getModPay().getPaymentSuccessMsg() vars["receiptMsgPayment"] = self._conf.getModPay().getPaymentReceiptMsg() vars["conditionsEnabled"] = "DISABLED" if self._conf.getModPay().arePaymentConditionsEnabled(): vars["conditionsEnabled"] = "ENABLED" vars["Currency"]=self._conf.getRegistrationForm().getCurrency() or _("not selected") else: vars["changeTo"] = "True" vars["status"] = _("DISABLED") vars["changeStatus"] = _("ENABLE") vars["disabled"] = "disabled" vars["detailPayment"] = "" vars["conditionsPayment"] = "" vars["conditionsEnabled"] = "DISABLED" vars["specificConditionsPayment"] = "" vars["successMsgPayment"] = "" vars["receiptMsgPayment"] = "" vars["Currency"] = "" vars["dataModificationURL"]=urlHandlers.UHConfModifEPaymentdetailPaymentModification.getURL(self._conf) vars["sections"] = self._getSectionsHTML() return vars
def merge(self, tplId, htmlText, helpText): """ Perform the merge between a regular HTML document and a WOHL specification @param tplId: the id of the page template (name) @type tplId: string @param htmlText: (X)HTML code @type htmlText: string @param helpText: XML code @type helpText: string """ try: parser = WOHLParser(helpText,"en") if not parser.getPages().has_key(tplId): raise MaKaCError( _("WOHL File has no reference to page %s") % tplId) else: # f = file("c:/logMerge.log", 'a') # f.write("\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#Entree de Merge dans contextHelp\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\n\n\n\n") # f.write("%s\n\n\n\n\n\n"%htmlText) # f.close() return self.__doMerge(htmlText,parser.getPages()[tplId]) except WOHLParserException, e: raise MaKaCError( _("Exception parsing context help information: ")+str(e))
def __readTranslation(self, transNode): """ Read a <translation /> node, and return a tuple representing it @param transNode: the translation, a DOM Node @type transNode: xml.dom.Node @return: tuple with the text and helpref structures, for this specific language """ text = None refs = [] for child in transNode.childNodes: if child.nodeType != minidom.Node.ELEMENT_NODE: continue if child.tagName == "text": text = self.__readText(child) elif child.tagName == "helpref": refs.append(self.__readHelpRef(child)) else: raise WOHLParserException( _("Element not allowed here!")) if text == None: raise WOHLParserException( _("Translation should have a <text /> element!")) return (text,refs)
def setRoomBooking( self, params ): if not params.has_key( 'resvID' ): raise errors.MaKaCError( _("resvID not set")) if not params.has_key( 'roomLocation' ): raise errors.MaKaCError( _("roomLocation not set")) self.__resvID = int( params['resvID'] ) self.__location = params['roomLocation']
def __init__(self, helpString, language): """ Constructor @param helpString: the XML input for the parser @type helpString: string @param language: the language which the translations should be fetched in @type language: string (TLD/ISO 3166-1 alpha-2 code) """ dom = minidom.parseString(helpString) self.__pages = {} self.__language = language root = dom.documentElement if root.tagName != "wohl": raise WOHLParserException( _("Wrong root node!")) for child in root.childNodes: if child.nodeType != minidom.Node.ELEMENT_NODE: continue if child.tagName != "page": raise WOHLParserException( _("Element not allowed here!")) self.__pages[child.attributes["name"].nodeValue] = self.__readPage(child)
def getVars(self): vars = wcomponents.WTemplated.getVars(self) authorObj = self._contrib.getAuthorById(self._authorId) not_found = NotFoundError( _("No author with id {} was found").format(self._authorId), title=_("Author not found") ) if authorObj is None: raise not_found authorList = self._conf.getAuthorIndex().getByAuthorObj(authorObj) if authorList is None: raise not_found author = authorList[0] vars["contributions"] = [ auth.getContribution() for auth in authorList if auth.getContribution().getConference() ] vars["fullName"] = author.getFullName() if self._aw.getUser() is not None: vars["email"] = author.getEmail() vars["address"] = author.getAddress() vars["telephone"] = author.getPhone() vars["fax"] = author.getFax() vars["affiliation"] = author.getAffiliation() return vars
def setStatusDeclined(self, responsibleUser=None, sendMail=True): if self._status != "pending" : return False self._status = "declined" logData = self.getParticipantData() logData["subject"] = _("%s : status set to DECLINED")%self.getWholeName() self.getConference().getLogHandler().logAction(logData,"participants",responsibleUser) if sendMail: data = {} data["fromAddr"] = info.HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail() confTitle = self._participation.getConference().getTitle() data["subject"] = _("Your application for attendance in %s declined")%confTitle toList = [] toList.append(self._email) title = "" if self._title == "" or self._title is None : title = self._firstName else: title = self._title data["toList"] = toList data["body"] = _(""" Dear %s %s, your request to attend the %s has been declined by the event manager. Your Indico """)%(title, self._familyName, confTitle) GenericMailer.sendAndLog(GenericNotification(data),self.getConference(),"participants",responsibleUser) return True
def getHTML( self, params ): rc="" rcPRM="" if self._conf.getConfPaperReview().getChoice() == CPR.NO_REVIEWING: message = _("Type of reviewing has not been chosen yet. You can choose it from Paper Reviewing ") setupText = _("Setup.") return """<table align="left"><tr><td style="padding-left: 25px; padding-top:10px; color:gray;"> %s <a href="%s">%s</a></td></tr></table>"""% (message, urlHandlers.UHConfModifReviewingPaperSetup.getURL(self._conf), setupText) else: rcPRM = WConfModificationReviewingFramePRM().getHTML(self._conf, \ params["addPaperReviewManagerURL"], \ params["removePaperReviewManagerURL"]) rc = WConfModificationReviewingFrame().getHTML( self._conf,\ params["addRefereeURL"], \ params["removeRefereeURL"], \ params["addEditorURL"], \ params["removeEditorURL"], \ params["addReviewerURL"], \ params["removeReviewerURL"]) return """<table width="100%%" class="Revtab"><tr><td>%s</td></tr><tr><td>%s</td></tr></table>"""%(rcPRM, rc)
def getVars(self): vars = wcomponents.WTemplated.getVars( self ) vars["title"] = self.htmlText(self._subContrib.getTitle()) vars["description"]=self._subContrib.getDescription() vars["id"]= self.htmlText(self._subContrib.getId()) vars["duration"] =(datetime(1900,1,1)+self._subContrib.getDuration()).strftime("%H:%M") vars["location"]="blah" loc=self._subContrib.getLocation() if loc is not None: vars["location"]="<i>%s</i>"%(self.htmlText(loc.getName())) if loc.getAddress() is not None and loc.getAddress()!="": vars["location"]="%s <pre>%s</pre>"%(vars["location"],loc.getAddress()) room=self._subContrib.getRoom() if room is not None: roomLink=linking.RoomLinker().getHTMLLink(room,loc) vars["location"]= _("""%s<br><small> _("Room"):</small> %s""")%(\ vars["location"],roomLink) vars["location"]=self._getHTMLRow( _("Place"),vars["location"]) vars["material"]=self._getMaterialHTML() vars["inContrib"]="" if self._subContrib.getParent() is not None: url=urlHandlers.UHContributionDisplay.getURL(self._subContrib.getParent()) ContribCaption="%s"%self._subContrib.getParent().getTitle() vars["inContrib"]="""<a href=%s>%s</a>"""%(\ quoteattr(str(url)),self.htmlText(ContribCaption)) vars["inContrib"]=self._getHTMLRow( _("Included in contribution"),vars["inContrib"]) l=[] for speaker in self._subContrib.getSpeakerList(): l.append(self.htmlText(speaker.getFullName())) vars["speakers"]=self._getHTMLRow( _("Presenters"),"<br>".join(l)) return vars
def _process(self): if self._params.get("OK"): if self._params.get("password", "") == "" or self._params.get("passwordBis", "") == "": self._params["msg"] = _("Both password and password confirmation fields must be filled up") del self._params["OK"] p = adminPages.WPIdentityChangePassword(self, self._avatar, self._params) return p.display() if self._params.get("password", "") != self._params.get("passwordBis", ""): self._params["msg"] = _("Password and password confirmation are not equal") del self._params["OK"] p = adminPages.WPIdentityChangePassword(self, self._avatar, self._params) return p.display() identity = self._avatar.getIdentityById(self._params["login"], "Local") if not identity: self._params["msg"] = _("You can NOT change others' passwords") del self._params["OK"] p = adminPages.WPIdentityChangePassword(self, self._avatar, self._params) return p.display() identity.setPassword(self._params["password"]) self._redirect(urlHandlers.UHUserDetails.getURL(self._avatar)) elif self._params.get("Cancel"): self._redirect(urlHandlers.UHUserDetails.getURL(self._avatar)) else: self._params["msg"] = "" p = adminPages.WPIdentityChangePassword(self, self._avatar, self._params) return p.display()
def _send(msgData): server=smtplib.SMTP(*Config.getInstance().getSmtpServer()) if Config.getInstance().getSmtpUseTLS(): server.ehlo() (code, errormsg) = server.starttls() if code != 220: raise MaKaCError( _("Can't start secure connection to SMTP server: %d, %s")%(code, errormsg)) if Config.getInstance().getSmtpLogin(): login = Config.getInstance().getSmtpLogin() password = Config.getInstance().getSmtpPassword() (code, errormsg) = server.login(login, password) if code != 235: raise MaKaCError( _("Can't login on SMTP server: %d, %s")%(code, errormsg)) to_addrs = msgData['toList'] | msgData['ccList'] | msgData['bccList'] try: Logger.get('mail').info('Sending email: To: {} / CC: {} / BCC: {}'.format( ', '.join(msgData['toList']) or 'None', ', '.join(msgData['ccList']) or 'None', ', '.join(msgData['bccList']) or 'None')) server.sendmail(msgData['fromAddr'], to_addrs, msgData['msg']) except smtplib.SMTPRecipientsRefused as e: raise MaKaCError('Email address is not valid: {}'.format(e.recipients)) finally: server.quit() Logger.get('mail').info('Mail sent to {}'.format(', '.join(to_addrs)))
def _getTaskList(self): html = [] taskList = self._target.getTaskList()[:] if self._listOrder == "1" : taskList.sort(task.Task.cmpTaskId) if self._listOrder == "2" : taskList.sort(task.Task.cmpTaskTitle) if self._listOrder == "3" : taskList.sort(task.Task.cmpTaskCurrentStatus) if self._listOrder == "4" : taskList.sort(task.Task.cmpTaskCreationDate) for t in taskList : if self._taskFilter == "" or self._taskFilter == t.getCurrentStatus().getStatusName() : urlDetails = urlHandlers.UHTaskDetails.getURL(self._target) urlDetails.addParam("taskId",t.getId()) urlComment = urlHandlers.UHTaskCommentNew.getURL(self._target) urlComment.addParam("taskId",t.getId()) tz = DisplayTZ(self._aw,None,useServerTZ=1).getDisplayTZ() creationDate = "%s"%t.getCreationDate().astimezone(timezone(tz)) text = _(""" <tr> <td> %s</td> <td> <a href="%s">%s</a></td> <td> %s</td> <td> %s</td> <td align="center"> %s</td> <td align="center"><a href="%s"> _("comment")</a></td> </tr> """)%(t.getId(),urlDetails,t.getTitle(), _(t.getCurrentStatus().getStatusName()), creationDate[0:16], t.getCommentHistorySize(),urlComment) html.append(text) return """ """.join(html)
def _checkParams(self): CollaborationPluginServiceBookingModifBase._checkParams(self) participantId = self._params.get("participantId", None) if participantId: self._participant = self._booking.getParticipantById(participantId) else: raise CERNMCUException( _("Service ") + str(self.__class__.__name__) + _(" called without a participantId parameter"))
def getVars( self ): vars = wcomponents.WTemplated.getVars(self) evaluation = self._conf.getEvaluation() vars["evaluation"] = evaluation vars["Box"] = Box vars["Choice"] = Choice vars["actionUrl"] = urlHandlers.UHConfModifEvaluationResultsOptions.getURL(self._conf) vars["selectSubmitters"] = Evaluation._SELECT_SUBMITTERS vars["removeSubmitters"] = Evaluation._REMOVE_SUBMITTERS #submitters if len(vars["selectedSubmissions"]) > 0 : selectedSubmissions = vars["selectedSubmissions"] else: selectedSubmissions = evaluation.getSubmissions() submitters = [sub.getSubmitterName() for sub in selectedSubmissions if isinstance(sub, Submission)] vars["submittersContext"] = "<br/> ".join(submitters) if evaluation.getNbOfSubmissions() < 1 : vars["submittersVisible"] = _("NONE") elif len(submitters) >= evaluation.getNbOfSubmissions() : vars["submittersVisible"] = _("ALL") elif len(submitters) > 3 : del submitters[3:] submitters.append("...") vars["submittersVisible"] = "; ".join(submitters).replace(", ", " ") else: vars["submittersVisible"] = "; ".join(submitters).replace(", ", " ") return vars
def _checkParams(self, params): base.RHProtected._checkParams(self, params) self._statusValue = "OK" self._message = "" try: self._title = params.get( "title", "" ).strip() self._startdate = params.get( "startdate", "" ).strip() self._enddate = params.get( "enddate", "" ).strip() self._place = params.get( "place", "" ).strip() self._room = params.get( "room", "" ).strip() self._accessPassword = params.get( "an", "" ).strip() self._modifyPassword = params.get( "mp", "" ).strip() self._style = params.get( "style", "" ).strip() self._fid = params.get( "fid", "" ).strip() self._description = params.get( "description", "" ).strip() self._stime = params.get( "stime", "" ).strip() self._etime = params.get( "etime", "" ).strip() self._speaker = params.get( "speaker", "" ).strip() self._speakeremail = params.get( "email", "" ).strip() self._speakeraffiliation = params.get( "affiliation", "" ).strip() if not self._title or not self._startdate or not self._enddate or not self._fid or not self._stime or not self._etime: raise MaKaCError( _("mandatory parameter missing")) ch = CategoryManager() try: self._cat = ch.getById(self._fid) except: raise MaKaCError( _("unknown category")) except MaKaCError, e: self._statusValue = "ERROR" self._message = e.getMsg()
def meetingAndLectureDisplay(cls, obj, params): out = params['out'] conf = params['conf'] if DBHelpers.roomsToShow(conf): linksList = PluginsHolder().getPluginType('InstantMessaging').getOption('customLinks').getValue() out.openTag("chatrooms") for chatroom in DBHelpers.getShowableRooms(conf): out.openTag("chatroom") out.writeTag("id", chatroom.getId()) out.writeTag("name", chatroom.getTitle()) out.writeTag("server", 'conference.' + chatroom.getHost() if chatroom.getCreatedInLocalServer() else chatroom.getHost()) out.writeTag("description", chatroom.getDescription()) out.writeTag("reqPassword", _('Yes') if chatroom.getPassword() else _('No')) out.writeTag("showPassword", chatroom.getShowPass()) out.writeTag("password", chatroom.getPassword()) out.writeTag("createdInLocalServer", chatroom.getCreatedInLocalServer()) out.openTag("links") if linksList.__len__() > 0: out.writeTag("linksToShow", 'true') else: out.writeTag("linksToShow", 'false') for link in linksList: out.openTag("customLink") out.writeTag("name", link['name']) out.writeTag("structure", GeneralLinkGenerator(chatroom, link['structure']).generate()) out.closeTag("customLink") out.closeTag("links") out.closeTag("chatroom") out.closeTag("chatrooms") out.writeTag("how2connect", PluginFieldsWrapper('InstantMessaging', 'XMPP').getOption('ckEditor'))
def _sendErrorEmail(self, e): ty, ex, tb = sys.exc_info() tracebackList = traceback.format_list(traceback.extract_tb(tb)) text = ( _( """ Offline website creation for the [event:%s] had caused an error while running the task. - Request from user: %s <%s> - Details of the exception: %s - Traceback: %s -- <Indico support> indico-project @ cern.ch """ ) % (self._conf.getId(), self._toUser.getFullName(), self._toUser.getEmail(), e, "\n".join(tracebackList)) ) maildata = { "fromAddr": Config.getInstance().getSupportEmail(), "toList": [Config.getInstance().getSupportEmail()], "subject": _("[Indico] Error in task: Offline website creation"), "body": text, } GenericMailer.send(GenericNotification(maildata))
def getVars(self): vars=wcomponents.WTemplated.getVars(self) authorObj = self._contrib.getAuthorById(self._authorId) if authorObj is None: raise MaKaCError( _("Not found the author: %s")%self._authorId) authorList=self._conf.getAuthorIndex().getByAuthorObj(authorObj) author = None if authorList is not None: author=authorList[0] else: raise MaKaCError( _("Not found the author: %s")%self._authorId) contribList = [] for auth in authorList: contrib=auth.getContribution() if contrib is not None: url=urlHandlers.UHContributionDisplay.getURL(contrib) material = self._getMaterialHTML(contrib) if material.strip()!="": material = " ( %s )"%material contribList.append("""<p style="text-indent: -3em;margin-left:3em"><a href=%s">%s-%s</a>%s</p>"""%(quoteattr(str(url)),self.htmlText(contrib.getId()),self.htmlText(contrib.getTitle()), material )) vars["contributions"] = "".join(contribList) vars["fullName"] = author.getFullName() vars["mailURL"]=urlHandlers.UHConferenceEmail.getURL(author) vars["mailIcon"]=Config.getInstance().getSystemIconURL("mail_big") vars["address"] = author.getAddress() vars["telephone"] = author.getPhone() vars["fax"] = author.getFax() vars["organisation"] = author.getAffiliation() return vars
def setRoom(self, params): if not params.has_key("roomID"): raise errors.MaKaCError(_("roomID not set")) if not params.has_key("roomLocation"): raise errors.MaKaCError(_("roomLocation not set")) self.__roomID = int(params["roomID"]) self.__location = params["roomLocation"]
def _createTabCtrl(self): self._tabCtrl = wcomponents.TabControl() self._subTabConfiguration = self._tabCtrl.newTab("configuration", _("Configuration"), urlHandlers.UHAdminsSystem.getURL()) self._subTabMaintenance = self._tabCtrl.newTab("maintenance", _("Maintenance"), urlHandlers.UHMaintenance.getURL())
def getVars( self ): ########### #variables# ########### vars = wcomponents.WTemplated.getVars(self) mode = vars.get("mode","") #actual mode (add, edit, ...) error = vars.get("error","") #error message questionType = vars.get("type","") #which question type is selected questionPos = int(vars.get("questionPos",-1)) #position of selected question, used when mode is EDIT. ########### #left menu# ########### self._leftMenu(questionType, vars) ###### #main# ###### if mode==Question._ADD: if questionType not in Question._QUESTION_SUBTYPES: raise FormValuesError( _("Unknown question type !"), _("Evaluation")) vars["main"] = WConfModifEvaluationEditQuestion(self._conf, mode, error, questionType, None).getHTML() elif mode==Question._EDIT: question = self._conf.getEvaluation().getQuestionAt(questionPos) if question == None: raise FormValuesError( _("No question found at the given position!"), _("Evaluation")) else: questionType = question.getTypeName() vars["main"] = WConfModifEvaluationEditQuestion(self._conf, mode, error, questionType, question).getHTML() else: #When no mode is selected, by default it shows the global view of questions. vars["main"] = "" for q in self._conf.getEvaluation().getQuestions(): vars["main"] += str(WConfModifEvaluationEditQuestionView(q).getHTML()) return vars
def _createTabCtrl(self): self._tabCtrl = wcomponents.TabControl() self._tabMain = self._tabCtrl.newTab( "main", _("Main"), urlHandlers.UHMaterialModification.getURL(self._material) ) self._tabAC = self._tabCtrl.newTab("ac", _("Protection"), urlHandlers.UHMaterialModifAC.getURL(self._material)) self._setActiveTab()
def _checkParams(self,params): RHConferenceModifBase._checkParams(self,params) self._action="" if params.has_key("CANCEL"): self._action="CANCEL" elif params.has_key("OK"): self._action="EDIT" self._sDate,self._eDate=None,None tz = self._target.getTimezone() if params.get("start_date","conference")=="own": try: self._sDate=timezone(tz).localize(datetime(int(params["sYear"]), int(params["sMonth"]), int(params["sDay"]), int(params["sHour"]), int(params["sMin"]))).astimezone(timezone('UTC')) except ValueError: raise MaKaCError( _("Please enter integers in all the start date fields"), _("Schedule")) if params.get("end_date","conference")=="own": try: self._eDate=timezone(tz).localize(datetime(int(params["eYear"]), int(params["eMonth"]), int(params["eDay"]), int(params["eHour"]), int(params["eMin"]))).astimezone(timezone('UTC')) except ValueError: raise MaKaCError( _("Please enter integers in all the end date fields"), _("Schedule"))
def _checkParams( self, params ): RHAbstractModifBase._checkParams(self, params) self._action = "" self._answers = [] if params.has_key("OK"): self._action = "GO" conf=self._target.getConference() self._track = conf.getTrackById(params.get("track","")) if self._track is None: raise FormValuesError( _("You have to choose a track in order to do the proposal. If there are not tracks to select, please change the track assignment of the abstract from its management page")) self._contribType = self._conf.getContribTypeById(params.get("contribType","")) self._comment = params.get("comment","") scaleLower = conf.getConfAbstractReview().getScaleLower() scaleHigher = conf.getConfAbstractReview().getScaleHigher() numberOfAnswers = conf.getConfAbstractReview().getNumberOfAnswers() c = 0 for question in conf.getConfAbstractReview().getReviewingQuestions(): c += 1 if not params.has_key("RB_"+str(c)): raise FormValuesError(_("Please, reply to all the reviewing questions. Question \"%s\" is missing the answer.")%question.getText()) rbValue = int(params.get("RB_"+str(c),scaleLower)) newId = conf.getConfAbstractReview().getNewAnswerId() newAnswer = Answer(newId, rbValue, numberOfAnswers, question) newAnswer.calculateRatingValue(scaleLower, scaleHigher) self._answers.append(newAnswer) elif params.has_key("CANCEL"): self._action="CANCEL"
def getVars(self): vars = wcomponents.WTemplated.getVars(self) authorObj = self._contrib.getAuthorById(self._authorId) not_found = NotFoundError(_("No author with id {} was found").format(self._authorId), title=_("Author not found")) if authorObj is None: raise not_found authorList = self._conf.getAuthorIndex().getByAuthorObj(authorObj) if authorList is None: raise not_found author = authorList[0] contribList = [] for auth in authorList: contrib = auth.getContribution() if contrib is not None: contribList.append({'title': contrib.getTitle(), 'url': str(urlHandlers.UHContributionDisplay.getURL(auth.getContribution())), 'materials': fossilize(contrib.getAllMaterialList())}) vars["contributions"] = contribList vars["fullName"] = author.getFullName() if self._aw.getUser() is not None: vars["email"] = author.getEmail() vars["address"] = author.getAddress() vars["telephone"] = author.getPhone() vars["fax"] = author.getFax() vars["affiliation"] = author.getAffiliation() return vars
def _checkParams(self, params): RHSessionModifBase._checkParams(self, params) self._slotId = params.get("slotId", "") self._cancel = params.has_key("CANCEL") self._ok = params.has_key("OK") self._hour = params.get("hour", "") self._minute = params.get("minute", "") self._action = params.get("action", "duration") self._currentDay = params.get("currentDay", "") self._inSessionTimetable = params.get("inSessionTimetable", "no") == "yes" if self._ok: if self._hour.strip() == "" or self._minute.strip() == "": raise MaKaCError( _( "Please write the time with the format HH:MM. For instance, 00:05 to indicate 'O hours' and '5 minutes'" ) ) try: if int(self._hour) or int(self._hour): pass except ValueError, e: raise MaKaCError( _( "Please write a number to specify the time HH:MM. For instance, 00:05 to indicate 'O hours' and '5 minutes'" ) )
def _setParam(self): ContextManager.set("dateChangeNotificationProblems", {}) if self._pTime < self._target.getStartDate(): raise ServiceError("ERR-E3", "Date/time of end cannot " + "be lower than data/time of start") self._target.setDates(self._target.getStartDate(), self._pTime.astimezone(timezone("UTC")), moveEntries=0) dateChangeNotificationProblems = ContextManager.get("dateChangeNotificationProblems") if dateChangeNotificationProblems: warningContent = [] for problemGroup in dateChangeNotificationProblems.itervalues(): warningContent.extend(problemGroup) return Warning( _("Warning"), [ _("The end date of your event was changed correctly."), _("However, there were the following problems:"), warningContent, ], ) else: return None
def _createTabCtrl(self): self._tabCtrl = wcomponents.TabControl() if self._isPRM or self._canModify: self._subTabPaperReviewingSetup = self._tabCtrl.newTab( "revsetup", _("Setup"),\ urlHandlers.UHConfModifReviewingPaperSetup.getURL( self._conf ) ) self._tabPaperReviewingControl = self._tabCtrl.newTab( "revcontrol", _("Team"),\ urlHandlers.UHConfModifReviewingControl.getURL( self._conf ) ) self._tabUserCompetencesReviewing = self._tabCtrl.newTab( "revcompetences", _("Competences"),\ urlHandlers.UHConfModifUserCompetences.getURL( self._conf ) ) if self._showAssignContributions: self._tabAssignContributions = self._tabCtrl.newTab( "assignContributions", _("Assign papers"),\ urlHandlers.UHConfModifReviewingAssignContributionsList.getURL( self._conf ) ) if self._showListContribToJudge and (self._conf.getConfPaperReview().getChoice() == CPR.CONTENT_REVIEWING or self._conf.getConfPaperReview().getChoice() == CPR.CONTENT_AND_LAYOUT_REVIEWING): self._tabListContribToJudge = self._tabCtrl.newTab( "contributionsToJudge", _("Assess as Referee"),\ urlHandlers.UHConfModifListContribToJudge.getURL( self._conf ) ) if self._showListContribToJudgeAsReviewer and (self._conf.getConfPaperReview().getChoice() == CPR.CONTENT_REVIEWING or self._conf.getConfPaperReview().getChoice() == CPR.CONTENT_AND_LAYOUT_REVIEWING): self._tabListContribToJudgeAsReviewer = self._tabCtrl.newTab( "contributionsToJudge", _("Assess as Content Reviewer"),\ urlHandlers.UHConfModifListContribToJudgeAsReviewer.getURL( self._conf ) ) if self._showListContribToJudgeAsEditor and (self._conf.getConfPaperReview().getChoice() == CPR.LAYOUT_REVIEWING or self._conf.getConfPaperReview().getChoice() == CPR.CONTENT_AND_LAYOUT_REVIEWING): self._tabListContribToJudgeAsEditor = self._tabCtrl.newTab( "contributionsToJudge", _("Assess as Layout Reviewer"),\ urlHandlers.UHConfModifListContribToJudgeAsEditor.getURL( self._conf ) ) self._setActiveTab()
def _getBody( self, params ): p = wcomponents.WNewPerson() if params.get("formTitle",None) is None : params["formTitle"] = _("Define new responsible") if params.get("titleValue",None) is None : params["titleValue"] = "" if params.get("surNameValue",None) is None : params["surNameValue"] = "" if params.get("nameValue",None) is None : params["nameValue"] = "" if params.get("emailValue",None) is None : params["emailValue"] = "" if params.get("addressValue",None) is None : params["addressValue"] = "" if params.get("affiliationValue",None) is None : params["affiliationValue"] = "" if params.get("phoneValue",None) is None : params["phoneValue"] = "" if params.get("faxValue",None) is None : params["faxValue"] = "" params["disabledSubmission"] = False params["submissionValue"] = _(""" <input type="checkbox" name="submissionControl"> _("Give submission rights to the presenter").""") params["disabledNotice"] = False params["noticeValue"] = _("""<i><font color="black"><b>_("Note"): </b></font>_("If this person does not already have an Indico account, he or she will be sent an email asking to create an account. After the account creation the user will automatically be given submission rights.")</i>""") formAction = urlHandlers.UHTaskNewPersonAdd.getURL(self._target) formAction.addParam("orgin","new") formAction.addParam("typeName","responsible") params["formAction"] = formAction return p.getHTML(params)
def _checkParams(self, params): RHTaskModifBase._checkParams(self, params) self._typeName = params.get("typeName", None) if self._typeName is None: raise MaKaCError(_("Type name of the person to add is not set."))
def _process(self): params = self._getRequestParams() self._errorList = [] #raise "%s"%params definedList = self._getDefinedList(self._typeName) if definedList is None: definedList = [] if params.get("orgin", "") == "new": #raise "new" if params.get("ok", None) is None: raise "not ok" self._redirect(urlHandlers.UHTaskNew.getURL(self._target)) return else: person = ContributionParticipation() person.setFirstName(params["name"]) person.setFamilyName(params["surName"]) person.setEmail(params["email"]) person.setAffiliation(params["affiliation"]) person.setAddress(params["address"]) person.setPhone(params["phone"]) person.setTitle(params["title"]) person.setFax(params["fax"]) if not self._alreadyDefined(person, definedList): definedList.append( [person, params.has_key("submissionControl")]) else: self._errorList.append( _("%s has been already defined as %s of this contribution" ) % (person.getFullName(), self._typeName)) elif params.get("orgin", "") == "selected": selectedList = self._normaliseListParam( self._getRequestParams().get("selectedPrincipals", [])) for s in selectedList: if s[0:8] == "*author*": auths = self._conf.getAuthorIndex() selected = auths.getById(s[9:])[0] else: ph = user.PrincipalHolder() selected = ph.getById(s) if isinstance(selected, user.Avatar): person = ContributionParticipation() person.setDataFromAvatar(selected) if not self._alreadyDefined(person, definedList): definedList.append( [person, params.has_key("submissionControl")]) else: self._errorList.append( _("%s has been already defined as %s of this contribution" ) % (person.getFullName(), self._typeName)) elif isinstance(selected, user.Group): for member in selected.getMemberList(): person = ContributionParticipation() person.setDataFromAvatar(member) if not self._alreadyDefined(person, definedList): definedList.append( [person, params.has_key("submissionControl")]) else: self._errorList.append( _("%s has been already defined as %s of this contribution" ) % (presenter.getFullName(), self._typeName)) else: person = ContributionParticipation() person.setTitle(selected.getTitle()) person.setFirstName(selected.getFirstName()) person.setFamilyName(selected.getFamilyName()) person.setEmail(selected.getEmail()) person.setAddress(selected.getAddress()) person.setAffiliation(selected.getAffiliation()) person.setPhone(selected.getPhone()) person.setFax(selected.getFax()) if not self._alreadyDefined(person, definedList): definedList.append( [person, params.has_key("submissionControl")]) else: self._errorList.append( _("%s has been already defined as %s of this contribution" ) % (person.getFullName(), self._typeName)) elif params.get("orgin", "") == "added": preservedParams = self._getPreservedParams() chosen = preservedParams.get("%sChosen" % self._typeName, None) if chosen is None or chosen == "": self._redirect( urlHandlers.UHConfModScheduleNewContrib.getURL( self._target)) return index = chosen.find("-") taskId = chosen[0:index] resId = chosen[index + 1:len(chosen)] taskObject = self._target.getTask(taskId) chosenPerson = taskObject.getResponsibleList()[int(resId)] if chosenPerson is None: self._redirect( urlHandlers.UHConfModScheduleNewContrib.getURL( self._target)) return person = ContributionParticipation() person.setTitle(chosenPerson.getTitle()) person.setFirstName(chosenPerson.getFirstName()) person.setFamilyName(chosenPerson.getFamilyName()) person.setEmail(chosenPerson.getEmail()) person.setAddress(chosenPerson.getAddress()) person.setAffiliation(chosenPerson.getAffiliation()) person.setPhone(chosenPerson.getPhone()) person.setFax(chosenPerson.getFax()) if not self._alreadyDefined(person, definedList): definedList.append( [person, params.has_key("submissionControl")]) else: self._errorList.append( _("%s has been already defined as %s of this contribution") % (person.getFullName(), self._typeName)) else: self._redirect(urlHandlers.UHConfModifSchedule.getURL( self._target)) return preservedParams = self._getPreservedParams() preservedParams["errorMsg"] = self._errorList self._preserveParams(preservedParams) self._websession.setVar("%sList" % self._typeName, definedList) self._redirect(urlHandlers.UHTaskNew.getURL(self._target))
def _checkParams(self, params): RHAdminPluginsBase._checkParams(self, params) if self._pluginType is None: raise PluginError(_("pluginType not set")) if self._pluginId is None: raise PluginError(_("pluginId not set"))
def _checkParams(self, params): RHAdminPluginsBase._checkParams(self, params) if self._pluginType is None: raise PluginError(_("pluginType not set")) elif not self._ph.hasPluginType(self._pluginType): raise PluginError("The plugin type " + self._pluginType + " does not exist, is not visible or is not active")
def _checkProtection(self): if self._target.getConference().hasEnabledSection("paperReviewing"): RHAssignEditorOrReviewerBase._checkProtection(self) else: raise MaKaCError( _("Paper Reviewing is not active for this conference"))
def _checkProtection(self): RHTrackAbstractBase._checkProtection(self) if not self._abstract.getConference().getConfAbstractReview().canReviewerAccept(): raise MaKaCError(_("The acceptance or rejection of abstracts is not allowed. Only the managers of the conference can perform this action."))
def _getCaption(cls, statusId): return _(cls._statusProps.get(statusId, [""])[0])
def getVars( self ): from MaKaC.registration import Notification vars = wcomponents.WTemplated.getVars(self) evaluation = self._conf.getEvaluation() evaluationStartNotification = evaluation.getNotification(Evaluation._EVALUATION_START) newSubmissionNotification = evaluation.getNotification(Evaluation._NEW_SUBMISSION) vars["setStatusURL"]=urlHandlers.UHConfModifEvaluationSetupChangeStatus.getURL(self._conf) vars["dataModificationURL"]=urlHandlers.UHConfModifEvaluationDataModif.getURL(self._conf) vars["specialActionURL"] = urlHandlers.UHConfModifEvaluationSetupSpecialAction.getURL(self._conf) vars["evaluation"] = evaluation vars["submissionsLimit"] = _("""--_("No limit")--""") if evaluation.getSubmissionsLimit() > 0: vars["submissionsLimit"] = evaluation.getSubmissionsLimit() vars["title"] = evaluation.getTitle() if evaluation.isMandatoryParticipant(): vars["mandatoryParticipant"] = _("Yes") else: vars["mandatoryParticipant"] = _("No") if evaluation.isMandatoryAccount(): vars["mandatoryAccount"] = _("Yes") else: vars["mandatoryAccount"] = _("No") if evaluation.isAnonymous() : vars["anonymous"] = _("Yes") else: vars["anonymous"] = _("No") if evaluationStartNotification == None : vars["evaluationStartNotifyTo"] = "" vars["evaluationStartNotifyCc"] = "" else : vars["evaluationStartNotifyTo"] = ", ".join(evaluationStartNotification.getToList()) vars["evaluationStartNotifyCc"] = ", ".join(evaluationStartNotification.getCCList()) if newSubmissionNotification == None : vars["newSubmissionNotifyTo"] = "" vars["newSubmissionNotifyCc"] = "" else : vars["newSubmissionNotifyTo"] = ", ".join(newSubmissionNotification.getToList()) vars["newSubmissionNotifyCc"] = ", ".join(newSubmissionNotification.getCCList()) ############## #if activated# ############## if evaluation.isVisible(): vars["changeTo"] = "False" vars["status"] = _("VISIBLE") if evaluation.getNbOfQuestions()<1 : vars["statusMoreInfo"] = _("""<span style="color: #E25300">(_("not ready"))</span>""") elif nowutc() < evaluation.getStartDate() : vars["statusMoreInfo"] = _("""<span style="color: #E25300">(_("not open yet"))</span>""") elif nowutc() > evaluation.getEndDate() : vars["statusMoreInfo"] = _("""<span style="color: #E25300">(_("closed"))</span>""") else: vars["statusMoreInfo"] = _("""<span style="color: green">(_("running"))</span>""") vars["changeStatus"] = _("HIDE") if evaluation.getStartDate() is None: vars["startDate"] = "" else: vars["startDate"] = evaluation.getStartDate().strftime("%A %d %B %Y") if evaluation.getEndDate() is None: vars["endDate"] = "" else: vars["endDate"] = evaluation.getEndDate().strftime("%A %d %B %Y") ################ #if deactivated# ################ else: vars["changeTo"] = "True" vars["status"] = _("HIDDEN") vars["statusMoreInfo"] = "" vars["changeStatus"] = _("SHOW") vars["startDate"] = "" vars["endDate"] = "" return vars
def _getTabContent( self, params ): return _("nothing")
def _checkProtection(self): conferenceModif.RHConferenceModifBase._checkProtection(self) if not self._conf.hasEnabledSection("evaluation"): raise MaKaCError( _("The Evaluation form was disabled by the conference managers." ), _("evaluation"))
def _importedXml(self, evaluation, params): """ Importation of an evaluation. Note: original 'isVisible' and the dates are kept. """ try: xmlString = params["xmlFile"].file.read() except AttributeError: #no file given self._redirect( urlHandlers.UHConfModifEvaluationSetup.getURL(self._conf)) return try: doc = parseString(xmlString) except: raise MaKaCError( _("""System can't import an evaluation from your file. Be sure to import the right XML file."""), _("evaluation")) #parse begins evalNode = self._getElement(doc, "evaluation") if params.get("configOption", "") == "imported": #parse node /evaluation/ title = self._getValue(evalNode, "title") announcement = self._getValue(evalNode, "announcement") submissionsLimit = self._getValue(evalNode, "submissionsLimit") contactInfo = self._getValue(evalNode, "contactInfo") mandatoryAccount = self._getValue(evalNode, "mandatoryAccount") mandatoryParticipant = self._getValue(evalNode, "mandatoryParticipant") anonymous = self._getValue(evalNode, "anonymous") evaluation.setTitle(title) evaluation.setAnnouncement(announcement) evaluation.setSubmissionsLimit(submissionsLimit) evaluation.setContactInfo(contactInfo) evaluation.setMandatoryAccount(mandatoryAccount) evaluation.setMandatoryParticipant(mandatoryParticipant) if anonymous.strip() == "": evaluation.setAnonymous(True) else: evaluation.setAnonymous(anonymous) #parse node /evaluation/notifications/ notificationsNode = self._getElement(evalNode, "notifications") evaluation.removeAllNotifications() for notificationNode in notificationsNode.childNodes: if isinstance(notificationNode, Element): from MaKaC.registration import Notification notification = Notification() toList = self._getValue(notificationNode, "toList") ccList = self._getValue(notificationNode, "ccList") notification.setToList(utils.getEmailList(toList)) notification.setCCList(utils.getEmailList(ccList)) evaluation.setNotification(notificationNode.tagName, notification) if params.get("questionsOption", "") != "current": # in ["imported", "both"] if params.get("questionsOption", "") == "imported": evaluation.removeAllQuestions() #parse node /evaluation/questions/ questionsNode = self._getElement(evalNode, "questions") for questionNode in questionsNode.childNodes: if isinstance(questionNode, Element): questionValue = self._getValue(questionNode, "questionValue") keyword = self._getValue(questionNode, "keyword") required = self._getValue(questionNode, "required") description = self._getValue(questionNode, "description") help = self._getValue(questionNode, "help") try: question = eval(questionNode.tagName)() if isinstance(question, Question): question.setQuestionValue(questionValue) question.setKeyword(keyword) question.setRequired(required) question.setDescription(description) question.setHelp(help) evaluation.insertQuestion(question) except NameError: raise MaKaCError( _("""xml parse error: unknown question type "%s" """) % questionNode.tagName, _("evaluation")) if isinstance(question, Box): defaultAnswer = self._getValue(questionNode, "defaultAnswer") question.setDefaultAnswer(defaultAnswer) elif isinstance(question, Choice): #parse node /evaluation/questions/*/choiceItems/ choiceItemsNode = self._getElement( questionNode, "choiceItems") for choiceItemNode in choiceItemsNode.childNodes: if isinstance(choiceItemNode, Element): itemText = self._getValue( choiceItemNode, "itemText") if itemText.strip() != "": isSelected = self._getValue( choiceItemNode, "isSelected") question.insertChoiceItem( itemText, isSelected)
def _checkProtection(self): RHTrackModifBase._checkProtection(self) if not self._conf.hasEnabledSection("cfa"): raise MaKaCError( _("You cannot access this option because \"Abstracts\" was disabled"))
def _checkProtection(self): LoggedOnlyService._checkProtection(self) if not session.user.is_admin: raise ServiceAccessError( _("Only administrators can perform this operation"))
def _getErrorsInData(self): res = [] if self._original is None or self._target == self._original: res.append(_("invalid original abstract id")) return res
def prepareAddedInfo(self, participant, eventManager): if participant is None: return None if eventManager is None: return None data = {} title = "" familyName = "" firstName = "" refuse = "" refuseURL = urlHandlers.UHConfParticipantsRefusal.getURL( self._conference) refuseURL.addParam("participantId", "%d" % self._lastParticipantId()) eventURL = urlHandlers.UHConferenceDisplay.getURL(self._conference) toList = [] if participant.getAvatar() is not None: toList.append(participant.getAvatar().getEmail()) data["toList"] = toList title = participant.getAvatar().getTitle() familyName = participant.getAvatar().getFamilyName() firstName = participant.getAvatar().getFirstName() else: toList.append(participant.getEmail()) data["toList"] = toList title = participant.getTitle() familyName = participant.getFamilyName() firstName = participant.getFamilyName() if data["toList"] is None or len(data["toList"]) == 0: return None if title is None or title == "": title = firstName if not self._obligatory: refuse = _(""" If you are not interested in taking part in this event or cannot participate due to any reason, please indicate your decline to the event organisers at %s """) % refuseURL else: refuse = _(""" Due to decision of the organisers, presence in the event is obligatory for all participants. """) data["fromAddr"] = eventManager.getEmail() data["subject"] = "Invitation to '%s'" % self._conference.getTitle() data["body"] = """ Dear %s %s, you have been added to the list of '%s' participants. Further information on this event are avaliable at %s. %s Looking forward to meeting you at %s Your Indico on behalf of %s %s """ % (title, familyName, self._conference.getTitle(), eventURL, refuse, self._conference.getTitle(), eventManager.getFirstName(), eventManager.getFamilyName()) return data
def _createTabCtrl(self): review_manager = self._conf.getReviewManager(self._contrib) self._tabCtrl = wcomponents.TabControl() hasReviewingEnabled = self._conf.hasEnabledSection('paperReviewing') paperReviewChoice = self._conf.getConfPaperReview().getChoice() if hasReviewingEnabled and paperReviewChoice != 1: if self._canModify or self._isPRM or review_manager.isReferee( self._rh._getUser()): self._subtabReviewing = self._tabCtrl.newTab( "reviewing", _("Paper Reviewing"), url_for('event_mgmt.contributionReviewing', self._target)) else: if review_manager.isEditor(self._rh._getUser()): self._subtabReviewing = self._tabCtrl.newTab( "reviewing", _("Paper Reviewing"), url_for('event_mgmt.confListContribToJudge-asEditor', self._target)) elif review_manager.isReviewer(self._rh._getUser()): self._subtabReviewing = self._tabCtrl.newTab( "reviewing", _("Paper Reviewing"), url_for('event_mgmt.confListContribToJudge-asReviewer', self._target)) if self._canModify or self._isPRM or review_manager.isReferee( self._rh._getUser()): self._subTabAssign = self._subtabReviewing.newSubTab( "assign", _("Assign Team"), url_for('event_mgmt.contributionReviewing', self._target)) if review_manager.isReferee( self._rh._getUser()) and paperReviewChoice not in (1, 3): self._subTabJudgements = self._subtabReviewing.newSubTab( "referee", _("Referee Assessment"), url_for('event_mgmt.confListContribToJudge', self._target)) else: self._subTabJudgements = self._subtabReviewing.newSubTab( "Assessments", _("Assessments"), url_for('event_mgmt.confListContribToJudge', self._target)) if (paperReviewChoice == 3 or paperReviewChoice == 4) and \ review_manager.isEditor(self._rh._getUser()) and \ not review_manager.getLastReview().getRefereeJudgement().isSubmitted(): self._tabJudgeEditing = self._subtabReviewing.newSubTab( "editing", _("Assess Layout"), url_for('event_mgmt.contributionEditingJudgement', self._target)) if (paperReviewChoice == 2 or paperReviewChoice == 4) and \ review_manager.isReviewer(self._rh._getUser()) and \ not review_manager.getLastReview().getRefereeJudgement().isSubmitted(): self._tabGiveAdvice = self._subtabReviewing.newSubTab( "advice", _("Assess Content"), url_for('event_mgmt.contributionGiveAdvice', self._target)) if self._canModify or \ self._isPRM or \ review_manager.isReferee(self._rh._getUser()) or \ len(review_manager.getVersioning()) > 1 or \ review_manager.getLastReview().getRefereeJudgement().isSubmitted(): self._subTabReviewingHistory = self._subtabReviewing.newSubTab( "reviewing_history", _("History"), url_for( 'event_mgmt.contributionReviewing-reviewingHistory', self._target)) self._setActiveTab() self._setupTabCtrl()
def _getCode(cls, statusId): return _(cls._statusProps.get(statusId, ["", "", ""])[2])
def __init__(self): self.items_actions = { _("Title"): Registrant.getTitle, _("Full Name"): Registrant.getFullName, _("Full Name (w/o title)"): RegistrantFullName2, _("Full Name B"): RegistrantFullName3, _("Full Name B (w/o title)"): RegistrantFullName4, _("First Name"): Registrant.getFirstName, _("Surname"): Registrant.getSurName, _("Position"): Registrant.getPosition, _("Institution"): Registrant.getInstitution, _("Country"): RegistrantCountry, _("City"): Registrant.getCity, _("Address"): Registrant.getAddress, _("Phone"): Registrant.getPhone, _("Fax"): Registrant.getFax, _("Email"): Registrant.getEmail, _("Personal homepage"): Registrant.getPersonalHomepage, _("Amount"): Registrant.getTotal, _("Conference Name"): Conference.getTitle, _("Conference Dates"): ConferenceDates, _("Fixed Text"): BadgeTemplateItem.getFixedText } """ Dictionary that maps group names to the item names that fall into that group. The groups are only used for the <select> box in the WConfModifBadgeDesign.tpl file. """ self.groups = [(_("Registrant Data"), [ _("Title"), _("Full Name"), _("Full Name (w/o title)"), _("Full Name B"), _("Full Name B (w/o title)"), _("First Name"), _("Surname"), _("Position"), _("Institution"), _("Country"), _("City"), _("Address"), _("Phone"), _("Fax"), _("Email"), _("Personal homepage"), _("Amount") ]), (_("Conference Data"), [_("Conference Name"), _("Conference Dates")]), (_("Fixed Elements"), [_("Fixed Text")])]
def _display(self, params): """ """ return _("no content")
def _checkProtection(self): if self._target.getConference().hasEnabledSection("paperReviewing"): RHContribModifBaseReviewingStaffRights._checkProtection(self) else: raise MaKaCError( _("Paper Reviewing is not active for this conference"))
def fillManagementSideMenu(cls, obj, params={}): if obj._conf.canModify(obj._rh._aw): if StatisticsRegister().hasActivePlugins(): params['Statistics'] = wcomponents.SideMenuItem( _('Statistics'), UHConfModifStatistics.getURL(obj._conf))
# -*- coding: utf-8 -*- ## ## $Id: __init__.py,v 1.3 2008/04/24 16:59:00 jose Exp $ ## ## This file is part of CDS Indico. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN. ## ## CDS Indico is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## CDS Indico is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Indico; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. from MaKaC.i18n import _ pluginTypeDescription = _("Epayment Plugins") ignore = False visible = False
def _getTitle(self): return WPConferenceModifBase._getTitle(self) + " - " + _("Statistics")
moveEntries=moveEntries) except TimingError, e: raise TimingNoReportError(e.getMessage(), title=_("Cannot set event dates"), explanation=e.getExplanation()) dateChangeNotificationProblems = ContextManager.get( 'dateChangeNotificationProblems') if dateChangeNotificationProblems: warningContent = [] for problemGroup in dateChangeNotificationProblems.itervalues(): warningContent.extend(problemGroup) w = Warning(_('Warning'), [ _('The start date of your event was changed correctly. ' 'However, there were the following problems:'), warningContent ]) return ResultWithWarning(self._params.get('value'), w).fossilize() else: return self._params.get('value') class ConferenceListContributionsReview(ConferenceListModificationBase): """ Returns a list of all contributions of a conference, ordered by id """ def _checkParams(self):
def getVars( self ): vars = wcomponents.WTemplated.getVars(self) nbQuestions = self._evaluation.getNbOfQuestions() #actionUrl url = urlHandlers.UHConfModifEvaluationEditPerformChanges.getURL(self._conf, mode=self._mode) ########### #Edit mode# ########### if self._mode == Question._EDIT: url.addParam("questionPos", self._question.getPosition()) if self._question.isRequired(): vars["required"] = 'checked="checked"' else: vars["required"] = "" vars["questionValue"]= self._question.getQuestionValue() vars["keyword"] = self._question.getKeyword() vars["description"] = self._question.getDescription() vars["help"] = self._question.getHelp() vars["position"] = WUtils.createSelect(False, range(1,nbQuestions+1), self._question.getPosition(), name="newPos") vars["saveButtonText"] = _("modify question") vars["choiceItems"] = self._choiceItems(self._question); if self._questionType in Question._BOX_SUBTYPES: defaultAnswer = self._question.getDefaultAnswer() else: #Unused, but : Better to prevent than to heal! defaultAnswer = "" url.addParam("questionPos",self._question.getPosition()) ########## #Add mode# ########## else: url.addParam("type", self._questionType) vars["required"] = "" vars["questionValue"]= "" vars["keyword"] = "" vars["description"] = "" vars["help"] = "" vars["position"] = WUtils.createSelect(False, range(1,nbQuestions+2), nbQuestions+1, name="newPos") vars["saveButtonText"]= _("add question") vars["choiceItems"] = self._choiceItems(); defaultAnswer = "" ####### #Other# ####### #defaultAnswer if self._questionType in Question._BOX_SUBTYPES: vars["defaultAnswer"] = _("""<tr> <td class="titleCellTD"><span class="titleCellFormat"> _("Default answer")</span></td> <td class="inputCelTD"><input type="text" name="defaultAnswer" value="%s"/></td> </tr>""")%(defaultAnswer) else: vars["defaultAnswer"] = "" #javascript for choiceItems vars["choiceItemsNb"] = self._CHOICEITEMS_NB_MIN vars["javascriptChoiceItemsAddImg"] = WUtils.createImg("add", _("add one more choice item")).replace('"',"'") vars["javascriptChoiceItemsRemoveImg"] = WUtils.createImg("remove", _("remove one choice item")).replace('"',"'") if self._questionType == Question._CHECKBOX: vars["javascriptChoiceItemsType"] = "checkbox" elif self._questionType in [Question._SELECT, Question._RADIO]: vars["javascriptChoiceItemsType"] = "radio" else: vars["javascriptChoiceItemsType"] = "" #error if self._error!="": vars["error"] = "%s<br/><br/><br/>"%(self._error) else: vars["error"] = "" #actionUrl vars["actionUrl"] = url return vars
def _process(self): # We will need to pickle the data back into JSON user = self.getAW().getUser() if not self._loggedIn: return json.dumps( { 'status': 'ERROR', 'info': { 'type': 'noReport', 'title': '', 'explanation': _('You are currently not authenticated. Please log in again.' ) } }, textarea=True) try: owner = self._target title = owner.getTitle() if type(owner) == Conference: ownerType = "event" elif type(owner) == Session: ownerType = "session" elif type(owner) == Contribution: ownerType = "contribution" elif type(owner) == SubContribution: ownerType = "subcontribution" else: ownerType = "" text = " in %s %s" % (ownerType, title) except: owner = None text = "" try: if len(self._errorList) > 0: raise Exception('Operation aborted') else: mat, status, info = self._addMaterialType(text, user) if status == "OK": for entry in info: entry['material'] = mat.getId() except Exception, e: status = "ERROR" if 'file' in self._params: del self._params['file'] info = { 'message': self._errorList or " %s: %s" % (e.__class__.__name__, str(e)), 'code': '0', 'requestInfo': self._params } Logger.get('requestHandler').exception('Error uploading file')
def getVars( self ): vars = WEvaluationDisplay.getVars(self) vars["hasSubmittedEvaluation"] = False vars["actionUrl"] = urlHandlers.UHConfModifEvaluationPreview.getURL(self._conf, status=_("submitted")) return vars
def _createTabCtrl(self): self._tabCtrl = wcomponents.TabControl() self._tabMain = self._tabCtrl.newTab("main", _("Main"), "") self._setActiveTab()
def _checkParams(self,params): RHTrackAbstractBase._checkParams(self,params) id=params.get("intCommentId","") if id=="": raise MaKaCError( _("the internal comment identifier hasn't been specified")) self._comment=self._abstract.getIntCommentById(id)
def _process(self): params = self._getRequestParams() if params.get("accessVisibility", "") == _("PRIVATE"): self._target.setTasksPrivate() elif params.get("accessVisibility", "") == _("PUBLIC"): self._target.setTasksPublic() else: pass if params.get("commentVisibility", "") == _("PRIVATE"): self._target.setTasksCommentPrivate() elif params.get("commentVisibility", "") == _("PUBLIC"): self._target.setTasksCommentPublic() else: pass if params.get("taskAccessAction", "") == "Add": chosen = params.get("accessChosen", None) if chosen is not None and chosen != "": person = self._findPerson(chosen) if person is not None: self._target.addTasksAccessPerson(person) elif params.get("taskAccessAction", "") == "New": pass elif params.get("taskAccessAction", "") == "Remove": chosen = self._normaliseListParam(params.get("access", [])) for c in chosen: self._target.removeTasksAccessPerson(int(c)) else: pass if params.get("taskCommentAction", "") == "Add": chosen = params.get("commentChosen", None) if chosen is not None and chosen != "": person = self._findPerson(chosen) if person is not None: self._target.addTasksCommentator(person) elif params.get("taskCommentAction", "") == "New": pass elif params.get("taskCommentAction", "") == "Remove": chosen = self._normaliseListParam(params.get("commentator", [])) for c in chosen: self._target.removeTasksCommentator(int(c)) else: pass if params.get("taskManagerAction", "") == "Add": chosen = params.get("managerChosen", None) if chosen is not None and chosen != "": person = self._findPerson(chosen) if person is not None: self._target.addTasksManager(person) elif params.get("taskManagerAction", "") == "New": pass elif params.get("taskManagerAction", "") == "Remove": chosen = self._normaliseListParam(params.get("manager", [])) for c in chosen: self._target.removeTasksManager(int(c)) else: pass p = category.WPCategModifTasks(self, self._target) return p.display()