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

version 1.50, 2007/01/31 14:28:04 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 286  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 323  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 396  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 406  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 457  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 571  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 707  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  #        if self.REQUEST.has_key('image'): # falls bilder
                 path=re.sub('//','/',self.REQUEST['path']) # falls '//' im Pfad  #                path=re.sub('//','/',self.REQUEST['path']) # falls '//' im Pfad
                 dlpath = re.sub('/mpiwg/online/','',path)+"/"+self.REQUEST['image']  #                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 )  #                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()  #                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)  #                logger('OSAS (combine)',logging.INFO,ret)
   
   
   

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


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