version 1.33, 2004/07/19 17:54:02
|
version 1.36, 2004/07/22 17:30:21
|
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, dlServerURL,localFileBase, version="book", basePath="", dlTarget=None): |
"""init""" |
"""init""" |
|
|
self.id=id |
self.id=id |
self.title=title |
self.title=title |
self.digilibBaseUrl=digilibBaseUrl |
self.dlServerURL = dlServerURL |
|
|
self.localFileBase=localFileBase |
self.localFileBase=localFileBase |
self.basePath=basePath |
self.basePath=basePath |
Line 520 class zogiLib(Folder):
|
Line 520 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 529 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 563 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.dlServerURL+'/servlet/Scaler?'+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 623 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""" |
self.checkQuery() |
self.checkQuery() |
|
if self.REQUEST.has_key('frametarget'): |
|
self.dlTarget = self.REQUEST['frametarget'] |
|
print "current dltarget: ", self.dlTarget |
bt = self.REQUEST.SESSION['browserType'] |
bt = self.REQUEST.SESSION['browserType'] |
if bt['staticHTML']: |
if bt['staticHTML']: |
pt=PageTemplateFile(os.path.join(package_home(globals()), 'zpt/optionwindow_static.zpt')).__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()), 'zpt/optionwindow_static.zpt')).__of__(self) |
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,dlServerURL, localFileBase, version, basePath, dlTarget, RESPONSE=None): |
"""change it""" |
"""change it""" |
self.title=title |
self.title=title |
self.digilibBaseUrl=digilibBaseUrl |
self.dlServerURL=dlServerURL |
self.localFileBase=localFileBase |
self.localFileBase=localFileBase |
self.basePath = basePath |
self.basePath = basePath |
self.layout=version |
self.layout=version |
Line 1106 class zogiLib(Folder):
|
Line 1110 class zogiLib(Folder):
|
RESPONSE.redirect('manage_main') |
RESPONSE.redirect('manage_main') |
|
|
|
|
|
|
|
## |
|
## odd stuff |
|
## |
|
|
|
def repairZogilib(self, obj=None): |
|
"""change stuff that broke on upgrading""" |
|
|
|
msg = "" |
|
|
|
if not obj: |
|
obj = self.getPhysicalRoot() |
|
|
|
print "starting in ", obj |
|
|
|
entries=obj.ZopeFind(obj,obj_metatypes=['zogiLib'],search_sub=1) |
|
|
|
for entry in entries: |
|
print " found ", entry |
|
if hasattr(entry[1], 'digilibBaseUrl'): |
|
msg += " fixing "+entry[0]+"\n" |
|
entry[1].dlServerURL = re.sub('/servlet/Scaler\?','',entry[1].digilibBaseUrl) |
|
del entry[1].digilibBaseUrl |
|
|
|
return msg+"\n\nfixed all zogilib instances in: "+obj.title |
|
|
|
|
def manage_addZogiLibForm(self): |
def manage_addZogiLibForm(self): |
"""interface for adding zogilib""" |
"""interface for adding zogilib""" |
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,dlServerURL, 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,dlServerURL, 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') |
Line 1155 def manage_addZogiLibPageTemplate(self,
|
Line 1186 def manage_addZogiLibPageTemplate(self,
|
u = "%s/%s" % (u, urllib.quote(id)) |
u = "%s/%s" % (u, urllib.quote(id)) |
REQUEST.RESPONSE.redirect(u+'/manage_main') |
REQUEST.RESPONSE.redirect(u+'/manage_main') |
return '' |
return '' |
|
|