comparison documentViewer.py @ 387:580db757e0eb

*** empty log message ***
author abukhman
date Fri, 29 Oct 2010 14:53:45 +0200
parents 48d27e100d19
children 114d40b358ab
comparison
equal deleted inserted replaced
386:48d27e100d19 387:580db757e0eb
49 Ft.Xml.Domlette.Print(node, stream=buf, encoding=encoding) 49 Ft.Xml.Domlette.Print(node, stream=buf, encoding=encoding)
50 s = buf.getvalue() 50 s = buf.getvalue()
51 buf.close() 51 buf.close()
52 return s 52 return s
53 53
54 def getBrowserType(self): 54 def browserCheck(self):
55 """get browser type object""" 55 """check the browsers request to find out the browser type"""
56 if self.REQUEST.SESSION.has_key('browserType'): 56 bt = {}
57 return self.REQUEST.SESSION['browserType'] 57 ua = self.REQUEST.get_header("HTTP_USER_AGENT")
58 else: 58 bt['ua'] = ua
59 bt = browserCheck(self) 59 bt['isIE'] = False
60 self.REQUEST.SESSION.set('browserType', bt) 60 bt['isN4'] = False
61 logging.debug("documentViewer (BROWSER TYPE) bt %s"%bt) 61 if string.find(ua, 'MSIE') > -1:
62 return bt 62 bt['isIE'] = True
63 else:
64 bt['isN4'] = (string.find(ua, 'Mozilla/4.') > -1)
65
66 try:
67 nav = ua[string.find(ua, '('):]
68 ie = string.split(nav, "; ")[1]
69 if string.find(ie, "MSIE") > -1:
70 bt['versIE'] = string.split(ie, " ")[1]
71 except: pass
72
73 bt['isMac'] = string.find(ua, 'Macintosh') > -1
74 bt['isWin'] = string.find(ua, 'Windows') > -1
75 bt['isIEWin'] = bt['isIE'] and bt['isWin']
76 bt['isIEMac'] = bt['isIE'] and bt['isMac']
77 bt['staticHTML'] = False
78
79 return bt
63 80
64 81
65 def getParentDir(path): 82 def getParentDir(path):
66 """returns pathname shortened by one""" 83 """returns pathname shortened by one"""
67 return '/'.join(path.split('/')[0:-1]) 84 return '/'.join(path.split('/')[0:-1])
307 mk=[mk] 324 mk=[mk]
308 for m in mk: 325 for m in mk:
309 ret+="mk=%s"%m 326 ret+="mk=%s"%m
310 return ret 327 return ret
311 328
312 329 def getBrowser(self):
330 """getBrowser the version of browser """
331 bt = browserCheck(self)
332 logging.debug("XXXXXXXXXXXXXXXX: %s"%bt)
333 return bt
334
313 def findDigilibUrl(self): 335 def findDigilibUrl(self):
314 """try to get the digilib URL from zogilib""" 336 """try to get the digilib URL from zogilib"""
315 url = self.template.zogilib.getDLBaseUrl() 337 url = self.template.zogilib.getDLBaseUrl()
316 return url 338 return url
317 339