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