Diff for /ECHO_content/VLPExtension.py between versions 1.2 and 1.7

version 1.2, 2004/05/27 09:31:25 version 1.7, 2004/06/08 17:04:39
Line 13  def getText(nodelist): Line 13  def getText(nodelist):
            rc = rc + node.data             rc = rc + node.data
     return rc      return rc
   
   class VLP_essay(Folder):
       """classe für VLP essays"""
   
       meta_type="VLP_essay"
   
       def __init__(self,id,title,label):
           """init"""
           self.id=id
           self.title=title
           self.label=label
   
       def getPage(self,pagenum):
           """gibt essay page mit num aus"""
           def sortFind(x,y):
               return cmp(x[0],y[0])
               
           pages=self.ZopeFind(self,obj_metatypes=['DTML Document','File'])
           
           pages.sort(sortFind)
           #print str(pages[int(pagenum)][1]())
           if pages[int(pagenum)-1][1].meta_type=='File':
               return self.xml2html(str(pages[int(pagenum)-1][1]))
           else:
               return str(self.xml2html(pages[int(pagenum)-1][1]()))
           
       def nextPage(self,pagenum,url):
           pages=len(self.ZopeFind(self,obj_metatypes=['DTML Document','File'])) # teste ob performance ok, sonst in variable
           if int(pagenum)+1 <= pages:
               retstr=url+"?p="+str(int(pagenum)+1)
               return """<td align="right" <a href="%s">next</a></td>"""%retstr
           
       def previousPage(self,pagenum,url):
           
           if int(pagenum)-1 > 0:
               retstr=url+"?p="+str(int(pagenum)-1)
               return """<td align="left" <a href="%s">previous</a></td>"""%retstr
           
           
   def manage_addVLP_essayForm(self):
       """Form for adding"""
       pt=PageTemplateFile('Products/ECHO_content/vlp/AddVLP_essay.zpt').__of__(self)
       return pt()
   
   def manage_addVLP_essay(self, id,title,label,RESPONSE=None):
       """add the copyright"""
   
       
       self._setObject(id, VLP_essay(id, title,label))
   
       if RESPONSE is not None:
           RESPONSE.redirect('manage_main')
       
   
   
 class VLP_collection(ECHO_collection):  class VLP_collection(ECHO_collection):
     """VLP spezifische Erweiterung der 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 pt"""
           path=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:3]=="lit":
                   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):  def manage_addVLP_collectionForm(self):
         """Form for adding a ressource"""          """Form for adding a ressource"""
Line 24  def manage_addVLP_collectionForm(self): Line 126  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"""      """add a echo collection"""
           
   
     newObj=VLP_collection(id,title,label,description,contentType,responsible,credits,weight,sortfield,coords,secondaryLinkTitle=secondaryLinkTitle,secondaryLink=secondaryLink,imageTag=imageTag,bgcolour="")      newObj=VLP_collection(id,title,label,description,contentType,responsible,credits,weight,sortfield,coords,secondaryLinkTitle=secondaryLinkTitle,secondaryLink=secondaryLink,imageTag=imageTag,bgcolour="")
   
     self._setObject(id,newObj)      self._setObject(id,newObj)
       setattr(newObj,'path',path)
   
     if RESPONSE is not None:      if RESPONSE is not None:
         RESPONSE.redirect('manage_main')          RESPONSE.redirect('manage_main')
Line 83  class VLP_resource(ECHO_resource): Line 186  class VLP_resource(ECHO_resource):
         pt.content_type="text/html"          pt.content_type="text/html"
         return pt()          return pt()
           
       index_html=show
           
     def index_meta(self):      def index_meta(self):
         """index_meta"""          """index_meta"""

Removed from v.1.2  
changed lines
  Added in v.1.7


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>