--- ECHO_content/VLPExtension.py 2005/02/28 14:09:55 1.40 +++ ECHO_content/VLPExtension.py 2005/02/28 20:02:08 1.41 @@ -338,10 +338,33 @@ def manage_addVLP_encyc(self, id,title,l if RESPONSE is not None: RESPONSE.redirect('manage_main') +class VLP_subcollection(ECHO_collection): + """ subcollection of elements""" + + meta_type="VLP_subcollection" + def generateSubCollectionFromDB(self): + """erzeuge subcollection""" + for item in self.ZSQLSimpleSearch("select * from vl_literature where volumeid like '%s'"%self.id): + manage_addECHO_link(self,item.reference,item.titlerefdisplay,item.titlerefdisplay) + + def index_html(self): + """erzeuge darstellung""" + pt=zptFile(self, 'vlp/collection_template.zpt') + return pt() + + +def manage_addVLP_subCollection(self,id,title,label,RESPONSE=None): + + self._setObject(id,VLP_subcollection(id,title,label)) + + if RESPONSE is not None: + RESPONSE.redirect('manage_main') + 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'}, @@ -349,6 +372,24 @@ class VLP_collection(ECHO_collection): {'label':'Update Metadata','action':'updateCollectionMD'}, ) + + def generateSubCollections(self): + """erzeuge subcollectionen""" + founds=self.ZSQLSimpleSearch("select * from vl_literature where referencetype in ('(Book)','(Collection)','(Journal)','(Library)')") + + self.REQUEST.RESPONSE.write("\n") + for found in founds: + + foundCol=self.ZopeFind(self,obj_ids=[found.reference]) + if foundCol: + self.manage_delObjects([foundCol[0][0]]) + + manage_addVLP_subCollection(self,found.reference,found.titlerefdisplay,found.titlerefdisplay) + #getattr(self,found.reference).generateSubCollectionFromDB() + + self.REQUEST.RESPONSE.write("

%s

\n"%found.reference) + + def VLP_path_configForm(self): """change pt""" path=PageTemplateFile(os.path.join(package_home(globals()),'vlp','ChangeVLPPath.zpt')).__of__(self) @@ -582,6 +623,8 @@ class VLP_resource(ECHO_resource,Cacheab def dir2index(self): """dir to index""" + excludeNames=['Icon'] + def calculateName(str): name=os.path.splitext(str[1:])[0] ret="%s: %s"%(str[0],name) @@ -596,7 +639,7 @@ class VLP_resource(ECHO_resource,Cacheab temp=[] ret.sort() for x in ret: - if not (x[0]=="."): + if (not (x[0]==".")) and (not x in excludeNames): temp.append((calculateName(x),os.path.splitext(x)[0])) return temp