From 7f80ad71e1ba029747981e8b7049190185667ee9 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 5 Mar 2015 13:25:46 +0300 Subject: [PATCH] updated admin panel files added 'clockpicker' library (could replace jquerry-ui timepicker later on in some files) modified functions.display.php to handle external classes modified addrow-v2.js to display cloned values and init clockpicker --- admin/assignsample.php | 145 ++-- admin/availability.php | 361 ++++----- admin/availabilitygroup.php | 279 +++---- admin/callrestrict.php | 55 +- admin/shifttemplate.php | 77 +- css/custom.css | 2 +- functions/functions.display.php | 34 +- functions/functions.xhtml.php | 10 +- include/clockpicker/LICENSE | 21 + .../dist/bootstrap-clockpicker.css | 168 ++++ .../clockpicker/dist/bootstrap-clockpicker.js | 729 ++++++++++++++++++ .../dist/bootstrap-clockpicker.min.css | 5 + .../dist/bootstrap-clockpicker.min.js | 6 + .../clockpicker/dist/jquery-clockpicker.css | 370 +++++++++ .../clockpicker/dist/jquery-clockpicker.js | 729 ++++++++++++++++++ .../dist/jquery-clockpicker.min.css | 9 + .../dist/jquery-clockpicker.min.js | 6 + js/addrow-v2.js | 10 +- 18 files changed, 2567 insertions(+), 449 deletions(-) create mode 100644 include/clockpicker/LICENSE create mode 100644 include/clockpicker/dist/bootstrap-clockpicker.css create mode 100644 include/clockpicker/dist/bootstrap-clockpicker.js create mode 100644 include/clockpicker/dist/bootstrap-clockpicker.min.css create mode 100644 include/clockpicker/dist/bootstrap-clockpicker.min.js create mode 100644 include/clockpicker/dist/jquery-clockpicker.css create mode 100644 include/clockpicker/dist/jquery-clockpicker.js create mode 100644 include/clockpicker/dist/jquery-clockpicker.min.css create mode 100644 include/clockpicker/dist/jquery-clockpicker.min.js diff --git a/admin/assignsample.php b/admin/assignsample.php index 1369f11c..63cf4b56 100644 --- a/admin/assignsample.php +++ b/admin/assignsample.php @@ -55,9 +55,25 @@ include("../functions/functions.display.php"); */ include("../functions/functions.input.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/window.js" + ); +$js_foot = array( +"../js/bootstrap-confirmation.js", +"../js/custom.js" + ); global $db; - if (isset($_GET['questionnaire_id']) && isset($_GET['sample']) && isset($_GET['call_max']) && isset($_GET['call_attempt_max'])) { //need to add sample to questionnaire @@ -76,13 +92,11 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['sample']) && isset($_GET[' VALUES('$questionnaire_id','$sid','$cm','$cam','$selecttype','$am', '$an')"; $db->Execute($sql); - } if (isset($_POST['edit'])) { //need to add sample to questionnaire - $questionnaire_id = bigintval($_POST['questionnaire_id']); $sid = bigintval($_POST['sample_import_id']); $cm = bigintval($_POST['call_max']); @@ -93,8 +107,6 @@ if (isset($_POST['edit'])) $an = 0; if (isset($_POST['allownew'])) $an = 1; - - $sql = "UPDATE questionnaire_sample SET call_max = '$cm', call_attempt_max = '$cam', @@ -105,7 +117,6 @@ if (isset($_POST['edit'])) AND sample_import_id = '$sid'"; $db->Execute($sql); - } @@ -117,7 +128,8 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['rsid'])) if (isset($_GET['edit'])) { - xhtml_head(T_("Assign Sample: Select sample to assign"),true,array("../css/table.css"),array("../js/window.js")); + $subtitle = T_("Edit assignment parameters"); + xhtml_head(T_("Assign samples to questionnaire: "),true,$css,$js_head,false,false,false,$subtitle);//array("../css/table.css"),array("../js/window.js") $sql = "SELECT si.description as description, qr.description as qdescription, @@ -134,31 +146,36 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['rsid'])) $qs = $db->GetRow($sql); - print "

" . T_("Edit sample details") . "

"; - print "

" . T_("Questionnaire") . ": " . $qs['qdescription'] . "

"; - print "

" . T_("Sample") . ": " . $qs['description'] . "

"; - - print "

" . T_("Go back") . "

"; + //print "

" . T_("Edit sample details") . "

"; + print "

 " . T_("Go back") . "

+

" . T_("Questionnaire") . ": " . $qs['qdescription'] . "

+

" . T_("Sample") . ": " . $qs['description'] . "

+
"; $allownew = $selected =""; if ($qs['random_select'] == 1) $selected = "checked=\"checked\""; if ($qs['allow_new'] == 1) $allownew = "checked=\"checked\""; - ?> -
-
-
-
- />
- />
+ + +


+


+


+
switch="yes" data-size="small" data-on-text="" data-off-text=""/>


+
class="col-sm-1" switch="yes" data-size="small" data-on-text="" data-off-text=""/>


- "/>

-
+
+
+ + + " . T_("Select a questionnaire from the list below") . ""; -display_questionnaire_chooser($questionnaire_id); - +print " " . T_("Go back") . ""; +print "

" . T_("Select a questionnaire") . ":

"; +display_questionnaire_chooser($questionnaire_id,false, "pull-left", "form-control"); if ($questionnaire_id != false) { - print "

" . T_("Samples selected for this questionnaire") . "

"; + + print "
+

". T_("Samples selected for this questionnaire") .":

"; $sql = "SELECT si.description as description, - CASE WHEN q.call_max = 0 THEN '" . TQ_("Unlimited") . "' ELSE q.call_max END as call_max, - CASE WHEN q.call_attempt_max = 0 THEN '" . TQ_("Unlimited") . "' ELSE q.call_attempt_max END AS call_attempt_max, - CASE WHEN q.random_select = 0 THEN '" . TQ_("Sequential") . "' ELSE '". TQ_("Random") . "' END as random_select, - CASE WHEN q.answering_machine_messages = 0 THEN '" . TQ_("Never") . "' ELSE q.answering_machine_messages END as answering_machine_messages, - CASE WHEN q.allow_new = 0 THEN '" . TQ_("No") . "' ELSE '".TQ_("Yes")."' END as allow_new, - CONCAT('" . TQ_("Edit") ."') as edit, - CONCAT('" . TQ_("Click to unassign") ."') as unassign + CASE WHEN q.call_max = 0 THEN '". TQ_("Unlimited") ."' ELSE q.call_max END as call_max, + CASE WHEN q.call_attempt_max = 0 THEN '". TQ_("Unlimited") . "' ELSE q.call_attempt_max END AS call_attempt_max, + CASE WHEN q.random_select = 0 THEN '". TQ_("Sequential") ."' ELSE '". TQ_("Random") . "' END as random_select, + CASE WHEN q.answering_machine_messages = 0 THEN '". TQ_("Never") . "' ELSE q.answering_machine_messages END as answering_machine_messages, + CASE WHEN q.allow_new = 0 THEN '". TQ_("No") ."' ELSE '".TQ_("Yes")."' END as allow_new, + CONCAT('') as edit, + CONCAT('') as unassign FROM questionnaire_sample as q, sample_import as si WHERE q.sample_import_id = si.sample_import_id AND q.questionnaire_id = '$questionnaire_id'"; @@ -200,9 +219,9 @@ if ($questionnaire_id != false) $qs = $db->GetAll($sql); if (!empty($qs)) - xhtml_table($qs,array("description","call_max","call_attempt_max","answering_machine_messages","random_select","allow_new","edit","unassign"),array(T_("Sample"), T_("Max calls"), T_("Max call attempts"), T_("Answering machine messages"), T_("Selection type"), T_("Allow new numbers to be drawn?"), T_("Edit"), T_("Unassign sample") )); + xhtml_table($qs,array("description","call_max","call_attempt_max","answering_machine_messages","random_select","allow_new","edit","unassign"),array(T_("Sample"), T_("Max calls"), T_("Max call attempts"), T_("Answering machine messages"), T_("Selection type"), T_("Allow new numbers to be drawn?"), T_("Edit"), T_("Unassign sample"))); else - print "

" . T_("No samples selected for this questionnaire") . "

"; + print "

". T_("No samples selected for this questionnaire") ."

"; $sql = "SELECT si.sample_import_id,si.description FROM sample_import as si @@ -211,36 +230,38 @@ if ($questionnaire_id != false) AND si.enabled = 1"; $qs = $db->GetAll($sql); + print"
"; if (!empty($qs)) { - - - print "

" . T_("Add a sample to this questionnaire:") . "

"; + print "
"; + print "

" . T_("Add a sample to this questionnaire:") . "

"; ?> -
-


-
-
-
-
-
- - "/>

-
+
+


+ +


+ +


+ +


+ +
" data-off-text=""/>


+ +
" data-off-text=""/>


+ + + +
+ +
+ \ No newline at end of file diff --git a/admin/availability.php b/admin/availability.php index 03b120ac..6d48dd3f 100644 --- a/admin/availability.php +++ b/admin/availability.php @@ -1,173 +1,188 @@ - - * @copyright Australian Consortium for Social and Political Research Inc (ACSPRI) 2011 - * @package queXS - * @subpackage admin - * @link http://www.acspri.org.au/ queXS was writen for ACSPRI - * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2 - * - */ - -/** - * Configuration file - */ -include ("../config.inc.php"); - -/** - * Database file - */ -include ("../db.inc.php"); - -/** - * XHTML functions - */ -include ("../functions/functions.xhtml.php"); - -global $db; - -$year="2008"; -$woy="1"; - -if (isset($_GET['availability_group'])) - $availability_group = intval($_GET['availability_group']); -else if (isset($_POST['availability_group'])) - $availability_group = intval($_POST['availability_group']); -else - die(T_("No time slot group set")); - - -if (isset($_POST['day'])) -{ - $db->StartTrans(); - - $sql = "DELETE FROM availability - WHERE availability_group_id = $availability_group"; - - $db->Execute($sql); - - foreach($_POST['day'] as $key => $val) - { - if (!empty($val)) - { - $val = intval($val); - $key = intval($key); - - $start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc()); - $end = $db->qstr($_POST['end'][$key],get_magic_quotes_gpc()); - - $sql = "INSERT INTO availability (day_of_week,start,end,availability_group_id) - VALUES ('$val',$start,$end,$availability_group)"; - - $db->Execute($sql); - } - } - - $sql = "UPDATE availability_group - SET description = " . $db->qstr($_POST['description']) . " - WHERE availability_group_id= $availability_group"; - - $db->Execute($sql); - - $db->CompleteTrans(); -} - -xhtml_head(T_("Modify time slots"),true,array("../css/shifts.css"),array("../js/addrow-v2.js")); - -/** - * Display warning if timezone data not installed - * - */ - -$sql = "SELECT CONVERT_TZ(NOW(),'Australia/Victoria','UTC') as t"; -$rs = $db->GetRow($sql); - -if (empty($rs) || !$rs || empty($rs['t'])) - print "
" . T_("Your database does not have timezones installed, please see here for details") . "
"; - - -print "
" . T_("Go back") . "
"; - - -$sql = "SELECT description - FROM availability_group - WHERE availability_group_id = $availability_group"; - -$rs = $db->GetRow($sql); - -$description = $rs['description']; - -print "

" . $rs['description'] . "

"; - -print "

" . T_("Enter the start and end times for each day of the week to restrict calls within") . "

"; -/** - * Begin displaying currently loaded restriction times - */ - -$sql = "SELECT DATE_FORMAT( STR_TO_DATE( CONCAT( '$year', ' ', '$woy', ' ', day_of_week -1 ) , '%x %v %w' ) , '%W' ) AS dt,day_of_week,start,end - FROM availability - WHERE availability_group_id = $availability_group"; - -$availabilitys = $db->GetAll($sql); -translate_array($availabilitys,array("dt")); - -$sql = "SELECT DATE_FORMAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ',day_of_week - 1),'%x %v %w'), '%W') as description, day_of_week as value, '' as selected - FROM day_of_week"; - -$daysofweek = $db->GetAll($sql); -translate_array($daysofweek,array("description")); - -?> -
- -"; - $count = 0; - foreach($availabilitys as $availability) - { - print ""; - $count++; - } - print ""; - - -?> -
" . T_("Day") . "" . T_("Start") . "" . T_("End") . "
"; - display_chooser($daysofweek, "day[$count]", false, true, false, false, false, array("description",$availability['dt'])); - print "
"; - display_chooser($daysofweek, "day[$count]", false, true, false, false, false, false); - print "
-

-

-

"/>

- -
-
-

"/>

- -
- + + * @copyright Australian Consortium for Social and Political Research Inc (ACSPRI) 2011 + * @package queXS + * @subpackage admin + * @link http://www.acspri.org.au/ queXS was writen for ACSPRI + * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2 + * + */ + +/** + * Configuration file + */ +include ("../config.inc.php"); + +/** + * Database file + */ +include ("../db.inc.php"); + +/** + * XHTML functions + */ +include ("../functions/functions.xhtml.php"); + +$css = array( +"../include/bootstrap-3.3.2/css/bootstrap.min.css", +//"../include/bootstrap-3.3.2/css/bootstrap-theme.min.css", +"../include/clockpicker/dist/bootstrap-clockpicker.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/addrow-v2.js", + ); +$js_foot = array( +"../include/clockpicker/dist/bootstrap-clockpicker.js", +"../js/custom.js" + ); + +global $db; + +$year="2008"; +$woy="1"; + +if (isset($_GET['availability_group'])) + $availability_group = intval($_GET['availability_group']); +else if (isset($_POST['availability_group'])) + $availability_group = intval($_POST['availability_group']); +else + die(T_("No time slot group set")); + + +if (isset($_POST['day'])) +{ + $db->StartTrans(); + + $sql = "DELETE FROM availability + WHERE availability_group_id = $availability_group"; + $db->Execute($sql); + + foreach($_POST['day'] as $key => $val) + { + if (!empty($val)) + { + $val = intval($val); + $key = intval($key); + + $start = $db->qstr($_POST['start'][$key],get_magic_quotes_gpc()); + $end = $db->qstr($_POST['end'][$key],get_magic_quotes_gpc()); + + $sql = "INSERT INTO availability (day_of_week,start,end,availability_group_id) + VALUES ('$val',$start,$end,$availability_group)"; + $db->Execute($sql); + } + } + + $sql = "UPDATE availability_group + SET description = " . $db->qstr($_POST['description']) . " + WHERE availability_group_id= $availability_group"; + $db->Execute($sql); + $db->CompleteTrans(); +} + +xhtml_head(T_("Modify time slots"),true,$css,$js_head);//,true,array("../css/shifts.css"),array("../js/addrow-v2.js") + +/** + * Display warning if timezone data not installed + * + */ + +$sql = "SELECT CONVERT_TZ(NOW(),'" . DEFAULT_TIME_ZONE . "','UTC') as t";//'Australia/Victoria' +$rs = $db->GetRow($sql); + +if (empty($rs) || !$rs || empty($rs['t'])) + print "
" . T_("Your database does not have timezones installed, please see here for details") . "
"; + + +print "
" . T_("Go back") . "
"; + + +$sql = "SELECT description + FROM availability_group + WHERE availability_group_id = $availability_group"; + +$rs = $db->GetRow($sql); + +$description = $rs['description']; + +print "

" . T_("Time slot name") . " : " . $rs['description'] . "

"; + +print "
" . T_("Enter the start and end times for each day of the week to restrict calls within") . "
"; +/** + * Begin displaying currently loaded restriction times + */ + +$sql = "SELECT DATE_FORMAT( STR_TO_DATE( CONCAT( '$year', ' ', '$woy', ' ', day_of_week -1 ) , '%x %v %w' ) , '%W' ) AS dt,day_of_week,start,end + FROM availability + WHERE availability_group_id = $availability_group"; + +$availabilitys = $db->GetAll($sql); +translate_array($availabilitys,array("dt")); + +$sql = "SELECT DATE_FORMAT(STR_TO_DATE(CONCAT($year, ' ',$woy,' ',day_of_week - 1),'%x %v %w'), '%W') as description, day_of_week as value, '' as selected + FROM day_of_week"; + +$daysofweek = $db->GetAll($sql); +translate_array($daysofweek,array("description")); + +?> +
+

+ +"; + $count = 0; + foreach($availabilitys as $availability) + { + print ""; + $count++; + } + print ""; + + +?> +
" . T_("Day") . "" . T_("Start") . "" . T_("End") . "
";//class='row_to_clone' + display_chooser($daysofweek, "day[$count]", false, true, false, false, false, array("description",$availability['dt'])); + print "
"; + display_chooser($daysofweek, "day[$count]", false, true, false, false, false, false); + print "
+

+ "/> + +


+
+ "/> + +
+ + \ No newline at end of file diff --git a/admin/availabilitygroup.php b/admin/availabilitygroup.php index 2599cbc9..f6dbfac0 100644 --- a/admin/availabilitygroup.php +++ b/admin/availabilitygroup.php @@ -1,135 +1,144 @@ - - * @copyright Australian Consortium for Social and Political Research Inc (2011) - * @package queXS - * @subpackage admin - * @link http://www.acspri.org.au/ queXS was writen for ACSPRI - * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2 - * - * - */ - -/** - * Configuration file - */ -include("../config.inc.php"); - -/** - * Database file - */ -include ("../db.inc.php"); - -/** - * XHTML functions - */ -include("../functions/functions.xhtml.php"); - -/** - * Display functions - */ -include("../functions/functions.display.php"); - -/** - * Limesurvey functions - */ -include("../functions/functions.limesurvey.php"); - -/** - * Operator functions - */ -include("../functions/functions.operator.php"); - -/** - * Input functions - */ -include("../functions/functions.input.php"); - -global $db; - -xhtml_head(T_("Time slots"),true,array("../css/table.css"),array("../js/window.js")); - -if (isset($_POST['subdel'])) -{ - $availability_group = intval($_POST['availability_group']); - - $db->StartTrans(); - - $sql = "DELETE FROM availability - WHERE availability_group_id = $availability_group"; - - $db->Execute($sql); - - $sql = "DELETE FROM questionnaire_availability - WHERE availability_group_id = $availability_group"; - - $db->Execute($sql); - - $sql = "DELETE FROM availability_group - WHERE availability_group_id = $availability_group"; - - $db->Execute($sql); - - $db->CompleteTrans(); -} -else if (isset($_POST['availability_group'])) -{ - $availability_group = $db->qstr($_POST['availability_group']); - - $sql = "INSERT INTO `availability_group` (availability_group_id,description) - VALUES (NULL,$availability_group)"; - - $db->Execute($sql); -} - -//view groups -$sql = "SELECT description, - CONCAT('". TQ_("Modify") . "') as link - FROM availability_group"; - - $rs = $db->GetAll($sql); - -print "

" . T_("Time slots")."

"; - -print "

" . T_("Time slots define periods of time during particular days of the week. These are used for the availability function and also the call attempt time slot function.") . "

"; - -if (empty($rs)) - print "

" . T_("No time slots") . "

"; -else - xhtml_table($rs,array("description","link"),array(T_("Time slot"),T_("Modify"))); - - -//add an availablity group -print "

" . T_("Add time slot") . "

"; -?> -
-

-

"/> -

-
- + + * @copyright Australian Consortium for Social and Political Research Inc (2011) + * @package queXS + * @subpackage admin + * @link http://www.acspri.org.au/ queXS was writen for ACSPRI + * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2 + * + * + */ + +/** + * Configuration file + */ +include("../config.inc.php"); + +/** + * Database file + */ +include ("../db.inc.php"); + +/** + * XHTML functions + */ +include("../functions/functions.xhtml.php"); + +/** + * Display functions + */ +include("../functions/functions.display.php"); + +/** + * Limesurvey functions + */ +include("../functions/functions.limesurvey.php"); + +/** + * Operator functions + */ +include("../functions/functions.operator.php"); + +/** + * Input functions + */ +include("../functions/functions.input.php"); + +$css = array( +"../include/bootstrap-3.3.2/css/bootstrap.min.css", +"../css/custom.css" + ); +$js_head = array( + ); +$js_foot = array( +"../js/window.js", +"../js/custom.js" + ); +global $db; + +xhtml_head(T_("Time slots"),true,$css,$js_head);//array("../css/table.css"),array("../js/window.js") + +if (isset($_POST['subdel'])) +{ + $availability_group = intval($_POST['availability_group']); + + $db->StartTrans(); + + $sql = "DELETE FROM availability + WHERE availability_group_id = $availability_group"; + + $db->Execute($sql); + + $sql = "DELETE FROM questionnaire_availability + WHERE availability_group_id = $availability_group"; + + $db->Execute($sql); + + $sql = "DELETE FROM availability_group + WHERE availability_group_id = $availability_group"; + + $db->Execute($sql); + + $db->CompleteTrans(); +} +else if (isset($_POST['availability_group'])) +{ + $availability_group = $db->qstr($_POST['availability_group']); + + $sql = "INSERT INTO `availability_group` (availability_group_id,description) + VALUES (NULL,$availability_group)"; + + $db->Execute($sql); +} + +//view groups +$sql = "SELECT description, + CONCAT('". TQ_("Modify") . "') as link + FROM availability_group"; + + $rs = $db->GetAll($sql); + +//print "

" . T_("Time slots")."

"; + +print "
" . T_("Time slots define periods of time during particular days of the week. These are used for the availability function and also the call attempt time slot function.") . "
"; + +if (empty($rs)) + print "
" . T_("No time slots") . "
"; +else{ + print "
"; + // print "

" . T_("Time slots")."

"; + xhtml_table($rs,array("description","link"),array(T_("Time slot"),T_("Modify"))); + print "
"; +} + +//add an availablity group