version 1.16, 2004/03/25 09:57:47
|
version 1.26, 2004/07/23 17:51:53
|
Line 4
|
Line 4
|
""" |
""" |
|
|
import addFolder |
import addFolder |
|
import OSAS_helpers |
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 60 class OSAS_ShowOnline(SimpleItem):
|
Line 61 class OSAS_ShowOnline(SimpleItem):
|
self.tree(path).toggle(path,file) |
self.tree(path).toggle(path,file) |
return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1']+"?path="+path) |
return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1']+"?path="+path) |
|
|
|
|
InitializeClass(OSAS_ShowOnline) |
InitializeClass(OSAS_ShowOnline) |
|
|
def manage_AddOSAS_ShowOnlineForm(self): |
def manage_AddOSAS_ShowOnlineForm(self): |
Line 104 class OSAS_StoreOnline(SimpleItem):
|
Line 106 class OSAS_StoreOnline(SimpleItem):
|
def rescaleThumbs(self,path): |
def rescaleThumbs(self,path): |
"""rescale thumbs of images in 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'])) |
dlpath = re.sub('/mpiwg/online/','',self.REQUEST['path']) |
|
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 --replace >> /tmp/sc.out &"% re.sub('/mpiwg/online/','',self.REQUEST['path'])) |
|
|
self.REQUEST.SESSION['path']=self.REQUEST['path'] |
self.REQUEST.SESSION['path']=self.REQUEST['path'] |
#return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1']) |
#return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1']) |
Line 157 class OSAS_StoreOnline(SimpleItem):
|
Line 161 class OSAS_StoreOnline(SimpleItem):
|
"""Test ob Eintrag ein Folder ist""" |
"""Test ob Eintrag ein Folder ist""" |
return isFullText(path,folder_name) |
return isFullText(path,folder_name) |
|
|
|
def isPdf(self,path,folder_name): |
|
"""Test ob Eintrag ein Folder mit pdf2 ist""" |
|
return isPdf(path,folder_name) |
|
|
|
|
|
def isPresentation(self,path,folder_name): |
|
"""Test ob Eintrag ein Folder ist""" |
|
return isPresentation(path,folder_name) |
|
|
def date(self): |
def date(self): |
return strftime("%d.%m.%Y",localtime()) |
return strftime("%d.%m.%Y",localtime()) |
|
|
Line 165 class OSAS_StoreOnline(SimpleItem):
|
Line 178 class OSAS_StoreOnline(SimpleItem):
|
pt=PageTemplateFile('Products/OSA_system/zpt/OSAS_addFolder.zpt').__of__(self) |
pt=PageTemplateFile('Products/OSA_system/zpt/OSAS_addFolder.zpt').__of__(self) |
return pt() |
return pt() |
|
|
|
def showHelp(self,refType,genericTag): |
|
"""helptext""" |
|
for reference in self.ZopeFind(self.standardMD): |
|
if reference[1].title==refType: |
|
text=getattr(reference[1],'md_'+genericTag)[2] |
|
return text |
|
return "NO EXPLANATION" |
|
|
|
def showHelpTag(self,url,reftype,item): |
|
"""gen javascript for showhelp""" |
|
url2=url+'/showHelp?refType=%s&genericTag=%s'%(reftype,item) |
|
ret="""javascript:wd=window.open(\'%s\',\'Help\',\'width=300,height=250\');void(\'\');wd.focus();"""%url2 |
|
return ret |
|
|
def addFolder(self,path,folder_name,description,archive_creation_date,creator): |
def addFolder(self,path,folder_name,description,archive_creation_date,creator): |
"""add the folder to the filesystem and write the metadata files""" |
"""add the folder to the filesystem and write the metadata files""" |
Line 204 class OSAS_StoreOnline(SimpleItem):
|
Line 230 class OSAS_StoreOnline(SimpleItem):
|
pt=PageTemplateFile('Products/OSA_system/zpt/OSAS_addmetadata.zpt').__of__(self) |
pt=PageTemplateFile('Products/OSA_system/zpt/OSAS_addmetadata.zpt').__of__(self) |
return pt() |
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 getViewerTemplateSets(self,obj_ids=None): |
|
"""Get the ViewerTemplateSet title for configuration""" |
|
ret=[] |
|
|
|
try: |
|
viewerTemplateSets=self.ZopeFind(self.viewerTemplateSets,obj_metatypes=['OSAS_viewerTemplateSet'],obj_ids=obj_ids)#assumes viewerTemplateSets folder somewhere in the hierarchie. |
|
|
|
for viewerTemplateSet in viewerTemplateSets: |
|
ret.append((viewerTemplateSet[1].title,viewerTemplateSet[0],viewerTemplateSet[1])) |
|
|
|
return ret |
|
|
|
except: |
|
return [('no ViewerTemplateSetfolders','')] |
|
|
|
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) |
InitializeClass(OSAS_StoreOnline) |
|
|
def manage_AddOSAS_StoreOnlineForm(self): |
def manage_AddOSAS_StoreOnlineForm(self): |
Line 956 def hasMetafile(path):
|
Line 1029 def hasMetafile(path):
|
return os.path.exists(path+"/index.meta") |
return os.path.exists(path+"/index.meta") |
#return path |
#return path |
|
|
|
|
|
|
def isdigilib2(path): |
def isdigilib2(path): |
"""check if folder is candidate for digilib without metadata""" |
"""check if folder is candidate for digilib without metadata""" |
try: |
try: |
Line 1005 def isFullText(path,folder_name):
|
Line 1080 def isFullText(path,folder_name):
|
|
|
return 0 |
return 0 |
|
|
|
def isPdf(path,folder_name): |
|
"""check if foldername in path is full text""" |
|
try: |
|
dom=xml.dom.minidom.parse(path+"/index.meta") |
|
for node in dom.getElementsByTagName("dir"): |
|
|
|
if getText(node.getElementsByTagName("content-type")[0].childNodes).lower()=="pdf": |
|
|
|
if getText(node.getElementsByTagName("name")[0].childNodes)==folder_name: |
|
return 1 |
|
return 0 |
|
except: |
|
|
|
return 0 |
|
|
def isPresentation(path,folder_name): |
def isPresentation(path,folder_name): |
"""check if foldername in path is full text""" |
"""check if foldername in path is full text""" |
Line 1165 def isScannedDocument(self,path):
|
Line 1254 def isScannedDocument(self,path):
|
try: |
try: |
dom = xml.dom.minidom.parseString(lines) |
dom = xml.dom.minidom.parseString(lines) |
content_type=getText(dom.getElementsByTagName("content-type")[0].childNodes) |
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 |
return 1 |
else: |
else: |
return 0 |
return 0 |