1 [% INCLUDE 'doc-head-open.inc' %]<title>Koha › Tools › CSV export profiles</title>[% INCLUDE 'doc-head-close.inc' %]
2 <script type="text/javascript">
4 function reloadPage(p) {
6 if (id != 0) { document.location = "/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=" + id; }
8 $(document).ready(function() {
9 $("#type").change(function(){
10 if ( $(this).find("option:selected").val() == "marc" ) {
11 $("li.marc_specific").show();
12 $("#marc_content").attr("required", "required");
13 $("li.sql_specific").hide();
14 $("#sql_content").removeAttr("required");
16 $("li.marc_specific").hide();
17 $("#marc_content").removeAttr("required");
18 $("li.sql_specific").show();
19 $("#sql_content").attr("required", "required");
28 <body id="tools_csv-profiles" class="tools">
29 [% INCLUDE 'header.inc' %]
30 [% INCLUDE 'cat-search.inc' %]
32 <div id="breadcrumbs">
33 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
34 › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
35 › CSV export profiles
38 <div id="doc3" class="yui-t2">
43 [% FOR m IN messages %]
44 <div class="dialog [% m.type %]">
46 [% CASE 'error_on_update' %]
47 An error occurred when updating this CSV profile. Perhaps it already exists.
48 [% CASE 'error_on_insert' %]
49 An error occurred when adding this CSV profile.
50 [% CASE 'error_on_delete' %]
51 An error occurred when deleting this CSV profile. Check the logs.
52 [% CASE 'success_on_update' %]
53 CSV profile updated successfully.
54 [% CASE 'success_on_insert' %]
55 CSV profile added successfully.
56 [% CASE 'success_on_delete' %]
57 CSV profile deleted successfully.
58 [% CASE 'already_exists' %]
59 This CSV profile already exists.
66 [% BLOCK list_separator_options %]
67 [% IF selected_separator == ',' %]
68 <option value="," selected="selected">Comma (,)</option>
70 <option value=",">Comma (,)</option>
72 [% IF selected_separator == '|' %]
73 <option value="|" selected="selected">Pipe (|)</option>
75 <option value="|">Pipe (|)</option>
77 [% IF selected_separator == ';' %]
78 <option value=";" selected="selected">Semi-colon (;)</option>
80 <option value=";">Semi-colon (;)</option>
82 [% IF selected_separator == '#' %]
83 <option value="#" selected="selected">Sharp (#)</option>
85 <option value="#">Sharp (#)</option>
87 [% IF selected_separator == ' ' %]
88 <option value=" " selected="selected">Space ( )</option>
90 <option value=" ">Space ( )</option>
92 [% IF selected_separator == '\t' %]
93 <option value="\t" selected="selected">Tabulation (\t)</option>
95 <option value="\t">Tabulation (\t)</option>
97 [% IF selected_separator == '\n' %]
98 <option value="\n" selected="selected">New line (\n)</option>
100 <option value="\n">New line (\n)</option>
104 [% IF op == 'add_form' %]
106 <h1>Modify a CSV profile</h1>
108 <h1>New CSV profile</h1>
111 <form action="/cgi-bin/koha/tools/csv-profiles.pl" class="validated" method="post">
112 <input type="hidden" name="op" value="add_validate" />
113 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id %]" />
114 <fieldset class="rows">
117 <li><span class="label">Profile ID: </span>[% csv_profile.export_format_id %]</li>
120 <label for="profile" class="required">Profile name: </label>
121 <input type="text" name="profile" id="profile" value="[% csv_profile.profile %]" class="required">
122 <span class="required">Required</span>
125 <label for="type" class="required">Profile type: </label>
126 <select id="type" name="type">
127 [% IF csv_profile.type == 'sql' %]
128 <option value="marc">MARC</option>
129 <option value="sql" selected="selected">SQL</option>
131 <option value="marc" selected="selected">MARC</option>
132 <option value="sql">SQL</option>
135 <span class="required">Required</span>
138 <label for="description">Profile description: </label>
139 <textarea cols="50" rows="2" name="description" id="description">[% csv_profile.description %]</textarea>
142 <label for="csv_separator">CSV separator: </label>
143 <select name="csv_separator" id="csv_separator">
144 [% PROCESS list_separator_options selected_separator=csv_profile.csv_separator || ',' %]
148 <li class="marc_specific">
149 <label for="field_separator">Field separator: </label>
150 <select name="field_separator" id="field_separator">
151 [% PROCESS list_separator_options selected_separator=csv_profile.field_separator || '#' %]
155 <li class="marc_specific"><label for="subfield_separator">Subfield separator: </label>
156 <select name="subfield_separator" id="subfield_separator">
157 [% PROCESS list_separator_options selected_separator=csv_profile.subfield_separator || '|'%]
161 <li class="marc_specific"><label for="encoding">Encoding: </label>
162 <select name="encoding" id="encoding">
163 [% FOREACH encoding IN encodings %]
164 [% IF csv_profile.encoding == encoding
165 OR NOT csv_profile AND encoding == 'utf8' %]
166 <option selected="selected">[% encoding %]</option>
168 <option>[% encoding %]</option>
174 <li class="marc_specific">
175 <label for="marc_content" class="required">Profile MARC fields: </label>
176 <textarea cols="50" rows="2" name="marc_content" id="marc_content">[% csv_profile.content %]</textarea>
177 <span class="required">Required</span>
178 <p>You have to define which fields or subfields you want to export, separated by pipes.</p>
179 <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>
180 <p>Example: Personal name=200|Entry element=210$a|300|009</p>
181 <p>You can use Template Toolkit tags too. See the help page for more information.</p>
184 <li class="sql_specific">
185 <label for="sql_content" class="required">Profile SQL fields: </label>
186 <textarea cols="50" rows="2" name="sql_content" id="sql_content">[% csv_profile.content %]</textarea>
187 <p>You have to define which fields you want to export, separated by pipes.</p>
188 <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>
189 <p>Example: Name=subscription.name|Title=subscription.title|Issue number=serial.serialseq</p>
193 <fieldset class="action">
194 <input type="submit" value="Submit" />
195 <a class="cancel" href="/cgi-bin/koha/tools/csv-profiles.pl">Cancel</a>
200 [% IF op == 'delete_confirm' %]
201 <div class="dialog alert">
203 <h3>Delete CSV Profile "[% csv_profile.profile %]?"</h3>
204 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="post">
205 <input type="hidden" name="op" value="delete_confirmed" />
206 <input type="hidden" name="export_format_id" value="[% csv_profile.export_format_id %]" />
207 <input type="submit" class="approve" value="Yes, delete" />
209 <form action="/cgi-bin/koha/tools/csv-profiles.pl" method="get">
210 <input type="submit" class="deny" value="No, do not Delete" />
213 This CSV Profile does not exist.
218 [% IF op == 'list' %]
220 <div id="toolbar" class="btn-toolbar">
221 <a class="btn btn-small" id="newcsvprofile" href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form"><i class="fa fa-plus"></i> New CSV profile</a>
224 <h2>CSV profiles</h2>
227 <table id="table_csv_profiles">
229 <th>CSV profile ID</th>
233 <th>CSV separator</th>
239 [% FOREACH csv_profile IN csv_profiles %]
241 <td>[% csv_profile.export_format_id %]</td>
242 <td>[% csv_profile.profile %]</td>
243 <td>[% csv_profile.description %]</td>
244 <td>[% csv_profile.content %]</td>
245 <td>[% csv_profile.csv_separator %]</td>
246 [% IF csv_profile.type == 'sql' %]
251 <td><a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=[% csv_profile.export_format_id %]">Edit</a></td>
252 <td><a href="/cgi-bin/koha/tools/csv-profiles.pl?op=delete_confirm&export_format_id=[% csv_profile.export_format_id %]">Delete</a></td>
258 There is no CSV profile defined. <a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form">Create a new CSV profile</a>.
264 <div class="yui-b noprint">
265 [% INCLUDE 'tools-menu.inc' %]
268 [% INCLUDE 'intranet-bottom.inc' %]