Diff for /OSAS/OSA_system/OSAS_show.py between versions 1.27 and 1.35

version 1.27, 2004/08/19 19:01:17 version 1.35, 2008/01/18 20:36:28
Line 10  from OFS.SimpleItem import SimpleItem Line 10  from OFS.SimpleItem import SimpleItem
 from Products.PageTemplates.PageTemplateFile import PageTemplateFile  from Products.PageTemplates.PageTemplateFile import PageTemplateFile
 from Products.PageTemplates.PageTemplate import PageTemplate  from Products.PageTemplates.PageTemplate import PageTemplate
 from AccessControl import ClassSecurityInfo  from AccessControl import ClassSecurityInfo
 from Globals import InitializeClass  from Globals import InitializeClass,package_home
   import zLOG
   
 class OSAS_ShowOnline(SimpleItem):  class OSAS_ShowOnline(SimpleItem):
     security=ClassSecurityInfo()      security=ClassSecurityInfo()
Line 25  class OSAS_ShowOnline(SimpleItem): Line 26  class OSAS_ShowOnline(SimpleItem):
     security.declareProtected('View','index_html')      security.declareProtected('View','index_html')
     def index_html(self):      def index_html(self):
         """main view"""          """main view"""
         pt=PageTemplateFile('Products/OSA_system/zpt/OSAS_ViewFiles.zpt').__of__(self)          pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','OSAS_ViewFiles.zpt')).__of__(self)
         return pt()          return pt()
           
     def getfilesystem2(self,start,reload=0):      def getfilesystem2(self,start,reload=0):
Line 54  class OSAS_ShowOnline(SimpleItem): Line 55  class OSAS_ShowOnline(SimpleItem):
         return hasMetafile(path)          return hasMetafile(path)
   
     def getMetafile(self,path):      def getMetafile(self,path):
         return getMetafile(path)          
           return getMetafile(path).decode('utf-8')
   
     def toggle_view(self,path,file):      def toggle_view(self,path,file):
         """Oeffnen bzw. schließen der Subfolders"""          """Oeffnen bzw. schließen der Subfolders"""
Line 66  InitializeClass(OSAS_ShowOnline) Line 68  InitializeClass(OSAS_ShowOnline)
   
 def manage_AddOSAS_ShowOnlineForm(self):  def manage_AddOSAS_ShowOnlineForm(self):
     """interface for adding the OSAS_root"""      """interface for adding the OSAS_root"""
     pt=PageTemplateFile('Products/OSA_system/zpt/AddOSAS_ShowOnline.zpt').__of__(self)      pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','AddOSAS_ShowOnline.zpt')).__of__(self)
     return pt()      return pt()
   
 def manage_AddOSAS_ShowOnline(self,id,RESPONSE=None):  def manage_AddOSAS_ShowOnline(self,id,RESPONSE=None):
Line 90  class OSAS_StoreOnline(SimpleItem): Line 92  class OSAS_StoreOnline(SimpleItem):
     security.declareProtected('View','index_html')      security.declareProtected('View','index_html')
     def index_html(self):      def index_html(self):
         """main view"""          """main view"""
         pt=PageTemplateFile('Products/OSA_system/zpt/OSAS_StoreFiles.zpt').__of__(self)          pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','OSAS_StoreFiles.zpt')).__of__(self)
         return pt()          return pt()
   
     def readContexts(self,path):      def readContexts(self,path):
Line 107  class OSAS_StoreOnline(SimpleItem): Line 109  class OSAS_StoreOnline(SimpleItem):
         """rescale thumbs of images in path"""          """rescale thumbs of images in path"""
   
         dlpath = re.sub('/mpiwg/online/','',self.REQUEST['path'])          dlpath = re.sub('/mpiwg/online/','',self.REQUEST['path'])
         os.popen("ssh archive@nausikaa2.rz-berlin.mpg.de /usr/local/mpiwg/scripts/scaleomat -src=/mpiwg/online -dest=/mpiwg/temp/online/scaled/thumb -dir=%s -scaleto=90 -replace >> /tmp/sc.out &"%dlpath )          ret=os.popen("ssh archive@nausikaa2.rz-berlin.mpg.de /usr/local/mpiwg/scripts/scaleomat -src=/mpiwg/online -dest=/mpiwg/temp/online/scaled/thumb -dir=%s -scaleto=100 -sync >> /tmp/sc.out &"%dlpath )
         #os.popen("ssh archive@nausikaa2.rz-berlin.mpg.de /usr/local/mpiwg/scripts/scaleomat.pl %s /mpiwg/temp/online/scaled/thumb 90 --replace >> /tmp/sc.out &"% re.sub('/mpiwg/online/','',self.REQUEST['path']))          #os.popen("ssh archive@nausikaa2.rz-berlin.mpg.de /usr/local/mpiwg/scripts/scaleomat.pl %s /mpiwg/temp/online/scaled/thumb 90 --replace >> /tmp/sc.out &"% re.sub('/mpiwg/online/','',self.REQUEST['path']))
       zLOG.LOG("OSAS_StoreOnline (rescleThumbs)",zLOG.INFO,ret.read())
       zLOG.LOG("OSAS_StoreOnline (rescleThumbs)",zLOG.INFO,"ssh archive@nausikaa2.rz-berlin.mpg.de /usr/local/mpiwg/scripts/scaleomat -src=/mpiwg/online -dest=/mpiwg/temp/online/scaled/thumb -dir=%s -scaleto=100 -sync >> /tmp/sc.out &"%dlpath)
         self.REQUEST.SESSION['path']=self.REQUEST['path']          self.REQUEST.SESSION['path']=self.REQUEST['path']
         #return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1'])          #return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1'])
         pt=PageTemplateFile('Products/OSA_system/zpt/OSAS_scaled.zpt').__of__(self)          pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','OSAS_scaled.zpt')).__of__(self)
         return pt()          return pt()
   
           
Line 142  class OSAS_StoreOnline(SimpleItem): Line 145  class OSAS_StoreOnline(SimpleItem):
         return hasMetafile(path)          return hasMetafile(path)
   
     def getMetafile(self,path):      def getMetafile(self,path):
         return getMetafile(path)          
           return getMetafile(path).decode('utf-8')
   
     def toggle_view(self,path,file):      def toggle_view(self,path,file):
         """Oeffnen bzw. schließen der Subfolders"""          """Oeffnen bzw. schließen der Subfolders"""
Line 175  class OSAS_StoreOnline(SimpleItem): Line 179  class OSAS_StoreOnline(SimpleItem):
   
     def addFolderForm(self,path):      def addFolderForm(self,path):
         """add a new path"""          """add a new path"""
         pt=PageTemplateFile('Products/OSA_system/zpt/OSAS_addFolder.zpt').__of__(self)          pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','OSAS_addFolder.zpt')).__of__(self)
         return pt()          return pt()
   
     def showHelp(self,refType,genericTag):      def showHelp(self,refType,genericTag):
Line 206  class OSAS_StoreOnline(SimpleItem): Line 210  class OSAS_StoreOnline(SimpleItem):
                           
         self.REQUEST.SESSION['indexmeta']=indexmeta          self.REQUEST.SESSION['indexmeta']=indexmeta
         self.REQUEST.SESSION['path']=path          self.REQUEST.SESSION['path']=path
         newtemplate=PageTemplateFile('Products/OSA_system/zpt/editindex').__of__(self)          newtemplate=PageTemplateFile(os.path.join(package_home(globals()),'zpt','editindex')).__of__(self)
         return newtemplate()          return newtemplate()
   
     def EditIndex2(self):      def EditIndex2(self):
Line 227  class OSAS_StoreOnline(SimpleItem): Line 231  class OSAS_StoreOnline(SimpleItem):
               
     def add_metafile(self):      def add_metafile(self):
         """nothing"""          """nothing"""
         pt=PageTemplateFile('Products/OSA_system/zpt/OSAS_addmetadata.zpt').__of__(self)          pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','OSAS_addmetadata.zpt')).__of__(self)
         return pt()          return pt()
   
     def getTextToolsField(self,path,name,default=''):      def getTextToolsField(self,path,name,default=''):
Line 265  class OSAS_StoreOnline(SimpleItem): Line 269  class OSAS_StoreOnline(SimpleItem):
     def changeTemplatesForm(self,path):      def changeTemplatesForm(self,path):
         """changeform"""          """changeform"""
         path=self.REQUEST.SESSION['path']=path          path=self.REQUEST.SESSION['path']=path
         pt=PageTemplateFile('Products/OSA_system/zpt/changeTemplatesForm.zpt').__of__(self)          pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','changeTemplatesForm.zpt')).__of__(self)
         return pt()          return pt()
   
                   
Line 281  InitializeClass(OSAS_StoreOnline) Line 285  InitializeClass(OSAS_StoreOnline)
           
 def manage_AddOSAS_StoreOnlineForm(self):  def manage_AddOSAS_StoreOnlineForm(self):
     """interface for adding the OSAS_root"""      """interface for adding the OSAS_root"""
     pt=PageTemplateFile('Products/OSA_system/zpt/AddOSAS_StoreOnline.zpt').__of__(self)      pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','AddOSAS_StoreOnline.zpt')).__of__(self)
     return pt()      return pt()
   
 def manage_AddOSAS_StoreOnline(self,id,RESPONSE=None):  def manage_AddOSAS_StoreOnline(self,id,RESPONSE=None):
Line 336  import xml.dom.minidom Line 340  import xml.dom.minidom
 from Products.PageTemplates.PageTemplateFile import PageTemplateFile  from Products.PageTemplates.PageTemplateFile import PageTemplateFile
 from Products.PageTemplates.PageTemplate import PageTemplate  from Products.PageTemplates.PageTemplate import PageTemplate
 import tempfile  import tempfile
 tempfile.tempdir="/var/tmp/archiver"  tempfile.tempdir="/var/tmp"
   
 exclusion=[".HSResource","lost+found","Network Trash Folder","TheFindByContentFolder","TheVolumeSettingsFolder"]  exclusion=[".HSResource","lost+found","Network Trash Folder","TheFindByContentFolder","TheVolumeSettingsFolder"]
   
 class fsentry(Implicit, Persistent, RoleManager):  class fsentry(Implicit, Persistent, RoleManager):
       """File entry class"""        """File entry class"""
       path = ""        path = ""
Line 569  class filesystem2(Implicit, Persistent, Line 574  class filesystem2(Implicit, Persistent,
       def loadfs(self,start):        def loadfs(self,start):
         """analyse filesystem"""          """analyse filesystem"""
         for line in self.getfs(start):          for line in self.getfs(start):
                       logging.debug("loadfs: reading %s"%repr(line))
         g=re.search(r"(.*/)(.*)\n",line)          g=re.search(r"(.*/)(.*)\n",line)
         if not g==None:          if not g==None:
                   try:                    try:
Line 577  class filesystem2(Implicit, Persistent, Line 582  class filesystem2(Implicit, Persistent,
                         file=g.group(2)                          file=g.group(2)
                   except:                    except:
                         """nothing"""                          """nothing"""
                     logging.debug("loadfs: file=%s"%repr(file))
                     #if file[0] in ('.',':'):
                         # skip dot-files
                     #    continue
                   if self.node.has_key(path):                    if self.node.has_key(path):
                  elements=self.node[path]                   elements=self.node[path]
                  elements.append(file)                   elements.append(file)
Line 647  class browse(Implicit, Persistent, RoleM Line 656  class browse(Implicit, Persistent, RoleM
       def filterExcluded(self,dir):        def filterExcluded(self,dir):
       ret=[]        ret=[]
       for item in dir:        for item in dir:
         if not item in exclusion:                  if not ((item in exclusion) or (item[0] in ('.',':'))):
             ret.append(item)               ret.append(item) 
       return ret        return ret
           
Line 1251  def isScannedDocument(self,path): Line 1260  def isScannedDocument(self,path):
       """returns TRUE, wenn path der Stammordner eines gescannten Documents ist"""        """returns TRUE, wenn path der Stammordner eines gescannten Documents ist"""
       try:        try:
             f = file(path+"/index.meta","r")              f = file(path+"/index.meta","r")
               logging.debug("isscanneddocument: file=%s"%f)
             lines = f.read()              lines = f.read()
         
             try:              try:
                   dom = xml.dom.minidom.parseString(lines)                    dom = xml.dom.minidom.parseString(lines)
                   content_type=getText(dom.getElementsByTagName("content-type")[0].childNodes)                     content_type=getText(dom.getElementsByTagName("content-type")[0].childNodes) 
                     logging.debug("isscanneddocument: content_type=%s"%content_type)
                   if (content_type=="scanned-document") or (content_type=="scanned document") or (content_type=="fulltext document"):                    if (content_type=="scanned-document") or (content_type=="scanned document") or (content_type=="fulltext document"):
                         return 1                          return 1
                   else:                    else:

Removed from v.1.27  
changed lines
  Added in v.1.35


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