version 1.33, 2004/07/19 17:54:02
|
version 1.34, 2004/07/21 17:44:51
|
Line 14 import urllib
|
Line 14 import urllib
|
import types |
import types |
from Globals import package_home |
from Globals import package_home |
|
|
ZOGIVERSION = "0.9.5 ROC:25.6.2004" |
ZOGIVERSION = "0.9.7 ROC:21.7.2004" |
|
|
def cropf(f): |
def cropf(f): |
"""returns a float with reduced precision""" |
"""returns a float with reduced precision""" |
Line 388 class zogiLib(Folder):
|
Line 388 class zogiLib(Folder):
|
{'label':'Main Config','action':'changeZogiLibForm'}, |
{'label':'Main Config','action':'changeZogiLibForm'}, |
) |
) |
|
|
def __init__(self, id, title, digilibBaseUrl,localFileBase, version="book", basePath="", dlTarget=None): |
def __init__(self, id, title, digilibBaseURL,localFileBase, version="book", basePath="", dlTarget=None, dlServerURL=None): |
"""init""" |
"""init""" |
|
|
self.id=id |
self.id=id |
self.title=title |
self.title=title |
self.digilibBaseUrl=digilibBaseUrl |
self.digilibBaseURL=digilibBaseURL |
|
self.dlServerURL = dlServerURL |
|
if digilibBaseURL and not dlServerURL: |
|
self.dlServerURL = re.sub("/servlet/Scaler\?","",self.digilibBaseURL) |
|
|
self.localFileBase=localFileBase |
self.localFileBase=localFileBase |
self.basePath=basePath |
self.basePath=basePath |
Line 520 class zogiLib(Folder):
|
Line 523 class zogiLib(Folder):
|
def getDLInfo(self): |
def getDLInfo(self): |
"""get DLInfo from digilib server""" |
"""get DLInfo from digilib server""" |
paramH={} |
paramH={} |
baseUrl=re.sub("servlet/Scaler","dlInfo-xml.jsp",self.digilibBaseUrl) |
baseUrl=self.dlServerURL+"/dlInfo-xml.jsp" |
try: |
try: |
url=urllib.urlopen(baseUrl+self.REQUEST['QUERY_STRING']) |
url=urllib.urlopen(baseUrl+self.REQUEST['QUERY_STRING']) |
dom=xml.dom.minidom.parse(url) |
dom=xml.dom.minidom.parse(url) |
Line 529 class zogiLib(Folder):
|
Line 532 class zogiLib(Folder):
|
paramH[param.getAttribute('name')]=param.getAttribute('value') |
paramH[param.getAttribute('name')]=param.getAttribute('value') |
return paramH |
return paramH |
except: |
except: |
return null |
return {} |
|
|
|
|
def createHeadJS(self): |
def createHeadJS(self): |
Line 563 class zogiLib(Folder):
|
Line 566 class zogiLib(Folder):
|
# if not explicitly defined take normal request |
# if not explicitly defined take normal request |
if not requestString: |
if not requestString: |
requestString = self.getAllDLParams() |
requestString = self.getAllDLParams() |
url = self.digilibBaseUrl+requestString |
url = self.digilibBaseURL+requestString |
# construct bottom and side insets |
# construct bottom and side insets |
b_par = "" |
b_par = "" |
s_par = "" |
s_par = "" |
Line 623 class zogiLib(Folder):
|
Line 626 class zogiLib(Folder):
|
|
|
def dl_lib_js(self): |
def dl_lib_js(self): |
"""javascript""" |
"""javascript""" |
return sendFile(self, 'js/dl_lib.js', 'text/plain') |
return sendFile(self, 'js/dllib.js', 'text/plain') |
|
|
def js_lib_js(self): |
def js_lib_js(self): |
"""javascript""" |
"""javascript""" |
return sendFile(self, 'js/js_lib.js', 'text/plain') |
return sendFile(self, 'js/baselib.js', 'text/plain') |
|
|
def optionwindow(self): |
def optionwindow(self): |
"""showoptions""" |
"""showoptions""" |
Line 836 class zogiLib(Folder):
|
Line 839 class zogiLib(Folder):
|
self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1']+'?'+params) |
self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1']+'?'+params) |
|
|
def getMetaFileName(self): |
def getMetaFileName(self): |
urlbase=re.sub('/servlet/Scaler','/dlContext-xml.jsp',self.digilibBaseUrl) |
url=self.dlServerURL+'/dlContext-xml.jsp?'+self.getAllDLParams() |
|
return urlbase |
|
|
return urlbase+self.getAllDLParams() |
|
|
|
|
|
|
def getToolbarPageURL(self): |
|
"""returns a toolbar-enabled page URL""" |
|
url=self.dlServerURL+'/digimage.jsp?'+self.getAllDLParams() |
|
return url |
|
|
def getDLTarget(self): |
def getDLTarget(self): |
"""returns dlTarget""" |
"""returns dlTarget""" |
Line 1090 class zogiLib(Folder):
|
Line 1094 class zogiLib(Folder):
|
pt=PageTemplateFile(os.path.join(package_home(globals()), 'zpt/changeZogiLibForm.zpt')).__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()), 'zpt/changeZogiLibForm.zpt')).__of__(self) |
return pt() |
return pt() |
|
|
def changeZogiLib(self,title,digilibBaseUrl, localFileBase, version, basePath, dlTarget, RESPONSE=None): |
def changeZogiLib(self,title,digilibBaseURL, localFileBase, version, basePath, dlTarget, RESPONSE=None): |
"""change it""" |
"""change it""" |
self.title=title |
self.title=title |
self.digilibBaseUrl=digilibBaseUrl |
self.digilibBaseURL=digilibBaseURL |
self.localFileBase=localFileBase |
self.localFileBase=localFileBase |
self.basePath = basePath |
self.basePath = basePath |
self.layout=version |
self.layout=version |
Line 1111 def manage_addZogiLibForm(self):
|
Line 1115 def manage_addZogiLibForm(self):
|
pt=PageTemplateFile(os.path.join(package_home(globals()), 'zpt/addZogiLibForm')).__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()), 'zpt/addZogiLibForm')).__of__(self) |
return pt() |
return pt() |
|
|
def manage_addZogiLib(self,id,title,digilibBaseUrl, localFileBase,version="book",basePath="",dlTarget="digilib",RESPONSE=None): |
def manage_addZogiLib(self,id,title,digilibBaseURL, localFileBase,version="book",basePath="",dlTarget="digilib",RESPONSE=None): |
"""add dgilib""" |
"""add dgilib""" |
newObj=zogiLib(id,title,digilibBaseUrl, localFileBase, version, basePath, dlTarget) |
newObj=zogiLib(id,title,digilibBaseURL, localFileBase, version, basePath, dlTarget) |
self.Destination()._setObject(id,newObj) |
self.Destination()._setObject(id,newObj) |
if RESPONSE is not None: |
if RESPONSE is not None: |
RESPONSE.redirect('manage_main') |
RESPONSE.redirect('manage_main') |