if (id != 0) { document.location = "/cgi-bin/koha/tools/csv-profiles.pl?id=" + id; }
}
$(document).ready(function() {
- $('#csvexporttabs > ul').tabs();
+ $('#csvexporttabs').tabs();
+
+ $("#profile_type").find("option:first").attr("selected", "selected");
+ $("#csvnew").find("li.marc_specific").show();
+ $("#csvnew").find("li.sql_specific").hide();
+
+ $("#profile_type").change(function(){
+ if ( $(this).find("option:selected").val() == "marc" ) {
+ $("#csvnew li.marc_specific").show();
+ $("#new_profile_marc_content").attr("required", "required");
+ $("#csvnew li.sql_specific").hide();
+ $("#new_profile_sql_content").removeAttr("required");
+ } else {
+ $("#csvnew li.marc_specific").hide();
+ $("#new_profile_marc_content").removeAttr("required");
+ $("#csvnew li.sql_specific").show();
+ $("#new_profile_sql_content").attr("required", "required");
+ }
+ });
+ $("#modify_profile_type").change(function(){
+ if ( $(this).find("option:selected").val() == "marc" ) {
+ $("#csvedit li.marc_specific").show();
+ $("#modify_profile_marc_content").attr("required", "required");
+ $("#csvedit li.sql_specific").hide();
+ $("#modify_profile_sql_content").removeAttr("required");
+ } else {
+ $("#csvedit li.marc_specific").hide();
+ $("#modify_profile_marc_content").removeAttr("required");
+ $("#csvedit li.sql_specific").show();
+ $("#modify_profile_sql_content").attr("required", "required");
+ }
+ });
+ $("#profile_type").change();
+ $("#modify_profile_type").change();
});
//]]>
</script>
<div class="yui-b">
[% IF ( success || error ) %]
[% IF ( success ) %]
- [% IF ( action == 'create' ) %]<p>The new CSV profile "[% profile_name %]" has been successfully created.</p>[% END %]
- [% IF ( action == 'edit' ) %]<p>The CSV profile has been successfully modified.</p>[% END %]
- [% IF ( action == 'delete' ) %]<p>The CSV profile has been successfully deleted.</p>[% END %]
- [% ELSE %]
- [% IF ( action == 'create' ) %]<p class="error">The new CSV profile "[% profile_name %]" has not been created.</p>[% END %]
- [% IF ( action == 'edit' ) %]<p class="error">The CSV profile has not been modified.</p>[% END %]
- [% IF ( action == 'delete' ) %]<p class="error">The CSV profile has not been deleted.</p>[% END %]
+ [% IF ( action == 'create' ) %]<div class="dialog message">The new CSV profile "[% profile_name %]" has been successfully created.</div>[% END %]
+ [% IF ( action == 'edit' ) %]<div class="dialog message">The CSV profile has been successfully modified.</div>[% END %]
+ [% IF ( action == 'delete' ) %]<div class="dialog message">The CSV profile has been successfully deleted.</div>[% END %]
+ [% ELSE %]
+ [% IF ( action == 'create' ) %]<div class="dialog alert">The new CSV profile "[% profile_name %]" has not been created.</div>[% END %]
+ [% IF ( action == 'edit' ) %]<div class="dialog alert">The CSV profile has not been modified.</div>[% END %]
+ [% IF ( action == 'delete' ) %]<div class="dialog alert">The CSV profile has not been deleted.</div>[% END %]
[% END %]
[% END %]
<div id="csvexporttabs" class="toptabs">
<ul>
- <li><a href="csv-profiles.pl#csvnew">New profile</a></li>
+ <li><a href="#csvnew">New profile</a></li>
[% IF ( existing_profiles ) %]
[% IF ( selected_profile_id ) %]
- <li class="ui-tabs-selected">
+ <li class="ui-tabs-active">
[% ELSE %]
<li>
[% END %]
- <a href="csv-profiles.pl#csvedit">Edit existing profile</a></li> [% END %]
+ <a href="#csvedit">Edit existing profile</a></li> [% END %]
</ul>
<div id="csvnew">
<h3>New CSV export profile</h3>
- <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="post">
+ <form action="/cgi-bin/koha/tools/csv-profiles.pl" class="validated" method="post">
<fieldset class="rows">
- <ol><li><label for="profile_name" class="required">Profile name: </label>
- <input type="text" id="profile_name" name="profile_name" /></li>
+ <ol>
+ <li>
+ <label for="profile_name" class="required">Profile name: </label>
+ <input type="text" id="profile_name" name="profile_name" required="required" />
+ <span class="required">Required</span>
+ </li>
+
+ <li>
+ <label for="profile_type" class="required">Profile type: </label>
+ <select id="profile_type" name="profile_type">
+ <option value="marc" selected="selected">MARC</option>
+ <option value="sql">SQL</option>
+ </select>
+ <span class="required">Required</span>
+ </li>
<li><label for="profile_description">Profile description: </label>
<textarea cols="50" rows="2" name="profile_description" id="profile_description"></textarea></li>
</select>
</li>
- <li><label for="new_field_separator">Field separator: </label>
+ <li class="marc_specific"><label for="new_field_separator">Field separator: </label>
<select name="field_separator" id="new_field_separator">
<option value=":">Colon (:)</option>
<option value=",">Comma (,)</option>
</select>
</li>
- <li><label for="new_subfield_separator">Subfield separator: </label>
+ <li class="marc_specific"><label for="new_subfield_separator">Subfield separator: </label>
<select name="subfield_separator" id="new_subfield_separator">
<option value=":">Colon (:)</option>
<option value=",">Comma (,)</option>
</select>
</li>
- <li><label for="new_encoding">Encoding: </label>
+ <li class="marc_specific"><label for="new_encoding">Encoding: </label>
<select name="encoding" id="new_encoding">
[% FOREACH encoding IN encodings %]
- [% IF ( encoding == 'utf8' ) %]
+ [% IF ( encoding.encoding == 'utf8' ) %]
<option selected="selected">[% encoding.encoding %]</option>
[% ELSE %]
<option>[% encoding.encoding %]</option>
</select></li>
- <li><label for="new_profile_content">Profile MARC fields: </label>
- <textarea cols="50" rows="2" name="profile_content" id="new_profile_content"></textarea>
+ <li class="marc_specific">
+ <label for="new_profile_marc_content" class="required">Profile MARC fields: </label>
+ <textarea cols="50" rows="2" name="profile_marc_content" id="new_profile_marc_content"></textarea>
+ <span class="required">Required</span>
<p>You have to define which fields or subfields you want to export, separated by pipes.</p>
<p>You can also use your own headers (instead of the ones from Koha) by prefixing the field number with an header, followed by the equal sign.</p>
<p>Example: Personal name=200|Entry element=210$a|300|009</p>
+ <p>You can use Template Toolkit tags too. See the help page for more information.</p>
</li>
+ <li class="sql_specific">
+ <label for="new_profile_sql_content" class="required">Profile SQL fields: </label>
+ <textarea cols="50" rows="2" name="profile_sql_content" id="new_profile_sql_content"></textarea>
+ <p>You have to define which fields you want to export, separated by pipes.</p>
+ <p>You can also use your own headers (instead of the ones from Koha) by prefixing the field name with an header, followed by the equal sign.</p>
+ <p>Example: Name=subscription.name|Title=subscription.title|Issue number=serial.serialseq</p>
+ </li>
</ol>
</fieldset>
<fieldset class="action"><input type="hidden" name="action" value="create" />
<div id="csvedit">
<h3>Modify or delete a CSV export profile</h3>
- <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="post">
+ <form action="/cgi-bin/koha/tools/csv-profiles.pl" class="validated" method="post">
<fieldset class="rows">
- <ol><li><label for="modify_profile_name">Profile name: </label>
- <select id="modify_profile_name" name="profile_name" onchange="javascript:reloadPage(this)">
+ <ol>
+ <li><label for="modify_profile_name" class="required">Profile name: </label>
+ <select id="modify_profile_name" name="profile_name" required="required" class="required" onchange="reloadPage(this)">
<option value="0">-- Choose One --</option>
[% FOREACH existing_profile IN existing_profiles %]
[% IF ( existing_profile.export_format_id == selected_profile_id ) %]
<option value="[% existing_profile.export_format_id %]">[% existing_profile.profile %]</option>
[% END %]
[% END %]
- </select></li>
+ </select>
+ <span class="required">Required</span>
+ </li>
+
+ <li>
+ <label for="modify_profile_type" class="required">Profile type: </label>
+ <select id="modify_profile_type" name="profile_type" class="required" required="required">
+ <option value="marc">MARC</option>
+ [% IF selected_profile_type == "sql" %]
+ <option value="sql" selected="selected">SQL</option>
+ [% ELSE %]
+ <option value="sql">SQL</option>
+ [% END %]
+ </select>
+ <span class="required">Required</span>
+ </li>
+
<li><label for="modify_profile_description">Profile description: </label>
<textarea cols="50" rows="2" name="profile_description" id="modify_profile_description">[% selected_profile_description %]</textarea></li>
[% END %]
</select></li>
- <li><label for="field_separator">Field separator: </label>
+ <li class="marc_specific"><label for="field_separator">Field separator: </label>
<select name="field_separator" id="field_separator">
<option value=":">Colon (:)</option>
</select></li>
- <li><label for="subfield_separator">Subfield separator: </label>
+ <li class="marc_specific"><label for="subfield_separator">Subfield separator: </label>
<select name="subfield_separator" id="subfield_separator">
<option value=":">Colon (:)</option>
</select></li>
- <li><label for="encoding">Encoding: </label>
+ <li class="marc_specific"><label for="encoding">Encoding: </label>
<select name="encoding" id="encoding">
[% FOREACH encoding IN encodings %]
- [% IF ( selected_encoding == encoding ) %]
+ [% IF ( selected_encoding == encoding.encoding ) %]
<option selected="selected">[% encoding.encoding %]</option>
[% ELSE %]
<option>[% encoding.encoding %]</option>
[% END %]
</select></li>
- <li><label for="modify_profile_content">Profile MARC fields: </label>
- <textarea cols="50" rows="2" name="profile_content" id="modify_profile_content">[% selected_profile_marcfields %]</textarea></li>
+ <li class="marc_specific">
+ <label for="modify_profile_marc_content" class="required">Profile MARC fields: </label>
+ <textarea cols="50" rows="2" name="profile_marc_content" id="modify_profile_marc_content" class="required" required="required">[% selected_profile_content %]</textarea>
+ <span class="required">Required</span>
+ </li>
+
+ <li class="sql_specific">
+ <label for="modify_profile_sql_content" class="required">Profile SQL fields: </label>
+ <textarea cols="50" rows="2" name="profile_sql_content" id="modify_profile_sql_content">[% selected_profile_content %]</textarea>
+ </li>
- <li class="radio"> <label for="delete">Delete selected profile ?</label>
+ <li class="radio"> <label for="delete">Delete selected profile?</label>
<input type="checkbox" name="delete" id="delete" /></li>
</ol>