From: Tara L Andrews Date: Fri, 31 Aug 2012 10:54:49 +0000 (+0200) Subject: initial pass at upload dialog X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=40ed7ca60254d1e7a2eb2124f83053c133507375;p=scpubgit%2Fstemmaweb.git initial pass at upload dialog --- diff --git a/root/src/index.tt b/root/src/index.tt index 0235472..ee57d6a 100644 --- a/root/src/index.tt +++ b/root/src/index.tt @@ -6,18 +6,54 @@ var selectedTextID; var selectedStemmaID = -1; var stemmata = []; -$(document).ready(function() { - // call out to load the directory div - $('#textinfo_container').hide(); - $('#textinfo_waitbox').hide(); + +function refreshDirectory () { $('#directory').load( "[% c.uri_for( 'directory' ) %]", function(response, status, xhr) { if (status == "error") { var msg = "An error occurred: "; $("#directory").html(msg + xhr.status + " " + xhr.statusText); } - }); - }); + } + ); +} + +$(document).ready( function() { + // call out to load the directory div + $('#textinfo_container').hide(); + $('#textinfo_waitbox').hide(); + refreshDirectory(); + $('#upload-collation-dialog').dialog({ + autoOpen: false, + height: 325, + width: 480, + modal: true, + buttons: { + "Upload": function( evt ) { + $(evt.target).button("disable"); + $('#upload_status').empty(); + form_values = $('#upload_collation').serialize(); + $.post( "[% c.uri_for ( '/newtradition' ) %]", form_values, function(data) { + $(evt.target).button("enable"); + $( "#dialog-form" ).dialog( "close" ); + refreshDirectory(); + loadTradition( data.id, data.name, 1 ) + }, 'json' ); + }, + Cancel: function() { + $( this ).dialog( "close" ); + } + }, + }).ajaxError( function(event, jqXHR, ajaxSettings, thrownError) { + if( ajaxSettings.url.indexOf( '/new' ) > -1 + && ajaxSettings.type == 'POST' ) { + var errobj = jQuery.parseJSON( jqXHR.responseText ); + $('#upload_status').append( '

Error: ' + errobj.error + '
The tradition cannot be created.

' ); + } + $(event.target).parent().find('.ui-button').button("enable"); + } + ); +}); [% END %] @@ -33,7 +69,7 @@ $(document).ready(function() { [% IF c.user_exists -%] -
+
Add a new text tradition
[% END %] @@ -70,4 +106,28 @@ $(document).ready(function() {
+ + +
+
+ +
+ + +
+
+

Supported file types / extensions:

+
    +
  • *.txt - spreadsheet collation, tab-separated values
  • +
  • *.csv - spreadsheet collation, comma-separated values
  • +
  • *.xls - spreadsheet collation, Excel 97-2004 format
  • +
  • *.xlsx - spreadsheet collation, Excel 2007 XML format
  • +
  • *.xml - TEI XML parallel segmentation format
  • +
  • *.xml - TEI XML export from Classical Text Editor
  • +
  • *.xml - GraphML export from the CollateX tool
  • +
+

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.

+
+
+
[% PROCESS footer.tt %] \ No newline at end of file