Implement the Stemweb request UI; start untested implementation of backend (#29)
[scpubgit/stemmaweb.git] / root / src / index.tt
1 [% WRAPPER header.tt
2         pagetitle = "Stemmaweb - Text tradition tools"
3         applicationjs = c.uri_for( 'js/componentload.js' )
4 %]
5     <script type="text/javascript">
6 // Set global variables that must be passed by the server
7 var basepath = "[% c.uri_for( '/' ) %]";
8 var textOnLoad = "[% withtradition %]";
9 var stemwebAlgorithms = [% stemweb_algorithms %];
10     </script>
11
12 [% END %]
13
14     <div id="topbanner">
15       <h1>Stemmaweb - a collection of tools for analysis of collated texts</h1>
16       <span class="mainnav">[% IF c.user_exists %]Hello! [% c.user.get_object.email %] <a class="navlink" href="[% c.uri_for( '/logout' ) %]">Sign out</a> | [% ELSE %]<a class="navlink" onclick="window.open('[% c.uri_for( '/login' ) %]', 'loginwindow', 'height=385,width=445')">Login</a> | [% END %]<a class="navlink" href="[% c.uri_for( '/about' ) %]">About</a> </span>
17       <p id="compatibility_check"><span class="error">This browser does not support 
18       the functions necessary for Stemmaweb to work properly. We recommend use of 
19       <a href="http://mozilla.org/firefox">Mozilla Firefox</a> or 
20       <a href="http://www.google.com/chrome">Google Chrome</a>.</span></p>
21     </div>
22     <div id="directory_container">
23       <h2>Text directory</h2>
24       <div id="directory"></div>
25 [% IF c.user_exists -%]
26           <div class="button" id="new_trad_button" onClick="$('#upload-collation-dialog').dialog('open')">
27             <span>Add a new text tradition</span>
28           </div>
29 [% END %]
30     </div>
31     <div id="textinfo_waitbox">
32         <h3>Loading tradition information, please wait...</h3>
33         <img src="[% c.uri_for( 'images', 'ajax-loader.gif' ) %]" alt="Loading tradition info..." />
34     </div>
35     <div id="textinfo_container">
36       <div id="textinfo_load_status"></div>
37       <h2>Text <span class="texttitle"></span></h2>
38       <form id="open_textinfo_edit" action="" method="GET" name="edit_textinfo">
39         <div class="button" id="edit_textinfo_button"
40                 onClick="$('#textinfo-edit-dialog').dialog('open')">
41           <span>Modify information about this tradition</span>
42         </div>
43       </form>
44       <ul>
45           <li>is owned by <span id="owner_id"></span></li>
46           <li>is <span id="not_public"></span>public</li>
47           <li>has <span id="marked_language"></span> as its primary language</li>
48               <li>has <span id="witness_num"></span> witnesses: <span id="witness_list"></span></li>
49       </ul>
50       
51       <div id="textinfo_container_buttons">
52           <form id="stemma_pager" action="" method="GET" name="stemma_pager">
53             <div id="stemma_pager_buttons">
54               <div class="pager_left_button" id="stemma_pager_left_button"></div>
55               <div class="pager_right_button" id="stemma_pager_right_button"></div>
56             </div>
57           </form>
58           <form id="open_stemma_add" action="" method="GET" name="add_new_stemma">
59             <div class="button" id="stemma_add_button" 
60                 onClick="$('#stemmaseq').val('n'); $('#stemma-edit-dialog').dialog('open');">
61                   <span>Add a new stemma</span>
62             </div>
63           </form>
64           <form id="open_stemma_edit" action="" method="GET" name="edit_current_stemma">
65             <div class="button" id="stemma_edit_button" 
66                 onClick="$('#stemmaseq').val(selectedStemmaID); $('#stemma-edit-dialog').dialog('open');">
67                   <span>Edit this stemma</span>
68             </div>
69           </form>
70           <form id="open_stemweb_ui" action="" method="GET" name="run_stemweb">
71             <div class="button" id="run_stemweb_button"
72                 onClick="$('#stemweb-ui-dialog').dialog('open');">
73               <span>Run a Stemweb algorithm</span>
74             </div>
75           </form>
76           <form id="run_stexaminer" action="" method="GET" name="run_stexaminer">
77             <div class="button" id="stexaminer_button" onClick="$('#run_stexaminer').submit()">
78                   <span>Examine variants against this stemma</span>
79             </div>
80           </form>
81           <form id="run_relater" action="" method="GET" name="run_relater">
82             <div class="button" id="relater_button" onClick="$('#run_relater').submit()">
83               <span id='relatebutton_label'>View collation and relationships</span>
84             </div>
85           </form>
86           <a id="dl_tradition" href="" download="file.xml">
87             <div class="button" id="download_button">
88               <span id='dlbutton_label'>Download tradition as XML</span>
89             </div>
90           </a>
91       </div>
92       <div id="stemma_graph"></div>
93       <div id="stemma_graph_title"><span id="stemma_identifier"></span></div>
94     </div>
95
96     <!-- Interim 'loading' message for directory box -->
97     <div id="loading_message">
98         <h3>Loading texts, please wait...</h3>
99         <img src="[% c.uri_for( 'images', 'ajax-loader.gif' ) %]" alt="Loading tradition list..."/>
100     </div>
101     
102     <!-- Textinfo editor dialog -->
103     <div id="textinfo-edit-dialog" title="Edit information about this tradition">
104       <div id="textinfo_edit_container">
105         <form id="edit_textinfo">
106                 <label for="edit_name">Tradition name: </label>
107                 <input id="edit_name" type="text" size="30" name="name"/><br/>
108                 <label for="edit_language">Language: </label>
109                 <input id="edit_language" type="text" size="12" name="language"/>
110                 <label for="edit_public">Publicly viewable: </label>
111                 <input id="edit_public" type="checkbox" name="public"/><br/>
112 [% IF c.user_exists -%]
113 [% IF c.user.get_object.is_admin -%]
114                 <label for="edit_owner">Tradition owner: </label>
115                 <input id="edit_owner" type="text" size="30" name="owner"/><br/>
116 [% END -%]
117 [% END -%]
118                 </form>
119                 <div id="edit_textinfo_status"></div>
120           </div>
121     </div>
122     
123     <!-- Stemma dot editor dialog, simple textarea for now -->
124     <div id="stemma-edit-dialog">
125       <div id="stemma_edit_container">
126         <form id="edit_stemma">
127                 <label for="dot_field">Dot definition for this stemma: </label><br/>
128                 <textarea id="dot_field" rows="30" cols="40"></textarea>
129                 <input id="stemmaseq" type="hidden" name="stemmaseq" val="n"/>
130                         <div id="edit_instructions">
131                                 <p>All definitions begin with the line
132                                         <pre>digraph "Stemma Name" {</pre>
133                                 and end with the line 
134                                         <pre>}</pre>
135                                 Please do not change these lines except to edit the stemma name.</p>
136                                 <p>First list each witness in your stemma, whether extant or lost /
137                                 reconstructed / hypothetical, and assign them a class of either "extant"
138                                 or "hypothetical". For example:</p><pre>  
139         α [ class=hypothetical ]
140         C [ class=extant ]
141                                 </pre>
142                                 <p>Next, list the direct links between witnesses, one per line. For example, if 
143                                 witness C descends directly from witness α, note it as follows:</p><pre>
144         α -> C
145                                 </pre>
146                                 <p>A witness may be the exemplar for any number of other witnesses, whether 
147                                 extant or not; likewise, a witness may inherit from any number of other 
148                                 witnesses. Use as may "A -> B" pairings as necessary to describe the links.</p>
149                         </div>
150         </form>
151         <div id="edit_stemma_status"></div>
152       </div>
153     </div>
154
155         <!-- Stemweb UI dialog box -->
156     <div id="stemweb-ui-dialog" title="Generate a Stemweb tree">
157       <div id="stemweb_ui_container">
158         <form id="call_stemweb">
159                 <input id="stemweb_tradition" type="hidden" name="tradition"/>
160                 <label for="algorithm">Run algorithm: </label>
161                 <select id="stemweb_algorithm" name="algorithm"></select><br/>
162                 <!-- Algorithm-specific options, if any, will be added within this div -->
163                 <div id="stemweb_runtime_options"></div>
164         </form>
165         <div id="stemweb_run_status"></div>
166       </div>
167     </div>
168     
169     <!-- File upload dialog box -->
170     <div id="upload-collation-dialog" title="Upload a collation">
171       <div id="upload_container">
172                 <input id="new_file" name="file" type="file" onchange="file_selected(this)">
173                 <label for="new_file" id="new_file_label">Collation file: </label>
174         <div id="new_file_name_container" onclick="$('#new_file').click();">&nbsp;(Use 'pick file' to select a tradition file to upload.)</div>
175         <form id="new_tradition">
176             <label for="new_name">Name of this text / tradition: </label>
177             <input id="new_name" type="text" name="name" size="40"/><br/>
178             <label for="new_lang">Primary language of the text: </label>
179             <input id="new_lang" type="text" name="language" size="20"/><br/>
180             <label for="new_public">Allow public display: </label>
181             <input id="new_public" name="public" type="checkbox"/><br/>
182         </form>
183         <div id="upload_status"></div>
184         <div>
185           <h4>Supported file types / extensions:</h4>
186           <ul>
187             <li>*.txt - spreadsheet collation, tab-separated values</li>
188             <li>*.csv - spreadsheet collation, comma-separated values</li>
189             <li>*.xls - spreadsheet collation, Excel 97-2004 format</li>
190             <li>*.xlsx - spreadsheet collation, Excel 2007 XML format</li>
191             <li>*.xml - TEI XML parallel segmentation format</li>
192             <li>*.xml - TEI XML export from Classical Text Editor</li>
193             <li>*.xml - GraphML export from the CollateX tool</li>
194           </ul>
195           <p>All spreadsheet collations should be arranged with the witness sigla in the first row, and the words aligned by row each in its correct witness column.</p>
196         </div>
197       </div>
198     </div>    
199 [% PROCESS footer.tt %]