|
|
| version 1.33, 2004/07/23 17:49:07 | version 1.36, 2004/10/04 12:57:03 |
|---|---|
| Line 137 def add3(self): | Line 137 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 146 def add4(self): |
| #return self.REQUEST['submit'] | #return self.REQUEST['submit'] |
| try: | try: |
| #os.popen('mkdir '+self.REQUEST.SESSION['path']) | |
| os.mkdir(self.REQUEST.SESSION['path']) | os.mkdir(self.REQUEST.SESSION['path']) |
| os.chmod(self.REQUEST.SESSION['path'],0774) | os.chmod(self.REQUEST.SESSION['path'],0775) |
| except: | except: |
| """nothing""" | """nothing""" |
| Line 156 def add4(self): | Line 159 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 172 def add4(self): |
| def add5(self): | def add5(self): |
| """ADD INDEX.META""" | """ADD INDEX.META""" |
| os.chmod(self.REQUEST.SESSION['path'],0775) | |
| 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 188 def add6(self): | Line 193 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() | 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') |
| f.writelines(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 258 def addPresentation(self,path): | Line 263 def addPresentation(self,path): |
| 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 |
| self.REQUEST.SESSION['xmlvorschlag']="""<info> | |
| tmpTxt="""<?xml version="1.0" encoding="UTF-8"?> | |
| <info> | |
| <author>%s</author> | <author>%s</author> |
| <title>%s</title> | <title>%s</title> |
| <date>%s</date> | <date>%s</date> |
| <display>yes</display> | <display>yes</display> |
| </info>"""%(author,title,date) | </info>"""%(author,title,date) |
| self.REQUEST.SESSION['xmlvorschlag']=tmpTxt.encode('utf-8') | |
| newtemplate=PageTemplateFile('Products/OSA_system/zpt/addPresentation').__of__(self) | newtemplate=PageTemplateFile('Products/OSA_system/zpt/addPresentation').__of__(self) |
| return newtemplate() | return newtemplate() |
| Line 410 def addTextExternal(self,path,texturl,ve | Line 419 def addTextExternal(self,path,texturl,ve |
| node.appendChild(subnode) | node.appendChild(subnode) |
| writefile=file(path+"/index.meta","w") | writefile=file(path+"/index.meta","w") |
| writefile.write(dom.toxml().encode('utf-8')) | writefile.write(dom.toxml(encoding="UTF-8")) |
| writefile.close() | writefile.close() |
| #change texttool tag | #change texttool tag |
| Line 439 def addTextExternal(self,path,texturl,ve | Line 448 def addTextExternal(self,path,texturl,ve |
| #index.meta ausgeben | #index.meta ausgeben |
| writefile=file(path+"/index.meta","w") | writefile=file(path+"/index.meta","w") |
| writefile.write(dom.toxml().encode('utf-8')) | writefile.write(dom.toxml(encoding="UTF-8")) |
| writefile.close() | writefile.close() |
| #registrieren | #registrieren |
| Line 512 def addDirsToIndexMeta(path,folder_name, | Line 521 def addDirsToIndexMeta(path,folder_name, |
| node.appendChild(subnode) | node.appendChild(subnode) |
| writefile=file(path+"/index.meta","w") | writefile=file(path+"/index.meta","w") |
| writefile.write(dom.toxml().encode('utf-8')) | writefile.write(dom.toxml(encoding='UTF-8')) |
| writefile.close() | writefile.close() |
| def readArchimedesXML(folder): | def readArchimedesXML(folder): |
| Line 671 def combineTextImage2(self,path): | Line 680 def combineTextImage2(self,path): |
| """nothing""" | """nothing""" |
| writefile=file(path+"/index.meta","w") | writefile=file(path+"/index.meta","w") |
| writefile.write(dom.toxml().encode('utf-8')) | writefile.write(dom.toxml(encoding="UTF-8")) |
| writefile.close() | writefile.close() |
| Line 679 def combineTextImage2(self,path): | Line 688 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 = re.sub('/mpiwg/online/','',path)+"/"+self.REQUEST['image'] |
| 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 ) | |
| #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'])) | #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'])) |
| 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] |