[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14003] move generic dynamic datetimepicker
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [14003] move generic dynamic datetimepicker |
Date: |
Thu, 24 Sep 2015 13:37:56 +0000 |
Revision: 14003
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14003
Author: sigurdne
Date: 2015-09-24 13:37:55 +0000 (Thu, 24 Sep 2015)
Log Message:
-----------
move generic dynamic datetimepicker
Modified Paths:
--------------
branches/dev-syncromind/booking/inc/class.uiapplication.inc.php
branches/dev-syncromind/booking/inc/class.uicommon.inc.php
branches/dev-syncromind/booking/inc/class.uievent.inc.php
branches/dev-syncromind/booking/inc/class.uireports.inc.php
Removed Paths:
-------------
branches/dev-syncromind/booking/js/booking/adddatetimepicker.js
Modified: branches/dev-syncromind/booking/inc/class.uiapplication.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uiapplication.inc.php
2015-09-24 00:03:32 UTC (rev 14002)
+++ branches/dev-syncromind/booking/inc/class.uiapplication.inc.php
2015-09-24 13:37:55 UTC (rev 14003)
@@ -740,7 +740,6 @@
array_set_default($application, 'dates',
$default_dates);
$this->flash_form_errors($errors);
-// self::add_javascript('booking', 'booking',
'adddatetimepicker.js');
$application['resources_json'] =
json_encode(array_map('intval', $application['resources']));
$application['accepted_documents_json'] =
json_encode($application['accepted_documents']);
if ($GLOBALS['phpgw_info']['flags']['currentapp'] ==
'booking')
@@ -788,7 +787,7 @@
$application['tabs'] =
phpgwapi_jquery::tabview_generate($tabs, $active_tab);
self::add_javascript('booking', 'booking',
'application.js');
- self::add_javascript('booking', 'booking',
'adddatetimepicker.js');
+ self::adddatetimepicker();
self::render_template_xsl('application_new',
array('application' => $application, 'activities' => $activities, 'agegroups'
=> $agegroups, 'audience' => $audience,'config' => $application_text));
}
@@ -848,7 +847,7 @@
}
$this->flash_form_errors($errors);
self::add_javascript('booking', 'booking',
'application.js');
- self::add_javascript('booking', 'booking',
'adddatetimepicker.js');
+ self::adddatetimepicker();
$this->set_case_officer($application);
$application['resources_json'] =
json_encode(array_map('intval', $application['resources']));
Modified: branches/dev-syncromind/booking/inc/class.uicommon.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uicommon.inc.php 2015-09-24
00:03:32 UTC (rev 14002)
+++ branches/dev-syncromind/booking/inc/class.uicommon.inc.php 2015-09-24
13:37:55 UTC (rev 14003)
@@ -649,4 +649,86 @@
return $defaultType;
}
}
+
+ protected function adddatetimepicker($type = 'datetime')
+ {
+ switch($type)
+ {
+ case 'datetime':
+
$GLOBALS['phpgw']->css->add_external_file("phpgwapi/js/jquery/css/jquery-ui-timepicker-addon.css");
+
$GLOBALS['phpgw']->js->validate_file('jquery', 'js/jquery-ui-timepicker-addon');
+ $_type = 'datetime';
+ break;
+ case 'time':
+
$GLOBALS['phpgw']->css->add_external_file("phpgwapi/js/jquery/css/jquery-ui-timepicker-addon.css");
+
$GLOBALS['phpgw']->js->validate_file('jquery', 'js/jquery-ui-timepicker-addon');
+ $_type = 'time';
+ break;
+ default:
+ $_type = 'date';
+ }
+
+ $img_cal =
$GLOBALS['phpgw']->common->image('phpgwapi','cal');
+ $dateformat = str_ireplace(array('d', 'm', 'y'),
array('dd', 'mm',
'yy'),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $lang_select_date = lang('select date');
+ $lang_from = lang('from');
+ $lang_to = lang('to');
+
+ $js =<<<JS
+
+ $(function() {
+
+ $('#add-date-link').click(function(){
+ var add = $(this);
+ var html = '';
+
+ if (!this.counter) { this.counter = 0; }
+
+ html = '<div class="date-container">'+
+ '<a class="close-btn btnclose"
href="javascript:void(0);">-</a>'+
+ '<div
class="pure-control-group">'+
+ '<label
for="start_date_'+this.counter+'"><h4>{$lang_from}</h4></label>'+
+ '<input class="time
pure-input-2-3" id="start_date_'+this.counter+'"
name="start_date_'+this.counter+'" type="text">'+
+ '</input>'+
+ '</div>'+
+ '<div
class="pure-control-group">'+
+ '<label
for="end_date_'+this.counter+'"><h4>{$lang_to}</h4></label>'+
+ '<input class="time
pure-input-2-3" id="end_date_'+this.counter+'" name="end_date_'+this.counter+'"
type="text">'+
+ '</input>'+
+ '</div>'
+ '</div>';
+
+ this.counter++;
+
+
add.parent().parent().children('#dates-container').append(html);
+
+ $( ".time" ).{$_type}picker({
+ dateFormat: '{$dateformat}',
+ showWeek: true,
+ changeMonth: true,
+ changeYear: true,
+ showOn: "button",
+ showButtonPanel:true,
+ buttonImage:
"{$img_cal}",
+ buttonText:
"{$lang_select_date}",
+ buttonImageOnly: true
+ });
+
+ });
+
+ });
+
+ $(document).on("click",".btnclose",function(){
+ var the = $(this);
+ RemoveDate(the);
+ });
+
+ RemoveDate = function(the){
+ the.parent().remove();
+ }
+
+JS;
+ $GLOBALS['phpgw']->js->add_code('', $js);
+
+ }
}
Modified: branches/dev-syncromind/booking/inc/class.uievent.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uievent.inc.php 2015-09-24
00:03:32 UTC (rev 14002)
+++ branches/dev-syncromind/booking/inc/class.uievent.inc.php 2015-09-24
13:37:55 UTC (rev 14003)
@@ -530,7 +530,7 @@
$active_tab = 'generic';
$event['tabs'] = phpgwapi_jquery::tabview_generate($tabs,
$active_tab);
- self::add_javascript('booking', 'booking',
'adddatetimepicker.js');
+ self::adddatetimepicker();
$this->add_template_helpers();
self::render_template_xsl('event_new', array('event' => $event,
'activities' => $activities, 'agegroups' => $agegroups, 'audience' =>
$audience));
Modified: branches/dev-syncromind/booking/inc/class.uireports.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uireports.inc.php 2015-09-24
00:03:32 UTC (rev 14002)
+++ branches/dev-syncromind/booking/inc/class.uireports.inc.php 2015-09-24
13:37:55 UTC (rev 14003)
@@ -187,7 +187,7 @@
$active_tab = 'generic';
$report['tabs'] =
phpgwapi_jquery::tabview_generate($tabs, $active_tab);
- self::add_javascript('booking', 'booking',
'adddatetimepicker.js');
+// self::adddatetimepicker();
$this->add_template_helpers();
self::render_template_xsl('report_new', array('report'
=> $report, 'activities' => $activities,
Deleted: branches/dev-syncromind/booking/js/booking/adddatetimepicker.js
===================================================================
--- branches/dev-syncromind/booking/js/booking/adddatetimepicker.js
2015-09-24 00:03:32 UTC (rev 14002)
+++ branches/dev-syncromind/booking/js/booking/adddatetimepicker.js
2015-09-24 13:37:55 UTC (rev 14003)
@@ -1,78 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-$(function() {
-
- $('#add-date-link').click(function(){
- var add = $(this);
- var html = '';
-
- if (!this.counter) { this.counter = 0; }
-
- html = '<div class="date-container">'+
- '<a class="close-btn btnclose"
href="javascript:void(0);">-</a>'+
- '<div class="pure-control-group">'+
- '<label
for="start_date_'+this.counter+'"><h4>!from</h4></label>'+
- '<input class="time pure-input-2-3"
id="start_date_'+this.counter+'" name="start_date_'+this.counter+'"
type="text">'+
- // '<xsl:if test="activity/start_date != """>'+
- // '<xsl:attribute name="value">'+
- // '<xsl:value-of
select="php:function("date", $datetime_format, number(activity/start_date))"/>'+
- // '</xsl:attribute>'+
- // '</xsl:if>'+
- //
- // '<xsl:attribute name="data-validation">'+
- // '<xsl:text>required</xsl:text>'+
- // '</xsl:attribute>'+
- '</input>'+
- '</div>'+
- '<div class="pure-control-group">'+
- '<label
for="end_date_'+this.counter+'"><h4>!to</h4></label>'+
-// <xsl:if test="activity/error_msg_array/end_date !=
''">
-// <xsl:variable name="error_msg">
-// <xsl:value-of
select="activity/error_msg_array/end_date" />
-// </xsl:variable>
-// <div class='input_error_msg'>
-// <xsl:value-of
select="php:function('lang', $error_msg)" />
-// </div>
-// </xsl:if>
- '<input class="time pure-input-2-3"
id="end_date_'+this.counter+'" name="end_date_'+this.counter+'" type="text">'+
-// <xsl:if test="activity/end_date != ''">
-// <xsl:attribute name="value">
-// <xsl:value-of
select="php:function('date', $datetime_format, number(activity/end_date))"/>
-// </xsl:attribute>
-// </xsl:if>
- '</input>'+
- '</div>'
- '</div>';
-
- this.counter++;
-
- add.parent().parent().children('#dates-container').append(html);
-
- $( ".time" ).datetimepicker({
- dateFormat: 'dd/mm/yy',
- showWeek: true,
- changeMonth: true,
- changeYear: true,
- showOn: "button",
- showButtonPanel:true,
- buttonImage: "/portico/phpgwapi/templates/base/images/cal.png",
- buttonText: "Select date",
- buttonImageOnly: true
- });
-
- });
-
-});
-
-$(document).on("click",".btnclose",function(){
- var the = $(this);
- RemoveDate(the);
-});
-
-RemoveDate = function(the){
- the.parent().remove();
-}
-
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14003] move generic dynamic datetimepicker,
Sigurd Nes <=