diff --git a/resources/Makefile.am b/resources/Makefile.am index 7c28309ff8f84016dbe2797a70fccbc25f97066d..c963804f69a17169b3259e3e4862c4afb785eb45 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -36,6 +36,7 @@ nobase_www_DATA = \ images/favicon_geant.ico \ images/favicon.png \ images/geant_logo_rgb_300dpi.jpg \ + account-manager.js \ jquery-1.11.1.min.js \ jquery.cookie-1.4.1.min.js \ jquery.steps.1.1.0.min.js \ diff --git a/resources/account-manager.js b/resources/account-manager.js new file mode 100644 index 0000000000000000000000000000000000000000..da2a8d90140d1bbb1bfeece7aa47c6373db82f92 --- /dev/null +++ b/resources/account-manager.js @@ -0,0 +1,152 @@ +// To confirm on a link (A HREF) +function request_confirm_link(my_url, my_message) { + question = confirm(my_message); + if (question !="0") { + top.location = my_url; + } + } + +function showhide(div){ + var oDiv = document.getElementById(div); + if(oDiv.style.display == "none"){ + oDiv.style.display = "block"; + }else{ + oDiv.style.display = "none"; + } +} + +function hide(div) { + var oDiv = document.getElementById(div); + oDiv.style.display = "none"; +} + +jQuery(function($){ + + $.widget( "custom.combobox", { + _create: function() { + this.wrapper = $( "<span>" ) + .addClass( "custom-combobox" ) + .insertAfter( this.element ); + + this.element.hide(); + this._createAutocomplete(); + this._createShowAllButton(); + }, + + _createAutocomplete: function() { + var selected = this.element.children( ":selected" ), + value = selected.val() ? selected.text() : ""; + + this.input = $( "<input>" ) + .appendTo( this.wrapper ) + .val( value ) + .attr( "title", "" ) + .addClass( "custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left error required" ) + .autocomplete({ + delay: 0, + minLength: 0, + source: $.proxy( this, "_source" ) + }) + .tooltip({ + tooltipClass: "ui-state-highlight" + }); + + this._on( this.input, { + autocompleteselect: function( event, ui ) { + ui.item.option.selected = true; + this._trigger( "select", event, { + item: ui.item.option + }); + }, + + autocompletechange: "_removeIfInvalid" + }); + }, + + _createShowAllButton: function() { + var input = this.input, + wasOpen = false; + + $( "<a>" ) + .attr( "tabIndex", -1 ) + .attr( "title", "Show All Items" ) + .tooltip() + .appendTo( this.wrapper ) + .button({ + icons: { + primary: "ui-icon-triangle-1-s" + }, + text: false + }) + .removeClass( "ui-corner-all" ) + .addClass( "custom-combobox-toggle ui-corner-right" ) + .mousedown(function() { + wasOpen = input.autocomplete( "widget" ).is( ":visible" ); + }) + .click(function() { + input.focus(); + + // Close if already visible + if ( wasOpen ) { + return; + } + + // Pass empty string as value to search for, displaying all results + input.autocomplete( "search", "" ); + }); + }, + + _source: function( request, response ) { + var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" ); + response( this.element.children( "option" ).map(function() { + var text = $( this ).text(); + if ( this.value && ( !request.term || matcher.test(text) ) ) + return { + label: text, + value: text, + option: this + }; + }) ); + }, + + _removeIfInvalid: function( event, ui ) { + + // Selected an item, nothing to do + if ( ui.item ) { + return; + } + + // Search for a match (case-insensitive) + var value = this.input.val(), + valueLowerCase = value.toLowerCase(), + valid = false; + this.element.children( "option" ).each(function() { + if ( $( this ).text().toLowerCase() === valueLowerCase ) { + this.selected = valid = true; + return false; + } + }); + + // Found a match, nothing to do + if ( valid ) { + return; + } + + // Remove invalid value + this.input + .val( "" ) + .attr( "title", value + " didn't match any item" ) + .tooltip( "open" ); + this.element.val( "" ); + this._delay(function() { + this.input.tooltip( "close" ).attr( "title", "" ); + }, 2500 ); + this.input.autocomplete( "instance" ).term = ""; + }, + + _destroy: function() { + this.wrapper.remove(); + this.element.show(); + } + }); +}); diff --git a/templates/web/index.tt2.html b/templates/web/index.tt2.html index ef63f31a2339410259ee1b684a7d7c00176f103b..af003abc579f09614080d7c61c5a83ec32db616d 100644 --- a/templates/web/index.tt2.html +++ b/templates/web/index.tt2.html @@ -8,11 +8,9 @@ html1/DTD/xhtml1-transitional.dtd"> <link rel="icon" type="image/png" href="images/favicon.png" /> - <!-- Foundation css --> <link rel="stylesheet" type="text/css" href="foundation/css/normalize.css"> <link rel="stylesheet" type="text/css" href="foundation/css/foundation.css"> - - <link href="jquery.steps.css" rel="stylesheet"> + <link rel="stylesheet" type="text/css" href="jquery.steps.css"> <link rel="stylesheet" type="text/css" href="jquery-ui-1.11.1/jquery-ui.min.css" /> <link rel="stylesheet" type="text/css" href="css/style.css" /> @@ -21,165 +19,7 @@ html1/DTD/xhtml1-transitional.dtd"> <script type="text/javascript" src="jquery.validate.1.13.0.min.js"></script> <script type="text/javascript" src="jquery.cookie-1.4.1.min.js"></script> <script type="text/javascript" src="jquery.steps.1.1.0.min.js"></script> - - <script TYPE="text/javascript"> -<!-- - - // To confirm on a link (A HREF) - function request_confirm_link(my_url, my_message) { - question = confirm(my_message); - if (question !="0") { - top.location = my_url; - } - } - -function showhide(div){ - var oDiv = document.getElementById(div); - if(oDiv.style.display == "none"){ - oDiv.style.display = "block"; - }else{ - oDiv.style.display = "none"; - } -} - -function hide(div) { - var oDiv = document.getElementById(div); - oDiv.style.display = "none"; -} - -jQuery(function($){ - - $.widget( "custom.combobox", { - _create: function() { - this.wrapper = $( "<span>" ) - .addClass( "custom-combobox" ) - .insertAfter( this.element ); - - this.element.hide(); - this._createAutocomplete(); - this._createShowAllButton(); - }, - - _createAutocomplete: function() { - var selected = this.element.children( ":selected" ), - value = selected.val() ? selected.text() : ""; - - this.input = $( "<input>" ) - .appendTo( this.wrapper ) - .val( value ) - .attr( "title", "" ) - .addClass( "custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left error required" ) - .autocomplete({ - delay: 0, - minLength: 0, - source: $.proxy( this, "_source" ) - }) - .tooltip({ - tooltipClass: "ui-state-highlight" - }); - - this._on( this.input, { - autocompleteselect: function( event, ui ) { - ui.item.option.selected = true; - this._trigger( "select", event, { - item: ui.item.option - }); - }, - - autocompletechange: "_removeIfInvalid" - }); - }, - - _createShowAllButton: function() { - var input = this.input, - wasOpen = false; - - $( "<a>" ) - .attr( "tabIndex", -1 ) - .attr( "title", "Show All Items" ) - .tooltip() - .appendTo( this.wrapper ) - .button({ - icons: { - primary: "ui-icon-triangle-1-s" - }, - text: false - }) - .removeClass( "ui-corner-all" ) - .addClass( "custom-combobox-toggle ui-corner-right" ) - .mousedown(function() { - wasOpen = input.autocomplete( "widget" ).is( ":visible" ); - }) - .click(function() { - input.focus(); - - // Close if already visible - if ( wasOpen ) { - return; - } - - // Pass empty string as value to search for, displaying all results - input.autocomplete( "search", "" ); - }); - }, - - _source: function( request, response ) { - var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" ); - response( this.element.children( "option" ).map(function() { - var text = $( this ).text(); - if ( this.value && ( !request.term || matcher.test(text) ) ) - return { - label: text, - value: text, - option: this - }; - }) ); - }, - - _removeIfInvalid: function( event, ui ) { - - // Selected an item, nothing to do - if ( ui.item ) { - return; - } - - // Search for a match (case-insensitive) - var value = this.input.val(), - valueLowerCase = value.toLowerCase(), - valid = false; - this.element.children( "option" ).each(function() { - if ( $( this ).text().toLowerCase() === valueLowerCase ) { - this.selected = valid = true; - return false; - } - }); - - // Found a match, nothing to do - if ( valid ) { - return; - } - - // Remove invalid value - this.input - .val( "" ) - .attr( "title", value + " didn't match any item" ) - .tooltip( "open" ); - this.element.val( "" ); - this._delay(function() { - this.input.tooltip( "close" ).attr( "title", "" ); - }, 2500 ); - this.input.autocomplete( "instance" ).term = ""; - }, - - _destroy: function() { - this.wrapper.remove(); - this.element.show(); - } - }); -}); - -//--> -</script> + <script type="text/javascript" src="account-manager.js"></script> <title>[% title %]</title>