[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9194] api : add jQuery datepicker wrapper-class
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [9194] api : add jQuery datepicker wrapper-class |
Date: |
Sat, 21 Apr 2012 18:26:49 +0000 |
Revision: 9194
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9194
Author: sigurdne
Date: 2012-04-21 18:26:49 +0000 (Sat, 21 Apr 2012)
Log Message:
-----------
api : add jQuery datepicker wrapper-class
Added Paths:
-----------
trunk/phpgwapi/inc/class.jqcal.inc.php
Added: trunk/phpgwapi/inc/class.jqcal.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.jqcal.inc.php (rev 0)
+++ trunk/phpgwapi/inc/class.jqcal.inc.php 2012-04-21 18:26:49 UTC (rev
9194)
@@ -0,0 +1,70 @@
+<?php
+ /**
+ * jQuery datepicker wrapper-class
+ *
+ * @author Sigurd Nes
+ * @copyright Copyright (C) 2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.fsf.org/licenses/gpl.html GNU General Public
License
+ * @package phpgwapi
+ * @subpackage gui
+ * @version $Id: class.jscal.inc.php 3415 2009-08-23 17:09:49Z sigurd $
+ */
+
+ /**
+ * jQuery datepicker wrapper-class
+ *
+ * @package phpgwapi
+ * @subpackage gui
+ */
+ class phpgwapi_jqcal
+ {
+
+ public $img_cal;
+ public $dateformat;
+ private $lang_select_date;
+
+ function __construct()
+ {
+ $theme = 'ui-lightness';
+ $GLOBALS['phpgw']->js->validate_file( 'jquery',
'js/jquery-1.7.2.min', 'phpgwapi' );
+ $GLOBALS['phpgw']->js->validate_file( 'jquery',
'js/jquery-ui-1.8.19.custom.min', 'phpgwapi' );
+ $GLOBALS['phpgw']->js->validate_file( 'jquery',
'js/jquery-ui-1.8.19.custom.min', 'phpgwapi' );
+ $GLOBALS['phpgw']->js->validate_file( 'jquery',
"development-bundle/ui/i18n/jquery.ui.datepicker-{$GLOBALS['phpgw_info']['user']['preferences']['common']['lang']}",
'phpgwapi' );
+
$GLOBALS['phpgw']->css->add_external_file("phpgwapi/js/jquery/css/{$theme}/jquery-ui-1.8.19.custom.css");
+ $this->img_cal =
$GLOBALS['phpgw']->common->image('phpgwapi','cal');
+ $this->dateformat = str_ireplace(array('d', 'm', 'y'),
array('dd', 'mm',
'yy'),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $this->lang_select_date = lang('select date');
+
+ }
+
+ function add_listener($name)
+ {
+ $this->_input_modern($name);
+ }
+
+ /**
+ * Add an event listener to the trigger icon - used for XSLT
+ *
+ * @access private
+ * @param string $name the element ID
+ */
+ function _input_modern($id)
+ {
+ $js = <<<JS
+ $(function() {
+ $( "#{$id}" ).datepicker({
+ dateFormat: '{$this->dateformat}',
+ showWeek: true,
+ changeMonth: true,
+ changeYear: true,
+ showOn: "button",
+ buttonImage: "{$this->img_cal}",
+ buttonText: "{$this->lang_select_date}",
+ buttonImageOnly: true
+ });
+ $('#ui-datepicker-div').draggable();
+ });
+JS;
+ $GLOBALS['phpgw']->js->add_code('', $js);
+ }
+ }
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9194] api : add jQuery datepicker wrapper-class,
Sigurd Nes <=