--- zogiLib/zogiLib.py 2006/07/25 18:18:36 1.66 +++ zogiLib/zogiLib.py 2011/02/14 16:33:43 1.73 @@ -18,7 +18,7 @@ import string import urllib import xml.dom.minidom -ZOGIVERSION = "0.10.3b ROC 13.7.2006" +ZOGIVERSION = "0.10.4b ROC 13.11.2006" def cropf(f): """returns a float with reduced precision""" @@ -69,7 +69,7 @@ class zogiImage(SimpleItem): if baseUrl: self.baseUrl=baseUrl else: - self.baseUrl="http://nausikaa.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler?" + self.baseUrl="http://digilib.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler?" self.queryString=queryString self.content_type=content_type @@ -183,25 +183,26 @@ class zogiLib(Folder): self.manage_addFolder('template') -# form templates + # form templates main_book = PageTemplateFile('zpt/main_book', globals()) main_image = PageTemplateFile('zpt/main_image', globals()) main_metaData = PageTemplateFile('zpt/main_metadata', globals()) + main_embed = PageTemplateFile('zpt/main_embed', globals()) #main_static = PageTemplateFile('zpt/main_static', globals()) options = PageTemplateFile('zpt/options', globals()) - changeForm = PageTemplateFile('zpt/changeForm', globals()) + #changeForm = PageTemplateFile('zpt/changeForm', globals()) -# display templates + # display templates aux_divs = PageTemplateFile('zpt/aux_divs', globals()) #aux_divsN4 = PageTemplateFile('zpt/aux_divsN4', globals()) img_div = PageTemplateFile('zpt/img_div', globals()) -# javascripts + # javascripts head_js = PageTemplateFile('zpt/head_js', globals()) jslib_js = PageTemplateFile('js/baselib.js', globals()) dllib_js = PageTemplateFile('js/dllib.js', globals()) -# graphic files + # graphic files arr_right = ImageFile('images/right.gif', globals()) arr_left = ImageFile('images/left.gif', globals()) arr_up = ImageFile('images/up.gif', globals()) @@ -358,7 +359,7 @@ class zogiLib(Folder): return {} - def zogilibPath(self, otherbase=None): + def zogilibPathOLD(self, otherbase=None): """returns an URL to the zogiLib instance""" url = self.REQUEST['URL1'] # should end with "/" @@ -373,6 +374,20 @@ class zogiLib(Folder): url += '/' return url + def zogilibPath(self, otherbase=None): + """returns an URL to the zogiLib instance""" + url = self.absolute_url() + # should end with "/" + if len(url) > 0 and url[-1] != '/': + url += '/' + if type(otherbase) is str: + url += otherbase + else: + url += self.basePath + # should still end with "/" + if len(url) > 0 and url[-1] != '/': + url += '/' + return url def zogilibAction(self, action, otherbase=None): """returns a URL with zogilib path and action""" url = self.zogilibPath(otherbase) @@ -396,6 +411,8 @@ class zogiLib(Folder): def getScalerUrl(self,requestString=""): """send scaler url""" + if requestString is None: + requestString = "" if self.dlServerURL[-1] == '?': # full Servlet URL return self.dlServerURL + requestString @@ -421,8 +438,6 @@ class zogiLib(Folder): if self.REQUEST.SESSION.has_key('scalerDiv'): (requestString, bottom, side, width, height) = self.REQUEST.SESSION['scalerDiv'] # if not explicitly defined take normal request - if not requestString: - requestString = self.getAllDLParams() url = self.getScalerUrl(requestString=requestString) # take insets from options if present if options is not None: @@ -446,7 +461,13 @@ class zogiLib(Folder): tag += '' if bt['isN4']: tag += '' @@ -464,7 +485,7 @@ class zogiLib(Folder): # make shure to remove unused parameter del self.REQUEST.SESSION['scalerDiv'] - pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/zogilib_img_div')).__of__(self) + pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/img_div')).__of__(self) return pt() def index_html(self): @@ -901,7 +922,7 @@ def manage_addZogiLibPageTemplate(self, id = 'main_%s'%layout self._setObject(id, zogiLibPageTemplate(id)) ob = getattr(self, id) - ob.pt_edit(open(os.path.join(package_home(globals()),'zpt/main_%s.zpt'%layout)).read(),None) + ob.pt_edit(open(os.path.join(package_home(globals()),'zpt/main_%s.zpt'%layout)).read(),'text/html') if title: ob.pt_setTitle(title) try: