Changeset 615:d6eca930a534 in documentViewer


Ignore:
Timestamp:
Jul 21, 2014, 10:53:42 AM (10 years ago)
Author:
Dirk Wintergruen <dwinter@…>
Branch:
default
Message:

hocr viewer eingebaut

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • __init__.py

    r564 r615  
    22import MpdlXmlTextServer
    33import MpiwgXmlTextServer
     4import HocrTextServer
    45
    56def initialize(context):
     
    2930        )
    3031   
     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  
    474474        color: gray;
    475475}
     476
     477span.ocr_line {
     478display:block;
     479}
  • documentViewer.py

    r613 r615  
    8383    # viewMode templates
    8484    viewer_text = PageTemplateFile('zpt/viewer/viewer_text', globals())
     85    viewer_hocr = PageTemplateFile('zpt/viewer/viewer_hocr', globals())
    8586    viewer_xml = PageTemplateFile('zpt/viewer/viewer_xml', globals())
    8687    viewer_image = PageTemplateFile('zpt/viewer/viewer_image', globals())
     
    165166    def getTextPage(self, **args):
    166167        """returns full text content of page"""
     168       
    167169        return self.template.fulltextclient.getTextPage(**args)
     170   
     171   
     172   
    168173
    169174    def getSearchResults(self, **args):
     
    240245        @param url: url which contains display information
    241246        @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'
     247        @param viewMode: 'image': display images, 'text': display text, 'xml': display xml, default is 'auto', 'hocr' : hocr format
    243248        @param viewLayer: sub-type of viewMode, e.g. layer 'dict' for viewMode='text'
    244249        @param tocMode: type of 'table of contents' for navigation (thumbs, text, figures, none)
     
    288293            viewMode = 'image'
    289294            self.REQUEST['viewMode'] = 'image'
     295           
     296       
     297           
    290298
    291299        # safe viewLayer in userinfo
     
    533541            metaDom = self.metadataService.getDomFromPathOrUrl(docUrl)
    534542            docinfo['imagePath'] = url.replace('/mpiwg/online', '', 1)
     543           
     544        elif mode=="hocr":
     545            # url points to folder with images, index.meta optional
     546            # asssume index.meta in parent dir
     547            docUrl = getParentPath(url)
     548            metaDom = self.metadataService.getDomFromPathOrUrl(docUrl)
     549            docinfo['imagePath'] = url.replace('/mpiwg/online', '', 1)
     550            docinfo['textURLPath'] = url.replace('/mpiwg/online', '', 1)
     551            if docinfo.get("creator", None) is None:
     552                docinfo['creator'] = ""
     553           
     554            if docinfo.get("title", None) is None:
     555                docinfo['title'] = ""
     556
     557            if docinfo.get("documentPath", None) is None:
     558                docinfo['documentPath'] = url.replace('/mpiwg/online', '', 1)
     559                docinfo['documentPath'] = url.replace('/pages', '', 1)
    535560
    536561        elif mode=="filepath":
  • zpt/viewer/layer_text_annotator.zpt

    r601 r615  
    55<metal:block metal:define-macro="html_head" tal:condition="python:'annotator' in viewLayers">
    66  <!--  annotator -->
     7 <link rel="stylesheet" type="text/css"
     8    tal:attributes="href string:$rootUrl/template/annotator_files/css/style.css" />
     9
    710  <link rel="stylesheet" type="text/css"
    811    tal:attributes="href string:$rootUrl/template/annotator_files/css/annotator.css" />
     12
    913
    1014  <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/vendor/json2.js"></script>
     
    1519  <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/range.js"></script>
    1620  <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 
    1724  <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/widget.js"></script>
    1825  <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/editor.js"></script>
     
    2532  <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/markdown.js"></script>
    2633  <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 
    2741  <!-- <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/filter.js"></script> -->
    2842
     
    4559            $(document).ready(function() {
    4660                // annotator
     61             
     62
     63                jQuery.i18n.load(i18n_dict);
    4764                var elem = $('div.pageContent').get(0);
    4865                var uri = annotatorPageUrl;
     
    7996                        'uri' : uri
    8097                    }
    81                 }).addPlugin('Tags').addPlugin('Markdown');
     98                }).addPlugin('Tags').addPlugin('Markdown').addPlugin('AnnotatorViewer');
     99               
     100                $('#anotacions-uoc-panel').slimscroll({height: '100%'});
    82101            });
    83102        // -->
Note: See TracChangeset for help on using the changeset viewer.