version 1.1, 2003/10/01 08:20:47
|
version 1.4, 2003/10/11 10:54:13
|
Line 1
|
Line 1
|
|
|
|
|
|
|
#BAUSTELLE |
#BAUSTELLE |
|
|
|
|
"""Methoden zum hinzufügen von Dokumenten ins Archiv""" |
"""Methoden zum hinzufügen von Dokumenten ins Archiv""" |
#import archive |
import archive |
import os |
import os |
from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
from Products.PageTemplates.PageTemplate import PageTemplate |
from Products.PageTemplates.PageTemplate import PageTemplate |
Line 22 def add(self, no_upload=0):
|
Line 19 def add(self, no_upload=0):
|
|
|
self.referencetypes=['Book','Journal Article','Manuscript'] |
self.referencetypes=['Book','Journal Article','Manuscript'] |
|
|
newtemplate=PageTemplateFile('products/OSA_system/OSAS_add_new').__of__(self) |
newtemplate=PageTemplateFile('Products/OSA_system/OSAS_add_new').__of__(self) |
self.REQUEST.SESSION['path']=self.REQUEST['path'] |
self.REQUEST.SESSION['path']=self.REQUEST['path'] |
if no_upload==0: |
if no_upload==0: |
self.REQUEST.SESSION['no_upload']='yes' |
self.REQUEST.SESSION['no_upload']='yes' |
Line 36 def add(self, no_upload=0):
|
Line 33 def add(self, no_upload=0):
|
|
|
|
|
def getISO(): |
def getISO(): |
f=file('/Users/dwinter/Documents/Projekte/OSAS/OSA_system/iso639-1.inc','r').readlines() |
f=file('/usr/local/mpiwg/Zope/lib/python/Products/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') |
Line 60 def add2(self):
|
Line 57 def add2(self):
|
#sorted=listed.sort() |
#sorted=listed.sort() |
#print sorted |
#print sorted |
|
|
newtemplate=PageTemplateFile('products/OSA_system/OSAS_add_bibdata').__of__(self) |
newtemplate=PageTemplateFile('Products/OSA_system/OSAS_add_bibdata').__of__(self) |
return newtemplate() |
return newtemplate() |
#return self.fields |
#return self.fields |
|
|
Line 100 def add3(self):
|
Line 97 def add3(self):
|
self.REQUEST.SESSION['folder_name']=self.REQUEST.SESSION['path'] |
self.REQUEST.SESSION['folder_name']=self.REQUEST.SESSION['path'] |
return add5(self) |
return add5(self) |
else: |
else: |
newtemplate=PageTemplateFile('products/OSA_system/OSAS_add_naming').__of__(self) |
newtemplate=PageTemplateFile('Products/OSA_system/OSAS_add_naming').__of__(self) |
return newtemplate() |
return newtemplate() |
|
|
|
|
Line 114 def add4(self):
|
Line 111 def add4(self):
|
|
|
self.REQUEST.SESSION['folder_name']=self.folder_name |
self.REQUEST.SESSION['folder_name']=self.folder_name |
self.image_folder_name="pageimg" |
self.image_folder_name="pageimg" |
newtemplate=PageTemplateFile('products/OSA_system/OSAS_upload').__of__(self) |
newtemplate=PageTemplateFile('Products/OSA_system/OSAS_upload').__of__(self) |
return newtemplate() |
return newtemplate() |
|
|
def add5(self): |
def add5(self): |
"""ADD INDEX.META""" |
"""ADD INDEX.META""" |
newtemplate=PageTemplateFile('products/OSA_system/OSAS_add_metadata').__of__(self) |
newtemplate=PageTemplateFile('Products/OSA_system/OSAS_add_metadata').__of__(self) |
return newtemplate() |
return newtemplate() |
|
|
def add6(self): |
def add6(self): |
Line 136 def add6(self):
|
Line 133 def add6(self):
|
for tag in self.metadata.keys(): |
for tag in self.metadata.keys(): |
self.metadataprint=self.metadataprint+"<"+tag+">"+self.metadata[tag]+"</"+tag+">\n" |
self.metadataprint=self.metadataprint+"<"+tag+">"+self.metadata[tag]+"</"+tag+">\n" |
|
|
newtemplate=PageTemplateFile('products/OSA_system/index_meta').__of__(self) |
newtemplate=PageTemplateFile('Products/OSA_system/index_meta').__of__(self) |
newtemplate.content_type="text/plain" |
newtemplate.content_type="text/plain" |
renderxml = newtemplate() |
renderxml = newtemplate() |
if self.REQUEST.SESSION.has_key('no_upload'): |
if self.REQUEST.SESSION.has_key('no_upload'): |
Line 155 def add6(self):
|
Line 152 def add6(self):
|
else: |
else: |
#print self.add_metadata['archive-path'] |
#print self.add_metadata['archive-path'] |
self.viewpath=re.search(r"/mpiwg/online/(.*)",self.add_metadata['archive-path']).group(1) |
self.viewpath=re.search(r"/mpiwg/online/(.*)",self.add_metadata['archive-path']).group(1) |
newtemplate2=PageTemplateFile('products/OSA_system/OSAS_saved').__of__(self) |
newtemplate2=PageTemplateFile('Products/OSA_system/OSAS_saved').__of__(self) |
|
|
|
|
newtemplate2.content_type="text/html" |
newtemplate2.content_type="text/html" |
Line 176 def addPresentation(self,path):
|
Line 173 def addPresentation(self,path):
|
|
|
dom=xml.dom.minidom.parse(path+"/index.meta") |
dom=xml.dom.minidom.parse(path+"/index.meta") |
|
|
|
|
try: |
try: |
author=archive.getText(dom.getElementsByTagName('author')[0].childNodes) |
author=archive.getText(dom.getElementsByTagName('author')[0].childNodes) |
except: |
except: |
Line 200 def addPresentation(self,path):
|
Line 198 def addPresentation(self,path):
|
<display>yes</display> |
<display>yes</display> |
</info>"""%(author,title,date) |
</info>"""%(author,title,date) |
|
|
newtemplate=PageTemplateFile('/usr/local/mpiwg/Zope/Extensions/addPresentation').__of__(self) |
newtemplate=PageTemplateFile('Products/OSA_system/addPresentation').__of__(self) |
return newtemplate() |
return newtemplate() |
|
|
def addPresentation2(self): |
def addPresentation2(self): |
"""add presentation """ |
"""add presentation """ |
self.folder_name=self.REQUEST['folder_name'] |
folder_name=self.REQUEST['folder_name'] |
#print self.REQUEST['folder_name'] |
#print self.REQUEST['folder_name'] |
self.content_description=self.REQUEST['content_description'] |
content_description=self.REQUEST['content_description'] |
|
|
self.path=self.REQUEST.SESSION['path'] |
path=self.REQUEST.SESSION['path'] |
|
|
if not self.REQUEST.has_key('fileupload'): |
if not self.REQUEST.has_key('fileupload'): |
self.xmlinfo=self.REQUEST['xmltext'] |
xmlinfo=self.REQUEST['xmltext'] |
file_name="info.xml" |
file_name="info.xml" |
|
|
else: |
else: |
file_name=self.REQUEST['fileupload'].filename |
file_name=self.REQUEST['fileupload'].filename |
self.xmlinfo=self.REQUEST.form['fileupload'].read() |
xmlinfo=self.REQUEST.form['fileupload'].read() |
# hack dW |
# hack Multipart auswertung funktioniert nicht ausser bei mozilla |
file_name="info.xml" |
file_name="info.xml" |
self.xmlinfo=self.REQUEST['xmltext'] |
xmlinfo=self.REQUEST['xmltext'] |
try: |
try: |
os.mkdir(self.path+"/"+self.folder_name) |
os.mkdir(path+"/"+folder_name) |
except: |
except: |
"""nothing""" |
"""nothing""" |
print "NAME:",file_name |
print "NAME:",file_name |
f=open(self.path+"/"+self.folder_name+"/"+file_name,"w") |
f=open(path+"/"+folder_name+"/"+file_name,"w") |
f.write(self.xmlinfo) |
f.write(xmlinfo) |
f.close() |
f.close() |
os.chmod(self.path+"/"+self.folder_name,0755) |
os.chmod(path+"/"+folder_name,0755) |
os.chmod(self.path+"/"+self.folder_name+"/"+file_name,0644) |
os.chmod(path+"/"+folder_name+"/"+file_name,0644) |
addDirsToIndexMeta(self.path,self.folder_name,self.content_description,'presentation') |
addDirsToIndexMeta(path,folder_name,content_description,'presentation') |
|
|
return self.REQUEST.RESPONSE.redirect('storefiles?path='+self.path) |
return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL2']+'?path='+path) |
|
|
def addText(self,path): |
def addText(self,path): |
"""add fulltext to the path""" |
"""add fulltext to the path""" |
self.REQUEST.SESSION['existing_names']=['pageimg'] # to be done generate list of existing text files |
self.REQUEST.SESSION['existing_names']=['pageimg'] # to be done generate list of existing text files |
self.REQUEST.SESSION['path']=path |
self.REQUEST.SESSION['path']=path |
newtemplate=PageTemplateFile('/usr/local/mpiwg/Zope/Extensions/addText').__of__(self) |
newtemplate=PageTemplateFile('Products/OSA_system/addText').__of__(self) |
return newtemplate() |
return newtemplate() |
|
|
def addText2(self): |
def addText2(self): |
self.folder_name=self.REQUEST['folder_name'] |
folder_name=self.REQUEST['folder_name'] |
#print self.REQUEST['folder_name'] |
#print self.REQUEST['folder_name'] |
self.content_description=self.REQUEST['content_description'] |
content_description=self.REQUEST['content_description'] |
self.path=self.REQUEST.SESSION['path'] |
path=self.REQUEST.SESSION['path'] |
self.file_name=self.REQUEST['fileupload'].filename |
file_name=self.REQUEST['fileupload'].filename |
self.file=self.REQUEST.form['fileupload'].read() |
filedata=self.REQUEST.form['fileupload'].read() |
os.mkdir(self.path+"/"+self.folder_name) |
os.mkdir(path+"/"+folder_name) |
f=open(self.path+"/"+self.folder_name+"/"+self.file_name,"w") |
f=open(path+"/"+folder_name+"/"+file_name,"w") |
f.write(self.file) |
f.write(filedata) |
f.close() |
f.close() |
os.chmod(self.path+"/"+self.folder_name,0755) |
os.chmod(path+"/"+folder_name,0755) |
os.chmod(self.path+"/"+self.folder_name+"/"+self.file_name,0644) |
os.chmod(path+"/"+folder_name+"/"+file_name,0644) |
addDirsToIndexMeta(self.path,self.folder_name,self.content_description,'fulltext') |
addDirsToIndexMeta(path,folder_name,content_description,'fulltext') |
|
|
return self.REQUEST.RESPONSE.redirect('storefiles?path='+self.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""" |
"""hinzufügen eines externen textes""" |
Line 363 def addImages(self,path):
|
Line 361 def addImages(self,path):
|
"""Imagesfolder to the path""" |
"""Imagesfolder to the path""" |
self.REQUEST.SESSION['existing_names']=['pageimg'] # to be done generate list of existing pageimages files |
self.REQUEST.SESSION['existing_names']=['pageimg'] # to be done generate list of existing pageimages files |
self.REQUEST.SESSION['path']=path |
self.REQUEST.SESSION['path']=path |
newtemplate=PageTemplateFile('products/OSA_system/OSAS_addImages').__of__(self) |
newtemplate=PageTemplateFile('Products/OSA_system/OSAS_addImages').__of__(self) |
return newtemplate() |
return newtemplate() |
|
|
def addImages2(self): |
def addImages2(self): |
|
|
self.image_folder_name=self.REQUEST['folder_name'] |
self.image_folder_name=self.REQUEST['folder_name'] |
#print self.REQUEST['folder_name'] |
#print self.REQUEST['folder_name'] |
self.content_description=self.REQUEST['content_description'] |
self.content_description=self.REQUEST['content_description'] |
Line 376 def addImages2(self):
|
Line 375 def addImages2(self):
|
self.content_type='images' |
self.content_type='images' |
addDirsToIndexMeta(self.REQUEST.SESSION['path'],self.image_folder_name,self.content_description,self.content_type) |
addDirsToIndexMeta(self.REQUEST.SESSION['path'],self.image_folder_name,self.content_description,self.content_type) |
self.REQUEST.SESSION['path']=re.search(r"/mpiwg(.*)",self.REQUEST.SESSION['path']).group(1) |
self.REQUEST.SESSION['path']=re.search(r"/mpiwg(.*)",self.REQUEST.SESSION['path']).group(1) |
newtemplate=PageTemplateFile('products/OSA_system/OSAS_upload2').__of__(self) |
newtemplate=PageTemplateFile('Products/OSA_system/OSAS_upload2').__of__(self) |
return newtemplate() |
return newtemplate() |
|
|
|
|
|
|
def addDirsToIndexMeta(path,folder_name,content_description,content_type): |
def addDirsToIndexMeta(path,folder_name,content_description,content_type): |
#f=file(path+"/index.meta",r) |
#f=file(path+"/index.meta",r) |
dom=xml.dom.minidom.parse(path+"/index.meta") |
dom=xml.dom.minidom.parse(path+"/index.meta") |
Line 437 def combineTextImage(self,path):
|
Line 437 def combineTextImage(self,path):
|
self.REQUEST.SESSION['imagefolders']=imagefolders |
self.REQUEST.SESSION['imagefolders']=imagefolders |
self.REQUEST.SESSION['presentationfolders']=presentationfolders |
self.REQUEST.SESSION['presentationfolders']=presentationfolders |
self.REQUEST.SESSION['filelanguage']=filelanguage |
self.REQUEST.SESSION['filelanguage']=filelanguage |
newtemplate=PageTemplateFile('/usr/local/mpiwg/Zope/Extensions/ImageandText').__of__(self) |
newtemplate=PageTemplateFile('Products/OSA_system/ImageandText').__of__(self) |
return newtemplate() |
return newtemplate() |
|
|
|
|
Line 499 def combineTextImage2(self,path):
|
Line 499 def combineTextImage2(self,path):
|
|
|
|
|
|
|
print 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 &"% re.sub('mpiwg/online/','',self.REQUEST['path']+"/"+self.REQUEST['image'])) |
return self.REQUEST.RESPONSE.redirect('storefiles?path='+self.REQUEST['path']) |
|
|
#return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL2']+'?path='+self.REQUEST['path']) |
|
|