* Calendar - Quick add dialog for new events

This commit is contained in:
nathangray 2018-12-13 14:35:26 -07:00
parent 7debe27ada
commit 5e9cace2bc
4 changed files with 78 additions and 3 deletions

View File

@ -45,6 +45,7 @@ class calendar_hooks
),
'add' => array(
'menuaction' => 'calendar.calendar_uiforms.edit',
'template' => 'calendar.add'
),
'add_app' => 'link_app',
'add_id' => 'link_id',
@ -243,6 +244,14 @@ class calendar_hooks
'admin' => False,
'default'=> '1', // 1 = week
),*/
'new_event_dialog' => array(
'type' => 'select',
'label' => 'New event dialog',
'name' => 'new_event_dialog',
'values'=> array('add' => lang('Quick add'), 'edit' => lang('Regular edit')),
'help' => 'Use quick add or full edit dialog when creating a new event',
'default' => 'add',
),
'multiple_weeks' => array(
'type' => 'select',
'label' => 'Weeks in multiple week view',
@ -354,6 +363,16 @@ class calendar_hooks
'xmlrpc' => False,
'admin' => False
),
'default_category' => array(
'type' => 'multiselect',
'label' => 'New event category',
'name' => 'default_category',
'help' => 'Category automatically added to new events',
'values' => Api\Etemplate\Widget\Select::typeOptions('select-cat', ',,,calendar'),
'default' => '',
'xmlrpc' => False,
'admin' => False
),
'default-alarm' => array(
'type' => 'date-duration',//'select',
'label' => lang('Default alarm for regular events').' ('.lang('empty = no alarm').')',

View File

@ -208,6 +208,10 @@ class calendar_uiforms extends calendar_ui
$cat = (int)$cat;
}
}
else
{
$cat_id = $this->cal_prefs['default_category'];
}
$duration = isset($_GET['duration']) ? (int)$_GET['duration'] : (int) $this->bo->cal_prefs['defaultlength']*60;
if(isset($_GET['end']))
{
@ -635,6 +639,11 @@ class calendar_uiforms extends calendar_ui
case 'exception': // create an exception in a recuring event
$msg = $this->_create_exception($event,$preserv);
break;
case 'edit':
// Going from add dialog to full edit dialog
unset($preserv['template']);
unset($event['template']);
break;
case 'copy': // create new event with copied content, some content need to be unset to make a "new" event
unset($event['id']);
@ -1478,6 +1487,12 @@ class calendar_uiforms extends calendar_ui
'no_popup' => isset($_GET['no_popup']),
'template' => isset($_GET['template']) ? $_GET['template'] : (isset($_REQUEST['print']) ? 'calendar.print' : 'calendar.edit'),
);
if($preserv['template'] && ($registry = Link::get_registry('calendar', 'add')) && $registry['template'] == $preserv['template'] &&
$this->cal_prefs['new_event_dialog'] == 'edit')
{
// User wants full thing
unset($preserv['template']);
}
$cal_id = (int) $_GET['cal_id'];
if($_GET['action'])
{

View File

@ -215,6 +215,7 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
this.state = content.data;
break;
case 'calendar.add':
case 'calendar.edit':
if (typeof content.data['conflicts'] == 'undefined')
{
@ -223,9 +224,12 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
{
this.set_enddate_visibility();
this.check_recur_type();
this.edit_start_change();
this.et2.getWidgetById('recur_exception').set_disabled(!content.data.recur_exception ||
typeof content.data.recur_exception[0] == 'undefined');
this.edit_start_change(null, this.et2.getWidgetById('start'));
if(this.et2.getWidgetById('recur_exception'))
{
this.et2.getWidgetById('recur_exception').set_disabled(!content.data.recur_exception ||
typeof content.data.recur_exception[0] == 'undefined');
}
}
else
{

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE overlay PUBLIC "-//EGroupware GmbH//eTemplate 2//EN" "http://www.egroupware.org/etemplate2.dtd">
<!-- $Id$ -->
<overlay>
<template id="calendar.add" template="" lang="" group="0" version="19.1.000">
<grid width="100%">
<columns>
<column width="88"/>
<column width="130"/>
<column width="88"/>
<column width="130"/>
<column width="130"/>
</columns>
<rows>
<row class="dialogHeader" height="28">
<appicon/>
<textbox id="title" needed="1" size="75" maxlength="255" tabindex="1" class="et2_fullWidth" span="4" blur="Title"/>
</row>
<row class="dialogHeader2" height="28">
<description for="start" value="Start" width="88"/>
<date-time id="start" needed="1" class="required" onchange="app.calendar.edit_start_change"/>
<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" onchange="app.calendar.edit_update_participant"/>
</row>
</rows>
</grid>
<hbox class="dialogFooterToolbar">
<button statustext="saves the changes made" label="Save" id="button[save]" image="save" background_image="1" />
<button statustext="Full edit dialog" label="Edit" id="button[edit]" image="edit" background_image="1"/>
<button statustext="Close the window" label="Cancel" id="button[cancel]" onclick="window.close();" image="cancel" background_image="1"/>
<checkbox label="Always use full edit dialog" id="always_edit_dialog" statustext="Always use the full edit dialog, not this little dialog" onchange="debugger;egw.set_preference('calendar',widget.id,widget.get_value() ? 'edit' : 'add');"/>
</hbox>
</template>
</overlay>