Diff for /OSAS/OSA_system/OSAS_add.py between versions 1.35 and 1.43

version 1.35, 2004/08/19 19:01:17 version 1.43, 2005/01/21 17:56:16
Line 14  from Products.PageTemplates.PageTemplate Line 14  from Products.PageTemplates.PageTemplate
 from Products.PageTemplates.PageTemplate import PageTemplate  from Products.PageTemplates.PageTemplate import PageTemplate
 import string  import string
 import urllib  import urllib
   import zLOG
 import xml.dom.minidom  import xml.dom.minidom
 from time import localtime,strftime  from time import localtime,strftime
 from Globals import package_home  from Globals import package_home
Line 52  def getISO(): Line 53  def getISO():
   
         ret={}          ret={}
         for lineraw in f:          for lineraw in f:
             line=lineraw.encode('ascii','replace')              line=lineraw.encode('ascii','replace').strip()
             value=string.split(line,'\t')[0].encode('ascii','replace')              value=string.split(line,'\t')[0].encode('ascii','replace')
             key=string.split(line,'\t')[1].encode('ascii','replace')              key=string.split(line,'\t')[1].encode('ascii','replace')
             ret[key]=value              ret[key]=value
Line 137  def add3(self): Line 138  def add3(self):
           
   
 def add4(self):  def add4(self):
   
     self.path=re.search(r"/mpiwg(.*)",self.REQUEST.SESSION['path']).group(1)      self.path=re.search(r"/mpiwg(.*)",self.REQUEST.SESSION['path']).group(1)
           
     self.folder_name=self.REQUEST['folder_name']      self.folder_name=self.REQUEST['folder_name']
Line 145  def add4(self): Line 147  def add4(self):
     #return self.REQUEST['submit']      #return self.REQUEST['submit']
           
     try:          try:    
         os.mkdir(self.REQUEST.SESSION['path'])              #os.popen('mkdir '+self.REQUEST.SESSION['path'])
         os.chmod(self.REQUEST.SESSION['path'],0774)          os.mkdir(os.path.join(self.REQUEST.SESSION['path'],self.REQUEST['folder_name']))
           os.chmod(os.path.join(self.REQUEST.SESSION['path'],self.REQUEST['folder_name']),0775)
   
     except:      except:
   
         """nothing"""          """nothing"""
   
     if self.REQUEST['submit']=="upload images":      if self.REQUEST['submit']=="upload images":
Line 156  def add4(self): Line 161  def add4(self):
   
         self.image_folder_name="pageimg"          self.image_folder_name="pageimg"
         newtemplate=PageTemplateFile('Products/OSA_system/zpt/OSAS_upload').__of__(self)          newtemplate=PageTemplateFile('Products/OSA_system/zpt/OSAS_upload').__of__(self)
           
         return newtemplate()          return newtemplate()
           
     elif self.REQUEST['submit']=="upload pdf":      elif self.REQUEST['submit']=="upload pdf":
Line 168  def add4(self): Line 174  def add4(self):
           
 def add5(self):  def add5(self):
     """ADD INDEX.META"""      """ADD INDEX.META"""
       try:
           os.chmod(self.REQUEST.SESSION['path'],0775)
       except:
           pass
   
     newtemplate=PageTemplateFile('Products/OSA_system/zpt/OSAS_add_metadata').__of__(self)      newtemplate=PageTemplateFile('Products/OSA_system/zpt/OSAS_add_metadata').__of__(self)
     return newtemplate()      return newtemplate()
   
Line 189  def add6(self): Line 200  def add6(self):
     newtemplate=PageTemplateFile('Products/OSA_system/zpt/index_meta').__of__(self)      newtemplate=PageTemplateFile('Products/OSA_system/zpt/index_meta').__of__(self)
     newtemplate.content_type="text/plain"      newtemplate.content_type="text/plain"
     renderxml = newtemplate(encode='utf-8')      renderxml = newtemplate(encode='utf-8')
       
           
     if self.REQUEST.SESSION.has_key('no_upload'):      if self.REQUEST.SESSION.has_key('no_upload'):
         metapath=self.REQUEST.SESSION['path']+"/index.meta"          metapath=self.REQUEST.SESSION['path']+"/index.meta"
     else:      else:
         metapath=self.add_metadata['archive-path']+"/"+self.add_metadata['folder_name']+"/index.meta"          metapath=self.add_metadata['archive-path']+"/"+self.add_metadata['folder_name']+"/index.meta"
           
     f=open(metapath,'w')      f=open(metapath,'w')
       try:
           f.write(renderxml.encode('utf-8'))
       except:
     f.write(renderxml)      f.write(renderxml)
   
     f.close()      f.close()
     os.chmod(metapath,0664)      os.chmod(metapath,0664)
     os.popen('chmod -R 0775 %s'%self.add_metadata['archive-path']+"/"+self.add_metadata['folder_name'])       os.popen('chmod -R 0775 %s'%self.add_metadata['archive-path']+"/"+self.add_metadata['folder_name']) 
Line 254  def addPresentation(self,path): Line 271  def addPresentation(self,path):
             except:              except:
                 date=""                  date=""
     i=1      i=1
     while os.path.exists("%02d-presentation"%i):      while os.path.exists(path+"/%02d-presentation"%i):
         i+=1          i+=1
         self.REQUEST.SESSION['presentationname']="%02d-presentation"%i          self.REQUEST.SESSION['presentationname']="%02d-presentation"%i
     self.REQUEST.SESSION['path']=path      self.REQUEST.SESSION['path']=path
Line 299  def addPresentation2(self): Line 316  def addPresentation2(self):
     f.write(xmlinfo)      f.write(xmlinfo)
     f.close()      f.close()
     try:      try:
         os.chmod(path+"/"+folder_name,0755)          os.chmod(path+"/"+folder_name,0775)
     except:      except:
         """NO"""          """NO"""
   
     os.chmod(path+"/"+folder_name+"/"+file_name,0644)      os.chmod(path+"/"+folder_name+"/"+file_name,0664)
     addDirsToIndexMeta(path,folder_name,content_description,'presentation')      addDirsToIndexMeta(path,folder_name,content_description,'presentation')
           
     return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL2']+'?path='+path)      return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL2']+'?path='+path)
Line 683  def combineTextImage2(self,path): Line 700  def combineTextImage2(self,path):
     urllib.urlopen("http://nausikaa2.rz-berlin.mpg.de:86/cgi-bin/toc/admin/reg.cgi?path=%s"%path).readlines()      urllib.urlopen("http://nausikaa2.rz-berlin.mpg.de:86/cgi-bin/toc/admin/reg.cgi?path=%s"%path).readlines()
   
     if self.REQUEST.has_key('image'): # falls bilder      if self.REQUEST.has_key('image'): # falls bilder
         dlpath = re.sub('/mpiwg/online/','',self.REQUEST['path'])+"/"+self.REQUEST['image']          path=re.sub('//','/',self.REQUEST['path']) # falls '//' im Pfad
         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 )          dlpath = re.sub('/mpiwg/online/','',path)+"/"+self.REQUEST['image']
             #os.popen("ssh archive@nausikaa2.rz-berlin.mpg.de /usr/local/mpiwg/scripts/scaleomat.pl %s /mpiwg/temp/online/scaled/thumb 90 >> /tmp/sc.out &"% re.sub('/mpiwg/online/','',self.REQUEST['path']+"/"+self.REQUEST['image']))  
           zLOG.LOG('OSas',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=90 -sync >> /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=90 -sync >> /tmp/sc.out &"%dlpath ).read()
           zLOG.LOG('OSAS (combine)',zLOG.INFO,ret)
   
   
   
     else: # falls keine Bilder (bug in reg.cgi info file ersetzen)      else: # falls keine Bilder (bug in reg.cgi info file ersetzen)
         f=file("/tmp/tmp_info.xml","w")          f=file("/tmp/tmp_info.xml","w")
         f.write(patchedInfoXML(self.REQUEST['path']))          tmp=patchedInfoXML(self.REQUEST['path'])
           f.write(tmp.encode('utf-8'))
         f.close()          f.close()
         splitted=path.split("/")          splitted=path.split("/")
         fn=splitted[len(splitted)-1]          fn=splitted[len(splitted)-1]

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


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