--- OSAS/OSA_system/OSAS_show.py 2004/04/08 16:50:01 1.18 +++ OSAS/OSA_system/OSAS_show.py 2004/04/17 15:09:09 1.22 @@ -4,6 +4,7 @@ """ import addFolder +import OSAS_helpers from OFS.Folder import Folder from OFS.SimpleItem import SimpleItem from Products.PageTemplates.PageTemplateFile import PageTemplateFile @@ -60,6 +61,7 @@ class OSAS_ShowOnline(SimpleItem): self.tree(path).toggle(path,file) return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1']+"?path="+path) + InitializeClass(OSAS_ShowOnline) def manage_AddOSAS_ShowOnlineForm(self): @@ -104,7 +106,7 @@ class OSAS_StoreOnline(SimpleItem): def rescaleThumbs(self,path): """rescale thumbs of images in path""" - os.popen("ssh nausikaa2.rz-berlin.mpg.de /usr/local/mpiwg/scripts/scaleomat.pl %s /mpiwg/temp/online/scaled/thumb 90 --replace >> /tmp/sc.out &"% re.sub('/mpiwg/online/','',self.REQUEST['path'])) + os.popen("ssh archive@nausikaa2.rz-berlin.mpg.de /usr/local/mpiwg/scripts/scaleomat.pl %s /mpiwg/temp/online/scaled/thumb 90 --replace >> /tmp/sc.out &"% re.sub('/mpiwg/online/','',self.REQUEST['path'])) self.REQUEST.SESSION['path']=self.REQUEST['path'] #return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1']) @@ -221,6 +223,53 @@ class OSAS_StoreOnline(SimpleItem): pt=PageTemplateFile('Products/OSA_system/zpt/OSAS_addmetadata.zpt').__of__(self) return pt() + def getTextToolsField(self,path,name,default=''): + """Lese Textoolsfelder aus index.meta im path aus""" + + try: + dom=xml.dom.minidom.parse(path+"/index.meta") + node=dom.getElementsByTagName('texttool')[0] #getNode + subnode=node.getElementsByTagName(name)[0] + + # bei text wird nur der Folder gebraucht + if name=="text": + splitted=getText(subnode.childNodes).split("/") + return splitted[len(splitted)-2] + else: + return getText(subnode.childNodes) + except: + return default + + def getProjects(self,obj_ids=None): + """Get the Project title for configuration""" + ret=[] + + try: + projects=self.ZopeFind(self.projects,obj_metatypes=['OSAS_project'],obj_ids=obj_ids)#assumes projects folder somewhere in the hierarchie. + + for project in projects: + ret.append((project[1].title,project[0],project[1])) + + return ret + + except: + return [('no Projectfolders','')] + + def changeTemplatesForm(self,path): + """changeform""" + path=self.REQUEST.SESSION['path']=path + pt=PageTemplateFile('Products/OSA_system/zpt/changeTemplatesForm.zpt').__of__(self) + return pt() + + + + def changeTemplates(self,path,RESPONSE=None): + """Andere alle Eintraege in index.meta""" + os.path.walk(path,OSAS_helpers.changeIndexMeta,self.REQUEST.form) + if RESPONSE is not None: + RESPONSE.redirect(self.REQUEST['URL1']+"?path="+self.REQUEST.SESSION['path']) + + InitializeClass(OSAS_StoreOnline) def manage_AddOSAS_StoreOnlineForm(self): @@ -1184,7 +1233,7 @@ def isScannedDocument(self,path): try: dom = xml.dom.minidom.parseString(lines) content_type=getText(dom.getElementsByTagName("content-type")[0].childNodes) - if (content_type=="scanned-document") or (content_type=="scanned document"): + if (content_type=="scanned-document") or (content_type=="scanned document") or (content_type=="fulltext document"): return 1 else: return 0