From: Jan Schneider Date: Mon, 31 May 2010 17:23:17 +0000 (+0200) Subject: Add parameter to show only the first character of the weekday in calendar popups. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=84eddcad48dec5cf95ec0c39fcb5a9805d025b2a;p=horde.git Add parameter to show only the first character of the weekday in calendar popups. --- diff --git a/framework/Ui/lib/Horde/Ui/JsCalendar.php b/framework/Ui/lib/Horde/Ui/JsCalendar.php index b3494ac8f..5f15b6d5c 100644 --- a/framework/Ui/lib/Horde/Ui/JsCalendar.php +++ b/framework/Ui/lib/Horde/Ui/JsCalendar.php @@ -16,13 +16,24 @@ class Horde_Ui_JsCalendar /** * Output the necessary javascript code to allow display of the calendar * widget. + * + * @param array $params Configuration parameters for the widget: + * - short_weekdays: display only the first letter of + * weekdays? */ - static public function init() + static public function init($params = array()) { + $params += array('short_weekdays' => false); + $weekdays = self::weekdays(); + if ($params['short_weekdays']) { + foreach ($weekdays as &$day) { + $day = substr($day, 0, 1); + } + } Horde::addScriptFile('calendar.js', 'horde'); Horde::addInlineScript(array( 'Horde_Calendar.firstDayOfWeek = ' . (isset($GLOBALS['prefs']) ? intval($GLOBALS['prefs']->getValue('first_week_day')) : 1), - 'Horde_Calendar.weekdays = ' . Horde_Serialize::serialize(self::weekdays(), Horde_Serialize::JSON, Horde_Nls::getCharset()), + 'Horde_Calendar.weekdays = ' . Horde_Serialize::serialize($weekdays, Horde_Serialize::JSON, Horde_Nls::getCharset()), 'Horde_Calendar.months = ' . Horde_Serialize::serialize(self::months(), Horde_Serialize::JSON, Horde_Nls::getCharset()), )); } diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 343c41251..39ec58f12 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -77,7 +77,7 @@ class Kronolith Horde::addScriptFile('date/' . $datejs, 'horde'); Horde::addScriptFile('date/date.js', 'horde'); Horde::addScriptFile('kronolith.js', 'kronolith'); - Horde_Ui_JsCalendar::init(); + Horde_Ui_JsCalendar::init(array('short_weekdays' => true)); if (isset($GLOBALS['language'])) { header('Content-type: text/html; charset=' . Horde_Nls::getCharset());