--- ImageArchive/ImageArchive.py 2005/06/05 10:10:44 1.60 +++ ImageArchive/ImageArchive.py 2005/07/04 11:01:02 1.61 @@ -4,6 +4,7 @@ from Globals import Persistent,package_h from Acquisition import Implicit from Products.PageTemplates.PageTemplateFile import PageTemplateFile from Products.PageTemplates.PageTemplate import PageTemplate +from xmlrpclib import ServerProxy import re import os import os.path @@ -16,6 +17,8 @@ from types import * import time from threading import Thread import Queue +import cgi + try: from Products.ZSQLExtend.ZSQLExtend import ZSQLExtendFolder except: @@ -242,7 +245,9 @@ class metaData(SimpleItem): ret+="

%s=%s

"%(tag,getattr(self,tag)) return ret+"" - + + + class ImageDigilib(Folder,Persistent,Implicit): """Anzeige object fuer digilib""" meta_type="ImageDigilib" @@ -503,7 +508,7 @@ class ImageDigilib(Folder,Persistent,Imp def index_html(self): """show image""" #DEVELOP: take first one for server - + #path="http://127.0.0.1:8080/zogilib_images?lv=2&fn="+self.ImageViewerPath+"/"+os.path.splitext(self.filename)[0] path="http://content.mpiwg-berlin.mpg.de/zogilib_images?lv=2&fn="+self.ImageViewerPath+"/"+os.path.splitext(self.filename)[0] return self.REQUEST.RESPONSE.redirect(path) @@ -533,8 +538,8 @@ class ImageCollection(Folder, Persistent """Sammelordner für Bilder""" meta_type="ImageCollection" - scalerPath="http://127.0.0.1:18080/digitallibrary/servlet/Scaler/?fn=" - #scalerPath="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?fn=" + #scalerPath="http://127.0.0.1:18080/digitallibrary/servlet/Scaler/?fn=" + scalerPath="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?fn=" zipThreads={} zipThreads2={} @@ -546,7 +551,18 @@ class ImageCollection(Folder, Persistent defaultMetaString="http://fm-web.mpiwg-berlin.mpg.de:8050/FMRes/FMPJS?-db=Wissenschaftlerportraits.fp5&-layID=69&-token=25&-max=1&-format=formvwcss.htm&-mode=browse&images::filename=%s&-find" ## TEST FUER IMAGEDATENBANK WP - + def getScalerPath(self): + """get ScalerPath""" + return self.scalerPath + + def getImageViewerPath(self): + """get ImageViewerPath""" + return self.ImageViewerPath + + def getImageStoragePath(self): + """get ImageStoragePath""" + return self.ImageStoragePath + def refreshTxt(self): """txt fuer refresh""" tn=self.REQUEST.SESSION['threadName'] @@ -1463,8 +1479,8 @@ def manage_AddImageCollection(self,id,ti class ImageCollectionMD(ImageCollection,ZSQLExtendFolder): """Imageviewer and Metadata""" meta_type="ImageCollection MD" - scalerPath="http://127.0.0.1:18080/digitallibrary/servlet/Scaler/?fn=" - #scalerPath="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?fn=" + #scalerPath="http://127.0.0.1:18080/digitallibrary/servlet/Scaler/?fn=" + scalerPath="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?fn=" manage_options=ImageCollection.manage_options+( {'label':'ZSQLExtend','action':'changeZSQLExtendForm'}, ) @@ -1558,3 +1574,85 @@ def manage_AddImageCollectionIFrame(self RESPONSE.redirect('manage_main') +class ImageZogiLib(ImageDigilib): + """Anzeige Object fuer Bilder ausserhalb von collections + ImageViewerPath und ImageStoragePath und wenn vorhanden Pfad zur Collection + werden zusaetzlich abgespeichert + """ + + meta_type="ImageZogiLib" + + manage_options=ImageDigilib.manage_options+( + {'label':'Main Config','action':'changeImageZogiLibForm'}, + ) + + def __init__(self,id,fn,ImageViewerPath,ImageStoragePath,scalerPath,ImageCollectionPath=None,REQUEST=None): + ImageDigilib.__init__(self,id,fn) + self.ImageViewerPath=ImageViewerPath + self.ImageStoragePath=ImageStoragePath + self.ImageCollectionPath=ImageCollectionPath + self.scalerPath=scalerPath + + def changeImageZogiLibForm(self): + """change zogilib Form""" + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','changeImageZogiLib.zpt')).__of__(self) + return pt() + + + def changeImageZogilib(fn,ImageViewerPath,ImageStoragePath,scalerPath,ImageCollectionPath,REQUEST=None): + """Change it""" + self.ImageViewerPath=ImageViewerPath + self.ImageStoragePath=ImageStoragePath + self.ImageCollectionPath=ImageColectionPath + self.scalerPath=scalerPath + +def manage_AddImageZogiLib(self,id=None,ImageViewerPath=None,ImageStoragePath=None,fileUpload=None,ImageCollectionPath=None,scalerPath=None,libPath=None,caption=None,RESPONSE=None): + """hinzufuegen eineis zogilibImage""" + + if libPath: + splitted=libPath.split("?") + urlSplit=splitted[0].split("/") + params=cgi.parse_qs(splitted[1]) + #is LibPath a digilib path? + if urlSplit[-1]=="Scaler": + if type(params['fn']) is ListType: + fnParam=params['fn'][0] + else: + fnParam=params['fn'] + fileNameSplit=os.path.split(fnParam) + ImageViewerPath=fileNameSplit[0] + id=fileNameSplit[1] + scalerPath=splitted[0]+"?fn=" + else: #assume if not the path is a path to an ImageCollection + if type(params['filename']) is ListType: + id=params['filename'][0] + else: + id=params['filename'] + + server=ServerProxy(splitted[0]) + ImageCollectionPath=libPath + ImageViewerPath=server.getImageViewerPath() + ImageStoragePath=server.getImageStoragePath() + scalerPath=server.getScalerPath() + + + + if fileUpload: + fn=splitPath(fileUpload.filename) + else: + fn=id + + newObj=ImageZogiLib(id,fn,ImageViewerPath,ImageStoragePath,scalerPath,ImageCollectionPath) + + self._setObject(id,newObj) + getattr(self,id).caption=caption[0:] + if fileUpload: + getattr(self,id).uploadImage(fileupload,self.ImageStoragePath) + + if RESPONSE is not None: + RESPONSE.redirect('manage_main') + + +def manage_AddImageZogiLibForm(self): + """to be done""" +