Changeset 617:7aefbddddaf9 in documentViewer
- Timestamp:
- Jul 23, 2014, 3:36:04 PM (10 years ago)
- Branch:
- default
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
__init__.py
r564 r615 2 2 import MpdlXmlTextServer 3 3 import MpiwgXmlTextServer 4 import HocrTextServer 4 5 5 6 def initialize(context): … … 29 30 ) 30 31 32 33 context.registerClass( 34 HocrTextServer.HocrTextServer, 35 constructors = ( 36 HocrTextServer.manage_addHocrTextServerForm, 37 HocrTextServer.manage_addHocrTextServer 38 ) 39 ) 40 41 -
css/docuviewer.css
r611 r615 474 474 color: gray; 475 475 } 476 477 span.ocr_line { 478 display:block; 479 } -
documentViewer.py
r613 r617 22 22 def getMDText(node): 23 23 """returns the @text content from the MetaDataProvider metadata node""" 24 25 26 24 27 if isinstance(node, dict): 25 28 return node.get('@text', None) 26 29 30 if isinstance(node,list): #more than one text file if there is an attribute don't choose it 31 for nodeInList in node: 32 attr = nodeInList.get("@attr",None) 33 if attr is None: 34 return node.get('@text',None) 35 return None 36 37 38 27 39 return node 28 40 … … 83 95 # viewMode templates 84 96 viewer_text = PageTemplateFile('zpt/viewer/viewer_text', globals()) 97 viewer_hocr = PageTemplateFile('zpt/viewer/viewer_hocr', globals()) 85 98 viewer_xml = PageTemplateFile('zpt/viewer/viewer_xml', globals()) 86 99 viewer_image = PageTemplateFile('zpt/viewer/viewer_image', globals()) … … 165 178 def getTextPage(self, **args): 166 179 """returns full text content of page""" 180 167 181 return self.template.fulltextclient.getTextPage(**args) 182 183 184 168 185 169 186 def getSearchResults(self, **args): … … 240 257 @param url: url which contains display information 241 258 @param mode: defines how to access the document behind url 242 @param viewMode: 'image': display images, 'text': display text, 'xml': display xml, default is 'auto' 259 @param viewMode: 'image': display images, 'text': display text, 'xml': display xml, default is 'auto', 'hocr' : hocr format 243 260 @param viewLayer: sub-type of viewMode, e.g. layer 'dict' for viewMode='text' 244 261 @param tocMode: type of 'table of contents' for navigation (thumbs, text, figures, none) … … 251 268 logging.error("template folder missing!") 252 269 return "ERROR: template folder missing!" 253 270 271 272 254 273 if not getattr(self, 'digilibBaseUrl', None): 255 274 self.digilibBaseUrl = self.findDigilibUrl() or "http://digilib.mpiwg-berlin.mpg.de/digitallibrary" … … 288 307 viewMode = 'image' 289 308 self.REQUEST['viewMode'] = 'image' 309 310 311 290 312 291 313 # safe viewLayer in userinfo … … 533 555 metaDom = self.metadataService.getDomFromPathOrUrl(docUrl) 534 556 docinfo['imagePath'] = url.replace('/mpiwg/online', '', 1) 557 558 elif mode=="hocr": 559 # url points to folder with images, index.meta optional 560 # asssume index.meta in parent dir 561 docUrl = getParentPath(url) 562 metaDom = self.metadataService.getDomFromPathOrUrl(docUrl) 563 docinfo['imagePath'] = url.replace('/mpiwg/online', '', 1) 564 docinfo['textURLPath'] = url.replace('/mpiwg/online', '', 1) 565 if docinfo.get("creator", None) is None: 566 docinfo['creator'] = "" 567 568 if docinfo.get("title", None) is None: 569 docinfo['title'] = "" 570 571 if docinfo.get("documentPath", None) is None: 572 docinfo['documentPath'] = url.replace('/mpiwg/online', '', 1) 573 docinfo['documentPath'] = url.replace('/pages', '', 1) 535 574 536 575 elif mode=="filepath": … … 726 765 # old style text URL 727 766 textUrl = getMDText(texttool.get('text', None)) 767 768 769 770 728 771 if textUrl and docPath: 729 772 if urlparse.urlparse(textUrl)[0] == "": #keine url -
zpt/viewer/layer_text_annotator.zpt
r601 r615 5 5 <metal:block metal:define-macro="html_head" tal:condition="python:'annotator' in viewLayers"> 6 6 <!-- annotator --> 7 <link rel="stylesheet" type="text/css" 8 tal:attributes="href string:$rootUrl/template/annotator_files/css/style.css" /> 9 7 10 <link rel="stylesheet" type="text/css" 8 11 tal:attributes="href string:$rootUrl/template/annotator_files/css/annotator.css" /> 12 9 13 10 14 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/vendor/json2.js"></script> … … 15 19 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/range.js"></script> 16 20 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/annotator.js"></script> 21 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/locale/en/annotator.js"></script> 22 23 17 24 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/widget.js"></script> 18 25 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/editor.js"></script> … … 25 32 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/markdown.js"></script> 26 33 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/unsupported.js"></script> 34 35 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/jquery.dateFormat.js"></script> 36 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/jquery.slimscroll.js"></script> 37 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/jquery-i18n-master/jquery.i18n.min.js"></script> 38 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/view_annotator.js"></script> 39 40 27 41 <!-- <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/filter.js"></script> --> 28 42 … … 45 59 $(document).ready(function() { 46 60 // annotator 61 62 63 jQuery.i18n.load(i18n_dict); 47 64 var elem = $('div.pageContent').get(0); 48 65 var uri = annotatorPageUrl; … … 79 96 'uri' : uri 80 97 } 81 }).addPlugin('Tags').addPlugin('Markdown'); 98 }).addPlugin('Tags').addPlugin('Markdown').addPlugin('AnnotatorViewer'); 99 100 $('#anotacions-uoc-panel').slimscroll({height: '100%'}); 82 101 }); 83 102 // -->
Note: See TracChangeset
for help on using the changeset viewer.