diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php
index 9914d39ab0..1a64b39bbe 100644
--- a/calendar/inc/class.calendar_uiforms.inc.php
+++ b/calendar/inc/class.calendar_uiforms.inc.php
@@ -1466,21 +1466,17 @@ class calendar_uiforms extends calendar_ui
}
// adding extra content for the resource link-entry widget to
// * select resources or addressbook as a default selection on the app selectbox based on prefs
- $content['participants']['resource']['default_sel'] = $this->cal_prefs['defaultresource_sel'];
+ $content['participants']['resource']['app'] = $this->cal_prefs['defaultresource_sel'];
// * get informations from the event on the ajax callback
- if (in_array($content['participants']['resource']['default_sel'],array('resources_conflict','resources_without_conflict')))
+ if (in_array($content['participants']['resource']['app'],array('resources_conflict','resources_without_conflict')))
{
// fix real app string
- $content['participants']['resource']['default_sel'] = 'resources';
- // this will be used to get reservation information on the resource select list
- $content['participants']['resource']['extra'] = "values2url(this.form,'start,end,duration,participants,recur_type,whole_day')".
- "+'&exec[event_id]=".$content['id']."'"."+'&exec[show_conflict]=".
- (($this->cal_prefs['defaultresource_sel'] == 'resources_without_conflict')? '0':'1')."'";
+ $content['participants']['resource']['app'] = 'resources';
}
// check if current pref. is an allowed application for the user
- if (!isset($GLOBALS['egw_info']['user']['apps'][$content['participants']['resource']['default_sel']]))
+ if (!isset($GLOBALS['egw_info']['user']['apps'][$content['participants']['resource']['app']]))
{
- $content['participants']['resource']['default_sel'] = 'home-accounts';
+ $content['participants']['resource']['app'] = 'home-accounts';
}
}
$content['participants']['status_date'] = $preserv['actual_date'];
diff --git a/calendar/js/app.js b/calendar/js/app.js
index 47272a6235..8a7d9eff02 100644
--- a/calendar/js/app.js
+++ b/calendar/js/app.js
@@ -939,6 +939,43 @@ app.classes.calendar = AppJS.extend(
}
},
+ /**
+ * In edit popup, search for calendar participants.
+ * Resources need to have the start & duration (etc.)
+ * passed along in the query.
+ *
+ * @param {Object} request
+ * @param {et2_link_entry} widget
+ *
+ * @returns {boolean} True to continue with the search
+ */
+ edit_participant_search: function(request, widget)
+ {
+ if(widget.app_select.val() == 'resources')
+ {
+ // Resources search is expecting exec
+ var values = widget.getInstanceManager().getValues(widget.getRoot());
+ if(typeof request.options != 'object' || request.options == null)
+ {
+ request.options = {};
+ }
+ request.options.exec = {
+ start: values.start,
+ end: values.end,
+ duration: values.duration,
+ participants: values.participants,
+ recur_type: values.recur_type,
+ event_id: values.link_to.to_id, // cal_id, if available
+ show_conflict: (egw.preference('defaultresource_sel','calendar') == 'resources_without_conflict') ? '0' : '1'
+ };
+ if(values.whole_day)
+ {
+ request.options.exec.whole_date = true;
+ }
+ }
+ return true;
+ },
+
/**
* Handles to select freetime, and replace the selected one on Start,
* and End date&time in edit calendar entry popup.
diff --git a/calendar/templates/default/edit.xet b/calendar/templates/default/edit.xet
index 4b61e8c7c8..3754508c49 100644
--- a/calendar/templates/default/edit.xet
+++ b/calendar/templates/default/edit.xet
@@ -112,7 +112,7 @@
-
+
diff --git a/resources/inc/class.resources_bo.inc.php b/resources/inc/class.resources_bo.inc.php
index fb9ea02023..f0af53e732 100755
--- a/resources/inc/class.resources_bo.inc.php
+++ b/resources/inc/class.resources_bo.inc.php
@@ -588,11 +588,11 @@ class resources_bo
$data = $this->so->search($criteria,$only_keys,$order_by='name',$extra_cols='',$wildcard='%',$empty,$op='OR',$limit,$filter);
// maybe we need to check disponibility of the searched resources in the calendar if $pattern ['exec'] contains some extra args
$show_conflict=False;
- if (is_array($pattern) && isset($pattern['exec']) )
+ if ($options['exec'])
{
// we'll use a cache for resources info taken from database
static $res_info_cache = array();
- $cal_info=$pattern['exec'];
+ $cal_info=$options['exec'];
if ( isset($cal_info['start']) && isset($cal_info['duration']))
{
//get a calendar objet for reservations
@@ -601,22 +601,14 @@ class resources_bo
require_once(EGW_INCLUDE_ROOT.'/calendar/inc/class.calendar_bo.inc.php');
$this->bocal =& CreateObject('calendar.calendar_bo');
}
-
- //get the real timestamps from infos we have on the event
- //use etemplate date widget to handle date values
- require_once(EGW_INCLUDE_ROOT.'/phpgwapi/inc/class.jscalendar.inc.php');
- $jscal=& CreateObject('phpgwapi.jscalendar');
- $startarr= $jscal->input2date($cal_info['start']['str'],$raw='raw',$day='day',$month='month',$year='year');
+ $start = new egw_time($cal_info['start']);
+ $startarr= getdate($start->format('ts'));
if (isset($cal_info['whole_day'])) {
$startarr['hour'] = $startarr['minute'] = 0;
- unset($startarr['raw']);
- $start = $this->bocal->date2ts($startarr);
- $end = $start + 86399;
+ $start = new egw_time($startarr);
+ $end = $start->format('ts') + 86399;
} else {
- $startarr['hour'] = $cal_info['start']['H'];
- $startarr['minute'] = $cal_info['start']['i'];
- unset($startarr['raw']);
- $start = $this->bocal->date2ts($startarr);
+ $start = $start->format('ts');
$end = $start + ($cal_info['duration']);
}
@@ -673,7 +665,7 @@ class resources_bo
}
}
if (isset($res_info_cache)) {
- $show_conflict= (isset($pattern['exec']['show_conflict'])&& ($pattern['exec']['show_conflict']=='0'))? False:True;
+ $show_conflict= (isset($options['exec']['show_conflict'])&& ($options['exec']['show_conflict']=='0'))? False:True;
// if we have this array indexed on resource id it means non-bookable resource are removed and we are working for calendar
// so we'll loop on this one and not $data
foreach($res_info_cache as $id => $resource) {