Bug 9894 - (3.12) Small followup

Liz's patch adds the 'flagged' value back, but there's a problem with its logic that prevents it to work on startup (works fine for changing values)

Regards
To+

Sponsored-by: Universidad Nacional de Córdoba
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This commit is contained in:
Tomás Cohen Arazi 2013-04-03 15:50:49 -03:00 committed by Jared Camins-Esakov
parent 0a91a071ef
commit a0680d0ca2

View file

@ -35,6 +35,16 @@ $(document).ready(function() {
}
}*/
/* Function to enable/disable hidden values checkboxes when Flag is (de)selected */
function enable_cb(tab) {
if ($("#hidden_flagged_" + tab).is(':checked')) {
$('.inclusive_' + tab).attr('disabled',true).removeAttr('checked');
}
else {
$('.inclusive_' + tab).removeAttr('disabled');
}
}
/* Function to serialize and set the 'hidden' field */
function setHiddenValue() {
@ -46,20 +56,6 @@ function setHiddenValue() {
var collapsed_checked = $("#hidden_collapsed_" + tab).is(':checked');
var hidden_value = "";
$(function() {
enable_cb();
$("#hidden_flagged_" + tab).click(enable_cb());
});
function enable_cb() {
if ($("#hidden_flagged_" + tab).is(':checked')) {
$('.inclusive_' + tab).attr('disabled',true).removeAttr('checked');
}
else {
$('.inclusive_' + tab).removeAttr('disabled');
}
}
if ( flagged_checked ) {
hidden_value='-8';
} else if ( opac_checked && ! intranet_checked && ! editor_checked && collapsed_checked ) {
@ -96,6 +92,8 @@ function setHiddenValue() {
hidden_value='8';
}
enable_cb(tab);
$('#hidden-' + tab).val(hidden_value);
}
@ -110,8 +108,6 @@ function populateHiddenCheckboxes(tab) {
var collapsed_checked = false;
var flagged_checked = false;
if ( hidden_value == '-8' ) {
flagged_checked = true;
} else if ( hidden_value == '-7') {
@ -163,12 +159,13 @@ function populateHiddenCheckboxes(tab) {
collapsed_checked = true;
} // else if ( hidden_value == '8') { skip }
$("#hidden_opac_" + tab).attr('checked',opac_checked);
$("#hidden_intranet_" + tab).attr('checked',intranet_checked);
$("#hidden_editor_" + tab).attr('checked',editor_checked);
$("#hidden_collapsed_" + tab).attr('checked',collapsed_checked);
$("#hidden_flagged_" + tab).attr('checked',flagged_checked);
enable_cb(tab);
}