Translation update done using Pootle.
[phpmyadmin-themes.git] / libraries / display_export.lib.php
blob10e8178d27e2d61df8399c51b5aceb6194abf3d0
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package phpMyAdmin
6 */
7 if (! defined('PHPMYADMIN')) {
8 exit;
11 // Get relations & co. status
12 $cfgRelation = PMA_getRelationsParam();
15 require_once './libraries/file_listing.php';
16 require_once './libraries/plugin_interface.lib.php';
18 function PMA_exportCheckboxCheck($str) {
19 if (isset($GLOBALS['cfg']['Export'][$str]) && $GLOBALS['cfg']['Export'][$str]) {
20 echo ' checked="checked"';
24 function PMA_exportIsActive($what, $val) {
25 if (isset($GLOBALS['cfg']['Export'][$what]) && $GLOBALS['cfg']['Export'][$what] == $val) {
26 echo ' checked="checked"';
30 /* Scan for plugins */
31 $export_list = PMA_getPlugins('./libraries/export/', array('export_type' => $export_type, 'single_table' => isset($single_table)));
33 /* Fail if we didn't find any plugin */
34 if (empty($export_list)) {
35 PMA_Message::error( __('Could not load export plugins, please check your installation!'))->display();
36 require './libraries/footer.inc.php';
39 // If the form data is being loaded from GET data, decode it
40 foreach($_GET as $name => $value) {
41 if(is_string($value)) {
42 $_GET[urldecode($name)] = urldecode($value);
47 <form method="post" action="export.php" name="dump">
49 <?php
50 if ($export_type == 'server') {
51 echo PMA_generate_common_hidden_inputs('', '', 1);
52 } elseif ($export_type == 'database') {
53 echo PMA_generate_common_hidden_inputs($db, '', 1);
54 } else {
55 echo PMA_generate_common_hidden_inputs($db, $table, 1);
58 // just to keep this value for possible next display of this form after saving on server
59 if (isset($single_table)) {
60 echo '<input type="hidden" name="single_table" value="TRUE" />' . "\n";
63 echo '<input type="hidden" name="export_type" value="' . $export_type . '" />' . "\n";
65 // If the export method was not set, the default is quick
66 if(isset($_GET['export_method'])) {
67 $cfg['Export']['method'] = $_GET['export_method'];
68 } elseif(!isset($cfg['Export']['method'])) {
69 $cfg['Export']['method'] = 'quick';
71 // The export method (quick, custom or custom-no-form)
72 echo '<input type="hidden" name="export_method" value="' . htmlspecialchars($cfg['Export']['method']) . '" />';
75 if(isset($_GET['sql_query'])) {
76 echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars(urldecode($_GET['sql_query'])) . '" />' . "\n";
77 } elseif (! empty($sql_query)) {
78 echo '<input type="hidden" name="sql_query" value="' . htmlspecialchars($sql_query) . '" />' . "\n";
82 <div class="exportoptions" id="header">
83 <h2>
84 <img src="<?php echo $GLOBALS['pmaThemeImage'];?>b_export.png" alt="export" />
85 <?php
86 if($export_type == 'server') {
87 echo __('Exporting databases from the current server');
88 } elseif($export_type == 'database') {
89 printf(__('Exporting tables from "%s" database'), htmlspecialchars($db));
90 } else {
91 printf(__('Exporting rows from "%s" table'), htmlspecialchars($table));
92 }?>
93 </h2>
94 </div>
96 <div class="exportoptions" id="quick_or_custom">
97 <h3><?php echo __('Export Method:'); ?></h3>
98 <ul>
99 <li>
100 <?php echo '<input type="radio" name="quick_or_custom" value="quick" id="radio_quick_export"';
101 if(isset($_GET['quick_or_custom'])) {
102 $export_method = $_GET['quick_or_custom'];
103 if($export_method == 'custom' || $export_method == 'custom_no_form') {
104 echo ' />';
105 } else {
106 echo ' checked="checked" />';
108 } elseif($cfg['Export']['method'] == 'custom' || $cfg['Export']['method'] == 'custom-no-form') {
109 echo ' />';
110 } else {
111 echo ' checked="checked" />';
113 echo '<label for ="radio_quick_export">' . __('Quick - display only the minimal options') . '</label>'; ?>
114 </li>
115 <li>
116 <?php echo '<input type="radio" name="quick_or_custom" value="custom" id="radio_custom_export"';
117 if(isset($_GET['quick_or_custom'])) {
118 $export_method = $_GET['quick_or_custom'];
119 if($export_method == 'custom' || $export_method == 'custom_no_form') {
120 echo ' checked="checked" />';
121 } else {
122 echo ' />';
124 } elseif($cfg['Export']['method'] == 'custom' || $cfg['Export']['method'] == 'custom-no-form') {
125 echo ' checked="checked" />';
126 } else {
127 echo ' />';
129 echo '<label for="radio_custom_export">' . __('Custom - display all possible options') . '</label>';?>
130 </li>
131 </ul>
132 </div>
134 <div class="exportoptions" id="databases_and_tables">
135 <?php
136 if($export_type == 'server') {
137 echo '<h3>' . __('Database(s):') . '</h3>';
138 } else if($export_type == 'database') {
139 echo '<h3>' . __('Table(s):') . '</h3>';
141 if (! empty($multi_values)) {
142 echo $multi_values;
145 </div>
147 <?php if (strlen($table) && ! isset($num_tables) && ! PMA_Table::isMerge($db, $table)) { ?>
148 <div class="exportoptions" id="rows">
149 <h3><?php echo __('Rows:'); ?></h3>
150 <ul>
151 <li>
152 <?php if(isset($_GET['allrows']) && $_GET['allrows'] == 1) {
153 echo '<input type="radio" name="allrows" value="0" id="radio_allrows_0" />';
154 } else {
155 echo '<input type="radio" name="allrows" value="0" id="radio_allrows_0" checked="checked" />';
157 echo '<label for ="radio_allrows_0">' . __('Dump some row(s)') . '</label>'; ?>
158 <ul>
159 <li><label for="limit_to"><?php echo __('Number of rows:') . '</label> <input type="text" id="limit_to" name="limit_to" size="5" value="'
160 . ((isset($_GET['limit_to'])) ? $_GET['limit_to'] : ((isset($unlim_num_rows) ? $unlim_num_rows : PMA_Table::countRecords($db, $table))))
161 . '" onfocus="this.select()" />' ?></li>
162 <li><label for="limit_from"><?php echo __('Row to begin at:') . '</label> <input type="text" id="limit_from" name="limit_from" value="'
163 . ((isset($_GET['limit_from'])) ? $_GET['limit_from'] : '0')
164 . '" size="5" onfocus="this.select()" />'; ?></li>
165 </ul>
166 </li>
167 <li>
168 <?php if(isset($_GET['allrows']) && $_GET['allrows'] == 0) {
169 echo '<input type="radio" name="allrows" value="1" id="radio_allrows_1" />';
170 } else {
171 echo '<input type="radio" name="allrows" value="1" id="radio_allrows_1" checked="checked" />';
173 echo ' <label for="radio_allrows_1">' . __('Dump all rows') . '</label>';?>
174 </li>
175 </ul>
176 </div>
177 <?php } ?>
179 <?php if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) { ?>
180 <div class="exportoptions" id="output_quick_export">
181 <h3><?php echo __('Output:'); ?></h3>
182 <ul>
183 <li>
184 <input type="checkbox" name="quick_export_onserver" value="saveit"
185 id="checkbox_quick_dump_onserver"
186 <?php PMA_exportCheckboxCheck('quick_export_onserver'); ?> />
187 <label for="checkbox_quick_dump_onserver">
188 <?php echo sprintf(__('Save on server in the directory <b>%s</b>'), htmlspecialchars(PMA_userDir($cfg['SaveDir']))); ?>
189 </label>
190 </li>
191 <li>
192 <input type="checkbox" name="quick_export_onserverover" value="saveitover"
193 id="checkbox_quick_dump_onserverover"
194 <?php PMA_exportCheckboxCheck('quick_export_onserver_overwrite'); ?> />
195 <label for="checkbox_quick_dump_onserverover"><?php echo __('Overwrite existing file(s)'); ?></label>
196 </li>
197 </ul>
198 </div>
199 <?php } ?>
201 <div class="exportoptions" id="output">
202 <h3><?php echo __('Output:'); ?></h3>
203 <ul id="ul_output">
204 <li>
205 <input type="radio" name="output_format" value="sendit" id="radio_dump_asfile" <?php isset($_GET['repopulate']) ? '' : PMA_exportCheckboxCheck('asfile'); ?> />
206 <label for="radio_dump_asfile"><?php echo __('Save output to a file'); ?></label>
207 <ul id="ul_save_asfile">
208 <?php if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) { ?>
209 <li>
210 <input type="checkbox" name="onserver" value="saveit"
211 id="checkbox_dump_onserver"
212 <?php PMA_exportCheckboxCheck('onserver'); ?> />
213 <label for="checkbox_dump_onserver">
214 <?php echo sprintf(__('Save on server in the directory <b>%s</b>'), htmlspecialchars(PMA_userDir($cfg['SaveDir']))); ?>
215 </label>
216 </li>
217 <li>
218 <input type="checkbox" name="onserverover" value="saveitover"
219 id="checkbox_dump_onserverover"
220 <?php PMA_exportCheckboxCheck('onserver_overwrite'); ?> />
221 <label for="checkbox_dump_onserverover"><?php echo __('Overwrite existing file(s)'); ?></label>
222 </li>
223 <?php } ?>
224 <li>
225 <label for="filename_template" class="desc">
226 <?php
227 echo __('File name template:');
228 $trans = new PMA_Message;
229 $trans->addMessage(__('@SERVER@ will become the server name'));
230 if ($export_type == 'database' || $export_type == 'table') {
231 $trans->addMessage(__(', @DATABASE@ will become the database name'));
232 if ($export_type == 'table') {
233 $trans->addMessage(__(', @TABLE@ will become the table name'));
237 $message = new PMA_Message(__('This value is interpreted using %1$sstrftime%2$s, so you can use time formatting strings. Additionally the following transformations will happen: %3$s. Other text will be kept as is. See the %4$sFAQ%5$s for details.'));
238 $message->addParam('<a href="' . PMA_linkURL(PMA_getPHPDocLink('function.strftime.php')). '" target="documentation" title="'
239 . __('Documentation') . '">', false);
240 $message->addParam('</a>', false);
241 $message->addParam($trans);
242 $message->addParam('<a href="Documentation.html#faq6_27" target="documentation">', false);
243 $message->addParam('</a>', false);
245 echo PMA_showHint($message);
247 </label>
248 <input type="text" name="filename_template" id="filename_template"
249 <?php
250 echo ' value="';
251 if(isset($_GET['filename_template'])) {
252 echo $_GET['filename_template'];
253 } else {
254 if ($export_type == 'database') {
255 echo htmlspecialchars($GLOBALS['PMA_Config']->getUserValue(
256 'pma_db_filename_template',
257 $GLOBALS['cfg']['Export']['file_template_database']));
258 } elseif ($export_type == 'table') {
259 echo htmlspecialchars($GLOBALS['PMA_Config']->getUserValue(
260 'pma_table_filename_template',
261 $GLOBALS['cfg']['Export']['file_template_table']));
262 } else {
263 echo htmlspecialchars($GLOBALS['PMA_Config']->getUserValue(
264 'pma_server_filename_template',
265 $GLOBALS['cfg']['Export']['file_template_server']));
268 echo '"';
271 <input type="checkbox" name="remember_template"
272 id="checkbox_remember_template"
273 <?php PMA_exportCheckboxCheck('remember_file_template'); ?> />
274 <label for="checkbox_remember_template">
275 <?php echo __('use this for future exports'); ?></label>
276 </li>
277 <?php
278 // charset of file
279 if ($GLOBALS['PMA_recoding_engine'] != PMA_CHARSET_NONE) {
280 echo ' <li><label for="select_charset_of_file" class="desc">'
281 . __('Character set of the file:') . '</label>' . "\n";
282 reset($cfg['AvailableCharsets']);
283 echo '<select id="select_charset_of_file" name="charset_of_file" size="1">';
284 foreach ($cfg['AvailableCharsets'] as $temp_charset) {
285 echo '<option value="' . $temp_charset . '"';
286 if(isset($_GET['charset_of_file']) && ($_GET['charset_of_file'] != $temp_charset)) {
287 echo '';
288 } elseif ((empty($cfg['Export']['charset']) && $temp_charset == $charset)
289 || $temp_charset == $cfg['Export']['charset']) {
290 echo ' selected="selected"';
292 echo '>' . $temp_charset . '</option>';
293 } // end foreach
294 echo '</select></li>';
295 } // end if
297 <?php
298 if(isset($_GET['compression'])) {
299 $selected_compression = $_GET['compression'];
300 } else {
301 $selected_compression = "none";
303 // zip, gzip and bzip2 encode features
304 $is_zip = ($cfg['ZipDump'] && @function_exists('gzcompress'));
305 $is_gzip = ($cfg['GZipDump'] && @function_exists('gzencode'));
306 $is_bzip = ($cfg['BZipDump'] && @function_exists('bzcompress'));
307 if ($is_zip || $is_gzip || $is_bzip) { ?>
308 <li>
309 <label for="compression" class="desc"><?php echo __('Compression:'); ?></label>
310 <select id="compression" name="compression">
311 <option value="none"><?php echo __('None'); ?></option>
312 <?php if ($is_zip) { ?>
313 <option value="zip" <?php echo ($selected_compression == "zip") ? 'selected="selected"' : ''; ?>><?php echo __('zipped'); ?></option>
314 <?php } if ($is_gzip) { ?>
315 <option value="gzip" <?php echo ($selected_compression == "gzip") ? 'selected="selected"' : ''; ?>><?php echo __('gzipped'); ?></option>
316 <?php } if ($is_bzip) { ?>
317 <option value="bzip" <?php echo ($selected_compression == "bzip") ? 'selected="selected"' : ''; ?>><?php echo __('bzipped'); ?></option>
318 <?php } ?>
319 </select>
320 </li>
321 <?php } else { ?>
322 <input type="hidden" name="compression" value="<?php echo $selected_compression; ?>" />
323 <?php } ?>
324 </ul>
325 </li>
326 <li><input type="radio" id="radio_view_as_text" name="output_format" value="astext" <?php echo isset($_GET['repopulate']) ? 'checked="checked"' : '' ?>/><label for="radio_view_as_text"><?php echo __('View output as text'); ?></label></li>
327 </ul>
328 </div>
330 <div class="exportoptions" id="format">
331 <h3><?php echo __('Format:'); ?></h3>
332 <?php echo PMA_pluginGetChoice('Export', 'what', $export_list, 'format'); ?>
333 </div>
335 <div class="exportoptions" id="format_specific_opts">
336 <h3><?php echo __('Format-specific options:'); ?></h3>
337 <p class="no_js_msg" id="scroll_to_options_msg"><?php echo __('Scroll down to fill in the options for the selected format and ignore the options for other formats.'); ?></p>
338 <?php echo PMA_pluginGetOptions('Export', $export_list); ?>
339 </div>
341 <?php if (function_exists('PMA_set_enc_form')) { ?>
342 <!-- Encoding setting form appended by Y.Kawada -->
343 <!-- Japanese encoding setting -->
344 <div class="exportoptions" id="kanji_encoding">
345 <h3><?php echo __('Encoding Conversion:'); ?></h3>
346 <?php echo PMA_set_enc_form(' '); ?>
347 </div>
348 <?php } ?>
350 <div class="exportoptions" id="submit">
351 <?php PMA_externalBug(__('SQL compatibility mode'), 'mysql', '50027', '14515'); ?>
352 <input type="submit" value="<?php echo __('Go'); ?>" id="buttonGo" />
353 </div>
354 </form>