version 1.18, 2004/06/02 17:32:54
|
version 1.21, 2004/06/02 21:53:15
|
Line 427 class zogiLib(Folder):
|
Line 427 class zogiLib(Folder):
|
{'label':'Main Config','action':'changeZogiLibForm'}, |
{'label':'Main Config','action':'changeZogiLibForm'}, |
) |
) |
|
|
def __init__(self, id,title,digilibBaseUrl, localFileBase,version="book"): |
def __init__(self, id, title, digilibBaseUrl, localFileBase, version="book", basePath=""): |
"""init""" |
"""init""" |
|
|
self.id=id |
self.id=id |
self.title=title |
self.title=title |
self.digilibBaseUrl=digilibBaseUrl |
self.digilibBaseUrl=digilibBaseUrl |
self.localFileBase=localFileBase |
self.localFileBase=localFileBase |
|
self.basePath=basePath |
self.layout=version |
self.layout=version |
|
|
|
|
Line 453 class zogiLib(Folder):
|
Line 454 class zogiLib(Folder):
|
|
|
|
|
def createHeadJS(self): |
def createHeadJS(self): |
"""generate javascript tags for head""" |
"""generate all javascript tags for head""" |
pt=PageTemplateFile(os.path.join(package_home(globals()), 'zpt/zogilib_head_js')).__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()), 'zpt/zogilib_head_js')).__of__(self) |
return pt() |
return pt() |
|
|
def createScalerImg(self, requestString = None): |
def createParamJS(self): |
|
"""generate javascript for parameters only""" |
|
pt=PageTemplateFile(os.path.join(package_home(globals()), 'zpt/zogilib_param_js')).__of__(self) |
|
return pt() |
|
|
|
|
|
def createScalerImg(self, requestString = None, bottom = 0, side = 0): |
"""generate Scaler IMG Tag""" |
"""generate Scaler IMG Tag""" |
|
self.checkQuery() |
bt = self.REQUEST.SESSION['browserType'] |
bt = self.REQUEST.SESSION['browserType'] |
if not requestString: |
if not requestString: |
requestString = self.REQUEST.QUERY_STRING |
requestString = self.getAllDLParams() |
url = self.digilibBaseUrl+requestString |
url = self.digilibBaseUrl+requestString |
tag = "" |
tag = "" |
if bt.isN4: |
if bt.isN4: |
Line 470 class zogiLib(Folder):
|
Line 478 class zogiLib(Folder):
|
tag += '<div id="scaler">' |
tag += '<div id="scaler">' |
tag += '<script type="text/javascript">' |
tag += '<script type="text/javascript">' |
tag += "var ps = bestPicSize(getElement('scaler'));" |
tag += "var ps = bestPicSize(getElement('scaler'));" |
tag += 'document.write(\'<img id="pic" src="%s&dw=\'+ps.width+\'&dh=\'+ps.height+\'" />\')'%url |
b_par = "" |
|
s_par = "" |
|
if (bottom != 0) or (side != 0): |
|
b_par = "-" + str(int(bottom)) |
|
s_par = "-" + str(int(side)) |
|
tag += 'document.write(\'<img id="pic" src="%s&dw=\'+(ps.width%s)+\'&dh=\'+(ps.height%s)+\'" />\')'%(url, s_par, b_par) |
tag += '</script>' |
tag += '</script>' |
if bt.isN4: |
if bt.isN4: |
tag += '</ilayer>' |
tag += '</ilayer>' |
Line 480 class zogiLib(Folder):
|
Line 493 class zogiLib(Folder):
|
|
|
def createAuxDiv(self): |
def createAuxDiv(self): |
"""generate other divs""" |
"""generate other divs""" |
|
self.checkQuery() |
bt = self.REQUEST.SESSION['browserType'] |
bt = self.REQUEST.SESSION['browserType'] |
if bt.isN4: |
if bt.isN4: |
f = 'zpt/zogilib_divsN4.zpt' |
f = 'zpt/zogilib_divsN4.zpt' |
Line 569 class zogiLib(Folder):
|
Line 583 class zogiLib(Folder):
|
|
|
|
|
|
|
def storeQuery(self): |
def storeQuery(self, more = None): |
"""storeQuery in session""" |
"""storeQuery in session""" |
dlParams = {} |
dlParams = {} |
for fm in self.REQUEST.form.keys(): |
for fm in self.REQUEST.form.keys(): |
dlParams[fm] = self.REQUEST.form[fm] |
dlParams[fm] = self.REQUEST.form[fm] |
|
# look for more |
|
if more: |
|
for fm in more.split('&'): |
|
try: |
|
pv = fm.split('=') |
|
dlParams[pv[0]] = pv[1] |
|
except: |
|
print "ouch!" |
|
# parse digilib mode parameter |
if 'mo' in dlParams: |
if 'mo' in dlParams: |
if len(dlParams['mo']) > 0: |
if len(dlParams['mo']) > 0: |
modes=dlParams['mo'].split(',') |
modes=dlParams['mo'].split(',') |
Line 586 class zogiLib(Folder):
|
Line 608 class zogiLib(Folder):
|
self.REQUEST.SESSION['dlInfo'] = self.getDLInfo() |
self.REQUEST.SESSION['dlInfo'] = self.getDLInfo() |
self.REQUEST.SESSION['browserType'] = BrowserCheck(self) |
self.REQUEST.SESSION['browserType'] = BrowserCheck(self) |
|
|
|
def checkQuery(self): |
|
"""check if the query has been stored""" |
|
if not (self.REQUEST.SESSION): |
|
print "ZOGILIB: have to store query!!" |
|
storeQuery(self) |
|
|
def getDLParam(self,param): |
def getDLParam(self,param): |
"""returns parameter""" |
"""returns parameter""" |
Line 626 class zogiLib(Folder):
|
Line 653 class zogiLib(Folder):
|
self.setDLParam('cont', cont) |
self.setDLParam('cont', cont) |
|
|
if pn: |
if pn: |
|
# unmark |
|
self.setDLParam('mk', None) |
self.setDLParam('pn', pn) |
self.setDLParam('pn', pn) |
|
|
if ws: |
if ws: |
Line 640 class zogiLib(Folder):
|
Line 669 class zogiLib(Folder):
|
def display(self): |
def display(self): |
"""(re)display page""" |
"""(re)display page""" |
params = self.getAllDLParams() |
params = self.getAllDLParams() |
|
if self.basePath: |
|
self.REQUEST.RESPONSE.redirect(self.REQUEST['URL2']+'?'+params) |
|
else: |
self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1']+'?'+params) |
self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1']+'?'+params) |
|
|
def getPT(self): |
def getPT(self): |
Line 775 class zogiLib(Folder):
|
Line 807 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, RESPONSE=None): |
def changeZogiLib(self,title,digilibBaseUrl, localFileBase, version, basePath, 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.layout=version |
self.layout=version |
|
|
if RESPONSE is not None: |
if RESPONSE is not None: |
Line 791 def manage_addZogiLibForm(self):
|
Line 824 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",RESPONSE=None): |
def manage_addZogiLib(self,id,title,digilibBaseUrl, localFileBase,version="book",basePath="",RESPONSE=None): |
"""add dgilib""" |
"""add dgilib""" |
newObj=zogiLib(id,title,digilibBaseUrl, localFileBase, version) |
newObj=zogiLib(id,title,digilibBaseUrl, localFileBase, version, basePath) |
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') |