hook up and test duplication server-side logic
[scpubgit/stemmaweb.git] / root / src / relate.tt
1 [% WRAPPER header.tt
2         pagetitle = "Stemmaweb - Relationship mapper"
3         applicationjs = c.uri_for("/js/relationship.js")
4         applicationstyle = c.uri_for('/css/relationship.css')
5 %]
6 <script type="text/javascript">
7 // Load the text ID and the base path
8 var basepath = "[% c.uri_for( '/relation/' ) %]";
9 var textid = "[% textid %]";
10 var can_morphologize = "[% can_morphologize %]";
11 var editable = "[% permission %]" === "full";
12 [% IF error -%]
13 var relationship_types = [];
14 var relationship_scopes = [];
15 [% ELSE -%]
16 var relationship_types = [% relationship_types %];
17 var relationship_scopes = [% relationship_scopes %];
18 [% END -%]
19
20 $(document).ready(function () {
21   loadSVG('[% svg_string %]');
22 });
23 </script>
24 [% END %]
25
26         <div id="topbanner">
27                 <span class="mainnav">
28                         <a href="help/[% text_lang %]" title="Relationship mapper help" class="helptag">Help / About</a> | <a href="[% c.uri_for( '/' ) %]?withtradition=[% textid %]" class="navlink">Return to index</a>
29                 </span>
30                 <h1>Relationship mapper</h1>
31                 <h2>[% text_title %]</h2>
32                 <div id="segmentation">
33 [% FOREACH segment IN textsegments -%]
34 [% IF segment.start != startseg -%]
35                         <a href="[% c.uri_for( "/relation/$textid" ) %]?start=[% segment.start %]">
36                                 <span class="segment_guide">[% segment.display %]</span>
37                         </a>
38 [% ELSE -%]
39                         <span class="segment_guide selected">[% segment.display %]</span>
40 [% END -%]
41 [% END -%]
42                 </div>
43         </div>
44
45         <div id="enlargement_container" class="fillPage">       
46                 <div id="loading_overlay">
47                         <div id="loading_message"><span>Loading, please wait...</span></div>
48                 </div>
49                 <div id="dialog_overlay"></div>
50                 <div id="enlargement" style="">
51                 <div id="svgenlargement"  class="fillPage"></div>
52                 </div>
53         </div>
54         
55         <div id="update_workspace_button"></div>
56         
57         <div id="dialog-form" title="Create relation between two nodes...">
58                 <form id="collapse_node_form" action="#">
59                 <fieldset>
60                         <input type="hidden" name="source_id" id="source_node_id"/>
61                         <input type="hidden" name="source_text" id="source_node_text"/>
62                         <input type="hidden" name="target_id" id="target_node_id"/>
63                         <input type="hidden" name="target_text" id="target_node_text"/>
64                         <label for="rel_type">Relation type..&nbsp;</label>
65                         <select name="rel_type" id="rel_type" class=".ui-widget select">
66                                 <option></option>
67                         </select>
68                         <br/><br/>
69                         <label for="scope">Scope of relation..&nbsp;</label>
70                         <select name="scope" id="scope" class=".ui-widget select">
71                                 <option></option>
72                         </select>
73                         <br/><br/>
74                         <label for="note">Annotation or note..&nbsp;</label>
75                         <textarea rows="3" style="width:100%;" name="note" id="note" class=".ui-widget input"></textarea>
76                 </fieldset>
77         <div id="status"></div>         
78                 </form>
79         </div>
80         <div id="dialog_overlay"></div>
81
82         <div id="delete-form" title="Relation info...">
83                 <form id="delete_relation_form" action="#">
84                         <input type="hidden" name="source_id" id="delete_source_node_id"/>
85                         <input type="hidden" name="target_id" id="delete_target_node_id"/>
86                 </form>
87                 <div id="delete-form-text">Type: <span id="delete_relation_type"></span><br/>
88                     Scope: <span id="delete_relation_scope"></span><br/>
89                     <span id="delete_relation_note"></span></div>
90         </div>
91
92         <div id="multipleselect-form" title="Multiple nodes selected...">
93                 <div id="multipleselect-form-status"></div>
94                 <div id="multipleselect-form-text">Select witness(es) to detach:</div>
95                 <form id="detach_collated_form" action="#">
96                 </form>
97         </div>
98         
99         <div id="reading-form" title="Reading info...">
100                 <form id="reading_data_form" action="#">
101                         <input type="hidden" name="reading_id" id="reading_id"/>
102                         <div class="morph">
103                                 <input type="checkbox" name="reading_is_nonsense" id="reading_is_nonsense"/>
104                                 <label for="reading_is_nonsense">This is a nonsense word</label>
105                                 <br/>
106                                 <input type="checkbox" name="reading_grammar_invalid" id="reading_grammar_invalid"/>
107                                 <label for="reading_grammar_invalid">This word's grammar cannot be right</label>
108                         </div>
109                         <br/><br/>
110                         <!-- Collation correction option goes here -->
111                         <div id="decollation">
112                                 <label for="reading_decollate">Detach this reading with the selected witnesses:</label>
113                                 <select id="reading_decollate_witnesses" name="reading_decollate_witnesses"
114                                         multiple="multiple">
115                                 <!-- Fill in relevant reading witnesses here -->
116                                 </select>
117                                 <button id="reading_decollate" onclick="decollate(); return false;">Uncollate</button>
118                         </div>
119                         <!-- Morphological options go here -->
120                         <div id="normalization" class="morph">
121                                 <label for="reading_normal_form">Normalized form: </label>
122                                 <input type="text" name="reading_normal_form" id="reading_normal_form"></input>
123                                 <button id="reading_relemmatize" onclick="relemmatize(); return false;">Re-lemmatize</button>
124                         </div>
125                         <div id="relemmatize_pending">
126                                 <img src="[% c.uri_for('/images/ajax-loader.gif') %]"/>
127                         </div>
128                         <br/><br/>
129                         <div id="morph_outer" class="morph">
130                                 <label>Lemma / part of speech:</label><br/>
131                                 <div id="morphology"></div>
132                         </div>
133                         </select>
134                         <div id="reading_status"></div>
135                 </form>
136     </div>
137         
138     <p/><p/>    
139     <div id="keymap">
140         <ul id="keymaplist">
141           <li></li>
142         </ul>
143     </div>
144     
145 [% PROCESS footer.tt %]