From a2dfd7170aa23fb4f33abcf4740ec5776da647bf Mon Sep 17 00:00:00 2001 From: lorilee Date: Tue, 15 Jun 2010 23:36:20 -0400 Subject: [PATCH] Added functions used to display file select forms in import --- libraries/common.lib.php | 44 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/libraries/common.lib.php b/libraries/common.lib.php index d7333c7a9..a06c875b3 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -2856,4 +2856,46 @@ function PMA_js($code, $print=true) return $out; } -?> + +/** + * Display the form used to browse anywhere on the server for the file to import + */ +function PMA_browseUploadFile($max_upload_size) { + $uid = uniqid(""); + echo ''; + echo ''; + echo ''; + echo ''; + echo PMA_displayMaximumUploadSize($max_upload_size) . "\n"; + // some browsers should respect this :) + echo PMA_generateHiddenMaxFileSize($max_upload_size) . "\n"; +} + +/** + * Display the form used to select a file to import from the server upload directory + */ +function PMA_selectUploadFile($import_list, $uploaddir) { + echo ''; + $extensions = ''; + foreach ($import_list as $key => $val) { + if (!empty($extensions)) { + $extensions .= '|'; + } + $extensions .= $val['extension']; + } + $matcher = '@\.(' . $extensions . ')(\.(' . PMA_supportedDecompressions() . '))?$@'; + + $files = PMA_getFileSelectOptions(PMA_userDir($uploaddir), $matcher, (isset($timeout_passed) && $timeout_passed && isset($local_import_file)) ? $local_import_file : ''); + if ($files === FALSE) { + PMA_Message::error(__('The directory you set for upload work cannot be reached'))->display(); + } elseif (!empty($files)) { + echo "\n"; + echo ' ' . "\n"; + } elseif (empty ($files)) { + echo 'There are no files to upload'; + } +} +?> \ No newline at end of file