mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-24 17:04:14 +01:00
Update for resource selection to re-enable conflict detection
- Remove account & contact options from default resource selection preference - Edit dialog participant now passes selected start & duration, so conflict detection works again
This commit is contained in:
parent
766dd31d16
commit
40fbf3e2c9
@ -192,9 +192,7 @@ class calendar_hooks
|
||||
$defaultresource_sel = array(
|
||||
'resources_conflict' => lang('resources with conflict detection'),
|
||||
'resources_without_conflict' => lang('resources except conflicting ones'),
|
||||
'resources' => lang('resources'),
|
||||
'addressbook' => lang('addressbook'),
|
||||
'home-accounts' => lang('Accounts'),
|
||||
'resources' => lang('resources')
|
||||
);
|
||||
$reset_stati_on_shifts = array(
|
||||
'no' => lang('Never'),
|
||||
@ -418,7 +416,8 @@ class calendar_hooks
|
||||
'help' => 'Default type of resources application selected in the calendar particpants research form.',
|
||||
'xmlrpc' => True,
|
||||
'admin' => False,
|
||||
'forced' => 'addressbook',
|
||||
'forced' => 'resources',
|
||||
'default' => 'resources'
|
||||
),
|
||||
'default_private' => array(
|
||||
'type' => 'check',
|
||||
|
@ -128,7 +128,8 @@ class calendar_owner_etemplate_widget extends etemplate_widget_taglist
|
||||
|
||||
$query = $_REQUEST['query'];
|
||||
// Arbitrarily limited to 50 / resource
|
||||
$options = array('start' => 0, 'num_rows' => 50);
|
||||
$options = array('start' => 0, 'num_rows' => 50) +
|
||||
array_diff_key($_REQUEST, array_flip(array('menuaction','query')));
|
||||
$results = array();
|
||||
|
||||
$resources = array_merge(array('' => $bo->resources['']),$bo->resources);
|
||||
|
@ -1621,20 +1621,6 @@ class calendar_uiforms extends calendar_ui
|
||||
if ($data['app'] == 'email') continue; // make no sense, as we cant search for email
|
||||
$content['participants']['cal_resources'] .= ','.$data['app'];
|
||||
}
|
||||
// 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']['app'] = $this->cal_prefs['defaultresource_sel'];
|
||||
// * get informations from the event on the ajax callback
|
||||
if (in_array($content['participants']['resource']['app'],array('resources_conflict','resources_without_conflict')))
|
||||
{
|
||||
// fix real app string
|
||||
$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']['app']]))
|
||||
{
|
||||
$content['participants']['resource']['app'] = 'home-accounts';
|
||||
}
|
||||
}
|
||||
$content['participants']['status_date'] = $preserv['actual_date'];
|
||||
$preserved = array_merge($preserv,$content);
|
||||
|
@ -1003,6 +1003,30 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
||||
if (typeof content.duration != 'undefined') end.set_value("+"+content.duration);
|
||||
}
|
||||
}
|
||||
this.edit_update_participant(start);
|
||||
},
|
||||
|
||||
/**
|
||||
* Update query parameters for participants
|
||||
*
|
||||
* This allows for resource conflict checking
|
||||
*
|
||||
* @param {DOMNode|et2_widget} input Either the input node, or the widget
|
||||
* @param {et2_widget} [widget] If input is an input node, widget will have
|
||||
* the widget, otherwise it will be undefined.
|
||||
*/
|
||||
edit_update_participant: function(input, widget)
|
||||
{
|
||||
if(typeof widget === 'undefined') widget = input;
|
||||
var content = widget.getInstanceManager().getValues(widget.getRoot());
|
||||
var participant = widget.getRoot().getWidgetById('participant');
|
||||
|
||||
participant.set_autocomplete_params({exec:{
|
||||
start: content.start,
|
||||
end: content.end,
|
||||
duration: content.duration,
|
||||
whole_day: content.whole_day
|
||||
}});
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -205,12 +205,12 @@
|
||||
</row>
|
||||
<row class="dialogHeader2" height="28">
|
||||
<description for="start" value="Start" width="88"/>
|
||||
<date-time id="start" needed="1" class="required"/>
|
||||
<date-time id="start" needed="1" class="required" onchange="app.calendar.edit_update_participant"/>
|
||||
<description for="duration" value="Duration" id="calendar_edit_duration" />
|
||||
<menulist >
|
||||
<menupopup statustext="Duration of the meeting" class="et2_fullWidth" id="duration" no_lang="1" onchange="app.calendar.set_enddate_visibility" options="Use end date,,,,,,,false"/>
|
||||
</menulist>
|
||||
<date-time id="end"/>
|
||||
<date-time id="end" onchange="app.calendar.edit_update_participant"/>
|
||||
</row>
|
||||
<row class="dialogHeader2" height="28">
|
||||
<label value="options"/>
|
||||
|
@ -598,7 +598,7 @@ 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 ($options['exec'])
|
||||
if ($options['exec'] && $GLOBALS['egw_info']['preferences']['calendar']['defaultresource_sel'] !== 'resources')
|
||||
{
|
||||
// we'll use a cache for resources info taken from database
|
||||
static $res_info_cache = array();
|
||||
@ -608,12 +608,11 @@ class resources_bo
|
||||
//get a calendar objet for reservations
|
||||
if ( (!isset($this->bocal)) || !(is_object($this->bocal)))
|
||||
{
|
||||
require_once(EGW_INCLUDE_ROOT.'/calendar/inc/class.calendar_bo.inc.php');
|
||||
$this->bocal =& CreateObject('calendar.calendar_bo');
|
||||
$this->bocal = new calendar_bo();
|
||||
}
|
||||
$start = new egw_time($cal_info['start']);
|
||||
$startarr= getdate($start->format('ts'));
|
||||
if (isset($cal_info['whole_day'])) {
|
||||
if (isset($cal_info['whole_day']) && $cal_info['whole_day']) {
|
||||
$startarr['hour'] = $startarr['minute'] = 0;
|
||||
$start = new egw_time($startarr);
|
||||
$end = $start->format('ts') + 86399;
|
||||
@ -675,7 +674,7 @@ class resources_bo
|
||||
}
|
||||
}
|
||||
if (isset($res_info_cache)) {
|
||||
$show_conflict= (isset($options['exec']['show_conflict'])&& ($options['exec']['show_conflict']=='0'))? False:True;
|
||||
$show_conflict= $GLOBALS['egw_info']['user']['preferences']['calendar']['defaultresource_sel'] === 'resources_conflict';
|
||||
// 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user