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