Changeset 585:83eeed69793f in documentViewer for documentViewer.py
- Timestamp:
- Nov 13, 2012, 4:33:34 PM (11 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
documentViewer.py
r584 r585 41 41 return node 42 42 43 def browserCheck(self):44 """check the browsers request to find out the browser type"""45 bt = {}46 ua = self.REQUEST.get_header("HTTP_USER_AGENT")47 bt['ua'] = ua48 bt['isIE'] = False49 bt['isN4'] = False50 bt['versFirefox']=""51 bt['versIE']=""52 bt['versSafariChrome']=""53 bt['versOpera']=""54 55 if string.find(ua, 'MSIE') > -1:56 bt['isIE'] = True57 else:58 bt['isN4'] = (string.find(ua, 'Mozilla/4.') > -1)59 # Safari oder Chrome identification60 try:61 nav = ua[string.find(ua, '('):]62 nav1=ua[string.find(ua,')'):]63 nav2=nav1[string.find(nav1,'('):]64 nav3=nav2[string.find(nav2,')'):]65 ie = string.split(nav, "; ")[1]66 ie1 =string.split(nav1, " ")[2]67 ie2 =string.split(nav3, " ")[1]68 ie3 =string.split(nav3, " ")[2]69 if string.find(ie3, "Safari") >-1:70 bt['versSafariChrome']=string.split(ie2, "/")[1]71 except: pass72 # IE identification73 try:74 nav = ua[string.find(ua, '('):]75 ie = string.split(nav, "; ")[1]76 if string.find(ie, "MSIE") > -1:77 bt['versIE'] = string.split(ie, " ")[1]78 except:pass79 # Firefox identification80 try:81 nav = ua[string.find(ua, '('):]82 nav1=ua[string.find(ua,')'):]83 if string.find(ie1, "Firefox") >-1:84 nav5= string.split(ie1, "/")[1]85 logging.debug("FIREFOX: %s"%(nav5))86 bt['versFirefox']=nav5[0:3]87 except:pass88 #Opera identification89 try:90 if string.find(ua,"Opera") >-1:91 nav = ua[string.find(ua, '('):]92 nav1=nav[string.find(nav,')'):]93 bt['versOpera']=string.split(nav1,"/")[2]94 except:pass95 96 bt['isMac'] = string.find(ua, 'Macintosh') > -197 bt['isWin'] = string.find(ua, 'Windows') > -198 bt['isIEWin'] = bt['isIE'] and bt['isWin']99 bt['isIEMac'] = bt['isIE'] and bt['isMac']100 bt['staticHTML'] = False101 102 return bt103 104 43 def getParentPath(path, cnt=1): 105 44 """returns pathname shortened by cnt""" … … 108 47 # split by /, shorten, and reassemble 109 48 return '/'.join(path.split('/')[0:-cnt]) 49 110 50 111 51 ## … … 145 85 layer_text_gis = PageTemplateFile('zpt/layer_text_gis', globals()) 146 86 layer_text_pundit = PageTemplateFile('zpt/layer_text_pundit', globals()) 87 layer_images_annotator = PageTemplateFile('zpt/layer_images_annotator', globals()) 147 88 layer_index_extended = PageTemplateFile('zpt/layer_index_extended', globals()) 148 89 # toc templates … … 161 102 docuviewer_ie_css = ImageFile('css/docuviewer_ie.css',globals()) 162 103 # make docuviewer_ie_css refreshable for development 163 docuviewer_ie_css.index_html = refreshingImageFileIndexHtml104 #docuviewer_ie_css.index_html = refreshingImageFileIndexHtml 164 105 jquery_js = ImageFile('js/jquery.js',globals()) 165 106 … … 347 288 return self.availableLayers 348 289 349 def getBrowser(self):350 """getBrowser the version of browser """351 bt = browserCheck(self)352 logging.debug("BROWSER VERSION: %s"%(bt))353 return bt354 355 290 def findDigilibUrl(self): 356 291 """try to get the digilib URL from zogilib"""
Note: See TracChangeset
for help on using the changeset viewer.