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