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\"";
-
?>
-
+
+
+
+
+
" . 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:") . " ";
?>
-
+
+
\ 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 "";
-
-
-print "";
-
-
-$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"));
-
-?>
-
-
-
+
+ * @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 "";
+
+
+print "";
+
+
+$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"));
+
+?>
+
+
+
\ 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
+?>
+
+
diff --git a/admin/callrestrict.php b/admin/callrestrict.php
index d8c49251..634a9f42 100644
--- a/admin/callrestrict.php
+++ b/admin/callrestrict.php
@@ -44,6 +44,22 @@ include ("../db.inc.php");
*/
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";
@@ -79,21 +95,21 @@ if (isset($_POST['day']))
$db->CompleteTrans();
}
-xhtml_head(T_("Modify call restriction times"),true,array("../css/shifts.css"),array("../js/addrow-v2.js"));
+xhtml_head(T_("Set call restriction times"),true,$css,$js_head);//,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";
+$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 "";
+ print "";
-print "" . T_("Enter the start and end times for each day of the week to restrict calls within") . " ";
+print "" . T_("Enter the start and end times for each day of the week to restrict calls within") . "
";
/**
* Begin displaying currently loaded restriction times
@@ -112,30 +128,33 @@ $daysofweek = $db->GetAll($sql);
translate_array($daysofweek,array("description"));
?>
-
+
+
\ No newline at end of file
diff --git a/admin/shifttemplate.php b/admin/shifttemplate.php
index 8c7eca1b..64e8d6d3 100644
--- a/admin/shifttemplate.php
+++ b/admin/shifttemplate.php
@@ -44,19 +44,33 @@ include ("../db.inc.php");
*/
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($_POST['day']))
{
$db->StartTrans();
$sql = "DELETE FROM shift_template
WHERE 1";
-
$db->Execute($sql);
foreach($_POST['day'] as $key => $val)
@@ -71,71 +85,76 @@ if (isset($_POST['day']))
$sql = "INSERT INTO shift_template (day_of_week,start,end)
VALUES ('$val',$start,$end)";
-
$db->Execute($sql);
}
}
-
$db->CompleteTrans();
}
-xhtml_head(T_("Modify shift template"),true,array("../css/shifts.css"),array("../js/addrow-v2.js"));
+xhtml_head(T_("Set default shift times"),true,$css,$js_head);//T_("Modify shift template"),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'
-$sql = "SELECT CONVERT_TZ(NOW(),'Australia/Victoria','UTC') as t";
$rs = $db->GetRow($sql);
if (empty($rs) || !$rs || empty($rs['t']))
- print "";
+ print "";
+/**
+ * Display warning if timezone data not installed
-print "" . T_("Enter standard shift start and end times for each day of the week in local time") . " ";
+ */
+
+//print "" . T_("Set default shift times") . " ";
+print "" . T_("Enter standard shift start and end times for each day of the week in local time") . "
";
/**
* Begin displaying currently loaded shifts
*/
-$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
+$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 shift_template";
$shifts = $db->GetAll($sql);
translate_array($shifts,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
+$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"));
?>
-
-
+
+
" . T_("Day") . " " . T_("Start") . " " . T_("End") . " ";
+ print "" . T_("Day") . " " . T_("Start") . " " . T_("End") . " ";
$count = 0;
foreach($shifts as $shift)
{
- print "";
+ print " ";// class='row_to_clone' /* these are not the rows to clone...*/
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, array("description",$shift['dt']));
- print " ";
+ print "
+
+
+ ";
$count++;
}
- print "";
+ print " ";
display_chooser($daysofweek, "day[$count]", false, true, false, false, false, false);
- print " ";
-
+ print "
+ ";
?>
-
-
- "/>
-
+
+
+ "/>
+
+
\ No newline at end of file
diff --git a/css/custom.css b/css/custom.css
index b203ce04..b5b1d641 100644
--- a/css/custom.css
+++ b/css/custom.css
@@ -73,5 +73,5 @@ text-shadow: 1px 2px 1px #ababab;
}
.h1, .h2, .h3, h1, h2, h3 {
margin-bottom: 0.4em;
-margin-top: 0.4em;
+margin-top: 0.25em;
}
\ No newline at end of file
diff --git a/functions/functions.display.php b/functions/functions.display.php
index 7046caa5..51ae666e 100644
--- a/functions/functions.display.php
+++ b/functions/functions.display.php
@@ -3,8 +3,6 @@
* Functions relating to displaying for XHTML
*
*
- *
- *
* This file is part of queXS
*
* queXS is free software; you can redistribute it and/or modify
@@ -31,7 +29,6 @@
*
*/
-
/**
* Configuration file
*/
@@ -43,30 +40,23 @@ include_once(dirname(__FILE__).'/../config.inc.php');
include_once(dirname(__FILE__).'/../db.inc.php');
-
-
-
-
-
-
/**
* Display a list of questionnaires to choose from in a drop down list
*
* @param int|bool $questionnaire_id The questionnaire id or false if none selecetd
*
*/
-function display_questionnaire_chooser($questionnaire_id = false, $overall = false)
+function display_questionnaire_chooser($questionnaire_id = false, $overall = false, $divclass=false, $selectclass=false)
{
global $db;
-
$sql = "SELECT questionnaire_id,description,CASE WHEN questionnaire_id = '$questionnaire_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
FROM questionnaire
WHERE enabled = 1";
$rs = $db->GetAll($sql);
- print " ";
+ print " ";
if (!empty($rs))
{
if (is_array($overall))
@@ -92,7 +82,7 @@ function display_questionnaire_chooser($questionnaire_id = false, $overall = fal
* @param int $questionnaire_id The questionnaire id
* @param int|bool $shift_id The shift id or false if none selected
*/
-function display_shift_chooser($questionnaire_id, $shift_id = false)
+function display_shift_chooser($questionnaire_id, $shift_id = false, $divclass=false, $selectclass=false)
{
global $db;
@@ -103,7 +93,7 @@ function display_shift_chooser($questionnaire_id, $shift_id = false)
$rs = $db->GetAll($sql);
- print " ";
+ print " ";
if (!empty($rs))
{
foreach($rs as $r)
@@ -121,13 +111,13 @@ function display_shift_chooser($questionnaire_id, $shift_id = false)
* @param int|bool $sample_import_id The sample import id or false if none selected
* @param bool $disabled Display disabled samples? (default is true)
*/
-function display_sample_chooser($questionnaire_id, $sample_import_id = false, $disabled = true)
+function display_sample_chooser($questionnaire_id, $sample_import_id = false, $disabled = true, $divclass=false, $selectclass=false)
{
global $db;
- $s = "";
+ $s = "";
- if (!$disabled)
+ if (!$disabled)
$s = " AND si.enabled = 1 ";
$sql = "SELECT s.sample_import_id,si.description,CASE WHEN s.sample_import_id = '$sample_import_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
@@ -137,7 +127,7 @@ function display_sample_chooser($questionnaire_id, $sample_import_id = false, $d
$rs = $db->GetAll($sql);
- print " ";
+ print " ";
if (!empty($rs))
{
foreach($rs as $r)
@@ -155,7 +145,7 @@ function display_sample_chooser($questionnaire_id, $sample_import_id = false, $d
* @param int $sample_import_id The sample import id
* @param int|bool $qsqri The sample import id or false if none selected
*/
-function display_quota_chooser($questionnaire_id, $sample_import_id, $qsqri = false)
+function display_quota_chooser($questionnaire_id, $sample_import_id, $qsqri = false, $divclass=false, $selectclass=false)
{
global $db;
@@ -166,7 +156,7 @@ function display_quota_chooser($questionnaire_id, $sample_import_id, $qsqri = fa
$rs = $db->GetAll($sql);
- print " ";
+ print " ";
if (!empty($rs))
{
foreach($rs as $r)
@@ -177,6 +167,4 @@ function display_quota_chooser($questionnaire_id, $sample_import_id, $qsqri = fa
print "
";
}
-
-
-?>
+?>
\ No newline at end of file
diff --git a/functions/functions.xhtml.php b/functions/functions.xhtml.php
index 1ab4a49a..e183c2f3 100644
--- a/functions/functions.xhtml.php
+++ b/functions/functions.xhtml.php
@@ -146,10 +146,10 @@ function xhtml_table($content,$fields,$head = false,$class = "tclass",$highlight
print "";
foreach ($fields as $e)
{
- print "";
+ print " ";
if (in_array($e,$total))
print $tot[$e];
- print " ";
+ print "";
}
print " ";
}
@@ -176,11 +176,11 @@ function xhtml_table($content,$fields,$head = false,$class = "tclass",$highlight
* @param bool $print Default is true, print the chooser otherwise return as a string
*
*/
-function display_chooser($elements, $selectid, $var, $useblank = true, $pass = false, $js = true, $indiv = true, $selected = false, $print = true, $class=false)
+function display_chooser($elements, $selectid, $var, $useblank = true, $pass = false, $js = true, $indiv = true, $selected = false, $print = true, $divclass=false, $selectclass="form-control")
{
$out = "";
- if ($indiv) $out .= "";
- $out .= "
.arrow {
+ left: 25px;
+}
+.clockpicker-align-top.popover > .arrow {
+ top: 17px;
+}
+.clockpicker-align-right.popover > .arrow {
+ left: auto;
+ right: 25px;
+}
+.clockpicker-align-bottom.popover > .arrow {
+ top: auto;
+ bottom: 6px;
+}
+.clockpicker-popover .popover-title {
+ background-color: #fff;
+ color: #999;
+ font-size: 24px;
+ font-weight: bold;
+ line-height: 30px;
+ text-align: center;
+}
+.clockpicker-popover .popover-title span {
+ cursor: pointer;
+}
+.clockpicker-popover .popover-content {
+ background-color: #f8f8f8;
+ padding: 12px;
+}
+.popover-content:last-child {
+ border-bottom-left-radius: 5px;
+ border-bottom-right-radius: 5px;
+}
+.clockpicker-plate {
+ background-color: #fff;
+ border: 1px solid #ccc;
+ border-radius: 50%;
+ width: 200px;
+ height: 200px;
+ overflow: visible;
+ position: relative;
+ /* Disable text selection highlighting. Thanks to Hermanya */
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+.clockpicker-canvas,
+.clockpicker-dial {
+ width: 200px;
+ height: 200px;
+ position: absolute;
+ left: -1px;
+ top: -1px;
+}
+.clockpicker-minutes {
+ visibility: hidden;
+}
+.clockpicker-tick {
+ border-radius: 50%;
+ color: #666;
+ line-height: 26px;
+ text-align: center;
+ width: 26px;
+ height: 26px;
+ position: absolute;
+ cursor: pointer;
+}
+.clockpicker-tick.active,
+.clockpicker-tick:hover {
+ background-color: rgb(192, 229, 247);
+ background-color: rgba(0, 149, 221, .25);
+}
+.clockpicker-button {
+ background-image: none;
+ background-color: #fff;
+ border-width: 1px 0 0;
+ border-top-left-radius: 0;
+ border-top-right-radius: 0;
+ margin: 0;
+ padding: 10px 0;
+}
+.clockpicker-button:hover {
+ background-image: none;
+ background-color: #ebebeb;
+}
+.clockpicker-button:focus {
+ outline: none!important;
+}
+.clockpicker-dial {
+ -webkit-transition: -webkit-transform 350ms, opacity 350ms;
+ -moz-transition: -moz-transform 350ms, opacity 350ms;
+ -ms-transition: -ms-transform 350ms, opacity 350ms;
+ -o-transition: -o-transform 350ms, opacity 350ms;
+ transition: transform 350ms, opacity 350ms;
+}
+.clockpicker-dial-out {
+ opacity: 0;
+}
+.clockpicker-hours.clockpicker-dial-out {
+ -webkit-transform: scale(1.2, 1.2);
+ -moz-transform: scale(1.2, 1.2);
+ -ms-transform: scale(1.2, 1.2);
+ -o-transform: scale(1.2, 1.2);
+ transform: scale(1.2, 1.2);
+}
+.clockpicker-minutes.clockpicker-dial-out {
+ -webkit-transform: scale(.8, .8);
+ -moz-transform: scale(.8, .8);
+ -ms-transform: scale(.8, .8);
+ -o-transform: scale(.8, .8);
+ transform: scale(.8, .8);
+}
+.clockpicker-canvas {
+ -webkit-transition: opacity 175ms;
+ -moz-transition: opacity 175ms;
+ -ms-transition: opacity 175ms;
+ -o-transition: opacity 175ms;
+ transition: opacity 175ms;
+}
+.clockpicker-canvas-out {
+ opacity: 0.25;
+}
+.clockpicker-canvas-bearing,
+.clockpicker-canvas-fg {
+ stroke: none;
+ fill: rgb(0, 149, 221);
+}
+.clockpicker-canvas-bg {
+ stroke: none;
+ fill: rgb(192, 229, 247);
+}
+.clockpicker-canvas-bg-trans {
+ fill: rgba(0, 149, 221, .25);
+}
+.clockpicker-canvas line {
+ stroke: rgb(0, 149, 221);
+ stroke-width: 1;
+ stroke-linecap: round;
+ /*shape-rendering: crispEdges;*/
+}
+.clockpicker-button.am-button {
+ margin: 1px;
+ padding: 5px;
+ border: 1px solid rgba(0, 0, 0, .2);
+ border-radius: 4px;
+
+}
+.clockpicker-button.pm-button {
+ margin: 1px 1px 1px 136px;
+ padding: 5px;
+ border: 1px solid rgba(0, 0, 0, .2);
+ border-radius: 4px;
+}
diff --git a/include/clockpicker/dist/bootstrap-clockpicker.js b/include/clockpicker/dist/bootstrap-clockpicker.js
new file mode 100644
index 00000000..e930b4ff
--- /dev/null
+++ b/include/clockpicker/dist/bootstrap-clockpicker.js
@@ -0,0 +1,729 @@
+/*!
+ * ClockPicker v0.0.7 (http://weareoutman.github.io/clockpicker/)
+ * Copyright 2014 Wang Shenwei.
+ * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
+ */
+
+;(function(){
+ var $ = window.jQuery,
+ $win = $(window),
+ $doc = $(document),
+ $body;
+
+ // Can I use inline svg ?
+ var svgNS = 'http://www.w3.org/2000/svg',
+ svgSupported = 'SVGAngle' in window && (function(){
+ var supported,
+ el = document.createElement('div');
+ el.innerHTML = ' ';
+ supported = (el.firstChild && el.firstChild.namespaceURI) == svgNS;
+ el.innerHTML = '';
+ return supported;
+ })();
+
+ // Can I use transition ?
+ var transitionSupported = (function(){
+ var style = document.createElement('div').style;
+ return 'transition' in style ||
+ 'WebkitTransition' in style ||
+ 'MozTransition' in style ||
+ 'msTransition' in style ||
+ 'OTransition' in style;
+ })();
+
+ // Listen touch events in touch screen device, instead of mouse events in desktop.
+ var touchSupported = 'ontouchstart' in window,
+ mousedownEvent = 'mousedown' + ( touchSupported ? ' touchstart' : ''),
+ mousemoveEvent = 'mousemove.clockpicker' + ( touchSupported ? ' touchmove.clockpicker' : ''),
+ mouseupEvent = 'mouseup.clockpicker' + ( touchSupported ? ' touchend.clockpicker' : '');
+
+ // Vibrate the device if supported
+ var vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitVibrate ? 'webkitVibrate' : null;
+
+ function createSvgElement(name) {
+ return document.createElementNS(svgNS, name);
+ }
+
+ function leadingZero(num) {
+ return (num < 10 ? '0' : '') + num;
+ }
+
+ // Get a unique id
+ var idCounter = 0;
+ function uniqueId(prefix) {
+ var id = ++idCounter + '';
+ return prefix ? prefix + id : id;
+ }
+
+ // Clock size
+ var dialRadius = 100,
+ outerRadius = 80,
+ // innerRadius = 80 on 12 hour clock
+ innerRadius = 54,
+ tickRadius = 13,
+ diameter = dialRadius * 2,
+ duration = transitionSupported ? 350 : 1;
+
+ // Popover template
+ var tpl = [
+ '',
+ '
',
+ '
',
+ ' ',
+ ' : ',
+ ' ',
+ ' ',
+ '
',
+ '
',
+ '
'
+ ].join('');
+
+ // ClockPicker
+ function ClockPicker(element, options) {
+ var popover = $(tpl),
+ plate = popover.find('.clockpicker-plate'),
+ hoursView = popover.find('.clockpicker-hours'),
+ minutesView = popover.find('.clockpicker-minutes'),
+ amPmBlock = popover.find('.clockpicker-am-pm-block'),
+ isInput = element.prop('tagName') === 'INPUT',
+ input = isInput ? element : element.find('input'),
+ addon = element.find('.input-group-addon'),
+ self = this,
+ timer;
+
+ this.id = uniqueId('cp');
+ this.element = element;
+ this.options = options;
+ this.isAppended = false;
+ this.isShown = false;
+ this.currentView = 'hours';
+ this.isInput = isInput;
+ this.input = input;
+ this.addon = addon;
+ this.popover = popover;
+ this.plate = plate;
+ this.hoursView = hoursView;
+ this.minutesView = minutesView;
+ this.amPmBlock = amPmBlock;
+ this.spanHours = popover.find('.clockpicker-span-hours');
+ this.spanMinutes = popover.find('.clockpicker-span-minutes');
+ this.spanAmPm = popover.find('.clockpicker-span-am-pm');
+ this.amOrPm = "PM";
+
+ // Setup for for 12 hour clock if option is selected
+ if (options.twelvehour) {
+
+ var amPmButtonsTemplate = ['',
+ '',
+ 'AM ',
+ '',
+ 'PM ',
+ '
'].join('');
+
+ var amPmButtons = $(amPmButtonsTemplate);
+ //amPmButtons.appendTo(plate);
+
+ ////Not working b/c they are not shown when this runs
+ //$('clockpicker-am-button')
+ // .on("click", function() {
+ // self.amOrPm = "AM";
+ // $('.clockpicker-span-am-pm').empty().append('AM');
+ // });
+ //
+ //$('clockpicker-pm-button')
+ // .on("click", function() {
+ // self.amOrPm = "PM";
+ // $('.clockpicker-span-am-pm').empty().append('PM');
+ // });
+
+ $('' + "AM" + ' ')
+ .on("click", function() {
+ self.amOrPm = "AM";
+ $('.clockpicker-span-am-pm').empty().append('AM');
+ }).appendTo(this.amPmBlock);
+
+
+ $('' + "PM" + ' ')
+ .on("click", function() {
+ self.amOrPm = 'PM';
+ $('.clockpicker-span-am-pm').empty().append('PM');
+ }).appendTo(this.amPmBlock);
+
+ }
+
+ if (! options.autoclose) {
+ // If autoclose is not setted, append a button
+ $('' + options.donetext + ' ')
+ .click($.proxy(this.done, this))
+ .appendTo(popover);
+ }
+
+ // Placement and arrow align - make sure they make sense.
+ if ((options.placement === 'top' || options.placement === 'bottom') && (options.align === 'top' || options.align === 'bottom')) options.align = 'left';
+ if ((options.placement === 'left' || options.placement === 'right') && (options.align === 'left' || options.align === 'right')) options.align = 'top';
+
+ popover.addClass(options.placement);
+ popover.addClass('clockpicker-align-' + options.align);
+
+ this.spanHours.click($.proxy(this.toggleView, this, 'hours'));
+ this.spanMinutes.click($.proxy(this.toggleView, this, 'minutes'));
+
+ // Show or toggle
+ input.on('focus.clockpicker click.clockpicker', $.proxy(this.show, this));
+ addon.on('click.clockpicker', $.proxy(this.toggle, this));
+
+ // Build ticks
+ var tickTpl = $('
'),
+ i, tick, radian, radius;
+
+ // Hours view
+ if (options.twelvehour) {
+ for (i = 1; i < 13; i += 1) {
+ tick = tickTpl.clone();
+ radian = i / 6 * Math.PI;
+ radius = outerRadius;
+ tick.css('font-size', '120%');
+ tick.css({
+ left: dialRadius + Math.sin(radian) * radius - tickRadius,
+ top: dialRadius - Math.cos(radian) * radius - tickRadius
+ });
+ tick.html(i === 0 ? '00' : i);
+ hoursView.append(tick);
+ tick.on(mousedownEvent, mousedown);
+ }
+ } else {
+ for (i = 0; i < 24; i += 1) {
+ tick = tickTpl.clone();
+ radian = i / 6 * Math.PI;
+ var inner = i > 0 && i < 13;
+ radius = inner ? innerRadius : outerRadius;
+ tick.css({
+ left: dialRadius + Math.sin(radian) * radius - tickRadius,
+ top: dialRadius - Math.cos(radian) * radius - tickRadius
+ });
+ if (inner) {
+ tick.css('font-size', '120%');
+ }
+ tick.html(i === 0 ? '00' : i);
+ hoursView.append(tick);
+ tick.on(mousedownEvent, mousedown);
+ }
+ }
+
+ // Minutes view
+ for (i = 0; i < 60; i += 5) {
+ tick = tickTpl.clone();
+ radian = i / 30 * Math.PI;
+ tick.css({
+ left: dialRadius + Math.sin(radian) * outerRadius - tickRadius,
+ top: dialRadius - Math.cos(radian) * outerRadius - tickRadius
+ });
+ tick.css('font-size', '120%');
+ tick.html(leadingZero(i));
+ minutesView.append(tick);
+ tick.on(mousedownEvent, mousedown);
+ }
+
+ // Clicking on minutes view space
+ plate.on(mousedownEvent, function(e){
+ if ($(e.target).closest('.clockpicker-tick').length === 0) {
+ mousedown(e, true);
+ }
+ });
+
+ // Mousedown or touchstart
+ function mousedown(e, space) {
+ var offset = plate.offset(),
+ isTouch = /^touch/.test(e.type),
+ x0 = offset.left + dialRadius,
+ y0 = offset.top + dialRadius,
+ dx = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
+ dy = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0,
+ z = Math.sqrt(dx * dx + dy * dy),
+ moved = false;
+
+ // When clicking on minutes view space, check the mouse position
+ if (space && (z < outerRadius - tickRadius || z > outerRadius + tickRadius)) {
+ return;
+ }
+ e.preventDefault();
+
+ // Set cursor style of body after 200ms
+ var movingTimer = setTimeout(function(){
+ $body.addClass('clockpicker-moving');
+ }, 200);
+
+ // Place the canvas to top
+ if (svgSupported) {
+ plate.append(self.canvas);
+ }
+
+ // Clock
+ self.setHand(dx, dy, ! space, true);
+
+ // Mousemove on document
+ $doc.off(mousemoveEvent).on(mousemoveEvent, function(e){
+ e.preventDefault();
+ var isTouch = /^touch/.test(e.type),
+ x = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
+ y = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0;
+ if (! moved && x === dx && y === dy) {
+ // Clicking in chrome on windows will trigger a mousemove event
+ return;
+ }
+ moved = true;
+ self.setHand(x, y, false, true);
+ });
+
+ // Mouseup on document
+ $doc.off(mouseupEvent).on(mouseupEvent, function(e){
+ $doc.off(mouseupEvent);
+ e.preventDefault();
+ var isTouch = /^touch/.test(e.type),
+ x = (isTouch ? e.originalEvent.changedTouches[0] : e).pageX - x0,
+ y = (isTouch ? e.originalEvent.changedTouches[0] : e).pageY - y0;
+ if ((space || moved) && x === dx && y === dy) {
+ self.setHand(x, y);
+ }
+ if (self.currentView === 'hours') {
+ self.toggleView('minutes', duration / 2);
+ } else {
+ if (options.autoclose) {
+ self.minutesView.addClass('clockpicker-dial-out');
+ setTimeout(function(){
+ self.done();
+ }, duration / 2);
+ }
+ }
+ plate.prepend(canvas);
+
+ // Reset cursor style of body
+ clearTimeout(movingTimer);
+ $body.removeClass('clockpicker-moving');
+
+ // Unbind mousemove event
+ $doc.off(mousemoveEvent);
+ });
+ }
+
+ if (svgSupported) {
+ // Draw clock hands and others
+ var canvas = popover.find('.clockpicker-canvas'),
+ svg = createSvgElement('svg');
+ svg.setAttribute('class', 'clockpicker-svg');
+ svg.setAttribute('width', diameter);
+ svg.setAttribute('height', diameter);
+ var g = createSvgElement('g');
+ g.setAttribute('transform', 'translate(' + dialRadius + ',' + dialRadius + ')');
+ var bearing = createSvgElement('circle');
+ bearing.setAttribute('class', 'clockpicker-canvas-bearing');
+ bearing.setAttribute('cx', 0);
+ bearing.setAttribute('cy', 0);
+ bearing.setAttribute('r', 2);
+ var hand = createSvgElement('line');
+ hand.setAttribute('x1', 0);
+ hand.setAttribute('y1', 0);
+ var bg = createSvgElement('circle');
+ bg.setAttribute('class', 'clockpicker-canvas-bg');
+ bg.setAttribute('r', tickRadius);
+ var fg = createSvgElement('circle');
+ fg.setAttribute('class', 'clockpicker-canvas-fg');
+ fg.setAttribute('r', 3.5);
+ g.appendChild(hand);
+ g.appendChild(bg);
+ g.appendChild(fg);
+ g.appendChild(bearing);
+ svg.appendChild(g);
+ canvas.append(svg);
+
+ this.hand = hand;
+ this.bg = bg;
+ this.fg = fg;
+ this.bearing = bearing;
+ this.g = g;
+ this.canvas = canvas;
+ }
+
+ raiseCallback(this.options.init);
+ }
+
+ function raiseCallback(callbackFunction) {
+ if (callbackFunction && typeof callbackFunction === "function") {
+ callbackFunction();
+ }
+ }
+
+ // Default options
+ ClockPicker.DEFAULTS = {
+ 'default': '', // default time, 'now' or '13:14' e.g.
+ fromnow: 0, // set default time to * milliseconds from now (using with default = 'now')
+ placement: 'bottom', // clock popover placement
+ align: 'left', // popover arrow align
+ donetext: '完成', // done button text
+ autoclose: false, // auto close when minute is selected
+ twelvehour: false, // change to 12 hour AM/PM clock from 24 hour
+ vibrate: true // vibrate the device when dragging clock hand
+ };
+
+ // Show or hide popover
+ ClockPicker.prototype.toggle = function(){
+ this[this.isShown ? 'hide' : 'show']();
+ };
+
+ // Set popover position
+ ClockPicker.prototype.locate = function(){
+ var element = this.element,
+ popover = this.popover,
+ offset = element.offset(),
+ width = element.outerWidth(),
+ height = element.outerHeight(),
+ placement = this.options.placement,
+ align = this.options.align,
+ styles = {},
+ self = this;
+
+ popover.show();
+
+ // Place the popover
+ switch (placement) {
+ case 'bottom':
+ styles.top = offset.top + height;
+ break;
+ case 'right':
+ styles.left = offset.left + width;
+ break;
+ case 'top':
+ styles.top = offset.top - popover.outerHeight();
+ break;
+ case 'left':
+ styles.left = offset.left - popover.outerWidth();
+ break;
+ }
+
+ // Align the popover arrow
+ switch (align) {
+ case 'left':
+ styles.left = offset.left;
+ break;
+ case 'right':
+ styles.left = offset.left + width - popover.outerWidth();
+ break;
+ case 'top':
+ styles.top = offset.top;
+ break;
+ case 'bottom':
+ styles.top = offset.top + height - popover.outerHeight();
+ break;
+ }
+
+ popover.css(styles);
+ };
+
+ // Show popover
+ ClockPicker.prototype.show = function(e){
+ // Not show again
+ if (this.isShown) {
+ return;
+ }
+
+ raiseCallback(this.options.beforeShow);
+
+ var self = this;
+
+ // Initialize
+ if (! this.isAppended) {
+ // Append popover to body
+ $body = $(document.body).append(this.popover);
+
+ // Reset position when resize
+ $win.on('resize.clockpicker' + this.id, function(){
+ if (self.isShown) {
+ self.locate();
+ }
+ });
+
+ this.isAppended = true;
+ }
+
+ // Get the time
+ var value = ((this.input.prop('value') || this.options['default'] || '') + '').split(':');
+ if (value[0] === 'now') {
+ var now = new Date(+ new Date() + this.options.fromnow);
+ value = [
+ now.getHours(),
+ now.getMinutes()
+ ];
+ }
+ this.hours = + value[0] || 0;
+ this.minutes = + value[1] || 0;
+ this.spanHours.html(leadingZero(this.hours));
+ this.spanMinutes.html(leadingZero(this.minutes));
+
+ // Toggle to hours view
+ this.toggleView('hours');
+
+ // Set position
+ this.locate();
+
+ this.isShown = true;
+
+ // Hide when clicking or tabbing on any element except the clock, input and addon
+ $doc.on('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id, function(e){
+ var target = $(e.target);
+ if (target.closest(self.popover).length === 0 &&
+ target.closest(self.addon).length === 0 &&
+ target.closest(self.input).length === 0) {
+ self.hide();
+ }
+ });
+
+ // Hide when ESC is pressed
+ $doc.on('keyup.clockpicker.' + this.id, function(e){
+ if (e.keyCode === 27) {
+ self.hide();
+ }
+ });
+
+ raiseCallback(this.options.afterShow);
+ };
+
+ // Hide popover
+ ClockPicker.prototype.hide = function(){
+ raiseCallback(this.options.beforeHide);
+
+ this.isShown = false;
+
+ // Unbinding events on document
+ $doc.off('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id);
+ $doc.off('keyup.clockpicker.' + this.id);
+
+ this.popover.hide();
+
+ raiseCallback(this.options.afterHide);
+ };
+
+ // Toggle to hours or minutes view
+ ClockPicker.prototype.toggleView = function(view, delay){
+ var raiseAfterHourSelect = false;
+ if (view === 'minutes' && $(this.hoursView).css("visibility") === "visible") {
+ raiseCallback(this.options.beforeHourSelect);
+ raiseAfterHourSelect = true;
+ }
+ var isHours = view === 'hours',
+ nextView = isHours ? this.hoursView : this.minutesView,
+ hideView = isHours ? this.minutesView : this.hoursView;
+
+ this.currentView = view;
+
+ this.spanHours.toggleClass('text-primary', isHours);
+ this.spanMinutes.toggleClass('text-primary', ! isHours);
+
+ // Let's make transitions
+ hideView.addClass('clockpicker-dial-out');
+ nextView.css('visibility', 'visible').removeClass('clockpicker-dial-out');
+
+ // Reset clock hand
+ this.resetClock(delay);
+
+ // After transitions ended
+ clearTimeout(this.toggleViewTimer);
+ this.toggleViewTimer = setTimeout(function(){
+ hideView.css('visibility', 'hidden');
+ }, duration);
+
+ if (raiseAfterHourSelect) {
+ raiseCallback(this.options.afterHourSelect);
+ }
+ };
+
+ // Reset clock hand
+ ClockPicker.prototype.resetClock = function(delay){
+ var view = this.currentView,
+ value = this[view],
+ isHours = view === 'hours',
+ unit = Math.PI / (isHours ? 6 : 30),
+ radian = value * unit,
+ radius = isHours && value > 0 && value < 13 ? innerRadius : outerRadius,
+ x = Math.sin(radian) * radius,
+ y = - Math.cos(radian) * radius,
+ self = this;
+ if (svgSupported && delay) {
+ self.canvas.addClass('clockpicker-canvas-out');
+ setTimeout(function(){
+ self.canvas.removeClass('clockpicker-canvas-out');
+ self.setHand(x, y);
+ }, delay);
+ } else {
+ this.setHand(x, y);
+ }
+ };
+
+ // Set clock hand to (x, y)
+ ClockPicker.prototype.setHand = function(x, y, roundBy5, dragging){
+ var radian = Math.atan2(x, - y),
+ isHours = this.currentView === 'hours',
+ unit = Math.PI / (isHours || roundBy5 ? 6 : 30),
+ z = Math.sqrt(x * x + y * y),
+ options = this.options,
+ inner = isHours && z < (outerRadius + innerRadius) / 2,
+ radius = inner ? innerRadius : outerRadius,
+ value;
+
+ if (options.twelvehour) {
+ radius = outerRadius;
+ }
+
+ // Radian should in range [0, 2PI]
+ if (radian < 0) {
+ radian = Math.PI * 2 + radian;
+ }
+
+ // Get the round value
+ value = Math.round(radian / unit);
+
+ // Get the round radian
+ radian = value * unit;
+
+ // Correct the hours or minutes
+ if (options.twelvehour) {
+ if (isHours) {
+ if (value === 0) {
+ value = 12;
+ }
+ } else {
+ if (roundBy5) {
+ value *= 5;
+ }
+ if (value === 60) {
+ value = 0;
+ }
+ }
+ } else {
+ if (isHours) {
+ if (value === 12) {
+ value = 0;
+ }
+ value = inner ? (value === 0 ? 12 : value) : value === 0 ? 0 : value + 12;
+ } else {
+ if (roundBy5) {
+ value *= 5;
+ }
+ if (value === 60) {
+ value = 0;
+ }
+ }
+ }
+
+ // Once hours or minutes changed, vibrate the device
+ if (this[this.currentView] !== value) {
+ if (vibrate && this.options.vibrate) {
+ // Do not vibrate too frequently
+ if (! this.vibrateTimer) {
+ navigator[vibrate](10);
+ this.vibrateTimer = setTimeout($.proxy(function(){
+ this.vibrateTimer = null;
+ }, this), 100);
+ }
+ }
+ }
+
+ this[this.currentView] = value;
+ this[isHours ? 'spanHours' : 'spanMinutes'].html(leadingZero(value));
+
+ // If svg is not supported, just add an active class to the tick
+ if (! svgSupported) {
+ this[isHours ? 'hoursView' : 'minutesView'].find('.clockpicker-tick').each(function(){
+ var tick = $(this);
+ tick.toggleClass('active', value === + tick.html());
+ });
+ return;
+ }
+
+ // Place clock hand at the top when dragging
+ if (dragging || (! isHours && value % 5)) {
+ this.g.insertBefore(this.hand, this.bearing);
+ this.g.insertBefore(this.bg, this.fg);
+ this.bg.setAttribute('class', 'clockpicker-canvas-bg clockpicker-canvas-bg-trans');
+ } else {
+ // Or place it at the bottom
+ this.g.insertBefore(this.hand, this.bg);
+ this.g.insertBefore(this.fg, this.bg);
+ this.bg.setAttribute('class', 'clockpicker-canvas-bg');
+ }
+
+ // Set clock hand and others' position
+ var cx = Math.sin(radian) * radius,
+ cy = - Math.cos(radian) * radius;
+ this.hand.setAttribute('x2', cx);
+ this.hand.setAttribute('y2', cy);
+ this.bg.setAttribute('cx', cx);
+ this.bg.setAttribute('cy', cy);
+ this.fg.setAttribute('cx', cx);
+ this.fg.setAttribute('cy', cy);
+ };
+
+ // Hours and minutes are selected
+ ClockPicker.prototype.done = function() {
+ raiseCallback(this.options.beforeDone);
+ this.hide();
+ var last = this.input.prop('value'),
+ value = leadingZero(this.hours) + ':' + leadingZero(this.minutes);
+ if (this.options.twelvehour) {
+ value = value + this.amOrPm;
+ }
+
+ this.input.prop('value', value);
+ if (value !== last) {
+ this.input.triggerHandler('change');
+ if (! this.isInput) {
+ this.element.trigger('change');
+ }
+ }
+
+ if (this.options.autoclose) {
+ this.input.trigger('blur');
+ }
+
+ raiseCallback(this.options.afterDone);
+ };
+
+ // Remove clockpicker from input
+ ClockPicker.prototype.remove = function() {
+ this.element.removeData('clockpicker');
+ this.input.off('focus.clockpicker click.clockpicker');
+ this.addon.off('click.clockpicker');
+ if (this.isShown) {
+ this.hide();
+ }
+ if (this.isAppended) {
+ $win.off('resize.clockpicker' + this.id);
+ this.popover.remove();
+ }
+ };
+
+ // Extends $.fn.clockpicker
+ $.fn.clockpicker = function(option){
+ var args = Array.prototype.slice.call(arguments, 1);
+ return this.each(function(){
+ var $this = $(this),
+ data = $this.data('clockpicker');
+ if (! data) {
+ var options = $.extend({}, ClockPicker.DEFAULTS, $this.data(), typeof option == 'object' && option);
+ $this.data('clockpicker', new ClockPicker($this, options));
+ } else {
+ // Manual operatsions. show, hide, remove, e.g.
+ if (typeof data[option] === 'function') {
+ data[option].apply(data, args);
+ }
+ }
+ });
+ };
+}());
diff --git a/include/clockpicker/dist/bootstrap-clockpicker.min.css b/include/clockpicker/dist/bootstrap-clockpicker.min.css
new file mode 100644
index 00000000..cf150784
--- /dev/null
+++ b/include/clockpicker/dist/bootstrap-clockpicker.min.css
@@ -0,0 +1,5 @@
+/*!
+ * ClockPicker v0.0.7 for Bootstrap (http://weareoutman.github.io/clockpicker/)
+ * Copyright 2014 Wang Shenwei.
+ * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
+ */.clockpicker .input-group-addon{cursor:pointer}.clockpicker-moving{cursor:move}.clockpicker-align-left.popover>.arrow{left:25px}.clockpicker-align-top.popover>.arrow{top:17px}.clockpicker-align-right.popover>.arrow{left:auto;right:25px}.clockpicker-align-bottom.popover>.arrow{top:auto;bottom:6px}.clockpicker-popover .popover-title{background-color:#fff;color:#999;font-size:24px;font-weight:700;line-height:30px;text-align:center}.clockpicker-popover .popover-title span{cursor:pointer}.clockpicker-popover .popover-content{background-color:#f8f8f8;padding:12px}.popover-content:last-child{border-bottom-left-radius:5px;border-bottom-right-radius:5px}.clockpicker-plate{background-color:#fff;border:1px solid #ccc;border-radius:50%;width:200px;height:200px;overflow:visible;position:relative;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.clockpicker-canvas,.clockpicker-dial{width:200px;height:200px;position:absolute;left:-1px;top:-1px}.clockpicker-minutes{visibility:hidden}.clockpicker-tick{border-radius:50%;color:#666;line-height:26px;text-align:center;width:26px;height:26px;position:absolute;cursor:pointer}.clockpicker-tick.active,.clockpicker-tick:hover{background-color:#c0e5f7;background-color:rgba(0,149,221,.25)}.clockpicker-button{background-image:none;background-color:#fff;border-width:1px 0 0;border-top-left-radius:0;border-top-right-radius:0;margin:0;padding:10px 0}.clockpicker-button:hover{background-image:none;background-color:#ebebeb}.clockpicker-button:focus{outline:0!important}.clockpicker-dial{-webkit-transition:-webkit-transform 350ms,opacity 350ms;-moz-transition:-moz-transform 350ms,opacity 350ms;-ms-transition:-ms-transform 350ms,opacity 350ms;-o-transition:-o-transform 350ms,opacity 350ms;transition:transform 350ms,opacity 350ms}.clockpicker-dial-out{opacity:0}.clockpicker-hours.clockpicker-dial-out{-webkit-transform:scale(1.2,1.2);-moz-transform:scale(1.2,1.2);-ms-transform:scale(1.2,1.2);-o-transform:scale(1.2,1.2);transform:scale(1.2,1.2)}.clockpicker-minutes.clockpicker-dial-out{-webkit-transform:scale(.8,.8);-moz-transform:scale(.8,.8);-ms-transform:scale(.8,.8);-o-transform:scale(.8,.8);transform:scale(.8,.8)}.clockpicker-canvas{-webkit-transition:opacity 175ms;-moz-transition:opacity 175ms;-ms-transition:opacity 175ms;-o-transition:opacity 175ms;transition:opacity 175ms}.clockpicker-canvas-out{opacity:.25}.clockpicker-canvas-bearing,.clockpicker-canvas-fg{stroke:none;fill:#0095dd}.clockpicker-canvas-bg{stroke:none;fill:#c0e5f7}.clockpicker-canvas-bg-trans{fill:rgba(0,149,221,.25)}.clockpicker-canvas line{stroke:#0095dd;stroke-width:1;stroke-linecap:round}.clockpicker-button.am-button{margin:1px;padding:5px;border:1px solid rgba(0,0,0,.2);border-radius:4px}.clockpicker-button.pm-button{margin:1px 1px 1px 136px;padding:5px;border:1px solid rgba(0,0,0,.2);border-radius:4px}
\ No newline at end of file
diff --git a/include/clockpicker/dist/bootstrap-clockpicker.min.js b/include/clockpicker/dist/bootstrap-clockpicker.min.js
new file mode 100644
index 00000000..c8006a38
--- /dev/null
+++ b/include/clockpicker/dist/bootstrap-clockpicker.min.js
@@ -0,0 +1,6 @@
+/*!
+ * ClockPicker v0.0.7 (http://weareoutman.github.io/clockpicker/)
+ * Copyright 2014 Wang Shenwei.
+ * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
+ */
+!function(){function t(t){return document.createElementNS(p,t)}function i(t){return(10>t?"0":"")+t}function e(t){var i=++m+"";return t?t+i:i}function s(s,r){function p(t,i){var e=u.offset(),s=/^touch/.test(t.type),o=e.left+b,n=e.top+b,p=(s?t.originalEvent.touches[0]:t).pageX-o,h=(s?t.originalEvent.touches[0]:t).pageY-n,k=Math.sqrt(p*p+h*h),v=!1;if(!i||!(g-y>k||k>g+y)){t.preventDefault();var m=setTimeout(function(){c.addClass("clockpicker-moving")},200);l&&u.append(x.canvas),x.setHand(p,h,!i,!0),a.off(d).on(d,function(t){t.preventDefault();var i=/^touch/.test(t.type),e=(i?t.originalEvent.touches[0]:t).pageX-o,s=(i?t.originalEvent.touches[0]:t).pageY-n;(v||e!==p||s!==h)&&(v=!0,x.setHand(e,s,!1,!0))}),a.off(f).on(f,function(t){a.off(f),t.preventDefault();var e=/^touch/.test(t.type),s=(e?t.originalEvent.changedTouches[0]:t).pageX-o,l=(e?t.originalEvent.changedTouches[0]:t).pageY-n;(i||v)&&s===p&&l===h&&x.setHand(s,l),"hours"===x.currentView?x.toggleView("minutes",A/2):r.autoclose&&(x.minutesView.addClass("clockpicker-dial-out"),setTimeout(function(){x.done()},A/2)),u.prepend(j),clearTimeout(m),c.removeClass("clockpicker-moving"),a.off(d)})}}var h=n(V),u=h.find(".clockpicker-plate"),v=h.find(".clockpicker-hours"),m=h.find(".clockpicker-minutes"),T=h.find(".clockpicker-am-pm-block"),C="INPUT"===s.prop("tagName"),H=C?s:s.find("input"),P=s.find(".input-group-addon"),x=this;if(this.id=e("cp"),this.element=s,this.options=r,this.isAppended=!1,this.isShown=!1,this.currentView="hours",this.isInput=C,this.input=H,this.addon=P,this.popover=h,this.plate=u,this.hoursView=v,this.minutesView=m,this.amPmBlock=T,this.spanHours=h.find(".clockpicker-span-hours"),this.spanMinutes=h.find(".clockpicker-span-minutes"),this.spanAmPm=h.find(".clockpicker-span-am-pm"),this.amOrPm="PM",r.twelvehour){{var S=['','',"AM ",'',"PM ","
"].join("");n(S)}n('AM ').on("click",function(){x.amOrPm="AM",n(".clockpicker-span-am-pm").empty().append("AM")}).appendTo(this.amPmBlock),n('PM ').on("click",function(){x.amOrPm="PM",n(".clockpicker-span-am-pm").empty().append("PM")}).appendTo(this.amPmBlock)}r.autoclose||n(''+r.donetext+" ").click(n.proxy(this.done,this)).appendTo(h),"top"!==r.placement&&"bottom"!==r.placement||"top"!==r.align&&"bottom"!==r.align||(r.align="left"),"left"!==r.placement&&"right"!==r.placement||"left"!==r.align&&"right"!==r.align||(r.align="top"),h.addClass(r.placement),h.addClass("clockpicker-align-"+r.align),this.spanHours.click(n.proxy(this.toggleView,this,"hours")),this.spanMinutes.click(n.proxy(this.toggleView,this,"minutes")),H.on("focus.clockpicker click.clockpicker",n.proxy(this.show,this)),P.on("click.clockpicker",n.proxy(this.toggle,this));var E,D,I,B,z=n('
');if(r.twelvehour)for(E=1;13>E;E+=1)D=z.clone(),I=E/6*Math.PI,B=g,D.css("font-size","120%"),D.css({left:b+Math.sin(I)*B-y,top:b-Math.cos(I)*B-y}),D.html(0===E?"00":E),v.append(D),D.on(k,p);else for(E=0;24>E;E+=1){D=z.clone(),I=E/6*Math.PI;var O=E>0&&13>E;B=O?w:g,D.css({left:b+Math.sin(I)*B-y,top:b-Math.cos(I)*B-y}),O&&D.css("font-size","120%"),D.html(0===E?"00":E),v.append(D),D.on(k,p)}for(E=0;60>E;E+=5)D=z.clone(),I=E/30*Math.PI,D.css({left:b+Math.sin(I)*g-y,top:b-Math.cos(I)*g-y}),D.css("font-size","120%"),D.html(i(E)),m.append(D),D.on(k,p);if(u.on(k,function(t){0===n(t.target).closest(".clockpicker-tick").length&&p(t,!0)}),l){var j=h.find(".clockpicker-canvas"),L=t("svg");L.setAttribute("class","clockpicker-svg"),L.setAttribute("width",M),L.setAttribute("height",M);var U=t("g");U.setAttribute("transform","translate("+b+","+b+")");var W=t("circle");W.setAttribute("class","clockpicker-canvas-bearing"),W.setAttribute("cx",0),W.setAttribute("cy",0),W.setAttribute("r",2);var N=t("line");N.setAttribute("x1",0),N.setAttribute("y1",0);var X=t("circle");X.setAttribute("class","clockpicker-canvas-bg"),X.setAttribute("r",y);var Y=t("circle");Y.setAttribute("class","clockpicker-canvas-fg"),Y.setAttribute("r",3.5),U.appendChild(N),U.appendChild(X),U.appendChild(Y),U.appendChild(W),L.appendChild(U),j.append(L),this.hand=N,this.bg=X,this.fg=Y,this.bearing=W,this.g=U,this.canvas=j}o(this.options.init)}function o(t){t&&"function"==typeof t&&t()}var c,n=window.jQuery,r=n(window),a=n(document),p="http://www.w3.org/2000/svg",l="SVGAngle"in window&&function(){var t,i=document.createElement("div");return i.innerHTML=" ",t=(i.firstChild&&i.firstChild.namespaceURI)==p,i.innerHTML="",t}(),h=function(){var t=document.createElement("div").style;return"transition"in t||"WebkitTransition"in t||"MozTransition"in t||"msTransition"in t||"OTransition"in t}(),u="ontouchstart"in window,k="mousedown"+(u?" touchstart":""),d="mousemove.clockpicker"+(u?" touchmove.clockpicker":""),f="mouseup.clockpicker"+(u?" touchend.clockpicker":""),v=navigator.vibrate?"vibrate":navigator.webkitVibrate?"webkitVibrate":null,m=0,b=100,g=80,w=54,y=13,M=2*b,A=h?350:1,V=['','
','
',' '," : ",' ',' ',"
",'
","
"].join("");s.DEFAULTS={"default":"",fromnow:0,placement:"bottom",align:"left",donetext:"完成",autoclose:!1,twelvehour:!1,vibrate:!0},s.prototype.toggle=function(){this[this.isShown?"hide":"show"]()},s.prototype.locate=function(){var t=this.element,i=this.popover,e=t.offset(),s=t.outerWidth(),o=t.outerHeight(),c=this.options.placement,n=this.options.align,r={};switch(i.show(),c){case"bottom":r.top=e.top+o;break;case"right":r.left=e.left+s;break;case"top":r.top=e.top-i.outerHeight();break;case"left":r.left=e.left-i.outerWidth()}switch(n){case"left":r.left=e.left;break;case"right":r.left=e.left+s-i.outerWidth();break;case"top":r.top=e.top;break;case"bottom":r.top=e.top+o-i.outerHeight()}i.css(r)},s.prototype.show=function(){if(!this.isShown){o(this.options.beforeShow);var t=this;this.isAppended||(c=n(document.body).append(this.popover),r.on("resize.clockpicker"+this.id,function(){t.isShown&&t.locate()}),this.isAppended=!0);var e=((this.input.prop("value")||this.options["default"]||"")+"").split(":");if("now"===e[0]){var s=new Date(+new Date+this.options.fromnow);e=[s.getHours(),s.getMinutes()]}this.hours=+e[0]||0,this.minutes=+e[1]||0,this.spanHours.html(i(this.hours)),this.spanMinutes.html(i(this.minutes)),this.toggleView("hours"),this.locate(),this.isShown=!0,a.on("click.clockpicker."+this.id+" focusin.clockpicker."+this.id,function(i){var e=n(i.target);0===e.closest(t.popover).length&&0===e.closest(t.addon).length&&0===e.closest(t.input).length&&t.hide()}),a.on("keyup.clockpicker."+this.id,function(i){27===i.keyCode&&t.hide()}),o(this.options.afterShow)}},s.prototype.hide=function(){o(this.options.beforeHide),this.isShown=!1,a.off("click.clockpicker."+this.id+" focusin.clockpicker."+this.id),a.off("keyup.clockpicker."+this.id),this.popover.hide(),o(this.options.afterHide)},s.prototype.toggleView=function(t,i){var e=!1;"minutes"===t&&"visible"===n(this.hoursView).css("visibility")&&(o(this.options.beforeHourSelect),e=!0);var s="hours"===t,c=s?this.hoursView:this.minutesView,r=s?this.minutesView:this.hoursView;this.currentView=t,this.spanHours.toggleClass("text-primary",s),this.spanMinutes.toggleClass("text-primary",!s),r.addClass("clockpicker-dial-out"),c.css("visibility","visible").removeClass("clockpicker-dial-out"),this.resetClock(i),clearTimeout(this.toggleViewTimer),this.toggleViewTimer=setTimeout(function(){r.css("visibility","hidden")},A),e&&o(this.options.afterHourSelect)},s.prototype.resetClock=function(t){var i=this.currentView,e=this[i],s="hours"===i,o=Math.PI/(s?6:30),c=e*o,n=s&&e>0&&13>e?w:g,r=Math.sin(c)*n,a=-Math.cos(c)*n,p=this;l&&t?(p.canvas.addClass("clockpicker-canvas-out"),setTimeout(function(){p.canvas.removeClass("clockpicker-canvas-out"),p.setHand(r,a)},t)):this.setHand(r,a)},s.prototype.setHand=function(t,e,s,o){var c,r=Math.atan2(t,-e),a="hours"===this.currentView,p=Math.PI/(a||s?6:30),h=Math.sqrt(t*t+e*e),u=this.options,k=a&&(g+w)/2>h,d=k?w:g;if(u.twelvehour&&(d=g),0>r&&(r=2*Math.PI+r),c=Math.round(r/p),r=c*p,u.twelvehour?a?0===c&&(c=12):(s&&(c*=5),60===c&&(c=0)):a?(12===c&&(c=0),c=k?0===c?12:c:0===c?0:c+12):(s&&(c*=5),60===c&&(c=0)),this[this.currentView]!==c&&v&&this.options.vibrate&&(this.vibrateTimer||(navigator[v](10),this.vibrateTimer=setTimeout(n.proxy(function(){this.vibrateTimer=null},this),100))),this[this.currentView]=c,this[a?"spanHours":"spanMinutes"].html(i(c)),!l)return void this[a?"hoursView":"minutesView"].find(".clockpicker-tick").each(function(){var t=n(this);t.toggleClass("active",c===+t.html())});o||!a&&c%5?(this.g.insertBefore(this.hand,this.bearing),this.g.insertBefore(this.bg,this.fg),this.bg.setAttribute("class","clockpicker-canvas-bg clockpicker-canvas-bg-trans")):(this.g.insertBefore(this.hand,this.bg),this.g.insertBefore(this.fg,this.bg),this.bg.setAttribute("class","clockpicker-canvas-bg"));var f=Math.sin(r)*d,m=-Math.cos(r)*d;this.hand.setAttribute("x2",f),this.hand.setAttribute("y2",m),this.bg.setAttribute("cx",f),this.bg.setAttribute("cy",m),this.fg.setAttribute("cx",f),this.fg.setAttribute("cy",m)},s.prototype.done=function(){o(this.options.beforeDone),this.hide();var t=this.input.prop("value"),e=i(this.hours)+":"+i(this.minutes);this.options.twelvehour&&(e+=this.amOrPm),this.input.prop("value",e),e!==t&&(this.input.triggerHandler("change"),this.isInput||this.element.trigger("change")),this.options.autoclose&&this.input.trigger("blur"),o(this.options.afterDone)},s.prototype.remove=function(){this.element.removeData("clockpicker"),this.input.off("focus.clockpicker click.clockpicker"),this.addon.off("click.clockpicker"),this.isShown&&this.hide(),this.isAppended&&(r.off("resize.clockpicker"+this.id),this.popover.remove())},n.fn.clockpicker=function(t){var i=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=n(this),o=e.data("clockpicker");if(o)"function"==typeof o[t]&&o[t].apply(o,i);else{var c=n.extend({},s.DEFAULTS,e.data(),"object"==typeof t&&t);e.data("clockpicker",new s(e,c))}})}}();
\ No newline at end of file
diff --git a/include/clockpicker/dist/jquery-clockpicker.css b/include/clockpicker/dist/jquery-clockpicker.css
new file mode 100644
index 00000000..30eeb111
--- /dev/null
+++ b/include/clockpicker/dist/jquery-clockpicker.css
@@ -0,0 +1,370 @@
+/*!
+ * ClockPicker v0.0.7 for jQuery (http://weareoutman.github.io/clockpicker/)
+ * Copyright 2014 Wang Shenwei.
+ * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
+ *
+ * Bootstrap v3.1.1 (http://getbootstrap.com)
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ */
+
+/* Picked from bootstrap: .popover, .btn, .text-primary */
+
+.popover {
+ position: absolute;
+ top: 0;
+ left: 0;
+ z-index: 1010;
+ display: none;
+ max-width: 276px;
+ padding: 1px;
+ text-align: left;
+ white-space: normal;
+ background-color: #fff;
+ background-clip: padding-box;
+ border: 1px solid #ccc;
+ border: 1px solid rgba(0, 0, 0, .2);
+ border-radius: 6px;
+ -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
+ box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
+}
+.popover.top {
+ margin-top: -10px;
+}
+.popover.right {
+ margin-left: 10px;
+}
+.popover.bottom {
+ margin-top: 10px;
+}
+.popover.left {
+ margin-left: -10px;
+}
+.popover-title {
+ padding: 8px 14px;
+ margin: 0;
+ font-size: 14px;
+ font-weight: normal;
+ line-height: 18px;
+ background-color: #f7f7f7;
+ border-bottom: 1px solid #ebebeb;
+ border-radius: 5px 5px 0 0;
+}
+.popover-content {
+ padding: 9px 14px;
+}
+.popover > .arrow,
+.popover > .arrow:after {
+ position: absolute;
+ display: block;
+ width: 0;
+ height: 0;
+ border-color: transparent;
+ border-style: solid;
+ /* The following are set in WordPress (wp-admin/css/revisions.css) - reset them to initial values */
+ overflow:visible;
+ margin:0;
+ padding:0;
+ z-index:auto;
+ background-color:transparent;
+ -webkit-box-shadow:none;
+ box-shadow:none;
+ bottom:auto;
+ left:auto;
+ right:auto;
+ top:auto;
+ -webkit-transform:none;
+ -ms-transform:none;
+ transform:none;
+}
+.popover > .arrow {
+ border-width: 11px;
+}
+.popover > .arrow:after {
+ content: "";
+ border-width: 10px;
+}
+.popover.top > .arrow {
+ bottom: -11px;
+ left: 50%;
+ margin-left: -11px;
+ border-top-color: #999;
+ border-top-color: rgba(0, 0, 0, .25);
+ border-bottom-width: 0;
+}
+.popover.top > .arrow:after {
+ bottom: 1px;
+ margin-left: -10px;
+ content: " ";
+ border-top-color: #fff;
+ border-bottom-width: 0;
+}
+.popover.right > .arrow {
+ top: 50%;
+ left: -11px;
+ margin-top: -11px;
+ border-right-color: #999;
+ border-right-color: rgba(0, 0, 0, .25);
+ border-left-width: 0;
+}
+.popover.right > .arrow:after {
+ bottom: -10px;
+ left: 1px;
+ content: " ";
+ border-right-color: #fff;
+ border-left-width: 0;
+}
+.popover.bottom > .arrow {
+ top: -11px;
+ left: 50%;
+ margin-left: -11px;
+ border-top-width: 0;
+ border-bottom-color: #999;
+ border-bottom-color: rgba(0, 0, 0, .25);
+}
+.popover.bottom > .arrow:after {
+ top: 1px;
+ margin-left: -10px;
+ content: " ";
+ border-top-width: 0;
+ border-bottom-color: #fff;
+}
+.popover.left > .arrow {
+ top: 50%;
+ right: -11px;
+ margin-top: -11px;
+ border-right-width: 0;
+ border-left-color: #999;
+ border-left-color: rgba(0, 0, 0, .25);
+}
+.popover.left > .arrow:after {
+ right: 1px;
+ bottom: -10px;
+ content: " ";
+ border-right-width: 0;
+ border-left-color: #fff;
+}
+.btn {
+ cursor: pointer;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ background-image: none;
+ border: 1px solid transparent;
+
+}
+.btn:focus,
+.btn:active:focus,
+.btn.active:focus {
+ outline: thin dotted;
+ outline: 5px auto -webkit-focus-ring-color;
+ outline-offset: -2px;
+}
+.btn:hover,
+.btn:focus {
+ color: #333;
+ text-decoration: none;
+}
+.btn:active,
+.btn.active {
+ background-image: none;
+ outline: 0;
+ -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
+ box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
+}
+.btn-default {
+ color: #333;
+ background-color: #fff;
+ border-color: #ccc;
+}
+.btn-default:hover,
+.btn-default:focus,
+.btn-default:active,
+.btn-default.active,
+.open .dropdown-toggle.btn-default {
+ color: #333;
+ background-color: #ebebeb;
+ border-color: #adadad;
+}
+.btn-default:active,
+.btn-default.active,
+.open .dropdown-toggle.btn-default {
+ background-image: none;
+}
+.btn-block {
+ display: block;
+ width: 100%;
+}
+.text-primary {
+ color: #428bca;
+}
+
+/*!
+ * ClockPicker v{package.version} for Bootstrap (http://weareoutman.github.io/clockpicker/)
+ * Copyright 2014 Wang Shenwei.
+ * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
+ */
+
+.clockpicker .input-group-addon {
+ cursor: pointer;
+}
+.clockpicker-moving {
+ cursor: move;
+}
+.clockpicker-align-left.popover > .arrow {
+ left: 25px;
+}
+.clockpicker-align-top.popover > .arrow {
+ top: 17px;
+}
+.clockpicker-align-right.popover > .arrow {
+ left: auto;
+ right: 25px;
+}
+.clockpicker-align-bottom.popover > .arrow {
+ top: auto;
+ bottom: 6px;
+}
+.clockpicker-popover .popover-title {
+ background-color: #fff;
+ color: #999;
+ font-size: 24px;
+ font-weight: bold;
+ line-height: 30px;
+ text-align: center;
+}
+.clockpicker-popover .popover-title span {
+ cursor: pointer;
+}
+.clockpicker-popover .popover-content {
+ background-color: #f8f8f8;
+ padding: 12px;
+}
+.popover-content:last-child {
+ border-bottom-left-radius: 5px;
+ border-bottom-right-radius: 5px;
+}
+.clockpicker-plate {
+ background-color: #fff;
+ border: 1px solid #ccc;
+ border-radius: 50%;
+ width: 200px;
+ height: 200px;
+ overflow: visible;
+ position: relative;
+ /* Disable text selection highlighting. Thanks to Hermanya */
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+.clockpicker-canvas,
+.clockpicker-dial {
+ width: 200px;
+ height: 200px;
+ position: absolute;
+ left: -1px;
+ top: -1px;
+}
+.clockpicker-minutes {
+ visibility: hidden;
+}
+.clockpicker-tick {
+ border-radius: 50%;
+ color: #666;
+ line-height: 26px;
+ text-align: center;
+ width: 26px;
+ height: 26px;
+ position: absolute;
+ cursor: pointer;
+}
+.clockpicker-tick.active,
+.clockpicker-tick:hover {
+ background-color: rgb(192, 229, 247);
+ background-color: rgba(0, 149, 221, .25);
+}
+.clockpicker-button {
+ background-image: none;
+ background-color: #fff;
+ border-width: 1px 0 0;
+ border-top-left-radius: 0;
+ border-top-right-radius: 0;
+ margin: 0;
+ padding: 10px 0;
+}
+.clockpicker-button:hover {
+ background-image: none;
+ background-color: #ebebeb;
+}
+.clockpicker-button:focus {
+ outline: none!important;
+}
+.clockpicker-dial {
+ -webkit-transition: -webkit-transform 350ms, opacity 350ms;
+ -moz-transition: -moz-transform 350ms, opacity 350ms;
+ -ms-transition: -ms-transform 350ms, opacity 350ms;
+ -o-transition: -o-transform 350ms, opacity 350ms;
+ transition: transform 350ms, opacity 350ms;
+}
+.clockpicker-dial-out {
+ opacity: 0;
+}
+.clockpicker-hours.clockpicker-dial-out {
+ -webkit-transform: scale(1.2, 1.2);
+ -moz-transform: scale(1.2, 1.2);
+ -ms-transform: scale(1.2, 1.2);
+ -o-transform: scale(1.2, 1.2);
+ transform: scale(1.2, 1.2);
+}
+.clockpicker-minutes.clockpicker-dial-out {
+ -webkit-transform: scale(.8, .8);
+ -moz-transform: scale(.8, .8);
+ -ms-transform: scale(.8, .8);
+ -o-transform: scale(.8, .8);
+ transform: scale(.8, .8);
+}
+.clockpicker-canvas {
+ -webkit-transition: opacity 175ms;
+ -moz-transition: opacity 175ms;
+ -ms-transition: opacity 175ms;
+ -o-transition: opacity 175ms;
+ transition: opacity 175ms;
+}
+.clockpicker-canvas-out {
+ opacity: 0.25;
+}
+.clockpicker-canvas-bearing,
+.clockpicker-canvas-fg {
+ stroke: none;
+ fill: rgb(0, 149, 221);
+}
+.clockpicker-canvas-bg {
+ stroke: none;
+ fill: rgb(192, 229, 247);
+}
+.clockpicker-canvas-bg-trans {
+ fill: rgba(0, 149, 221, .25);
+}
+.clockpicker-canvas line {
+ stroke: rgb(0, 149, 221);
+ stroke-width: 1;
+ stroke-linecap: round;
+ /*shape-rendering: crispEdges;*/
+}
+.clockpicker-button.am-button {
+ margin: 1px;
+ padding: 5px;
+ border: 1px solid rgba(0, 0, 0, .2);
+ border-radius: 4px;
+
+}
+.clockpicker-button.pm-button {
+ margin: 1px 1px 1px 136px;
+ padding: 5px;
+ border: 1px solid rgba(0, 0, 0, .2);
+ border-radius: 4px;
+}
diff --git a/include/clockpicker/dist/jquery-clockpicker.js b/include/clockpicker/dist/jquery-clockpicker.js
new file mode 100644
index 00000000..e930b4ff
--- /dev/null
+++ b/include/clockpicker/dist/jquery-clockpicker.js
@@ -0,0 +1,729 @@
+/*!
+ * ClockPicker v0.0.7 (http://weareoutman.github.io/clockpicker/)
+ * Copyright 2014 Wang Shenwei.
+ * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
+ */
+
+;(function(){
+ var $ = window.jQuery,
+ $win = $(window),
+ $doc = $(document),
+ $body;
+
+ // Can I use inline svg ?
+ var svgNS = 'http://www.w3.org/2000/svg',
+ svgSupported = 'SVGAngle' in window && (function(){
+ var supported,
+ el = document.createElement('div');
+ el.innerHTML = ' ';
+ supported = (el.firstChild && el.firstChild.namespaceURI) == svgNS;
+ el.innerHTML = '';
+ return supported;
+ })();
+
+ // Can I use transition ?
+ var transitionSupported = (function(){
+ var style = document.createElement('div').style;
+ return 'transition' in style ||
+ 'WebkitTransition' in style ||
+ 'MozTransition' in style ||
+ 'msTransition' in style ||
+ 'OTransition' in style;
+ })();
+
+ // Listen touch events in touch screen device, instead of mouse events in desktop.
+ var touchSupported = 'ontouchstart' in window,
+ mousedownEvent = 'mousedown' + ( touchSupported ? ' touchstart' : ''),
+ mousemoveEvent = 'mousemove.clockpicker' + ( touchSupported ? ' touchmove.clockpicker' : ''),
+ mouseupEvent = 'mouseup.clockpicker' + ( touchSupported ? ' touchend.clockpicker' : '');
+
+ // Vibrate the device if supported
+ var vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitVibrate ? 'webkitVibrate' : null;
+
+ function createSvgElement(name) {
+ return document.createElementNS(svgNS, name);
+ }
+
+ function leadingZero(num) {
+ return (num < 10 ? '0' : '') + num;
+ }
+
+ // Get a unique id
+ var idCounter = 0;
+ function uniqueId(prefix) {
+ var id = ++idCounter + '';
+ return prefix ? prefix + id : id;
+ }
+
+ // Clock size
+ var dialRadius = 100,
+ outerRadius = 80,
+ // innerRadius = 80 on 12 hour clock
+ innerRadius = 54,
+ tickRadius = 13,
+ diameter = dialRadius * 2,
+ duration = transitionSupported ? 350 : 1;
+
+ // Popover template
+ var tpl = [
+ '',
+ '
',
+ '
',
+ ' ',
+ ' : ',
+ ' ',
+ ' ',
+ '
',
+ '
',
+ '
'
+ ].join('');
+
+ // ClockPicker
+ function ClockPicker(element, options) {
+ var popover = $(tpl),
+ plate = popover.find('.clockpicker-plate'),
+ hoursView = popover.find('.clockpicker-hours'),
+ minutesView = popover.find('.clockpicker-minutes'),
+ amPmBlock = popover.find('.clockpicker-am-pm-block'),
+ isInput = element.prop('tagName') === 'INPUT',
+ input = isInput ? element : element.find('input'),
+ addon = element.find('.input-group-addon'),
+ self = this,
+ timer;
+
+ this.id = uniqueId('cp');
+ this.element = element;
+ this.options = options;
+ this.isAppended = false;
+ this.isShown = false;
+ this.currentView = 'hours';
+ this.isInput = isInput;
+ this.input = input;
+ this.addon = addon;
+ this.popover = popover;
+ this.plate = plate;
+ this.hoursView = hoursView;
+ this.minutesView = minutesView;
+ this.amPmBlock = amPmBlock;
+ this.spanHours = popover.find('.clockpicker-span-hours');
+ this.spanMinutes = popover.find('.clockpicker-span-minutes');
+ this.spanAmPm = popover.find('.clockpicker-span-am-pm');
+ this.amOrPm = "PM";
+
+ // Setup for for 12 hour clock if option is selected
+ if (options.twelvehour) {
+
+ var amPmButtonsTemplate = ['',
+ '',
+ 'AM ',
+ '',
+ 'PM ',
+ '
'].join('');
+
+ var amPmButtons = $(amPmButtonsTemplate);
+ //amPmButtons.appendTo(plate);
+
+ ////Not working b/c they are not shown when this runs
+ //$('clockpicker-am-button')
+ // .on("click", function() {
+ // self.amOrPm = "AM";
+ // $('.clockpicker-span-am-pm').empty().append('AM');
+ // });
+ //
+ //$('clockpicker-pm-button')
+ // .on("click", function() {
+ // self.amOrPm = "PM";
+ // $('.clockpicker-span-am-pm').empty().append('PM');
+ // });
+
+ $('' + "AM" + ' ')
+ .on("click", function() {
+ self.amOrPm = "AM";
+ $('.clockpicker-span-am-pm').empty().append('AM');
+ }).appendTo(this.amPmBlock);
+
+
+ $('' + "PM" + ' ')
+ .on("click", function() {
+ self.amOrPm = 'PM';
+ $('.clockpicker-span-am-pm').empty().append('PM');
+ }).appendTo(this.amPmBlock);
+
+ }
+
+ if (! options.autoclose) {
+ // If autoclose is not setted, append a button
+ $('' + options.donetext + ' ')
+ .click($.proxy(this.done, this))
+ .appendTo(popover);
+ }
+
+ // Placement and arrow align - make sure they make sense.
+ if ((options.placement === 'top' || options.placement === 'bottom') && (options.align === 'top' || options.align === 'bottom')) options.align = 'left';
+ if ((options.placement === 'left' || options.placement === 'right') && (options.align === 'left' || options.align === 'right')) options.align = 'top';
+
+ popover.addClass(options.placement);
+ popover.addClass('clockpicker-align-' + options.align);
+
+ this.spanHours.click($.proxy(this.toggleView, this, 'hours'));
+ this.spanMinutes.click($.proxy(this.toggleView, this, 'minutes'));
+
+ // Show or toggle
+ input.on('focus.clockpicker click.clockpicker', $.proxy(this.show, this));
+ addon.on('click.clockpicker', $.proxy(this.toggle, this));
+
+ // Build ticks
+ var tickTpl = $('
'),
+ i, tick, radian, radius;
+
+ // Hours view
+ if (options.twelvehour) {
+ for (i = 1; i < 13; i += 1) {
+ tick = tickTpl.clone();
+ radian = i / 6 * Math.PI;
+ radius = outerRadius;
+ tick.css('font-size', '120%');
+ tick.css({
+ left: dialRadius + Math.sin(radian) * radius - tickRadius,
+ top: dialRadius - Math.cos(radian) * radius - tickRadius
+ });
+ tick.html(i === 0 ? '00' : i);
+ hoursView.append(tick);
+ tick.on(mousedownEvent, mousedown);
+ }
+ } else {
+ for (i = 0; i < 24; i += 1) {
+ tick = tickTpl.clone();
+ radian = i / 6 * Math.PI;
+ var inner = i > 0 && i < 13;
+ radius = inner ? innerRadius : outerRadius;
+ tick.css({
+ left: dialRadius + Math.sin(radian) * radius - tickRadius,
+ top: dialRadius - Math.cos(radian) * radius - tickRadius
+ });
+ if (inner) {
+ tick.css('font-size', '120%');
+ }
+ tick.html(i === 0 ? '00' : i);
+ hoursView.append(tick);
+ tick.on(mousedownEvent, mousedown);
+ }
+ }
+
+ // Minutes view
+ for (i = 0; i < 60; i += 5) {
+ tick = tickTpl.clone();
+ radian = i / 30 * Math.PI;
+ tick.css({
+ left: dialRadius + Math.sin(radian) * outerRadius - tickRadius,
+ top: dialRadius - Math.cos(radian) * outerRadius - tickRadius
+ });
+ tick.css('font-size', '120%');
+ tick.html(leadingZero(i));
+ minutesView.append(tick);
+ tick.on(mousedownEvent, mousedown);
+ }
+
+ // Clicking on minutes view space
+ plate.on(mousedownEvent, function(e){
+ if ($(e.target).closest('.clockpicker-tick').length === 0) {
+ mousedown(e, true);
+ }
+ });
+
+ // Mousedown or touchstart
+ function mousedown(e, space) {
+ var offset = plate.offset(),
+ isTouch = /^touch/.test(e.type),
+ x0 = offset.left + dialRadius,
+ y0 = offset.top + dialRadius,
+ dx = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
+ dy = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0,
+ z = Math.sqrt(dx * dx + dy * dy),
+ moved = false;
+
+ // When clicking on minutes view space, check the mouse position
+ if (space && (z < outerRadius - tickRadius || z > outerRadius + tickRadius)) {
+ return;
+ }
+ e.preventDefault();
+
+ // Set cursor style of body after 200ms
+ var movingTimer = setTimeout(function(){
+ $body.addClass('clockpicker-moving');
+ }, 200);
+
+ // Place the canvas to top
+ if (svgSupported) {
+ plate.append(self.canvas);
+ }
+
+ // Clock
+ self.setHand(dx, dy, ! space, true);
+
+ // Mousemove on document
+ $doc.off(mousemoveEvent).on(mousemoveEvent, function(e){
+ e.preventDefault();
+ var isTouch = /^touch/.test(e.type),
+ x = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
+ y = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0;
+ if (! moved && x === dx && y === dy) {
+ // Clicking in chrome on windows will trigger a mousemove event
+ return;
+ }
+ moved = true;
+ self.setHand(x, y, false, true);
+ });
+
+ // Mouseup on document
+ $doc.off(mouseupEvent).on(mouseupEvent, function(e){
+ $doc.off(mouseupEvent);
+ e.preventDefault();
+ var isTouch = /^touch/.test(e.type),
+ x = (isTouch ? e.originalEvent.changedTouches[0] : e).pageX - x0,
+ y = (isTouch ? e.originalEvent.changedTouches[0] : e).pageY - y0;
+ if ((space || moved) && x === dx && y === dy) {
+ self.setHand(x, y);
+ }
+ if (self.currentView === 'hours') {
+ self.toggleView('minutes', duration / 2);
+ } else {
+ if (options.autoclose) {
+ self.minutesView.addClass('clockpicker-dial-out');
+ setTimeout(function(){
+ self.done();
+ }, duration / 2);
+ }
+ }
+ plate.prepend(canvas);
+
+ // Reset cursor style of body
+ clearTimeout(movingTimer);
+ $body.removeClass('clockpicker-moving');
+
+ // Unbind mousemove event
+ $doc.off(mousemoveEvent);
+ });
+ }
+
+ if (svgSupported) {
+ // Draw clock hands and others
+ var canvas = popover.find('.clockpicker-canvas'),
+ svg = createSvgElement('svg');
+ svg.setAttribute('class', 'clockpicker-svg');
+ svg.setAttribute('width', diameter);
+ svg.setAttribute('height', diameter);
+ var g = createSvgElement('g');
+ g.setAttribute('transform', 'translate(' + dialRadius + ',' + dialRadius + ')');
+ var bearing = createSvgElement('circle');
+ bearing.setAttribute('class', 'clockpicker-canvas-bearing');
+ bearing.setAttribute('cx', 0);
+ bearing.setAttribute('cy', 0);
+ bearing.setAttribute('r', 2);
+ var hand = createSvgElement('line');
+ hand.setAttribute('x1', 0);
+ hand.setAttribute('y1', 0);
+ var bg = createSvgElement('circle');
+ bg.setAttribute('class', 'clockpicker-canvas-bg');
+ bg.setAttribute('r', tickRadius);
+ var fg = createSvgElement('circle');
+ fg.setAttribute('class', 'clockpicker-canvas-fg');
+ fg.setAttribute('r', 3.5);
+ g.appendChild(hand);
+ g.appendChild(bg);
+ g.appendChild(fg);
+ g.appendChild(bearing);
+ svg.appendChild(g);
+ canvas.append(svg);
+
+ this.hand = hand;
+ this.bg = bg;
+ this.fg = fg;
+ this.bearing = bearing;
+ this.g = g;
+ this.canvas = canvas;
+ }
+
+ raiseCallback(this.options.init);
+ }
+
+ function raiseCallback(callbackFunction) {
+ if (callbackFunction && typeof callbackFunction === "function") {
+ callbackFunction();
+ }
+ }
+
+ // Default options
+ ClockPicker.DEFAULTS = {
+ 'default': '', // default time, 'now' or '13:14' e.g.
+ fromnow: 0, // set default time to * milliseconds from now (using with default = 'now')
+ placement: 'bottom', // clock popover placement
+ align: 'left', // popover arrow align
+ donetext: '完成', // done button text
+ autoclose: false, // auto close when minute is selected
+ twelvehour: false, // change to 12 hour AM/PM clock from 24 hour
+ vibrate: true // vibrate the device when dragging clock hand
+ };
+
+ // Show or hide popover
+ ClockPicker.prototype.toggle = function(){
+ this[this.isShown ? 'hide' : 'show']();
+ };
+
+ // Set popover position
+ ClockPicker.prototype.locate = function(){
+ var element = this.element,
+ popover = this.popover,
+ offset = element.offset(),
+ width = element.outerWidth(),
+ height = element.outerHeight(),
+ placement = this.options.placement,
+ align = this.options.align,
+ styles = {},
+ self = this;
+
+ popover.show();
+
+ // Place the popover
+ switch (placement) {
+ case 'bottom':
+ styles.top = offset.top + height;
+ break;
+ case 'right':
+ styles.left = offset.left + width;
+ break;
+ case 'top':
+ styles.top = offset.top - popover.outerHeight();
+ break;
+ case 'left':
+ styles.left = offset.left - popover.outerWidth();
+ break;
+ }
+
+ // Align the popover arrow
+ switch (align) {
+ case 'left':
+ styles.left = offset.left;
+ break;
+ case 'right':
+ styles.left = offset.left + width - popover.outerWidth();
+ break;
+ case 'top':
+ styles.top = offset.top;
+ break;
+ case 'bottom':
+ styles.top = offset.top + height - popover.outerHeight();
+ break;
+ }
+
+ popover.css(styles);
+ };
+
+ // Show popover
+ ClockPicker.prototype.show = function(e){
+ // Not show again
+ if (this.isShown) {
+ return;
+ }
+
+ raiseCallback(this.options.beforeShow);
+
+ var self = this;
+
+ // Initialize
+ if (! this.isAppended) {
+ // Append popover to body
+ $body = $(document.body).append(this.popover);
+
+ // Reset position when resize
+ $win.on('resize.clockpicker' + this.id, function(){
+ if (self.isShown) {
+ self.locate();
+ }
+ });
+
+ this.isAppended = true;
+ }
+
+ // Get the time
+ var value = ((this.input.prop('value') || this.options['default'] || '') + '').split(':');
+ if (value[0] === 'now') {
+ var now = new Date(+ new Date() + this.options.fromnow);
+ value = [
+ now.getHours(),
+ now.getMinutes()
+ ];
+ }
+ this.hours = + value[0] || 0;
+ this.minutes = + value[1] || 0;
+ this.spanHours.html(leadingZero(this.hours));
+ this.spanMinutes.html(leadingZero(this.minutes));
+
+ // Toggle to hours view
+ this.toggleView('hours');
+
+ // Set position
+ this.locate();
+
+ this.isShown = true;
+
+ // Hide when clicking or tabbing on any element except the clock, input and addon
+ $doc.on('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id, function(e){
+ var target = $(e.target);
+ if (target.closest(self.popover).length === 0 &&
+ target.closest(self.addon).length === 0 &&
+ target.closest(self.input).length === 0) {
+ self.hide();
+ }
+ });
+
+ // Hide when ESC is pressed
+ $doc.on('keyup.clockpicker.' + this.id, function(e){
+ if (e.keyCode === 27) {
+ self.hide();
+ }
+ });
+
+ raiseCallback(this.options.afterShow);
+ };
+
+ // Hide popover
+ ClockPicker.prototype.hide = function(){
+ raiseCallback(this.options.beforeHide);
+
+ this.isShown = false;
+
+ // Unbinding events on document
+ $doc.off('click.clockpicker.' + this.id + ' focusin.clockpicker.' + this.id);
+ $doc.off('keyup.clockpicker.' + this.id);
+
+ this.popover.hide();
+
+ raiseCallback(this.options.afterHide);
+ };
+
+ // Toggle to hours or minutes view
+ ClockPicker.prototype.toggleView = function(view, delay){
+ var raiseAfterHourSelect = false;
+ if (view === 'minutes' && $(this.hoursView).css("visibility") === "visible") {
+ raiseCallback(this.options.beforeHourSelect);
+ raiseAfterHourSelect = true;
+ }
+ var isHours = view === 'hours',
+ nextView = isHours ? this.hoursView : this.minutesView,
+ hideView = isHours ? this.minutesView : this.hoursView;
+
+ this.currentView = view;
+
+ this.spanHours.toggleClass('text-primary', isHours);
+ this.spanMinutes.toggleClass('text-primary', ! isHours);
+
+ // Let's make transitions
+ hideView.addClass('clockpicker-dial-out');
+ nextView.css('visibility', 'visible').removeClass('clockpicker-dial-out');
+
+ // Reset clock hand
+ this.resetClock(delay);
+
+ // After transitions ended
+ clearTimeout(this.toggleViewTimer);
+ this.toggleViewTimer = setTimeout(function(){
+ hideView.css('visibility', 'hidden');
+ }, duration);
+
+ if (raiseAfterHourSelect) {
+ raiseCallback(this.options.afterHourSelect);
+ }
+ };
+
+ // Reset clock hand
+ ClockPicker.prototype.resetClock = function(delay){
+ var view = this.currentView,
+ value = this[view],
+ isHours = view === 'hours',
+ unit = Math.PI / (isHours ? 6 : 30),
+ radian = value * unit,
+ radius = isHours && value > 0 && value < 13 ? innerRadius : outerRadius,
+ x = Math.sin(radian) * radius,
+ y = - Math.cos(radian) * radius,
+ self = this;
+ if (svgSupported && delay) {
+ self.canvas.addClass('clockpicker-canvas-out');
+ setTimeout(function(){
+ self.canvas.removeClass('clockpicker-canvas-out');
+ self.setHand(x, y);
+ }, delay);
+ } else {
+ this.setHand(x, y);
+ }
+ };
+
+ // Set clock hand to (x, y)
+ ClockPicker.prototype.setHand = function(x, y, roundBy5, dragging){
+ var radian = Math.atan2(x, - y),
+ isHours = this.currentView === 'hours',
+ unit = Math.PI / (isHours || roundBy5 ? 6 : 30),
+ z = Math.sqrt(x * x + y * y),
+ options = this.options,
+ inner = isHours && z < (outerRadius + innerRadius) / 2,
+ radius = inner ? innerRadius : outerRadius,
+ value;
+
+ if (options.twelvehour) {
+ radius = outerRadius;
+ }
+
+ // Radian should in range [0, 2PI]
+ if (radian < 0) {
+ radian = Math.PI * 2 + radian;
+ }
+
+ // Get the round value
+ value = Math.round(radian / unit);
+
+ // Get the round radian
+ radian = value * unit;
+
+ // Correct the hours or minutes
+ if (options.twelvehour) {
+ if (isHours) {
+ if (value === 0) {
+ value = 12;
+ }
+ } else {
+ if (roundBy5) {
+ value *= 5;
+ }
+ if (value === 60) {
+ value = 0;
+ }
+ }
+ } else {
+ if (isHours) {
+ if (value === 12) {
+ value = 0;
+ }
+ value = inner ? (value === 0 ? 12 : value) : value === 0 ? 0 : value + 12;
+ } else {
+ if (roundBy5) {
+ value *= 5;
+ }
+ if (value === 60) {
+ value = 0;
+ }
+ }
+ }
+
+ // Once hours or minutes changed, vibrate the device
+ if (this[this.currentView] !== value) {
+ if (vibrate && this.options.vibrate) {
+ // Do not vibrate too frequently
+ if (! this.vibrateTimer) {
+ navigator[vibrate](10);
+ this.vibrateTimer = setTimeout($.proxy(function(){
+ this.vibrateTimer = null;
+ }, this), 100);
+ }
+ }
+ }
+
+ this[this.currentView] = value;
+ this[isHours ? 'spanHours' : 'spanMinutes'].html(leadingZero(value));
+
+ // If svg is not supported, just add an active class to the tick
+ if (! svgSupported) {
+ this[isHours ? 'hoursView' : 'minutesView'].find('.clockpicker-tick').each(function(){
+ var tick = $(this);
+ tick.toggleClass('active', value === + tick.html());
+ });
+ return;
+ }
+
+ // Place clock hand at the top when dragging
+ if (dragging || (! isHours && value % 5)) {
+ this.g.insertBefore(this.hand, this.bearing);
+ this.g.insertBefore(this.bg, this.fg);
+ this.bg.setAttribute('class', 'clockpicker-canvas-bg clockpicker-canvas-bg-trans');
+ } else {
+ // Or place it at the bottom
+ this.g.insertBefore(this.hand, this.bg);
+ this.g.insertBefore(this.fg, this.bg);
+ this.bg.setAttribute('class', 'clockpicker-canvas-bg');
+ }
+
+ // Set clock hand and others' position
+ var cx = Math.sin(radian) * radius,
+ cy = - Math.cos(radian) * radius;
+ this.hand.setAttribute('x2', cx);
+ this.hand.setAttribute('y2', cy);
+ this.bg.setAttribute('cx', cx);
+ this.bg.setAttribute('cy', cy);
+ this.fg.setAttribute('cx', cx);
+ this.fg.setAttribute('cy', cy);
+ };
+
+ // Hours and minutes are selected
+ ClockPicker.prototype.done = function() {
+ raiseCallback(this.options.beforeDone);
+ this.hide();
+ var last = this.input.prop('value'),
+ value = leadingZero(this.hours) + ':' + leadingZero(this.minutes);
+ if (this.options.twelvehour) {
+ value = value + this.amOrPm;
+ }
+
+ this.input.prop('value', value);
+ if (value !== last) {
+ this.input.triggerHandler('change');
+ if (! this.isInput) {
+ this.element.trigger('change');
+ }
+ }
+
+ if (this.options.autoclose) {
+ this.input.trigger('blur');
+ }
+
+ raiseCallback(this.options.afterDone);
+ };
+
+ // Remove clockpicker from input
+ ClockPicker.prototype.remove = function() {
+ this.element.removeData('clockpicker');
+ this.input.off('focus.clockpicker click.clockpicker');
+ this.addon.off('click.clockpicker');
+ if (this.isShown) {
+ this.hide();
+ }
+ if (this.isAppended) {
+ $win.off('resize.clockpicker' + this.id);
+ this.popover.remove();
+ }
+ };
+
+ // Extends $.fn.clockpicker
+ $.fn.clockpicker = function(option){
+ var args = Array.prototype.slice.call(arguments, 1);
+ return this.each(function(){
+ var $this = $(this),
+ data = $this.data('clockpicker');
+ if (! data) {
+ var options = $.extend({}, ClockPicker.DEFAULTS, $this.data(), typeof option == 'object' && option);
+ $this.data('clockpicker', new ClockPicker($this, options));
+ } else {
+ // Manual operatsions. show, hide, remove, e.g.
+ if (typeof data[option] === 'function') {
+ data[option].apply(data, args);
+ }
+ }
+ });
+ };
+}());
diff --git a/include/clockpicker/dist/jquery-clockpicker.min.css b/include/clockpicker/dist/jquery-clockpicker.min.css
new file mode 100644
index 00000000..f6916d82
--- /dev/null
+++ b/include/clockpicker/dist/jquery-clockpicker.min.css
@@ -0,0 +1,9 @@
+/*!
+ * ClockPicker v0.0.7 for jQuery (http://weareoutman.github.io/clockpicker/)
+ * Copyright 2014 Wang Shenwei.
+ * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
+ *
+ * Bootstrap v3.1.1 (http://getbootstrap.com)
+ * Copyright 2011-2014 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ */.popover{position:absolute;top:0;left:0;z-index:1010;display:none;max-width:276px;padding:1px;text-align:left;white-space:normal;background-color:#fff;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2)}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;font-weight:400;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid;overflow:visible;margin:0;padding:0;z-index:auto;background-color:transparent;-webkit-box-shadow:none;box-shadow:none;bottom:auto;left:auto;right:auto;top:auto;-webkit-transform:none;-ms-transform:none;transform:none}.popover>.arrow{border-width:11px}.popover>.arrow:after{content:"";border-width:10px}.popover.top>.arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.popover.top>.arrow:after{bottom:1px;margin-left:-10px;content:" ";border-top-color:#fff;border-bottom-width:0}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,.25);border-left-width:0}.popover.right>.arrow:after{bottom:-10px;left:1px;content:" ";border-right-color:#fff;border-left-width:0}.popover.bottom>.arrow{top:-11px;left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25)}.popover.bottom>.arrow:after{top:1px;margin-left:-10px;content:" ";border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;bottom:-10px;content:" ";border-right-width:0;border-left-color:#fff}.btn{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent}.btn.active:focus,.btn:active:focus,.btn:focus{outline:dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.btn:focus,.btn:hover{color:#333;text-decoration:none}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default.active,.btn-default:active,.btn-default:focus,.btn-default:hover,.open .dropdown-toggle.btn-default{color:#333;background-color:#ebebeb;border-color:#adadad}.btn-default.active,.btn-default:active,.open .dropdown-toggle.btn-default{background-image:none}.btn-block{display:block;width:100%}.text-primary{color:#428bca}.clockpicker .input-group-addon{cursor:pointer}.clockpicker-moving{cursor:move}.clockpicker-align-left.popover>.arrow{left:25px}.clockpicker-align-top.popover>.arrow{top:17px}.clockpicker-align-right.popover>.arrow{left:auto;right:25px}.clockpicker-align-bottom.popover>.arrow{top:auto;bottom:6px}.clockpicker-popover .popover-title{background-color:#fff;color:#999;font-size:24px;font-weight:700;line-height:30px;text-align:center}.clockpicker-popover .popover-title span{cursor:pointer}.clockpicker-popover .popover-content{background-color:#f8f8f8;padding:12px}.popover-content:last-child{border-bottom-left-radius:5px;border-bottom-right-radius:5px}.clockpicker-plate{background-color:#fff;border:1px solid #ccc;border-radius:50%;width:200px;height:200px;overflow:visible;position:relative;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.clockpicker-canvas,.clockpicker-dial{width:200px;height:200px;position:absolute;left:-1px;top:-1px}.clockpicker-minutes{visibility:hidden}.clockpicker-tick{border-radius:50%;color:#666;line-height:26px;text-align:center;width:26px;height:26px;position:absolute;cursor:pointer}.clockpicker-tick.active,.clockpicker-tick:hover{background-color:#c0e5f7;background-color:rgba(0,149,221,.25)}.clockpicker-button{background-image:none;background-color:#fff;border-width:1px 0 0;border-top-left-radius:0;border-top-right-radius:0;margin:0;padding:10px 0}.clockpicker-button:hover{background-image:none;background-color:#ebebeb}.clockpicker-button:focus{outline:0!important}.clockpicker-dial{-webkit-transition:-webkit-transform 350ms,opacity 350ms;-moz-transition:-moz-transform 350ms,opacity 350ms;-ms-transition:-ms-transform 350ms,opacity 350ms;-o-transition:-o-transform 350ms,opacity 350ms;transition:transform 350ms,opacity 350ms}.clockpicker-dial-out{opacity:0}.clockpicker-hours.clockpicker-dial-out{-webkit-transform:scale(1.2,1.2);-moz-transform:scale(1.2,1.2);-ms-transform:scale(1.2,1.2);-o-transform:scale(1.2,1.2);transform:scale(1.2,1.2)}.clockpicker-minutes.clockpicker-dial-out{-webkit-transform:scale(.8,.8);-moz-transform:scale(.8,.8);-ms-transform:scale(.8,.8);-o-transform:scale(.8,.8);transform:scale(.8,.8)}.clockpicker-canvas{-webkit-transition:opacity 175ms;-moz-transition:opacity 175ms;-ms-transition:opacity 175ms;-o-transition:opacity 175ms;transition:opacity 175ms}.clockpicker-canvas-out{opacity:.25}.clockpicker-canvas-bearing,.clockpicker-canvas-fg{stroke:none;fill:#0095dd}.clockpicker-canvas-bg{stroke:none;fill:#c0e5f7}.clockpicker-canvas-bg-trans{fill:rgba(0,149,221,.25)}.clockpicker-canvas line{stroke:#0095dd;stroke-width:1;stroke-linecap:round}.clockpicker-button.am-button{margin:1px;padding:5px;border:1px solid rgba(0,0,0,.2);border-radius:4px}.clockpicker-button.pm-button{margin:1px 1px 1px 136px;padding:5px;border:1px solid rgba(0,0,0,.2);border-radius:4px}
\ No newline at end of file
diff --git a/include/clockpicker/dist/jquery-clockpicker.min.js b/include/clockpicker/dist/jquery-clockpicker.min.js
new file mode 100644
index 00000000..c8006a38
--- /dev/null
+++ b/include/clockpicker/dist/jquery-clockpicker.min.js
@@ -0,0 +1,6 @@
+/*!
+ * ClockPicker v0.0.7 (http://weareoutman.github.io/clockpicker/)
+ * Copyright 2014 Wang Shenwei.
+ * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
+ */
+!function(){function t(t){return document.createElementNS(p,t)}function i(t){return(10>t?"0":"")+t}function e(t){var i=++m+"";return t?t+i:i}function s(s,r){function p(t,i){var e=u.offset(),s=/^touch/.test(t.type),o=e.left+b,n=e.top+b,p=(s?t.originalEvent.touches[0]:t).pageX-o,h=(s?t.originalEvent.touches[0]:t).pageY-n,k=Math.sqrt(p*p+h*h),v=!1;if(!i||!(g-y>k||k>g+y)){t.preventDefault();var m=setTimeout(function(){c.addClass("clockpicker-moving")},200);l&&u.append(x.canvas),x.setHand(p,h,!i,!0),a.off(d).on(d,function(t){t.preventDefault();var i=/^touch/.test(t.type),e=(i?t.originalEvent.touches[0]:t).pageX-o,s=(i?t.originalEvent.touches[0]:t).pageY-n;(v||e!==p||s!==h)&&(v=!0,x.setHand(e,s,!1,!0))}),a.off(f).on(f,function(t){a.off(f),t.preventDefault();var e=/^touch/.test(t.type),s=(e?t.originalEvent.changedTouches[0]:t).pageX-o,l=(e?t.originalEvent.changedTouches[0]:t).pageY-n;(i||v)&&s===p&&l===h&&x.setHand(s,l),"hours"===x.currentView?x.toggleView("minutes",A/2):r.autoclose&&(x.minutesView.addClass("clockpicker-dial-out"),setTimeout(function(){x.done()},A/2)),u.prepend(j),clearTimeout(m),c.removeClass("clockpicker-moving"),a.off(d)})}}var h=n(V),u=h.find(".clockpicker-plate"),v=h.find(".clockpicker-hours"),m=h.find(".clockpicker-minutes"),T=h.find(".clockpicker-am-pm-block"),C="INPUT"===s.prop("tagName"),H=C?s:s.find("input"),P=s.find(".input-group-addon"),x=this;if(this.id=e("cp"),this.element=s,this.options=r,this.isAppended=!1,this.isShown=!1,this.currentView="hours",this.isInput=C,this.input=H,this.addon=P,this.popover=h,this.plate=u,this.hoursView=v,this.minutesView=m,this.amPmBlock=T,this.spanHours=h.find(".clockpicker-span-hours"),this.spanMinutes=h.find(".clockpicker-span-minutes"),this.spanAmPm=h.find(".clockpicker-span-am-pm"),this.amOrPm="PM",r.twelvehour){{var S=['','',"AM ",'',"PM ","
"].join("");n(S)}n('AM ').on("click",function(){x.amOrPm="AM",n(".clockpicker-span-am-pm").empty().append("AM")}).appendTo(this.amPmBlock),n('PM ').on("click",function(){x.amOrPm="PM",n(".clockpicker-span-am-pm").empty().append("PM")}).appendTo(this.amPmBlock)}r.autoclose||n(''+r.donetext+" ").click(n.proxy(this.done,this)).appendTo(h),"top"!==r.placement&&"bottom"!==r.placement||"top"!==r.align&&"bottom"!==r.align||(r.align="left"),"left"!==r.placement&&"right"!==r.placement||"left"!==r.align&&"right"!==r.align||(r.align="top"),h.addClass(r.placement),h.addClass("clockpicker-align-"+r.align),this.spanHours.click(n.proxy(this.toggleView,this,"hours")),this.spanMinutes.click(n.proxy(this.toggleView,this,"minutes")),H.on("focus.clockpicker click.clockpicker",n.proxy(this.show,this)),P.on("click.clockpicker",n.proxy(this.toggle,this));var E,D,I,B,z=n('
');if(r.twelvehour)for(E=1;13>E;E+=1)D=z.clone(),I=E/6*Math.PI,B=g,D.css("font-size","120%"),D.css({left:b+Math.sin(I)*B-y,top:b-Math.cos(I)*B-y}),D.html(0===E?"00":E),v.append(D),D.on(k,p);else for(E=0;24>E;E+=1){D=z.clone(),I=E/6*Math.PI;var O=E>0&&13>E;B=O?w:g,D.css({left:b+Math.sin(I)*B-y,top:b-Math.cos(I)*B-y}),O&&D.css("font-size","120%"),D.html(0===E?"00":E),v.append(D),D.on(k,p)}for(E=0;60>E;E+=5)D=z.clone(),I=E/30*Math.PI,D.css({left:b+Math.sin(I)*g-y,top:b-Math.cos(I)*g-y}),D.css("font-size","120%"),D.html(i(E)),m.append(D),D.on(k,p);if(u.on(k,function(t){0===n(t.target).closest(".clockpicker-tick").length&&p(t,!0)}),l){var j=h.find(".clockpicker-canvas"),L=t("svg");L.setAttribute("class","clockpicker-svg"),L.setAttribute("width",M),L.setAttribute("height",M);var U=t("g");U.setAttribute("transform","translate("+b+","+b+")");var W=t("circle");W.setAttribute("class","clockpicker-canvas-bearing"),W.setAttribute("cx",0),W.setAttribute("cy",0),W.setAttribute("r",2);var N=t("line");N.setAttribute("x1",0),N.setAttribute("y1",0);var X=t("circle");X.setAttribute("class","clockpicker-canvas-bg"),X.setAttribute("r",y);var Y=t("circle");Y.setAttribute("class","clockpicker-canvas-fg"),Y.setAttribute("r",3.5),U.appendChild(N),U.appendChild(X),U.appendChild(Y),U.appendChild(W),L.appendChild(U),j.append(L),this.hand=N,this.bg=X,this.fg=Y,this.bearing=W,this.g=U,this.canvas=j}o(this.options.init)}function o(t){t&&"function"==typeof t&&t()}var c,n=window.jQuery,r=n(window),a=n(document),p="http://www.w3.org/2000/svg",l="SVGAngle"in window&&function(){var t,i=document.createElement("div");return i.innerHTML=" ",t=(i.firstChild&&i.firstChild.namespaceURI)==p,i.innerHTML="",t}(),h=function(){var t=document.createElement("div").style;return"transition"in t||"WebkitTransition"in t||"MozTransition"in t||"msTransition"in t||"OTransition"in t}(),u="ontouchstart"in window,k="mousedown"+(u?" touchstart":""),d="mousemove.clockpicker"+(u?" touchmove.clockpicker":""),f="mouseup.clockpicker"+(u?" touchend.clockpicker":""),v=navigator.vibrate?"vibrate":navigator.webkitVibrate?"webkitVibrate":null,m=0,b=100,g=80,w=54,y=13,M=2*b,A=h?350:1,V=['','
','
',' '," : ",' ',' ',"
",'
","
"].join("");s.DEFAULTS={"default":"",fromnow:0,placement:"bottom",align:"left",donetext:"完成",autoclose:!1,twelvehour:!1,vibrate:!0},s.prototype.toggle=function(){this[this.isShown?"hide":"show"]()},s.prototype.locate=function(){var t=this.element,i=this.popover,e=t.offset(),s=t.outerWidth(),o=t.outerHeight(),c=this.options.placement,n=this.options.align,r={};switch(i.show(),c){case"bottom":r.top=e.top+o;break;case"right":r.left=e.left+s;break;case"top":r.top=e.top-i.outerHeight();break;case"left":r.left=e.left-i.outerWidth()}switch(n){case"left":r.left=e.left;break;case"right":r.left=e.left+s-i.outerWidth();break;case"top":r.top=e.top;break;case"bottom":r.top=e.top+o-i.outerHeight()}i.css(r)},s.prototype.show=function(){if(!this.isShown){o(this.options.beforeShow);var t=this;this.isAppended||(c=n(document.body).append(this.popover),r.on("resize.clockpicker"+this.id,function(){t.isShown&&t.locate()}),this.isAppended=!0);var e=((this.input.prop("value")||this.options["default"]||"")+"").split(":");if("now"===e[0]){var s=new Date(+new Date+this.options.fromnow);e=[s.getHours(),s.getMinutes()]}this.hours=+e[0]||0,this.minutes=+e[1]||0,this.spanHours.html(i(this.hours)),this.spanMinutes.html(i(this.minutes)),this.toggleView("hours"),this.locate(),this.isShown=!0,a.on("click.clockpicker."+this.id+" focusin.clockpicker."+this.id,function(i){var e=n(i.target);0===e.closest(t.popover).length&&0===e.closest(t.addon).length&&0===e.closest(t.input).length&&t.hide()}),a.on("keyup.clockpicker."+this.id,function(i){27===i.keyCode&&t.hide()}),o(this.options.afterShow)}},s.prototype.hide=function(){o(this.options.beforeHide),this.isShown=!1,a.off("click.clockpicker."+this.id+" focusin.clockpicker."+this.id),a.off("keyup.clockpicker."+this.id),this.popover.hide(),o(this.options.afterHide)},s.prototype.toggleView=function(t,i){var e=!1;"minutes"===t&&"visible"===n(this.hoursView).css("visibility")&&(o(this.options.beforeHourSelect),e=!0);var s="hours"===t,c=s?this.hoursView:this.minutesView,r=s?this.minutesView:this.hoursView;this.currentView=t,this.spanHours.toggleClass("text-primary",s),this.spanMinutes.toggleClass("text-primary",!s),r.addClass("clockpicker-dial-out"),c.css("visibility","visible").removeClass("clockpicker-dial-out"),this.resetClock(i),clearTimeout(this.toggleViewTimer),this.toggleViewTimer=setTimeout(function(){r.css("visibility","hidden")},A),e&&o(this.options.afterHourSelect)},s.prototype.resetClock=function(t){var i=this.currentView,e=this[i],s="hours"===i,o=Math.PI/(s?6:30),c=e*o,n=s&&e>0&&13>e?w:g,r=Math.sin(c)*n,a=-Math.cos(c)*n,p=this;l&&t?(p.canvas.addClass("clockpicker-canvas-out"),setTimeout(function(){p.canvas.removeClass("clockpicker-canvas-out"),p.setHand(r,a)},t)):this.setHand(r,a)},s.prototype.setHand=function(t,e,s,o){var c,r=Math.atan2(t,-e),a="hours"===this.currentView,p=Math.PI/(a||s?6:30),h=Math.sqrt(t*t+e*e),u=this.options,k=a&&(g+w)/2>h,d=k?w:g;if(u.twelvehour&&(d=g),0>r&&(r=2*Math.PI+r),c=Math.round(r/p),r=c*p,u.twelvehour?a?0===c&&(c=12):(s&&(c*=5),60===c&&(c=0)):a?(12===c&&(c=0),c=k?0===c?12:c:0===c?0:c+12):(s&&(c*=5),60===c&&(c=0)),this[this.currentView]!==c&&v&&this.options.vibrate&&(this.vibrateTimer||(navigator[v](10),this.vibrateTimer=setTimeout(n.proxy(function(){this.vibrateTimer=null},this),100))),this[this.currentView]=c,this[a?"spanHours":"spanMinutes"].html(i(c)),!l)return void this[a?"hoursView":"minutesView"].find(".clockpicker-tick").each(function(){var t=n(this);t.toggleClass("active",c===+t.html())});o||!a&&c%5?(this.g.insertBefore(this.hand,this.bearing),this.g.insertBefore(this.bg,this.fg),this.bg.setAttribute("class","clockpicker-canvas-bg clockpicker-canvas-bg-trans")):(this.g.insertBefore(this.hand,this.bg),this.g.insertBefore(this.fg,this.bg),this.bg.setAttribute("class","clockpicker-canvas-bg"));var f=Math.sin(r)*d,m=-Math.cos(r)*d;this.hand.setAttribute("x2",f),this.hand.setAttribute("y2",m),this.bg.setAttribute("cx",f),this.bg.setAttribute("cy",m),this.fg.setAttribute("cx",f),this.fg.setAttribute("cy",m)},s.prototype.done=function(){o(this.options.beforeDone),this.hide();var t=this.input.prop("value"),e=i(this.hours)+":"+i(this.minutes);this.options.twelvehour&&(e+=this.amOrPm),this.input.prop("value",e),e!==t&&(this.input.triggerHandler("change"),this.isInput||this.element.trigger("change")),this.options.autoclose&&this.input.trigger("blur"),o(this.options.afterDone)},s.prototype.remove=function(){this.element.removeData("clockpicker"),this.input.off("focus.clockpicker click.clockpicker"),this.addon.off("click.clockpicker"),this.isShown&&this.hide(),this.isAppended&&(r.off("resize.clockpicker"+this.id),this.popover.remove())},n.fn.clockpicker=function(t){var i=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=n(this),o=e.data("clockpicker");if(o)"function"==typeof o[t]&&o[t].apply(o,i);else{var c=n.extend({},s.DEFAULTS,e.data(),"object"==typeof t&&t);e.data("clockpicker",new s(e,c))}})}}();
\ No newline at end of file
diff --git a/js/addrow-v2.js b/js/addrow-v2.js
index 5c0c9eb9..b37e59ed 100644
--- a/js/addrow-v2.js
+++ b/js/addrow-v2.js
@@ -90,7 +90,7 @@ function addRow() {
continue;
s = t[0] + "[" + rowCount.toString() + "]";
element.setAttribute("name", s);
- element.value = "";
+ //element.value = ""; /* <-- this row deletes cloned tag values */
}
elements = newRow.getElementsByTagName("select");
@@ -108,10 +108,14 @@ function addRow() {
element.value = "";
}
-
/* Add the newly-created row to the table */
templateRow.parentNode.appendChild(newRow);
+
+ /* init clockpicker for added row*/
+ $('.clockpicker').clockpicker({
+ autoclose: true
+ });
return true;
}
-/* set ts=8 sw=4 sts=4 expandtab: */
+/* set ts=8 sw=4 sts=4 expandtab: */
\ No newline at end of file