From: Michael M Slusarz Date: Tue, 27 Jul 2010 06:05:09 +0000 (-0600) Subject: Add full_weekdays option to Horde_Core_Ui_JsCalendar::. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=7d56c17c90b7759d8373fe1a8241223686e07445;p=horde.git Add full_weekdays option to Horde_Core_Ui_JsCalendar::. --- diff --git a/framework/Core/lib/Horde/Core/Ui/JsCalendar.php b/framework/Core/lib/Horde/Core/Ui/JsCalendar.php index 47afb1592..e694622bd 100644 --- a/framework/Core/lib/Horde/Core/Ui/JsCalendar.php +++ b/framework/Core/lib/Horde/Core/Ui/JsCalendar.php @@ -20,12 +20,22 @@ class Horde_Core_Ui_JsCalendar * widget. * * @param array $params Configuration parameters for the widget: - * - short_weekdays: display only the first letter of - * weekdays? + *
+     * 'full_weekdays' - (boolean) Add full weekday localized list to
+     *                   javascript object.
+     *                   DEFAULT: false
+     * 'short_weekdays' - (boolean) Display only the first letter of
+     *                    weekdays?
+     *                    DEFAULT: false
+     * 
*/ - static public function init($params = array()) + static public function init(array $params = array()) { - $params += array('short_weekdays' => false); + $params = array_merge(array( + 'full_weekdays' => false, + 'short_weekdays' => false + ), $params); + $weekdays = self::weekdays(); if ($params['short_weekdays']) { foreach ($weekdays as &$day) { @@ -37,8 +47,13 @@ class Horde_Core_Ui_JsCalendar Horde::addInlineScript(array( 'Horde_Calendar.firstDayOfWeek = ' . (isset($GLOBALS['prefs']) ? intval($GLOBALS['prefs']->getValue('first_week_day')) : 1), 'Horde_Calendar.weekdays = ' . Horde_Serialize::serialize($weekdays, Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()), - 'Horde_Calendar.months = ' . Horde_Serialize::serialize(self::months(), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()), + 'Horde_Calendar.months = ' . Horde_Serialize::serialize(self::months(), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) )); + if ($params['full_weekdays']) { + Horde::addInlineScript(array( + 'Horde_Calendar.fullweekdays = ' . Horde_Serialize::serialize(self::fullWeekdays(), Horde_Serialize::JSON, $GLOBALS['registry']->getCharset()) + )); + } } /** @@ -60,6 +75,24 @@ class Horde_Core_Ui_JsCalendar } /** + * Return the list of localized full weekday names. + * + * @return array Full weekday names. + */ + static public function fullWeekdays() + { + return array( + _("Sunday"), + _("Monday"), + _("Tuesday"), + _("Wednesday"), + _("Thursday"), + _("Friday"), + _("Saturday"), + ); + } + + /** * Return the localized list of months. * * @return array Month list. diff --git a/horde/js/calendar.js b/horde/js/calendar.js index c41b46f85..9de7164c0 100644 --- a/horde/js/calendar.js +++ b/horde/js/calendar.js @@ -9,7 +9,8 @@ var Horde_Calendar = { - // Variables set externally: firstDayOfWeek, months, weekdays + // Variables set externally: firstDayOfWeek, fullweekdays, months, + // weekdays // Variables defaulting to null: date, month, openDate, trigger, year open: function(trigger, data)