--- ECHO_content/ECHO_collection.py 2004/05/13 21:28:47 1.86 +++ ECHO_content/ECHO_collection.py 2004/05/18 22:30:09 1.87 @@ -124,9 +124,25 @@ def sendFile(self, filename, type): self.REQUEST.RESPONSE.write(file(fn).read()) return +class BrowserCheck: + """check the browsers request to find out the browser type""" + + def __init__(self, zope): + self.ua = zope.REQUEST.get_header("HTTP_USER_AGENT") + self.isN4 = (string.find(self.ua, 'Mozilla/4.') > -1) and (string.find(self.ua, 'MSIE') < 0) + self.isIE = string.find(self.ua, 'MSIE') > -1 + self.nav = self.ua[string.find(self.ua, '('):] + ie = string.split(self.nav, "; ")[1] + if string.find(ie, "MSIE") > -1: + self.versIE = string.split(ie, " ")[1] + self.isMac = string.find(self.ua, 'Macintosh') > -1 + self.isWin = string.find(self.ua, 'Windows') > -1 + self.isIEWin = self.isIE and self.isWin + self.isIEMac = self.isIE and self.isMac + def writeMetadata(url,metadict): - """Einlesen der Metadaten und und erstellen des geänderten XML file""" + """Einlesen der Metadaten und und erstellen des geaenderten XML file""" try: geturl="" @@ -1042,17 +1058,34 @@ class ECHO_collection(Folder, Persistent """generate divs""" pt=PageTemplateFile(os.path.join(package_home(globals()), 'zpt/ECHO_content_map_frag_js')).__of__(self) return pt() + + def createMapImg(self): + """generate img-tag for map""" + bt = BrowserCheck(self) + tag = "" + src = self.REQUEST['URL1'] + "/overview" + if bt.isN4: + tag += ''%src + else: + tag += ''%src + return tag def createMapLink(self, ob, text=None): """generate map link""" + bt = BrowserCheck(self) id = ob[1] link = ob[1] if text == None: text = ob[2] - tag = '" + tag = "" + if bt.isN4: + tag += '" + else: + tag = '" return tag def createMapAux(self, ob, arrowsrc="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?dw=15&fn=icons/pfeil"): @@ -1061,18 +1094,39 @@ class ECHO_collection(Folder, Persistent link = ob[1] vtype = ob[5] ctype = ob[3].contentType - - tag = ''%(id,id,id,link) - if vtype == "view point": - rot = ob[4][4] - tag += ''%(id,arrowsrc,rot) + bt = BrowserCheck(self) + tag = "" + + if bt.isN4: + tag += ''%(id,id,id) + if vtype == "view point": + rot = ob[4][4] + tag += ''%(link,arrowsrc,rot) + else: + tag += ''%(id,id,id,link) + if vtype == "view point": + rot = ob[4][4] + if bt.isIEWin and bt.versIE > 5: + tag += ''%(id,arrowsrc,rot,arrowsrc,rot) + else: + tag += ''%(id,arrowsrc,rot) + else: + if bt.isIEWin: + tag += '