David Cook
7f8c59edaa
This patch removes the whitespace from arguments to the "name" parameter in "window.open". It also adds a trap for the "openWindow" helper function, which will use a "null" instead of a "name" if window.open isn't able to handle a name with whitespace (i.e. if it's IE <= 9). _TEST PLAN_ 1) Switch to an emulated or authentic Internet Explorer version E 9 or lower 2) Click "Help" 3) Note that it opens the page in the current window rather than as a popup 4) Apply the patch 5) Shift refresh your page 6) Click "Help" 7) Note that it now opens (correctly) as a pop-up (If you want to be more thorough, you can test in other browsers as well to make sure that it still works.) Tested with IE 10 developer tools: IE7, IE 8, IE 9 Window pops up as expected. No regression found with IE 10 / FF31.0 Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Tested for regressions in Firefox and Chromium. I checked the help and the duplicate authorities windows still work correctly. Passes tests and QA script. Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
396 lines
19 KiB
Text
396 lines
19 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', 'DuplicateAuthority','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 %]
|
|
|
|
[% SET mv = subfield_loo.marc_value %]
|
|
[% IF ( mv.type == 'select' ) %]
|
|
<select name="[%- mv.name -%]" tabindex="1" size="1" class="input_marceditor" id="[%- mv.id -%]">
|
|
[% FOREACH aval IN mv.values %]
|
|
[% IF aval == mv.default %]
|
|
<option value="[%- aval -%]" selected="selected">[%- mv.labels.$aval -%]</option>
|
|
[% ELSE %]
|
|
<option value="[%- aval -%]">[%- mv.labels.$aval -%]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
[% ELSIF ( mv.type == 'text1' ) %]
|
|
<input type="text" id="[%- mv.id -%]" name="[%- mv.id -%]" value="[%- mv.value -%]" class="input_marceditor" tabindex="1" />
|
|
<a href="#" class="buttonDot" onclick="openAuth(this.parentNode.getElementsByTagName('input')[1].id,'[%- mv.authtypecode -%]','auth'); return false;" tabindex="1" title="Tag editor">...</a>
|
|
[% ELSIF ( mv.type == 'text2' ) %]
|
|
<input tabindex="1" type="text" id="[%- mv.id -%]" size="67" maxlength="[%- mv.maxlength -%]" name="[%- mv.id -%]" value="[%- mv.value -%]" class="input_marceditor" onfocus="Focus[%- mv.function -%]([%- mv.index_tag -%])" onblur="Blur[%- mv.function -%]([%- mv.index_tag -%]);" />
|
|
<a href="#" class="buttonDot" onclick="Clic[%- mv.function -%]('[%- mv.id -%]'); return false;" title="Tag editor">...</a>
|
|
[% mv.javascript %]
|
|
[% ELSIF ( mv.type == 'text' ) %]
|
|
<input type="text" id="[%- mv.id -%]" name="[%- mv.name -%]" value="[%- mv.value -%]" class="input_marceditor" tabindex="1" size="67" maxlength="[%- mv.maxlength -%]" />
|
|
[% ELSIF ( mv.type == 'textarea' ) %]
|
|
<textarea cols="70" rows="4" id="[%- mv.id -%]" name="[%- mv.name -%]" class="input_marceditor" tabindex="1" size="67" maxlength="[%- mv.maxlength -%]">[%- mv.value -%]</textarea>
|
|
[% ELSIF ( mv.type == 'hidden' ) %]
|
|
<input tabindex="1" type="hidden" id="[%- mv.id -%]" name="[%- mv.name -%]" size="67" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" />
|
|
[% ELSIF ( mv.type == 'hidden_simple' ) %]
|
|
<input type="hidden" name="[%- mv.name -%]" />
|
|
[% END %]
|
|
|
|
<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' %]
|