version 1.59, 2005/05/03 16:31:36
|
version 1.68, 2005/10/25 18:57:59
|
Line 1
|
Line 1
|
|
|
|
genericServerPath="http://content.mpiwg-berlin.mpg.de/zogilib_images" |
|
#genericServerPath="http://127.0.0.1:8080/zogilib_images" |
|
|
|
|
from OFS.Folder import Folder |
from OFS.Folder import Folder |
from OFS.SimpleItem import SimpleItem |
from OFS.SimpleItem import SimpleItem |
from Globals import Persistent,package_home |
from Globals import Persistent,package_home |
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 22 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, getSecurityManager |
|
|
|
try: |
|
from Products.ZSQLExtend.ZSQLExtend import ZSQLExtendFolder |
|
except: |
|
print "ZSQL Extend Folder nicht importiert" |
|
print "Metadatendfolder funktioniert nicht!!!" |
|
|
|
|
|
|
try: |
try: |
from Products.ECHO_content.ECHO_collection import ECHO_basis |
from Products.ECHO_content.ECHO_collection import ECHO_basis |
Line 97 class generateSet:
|
Line 114 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 111 class generateSet:
|
Line 129 class generateSet:
|
self.response+=(str("<p>Error in File: %s (possible missing)<br>\n"%filename)) |
self.response+=(str("<p>Error in File: %s (possible missing)<br>\n"%filename)) |
else: |
else: |
if self.version=="working": |
if self.version=="working": |
path="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?fn="+self.ImageViewerPath+"/"+os.path.splitext(urllib.quote(id[0]))[0]+"&dh=2000&dw=2000" |
requestString=self.ImageViewerPath+"/"+os.path.splitext(urllib.quote(id[0]))[0]+"&dh=2000&dw=2000" |
|
path=getattr(self,'serverPath',genericServerPath)+"/scaledImage?fn="+requestString |
|
|
else: |
else: |
path="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?fn="+self.ImageViewerPath+"/"+os.path.splitext(urllib.quote(id[0]))[0]+"&mo=rawfile,hires" |
requestString=self.ImageViewerPath+"/"+os.path.splitext(urllib.quote(id[0]))[0]+"&mo=rawfile,hires" |
|
path=getattr(self,'serverPath',genericServerPath)+"/scaledImage?fn="+requestString |
|
|
|
|
image=urllib.urlopen(path).read() |
image=urllib.urlopen(path).read() |
|
|
|
|
Line 124 class generateSet:
|
Line 147 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 155 class generateSet:
|
Line 179 class generateSet:
|
self.response+=str("<p>Error in File: %s (missing?)<br>\n"%filename) |
self.response+=str("<p>Error in File: %s (missing?)<br>\n"%filename) |
|
|
else: |
else: |
path="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?fn="+self.ImageViewerPath+"/"+os.path.splitext(ids[nr+i])[0]+"&mo=rawfile,hires" |
|
|
requestString=self.ImageViewerPath+"/"+os.path.splitext(ids[nr+i])[0]+"&mo=rawfile,hires" |
|
path=getattr(self,'serverPath',genericServerPath)+"/scaledImage?fn="+requestString |
|
|
image=urllib.urlopen(path).read() |
image=urllib.urlopen(path).read() |
|
|
Line 238 class metaData(SimpleItem):
|
Line 264 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 250 class ImageDigilib(Folder,Persistent,Imp
|
Line 278 class ImageDigilib(Folder,Persistent,Imp
|
|
|
) |
) |
|
|
|
def getAccessRight(self): |
|
"""get the accessright, return is string "extern" or "intern" """ |
|
return self.getRights(self.filename.split('.')[0]) |
|
|
|
|
|
def isAccessible(self): |
|
"""gives true if obejct is accessible taking the rights of the user into account""" |
|
|
|
#TODO: implement rights, currently true if external and false if internal, and true if user has role authenticated |
|
|
|
username=self.REQUEST['AUTHENTICATED_USER'] |
|
#print username |
|
#print self.acl_users.getUserNames() |
|
user=getSecurityManager().getUser() |
|
|
|
roles=user.getRoles() |
|
if 'Authenticated' in roles: |
|
return True |
|
|
|
if self.getAccessRight()=="extern": |
|
return True |
|
else: |
|
return False |
|
|
def addMetaObject(self,id,RESPONSE=None): |
def addMetaObject(self,id,RESPONSE=None): |
"""Add an MetaObject""" |
"""Add an MetaObject""" |
objectType=getattr(self.Control_Panel.Products.ImageMetaData,self.genericMetaDataType) |
objectType=getattr(self.Control_Panel.Products.ImageMetaData,self.genericMetaDataType) |
Line 279 class ImageDigilib(Folder,Persistent,Imp
|
Line 331 class ImageDigilib(Folder,Persistent,Imp
|
self.filename=filename |
self.filename=filename |
self.meta=meta |
self.meta=meta |
|
|
|
|
def getMeta(self): |
def getMeta(self): |
"""ausgabe der metadaten""" |
"""ausgabe der metadaten""" |
return self.meta |
return self.meta |
Line 332 class ImageDigilib(Folder,Persistent,Imp
|
Line 385 class ImageDigilib(Folder,Persistent,Imp
|
|
|
def download(self,fmt="&mo=rawfile,hires",suffix=None): |
def download(self,fmt="&mo=rawfile,hires",suffix=None): |
"""download""" |
"""download""" |
path="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?fn="+self.ImageViewerPath+"/"+os.path.splitext(self.filename)[0]+fmt |
|
|
requestString=self.ImageViewerPath+"/"+os.path.splitext(self.filename)[0]+fmt |
|
path=getattr(self,'serverPath',genericServerPath)+"/scaledImage?fn="+requestString |
|
|
|
|
if self.REQUEST.SESSION.has_key('filenamesIds') and self.REQUEST.SESSION['filenamesIds'].has_key(self.filename): |
if self.REQUEST.SESSION.has_key('filenamesIds') and self.REQUEST.SESSION['filenamesIds'].has_key(self.filename): |
filename=self.REQUEST.SESSION['filenamesIds'][self.filename][0]+"_"+self.filename |
filename=self.REQUEST.SESSION['filenamesIds'][self.filename][0]+"_"+self.filename |
Line 356 class ImageDigilib(Folder,Persistent,Imp
|
Line 412 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 463 class ImageDigilib(Folder,Persistent,Imp
|
Line 522 class ImageDigilib(Folder,Persistent,Imp
|
def thumb(self,url=None): |
def thumb(self,url=None): |
"""show thumb""" |
"""show thumb""" |
thumbname=os.path.splitext(self.filename)[0]+".jpg" |
thumbname=os.path.splitext(self.filename)[0]+".jpg" |
## if not os.path.exists("/mpiwg/temp/online/scaled/small/"+self.ImageViewerPath+"/"+thumbname): |
requestString=self.ImageViewerPath+"/"+os.path.splitext(self.filename)[0]+"&dw=100&dh=100&mo=lores" |
## image=urllib.urlopen("http://nausikaa2.rz-berlin.mpg.de:18080/digitallibrary/servlet/Scaler/?fn="+self.ImageViewerPath+"/"+self.filename+"&dw=150&mo=lores").read() |
path=getattr(self,'serverPath',genericServerPath)+"/scaledImage?fn="+requestString |
## f=open("/mpiwg/temp/online/scaled/small/"+self.ImageViewerPath+"/"+thumbname,"w") |
|
## f.write(image) |
|
## f.close() |
|
## os.popen("ssh nausikaa2.rz-berlin.mpg.de /usr/local/mpiwg/scripts/scaleomat.pl %s /mpiwg/temp/online/scaled/small 150 &"% self.ImageViewerPath) |
|
|
|
#DEVEL:take nausikaa for server solution |
|
|
|
path="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?fn="+self.ImageViewerPath+"/"+os.path.splitext(self.filename)[0]+"&dw=100&dh=100&mo=lores" |
|
#path="/mpiwg/online/"+self.ImageViewerPath+"/"+thumbname |
|
self.REQUEST.SESSION['string']="<img border=\"0\" src=\"%s\">"% path |
self.REQUEST.SESSION['string']="<img border=\"0\" src=\"%s\">"% path |
if url: |
if url: |
return "<img border=\"0\" src=\"%s\">"% path |
return "<img border=\"0\" src=\"%s\">"% path |
Line 481 class ImageDigilib(Folder,Persistent,Imp
|
Line 533 class ImageDigilib(Folder,Persistent,Imp
|
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','thumb.zpt')).__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','thumb.zpt')).__of__(self) |
return pt() |
return pt() |
|
|
|
|
|
def thumbMD(self,url=None): |
|
"""show thumb mit Metadaten erwarten image in ImageCollectionMD |
|
""" |
|
thumbname=os.path.splitext(self.filename)[0]+".jpg" |
|
|
|
requestString=self.ImageViewerPath+"/"+os.path.splitext(self.filename)[0]+"&dw=100&dh=100&mo=lores" |
|
path=getattr(self,'serverPath',genericServerPath)+"/scaledImage?fn="+requestString |
|
|
|
|
|
|
|
self.REQUEST.SESSION['string']="<img border=\"0\" src=\"%s\">"% path |
|
if url: |
|
return "<img border=\"0\" src=\"%s\">"% path |
|
else: |
|
|
|
overview=self.ZopeFind(self.aq_parent,obj_ids=['thumb.html']) |
|
if overview: |
|
return getattr(self,overview[0][0])() |
|
else: |
|
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','thumbMD.zpt')).__of__(self) |
|
return pt() |
|
|
|
|
|
def image(self,dw=None,dh=None): |
|
"""show image only with scaler""" |
|
str=[] |
|
if (not dw) and (not dh): |
|
str.append("mo=file") |
|
if dw: |
|
str.append("dw=%s"%dw) |
|
|
|
if dh: |
|
str.append("dw=%s"%dh) |
|
|
|
str.append("lv=2&fn=%s"%self.ImageViewerPath+"/"+os.path.splitext(self.filename)[0]) |
|
|
|
|
|
requestString="&".join(str) |
|
|
|
self.REQUEST.RESPONSE.redirect(getattr(self,'serverPath',genericServerPath)+"/scaledImage?"+requestString) |
|
|
def index_html(self): |
def index_html(self): |
"""show image""" |
"""show image with zogilib""" |
#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=getattr(self,'serverPath',genericServerPath)+"?lv=2&fn="+self.ImageViewerPath+"/"+os.path.splitext(self.filename)[0] |
return self.REQUEST.RESPONSE.redirect(path) |
return self.REQUEST.RESPONSE.redirect(path) |
|
|
|
|
Line 510 def manage_AddImageDigilib(self,id,fileu
|
Line 604 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" |
|
|
|
|
|
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 525 class ImageCollection(Folder, Persistent
|
Line 623 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""" |
|
path=getattr(self,'serverPath',genericServerPath)+"/scaledImage?fn=" |
|
|
|
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 636 class ImageCollection(Folder, Persistent
|
Line 745 class ImageCollection(Folder, Persistent
|
|
|
|
|
|
|
def __init__(self,id,title,ImageStoragePath,ImageViewerPath,defaultMetaString): |
def __init__(self,id,title,ImageStoragePath,ImageViewerPath,defaultMetaString,serverPath=genericServerPath): |
self.id=id |
self.id=id |
self.title=title |
self.title=title |
self.ImageStoragePath=ImageStoragePath |
self.ImageStoragePath=ImageStoragePath |
self.ImageViewerPath=ImageViewerPath |
self.ImageViewerPath=ImageViewerPath |
self.defaultMetaString=defaultMetaString |
self.defaultMetaString=defaultMetaString |
|
self.serverPath=serverPath |
|
|
optTMP= Folder.manage_options |
optTMP= Folder.manage_options |
|
|
Line 774 class ImageCollection(Folder, Persistent
|
Line 884 class ImageCollection(Folder, Persistent
|
|
|
|
|
def xmlinput(self,url): |
def xmlinput(self,url): |
"""Anzeige von ausgewaehlten thumbs""" |
"""Anzeige <n ausgewaehlten thumbs""" |
#return url |
#return url |
|
|
url=urllib.unquote(url) |
url=urllib.unquote(url) |
Line 836 class ImageCollection(Folder, Persistent
|
Line 946 class ImageCollection(Folder, Persistent
|
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','addImage.zpt')).__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','addImage.zpt')).__of__(self) |
return pt() |
return pt() |
|
|
def addImage2(self,fileupload,meta,use_default=None,RESPONSE=None): |
def addImage2(self,fileupload,fileName=None,meta=None,use_default=None,RESPONSE=None): |
"""Add""" |
"""Add""" |
|
|
#print "FU",fileupload |
#print "FU",fileupload |
Line 848 class ImageCollection(Folder, Persistent
|
Line 958 class ImageCollection(Folder, Persistent
|
meta=None |
meta=None |
else: |
else: |
meta=None |
meta=None |
|
|
|
if fileName: |
|
fn=fileName |
|
else: |
fn=splitPath(fileupload.filename) |
fn=splitPath(fileupload.filename) |
|
|
manage_AddImageDigilib(self,fn,fileupload,meta=meta) |
manage_AddImageDigilib(self,fn,fileupload,meta=meta) |
|
|
|
if RESPONSE: |
return RESPONSE.redirect(self.REQUEST['URL1']+'/'+fn) |
return RESPONSE.redirect(self.REQUEST['URL1']+'/'+fn) |
#return self.REQUEST['URL1']+'/'+fileupload.filename |
#return self.REQUEST['URL1']+'/'+fileupload.filename |
|
|
Line 886 class ImageCollection(Folder, Persistent
|
Line 1002 class ImageCollection(Folder, Persistent
|
|
|
RESPONSE.redirect('manage_main') |
RESPONSE.redirect('manage_main') |
|
|
def importStructure(self,path): |
## def importStructure(self,path): |
"""import""" |
## """import""" |
splitted=os.path.split(path) |
## splitted=os.path.split(path) |
if os.path.isDir(path) and (len(splitted[1])>0) and (splitted[1][0]=="."): |
## if os.path.isDir(path) and (len(splitted[1])>0) and (splitted[1][0]=="."): |
manage_AddImageCollection(self,splitted[1],splitted[1],path,self.ImageViewerPath,self.defaultMetaString,RESPONSE=None) |
## manage_AddImageCollection(self,splitted[1],splitted[1],path,self.ImageViewerPath,self.defaultMetaString,RESPONSE=None) |
|
|
obj=getattr(self,splitted[1]) |
## obj=getattr(self,splitted[1]) |
obj.ImportFiles() |
## obj.ImportFiles() |
|
|
def ImportStructure(self,RESPONSE=None): |
def ImportStructure(self,RESPONSE=None): |
"""Import the existing files of a folder""" |
"""Import the existing files of a folder""" |
Line 1264 class ImageCollection(Folder, Persistent
|
Line 1380 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 1383 class ImageCollection(Folder, Persistent
|
Line 1499 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""" |
print |
|
if fn: |
if fn: |
ret=[] |
ret=[] |
|
|
Line 1417 class ImageCollection(Folder, Persistent
|
Line 1536 class ImageCollection(Folder, Persistent
|
self.REQUEST.SESSION['showall']=self.REQUEST.SESSION.get('showall','no') |
self.REQUEST.SESSION['showall']=self.REQUEST.SESSION.get('showall','no') |
|
|
|
|
|
overview=self.ZopeFind(self,obj_ids=['overview.html']) |
|
if overview: |
|
return overview[0][1]() |
|
else: |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','overview.zpt')).__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','overview.zpt')).__of__(self) |
return pt() |
return pt() |
|
|
Line 1434 def manage_AddImageCollection(self,id,ti
|
Line 1557 def manage_AddImageCollection(self,id,ti
|
RESPONSE.redirect('manage_main') |
RESPONSE.redirect('manage_main') |
|
|
|
|
|
|
|
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=" |
|
rightsQueryDefault="SELECT accessibility from vision_main where id_image=(SELECT id from vision_images where filename ~ '%s*' )" |
|
rightsQueryFieldDefault="accessibility" |
|
|
|
manage_options=ImageCollection.manage_options+( |
|
{'label':'ZSQLExtend','action':'changeZSQLExtendForm'}, |
|
{'label':'Change Rights Query','action':'changeRightsQueryForm'}, |
|
) |
|
|
|
try: |
|
changeZSQLExtendForm=ZSQLExtendFolder.changeZSQLExtendForm |
|
except: |
|
pass |
|
|
|
def changeRightsQueryForm(self): |
|
"""change Rights Query""" |
|
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','ChangeRightsQueryForm.zpt')).__of__(self) |
|
return pt() |
|
|
|
def changeRightsQuery(self,rightsQuery,rightsQueryField,RESPONSE=None): |
|
"""change Rightsquery""" |
|
|
|
self.rightsQuery=rightsQuery |
|
self.rightsQueryField=rightsQueryField |
|
|
|
if RESPONSE is not None: |
|
RESPONSE.redirect('manage_main') |
|
|
|
|
|
|
|
def getRightsQuery(self): |
|
"""get Query""" |
|
return getattr(self,'rightsQuery',self.rightsQueryDefault) |
|
|
|
def getRightsQueryField(self): |
|
"""get Query Fiueld""" |
|
return getattr(self,'rightsQueryField',self.rightsQueryFieldDefault) |
|
|
|
|
|
|
|
def setGenericSearchStringForm(self): |
|
"""form setze generischen search string fuer MD""" |
|
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','setGenericSearchStringForm.zpt')).__of__(self) |
|
return pt() |
|
|
|
def setGenericSearchString(self,searchString): |
|
"""setze generischen search string""" |
|
self.searchString=searchString |
|
|
|
def thumblistMD(self): |
|
"""main template collection""" |
|
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','thumbListMD.zpt')).__of__(self) |
|
return pt() |
|
|
|
def getRights(self,id): |
|
"""get the rights from a database""" |
|
#print self.rightsQuery%id |
|
results=self.ZSQLSimpleSearch(self.getRightsQuery()%id) |
|
if results: |
|
result = getattr(results[0],self.getRightsQueryField()) |
|
else: |
|
result = '' |
|
return result |
|
|
|
|
|
def manage_AddImageCollectionMDForm(self): |
|
"""Nothing yet""" |
|
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','AddImageCollectionFormMD.zpt')).__of__(self) |
|
return pt() |
|
|
|
def manage_AddImageCollectionMD(self,id,title,ImageStoragePath,ImageViewerPath,defaultMetaString,RESPONSE=None): |
|
"""Add ImageCollection""" |
|
newObj=ImageCollectionMD(id,title,ImageStoragePath,ImageViewerPath,defaultMetaString) |
|
self._setObject(id,newObj) |
|
|
|
if RESPONSE is not None: |
|
RESPONSE.redirect('manage_main') |
|
|
|
|
|
|
|
|
class ImageCollectionIFrame(ImageCollection): |
class ImageCollectionIFrame(ImageCollection): |
"""Class fuer Collection set als IFrame""" |
"""Class fuer Collection set als IFrame""" |
|
|
Line 1490 def manage_AddImageCollectionIFrame(self
|
Line 1699 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 |
|
""" |
|
#TODO: scaler path notwendig? |
|
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""" |
|
|