9e9088049c
Currently translating Javascript strings with variables in them is hard, because the strings are created from separate parts. For example: _("Are you sure you want to delete the") + " " + count + " " + _("attached items?") This is translated in two different parts, and the translator cannot affect the place where the count-variable is. Now, if the javascript strings allowed placeholders, similar to how the template strings do, the above could be written as: _("Are you sure you want to delete the %s attached items?").format(count) This would make translation much easier. Attached patch adds a Javascript string formatter, and changes all the concatenated translatable JS strings used in intranet to use that. To test: 1) cd misc/translator 2) perl translate update xx-YY 3) grep ^msgid po/xx-YY-i-staff-t-prog-v-3006000.po | sort | uniq > xx-YY-pre 4) apply patch 5) perl translate update xx-YY 6) grep ^msgid po/xx-YY-i-staff-t-prog-v-3006000.po | sort | uniq > xx-YY-post 7) compare the files: diff -Nurd xx-YY-pre xx-yy-post | less should show the javascript strings that changed. 8) Test the UIs where the formatted js strings are used. Signed-off-by: Owen Leonard <oleonard@myacpl.org> I tested *most* of the changed files. There were some instances where it wasn't clear to me how to trigger the warnings which were modified, especially tags/review.tt, admin/manage-marc-import.tt, and holidays.tt. Everything I was able to test worked correctly. Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Works nicely, no regressions found. Thx! Signed-off-by: Galen Charlton <gmc@esilibrary.com>
370 lines
17 KiB
Text
370 lines
17 KiB
Text
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Authorities › [% IF ( authid ) %]Modify authority #[% authid %] ([% authtypetext %])[% ELSE %]Adding authority ([% authtypetext %])[% END %]</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
|
|
<script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
$(window).load(function(){
|
|
$("#loading").hide();
|
|
});
|
|
$(document).ready(function() {
|
|
$('#authoritytabs').tabs();
|
|
$('#toolbar').fixFloat();
|
|
$("#addauth").click(function(){
|
|
if(Check()){
|
|
$("#f").submit();
|
|
}
|
|
});
|
|
});
|
|
|
|
/**
|
|
* check if mandatory subfields are written
|
|
*/
|
|
function AreMandatoriesNotOk(){
|
|
var mandatories = new Array();
|
|
var mandatoriesfields = new Array();
|
|
var tab = new Array();
|
|
var label = new Array();
|
|
[% FOREACH BIG_LOO IN BIG_LOOP %]
|
|
[% FOREACH innerloo IN BIG_LOO.innerloop %]
|
|
[% IF ( innerloo.mandatory ) %]
|
|
mandatoriesfields.push(new Array("[% innerloo.tag %]","[% innerloo.index %][% innerloo.random %]","[% innerloo.index %]"));
|
|
[% END %]
|
|
[% FOREACH subfield_loo IN innerloo.subfield_loop %]
|
|
[% IF ( subfield_loo.mandatory ) %]mandatories.push("[% subfield_loo.id %]");
|
|
tab.push("[% subfield_loo.number %]");
|
|
label.push("[% subfield_loo.marc_lib |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]");
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
var StrAlert = "";
|
|
for(var i=0,len=mandatories.length; i<len ; i++){
|
|
var id_string = mandatories[i];
|
|
// alert (id_string);
|
|
if( ! $("#" + id_string).val() ){
|
|
$("#" + id_string).attr('class','subfield_not_filled').focus();
|
|
StrAlert += "\t* " + _("%s in tab %s").format(label[i], tab[i]) + "\n";
|
|
}
|
|
}
|
|
|
|
/* Check for mandatories field(not subfields) */
|
|
for(var i=0,len=mandatoriesfields.length; i<len; i++){
|
|
isempty = true;
|
|
arr = mandatoriesfields[i];
|
|
divid = "tag_" + arr[0] + "_" + arr[1];
|
|
varegexp = new RegExp("^tag_" + arr[0] + "_code_");
|
|
|
|
if(parseInt(arr[0]) >= 10){
|
|
elem = document.getElementById(divid);
|
|
eleminputs = elem.getElementsByTagName('input');
|
|
|
|
for(var j=0,len2=eleminputs.length; j<len2; j++){
|
|
|
|
if(eleminputs[j].name.match(varegexp) && eleminputs[j].value){
|
|
inputregexp = new RegExp("^tag_" + arr[0] + "_subfield_" + eleminputs[j].value + "_" + arr[2]);
|
|
|
|
for( var k=0; k<len2; k++){
|
|
if(eleminputs[k].id.match(inputregexp) && eleminputs[k].value){
|
|
isempty = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
isempty = false;
|
|
}
|
|
|
|
if(isempty){
|
|
flag = 1;
|
|
StrAlert += "\t* " + _("Field %s is mandatory, at least one of its subfields must be filled.").format(arr[0]) + "\n";
|
|
}
|
|
|
|
}
|
|
|
|
|
|
if(StrAlert){
|
|
return _("Can't save this record because the following field aren't filled :") + "\n\n" + StrAlert;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function Check(){
|
|
var StrAlert = AreMandatoriesNotOk();
|
|
if( ! StrAlert ){
|
|
document.f.submit();
|
|
return true;
|
|
} else {
|
|
alert(StrAlert);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function AddField(field,cntrepeatfield) {
|
|
document.forms['f'].op.value = "addfield";
|
|
document.forms['f'].addfield_field.value=field;
|
|
document.forms['f'].repeat_field.value=cntrepeatfield;
|
|
document.f.submit();
|
|
}
|
|
|
|
function addauthority() {
|
|
X = document.forms[0].authtype.value;
|
|
window.location="/cgi-bin/koha/authorities/authorities.pl?authtypecode="+X;
|
|
}
|
|
function searchauthority() {
|
|
X = document.forms[0].authtype2.value;
|
|
Y = document.forms[0].value.value;
|
|
window.location="/cgi-bin/koha/authorities/authorities-home.pl?op=do_search&type=intranet&authtypecode="+X+"&value="+Y+"&marclist=&and_or=and&excluding=&operator=contains";
|
|
}
|
|
function confirmnotdup(redirect){
|
|
$("#confirm_not_duplicate").attr("value","1");
|
|
Check();
|
|
}
|
|
//]]>
|
|
</script>
|
|
<link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
|
|
[% IF ( bidi ) %]
|
|
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/right-to-left.css" />
|
|
[% END %]
|
|
</head>
|
|
<body id="auth_authorities" class="auth">
|
|
|
|
<div id="loading">
|
|
<div>Loading, please wait...</div>
|
|
</div>
|
|
|
|
[% INCLUDE 'header.inc' %]
|
|
|
|
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a> › [% IF ( authid ) %]Modify authority #[% authid %] ([% authtypetext %])[% ELSE %]Adding authority [% authtypetext %][% END %] </div>
|
|
|
|
<div id="doc" class="yui-t7">
|
|
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-g">
|
|
|
|
[% IF ( authid ) %]
|
|
<h1>Modify authority #[% authid %] [% authtypetext %]</h1>
|
|
[% ELSE %]
|
|
<h1>Adding authority [% authtypetext %]</h1>
|
|
[% END %]
|
|
|
|
[% IF ( duplicateauthid ) %]
|
|
<div class="dialog alert">
|
|
<h4>Duplicate record suspected</h4>
|
|
<p>Is this a duplicate of <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% duplicateauthid %]" onclick="openWindow('/cgi-bin/koha/authorities/detail.pl?authid=[% duplicateauthid %]&popup=1', 'Duplicate authority','800','600'); return false;" class="button">[% duplicateauthvalue %]</a>?</p>
|
|
|
|
<form action="authorities.pl" method="get">
|
|
<input type="hidden" name="authid" value="[% duplicateauthid %]" />
|
|
<input type="submit" class="edit" value="Yes: Edit existing authority" />
|
|
</form>
|
|
<form action="authorities.pl" method="get">
|
|
<input type="button" value="No: Save as new authority" class="save" accesskey="w" onclick="confirmnotdup('items'); return false;" />
|
|
</form>
|
|
</div>
|
|
[% END %]
|
|
|
|
<form method="post" name="f" action="/cgi-bin/koha/authorities/authorities.pl">
|
|
<input type="hidden" name="op" value="add" />
|
|
<input type="hidden" name="addfield_field" value="" />
|
|
<input type="hidden" name="repeat_field" value="" />
|
|
<input type="hidden" name="authtypecode" value="[% authtypecode %]" />
|
|
<input type="hidden" name="authid" value="[% authid %]" />
|
|
<input type="hidden" name="index" value="[% index %]" />
|
|
<input type="hidden" value="0" id="confirm_not_duplicate" name="confirm_not_duplicate" />
|
|
|
|
<div id="toolbar" class="btn-toolbar">
|
|
<div class="btn-group"><a href="#" id="addauth" class="btn btn-small" accesskey="w"><i class="icon-hdd"></i> Save</a></div>
|
|
</div>
|
|
|
|
<div id="authoritytabs" class="toptabs numbered">
|
|
<ul>
|
|
[% FOREACH BIG_LOO IN BIG_LOOP %]
|
|
<li><a href="#tab[% BIG_LOO.number %]XX">[% BIG_LOO.number %]</a></li>
|
|
[% END %]
|
|
</ul>
|
|
|
|
[% FOREACH BIG_LOO IN BIG_LOOP %]
|
|
<div id="tab[% BIG_LOO.number %]XX">
|
|
|
|
[% FOREACH innerloo IN BIG_LOO.innerloop %]
|
|
[% IF ( innerloo.tag ) %]
|
|
<div class="tag clearfix" id="tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]">
|
|
<div class="tag_title" id="div_indicator_tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]">
|
|
[% UNLESS hide_marc %]
|
|
[% IF advancedMARCEditor %]
|
|
<a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib %] - Click to Expand this Tag" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;">[% innerloo.tag %]</a>
|
|
[% ELSE %]
|
|
<span title="[% innerloo.tag_lib %]">[% innerloo.tag %]</span>
|
|
[% END %]
|
|
[% IF ( innerloo.fixedfield ) %]
|
|
<input type="text"
|
|
tabindex="1"
|
|
class="indicator flat"
|
|
style="display:none;"
|
|
name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]"
|
|
size="1"
|
|
maxlength="1"
|
|
value="[% innerloo.indicator1 %]" />
|
|
<input type="text"
|
|
tabindex="1"
|
|
class="indicator flat"
|
|
style="display:none;"
|
|
name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]"
|
|
size="1"
|
|
maxlength="1"
|
|
value="[% innerloo.indicator2 %]" />
|
|
[% ELSE %]
|
|
<input type="text"
|
|
tabindex="1"
|
|
class="indicator flat"
|
|
name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]"
|
|
size="1"
|
|
maxlength="1"
|
|
value="[% innerloo.indicator1 %]" />
|
|
<input type="text"
|
|
tabindex="1"
|
|
class="indicator flat"
|
|
name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]"
|
|
size="1"
|
|
maxlength="1"
|
|
value="[% innerloo.indicator2 %]" />
|
|
[% END %] -
|
|
[% ELSE %]
|
|
[% IF ( innerloo.fixedfield ) %]
|
|
<input type="hidden"
|
|
tabindex="1"
|
|
name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]"
|
|
value="[% innerloo.indicator1 %]" />
|
|
<input type="hidden"
|
|
tabindex="1"
|
|
name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]"
|
|
value="[% innerloo.indicator2 %]" />
|
|
[% ELSE %]
|
|
<input type="hidden"
|
|
tabindex="1"
|
|
name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]"
|
|
value="[% innerloo.indicator1 %]" />
|
|
<input type="hidden"
|
|
tabindex="1"
|
|
name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]"
|
|
value="[% innerloo.indicator2 %]" />
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% UNLESS advancedMARCEditor %]
|
|
<a href="#" tabindex="1" class="expandfield" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Click to Expand this Tag">[% innerloo.tag_lib %]</a>
|
|
[% END %]
|
|
<span class="field_controls">
|
|
[% IF ( innerloo.repeatable ) %]
|
|
<a href="#" tabindex="1" class="buttonPlus" onclick="CloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]','[% hide_marc %]','[% advancedMARCEditor %]'); return false;" title="Repeat this Tag">
|
|
<img src="[% interface %]/[% theme %]/img/repeat-tag.png" alt="Repeat this Tag" />
|
|
</a>
|
|
[% END %]
|
|
<a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Delete this Tag">
|
|
<img src="[% interface %]/[% theme %]/img/delete-tag.png" alt="Delete this Tag" />
|
|
</a>
|
|
</span>
|
|
|
|
</div>
|
|
|
|
[% FOREACH subfield_loo IN innerloo.subfield_loop %]
|
|
<!-- One line on the marc editor -->
|
|
<div class="subfield_line" style="[% subfield_loo.visibility %]" id="subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]">
|
|
|
|
[% UNLESS advancedMARCEditor %]
|
|
[% IF ( subfield_loo.fixedfield ) %]<label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" style="display:none;" class="labelsubfield">
|
|
[% ELSE %]<label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" class="labelsubfield">
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% UNLESS hide_marc %]
|
|
<span class="subfieldcode">
|
|
[% IF ( subfield_loo.fixedfield ) %]
|
|
<img class="buttonUp" style="display:none;" src="[% interface %]/[% theme %]/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]')" alt="Move Up" title="Move Up" />
|
|
[% ELSE %]
|
|
<img class="buttonUp" src="[% interface %]/[% theme %]/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]')" alt="Move Up" title="Move Up" />
|
|
[% END %]
|
|
<input type="text"
|
|
title="[% subfield_loo.marc_lib_plain %]"
|
|
style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;"
|
|
name="tag_[% subfield_loo.tag %]_code_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]"
|
|
value="[% subfield_loo.subfield %]"
|
|
size="1"
|
|
maxlength="1"
|
|
class="flat"
|
|
tabindex="0" />
|
|
</span>
|
|
[% ELSE %]
|
|
<input type="hidden"
|
|
name="tag_[% subfield_loo.tag %]_code_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]"
|
|
value="[% subfield_loo.subfield %]" />
|
|
[% END %]
|
|
|
|
[% UNLESS advancedMARCEditor %]
|
|
[% IF ( subfield_loo.mandatory ) %]<span class="subfield subfield_mandatory">[% ELSE %]<span class="subfield">[% END %]
|
|
[% subfield_loo.marc_lib_plain %]
|
|
[% IF ( subfield_loo.mandatory ) %]<span class="mandatory_marker" title="This field is mandatory">*</span>[% END %]
|
|
</span>
|
|
</label>
|
|
[% END %]
|
|
|
|
[% subfield_loo.marc_value %]
|
|
|
|
<span class="subfield_controls">
|
|
[% IF ( subfield_loo.repeatable ) %]
|
|
<a href="#" class="buttonPlus" tabindex="1" onclick="CloneSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]','[% advancedMARCEditor %]'); return false;">
|
|
<img src="[% interface %]/[% theme %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
|
|
</a>
|
|
<a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]'); return false;">
|
|
<img src="[% interface %]/[% theme %]/img/delete-subfield.png" alt="Delete" title="Delete this subfield" />
|
|
</a>
|
|
[% END %]
|
|
</span>
|
|
|
|
</div>
|
|
<!-- End of the line -->
|
|
[% END %]
|
|
|
|
</div>
|
|
[% END %]<!-- if innerloo.tag -->
|
|
[% END %]<!-- BIG_LOO.innerloop -->
|
|
</div>
|
|
[% END %]<!-- BIG_LOOP -->
|
|
|
|
</div><!-- tabs -->
|
|
|
|
<div name="hidden" id="hidden" class="tab">
|
|
[% FOREACH hidden_loo IN hidden_loop %]
|
|
<input type="hidden" name="tag" value="[% hidden_loo.tag %]" />
|
|
<input type="hidden" name="subfield" value="[% hidden_loo.subfield %]" />
|
|
<input type="hidden" name="mandatory" value="[% hidden_loo.mandatory %]" />
|
|
<input type="hidden" name="kohafield" value="[% hidden_loo.kohafield %]" />
|
|
<input type="hidden" name="tag_mandatory" value="[% hidden_loo.tag_mandatory %]" />
|
|
[% END %]
|
|
</div>
|
|
[% IF ( oldauthnumtagfield ) %]
|
|
<input type="hidden" name="tag" value="[% oldauthnumtagfield %]" />
|
|
<input type="hidden" name="subfield" value="[% oldauthnumtagsubfield %]" />
|
|
<input type="hidden" name="field_value" value="[% authid %]" />
|
|
<input type="hidden" name="mandatory" value="0" />
|
|
<input type="hidden" name="kohafield" value="[% kohafield %]" />
|
|
<input type="hidden" name="tag_mandatory" value="[% tag_mandatory %]" />
|
|
<input type="hidden" name="tag" value="[% oldauthtypetagfield %]" />
|
|
<input type="hidden" name="subfield" value="[% oldauthtypetagsubfield %]" />
|
|
<input type="hidden" name="field_value" value="[% authtypecode %]" />
|
|
[% END %]
|
|
|
|
<fieldset class="action">
|
|
<input type="button" id="addauth2" value="Save" onclick="Check(this.form)" accesskey="w" />
|
|
</fieldset>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|