Koha/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt
Owen Leonard 65d46ca2d1 Bug 9622 - Replace YUI button on MARC fameworks page with Bootstrap
This patch converts the toolbar on the MARC frameworks administration
page to to Bootstrap, replacing YUI button code with Bootstrap markup.

To test, view the MARC frameworks administration page and confirm that
the "New framework" button looks correct and works correctly.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Comment: Work as described. No errors. Look good.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works nicely, no problems found.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-02-18 08:05:33 -05:00

289 lines
16 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Administration &rsaquo; MARC frameworks
[% IF ( add_form ) %]
&rsaquo; [% IF ( frameworkcode ) %]Modify framework text[% ELSE %]Add framework[% END %]
[% ELSIF ( delete_confirm ) %]
&rsaquo; Delete framework for [% frameworktext %] ([% frameworkcode %])?
[% END %]
</title>
[% INCLUDE 'doc-head-close.inc' %]
<script type="text/javascript">
//<![CDATA[
function isNotNull(f,noalert) {
if (f.value.length ==0) {
return false;
}
return true;
}
function toUC(f) {
f.value = f.value.toUpperCase();
return true;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function Check(f) {
var ok=1;
var _alertString="";
var alertString2;
if (f.frameworkcode.value.length==0) {
_alertString += "\n- " + _("Framework code missing");
}
if (!(isNotNull(window.document.Aform.frameworktext))) {
_alertString += "\n- " + _("Description missing");
}
if (_alertString.length==0) {
document.Aform.submit();
} else {
alertString2 = _("Form not submitted because of the following problem(s)");
alertString2 += "\n------------------------------------------------------------------------------------\n";
alertString2 += _alertString;
alert(alertString2);
return false;
}
return true;
}
//]]>
</script>
<script type="text/javascript">
/* Import/Export from/to spreadsheet */
var importing = false;
$(document).ready(function() {
$("body").css("cursor", "auto");
$('.import_export_options').hide();
$('a.import_export_fw').click(function() {
if (!importing) {
$('.import_export_options').hide();
$(this).next().show('slide');
}
return false;
});
$('.import_export_close').click(function() {
if (!importing) {
$('.import_export_options').fadeOut('fast');
$("body").css("cursor", "auto");
return false;
}
});
$('.input_import').val("");
var matches = new RegExp("\\?error_import_export=(.+)$").exec(window.location.search);
if (matches && matches.length > 1) {
alert(_("Error importing the framework ") + decodeURIComponent(matches[1]));
}
$('input.input_import').change( function() {
var filename = $(this).val();
if ( ! /(?:\.csv|\.sql|\.ods|\.xml)$/.test(filename)) {
$(this).css("background-color","yellow");
alert(_("Please select an ods or xml file"));
$(this).val("");
$(this).css("background-color","white");
}
});
$('form.form_export').submit(function() {
$('.import_export_options').hide();
return true;
});
$('form.form_import').submit(function() {
var id = $(this).attr('id');
var obj = $('#' + id + ' input:file');
if (/(?:\.csv|\.sql|\.ods|\.xml)$/.test(obj.val())) {
if (confirm(_("Do you really want to import the framework fields and subfields? This will overwrite the current configuration. For safety reasons please use the export option to make a backup"))) {
var frameworkcode = $('#' + id + ' input:hidden[name=frameworkcode]').val();
$('#importing_' + frameworkcode).find("span").html(_("Importing to framework:")+"<strong>" + frameworkcode + "</strong><br />" +_("Importing from file:")+"<i>" + obj.val().replace(new RegExp("^.+[/\\\\]"),"") + "</i>");
if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) {
var timestamp = new Date().getTime();
$('#importing_' + frameworkcode).find("img").attr('src', '/intranet-tmpl/prog/img/loading-small.gif' + '?' +timestamp);
}
$('#importing_' + frameworkcode).css('display', 'block');
if (navigator.userAgent.toLowerCase().indexOf('firefox') == -1) $("body").css("cursor", "progress");
importing = true;
return true;
} else
return false;
}
obj.css("background-color","yellow");
alert(_("Please select an spreadsheet (csv, ods, xml) or sql file"));
obj.val("");
obj.css("background-color","white");
return false;
});
});
</script>
</head>
<body id="admin_biblio_framework" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
&rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
&rsaquo; <a href="/cgi-bin/koha/admin/biblio_framework.pl">MARC frameworks</a>
[% IF ( add_form ) %]
&rsaquo; [% IF ( frameworkcode ) %]Modify framework text[% ELSE %]Add framework[% END %]
[% ELSIF ( delete_confirm ) %]
&rsaquo; Delete framework for [% frameworktext %] ([% frameworkcode %])?
[% END %]
</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% IF ( else ) %]
<div id="toolbar" class="btn-toolbar">
<a class="btn btn-small" id="newframework" href="/cgi-bin/koha/admin/biblio_framework.pl?op=add_form"><i class="icon-plus"></i> New framework</a>
</div>
[% END %]
[% IF ( add_form ) %]
<h1>[% IF ( frameworkcode ) %]Modify framework text[% ELSE %]Add framework[% END %]</h1>
<form action="[% script_name %]" name="Aform" method="post" onsubmit="return Check(this);">
<input type="hidden" name="op" value="add_validate" />
<fieldset class="rows">
<ol>
[% IF ( frameworkcode ) %]
<li><span class="label">Framework code</span><input type="hidden" id="frameworkcode" name="frameworkcode" value="[% frameworkcode %]" />[% frameworkcode %]
<input type="hidden" name="modif" value="1" />
</li>
[% ELSE %]
<li><label for="frameworkcode">Framework code</label><input type="text" id="frameworkcode" name="frameworkcode" size="4" maxlength="4" onblur="toUC(this)" /></li>
[% END %]
<li><label for="description">Description</label>
<input type="text" name="frameworktext" id="description" size="40" maxlength="80" value="[% frameworktext |html %]" /></li></ol></fieldset>
<fieldset class="action"> <input type="submit" value="Submit" class="submit" /></fieldset>
</form>
[% END %]
[% IF ( delete_confirm ) %]
<div class="dialog alert">
<h3>Delete framework for [% frameworktext %] ([% frameworkcode %])?</h3>
[% IF ( total ) %]
<p><strong>This framework is used [% total %] times</strong>.</p>
[% END %]
<form class="inline" action="[% script_name %]" method="post"><input type="hidden" name="op" value="delete_confirmed" /><input type="hidden" name="frameworkcode" value="[% frameworkcode %]" /><input type="submit" class="approve" value="Yes, delete this framework!" />
</form>
<form class="inline" action="[% script_name %]" method="get"><input type="submit" class="deny" value="No, do not delete!" /></form>
</div>
[% END %]
[% IF ( else ) %]
<h1>MARC frameworks</h1>
<p>Framework name, then go to MARC biblio to set MARC editor parameters</p>
<table>
<tr>
<th>Code</th>
<th>Description</th>
<th>&nbsp;</th>
<th>Edit</th>
<th>Delete</th>
<th title="Export framework structure (fields, subfields) to a spreadsheet file (.csv, .xml, .ods) or SQL file">Export</th>
<th title="Import framework structure (fields, subfields) from a spreadsheet file (.csv, .xml, .ods) or SQL file">Import</th>
</tr>
<tr>
<td>&nbsp;</td>
<td>Default framework</td>
<td><a href="marctagstructure.pl?frameworkcode=[% frameworkcode %]">MARC structure</a></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><div class="import_export"><a class="import_export_fw" href="#" title="Export [% frameworkcode %] framework structure (fields, subfields) to a spreadsheet file (.csv, .xml, .ods) or SQL file">Export</a>
<div class="import_export_options">
<form action="import_export_framework.pl" name="form_[% frameworkcode %]" method="get" target="_blank" class="form_export">
<fieldset class="rows">
<legend>Export framework</legend>
<input type="hidden" name="frameworkcode" value="[% frameworkcode %]" />
<ol>
<li><label for="csv_type_export_[% frameworkcode %]">Export to CSV spreadsheet</label><input type="radio" name="type_export_[% frameworkcode %]" value="csv" id="csv_type_export_[% frameworkcode %]" checked="checked" /></li>
<li><label for="xml_type_export_[% frameworkcode %]">Export to Excel with XML format, compatible with OpenOffice/LibreOffice as well</label><input type="radio" name="type_export_[% frameworkcode %]" value="excel" id="xml_type_export_[% frameworkcode %]" /></li>
<li><label for="ods_type_export_[% frameworkcode %]">Export to OpenDocument spreadsheet format</label><input type="radio" name="type_export_[% frameworkcode %]" value="ods" id="ods_type_export_[% frameworkcode %]" /></li>
<li><label for="sql_type_export_[% frameworkcode %]">Export to SQL</label><input type="radio" name="type_export_[% frameworkcode %]" value="sql" id="sql_type_export_[% frameworkcode %]" /></li>
</ol>
</fieldset>
<fieldset class="action"><input type="submit" href="#" value="Export" title="Export to a spreadsheet" /> <a href="#" class="import_export_close cancel">Cancel</a> </fieldset>
</form>
</div>
</div>
</td>
<td><div class="import_export"><a href="#" class="import_export_fw" title="Import [% frameworkcode %] framework structure (fields, subfields) from a spreadsheet file (.csv, .xml, .ods) or SQL file">Import</a>
<div class="import_export_options">
<form action="/cgi-bin/koha/admin/import_export_framework.pl" name="form_i_[% frameworkcode %]" id="form_i_[% frameworkcode %]" method="post" enctype="multipart/form-data" class="form_import">
<fieldset class="rows">
<legend>Import [% frameworkcode %] framework structure (fields and subfields) from a spreadsheet file (.csv, .xml, .ods) or SQL file</legend>
<input type="hidden" name="frameworkcode" value="[% frameworkcode %]" />
<input type="hidden" name="action" value="import" />
<ol>
<li><label for="d_file_import_[% frameworkcode %]">Upload file:</label><input type="file" name="file_import_[% frameworkcode %]" id="d_file_import_[% frameworkcode %]" class="input_import" value="" autocomplete="off" /></li>
<li><div id="importing_[% frameworkcode %]" style="display:none" class="importing"><img src="/intranet-tmpl/prog/img/loading-small.gif" /><span class="importing_msg"></span></div></li>
</ol>
</fieldset>
<fieldset class="action"><input type="submit" value="Import" /> <a href="#" class="import_export_close cancel">Cancel</a> </fieldset>
</form>
</div>
</div>
</td>
</tr>
<!-- note highlight assignment appears backwards because we already have a normal row for Default -->
[% FOREACH loo IN loop %]
[% IF ( loop.odd ) %]<tr class="highlight">
[% ELSE %]<tr>
[% END %]
<td>[% loo.frameworkcode %]</td>
<td>[% loo.frameworktext %]</td>
<td><a href="marctagstructure.pl?frameworkcode=[% loo.frameworkcode %]" >MARC structure</a></td>
<td><a href="[% loo.script_name %]?op=add_form&amp;frameworkcode=[% loo.frameworkcode |html %]">Edit</a></td>
<td><a href="[% loo.script_name %]?op=delete_confirm&amp;frameworkcode=[% loo.frameworkcode |html %]">Delete</a></td>
<td>
<div class="import_export"><a class="import_export_fw" href="#" title="Export [% loo.frameworkcode %] framework structure (fields and subfields) to a spreadsheet file (.csv, .xml, .ods) or SQL file">Export</a>
<div class="import_export_options">
<form action="import_export_framework.pl" name="form_[% loo.frameworkcode %]" method="get" target="_blank" class="form_export">
<fieldset class="rows">
<legend>Export framework</legend>
<input type="hidden" name="frameworkcode" value="[% loo.frameworkcode %]" />
<ol>
<li><label for="csv_type_export_[% loo.frameworkcode %][% loop.count %]">Export to CSV spreadsheet</label><input type="radio" name="type_export_[% loo.frameworkcode %]" value="csv" id="csv_type_export_[% loo.frameworkcode %][% loop.count %]" checked="checked" /></li>
<li><label for="xml_type_export_[% loo.frameworkcode %][% loop.count %]">Export to Excel as XML format, compatible with OpenOffice/LibreOffice as well</label><input type="radio" name="type_export_[% loo.frameworkcode %]" value="excel" id="xml_type_export_[% loo.frameworkcode %][% loop.count %]" /></li>
<li><label for="ods_type_export_[% loo.frameworkcode %][% loop.count %]">Export to OpenDocument spreadsheet format</label><input type="radio" name="type_export_[% loo.frameworkcode %]" value="ods" id="ods_type_export_[% loo.frameworkcode %][% loop.count %]" /></li>
<li><label for="sql_type_export_[% loo.frameworkcode %][% loop.count %]">Export to SQL</label><input type="radio" name="type_export_[% loo.frameworkcode %]" value="sql" id="sql_type_export_[% loo.frameworkcode %][% loop.count %]" /></li>
</ol>
</fieldset>
<fieldset class="action"><input type="submit" href="#" value="Export" title="Export to a spreadsheet" /> <a href="#" class="cancel import_export_close">Cancel</a> </fieldset>
</form>
</div>
</div>
</td>
<td><div class="import_export"><a class="import_export_fw" href="#" title="Import [% loo.frameworkcode %] framework structure (fields and subfields) from a spreadsheet file (.csv, .xml, .ods) or SQL file">Import</a>
<div class="import_export_options">
<form action="/cgi-bin/koha/admin/import_export_framework.pl" name="form_i_[% loo.frameworkcode %]" id="form_i_[% loo.frameworkcode %]" method="post" enctype="multipart/form-data" class="form_import">
<fieldset class="rows">
<legend>Import [% frameworkcode %] framework structure (fields and subfields) from a spreadsheet file (.csv, .xml, .ods) or SQL file</legend>
<input type="hidden" name="frameworkcode" value="[% loo.frameworkcode %]" />
<input type="hidden" name="action" value="import" />
<ol>
<li><label for="file_import_[% loo.frameworkcode %]">Upload file:</label><input type="file" name="file_import_[% loo.frameworkcode %]" id="file_import_[% loo.frameworkcode %]" class="input_import" value="" autocomplete="off" /></li>
</ol>
</fieldset>
<fieldset class="action"><input type="submit" value="Import" /><div id="importing_[% loo.frameworkcode %]" style="display:none" class="importing"><img src="/intranet-tmpl/prog/img/loading-small.gif" /><span class="importing_msg"></span></div> <a href="#" class="cancel import_export_close">Cancel</a> </fieldset>
</form>
</div>
</div>
</td>
</tr>
[% END %]
</table>
[% IF ( previous ) %]<a href="[% previous %]">&lt;&lt; Previous</a>[% END %]
[% IF ( next ) %]<a href="[% next %]">Next &gt;&gt;</a>[% END %]
[% END %]
</div>
</div>
<div class="yui-b">
[% INCLUDE 'admin-menu.inc' %]
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]