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