Diff for /ECHO_content/ECHO_collection.py between versions 1.285 and 1.290

version 1.285, 2007/02/20 15:55:21 version 1.290, 2007/07/19 14:13:13
Line 42  from Products.ZCatalog.CatalogPathAwaren Line 42  from Products.ZCatalog.CatalogPathAwaren
 from Products.ZCTextIndex.ZCTextIndex import manage_addLexicon  from Products.ZCTextIndex.ZCTextIndex import manage_addLexicon
   
 import urllib  import urllib
   import urllib2
 import cgi  import cgi
 import smtplib  import smtplib
 import time  import time
Line 199  class ECHO_locale(ZopePageTemplate): Line 200  class ECHO_locale(ZopePageTemplate):
                 self.title=title                  self.title=title
                 self.label=label                  self.label=label
                 if text:                  if text:
                           if content_type is None:
                               content_type = self.content_type
                         self.pt_edit(text, content_type)                          self.pt_edit(text, content_type)
                 self.id=id                  self.id=id
   
Line 217  class ECHO_locale(ZopePageTemplate): Line 220  class ECHO_locale(ZopePageTemplate):
                 self.title=title                  self.title=title
                 self.label=label                  self.label=label
                 if not text is None:                  if not text is None:
                           if content_type is None:
                               content_type = self.content_type
                         self.pt_edit(text, content_type)                          self.pt_edit(text, content_type)
   
                 if RESPONSE is not None:                  if RESPONSE is not None:
Line 306  class ECHO_layoutTemplate(ZopePageTempla Line 311  class ECHO_layoutTemplate(ZopePageTempla
         if text is None:          if text is None:
             self._default_content_fn = os.path.join(package_home(globals()),'zpt','ECHO_%s_template_standard.zpt'%EchoType)              self._default_content_fn = os.path.join(package_home(globals()),'zpt','ECHO_%s_template_standard.zpt'%EchoType)
             text = open(self._default_content_fn).read()              text = open(self._default_content_fn).read()
           if content_type is None:
               content_type = self.content_type
         self.pt_edit(text, content_type)          self.pt_edit(text, content_type)
   
   
Line 1176  class ECHO_resource(CatalogAware,Folder, Line 1183  class ECHO_resource(CatalogAware,Folder,
         only if metalink is set, otherwise it gives false          only if metalink is set, otherwise it gives false
         """          """
                   
           texterUrl="http://nausikaa2.mpiwg-berlin.mpg.de/digitallibrary/servlet/Texter?fn=/"
           
         vl,msg=self.checkValidityOfMetaLink()          vl,msg=self.checkValidityOfMetaLink()
                   
           if not vl: #ungueltiger link, versuche neuen
               newStr=re.match(".*/mpiwg/online/(.*)",self.metalink) # suche pfad hinter /mpiwg/online 
               oldLink=self.metalink
               
               if newStr:
                   self.metalink=texterUrl+newStr.group(1)
                   vl,msg=self.checkValidityOfMetaLink()
               else:
                   logging.error("change Viewer XX(mew Metadatafile) %s"%self.metalink)
                   vl=False
                   
               if not vl: # geht immer noch nicht, dann setzte wieder zurueck
                   self.metaLink=oldLink
               
               logging.info("change Viewer (mew Metadatafile) %s"%self.metalink)
              
         if vl:          if vl:
             self.newViewer=newViewer              self.newViewer=newViewer
             return vl,msg              return vl,msg
Line 1808  class ECHO_externalLink(Folder,ECHO_basi Line 1833  class ECHO_externalLink(Folder,ECHO_basi
         """ set linkType """          """ set linkType """
         self.linkType = type          self.linkType = type
                           
       def checkLink(self):
           """ returns tuple (isWorking,Error) """        
           try:
               urllib2.urlopen(self.link)
               return (True, '')
           except urllib2.HTTPError, e:
               return (False, e.code)
           except urllib2.URLError, e:
               return (False, str(e.reason))
           except:
               return (False, 'unknown Error')
               
                           
     manage_options = (      manage_options = (
         {'label':'Main Config','action':'ECHO_externalLink_config'},          {'label':'Main Config','action':'ECHO_externalLink_config'},
Line 2133  class ECHO_collection(CatalogAware, Fold Line 2170  class ECHO_collection(CatalogAware, Fold
   
                             if obj.meta_type=="ECHO_mapText":                              if obj.meta_type=="ECHO_mapText":
                                     if splitted[1]=="en":                                      if splitted[1]=="en":
                                             obj.locale_en.pt_edit(REQUEST.form[key],None)                                              obj.locale_en.pt_edit(REQUEST.form[key],obj.locale_en.content_type)
                                     else:                                      else:
                                             obj.pt_edit(REQUEST.form[key],None)                                              obj.pt_edit(REQUEST.form[key],obj.content_type)
                             else:                              else:
                                     text=obj.ZopeFind(obj,obj_metatypes=['ECHO_mapText'])                                      text=obj.ZopeFind(obj,obj_metatypes=['ECHO_mapText'])
                                     if splitted[1]=="en":                                      if splitted[1]=="en":
                                                                                           
                                             text[0][1].locale_en.pt_edit(REQUEST.form[key],None)                                              text[0][1].locale_en.pt_edit(REQUEST.form[key],text[0][1].locale_en.content_type)
                                     else:                                      else:
                                             text[0][1].pt_edit(REQUEST.form[key],None)                                              text[0][1].pt_edit(REQUEST.form[key],text[0][1].content_type)
             if RESPONSE is not None:              if RESPONSE is not None:
                         RESPONSE.redirect('manage_main')                          RESPONSE.redirect('manage_main')
   
Line 2599  class ECHO_collection(CatalogAware, Fold Line 2636  class ECHO_collection(CatalogAware, Fold
         ret="""<?xml version="1.0" encoding="utf-8" ?>"""          ret="""<?xml version="1.0" encoding="utf-8" ?>"""
         return ret+"<collection>"+getCollection(self,pwstr=pwstr)+"</collection>"          return ret+"<collection>"+getCollection(self,pwstr=pwstr)+"</collection>"
           
     def createAllJSAreas(self):      def createAllJSAreas(self,mapColTypes=None):
         """create area calls for JavaScript"""          """create area calls for JavaScript"""
         areas = self.getAllMapAreas()          areas = self.getAllMapAreas(mapColTypes=mapColTypes)
         return self.createJSAreas(areas)          return self.createJSAreas(areas)
   
           
Line 2826  class ECHO_collection(CatalogAware, Fold Line 2863  class ECHO_collection(CatalogAware, Fold
         """javascript"""          """javascript"""
         return sendFile(self, 'js/hl_add.js', 'text/plain')          return sendFile(self, 'js/hl_add.js', 'text/plain')
   
     def getAllMapAreas(self,mapColTypes=['ECHO_collection','ECHO_resource','ECHO_link','ECHO_externalLink']):      def getAllMapAreas(self,mapColTypes=None):
         """Give list of coordinates"""          """Give list of coordinates"""
           if mapColTypes is None:
               mapColTypes=['ECHO_collection','ECHO_resource','ECHO_link','ECHO_externalLink']
                   
         areas=[]          areas=[]
         for entry in self.getSubCols(subColTypes=mapColTypes):          for entry in self.getSubCols(subColTypes=mapColTypes):
Line 4101  class ECHO_linkList(ZopePageTemplate,ECH Line 4140  class ECHO_linkList(ZopePageTemplate,ECH
          self.ZBindings_edit(self._default_bindings)           self.ZBindings_edit(self._default_bindings)
          if text is None:           if text is None:
              text = ''               text = ''
            if content_type is None:
                content_type = self.content_type
          self.pt_edit(text, contentType)           self.pt_edit(text, contentType)
   
   

Removed from v.1.285  
changed lines
  Added in v.1.290


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