2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

new Sample import page

changed from bs-switch to bs-toggle,  added file input filter and restriction
This commit is contained in:
Alex
2015-03-23 11:29:45 +03:00
parent f4be897763
commit ab22e06703
2 changed files with 158 additions and 190 deletions

View File

@@ -1,32 +1,6 @@
<?php <?php
/** /**
* Import a sample from a Headered CSV file * Import a sample from a Headered CSV file
*
*
* This file is part of queXS
*
* queXS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* queXS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*
* @author Adam Zammit <adam.zammit@deakin.edu.au>
* @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
*
*/ */
/** /**
@@ -48,13 +22,13 @@ $css = array(
"../include/bootstrap-3.3.2/css/bootstrap.min.css", "../include/bootstrap-3.3.2/css/bootstrap.min.css",
"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", "../include/bootstrap-3.3.2/css/bootstrap-theme.min.css",
"../include/font-awesome-4.3.0/css/font-awesome.css", "../include/font-awesome-4.3.0/css/font-awesome.css",
"../css/bootstrap-switch.min.css", "../include/bootstrap-toggle/css/bootstrap-toggle.min.css",
"../css/custom.css" "../css/custom.css"
); );
$js_head = array( $js_head = array(
"../js/jquery-2.1.3.min.js", "../js/jquery-2.1.3.min.js",
"../include/bootstrap-3.3.2/js/bootstrap.min.js", "../include/bootstrap-3.3.2/js/bootstrap.min.js",
"../js/bootstrap-switch.min.js" "../include/bootstrap-toggle/js/bootstrap-toggle.min.js",
); );
$js_foot = array( $js_foot = array(
"../js/bootstrap-filestyle.min.js", "../js/bootstrap-filestyle.min.js",
@@ -91,7 +65,7 @@ if (isset($_POST['import_form']))
} }
} }
else else
print "<div class='alert alert-danger col-md-offset-2'><p>" . T_("Error:") . " $error </p><p>" . T_("Please go back in your browser and fix the problem") . "</p></div>"; print "<div class='alert alert-danger col-md-offset-2'><p>" . T_("Error:") . " $error </p><p>" . T_("Please check imported file, go back in your browser and fix the problem") . "</p></div>";
//verifiy that exactly one primary phone number is selected //verifiy that exactly one primary phone number is selected
//upload to database //upload to database
@@ -114,10 +88,8 @@ else if (isset($_POST['import_file']))
display_table(get_first_row($tmpfname)); display_table(get_first_row($tmpfname));
?> ?>
<p><input type="hidden" name="description" value="<?php if (isset($_POST['description'])) print($_POST['description']); ?>"/></p> <input type="hidden" name="description" value="<?php if (isset($_POST['description'])) print($_POST['description']); ?>"/>
<input type="hidden" name="filename" value="<?php echo $tmpfname; ?>"/> <input type="hidden" name="filename" value="<?php echo $tmpfname; ?>"/>
<div class="form-group"> <div class="form-group">
<label class="col-md-4 control-label" for="submit"></label> <label class="col-md-4 control-label" for="submit"></label>
@@ -128,9 +100,6 @@ else if (isset($_POST['import_file']))
</form> </form>
<script type="text/javascript">
$('[switch="yes"]').bootstrapSwitch()
</script>
<?php <?php
xhtml_foot($js_foot); xhtml_foot($js_foot);
@@ -183,5 +152,4 @@ else
<?php <?php
xhtml_foot($js_foot); xhtml_foot($js_foot);
} }
?> ?>

View File

@@ -86,7 +86,7 @@ function verify_fields($fields)
{ {
if (array_key_exists($fields["n_$val"], $names)) if (array_key_exists($fields["n_$val"], $names))
{ {
return T_("Duplicate name"); return T_("Duplicate column name") . ":&emsp;<b>" . $fields["n_$val"] . "</b>";
} }
else else
{ {
@@ -141,7 +141,7 @@ function display_table($data)
if (empty($val)) $val = "samp_$row"; if (empty($val)) $val = "samp_$row";
print "<tr><td>$value</td> print "<tr><td>$value</td>
<td><input type=\"checkbox\" name=\"i_$row\" checked=\"$checked\" switch=\"yes\" data-size=\"small\" data-on-text=\"" . TQ_("Yes") . "\" data-off-text=" . TQ_("No") . " /></td> <td class='text-center'><input type=\"checkbox\" name=\"i_$row\" checked=\"$checked\" data-toggle=\"toggle\" data-size=\"small\" data-on=\"" . TQ_("Yes") . "\" data-off=" . TQ_("No") . " /></td>
<td><input type=\"text\" value=\"$val\" name=\"n_$row\" class=\"form-control\" /></td> <td><input type=\"text\" value=\"$val\" name=\"n_$row\" class=\"form-control\" /></td>
<td>"; <td>";
print "<select name=\"t_$row\" class=\"form-control\">"; print "<select name=\"t_$row\" class=\"form-control\">";
@@ -153,7 +153,7 @@ function display_table($data)
$selected = ""; $selected = "";
} }
print "</select></td>"; print "</select></td>";
print "<td>&emsp;<input type=\"checkbox\" name=\"a_$row\" switch=\"yes\" data-size=\"small\" data-on-text=\"" . TQ_("Yes") . "\" data-off-text=" . TQ_("No") . " /></td>"; print "<td class=\"text-center\"><input type=\"checkbox\" name=\"a_$row\" data-toggle=\"toggle\" data-size=\"small\" data-on=\"" . TQ_("Yes") . "\" data-off=" . TQ_("No") . " /></td>";
print "</tr>"; print "</tr>";
$row++; $row++;
} }