Mercurial > hg > documentViewer
annotate zpt/viewer/layer_text_annotator.zpt @ 623:6012fe93f78c
better scheme-less URL code.
author | casties |
---|---|
date | Mon, 15 Dec 2014 16:10:05 +0100 |
parents | bc68ca0d2c0a |
children |
rev | line source |
---|---|
525 | 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
3 <html xmlns="http://www.w3.org/1999/xhtml"> | |
4 <head> | |
526 | 5 <metal:block metal:define-macro="html_head" tal:condition="python:'annotator' in viewLayers"> |
525 | 6 <!-- annotator --> |
7 <link rel="stylesheet" type="text/css" | |
8 tal:attributes="href string:$rootUrl/template/annotator_files/css/annotator.css" /> | |
9 | |
600 | 10 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/vendor/json2.js"></script> |
11 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/vendor/showdown.js"></script> | |
12 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/extensions.js"></script> | |
13 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/console.js"></script> | |
14 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/class.js"></script> | |
15 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/range.js"></script> | |
16 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/annotator.js"></script> | |
17 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/widget.js"></script> | |
18 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/editor.js"></script> | |
19 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/viewer.js"></script> | |
20 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/notification.js"></script> | |
21 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/store.js"></script> | |
22 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/permissions.js"></script> | |
23 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/auth.js"></script> | |
24 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/tags.js"></script> | |
601 | 25 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/markdown.js"></script> |
600 | 26 <script type="text/javascript" tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/unsupported.js"></script> |
547
7c6fdc31bd35
use normalized uri (e.g. http://echo.mpiwg-berlin.mpg.de/documents/permanent/library/163127KK?pn=9)
casties
parents:
546
diff
changeset
|
27 <!-- <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/filter.js"></script> --> |
528 | 28 |
29 <script type="text/javascript" | |
622
bc68ca0d2c0a
make annotationServerUrl work with protocol-relative URL (//).
casties
parents:
620
diff
changeset
|
30 tal:define="global annServerUrl string://tuxserve03.mpiwg-berlin.mpg.de/AnnotationManager; |
557 | 31 annUrl python:'http://echo.mpiwg-berlin.mpg.de/documents%s?pn=%s'%(docinfo['documentPath'],pageinfo['pn']); |
32 resUrl python:'http://echo.mpiwg-berlin.mpg.de/documents%s'%(docinfo['documentPath']); | |
555 | 33 global annUser python:here.getAuthenticatedUser(anon='anonymous'); |
34 global annGroup python:request.get('annotator_group', None); | |
35 permUser python:test(annGroup, 'group:%s'%annGroup, annUser);" | |
557 | 36 tal:content="structure string: |
37 var annotatorServerUrl='$annServerUrl'; | |
38 var annotatorPageUrl='$annUrl'; | |
39 var annotatorResourceUrl='$resUrl'; | |
40 var annotatorUser='$annUser'; | |
41 var permissionUser='$permUser';"></script> | |
525 | 42 |
43 <script type="text/javascript"> | |
44 // <!-- | |
45 $(document).ready(function() { | |
46 // annotator | |
47 var elem = $('div.pageContent').get(0); | |
528 | 48 var uri = annotatorPageUrl; |
525 | 49 var devAnnotator = new Annotator(elem).addPlugin('Auth', { |
528 | 50 tokenUrl : 'template/token?user='+annotatorUser |
525 | 51 }).addPlugin('Permissions', { |
550 | 52 permissions: { |
53 'read': [], | |
54 'update': [permissionUser], | |
55 'delete': [permissionUser], | |
56 'admin': [permissionUser] | |
57 }, | |
546 | 58 user : permissionUser, |
525 | 59 userString : function(user) { |
60 if (user && user.name) { | |
61 return user.name; | |
62 } | |
63 return user; | |
64 }, | |
65 userId : function(user) { | |
66 if (user && user.id) { | |
67 return user.id; | |
68 } | |
69 return user; | |
70 } | |
71 }).addPlugin('Store', { | |
557 | 72 prefix: annotatorServerUrl+'/annotator', |
525 | 73 annotationData : { |
555 | 74 'uri' : uri, |
75 'resource' : annotatorResourceUrl | |
525 | 76 }, |
77 loadFromSearch : { | |
78 'limit' : 20, | |
79 'uri' : uri | |
80 } | |
619
79973dee60bd
revert layer_text_annotator to old version and fix layer_image_annotator for current version.
casties
parents:
615
diff
changeset
|
81 }).addPlugin('Tags').addPlugin('Markdown'); |
525 | 82 }); |
83 // --> | |
84 </script> | |
85 | |
86 </metal:block> | |
87 </head> | |
88 <body> | |
89 <!-- right-side options --> | |
90 <div class="col buttons"> | |
91 <!-- LAYER DISPLAY OPTION --> | |
92 <ul> | |
93 <li metal:define-macro="layer_select_li"> | |
94 <input type="checkbox" class="autosubmit" name="viewLayer" value="annotator" | |
552 | 95 tal:attributes="checked python:'annotator' in viewLayers" /> Annotator |
525 | 96 </li> |
97 </ul> | |
98 </div> | |
99 | |
526 | 100 <metal:block metal:define-macro="options_box" tal:condition="python:'annotator' in viewLayers"> |
525 | 101 <!-- BEGIN ANNOTATIONS --> |
546 | 102 <div class="options"> |
552 | 103 <h4>Annotator</h4> |
546 | 104 <p> |
105 User "<span tal:replace="annUser" />"<span tal:condition="annGroup" tal:content="string: ($annGroup)"/>. | |
106 </p> | |
107 <!-- TODO: login button --> | |
108 <form class="autosubmit" tal:attributes="action viewerUrl"> | |
109 <input type="hidden" tal:define="params python:here.getParams(params={'annotator_group':None});" tal:repeat="param params" | |
110 tal:attributes="name param; value python:params[param]" /> | |
111 <p> | |
112 In group | |
113 <select class="autosubmit" name="annotator_group"> | |
114 <option value="" tal:attributes="selected not:annGroup;"> </option> | |
115 <option | |
557 | 116 tal:repeat="group python:here.getAnnotatorGroupsForUser(user=annUser,annotationServerUrl=annServerUrl)" |
546 | 117 tal:attributes="value group/id; selected python:group['id']==annGroup;" tal:content="group/name" /> |
118 </select> <br /> | |
119 <input type="submit" value="Go!" /> | |
120 </p> | |
121 </form> | |
549 | 122 <p tal:define="std modules/Products.PythonScripts.standard"> |
587
6000c7e24d8a
new parameter "pf" to specify image file name. (still some issues)
casties
parents:
557
diff
changeset
|
123 <a class="button" tal:attributes="href python:'%s/login/login?came_from=%s'%(viewerUrl,std.url_quote(here.getLink()))">Log in</a> |
549 | 124 </p> |
525 | 125 </div> |
126 <!-- END ANNOTATIONS --> | |
127 </metal:block> | |
128 | |
129 </body> | |
130 | |
131 </html> |