Diff for /OSAS/OSA_system/OSAS_add.py between versions 1.5 and 1.10

version 1.5, 2003/10/13 22:24:35 version 1.10, 2004/01/29 10:19:38
Line 33  def add(self, no_upload=0): Line 33  def add(self, no_upload=0):
   
   
 def getISO():  def getISO():
       """ISO"""
       try:
         f=file('/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/iso639-1.inc','r').readlines()          f=file('/usr/local/mpiwg/Zope/lib/python/Products/OSA_system/iso639-1.inc','r').readlines()
           #f=file('OSA_system/iso639-1.inc','r').readlines()
     ret={}      ret={}
     for lineraw in f:      for lineraw in f:
         line=lineraw.encode('ascii','replace')          line=lineraw.encode('ascii','replace')
         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
       except:
           ret={}
         return ret          return ret
   
 def add2(self):  def add2(self):
Line 52  def add2(self): Line 56  def add2(self):
   
     self.fields=self.bibdata[self.reftype]      self.fields=self.bibdata[self.reftype]
     self.isolist=getISO()      self.isolist=getISO()
       tmp=getISO().keys()
       tmp.sort()
       self.isokeys=tmp
         #listed=[ x for x in self.isolist.keys()]          #listed=[ x for x in self.isolist.keys()]
     #print listed      #print listed
         #sorted=listed.sort()          #sorted=listed.sort()
Line 144  def add6(self): Line 151  def add6(self):
     f=open(metapath,'w')      f=open(metapath,'w')
     f.writelines(renderxml)      f.writelines(renderxml)
     f.close()      f.close()
     os.chmod(metapath,0644)      os.chmod(metapath,0664)
       os.popen('chmod -R 0775 %s'%self.add_metadata['archive-path']+"/"+self.add_metadata['folder_name']) 
     if self.REQUEST.SESSION.has_key('no_upload'):      if self.REQUEST.SESSION.has_key('no_upload'):
                   
         #newtemplate2=PageTemplateFile('/usr/local/mpiwg/Zope/Extensions/done',"text/html").__of__(self)          #newtemplate2=PageTemplateFile('/usr/local/mpiwg/Zope/Extensions/done',"text/html").__of__(self)
Line 177  def addPresentation(self,path): Line 185  def addPresentation(self,path):
     try:      try:
         author=archive.getText(dom.getElementsByTagName('author')[0].childNodes)          author=archive.getText(dom.getElementsByTagName('author')[0].childNodes)
     except:      except:
           try:
         author=archive.getText(dom.getElementsByTagName('Author')[0].childNodes)          author=archive.getText(dom.getElementsByTagName('Author')[0].childNodes)
           except:
               author=archive.getText(dom.getElementsByTagName('Editor')[0].childNodes)
               
     title=archive.getText(dom.getElementsByTagName('title')[0].childNodes)      title=archive.getText(dom.getElementsByTagName('title')[0].childNodes)
     try:      try:
         date=archive.getText(dom.getElementsByTagName('year')[0].childNodes)          date=archive.getText(dom.getElementsByTagName('year')[0].childNodes)
Line 336  def addTextExternal(self,path,texturl,ve Line 348  def addTextExternal(self,path,texturl,ve
     writefile.close()      writefile.close()
           
     #registrieren      #registrieren
     urllib.urlopen("http://nausikaa2.rz-berlin.mpg.de:86/cgi-bin/toc/admin/reg.cgi?path=%s"%path).readlines()      return urllib.urlopen("http://nausikaa2.rz-berlin.mpg.de:86/cgi-bin/toc/admin/reg.cgi?path=%s"%path).readlines()
       
           
     return "DONE:"+textpath+"/"+name  
   
 def TextExternalError(text):  def TextExternalError(text):
     firsts=text[0:10]      firsts=text[0:10]
Line 419  def readArchimedesXML(folder): Line 431  def readArchimedesXML(folder):
     for item in items:      for item in items:
         #print item.attributes['dir'].value          #print item.attributes['dir'].value
         try:                  try:        
             dict[item.attributes['dir'].value]=item.attributes['uri'].value              dict[item.attributes['dir'].value]=item.attributes['xml'].value
             #print item.attributes['dir'].value,item.attributes['text'].value              #print item.attributes['dir'].value,item.attributes['text'].value
         except:          except:
             """nothing"""              """nothing"""
Line 456  def combineTextImage(self,path): Line 468  def combineTextImage(self,path):
     except:      except:
         filelanguage=""          filelanguage=""
     self.REQUEST.SESSION['isolist']=getISO()      self.REQUEST.SESSION['isolist']=getISO()
       tmp=getISO().keys()
       tmp.sort()
       self.REQUEST.SESSION['isolistsort']=tmp
     self.REQUEST.SESSION['path']=path      self.REQUEST.SESSION['path']=path
     self.REQUEST.SESSION['texts']=texts      self.REQUEST.SESSION['texts']=texts
     self.REQUEST.SESSION['imagefolders']=imagefolders      self.REQUEST.SESSION['imagefolders']=imagefolders
Line 499  def combineTextImage2(self,path): Line 514  def combineTextImage2(self,path):
     if self.REQUEST.has_key('text'):                  if self.REQUEST.has_key('text'):            
         textfile=os.listdir(path+"/"+self.REQUEST['text'])[0]          textfile=os.listdir(path+"/"+self.REQUEST['text'])[0]
         textfoldernode=dom.createElement('text')          textfoldernode=dom.createElement('text')
         textfoldernodetext=dom.createTextNode(self.REQUEST['text']+"/"+textfile)          textfoldernodetext=dom.createTextNode(path+"/"+self.REQUEST['text']+"/"+textfile)
         textfoldernode.appendChild(textfoldernodetext)          textfoldernode.appendChild(textfoldernodetext)
         subnode.appendChild(textfoldernode)          subnode.appendChild(textfoldernode)
   
Line 521  def combineTextImage2(self,path): Line 536  def combineTextImage2(self,path):
         presentationnode.appendChild(presentationnodetext)          presentationnode.appendChild(presentationnodetext)
         subnode.appendChild(presentationnode)          subnode.appendChild(presentationnode)
           
   
       if self.REQUEST.has_key('xslt'):
           if not self.REQUEST['xslt']=="":
               xsltnode=dom.createElement('xslt')
               xsltnodetext=dom.createTextNode(self.REQUEST['xslt'])
               xsltnode.appendChild(xsltnodetext)
               subnode.appendChild(xsltnode)
   
     node.appendChild(subnode)      node.appendChild(subnode)
   
     try:      try:
         node=dom.getElementsByTagName('bib')[0]          node2=node.getElementsByTagName('bib')[0]
         sub=dom.getElementsByTagName('lang')[0]          subs=node2.getElementsByTagName('lang')
               for sub in subs:
         node.removeChild(sub)              print "X",sub
               node2.removeChild(sub)
     except:      except:
         """nothing"""          """nothing"""
     try:      try:
         main=dom.getElementsByTagName('bib')[0]          main=dom.getElementsByTagName('bib')[0]
         node=dom.createElement('lang')          node=dom.createElement('lang')
         textnode=dom.createTextNode(self.REQUEST['lang'])          textnode=dom.createTextNode(self.REQUEST['lang'])
           print "LANG:",lang
         node.appendChild(textnode)          node.appendChild(textnode)
         main.appendChild(node)          main.appendChild(node)
     except:      except:
           try:
               subs=dom.getElementsByTagName('lang')
               main=dom.getElementsByTagName('resource')[0]
               for sub in subs:
                   main.removeChild(sub)
           except:
         """nothing"""          """nothing"""
           
           try:
               main=dom.getElementsByTagName('resource')[0]
               node=dom.createElement('lang')
               textnode=dom.createTextNode(self.REQUEST['lang'])
               #print "LANG:",self.REQUEST['lang']
               node.appendChild(textnode)
               main.appendChild(node)
           except:
               """nothing"""
               
     writefile=file(path+"/index.meta","w")      writefile=file(path+"/index.meta","w")
     writefile.write(dom.toxml().encode('utf-8'))      writefile.write(dom.toxml().encode('utf-8'))
     writefile.close()      writefile.close()
Line 546  def combineTextImage2(self,path): Line 588  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()
     #return urllib.quote("http://nausikaa2.rz-berlin.mpg.de:86/cgi-bin/toc/admin/reg.cgi?path=%s"%path)      #return urllib.quote("http://nausikaa2.rz-berlin.mpg.de:86/cgi-bin/toc/admin/reg.cgi?path=%s"%path)
     os.popen("ssh nausikaa2.rz-berlin.mpg.de /usr/local/mpiwg/scripts/scaleomat.pl %s /mpiwg/temp/online/scaled/thumb 90 &"% re.sub('mpiwg/online/','',self.REQUEST['path']+"/"+self.REQUEST['image']))      os.popen("ssh 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']))
           
     #return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL2']+'?path='+self.REQUEST['path'])      #return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL2']+'?path='+self.REQUEST['path'])
           

Removed from v.1.5  
changed lines
  Added in v.1.10


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