From: <jon...@us...> - 2011-10-07 13:20:44
|
Revision: 38057 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=38057&view=rev Author: jonnybradley Date: 2011-10-07 13:20:32 +0000 (Fri, 07 Oct 2011) Log Message: ----------- [FIX] tracker: Clear up ambiguity and fix bugs in ui datepicker field when empty (added option to use empty or "now"). Also use feature_jquery_ui setting for the pref default and update some labels. Modified Paths: -------------- branches/8.x/lib/core/Tracker/Field/JsCalendar.php branches/8.x/lib/jquery_tiki/tiki-jquery.js Modified: branches/8.x/lib/core/Tracker/Field/JsCalendar.php =================================================================== --- branches/8.x/lib/core/Tracker/Field/JsCalendar.php 2011-10-07 10:52:56 UTC (rev 38056) +++ branches/8.x/lib/core/Tracker/Field/JsCalendar.php 2011-10-07 13:20:32 UTC (rev 38057) @@ -9,13 +9,15 @@ { public static function getTypes() { + global $prefs; + return array( 'j' => array( - 'name' => tr('Date and Time (JSCalendar)'), - 'description' => tr('Provides drop-down options to accurately select a date and/or time.'), + 'name' => tr('Date and Time (Date Picker)'), + 'description' => tr('Provides jQuery-UI date picker select a date and optionally time.'), 'prefs' => array('trackerfield_jscalendar'), 'tags' => array('advanced'), - 'default' => 'n', + 'default' => $prefs['feature_jquery_ui'], 'params' => array( 'datetime' => array( 'name' => tr('Type'), @@ -26,6 +28,15 @@ 'd' => tr('Date only'), ), ), + 'useNow' => array( + 'name' => tr('Default value'), + 'description' => tr('Use an empty value or now for new items'), + 'filter' => 'int', + 'options' => array( + 0 => tr('Empty'), + 1 => tr('Now'), + ), + ), ), ), ); @@ -38,7 +49,7 @@ return array( 'value' => (isset($requestData[$ins_id])) ? $requestData[$ins_id] - : $this->getValue(TikiLib::lib('tiki')->now), + : $this->getValue(), ); } @@ -54,6 +65,9 @@ if (empty($params['date'])) { $params['date'] = $this->getConfiguration('value'); } + if (empty($params['date']) && $this->getOption(1)) { + $params['date'] = TikiLib::lib('tiki')->now; + } } else { $params['date'] = ''; } Modified: branches/8.x/lib/jquery_tiki/tiki-jquery.js =================================================================== --- branches/8.x/lib/jquery_tiki/tiki-jquery.js 2011-10-07 10:52:56 UTC (rev 38056) +++ branches/8.x/lib/jquery_tiki/tiki-jquery.js 2011-10-07 13:20:32 UTC (rev 38057) @@ -1137,13 +1137,18 @@ onClose: function(dateText, inst) { $.datepicker._updateAlternate(inst); // make sure the hidden field is up to date var timestamp = parseInt($(inst.settings.altField).val() / 1000, 10); - if (inst.settings && inst.settings.timepicker) { // if it's a datetimepicker add on the time + if (!timestamp) { + $.datepicker._setDateFromField(inst); // seems to need reminding when starting empty + $.datepicker._updateAlternate(inst); + timestamp = parseInt($(inst.settings.altField).val() / 1000, 10); + } + if (timestamp && inst.settings && inst.settings.timepicker) { // if it's a datetimepicker add on the time var time = inst.settings.timepicker.hour * 3600 + inst.settings.timepicker.minute * 60 + inst.settings.timepicker.second; timestamp += time; } - $(inst.settings.altField).val(timestamp); + $(inst.settings.altField).val(timestamp ? timestamp : ""); } }; break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |