Lines 88-95
$(document).ready(function(){
Link Here
|
88 |
}); |
88 |
}); |
89 |
|
89 |
|
90 |
function Check(f) { |
90 |
function Check(f) { |
91 |
var total_errors = CheckMandatorySubfields(f); |
91 |
var total_mandatory = CheckMandatorySubfields(f); |
92 |
if (total_errors==0) { |
92 |
var total_important = CheckImportantSubfields(f); |
|
|
93 |
var alertString2; |
94 |
if (total_mandatory==0) { |
93 |
// Explanation about this line: |
95 |
// Explanation about this line: |
94 |
// In case of limited edition permission, we have to prevent user from modifying some fields. |
96 |
// In case of limited edition permission, we have to prevent user from modifying some fields. |
95 |
// But there is no such thing as readonly attribute for select elements. |
97 |
// But there is no such thing as readonly attribute for select elements. |
Lines 97-108
function Check(f) {
Link Here
|
97 |
// So we "un-disable" the elements just before submitting. |
99 |
// So we "un-disable" the elements just before submitting. |
98 |
// That's a bit clumsy, and if someone comes up with a better solution, feel free to improve that. |
100 |
// That's a bit clumsy, and if someone comes up with a better solution, feel free to improve that. |
99 |
$("select[name=field_value]").prop('disabled', false); |
101 |
$("select[name=field_value]").prop('disabled', false); |
100 |
return true; |
|
|
101 |
} else { |
102 |
} else { |
102 |
var alertString2 = _("Form not submitted because of the following problem(s)"); |
103 |
alertString2 = _("Form not submitted because of the following problem(s)"); |
103 |
alertString2 += "\n------------------------------------------------------------------------------------\n"; |
104 |
alertString2 += "\n------------------------------------------------------------------------------------\n"; |
104 |
alertString2 += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors); |
105 |
alertString2 += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_mandatory); |
105 |
alert(alertString2); |
106 |
} |
|
|
107 |
if(total_important > 0){ |
108 |
if( !alertString2 ){ |
109 |
alertString2 = ""; |
110 |
} |
111 |
alertString2 += "\n\n " + _("%s important field(s) empty (highlighted)").format(total_important); |
112 |
alertString2 += "\n\n " + _("Are you sure you want to save?"); |
113 |
} |
114 |
if(alertString2){ |
115 |
if(total_mandatory){ |
116 |
alert(alertString2); |
117 |
}else{ |
118 |
var a = confirm(alertString2); |
119 |
if( a ){ |
120 |
return true; |
121 |
} |
122 |
} |
106 |
return false; |
123 |
return false; |
107 |
} |
124 |
} |
108 |
return true; |
125 |
return true; |
Lines 320-331
function confirm_deletion() {
Link Here
|
320 |
<input type="hidden" name="tag" value="[% ite.tag %]" /> |
337 |
<input type="hidden" name="tag" value="[% ite.tag %]" /> |
321 |
<input type="hidden" name="subfield" value="[% ite.subfield %]" /> |
338 |
<input type="hidden" name="subfield" value="[% ite.subfield %]" /> |
322 |
<input type="hidden" name="mandatory" value="[% ite.mandatory %]" /> |
339 |
<input type="hidden" name="mandatory" value="[% ite.mandatory %]" /> |
|
|
340 |
<input type="hidden" name="important" value="[% ite.important %]" /> |
323 |
[% IF ( ite.repeatable ) %] |
341 |
[% IF ( ite.repeatable ) %] |
324 |
<a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;"> |
342 |
<a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;"> |
325 |
<img src="[% interface %]/[% theme %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" /> |
343 |
<img src="[% interface %]/[% theme %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" /> |
326 |
</a> |
344 |
</a> |
327 |
[% END %] |
345 |
[% END %] |
328 |
[% IF ( ite.mandatory ) %] <span class="required">Required</span>[% END %] |
346 |
[% IF ( ite.mandatory ) %] <span class="required">Required</span> |
|
|
347 |
[% ELSIF ( ite.important ) %] <span class="important" style="font-style: italic; margin-left: .5em;">Important</span> |
348 |
[% END %] |
329 |
</div></li> |
349 |
</div></li> |
330 |
[% END %] |
350 |
[% END %] |
331 |
</ol> |
351 |
</ol> |