--- ECHO_content/VLPExtension.py 2004/05/27 09:31:25 1.2 +++ ECHO_content/VLPExtension.py 2004/05/28 15:01:43 1.3 @@ -16,6 +16,54 @@ def getText(nodelist): class VLP_collection(ECHO_collection): """VLP spezifische Erweiterung der Collection""" + meta_type="VLP_collection" + manage_options=ECHO_collection.manage_options+( + {'label':'Change Path','action':'VLP_path_configForm'}, + {'label':'Update Library','action':'updateCollection'}, + {'label':'Update Metadata','action':'updateCollectionMD'}, + ) + + def VLP_path_configForm(self): + """change path""" + pt=PageTemplateFile('Products/ECHO_content/vlp/ChangeVLPPath.zpt').__of__(self) + return pt() + + def VLP_path_config(self,path,RESPONSE=None): + """config""" + self.path=path + if RESPONSE is not None: + RESPONSE.redirect('manage_main') + + def updateCollection(self,RESPONSE=None): + """liest verzeichnisse aus dem pfad und legt sie dann als objekte in den ordner""" + files=os.listdir(self.path) + for fileName in files: + + if fileName[0:3]=="lit": + + metalink=self.REQUEST['URL1']+"/"+fileName+"/index_meta" + newObj=VLP_resource(fileName,'',metalink,fileName,fileName,fileName,'generated','book','','','','','','') + self._setObject(fileName,newObj) + + genObj=getattr(self,fileName) + genObj.createIndexFile() + + + if RESPONSE is not None: + RESPONSE.redirect('manage_main') + + def updateCollectionMD(self,RESPONSE=None): + """updateMD""" + files=os.listdir(self.path) + for fileName in files: + if fileName[0:5]=="lit11": + genObj=getattr(self,fileName) + genObj.copyIndex_meta2echo_resource() + genObj.generate_title() + + if RESPONSE is not None: + RESPONSE.redirect('manage_main') + def manage_addVLP_collectionForm(self): """Form for adding a ressource""" @@ -24,13 +72,14 @@ def manage_addVLP_collectionForm(self): -def manage_addVLP_collection(self,id,title,label,description,contentType,responsible,weight,sortfield,coords="",secondaryLinkTitle="",secondaryLink="",credits=None,RESPONSE=None,imageTag="",bgcolour=""): +def manage_addVLP_collection(self,id,title,label,description,contentType,responsible,weight,sortfield,path,coords="",secondaryLinkTitle="",secondaryLink="",credits=None,RESPONSE=None,imageTag="",bgcolour=""): """add a echo collection""" newObj=VLP_collection(id,title,label,description,contentType,responsible,credits,weight,sortfield,coords,secondaryLinkTitle=secondaryLinkTitle,secondaryLink=secondaryLink,imageTag=imageTag,bgcolour="") self._setObject(id,newObj) + setattr(newObj,'path',path) if RESPONSE is not None: RESPONSE.redirect('manage_main') @@ -83,6 +132,7 @@ class VLP_resource(ECHO_resource): pt.content_type="text/html" return pt() + index_html=show def index_meta(self): """index_meta"""