version 1.60, 2005/06/05 10:10:44
|
version 1.64, 2005/10/07 10:51:38
|
Line 4 from Globals import Persistent,package_h
|
Line 4 from Globals import Persistent,package_h
|
from Acquisition import Implicit |
from Acquisition import Implicit |
from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
from Products.PageTemplates.PageTemplate import PageTemplate |
from Products.PageTemplates.PageTemplate import PageTemplate |
|
from xmlrpclib import ServerProxy |
import re |
import re |
import os |
import os |
import os.path |
import os.path |
Line 16 from types import *
|
Line 17 from types import *
|
import time |
import time |
from threading import Thread |
from threading import Thread |
import Queue |
import Queue |
|
import cgi |
|
|
|
from AccessControl import ClassSecurityInfo |
|
|
try: |
try: |
from Products.ZSQLExtend.ZSQLExtend import ZSQLExtendFolder |
from Products.ZSQLExtend.ZSQLExtend import ZSQLExtendFolder |
except: |
except: |
print "ZSQL Extend Folder nicht importiert" |
print "ZSQL Extend Folder nicht importiert" |
print "Metadatendfolder funktioniert nicht!!!" |
print "Metadatendfolder funktioniert nicht!!!" |
|
|
|
|
|
|
try: |
try: |
from Products.ECHO_content.ECHO_collection import ECHO_basis |
from Products.ECHO_content.ECHO_collection import ECHO_basis |
except: |
except: |
Line 102 class generateSet:
|
Line 109 class generateSet:
|
|
|
self.response+=str("<p>Get File: %s<br>\n"%filename) |
self.response+=str("<p>Get File: %s<br>\n"%filename) |
|
|
|
|
if self.local: |
if self.local: |
|
|
if self.version=="working": |
if self.version=="working": |
Line 129 class generateSet:
|
Line 137 class generateSet:
|
fh.close() |
fh.close() |
|
|
#folgeseiten |
#folgeseiten |
|
|
if int(self.filenamesIds[id[0]][1])>1: |
if int(self.filenamesIds[id[0]][1])>1: |
#ids=self.show_thumbs() |
#ids=self.show_thumbs() |
|
|
Line 243 class metaData(SimpleItem):
|
Line 252 class metaData(SimpleItem):
|
return ret+"</body></html>" |
return ret+"</body></html>" |
|
|
|
|
|
|
|
|
class ImageDigilib(Folder,Persistent,Implicit): |
class ImageDigilib(Folder,Persistent,Implicit): |
"""Anzeige object fuer digilib""" |
"""Anzeige object fuer digilib""" |
meta_type="ImageDigilib" |
meta_type="ImageDigilib" |
|
security=ClassSecurityInfo() |
leiden_meta_fields=['image_id','date','country','place','people','description','photographer'] |
leiden_meta_fields=['image_id','date','country','place','people','description','photographer'] |
|
|
manage_options = Folder.manage_options+( |
manage_options = Folder.manage_options+( |
Line 361 class ImageDigilib(Folder,Persistent,Imp
|
Line 372 class ImageDigilib(Folder,Persistent,Imp
|
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','upDateImageForm.zpt')).__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','upDateImageForm.zpt')).__of__(self) |
return pt() |
return pt() |
|
|
|
|
|
security.declareProtected('View management screens','renameImageForm') |
def renameImageForm(self): |
def renameImageForm(self): |
"""form""" |
"""form""" |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','renameImageForm.zpt')).__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','renameImageForm.zpt')).__of__(self) |
return pt() |
return pt() |
|
|
|
security.declareProtected('View management screens','renameImage') |
def renameImage(self,newname,RESPONSE=None): |
def renameImage(self,newname,RESPONSE=None): |
"""umbenennen""" |
"""umbenennen""" |
#umbennen des files im folder |
#umbennen des files im folder |
Line 503 class ImageDigilib(Folder,Persistent,Imp
|
Line 517 class ImageDigilib(Folder,Persistent,Imp
|
def index_html(self): |
def index_html(self): |
"""show image""" |
"""show image""" |
#DEVELOP: take first one for server |
#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] |
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) |
return self.REQUEST.RESPONSE.redirect(path) |
|
|
Line 529 def manage_AddImageDigilib(self,id,fileu
|
Line 543 def manage_AddImageDigilib(self,id,fileu
|
|
|
|
|
class ImageCollection(Folder, Persistent, Implicit,ECHO_basis): |
class ImageCollection(Folder, Persistent, Implicit,ECHO_basis): |
|
"""Sammelordner fuer Bilder""" |
"""Sammelordner für Bilder""" |
|
meta_type="ImageCollection" |
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=" |
security=ClassSecurityInfo() |
|
|
|
#scalerPath="http://127.0.0.1:18080/digitallibrary/servlet/Scaler/?fn=" |
|
scalerPath="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?fn=" |
|
|
zipThreads={} |
zipThreads={} |
zipThreads2={} |
zipThreads2={} |
Line 546 class ImageCollection(Folder, Persistent
|
Line 562 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 |
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): |
def refreshTxt(self): |
"""txt fuer refresh""" |
"""txt fuer refresh""" |
Line 1285 class ImageCollection(Folder, Persistent
|
Line 1312 class ImageCollection(Folder, Persistent
|
return (cols,rows) |
return (cols,rows) |
|
|
|
|
def show_thumbs_rows(self,numberOfColumns,numberOfRows=None,startId=None): |
def show_thumbs_rows(self,numberOfColumns,numberOfRows=None,startId=None,showall="No"): |
"""Ausgabe anzahl""" |
"""Ausgabe anzahl""" |
|
|
idsAll=self.show_thumbs() |
idsAll=self.show_thumbs() |
if len(idsAll)==0: #keine Einträge |
if len(idsAll)==0: #keine Einträge |
return 0 |
return 0 |
if self.REQUEST.SESSION.has_key("filename"): |
if self.REQUEST.SESSION.has_key("filename") and not (showall=="yes"): |
filename=self.REQUEST.SESSION["filename"] |
filename=self.REQUEST.SESSION["filename"] |
filename=self.getImageByName(filename,onlyName="yes") |
filename=self.getImageByName(filename,onlyName="yes") |
|
|
Line 1404 class ImageCollection(Folder, Persistent
|
Line 1431 class ImageCollection(Folder, Persistent
|
return filename |
return filename |
else: |
else: |
return fn |
return fn |
|
|
|
|
|
security.declareProtected('View','index_html') |
def index_html(self,fn=None): |
def index_html(self,fn=None): |
"""main template collection""" |
"""main template collection""" |
|
|
Line 1463 def manage_AddImageCollection(self,id,ti
|
Line 1493 def manage_AddImageCollection(self,id,ti
|
class ImageCollectionMD(ImageCollection,ZSQLExtendFolder): |
class ImageCollectionMD(ImageCollection,ZSQLExtendFolder): |
"""Imageviewer and Metadata""" |
"""Imageviewer and Metadata""" |
meta_type="ImageCollection MD" |
meta_type="ImageCollection MD" |
scalerPath="http://127.0.0.1:18080/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=" |
scalerPath="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?fn=" |
manage_options=ImageCollection.manage_options+( |
manage_options=ImageCollection.manage_options+( |
{'label':'ZSQLExtend','action':'changeZSQLExtendForm'}, |
{'label':'ZSQLExtend','action':'changeZSQLExtendForm'}, |
) |
) |
|
|
|
try: |
changeZSQLExtendForm=ZSQLExtendFolder.changeZSQLExtendForm |
changeZSQLExtendForm=ZSQLExtendFolder.changeZSQLExtendForm |
|
except: |
|
pass |
|
|
def setGenericSearchStringForm(self): |
def setGenericSearchStringForm(self): |
"""form setze generischen search string fuer MD""" |
"""form setze generischen search string fuer MD""" |
Line 1558 def manage_AddImageCollectionIFrame(self
|
Line 1591 def manage_AddImageCollectionIFrame(self
|
RESPONSE.redirect('manage_main') |
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""" |
|
|