Diff for /OSAS/OSA_system/OSAS_add.py between versions 1.47 and 1.53

version 1.47, 2006/06/14 16:13:53 version 1.53, 2010/02/15 19:09:00
Line 1 Line 1
 #Neue Version Begin 5.4.2004  #Neue Version Begin 5.4.2004
   
   
 """Methoden zum hinzufügen von Dokumenten ins Archiv"""  """Methoden zum hinzufuegen von Dokumenten ins Archiv"""
 from OSAS_helpers import readArchimedesXML   from OSAS_helpers import readArchimedesXML 
 try:  try:
         import archive          import archive
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 logging
   
   #ersetzt logging
   def logger(txt,method,txt2):
       """logging"""
       logging.info(txt+ txt2)
   
   
 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 279  def addPresentation(self,path): Line 286  def addPresentation(self,path):
         self.REQUEST.SESSION['presentationname']="%02d-presentation"%i          self.REQUEST.SESSION['presentationname']="%02d-presentation"%i
         self.REQUEST.SESSION['path']=path          self.REQUEST.SESSION['path']=path
   
         tmpTxt="""<?xml version="1.0" encoding="UTF-8"?>          tmpTxt=u"""<?xml version="1.0" encoding="UTF-8"?>
         <info>          <info>
         <author>%s</author>          <author>%s</author>
         <title>%s</title>          <title>%s</title>
Line 316  def addPresentation2(self): Line 323  def addPresentation2(self):
                 """nothing"""                  """nothing"""
         #print "NAME:",file_name          #print "NAME:",file_name
         f=open(path+"/"+folder_name+"/"+file_name,"w")          f=open(path+"/"+folder_name+"/"+file_name,"w")
         f.write(xmlinfo)          f.write(xmlinfo.encode('utf-8'))
         f.close()          f.close()
         try:          try:
                 os.chmod(path+"/"+folder_name,0775)                  os.chmod(path+"/"+folder_name,0775)
Line 389  def addText2(self): Line 396  def addText2(self):
         return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL2']+'?path='+path)          return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL2']+'?path='+path)
   
 def addTextExternal(self,path,texturl,version):  def addTextExternal(self,path,texturl,version):
         """hinzufügen eines externen textes"""          """hinzufuegen eines externen textes"""
         try: #neue text version einlesen          try: #neue text version einlesen
                 texttemp=urllib.urlopen(texturl).readlines()                  texttemp=urllib.urlopen(texturl).readlines()
                 text=""                  text=""
Line 399  def addTextExternal(self,path,texturl,ve Line 406  def addTextExternal(self,path,texturl,ve
                 return "ERROR: cannot read: %s"%texturl                  return "ERROR: cannot read: %s"%texturl
         if TextExternalError(text): #kein xml header          if TextExternalError(text): #kein xml header
                 return "ERROR: cannot read: %s"%texturl, "received:",text                   return "ERROR: cannot read: %s"%texturl, "received:",text 
         textpath=getNewTextPath(path) #erzeuge neuen Ornder für den Text          textpath=getNewTextPath(path) #erzeuge neuen Ornder fuer den Text
         splitted=string.split(texturl,"/")          splitted=string.split(texturl,"/")
         name=splitted[len(splitted)-1] #Name des XML-files          name=splitted[len(splitted)-1] #Name des XML-files
         try:          try:
Line 450  def addTextExternal(self,path,texturl,ve Line 457  def addTextExternal(self,path,texturl,ve
         try:          try:
                 texttoolnodelist=subnode.getElementsByTagName('text')                  texttoolnodelist=subnode.getElementsByTagName('text')
                   
                 if not len(texttoolnodelist)==0: #texttool tag existiert schon, dann löschen                  if not len(texttoolnodelist)==0: #texttool tag existiert schon, dann loeschen
                         subsubnode=subnode.removeChild(texttoolnodelist[0])                          subsubnode=subnode.removeChild(texttoolnodelist[0])
                         subsubnode.unlink()                          subsubnode.unlink()
         except:          except:
Line 564  def readArchimedesXML(folder): Line 571  def readArchimedesXML(folder):
                   
   
 def combineTextImage2(self,path):  def combineTextImage2(self,path):
         """erstellt bzw. ändert texttool meta tag"""          """erstellt bzw. aendert texttool meta tag"""
         dom=xml.dom.minidom.parse(path+"/index.meta")          dom=xml.dom.minidom.parse(path+"/index.meta")
         node=dom.getElementsByTagName('meta')[0] #getNode          node=dom.getElementsByTagName('meta')[0] #getNode
   
   
         subnodelist=node.getElementsByTagName('texttool')          subnodelist=node.getElementsByTagName('texttool')
         if not len(subnodelist)==0: #texttool tag existiert schon, dann löschen          if not len(subnodelist)==0: #texttool tag existiert schon, dann loeschen
                 subnode=node.removeChild(subnodelist[0])                  subnode=node.removeChild(subnodelist[0])
                 subnode.unlink()                  subnode.unlink()
   
         subnode=dom.createElement('texttool') #neu erzeugen          subnode=dom.createElement('texttool') #neu erzeugen
   
                   
         presentfile=os.listdir(path+"/"+self.REQUEST['presentation'])[0]          presentfiles=os.listdir(path+"/"+self.REQUEST['presentation'])
           for presentfileTmp in presentfiles:
               if (presentfileTmp[0]!="."): #schliesse unsichbare DAteien aus.
                   presentfile=presentfileTmp
                   
   
         displaynode=dom.createElement('display')          displaynode=dom.createElement('display')
Line 700  def combineTextImage2(self,path): Line 710  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
   #                path=re.sub('//','/',self.REQUEST['path']) # falls '//' im Pfad
   #                dlpath = re.sub('/mpiwg/online/','',path)+"/"+self.REQUEST['image']
   #
   #                logger('OSas',logging.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()
   #                logger('OSAS (combine)',logging.INFO,ret)
   
         if self.REQUEST.has_key('image'): # falls bilder  
                 path=re.sub('//','/',self.REQUEST['path']) # falls '//' im Pfad  
                 dlpath = re.sub('/mpiwg/online/','',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=100 -sync >> /tmp/sc.out &"%dlpath ).read()  
                 zLOG.LOG('OSAS (combine)',zLOG.INFO,ret)  
   
           #else: # falls keine Bilder (bug in reg.cgi info file ersetzen)
           #        f=file("/tmp/tmp_info.xml","w")
         else: # falls keine Bilder (bug in reg.cgi info file ersetzen)          #        tmp=patchedInfoXML(self.REQUEST['path'])
                 f=file("/tmp/tmp_info.xml","w")          #        f.write(tmp.encode('utf-8'))
                 tmp=patchedInfoXML(self.REQUEST['path'])          #        f.close()
                 f.write(tmp.encode('utf-8'))          #        splitted=path.split("/")
                 f.close()          #        fn=splitted[len(splitted)-1]
                 splitted=path.split("/")          #        remotePath="archive@nausikaa2.rz-berlin.mpg.de:/usr/local/share/archimedes/web/docs/proj/echo/1/docs/"+fn+"/info.xml"
                 fn=splitted[len(splitted)-1]          #        os.popen("scp /tmp/tmp_info.xml %s"%remotePath)
                 remotePath="archive@nausikaa2.rz-berlin.mpg.de:/usr/local/share/archimedes/web/docs/proj/echo/1/docs/"+fn+"/info.xml"  
                 os.popen("scp /tmp/tmp_info.xml %s"%remotePath)  
   
 def patchedInfoXML(path):  def patchedInfoXML(path):
         dom=xml.dom.minidom.parse(path+"/index.meta")          dom=xml.dom.minidom.parse(path+"/index.meta")

Removed from v.1.47  
changed lines
  Added in v.1.53


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