def submit(self, params): l = conference.Link() l.setName(params["title"]) l.setDescription(params["description"]) l.setURL(params["url"]) self.__material.addResource(l) return "[done]"
def _process( self ): params = self._getRequestParams() l = conference.Link() l.setName( params["title"] ) l.setDescription( params["description"] ) l.setURL( params["url"] ) self._material.addResource( l ) self._redirect( urlHandlers.UHMaterialModification.getURL( self._material ) )
def __addMaterials(self, subcontrib): if self._materials: for material in self._materials.keys(): newMaterial = conference.Material() newMaterial.setTitle(material) for resource in self._materials[material]: newLink = conference.Link() newLink.setURL(resource) newLink.setName(resource) newMaterial.addResource(newLink) subcontrib.addMaterial(newMaterial)
def getFiles(mat, f):#adds the files associated with a conference/session/contribution and adds them #f[0]-id, f[1]-format, f[2]-category, f[3]-cd, f[4]-md, f[5]-name, f[6]-path, f[7]-description, f[8]-numPages #f[9]-size, f[10]-deleted, f[11]-fileID, f[12]-eventID #if file name ends in .link open file, get address, make link cf = agenda.cursor() cf.execute("select password from FILE_PASSWORD where fileID=" + str(f[0])) f = cf.fetchone() if f!=None: password = f[0] else: password = "" if password!="": mat.setAccessKey(password) mat.setProtection(True) if getfiles!=0: error = False if f[5][-4:] == 'link' or f[5][-8:] =='lnk.html': if f[2] == 'moreinfo' and f[6][-8:] != 'moreinfo': path = f[6].encode(sys.getfilesystemencoding()) + "/moreinfo/" + f[5].encode(sys.getfilesystemencoding()) else: path = f[6].encode(sys.getfilesystemencoding()) + "/" + f[5].encode(sys.getfilesystemencoding()) log("getFiles:link: path = %s"%path) if file_host != "localhost": os.system("scp 'tbaron@%s:%s' '/tmp/%s'" % (file_host,re.escape(path), f[5].encode(sys.getfilesystemencoding()))) path = "/tmp/%s" % f[5].encode(sys.getfilesystemencoding()) try: f = file(path, 'rb') address = f.read() address = getAddress(address) f.close() except IOError,e: log("ressource file not found : %s" %path) error = True address = '' res = conference.Link() res.setURL(address) else:#if not a link res = conference.LocalFile()#creates new file and sets the local file path res.setFileName(f[5]) if f[2] == 'moreinfo' and f[6][-8:] != 'moreinfo': path = f[6].encode(sys.getfilesystemencoding()) + "/moreinfo/" + f[5].encode(sys.getfilesystemencoding()) else: path = f[6].encode(sys.getfilesystemencoding()) + "/" + f[5].encode(sys.getfilesystemencoding()) log("getFiles:file: path = %s"%path) if file_host != "localhost": os.system("scp 'tbaron@%s:%s' '/tmp/%s'" % (file_host,re.escape(path), f[5].encode(sys.getfilesystemencoding()))) path = "/tmp/%s" % f[5].encode(sys.getfilesystemencoding()) try: res.setFilePath(path) except Exception,e: log("ressource file not found : %s" %path) error = True
def _process(self): params = self._getRequestParams() if params["title"] == "": params["title"] = "No Title" # change number of dates (lecture) if self._confirm == True: if self._event_type != "simple_event": c = self._createEvent(self._params) self.alertCreation([c]) # lectures else: lectures = [] for i in range(1, int(self._params["nbDates"]) + 1): self._params["sDay"] = self._params.get("sDay_%s" % i, "") self._params["sMonth"] = self._params.get( "sMonth_%s" % i, "") self._params["sYear"] = self._params.get( "sYear_%s" % i, "") self._params["sHour"] = self._params.get( "sHour_%s" % i, "") self._params["sMinute"] = self._params.get( "sMinute_%s" % i, "") self._params["duration"] = int( self._params.get("dur_%s" % i, 60)) lectures.append(self._createEvent(self._params)) self.alertCreation(lectures) lectures.sort(sortByStartDate) # create links for i in range(0, len(lectures)): lecture = lectures[i] if len(lectures) > 1: lecture.setTitle( "%s (%s/%s)" % (lecture.getTitle(), i + 1, len(lectures))) for j in range(0, len(lectures)): if j != i: mat = conference.Material() mat.setTitle("part%s" % (j + 1)) url = str( urlHandlers.UHConferenceDisplay.getURL( lectures[j])) link = conference.Link() link.setURL(url) link.setName(url) mat.addResource(link) lecture.addMaterial(mat) c = lectures[0] self._redirect(urlHandlers.UHConferenceModification.getURL(c)) else: url = urlHandlers.UHCategoryDisplay.getURL(self._target) self._redirect(url)
def _process(self): try: try: m = self._target.getMaterialById(self._title) except: m = None if m == None: m = conference.Material() self._target.addMaterial(m) params = {"title": self._title} m.setValues(params) l = conference.Link() l.setURL(self._value) m.addResource(l) m.setMainResource(l) except MaKaCError, e: return self._createResponse("ERROR", e.getMsg())