Diff for /ZSQLExtend/ZSQLExtend.py between versions 1.58 and 1.59

version 1.58, 2005/02/08 16:12:54 version 1.59, 2005/02/09 20:10:42
Line 7  import string Line 7  import string
 import sys  import sys
 #from pyPgSQL import libpq  #from pyPgSQL import libpq
 from AccessControl import getSecurityManager  from AccessControl import getSecurityManager
   from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
 from Products.PageTemplates.PageTemplateFile import PageTemplateFile  from Products.PageTemplates.PageTemplateFile import PageTemplateFile
   
 from Products.ZSQLMethods.SQL import SQLConnectionIDs  from Products.ZSQLMethods.SQL import SQLConnectionIDs
Line 1175  class ZSQLBibliography(Folder,ZSQLExtend Line 1175  class ZSQLBibliography(Folder,ZSQLExtend
             pt.content_type="text/html"              pt.content_type="text/html"
             return pt()              return pt()
   
     def changeZSQLBibliography(self,tableName,label,description,REQUEST=None):      def changeZSQLBibliography(self,tableName,label,description,connection_id=None,REQUEST=None):
         """change it"""          """change it"""
           self.connection_id=connection_id
         self.tableName=tableName          self.tableName=tableName
         self.label=label          self.label=label
         self.description=description          self.description=description
Line 1186  class ZSQLBibliography(Folder,ZSQLExtend Line 1187  class ZSQLBibliography(Folder,ZSQLExtend
   
     manage_options=Folder.manage_options+(      manage_options=Folder.manage_options+(
         {'label':'Main Config','action':'changeZSQLBibliographyForm'},          {'label':'Main Config','action':'changeZSQLBibliographyForm'},
           {'label':'Generate RDF Template','action':'generateRDFTemplate'},
           {'label':'Generate XML Template','action':'generateXMLTemplate'},
        )         )
   
   
Line 1276  class ZSQLBibliography(Folder,ZSQLExtend Line 1279  class ZSQLBibliography(Folder,ZSQLExtend
         pt.content_type="text/xml"          pt.content_type="text/xml"
         return pt()          return pt()
   
   
       def generateRDFTemplate(self,REQUEST=None):
           """generateRDFtemplate"""
           zt=ZopePageTemplate('record.rdf')
           self._setObject('record.rdf',zt)
           default_content_fn = os.path.join(package_home(globals()),
                                             'zpt','record.rdf')
           text = open(default_content_fn).read()
           zt.pt_edit(text, 'text/xml')
   
   
           if REQUEST is not None:
               return self.manage_main(self, REQUEST)
   
       def generateXMLTemplate(self,REQUEST=None):
           """generateXMLtemplate"""
           zt=ZopePageTemplate('record.xml')
           self._setObject('record.xml',zt)
           default_content_fn = os.path.join(package_home(globals()),
                                             'zpt','record.xml')
           text = open(default_content_fn).read()
           zt.pt_edit(text, 'text/xml')
   
   
           if REQUEST is not None:
               return self.manage_main(self, REQUEST)
     def getMetaDataRDF(self):      def getMetaDataRDF(self):
         """crate index meta"""          """crate index meta"""
           find=self.ZopeFind(self,obj_ids=["record.rdf"])
           if not find:
         pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','record.rdf')).__of__(self)          pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','record.rdf')).__of__(self)
         pt.content_type="text/xml"          pt.content_type="text/xml"
         return pt()          return pt()
           else:
               return find[0][1]()
   
     def getMetaDataXML(self):      def getMetaDataXML(self):
         """crate index meta"""          """crate index meta"""
Line 1292  class ZSQLBibliography(Folder,ZSQLExtend Line 1325  class ZSQLBibliography(Folder,ZSQLExtend
         else:          else:
             return find[0][1]()              return find[0][1]()
   
     def createVLMAtripels(self):  
         """index"""  
         # check if the request's host part was OK  
         http_host = self.REQUEST['HTTP_HOST']  
         host_port = self.REQUEST['SERVER_PORT']  
         fix_host = None  
         if http_host and http_host.rfind(host_port) == -1:  
             print "HTTP_HOST needs fixing!"  
             fix_host = http_host + ":" + host_port  
           
         ret=""  
         for found in self.ZSQLSimpleSearch("select id_text from %s limit ALL"%'cdli_cat'):  
             base_url = self.absolute_url()  
             if fix_host:  
                 #print "replacing ", http_host, " by ", fix_host  
                 base_url = string.replace(base_url, http_host, fix_host, 1)  
   
             #found2=self.ZSQLInlineSearchU(_table="cdli_imglist",id_text=found.id_text)  
             #create collectionobject info  
             subject="http://141.14.237.222:8080/cdlineu/cdli_coll/cdli2/cdli_templates/cdli_templates/textdisplay.html?-table=cdli_cat&id_text=%s"%found.id_text  
             object="http://141.14.237.222:8080/cdlidata/images/getMetaDataRDF?id_text=%s"%found.id_text  
             predicate="metadata"  
             ret+="%s\t%s\t%s\n"%(subject,object,predicate)  
             #create image  
             subject="http://141.14.237.222:8080/cdlineu/cdli_coll/cdli2/cdli_templates/cdli_templates/textdisplay.html?-table=cdli_cat&id_text=%s"%found.id_text  
             object="http://nausikaa2.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler?fn=/experimental/cdli/dl/photo/%s&mo=rawfile"%found.id_text  
             predicate="image"  
               
             ret+="%s\t%s\t%s\n"%(subject,object,predicate)  
   
             #create thumb  
             subject="http://nausikaa2.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler?fn=/experimental/cdli/dl/photo/%s&mo=rawfile"%found.id_text  
             object="http://nausikaa2.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler?fn=/experimental/cdli/dl/photo/%s&dw=100&dh=100"%found.id_text  
             predicate="thumb"  
               
             ret+="%s\t%s\t%s\n"%(subject,object,predicate)  
       
         return ret  
   
   
     def getMetaDatasXML(self):      def getMetaDatasXML(self):
         """index"""          """index"""
Line 1363  manage_addZSQLBibliographyForm=DTMLFile( Line 1357  manage_addZSQLBibliographyForm=DTMLFile(
 def manage_addZSQLBibliography(self, id, tableName,label,description,title='',  def manage_addZSQLBibliography(self, id, tableName,label,description,title='',
                      createPublic=0,                       createPublic=0,
                      createUserF=0,                       createUserF=0,
                        connection_id=None,
                      REQUEST=None):                       REQUEST=None):
     """Add a new Folder object with id *id*.      """Add a new Folder object with id *id*.
   
Line 1380  def manage_addZSQLBibliography(self, id, Line 1375  def manage_addZSQLBibliography(self, id,
     setattr(ob,'tableName',tableName)      setattr(ob,'tableName',tableName)
     setattr(ob,'label',label)      setattr(ob,'label',label)
     setattr(ob,'description',description)      setattr(ob,'description',description)
       setattr(ob,'connection_id',connection_id)
           
     checkPermission=getSecurityManager().checkPermission      checkPermission=getSecurityManager().checkPermission
   

Removed from v.1.58  
changed lines
  Added in v.1.59


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