Skip to content
Snippets Groups Projects
Commit 78b1d6b8 authored by Deleted User's avatar Deleted User
Browse files

Correction des labels non sélectionnés qui n'étaient pas mis à jour lors du setup_session()

parent 91371110
No related branches found
No related tags found
1 merge request!57Correction des labels non sélectionnés qui n'étaient pas mis à jour lors du setup_session()
......@@ -61,10 +61,32 @@ function save_session() {
}
function setup_session() {
hierarchy.old_labels_tab = str_to_tab(getCookie('old_labels_tab'));
hierarchy.unselect_tab = str_to_tab(getCookie('unselect_labels_tab'));
hierarchy.labels_language = result.labels_language = getCookie('language');
hierarchy.init_all_labels();
result.maj_results(3);
hierarchy.maj_new_labels_tab();
}
/**
* Return 0 no cookies are found return 0.
* Else return 1 if old_tab cookie are found => the initialization of tutos
* and labels is done from the labels contained in old_tab.
* If language cookie are found, juste th language is modified => labels tab's
* need to be initialise (return 0).
*/
var success = 0;
if (getCookie('language') != null && getCookie('language').length != 0)
hierarchy.labels_language = result.labels_language = getCookie('language');
if (getCookie('old_labels_tab') != null && getCookie('old_labels_tab').length != 0)
hierarchy.old_labels_tab = str_to_tab(getCookie('old_labels_tab'));
if (getCookie('unselect_labels_tab') != null && getCookie('unselect_labels_tab').length != 0)
hierarchy.unselect_tab = str_to_tab(getCookie('unselect_labels_tab'));
if (getCookie('old_labels_tab') != null && getCookie('old_labels_tab').length != 0) {
hierarchy.init_all_labels();
result.maj_results(3);
success = 1;
} else if (getCookie('unselect_labels_tab') != null && getCookie('unselect_labels_tab').length != 0) {
hierarchy.init_all_labels();
result.init_result_tab();
del_unselect_language();
result.del_unselected_results();
hierarchy.maj_new_labels_tab();
success = 1;
}
return (success);
}
\ No newline at end of file
......@@ -148,9 +148,12 @@
* Initialise the two different par of hierarcy and
* the array that contain all tutos.
*/
hierarchy.init_all_labels();
hierarchy.init_new_labels_tab();
result.init_result_tab();
setup = setup_session();
if (setup == 0) {
hierarchy.init_all_labels();
hierarchy.init_new_labels_tab();
result.init_result_tab();
}
}
function update_loading(value) {
......@@ -250,6 +253,7 @@
this.new_labels_tab = research(this.new_labels_tab, this.all_labels);
this.old_labels_tab = research(this.old_labels_tab, this.all_labels);
this.unselect_tab = research(this.unselect_tab, this.all_labels);
save_session();
update_loading(1);
},
add_label_to_old_tab: function(index, source) {
......@@ -268,6 +272,7 @@
this.unselect_tab.splice(index, 1);
result.maj_results(3);
}
save_session();
update_loading(1);
},
rm_label_of_old_tab: function(index) {
......@@ -320,7 +325,7 @@
hierarchy.maj_new_labels_tab();
} else
result.maj_results(3);
save_session();
save_session();
update_loading(1);
},
maj_new_labels_tab: function() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment