mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:20 +01:00
*Calendar - Quick add dialog now shows conflict warning instead of quietly stopping
This commit is contained in:
parent
3c9419ee1a
commit
cd76cccf8b
@ -34,6 +34,7 @@ class calendar_uiforms extends calendar_ui
|
||||
var $public_functions = array(
|
||||
'freetimesearch' => True,
|
||||
'ajax_add' => true,
|
||||
'ajax_conflicts' => true,
|
||||
'edit' => true,
|
||||
'process_edit' => true,
|
||||
'export' => true,
|
||||
@ -1469,6 +1470,32 @@ class calendar_uiforms extends calendar_ui
|
||||
$this->edit();
|
||||
}
|
||||
|
||||
public function ajax_conflicts()
|
||||
{
|
||||
$participants = json_decode($_GET['participants'],true);
|
||||
unset($_GET['participants']);
|
||||
|
||||
$content = $this->default_add_event();
|
||||
|
||||
// Process edit wants to see input values
|
||||
$participants = array(1=> false);
|
||||
$participants['cal_resources'] = '';
|
||||
foreach($content['participants'] as $id => $status)
|
||||
{
|
||||
$quantity = $role = '';
|
||||
calendar_so::split_status($status,$quantity,$role);
|
||||
$participants[] = array(
|
||||
'uid' => $id,
|
||||
'status' => $status,
|
||||
'quantity' => $quantity,
|
||||
'role' => $role
|
||||
);
|
||||
}
|
||||
$content['participants'] = $participants;
|
||||
$content['button'] = array('apply' => true);
|
||||
return $this->process_edit($content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit a calendar event
|
||||
*
|
||||
|
@ -1655,7 +1655,6 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
||||
// Open dialog to use as target
|
||||
var add_dialog = et2_dialog.show_dialog(null, '', ' ', null, [], et2_dialog.PLAIN_MESSAGE, this.egw);
|
||||
|
||||
|
||||
// Call the server, get it into the dialog
|
||||
options = jQuery.extend({menuaction: 'calendar.calendar_uiforms.ajax_add', template: 'calendar.add'}, options);
|
||||
this.egw.json(
|
||||
@ -1699,16 +1698,36 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
||||
// Wait a bit to make sure etemplate button finishes processing, or it will error
|
||||
window.setTimeout(function() {
|
||||
var template = etemplate2.getById('calendar-add');
|
||||
if(template)
|
||||
if(template && template.name === 'calendar.add')
|
||||
{
|
||||
template.clear();
|
||||
this.dialog.destroy();
|
||||
delete app.calendar.quick_add;
|
||||
}
|
||||
this.dialog.destroy();
|
||||
if(this.event)
|
||||
else if (template)
|
||||
{
|
||||
this.event.destroy();
|
||||
// Open conflicts
|
||||
var data = jQuery.extend({},template.widgetContainer.getArrayMgr('content').data, app.calendar.quick_add);
|
||||
|
||||
egw.openPopup(
|
||||
egw.link(
|
||||
'/index.php?menuaction=calendar.calendar_uiforms.ajax_conflicts',
|
||||
data
|
||||
),
|
||||
850, 300,
|
||||
'conflicts', 'calendar'
|
||||
);
|
||||
|
||||
delete app.calendar.quick_add;
|
||||
|
||||
// Close the JS dialog
|
||||
this.dialog.destroy();
|
||||
|
||||
// Do not submit this etemplate
|
||||
return false;
|
||||
}
|
||||
}.bind({dialog: add_dialog, event: event}), 100);
|
||||
|
||||
}.bind({dialog: add_dialog, event: ev}), 1000);
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -1722,6 +1741,7 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
||||
*/
|
||||
add_dialog_save: function(event, widget)
|
||||
{
|
||||
this.quick_add = widget.getInstanceManager().getValues(widget.getRoot());
|
||||
// Close the dialog
|
||||
jQuery(widget.getInstanceManager().DOMContainer.parentNode).dialog('close');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user