Mercurial > hg > documentViewer
annotate zpt/viewer/layer_text_annotator.zpt @ 600:87f3a0e63b13
add markdown plugin for annotator.
author | casties |
---|---|
date | Wed, 21 Nov 2012 17:31:32 +0100 |
parents | da7daa783df4 |
children | 8c0625dfd36e |
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> | |
25 <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
|
26 <!-- <script tal:attributes="src string:$rootUrl/template/annotator_files/lib/plugin/filter.js"></script> --> |
528 | 27 |
28 <script type="text/javascript" | |
557 | 29 tal:define="global annServerUrl string:http://tuxserve03.mpiwg-berlin.mpg.de/AnnotationManager; |
30 annUrl python:'http://echo.mpiwg-berlin.mpg.de/documents%s?pn=%s'%(docinfo['documentPath'],pageinfo['pn']); | |
31 resUrl python:'http://echo.mpiwg-berlin.mpg.de/documents%s'%(docinfo['documentPath']); | |
555 | 32 global annUser python:here.getAuthenticatedUser(anon='anonymous'); |
33 global annGroup python:request.get('annotator_group', None); | |
34 permUser python:test(annGroup, 'group:%s'%annGroup, annUser);" | |
557 | 35 tal:content="structure string: |
36 var annotatorServerUrl='$annServerUrl'; | |
37 var annotatorPageUrl='$annUrl'; | |
38 var annotatorResourceUrl='$resUrl'; | |
39 var annotatorUser='$annUser'; | |
40 var permissionUser='$permUser';"></script> | |
525 | 41 |
42 <script type="text/javascript"> | |
43 // <!-- | |
44 $(document).ready(function() { | |
45 // annotator | |
46 var elem = $('div.pageContent').get(0); | |
528 | 47 var uri = annotatorPageUrl; |
525 | 48 var devAnnotator = new Annotator(elem).addPlugin('Auth', { |
528 | 49 tokenUrl : 'template/token?user='+annotatorUser |
525 | 50 }).addPlugin('Permissions', { |
550 | 51 permissions: { |
52 'read': [], | |
53 'update': [permissionUser], | |
54 'delete': [permissionUser], | |
55 'admin': [permissionUser] | |
56 }, | |
546 | 57 user : permissionUser, |
525 | 58 userString : function(user) { |
59 if (user && user.name) { | |
60 return user.name; | |
61 } | |
62 return user; | |
63 }, | |
64 userId : function(user) { | |
65 if (user && user.id) { | |
66 return user.id; | |
67 } | |
68 return user; | |
69 } | |
70 }).addPlugin('Store', { | |
557 | 71 prefix: annotatorServerUrl+'/annotator', |
525 | 72 annotationData : { |
555 | 73 'uri' : uri, |
74 'resource' : annotatorResourceUrl | |
525 | 75 }, |
76 loadFromSearch : { | |
77 'limit' : 20, | |
78 'uri' : uri | |
79 } | |
600 | 80 }).addPlugin('Tags').addPlugin('Markdown'); |
525 | 81 }); |
82 // --> | |
83 </script> | |
84 | |
85 </metal:block> | |
86 </head> | |
87 <body> | |
88 <!-- right-side options --> | |
89 <div class="col buttons"> | |
90 <!-- LAYER DISPLAY OPTION --> | |
91 <ul> | |
92 <li metal:define-macro="layer_select_li"> | |
93 <input type="checkbox" class="autosubmit" name="viewLayer" value="annotator" | |
552 | 94 tal:attributes="checked python:'annotator' in viewLayers" /> Annotator |
525 | 95 </li> |
96 </ul> | |
97 </div> | |
98 | |
526 | 99 <metal:block metal:define-macro="options_box" tal:condition="python:'annotator' in viewLayers"> |
525 | 100 <!-- BEGIN ANNOTATIONS --> |
546 | 101 <div class="options"> |
552 | 102 <h4>Annotator</h4> |
546 | 103 <p> |
104 User "<span tal:replace="annUser" />"<span tal:condition="annGroup" tal:content="string: ($annGroup)"/>. | |
105 </p> | |
106 <!-- TODO: login button --> | |
107 <form class="autosubmit" tal:attributes="action viewerUrl"> | |
108 <input type="hidden" tal:define="params python:here.getParams(params={'annotator_group':None});" tal:repeat="param params" | |
109 tal:attributes="name param; value python:params[param]" /> | |
110 <p> | |
111 In group | |
112 <select class="autosubmit" name="annotator_group"> | |
113 <option value="" tal:attributes="selected not:annGroup;"> </option> | |
114 <option | |
557 | 115 tal:repeat="group python:here.getAnnotatorGroupsForUser(user=annUser,annotationServerUrl=annServerUrl)" |
546 | 116 tal:attributes="value group/id; selected python:group['id']==annGroup;" tal:content="group/name" /> |
117 </select> <br /> | |
118 <input type="submit" value="Go!" /> | |
119 </p> | |
120 </form> | |
549 | 121 <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
|
122 <a class="button" tal:attributes="href python:'%s/login/login?came_from=%s'%(viewerUrl,std.url_quote(here.getLink()))">Log in</a> |
549 | 123 </p> |
525 | 124 </div> |
125 <!-- END ANNOTATIONS --> | |
126 </metal:block> | |
127 | |
128 </body> | |
129 | |
130 </html> |