--- zogiLib/zogiLib.py 2005/11/08 18:10:10 1.60 +++ zogiLib/zogiLib.py 2005/11/08 18:28:19 1.61 @@ -25,27 +25,6 @@ def cropf(f): return float(int(f * 10000)/10000.0) -def sendFile(self, filename, type): - """sends an object or a local file (from the product) as response""" - paths = filename.split('/') - object = self - # look for an object called filename - for path in paths: - if hasattr(object, path): - object = getattr(object, path) - else: - object = None - break - if object: - # if the object exists then send it - return object.index_html(self.REQUEST.REQUEST, self.REQUEST.RESPONSE) - else: - # send a local file with the given content-type - fn = os.path.join(package_home(globals()), filename) - self.REQUEST.RESPONSE.setHeader("Content-Type", type) - self.REQUEST.RESPONSE.write(file(fn).read()) - return - def browserCheck(self): """check the browsers request to find out the browser type""" bt = {} @@ -184,13 +163,13 @@ class zogiLib(Folder): main_book = PageTemplateFile('zpt/main_book', globals()) main_image = PageTemplateFile('zpt/main_image', globals()) main_metaData = PageTemplateFile('zpt/main_metadata', globals()) - main_static = PageTemplateFile('zpt/main_static', globals()) + #main_static = PageTemplateFile('zpt/main_static', globals()) options = PageTemplateFile('zpt/options', globals()) changeForm = PageTemplateFile('zpt/changeForm', globals()) # display templates - aux_divs = PageTemplateFile('zpt/aux_divs', globals()) - aux_divsN4 = PageTemplateFile('zpt/aux_divsN4', globals()) + aux_divs = PageTemplateFile('zpt/aux_divs', globals()) + #aux_divsN4 = PageTemplateFile('zpt/aux_divsN4', globals()) img_div = PageTemplateFile('zpt/img_div', globals()) # javascripts @@ -202,7 +181,7 @@ class zogiLib(Folder): arr_right = ImageFile('images/right.gif', globals()) arr_left = ImageFile('images/left.gif', globals()) arr_up = ImageFile('images/up.gif', globals()) - arr_down = ImageFile('images/down.gif', globals()) + arr_down = ImageFile('images/down.gif', globals()) mark1 = ImageFile('images/mark1.gif', globals()) mark2 = ImageFile('images/mark2.gif', globals()) mark3 = ImageFile('images/mark3.gif', globals()) @@ -343,7 +322,7 @@ class zogiLib(Folder): """get DLInfo from digilib server""" paramH={} baseUrl=self.getDLBaseUrl()+"/dlInfo-xml.jsp" - print "getdlinfo: ", baseUrl + #print "getdlinfo: ", baseUrl try: url=urllib.urlopen(baseUrl+'?'+self.getAllDLParams()) dom=xml.dom.minidom.parse(url) @@ -365,7 +344,7 @@ class zogiLib(Folder): url += otherbase else: url += self.basePath - # should end with "/" + # should still end with "/" if len(url) > 0 and url[-1] != '/': url += '/' return url @@ -468,10 +447,9 @@ class zogiLib(Folder): if not hasattr(self, 'template'): # create template folder if it doesn't exist - print "no template folder" + print "no template folder -- creating" self.manage_addFolder('template') - print "template!" pt = getattr(self.template, 'main_'+tpt) return pt() @@ -587,22 +565,23 @@ class zogiLib(Folder): """returns dlTarget""" self.checkQuery() s = self.dlTarget - if s == None: - s = "" -# s = 'dl' -# if self.getDLParam('fn'): -# s += "_" + self.getDLParam('fn') -# if self.getDLParam('pn'): -# s += "_" + self.getDLParam('pn') + if (s is None) or (s == ""): +# s = "" + s = 'dl' + if self.getDLParam('fn'): + s += "_" + self.getDLParam('fn') + if self.getDLParam('pn'): + s += "_" + self.getDLParam('pn') + return s def getPN(self): - """pagenums""" + """pagenumber""" pn = int(self.getDLParam('pn', 1)) return pn def getPT(self): - """pagenums""" + """number of total pages""" pt = self.getDLParam('pt', None) if pt is None: # get pt from dlInfo