Diff for /ECHO_content/ECHO_collection.py between versions 1.142 and 1.148

version 1.142, 2004/07/18 14:14:42 version 1.148, 2004/07/20 16:24:44
Line 46  import xml.dom.minidom Line 46  import xml.dom.minidom
 from ECHO_graphicalOverview import javaHandler,javaScriptMain  from ECHO_graphicalOverview import javaHandler,javaScriptMain
 import ECHO_helpers  import ECHO_helpers
   
 def getRDFDescription(self,linkURL,urn=None):  def getRDFDescription(self,linkURL,urn=None,nameDef=None):
         """rdf"""          """rdf"""
           
         ret=""          ret=""
         about="""<RDF:Description about="%s">"""          about="""<RDF:Description RDF:about="%s">"""
         name="""<ECHONAVIGATION:name>%s</ECHONAVIGATION:name>"""          name="""<ECHONAVIGATION:name>%s</ECHONAVIGATION:name>"""
         #link="""<ECHONAVIGATION:link>%s</ECHONAVIGATION:link>"""          link="""<ECHONAVIGATION:link xlink:href="%s">%s</ECHONAVIGATION:link>"""
         link="""<ECHONAVIGATION:link RDF:about="%s"/>"""          clickable="""<ECHONAVIGATION:linkClickable>%s</ECHONAVIGATION:linkClickable>"""
           #link="""<ECHONAVIGATION:link RDF:about="%s"/>"""
         type="""<ECHONAVIGATION:type>%s</ECHONAVIGATION:type>"""          type="""<ECHONAVIGATION:type>%s</ECHONAVIGATION:type>"""
               #xlink="""<ECHONAVIGATION:xlink xlink:href="%s"/>"""    
         if not urn:          if not urn:
             urn="urn:"+re.sub('/',':',self.absolute_url())              #urn="urn:"+re.sub('/',':',self.absolute_url())
               urn=self.absolute_url()
         about2=about%urn          about2=about%urn
           if not nameDef:
         if hasattr(self,'label') and not (self.label==""):          if hasattr(self,'label') and not (self.label==""):
             name2=name%urllib.quote(self.label)                  name2=name%self.label
         elif not self.title=="":          elif not self.title=="":
             name2=name%urllib.quote(self.title)                  name2=name%self.title
         else:          else:
             name2=name%self.getId()              name2=name%self.getId()
                           
         link2=link%urllib.quote(linkURL)              name2=re.sub('&','&amp;',name2)
           else:
               name2=name%nameDef
   
           linkURL=re.sub('http:','',linkURL)
           linkURL2=re.sub('&','&amp;',linkURL)
           link2=link%(("http:"+linkURL2),("http:"+urllib.quote(linkURL)))
           clickable2=clickable%"true"
         type2=type%self.meta_type          type2=type%self.meta_type
                   
         ret=about2+"\n"+name2+"\n"+link2+"\n"+type2+"\n</RDF:Description>"          #ret=about2+"\n"+name2+"\n"+link2+"\n"+type2+"\n"+clickable2+"\n</RDF:Description>"
           ret=about2+"\n"+name2+"\n"+type2+"\n"+clickable2+"\n</RDF:Description>"
         return ret          return ret
           
 def getCopyrightsFromForm(self,argv):   def getCopyrightsFromForm(self,argv): 
Line 515  class ECHO_resource(Folder,Persistent): Line 526  class ECHO_resource(Folder,Persistent):
     getSubCols = ECHO_helpers.getSubCols      getSubCols = ECHO_helpers.getSubCols
   
     security.declareProtected('View','index_html')      security.declareProtected('View','index_html')
     def getRDF(self):  
       def showRDF(self):
           """showrdf"""
               self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml')
           ret="""<?xml version="1.0" encoding="utf-8"?>\n<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  xmlns:ECHONAVIGATION="http://www.echo.eu/rdf#">\n"""
           ret+=self.getRDF(urn="echo:collectionroot")+"\n"
   
           ret+="""</RDF:RDF>"""
               return ret 
   
       def getRDF(self,urn=None):
         """rdf"""          """rdf"""
         return getRDFDescription(self,self.link)          ret=getRDFDescription(self,self.link,urn=urn)
           return ret+self.createSubElementRDF(urn=urn) 
   
                   
       def createSubElementRDF(self,urn=None):
           """rdf list"""
           if not urn:
               urn=self.absolute_url()
           ret=""
   
           rettemp="""<RDF:Seq RDF:about="%s">\n"""%urn
           flag=0
           
           li="""<RDF:li RDF:resource="%s" />\n"""
           if not ('<error>' in self.getFullTextXML(noredirect='Yes')):
               nurn=self.absolute_url()+'/getFullTextXML'
               rettemp+=li%nurn
               flag=1
           if not ('<error>' in self.getImageView(noredirect='Yes')):
               nurn=self.absolute_url()+'/getImageView'
               rettemp+=li%nurn
               flag=1
   
           rettemp+="</RDF:Seq>"
   
           if flag==1:
               ret+=rettemp
               
           if not ('<error>' in self.getFullTextXML(noredirect='Yes')):
                       nurn=self.absolute_url()+'/getFullTextXML'  
               ret+=getRDFDescription(self,self.absolute_url()+'/getFullTextXML',urn=nurn,nameDef="Fulltext")
   
           if not ('<error>' in self.getImageView(noredirect='Yes')):
                       nurn=self.absolute_url()+'/getImageView'
               ret+=getRDFDescription(self,self.absolute_url()+'/getImageView',urn=nurn,nameDef="Image View")
   
           return ret
                   
     def getAccessRightSelectorHTML(self,outlook="select"):      def getAccessRightSelectorHTML(self,outlook="select"):
         """htmlselector"""          """htmlselector"""
Line 537  class ECHO_resource(Folder,Persistent): Line 593  class ECHO_resource(Folder,Persistent):
         else:          else:
             ret=""              ret=""
             for value in values:              for value in values:
                 print                  
                 if value==self.getAccessRightMD():                  if value==self.getAccessRightMD():
                     ret+="""<input type="radio" name="%s" value="%s" checked>%s"""%(self.getId(),value,value)                      ret+="""<input type="radio" name="%s" value="%s" checked>%s"""%(self.getId(),value,value)
                 else:                  else:
Line 802  class ECHO_resource(Folder,Persistent): Line 858  class ECHO_resource(Folder,Persistent):
             else:              else:
                 return "<error>no fulltext available</error>"                  return "<error>no fulltext available</error>"
   
   
       def getImageView(self,noredirect=None):
           """getImages; give Imageviewr  and <error></error> if somthing goes wrong."""
           try:
               fh=urllib.urlopen(self.metalink)
               dom=xml.dom.minidom.parse(fh)
               texttools=dom.getElementsByTagName('texttool')
               text=texttools[0].getElementsByTagName('image')
               imagetemp=getText(text[0].childNodes)
               
               text=dom.getElementsByTagName('archive-path')
               archivepath=getText(text[0].childNodes)
               archivepath=re.sub('/mpiwg/online/','',archivepath) 
               imageurl="http://echo.mpiwg-berlin.mpg.de/zogilib?fn="+archivepath+"/"+imagetemp
               if not noredirect:
                               self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml')  
                   self.REQUEST.RESPONSE.redirect(imageurl)
               else:
                   return imageurl
           except:
   
               if not noredirect:
                   self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml')
                   self.REQUEST.RESPONSE.write("<error>no fulltext available</error>")
               else:
                   return "<error>no images available</error>"
   
       
     def getCopyrightsHTML(self):      def getCopyrightsHTML(self):
         """gib (link auf copyright link, mediatyp, institution, copyrightType, label von copyrightType) aus"""          """gib (link auf copyright link, mediatyp, institution, copyrightType, label von copyrightType) aus"""
                   
Line 1506  class ECHO_collection(Folder, Persistent Line 1590  class ECHO_collection(Folder, Persistent
   
     path="/mpiwg/online/permanent/shipbuilding"      path="/mpiwg/online/permanent/shipbuilding"
   
     def showRDF(self):  
         """showrdf"""  
             self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml')  
         ret="""<?xml encoding="utf-8"?>\n<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  xmlns:ECHONAVIGATION="http://www.echo.eu/rdf#">\n"""  
         ret+=self.getRDF(urn="echo:collectionroot")+"\n"  
         ret+="""</RDF:RDF>"""  
             return ret   
   
     def getRDF(self,urn=None):      def getRDF(self,urn=None):
         """rdf of the collection"""          """rdf of the collection"""
           
         contents=self.ZopeFind(self,obj_metatypes=['ECHO_group','ECHO_resource','ECHO_collection'])          contents=self.ZopeFind(self,obj_metatypes=['ECHO_group','ECHO_resource','ECHO_collection'])
   
         ret=getRDFDescription(self,self.absolute_url(),urn)          ret=getRDFDescription(self,self.absolute_url(),urn=urn)
   
         if not urn:          if not urn:
             urn="urn:"+re.sub('/',':',self.absolute_url())              urn=self.absolute_url()
         else:  
             urn="urn:"+urn  
                           
         li="""<RDF:li resource="%s" />\n"""          li="""<RDF:li RDF:resource="%s" />\n"""
   
                   
         for content in contents:          for content in contents:
             ret+=content[1].getRDF()+"\n"              ret+=content[1].getRDF()+"\n"
                           
         ret+="""<RDF:Seq about="%s">\n"""%urn          ret+="""<RDF:Seq RDF:about="%s">\n"""%urn
         for content in contents:          for content in contents:
             nurn="urn:"+re.sub('/',':',content[1].absolute_url())              nurn=content[1].absolute_url()
             ret+=li%nurn              ret+=li%nurn
         return ret+"</RDF:Seq>"          return ret+"</RDF:Seq>"
                   
                   
       def showRDF(self):
           """showrdf"""
               self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml')
           ret="""<?xml version="1.0" encoding="utf-8"?>\n<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  xmlns:ECHONAVIGATION="http://www.echo.eu/rdf#">\n"""
           ret+=self.getRDF(urn="echo:collectionroot")+"\n"
   
           ret+="""</RDF:RDF>"""
           
               return ret 
   
        
     def changeLabels(self):      def changeLabels(self):
         """change form"""          """change form"""
         pt=PageTemplateFile('Products/ECHO_content/zpt/changeLabelsForm').__of__(self)          pt=PageTemplateFile('Products/ECHO_content/zpt/changeLabelsForm').__of__(self)
Line 2241  class ECHO_group(ECHO_collection): Line 2327  class ECHO_group(ECHO_collection):
           
     security.declareProtected('View','index_html')      security.declareProtected('View','index_html')
   
     def getRDF(self):      def showRDF(self):
           """showrdf"""
               self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml')
           ret="""<?xml version="1.0" encoding="utf-8"?>\n<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  xmlns:ECHONAVIGATION="http://www.echo.eu/rdf#">\n"""
           ret+=self.getRDF(urn="echo:collectionroot")+"\n"
   
           ret+="""</RDF:RDF>"""
           
               return ret 
   
       def getRDF(self,urn=None):
         """rdf of the collection"""          """rdf of the collection"""
         contents=self.ZopeFind(self,obj_metatypes=['ECHO_group','ECHO_resource','ECHO_collection'])          contents=self.ZopeFind(self,obj_metatypes=['ECHO_group','ECHO_resource','ECHO_collection'])
   
         ret=getRDFDescription(self,self.absolute_url())          ret=getRDFDescription(self,self.absolute_url(),urn=urn)
   
                   
   
         urn="urn:"+re.sub('/',':',self.absolute_url())          if not urn:
         li="""<RDF:li resource="%s" />\n"""              urn=self.absolute_url()
           li="""<RDF:li RDF:resource="%s" />\n"""
                   
                   
         for content in contents:          for content in contents:
             ret+=content[1].getRDF()+"\n"              ret+=content[1].getRDF()+"\n"
                           
         ret+="""<RDF:Seq about="%s">\n"""%urn          ret+="""<RDF:Seq RDF:about="%s">\n"""%urn
         for content in contents:          for content in contents:
             nurn="urn:"+re.sub('/',':',content[1].absolute_url())              nurn=content[1].absolute_url()
             ret+=li%nurn              ret+=li%nurn
         return ret+"</RDF:Seq>"          return ret+"</RDF:Seq>"
                   
Line 2481  class ECHO_root(Folder,Persistent,Implic Line 2577  class ECHO_root(Folder,Persistent,Implic
     def showRDF(self):      def showRDF(self):
         """showrdf"""          """showrdf"""
             self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml')              self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml')
         ret="""<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  xmlns:ECHONAVIGATION="http://www.echo.eu/rdf#">\n"""          ret="""<?xml version="1.0" encoding="utf-8"?>\n<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  xmlns:ECHONAVIGATION="http://www.echo.eu/rdf#">\n"""
         ret+=self.getRDF()+"\n"          ret+=self.getRDF(urn="echo:collectionroot")+"\n"
   
         ret+="""</RDF:RDF>"""          ret+="""</RDF:RDF>"""
             return ret              return ret
   
     def getRDF(self):      def getRDF(self,urn=None):
         """rdf of the collection"""          """rdf of the collection"""
         contents=self.ZopeFind(self,obj_metatypes=['ECHO_group','ECHO_resource','ECHO_collection'])  
   
         about="""<RDF:Description about="%s">"""  
         name="""<ECHONAVIGATION:name>%s</ECHONAVIGATION:name>"""  
           
         urn="urn:"+re.sub('/',':',self.absolute_url())  
   
         about2=about%urn  
         name2=name%self.getId()  
                   
           contents=self.ZopeFind(self,obj_metatypes=['ECHO_group','ECHO_resource','ECHO_collection'])
   
         ret=about2+"\n"+name2+"\n"+"</RDF:Description>"          ret=getRDFDescription(self,self.absolute_url(),urn=urn)
   
         li="""<RDF:li resource="%s" />\n"""          li="""<RDF:li RDF:resource="%s" />\n"""
   
                   
         for content in contents:          for content in contents:
             ret+=content[1].getRDF()+"\n"              ret+=content[1].getRDF()+"\n"
                           
         ret+="""<RDF:Seq about="%s">\n"""%urn          ret+="""<RDF:Seq RDF:about="%s">\n"""%urn
         for content in contents:          for content in contents:
             nurn="urn:"+re.sub('/',':',content[1].absolute_url())              nurn=content[1].absolute_url()
             ret+=li%nurn              ret+=li%nurn
         return ret+"</RDF:Seq>"          return ret+"</RDF:Seq>"
                   

Removed from v.1.142  
changed lines
  Added in v.1.148


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