--- OSAS/OSA_system/OSAS_add.py 2004/01/21 07:43:01 1.9 +++ OSAS/OSA_system/OSAS_add.py 2004/03/03 13:02:54 1.12 @@ -9,6 +9,7 @@ from Products.PageTemplates.PageTemplate import string import urllib import xml.dom.minidom +from time import localtime,strftime #referencetypes=['Book','Bic','Journal Article','Manuscript','jiji'] @@ -19,7 +20,7 @@ def add(self, no_upload=0): self.referencetypes=['Book','Journal Article','Manuscript'] - newtemplate=PageTemplateFile('Products/OSA_system/OSAS_add_new').__of__(self) + newtemplate=PageTemplateFile('Products/OSA_system/zpt/OSAS_add_new').__of__(self) self.REQUEST.SESSION['path']=self.REQUEST['path'] if no_upload==0: self.REQUEST.SESSION['no_upload']='yes' @@ -33,6 +34,7 @@ def add(self, no_upload=0): def getISO(): + """ISO""" try: 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() @@ -41,8 +43,7 @@ def getISO(): line=lineraw.encode('ascii','replace') value=string.split(line,'\t')[0].encode('ascii','replace') key=string.split(line,'\t')[1].encode('ascii','replace') - - ret[key]=value + ret[key]=value except: ret={} return ret @@ -56,12 +57,15 @@ def add2(self): self.fields=self.bibdata[self.reftype] self.isolist=getISO() + tmp=getISO().keys() + tmp.sort() + self.isokeys=tmp #listed=[ x for x in self.isolist.keys()] #print listed #sorted=listed.sort() #print sorted - newtemplate=PageTemplateFile('Products/OSA_system/OSAS_add_bibdata').__of__(self) + newtemplate=PageTemplateFile('Products/OSA_system/zpt/OSAS_add_bibdata').__of__(self) return newtemplate() #return self.fields @@ -101,7 +105,7 @@ def add3(self): self.REQUEST.SESSION['folder_name']=self.REQUEST.SESSION['path'] return add5(self) else: - newtemplate=PageTemplateFile('Products/OSA_system/OSAS_add_naming').__of__(self) + newtemplate=PageTemplateFile('Products/OSA_system/zpt/OSAS_add_naming').__of__(self) return newtemplate() @@ -115,12 +119,12 @@ def add4(self): self.REQUEST.SESSION['folder_name']=self.folder_name self.image_folder_name="pageimg" - newtemplate=PageTemplateFile('Products/OSA_system/OSAS_upload').__of__(self) + newtemplate=PageTemplateFile('Products/OSA_system/zpt/OSAS_upload').__of__(self) return newtemplate() def add5(self): """ADD INDEX.META""" - newtemplate=PageTemplateFile('Products/OSA_system/OSAS_add_metadata').__of__(self) + newtemplate=PageTemplateFile('Products/OSA_system/zpt/OSAS_add_metadata').__of__(self) return newtemplate() def add6(self): @@ -137,7 +141,7 @@ def add6(self): for tag in self.metadata.keys(): self.metadataprint=self.metadataprint+"<"+tag+">"+self.metadata[tag]+"\n" - newtemplate=PageTemplateFile('Products/OSA_system/index_meta').__of__(self) + newtemplate=PageTemplateFile('Products/OSA_system/zpt/index_meta').__of__(self) newtemplate.content_type="text/plain" renderxml = newtemplate() if self.REQUEST.SESSION.has_key('no_upload'): @@ -148,7 +152,8 @@ def add6(self): f=open(metapath,'w') f.writelines(renderxml) 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'): #newtemplate2=PageTemplateFile('/usr/local/mpiwg/Zope/Extensions/done',"text/html").__of__(self) @@ -156,7 +161,7 @@ def add6(self): else: #print self.add_metadata['archive-path'] 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/zpt/OSAS_saved').__of__(self) newtemplate2.content_type="text/html" @@ -166,7 +171,7 @@ def add6(self): return newtemplate2() -from time import localtime,strftime + def date(self): return strftime("%d.%m.%Y",localtime()) @@ -206,7 +211,7 @@ def addPresentation(self,path): yes """%(author,title,date) - newtemplate=PageTemplateFile('Products/OSA_system/addPresentation').__of__(self) + newtemplate=PageTemplateFile('Products/OSA_system/zpt/addPresentation').__of__(self) return newtemplate() def addPresentation2(self): @@ -245,7 +250,7 @@ def addText(self,path): """add fulltext to the path""" self.REQUEST.SESSION['existing_names']=['pageimg'] # to be done generate list of existing text files self.REQUEST.SESSION['path']=path - newtemplate=PageTemplateFile('Products/OSA_system/addText').__of__(self) + newtemplate=PageTemplateFile('Products/OSA_system/zpt/addText').__of__(self) return newtemplate() def addText2(self): @@ -369,7 +374,7 @@ def addImages(self,path): """Imagesfolder to the path""" self.REQUEST.SESSION['existing_names']=['pageimg'] # to be done generate list of existing pageimages files self.REQUEST.SESSION['path']=path - newtemplate=PageTemplateFile('Products/OSA_system/OSAS_addImages').__of__(self) + newtemplate=PageTemplateFile('Products/OSA_system/zpt/OSAS_addImages').__of__(self) return newtemplate() def addImages2(self): @@ -383,7 +388,7 @@ def addImages2(self): self.content_type='images' 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) - newtemplate=PageTemplateFile('Products/OSA_system/OSAS_upload2').__of__(self) + newtemplate=PageTemplateFile('Products/OSA_system/zpt/OSAS_upload2').__of__(self) return newtemplate() @@ -436,6 +441,7 @@ def readArchimedesXML(folder): return dict[folder] else: return "" + def combineTextImage(self,path): """gibt input formular zur erstellung des texttools meta tag aus""" files = os.listdir(path) @@ -464,6 +470,9 @@ def combineTextImage(self,path): except: filelanguage="" self.REQUEST.SESSION['isolist']=getISO() + tmp=getISO().keys() + tmp.sort() + self.REQUEST.SESSION['isolistsort']=tmp self.REQUEST.SESSION['path']=path self.REQUEST.SESSION['texts']=texts self.REQUEST.SESSION['imagefolders']=imagefolders @@ -537,6 +546,23 @@ def combineTextImage2(self,path): xsltnode.appendChild(xsltnodetext) subnode.appendChild(xsltnode) + """ + if self.REQUEST.has_key('thumbtemplate'): + if not self.REQUEST['thumbtemplate']=="": + xsltnode=dom.createElement('thumbtemplate') + xsltnodetext=dom.createTextNode(self.REQUEST['thumbtemplate']) + xsltnode.appendChild(xsltnodetext) + subnode.appendChild(xsltnode) + + if self.REQUEST.has_key('topbar'): + if not self.REQUEST['topbar']=="": + xsltnode=dom.createElement('topbar') + xsltnodetext=dom.createTextNode(self.REQUEST['topbar']) + xsltnode.appendChild(xsltnodetext) + subnode.appendChild(xsltnode) + + """ + node.appendChild(subnode) try: