* @copyright Deakin University 2007,2008 * @package queXS * @subpackage admin * @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2 * */ /** * Configuration file */ include ("../config.inc.php"); /** * XHTML functions */ include ("../functions/functions.xhtml.php"); /** * Sample import functions */ include("../functions/functions.import.php"); $css = array( "../include/bootstrap-3.3.2/css/bootstrap.min.css", "../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", "../include/font-awesome-4.3.0/css/font-awesome.css", "../css/bootstrap-switch.min.css", "../css/custom.css" ); $js_head = array( "../js/jquery-2.1.3.min.js", "../include/bootstrap-3.3.2/js/bootstrap.min.js", "../js/bootstrap-switch.min.js" ); $js_foot = array( "../js/bootstrap-filestyle.min.js", "../js/custom.js" ); if (isset($_POST['import_form'])) { //form has been submitted $subtitle = T_("Validating and uploading"); xhtml_head(T_("Import sample") . ":",true,$css,$js_head,false,false,false,$subtitle); echo " " . T_("Go back") . ""; //verify each GET field is unique (except import_form) $sfields = array(); foreach($_POST as $getv => $val) //clean up? $sfields[$getv] = $val; $error = verify_fields($sfields); $description = $_POST['description']; if ($error == "") { //verified so upload if (import_file($_POST['filename'],$description,$sfields)) { print "

" . T_("Successfully imported sample") . " 

$description

"; } else { print -"

" . T_("Error importing file. Please try again") . "

"; } } else print "

" . T_("Error:") . " $error

" . T_("Please go back in your browser and fix the problem") . "

"; //verifiy that exactly one primary phone number is selected //upload to database xhtml_foot($js_foot); } else if (isset($_POST['import_file'])) { //file has been submitted $subtitle = T_("Select columns to import"); xhtml_head(T_("Import sample") . ":",true,$css,$js_head,false,false,false,$subtitle); echo " " . T_("Go back") . ""; print "
"; $tmpfname = tempnam(TEMPORARY_DIRECTORY, "FOO"); move_uploaded_file($_FILES['file']['tmp_name'],$tmpfname); display_table(get_first_row($tmpfname)); ?>

 " . T_("Go back") . ""; $ua = $_SERVER['HTTP_USER_AGENT']; if (preg_match('/Firefox/i', $ua)) $csv= "text/csv"; else $csv= ".csv"; //print "ua=" . $_SERVER['HTTP_USER_AGENT']; ?>
" type="file" accept="" />
" class="form-control input-md">