diff -r a1234ceba912 -r 5f038a505cd7 Resources/public/js/wikiTag.js --- a/Resources/public/js/wikiTag.js Fri Oct 21 19:22:06 2011 +0200 +++ b/Resources/public/js/wikiTag.js Mon Oct 24 18:45:34 2011 +0200 @@ -111,10 +111,10 @@ submitdata: { csrfmiddlewaretoken:global_csrf_token, wikitag_document_id:$('#wikitag_document_id').val(), - num_page:$('#num_page').val(), - nb_by_page:$('#nb_by_page').val(), - sort:$('#sort').val(), - searched:$('#searched_str').val() + num_page:(('num_page' in getUrlVars()) ? getUrlVars()['num_page'] : undefined), + nb_by_page:(('nb_by_page' in getUrlVars()) ? getUrlVars()['nb_by_page'] : undefined), + sort:((('sort' in getUrlVars()) && (typeof(getUrlVars()['sort'])=="string")) ? getUrlVars()['sort'] : undefined), + searched:(('searched' in getUrlVars()) ? getUrlVars()['searched'] : undefined) }, callback : function(value, settings) { $('#wikitag_table_container').html(value); @@ -122,6 +122,13 @@ } }); + /* + + num_page:$('#num_page').val(), + nb_by_page:$('#nb_by_page').val(), + sort:$('#sort').val(), + searched:$('#searched_str').val() + */ // Tag table drag and drop $("#wikitag_table").tableDnD({ onDragClass: "wikitag_dragged_row", @@ -212,28 +219,6 @@ reorder_tags(); } }); - /* - // Validate sheet management : the radiobutton name has is "'gr_validated' + datasheet.hda_id" - $("#validated").click(function(e){ - e.preventDefault(); - // We count the number of tags. It has to be between 5 and 25 - var nb_tags = $('#tag_table tr').length - 1; - if(nb_tags<5 || nb_tags>25){ - alert("Cette fiche n'est pas validable : elle doit contenir entre 5 et 25 tags."); - } - else{ - if(confirm("Confirmez-vous la validation de cette fiche ? Elle contient " + nb_tags + " tags.")){ - window.location = validate_datasheet_url + "/" + $('#wikitag_document_id').val() + "/true"; - } - } - }); - $("#not_validated").click(function(e){ - e.preventDefault(); - if(confirm("Confirmez-vous l'invalidation de cette fiche ?")){ - window.location = validate_datasheet_url + "/" + $('#wikitag_document_id').val() + "/false"; - } - }); - */ } function wikitag_update_tag(btn) @@ -366,3 +351,17 @@ }); } +function getUrlVars() +{ + var vars = [], hash; + if(window.location.href.indexOf('?')>=0){ + var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); + for(var i = 0; i < hashes.length; i++) + { + hash = hashes[i].split('='); + vars.push(hash[0]); + vars[hash[0]] = hash[1]; + } + } + return vars; +}