|
|
| version 1.1, 2003/09/25 15:25:08 | version 1.2, 2003/09/25 17:52:02 |
|---|---|
| Line 1 | Line 1 |
| # Classes for displaying, browsing and organizing the archive | # Classes for displaying, browsing and organizing the archive |
| import addFolder | |
| from OFS.Folder import Folder | from OFS.Folder import Folder |
| from OFS.SimpleItem import SimpleItem | from OFS.SimpleItem import SimpleItem |
| from Products.PageTemplates.PageTemplateFile import PageTemplateFile | from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
| Line 64 def manage_AddOSAS_ShowOnline(self,id,RE | Line 65 def manage_AddOSAS_ShowOnline(self,id,RE |
| RESPONSE.redirect('manage_main') | RESPONSE.redirect('manage_main') |
| class OSAS_StoreOnline(SimpleItem): | |
| """Webfrontend für das Storagesystem""" | |
| def __init__(self,id): | |
| """initialize a new instance""" | |
| self.id = id | |
| meta_type="OSAS_StoreOnline" | |
| def index_html(self): | |
| """main view""" | |
| pt=PageTemplateFile('products/OSA_system/OSAS_StoreFiles.zpt').__of__(self) | |
| return pt() | |
| def getfilesystem2(self,start,reload=0): | |
| """load filesystem""" | |
| k=filesystem2(start,1) | |
| return k | |
| def tree(self,start): | |
| """get the filetree""" | |
| k=browse(start) | |
| return k | |
| def path_to_link_store(self,path): | |
| """generates navigation bar for viewfiles""" | |
| return path_to_link_store(self.REQUEST['URL'],path) | |
| def isdigilib2(self,path): | |
| """check if digilib""" | |
| return isdigilib2(path) | |
| def changeName(self,name): | |
| return changeName(name) | |
| def hasMetafile(self,path): | |
| return hasMetafile(path) | |
| def getMetafile(self,path): | |
| return getMetafile(path) | |
| def toggle_view(self,path,file): | |
| """Oeffnen bzw. schließen der Subfolders""" | |
| self.tree(path).toggle(path,file) | |
| return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1']+"?path="+path) | |
| def isFolder(self,path): | |
| """Test ob Eintrag ein Folder ist""" | |
| return isFolder(self,path) | |
| def isScannedDocument(self,path): | |
| """Test ob Eintrag ein Folder ist""" | |
| return isScannedDocument(self,path) | |
| def isFullText(self,path,folder_name): | |
| """Test ob Eintrag ein Folder ist""" | |
| return isFullText(path,folder_name) | |
| def addFolderForm(self,path): | |
| """add a new path""" | |
| pt=PageTemplateFile('products/OSA_system/OSAS_addFolder.zpt').__of__(self) | |
| return pt() | |
| def date(self): | |
| return strftime("%d.%m.%Y",localtime()) | |
| def addFolder(self,path,folder_name,description,archive_creation_date,creator): | |
| """add the folder to the filesystem and write the metadata files""" | |
| return addFolder.addFolder(self,path,folder_name,description,archive_creation_date,creator) | |
| def EditIndex(self,path): | |
| """Editiere das Index Metafile""" | |
| try: | |
| dom=xml.dom.minidom.parse(path+"/index.meta") | |
| indexmeta=dom.toxml() | |
| except: | |
| indexmeta="" | |
| self.REQUEST.SESSION['indexmeta']=indexmeta | |
| self.REQUEST.SESSION['path']=path | |
| newtemplate=PageTemplateFile('products/OSA_system/editindex').__of__(self) | |
| return newtemplate() | |
| def EditIndex2(self): | |
| """Sichern der Aenderungen in Index.meta""" | |
| if not self.REQUEST.has_key('fileupload'): | |
| #newtext=urllib.unquote(self.REQUEST['indexmeta']) | |
| newtext=self.REQUEST['indexmeta'] | |
| print newtext | |
| else: | |
| self.file_name=self.REQUEST['fileupload'].filename | |
| #newtext=self.REQUEST.form['fileupload'].read() | |
| # HACK DW | |
| newtext=self.REQUEST['indexmeta'] | |
| indexmeta=file(self.REQUEST.SESSION['path']+"/index.meta","w") | |
| indexmeta.writelines(newtext) | |
| return self.REQUEST.response.redirect(self.REQUEST['URL1']+"?path="+self.REQUEST.SESSION['path']) | |
| def manage_AddOSAS_StoreOnlineForm(self): | |
| """interface for adding the OSAS_root""" | |
| pt=PageTemplateFile('products/OSA_system/AddOSAS_StoreOnline.zpt').__of__(self) | |
| return pt() | |
| def manage_AddOSAS_StoreOnline(self,id,RESPONSE=None): | |
| """add the OSAS_root""" | |
| newObj=OSAS_StoreOnline(id) | |
| self._setObject(id,newObj) | |
| if RESPONSE is not None: | |
| RESPONSE.redirect('manage_main') | |
| Line 535 def path_to_link_view(URL,path): | Line 649 def path_to_link_view(URL,path): |
| i=i-1 | i=i-1 |
| return string | return string |
| def path_to_link_store(path): | def path_to_link_store(URL,path): |
| """generates navigation bar for viewfiles""" | """generates navigation bar for viewfiles""" |
| string="" | string="" |
| Line 552 def path_to_link_store(path): | Line 666 def path_to_link_store(path): |
| tmppath=os.path.dirname(tmppath) | tmppath=os.path.dirname(tmppath) |
| while i>=0: | while i>=0: |
| string=string+"<a href=storefiles?path="+pathes[i][0]+">"+pathes[i][1]+"</a>/" | string=string+"<a href="+URL+"?path="+pathes[i][0]+">"+pathes[i][1]+"</a>/" |
| i=i-1 | i=i-1 |
| return string | return string |
| Line 986 def date(self): | Line 1100 def date(self): |
| def EditIndex(self,path): | |
| try: | |
| dom=xml.dom.minidom.parse(path+"/index.meta") | |
| indexmeta=dom.toxml() | |
| except: | |
| indexmeta="" | |
| self.REQUEST.SESSION['indexmeta']=indexmeta | |
| self.REQUEST.SESSION['path']=path | |
| newtemplate=PageTemplateFile('/usr/local/mpiwg/Zope/Extensions/editindex').__of__(self) | |
| return newtemplate() | |
| def EditIndex2(self): | |
| if not self.REQUEST.has_key('fileupload'): | |
| #newtext=urllib.unquote(self.REQUEST['indexmeta']) | |
| newtext=self.REQUEST['indexmeta'] | |
| print newtext | |
| else: | |
| self.file_name=self.REQUEST['fileupload'].filename | |
| #newtext=self.REQUEST.form['fileupload'].read() | |
| # HACK DW | |
| newtext=self.REQUEST['indexmeta'] | |
| indexmeta=file(self.REQUEST.SESSION['path']+"/index.meta","w") | |
| indexmeta.writelines(newtext) | |
| return self.REQUEST.response.redirect("storage/storefiles?path="+self.REQUEST.SESSION['path']) | |