initial pass at upload dialog
[scpubgit/stemmaweb.git] / root / src / index.tt
CommitLineData
fb6e49b3 1[% WRAPPER header.tt
2 pagetitle = "Stemmaweb - Text tradition tools"
538715bd 3 applicationjs = c.uri_for( 'js/componentload.js' )
fb6e49b3 4%]
5 <script type="text/javascript">
f007ac1e 6var selectedTextID;
98a45925 7var selectedStemmaID = -1;
8var stemmata = [];
40ed7ca6 9
10function refreshDirectory () {
69799996 11 $('#directory').load( "[% c.uri_for( 'directory' ) %]",
12 function(response, status, xhr) {
13 if (status == "error") {
14 var msg = "An error occurred: ";
15 $("#directory").html(msg + xhr.status + " " + xhr.statusText);
16 }
40ed7ca6 17 }
18 );
19}
20
21$(document).ready( function() {
22 // call out to load the directory div
23 $('#textinfo_container').hide();
24 $('#textinfo_waitbox').hide();
25 refreshDirectory();
26 $('#upload-collation-dialog').dialog({
27 autoOpen: false,
28 height: 325,
29 width: 480,
30 modal: true,
31 buttons: {
32 "Upload": function( evt ) {
33 $(evt.target).button("disable");
34 $('#upload_status').empty();
35 form_values = $('#upload_collation').serialize();
36 $.post( "[% c.uri_for ( '/newtradition' ) %]", form_values, function(data) {
37 $(evt.target).button("enable");
38 $( "#dialog-form" ).dialog( "close" );
39 refreshDirectory();
40 loadTradition( data.id, data.name, 1 )
41 }, 'json' );
42 },
43 Cancel: function() {
44 $( this ).dialog( "close" );
45 }
46 },
47 }).ajaxError( function(event, jqXHR, ajaxSettings, thrownError) {
48 if( ajaxSettings.url.indexOf( '/new' ) > -1
49 && ajaxSettings.type == 'POST' ) {
50 var errobj = jQuery.parseJSON( jqXHR.responseText );
51 $('#upload_status').append( '<p class="error">Error: ' + errobj.error + '</br>The tradition cannot be created.</p>' );
52 }
53 $(event.target).parent().find('.ui-button').button("enable");
54 }
55 );
56});
fb6e49b3 57 </script>
58
59[% END %]
60
7439e248 61 <div id="topbanner">
62 <h1>Stemmaweb - a collection of tools for analysis of collated texts</h1>
69799996 63 <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> | <a class="navlink" onclick="window.open('[% c.uri_for( '/register' ) %]', 'regwindow', 'height=385,width=445')">Register</a> | [% END %]<a class="navlink" href="[% c.uri_for( 'about.html' ) %]">About</a> </span>
7439e248 64 </div>
fb792f63 65 <div id="directory_container">
66 <h2>Text directory</h2>
67 <div id="directory">
7439e248 68 <h3>Loading texts, please wait...</h3>
69 <img src="[% c.uri_for( 'images', 'ajax-loader.gif' ) %]" />
fb792f63 70 </div>
98a45925 71[% IF c.user_exists -%]
40ed7ca6 72 <div class="button" id="new_trad_button" onClick="$('#upload-collation-dialog').dialog('open')">
98a45925 73 <span>Add a new text tradition</span>
74 </div>
75[% END %]
76 </div>
77 <div id="textinfo_waitbox">
78 <img src="[% c.uri_for( 'images', 'ajax-loader.gif' ) %]" alt="Loading tradition info..."/>
79 </div>
80 <div id="textinfo_container">
81 <h2>Text <span class="texttitle"></span></h2>
82 <ul>
83 <li>has <span id="witness_num"></span> witnesses: <span id="witness_list"></span></li>
84 <li>has <span id="reading_num"></span> distinct readings</li>
85 <li>has <span id="relationship_num"></span> distinct reading relationships</li>
86 </ul>
87
88 <!-- TODO buttons on either side of the graph div to flip through the stemmata -->
a35b3190 89 <div id="textinfo_container_buttons">
90 <form id="stemma_pager" action="" method="GET" name="stemma_pager">
91 <div class="button" id="stemma_pager_button" onClick="$('#stemma_pager').submit()">
92 <span>Left &amp; right go here</span>
93 </div>
94 </form>
95 <form id="run_stexaminer" action="" method="GET" name="run_stexaminer">
96 <div class="button" id="stexaminer_button" onClick="$('#run_stexaminer').submit()">
97 <span>Examine variants against this stemma</span>
98 </div>
99 </form>
100 <form id="run_relater" action="" method="GET" name="run_relater">
101 <div class="button" id="relater_button" onClick="$('#run_relater').submit()">
102 <span>Run relationship mapper</span>
103 </div>
104 </form>
105 </div>
98a45925 106 <div id="stemma_graph"></div>
7439e248 107 </div>
fb6e49b3 108
40ed7ca6 109
110 <!-- File upload dialog box -->
111 <div id="upload-collation-dialog" title="Upload a collation">
112 <form id="upload_collation" action="" method="POST" enctype="multipart/form-data" name="upload_collation">
113 <label for="traditionname">Name of this text / tradition: </label>
114 <input id="traditionname" type="text" name="name" size="40"/><br/>
115 <label for="inputfile">Collation file for the tradition: </label>
116 <input id="inputfile" type="file" name="inputfile" size="40"/>
117 <div id="upload_status"></div>
118 <div>
119 <h4>Supported file types / extensions:</h4>
120 <ul>
121 <li>*.txt - spreadsheet collation, tab-separated values</li>
122 <li>*.csv - spreadsheet collation, comma-separated values</li>
123 <li>*.xls - spreadsheet collation, Excel 97-2004 format</li>
124 <li>*.xlsx - spreadsheet collation, Excel 2007 XML format</li>
125 <li>*.xml - TEI XML parallel segmentation format</li>
126 <li>*.xml - TEI XML export from Classical Text Editor</li>
127 <li>*.xml - GraphML export from the CollateX tool</li>
128 </ul>
129 <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>
130 </div>
131 </form>
132 </div>
fb6e49b3 133[% PROCESS footer.tt %]