enable create of recurreence for weekdays only for recur_type weekly (conditional enabling/disabling weekday selection area) provided by andreas stoeckel

This commit is contained in:
Klaus Leithoff 2010-04-16 13:24:58 +00:00
parent fb747b3a97
commit c93b76987a
4 changed files with 52 additions and 5 deletions

View File

@ -1070,9 +1070,14 @@ class calendar_uiforms extends calendar_ui
}
else
{
//Add the check_recur_type function to onload, which disables recur_data function
//if recur_type is not repeat weekly.
$onload = "check_recur_type('recur_type',2);";
// We hide the enddate if one of our predefined durations fits
// the call to set_style_by_class has to be in onload, to make sure the function and the element is already created
$GLOBALS['egw']->js->set_onload("set_style_by_class('table','end_hide','display','".($content['duration'] && isset($sel_options['duration'][$content['duration']]) ? 'none' : 'block')."');");
$onload .= " set_style_by_class('table','end_hide','display','".($content['duration'] && isset($sel_options['duration'][$content['duration']]) ? 'none' : 'block')."');";
$GLOBALS['egw']->js->set_onload($onload);
$readonlys['recur_exception'] = !count($content['recur_exception']); // otherwise we get a delete button
@ -1147,6 +1152,12 @@ class calendar_uiforms extends calendar_ui
. (!$event['id'] ? lang('Add')
: ($view ? ($content['edit_single'] ? lang('View exception') : ($content['recur_type'] ? lang('View series') : lang('View')))
: ($content['edit_single'] ? lang('Create exception') : ($content['recur_type'] ? lang('Edit series') : lang('Edit')))));
//Function for disabling the recur_data multiselect box
$js .=
"\nfunction check_recur_type(_id, _ind)\n{\negw_set_checkbox_multiselect_enabled('recur_data',".
"document.getElementById('exec['+_id+']').selectedIndex == _ind);\n}\n";
$GLOBALS['egw_info']['flags']['java_script'] .= "<script>\n$js\n</script>\n";
$content['cancel_needs_refresh'] = (bool)$_GET['cancel_needs_refresh'];

View File

@ -2,7 +2,7 @@
/**
* eGroupWare - eTemplates for Application calendar
* http://www.egroupware.org
* generated by soetemplate::dump4setup() 2010-04-16 12:15
* generated by soetemplate::dump4setup() 2010-04-16 15:15
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package calendar
@ -35,7 +35,7 @@ $templ_data[] = array('name' => 'calendar.edit.participants','template' => '','l
$templ_data[] = array('name' => 'calendar.edit.print','template' => '','lang' => '','group' => '0','version' => '1.6.001','data' => 'a:1:{i:0;a:7:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:6:{s:1:"A";s:2:"95";s:2:"c3";s:4:",top";s:2:"c1";s:3:"row";s:2:"c2";s:2:"th";s:2:"h1";s:8:",@no_add";s:1:"D";s:24:",@hide_status_recurrence";}i:1;a:6:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:3:"New";}s:1:"B";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:6:"2,,0,0";i:1;a:4:{s:4:"type";s:14:"select-account";s:4:"size";s:27:"User or group,calendar+,,10";s:4:"name";s:7:"account";s:4:"help";s:13:"User or group";}i:2;a:3:{s:4:"type";s:10:"link-entry";s:4:"name";s:8:"resource";s:4:"size";s:14:"@cal_resources";}}s:1:"C";a:3:{s:4:"type";s:3:"int";s:4:"size";s:4:"1,,3";s:4:"name";s:8:"quantity";}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:3:{s:4:"type";s:6:"button";s:5:"label";s:3:"Add";s:4:"name";s:3:"add";}s:1:"F";a:1:{s:4:"type";s:5:"label";}}i:2;a:6:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:4:"Type";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:12:"Participants";}s:1:"C";a:2:{s:4:"type";s:5:"label";s:5:"label";s:8:"Quantity";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:10:"All future";}s:1:"E";a:2:{s:4:"type";s:5:"label";s:5:"label";s:6:"Status";}s:1:"F";a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"Actions";}}i:3;a:6:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:4:"name";s:11:"${row}[app]";}s:1:"B";a:6:{s:4:"type";s:5:"label";s:4:"data";a:2:{i:0;a:0:{}i:1;a:2:{s:1:"A";a:3:{s:4:"type";s:14:"select-account";s:4:"name";s:6:"${row}";s:8:"readonly";s:1:"1";}s:1:"B";a:5:{s:4:"type";s:6:"select";s:4:"name";s:26:"accounts_status[$row_cont]";s:8:"onchange";s:1:"1";s:4:"help";s:30:"Accept or reject an invitation";s:7:"no_lang";s:1:"1";}}}s:4:"rows";i:1;s:4:"cols";i:2;s:4:"name";s:13:"${row}[title]";s:7:"no_lang";s:1:"1";}s:1:"C";a:3:{s:4:"type";s:3:"int";s:4:"name";s:16:"${row}[quantity]";s:4:"size";s:4:"1,,3";}s:1:"D";a:3:{s:4:"type";s:8:"checkbox";s:4:"name";s:25:"${row}[status_recurrence]";s:5:"align";s:6:"center";}s:1:"E";a:4:{s:4:"type";s:6:"select";s:4:"name";s:14:"${row}[status]";s:7:"no_lang";s:1:"1";s:8:"onchange";i:1;}s:1:"F";a:9:{s:4:"type";s:6:"button";s:4:"data";a:2:{i:0;a:1:{s:2:"h1";s:19:",!@resources_status";}i:1;a:2:{s:1:"A";a:4:{s:4:"type";s:16:"resources_select";s:4:"name";s:6:"${row}";s:8:"readonly";s:1:"1";s:7:"no_lang";s:1:"1";}s:1:"B";a:5:{s:4:"type";s:6:"select";s:4:"name";s:27:"resources_status[$row_cont]";s:8:"onchange";s:1:"1";s:4:"help";s:30:"Accept or reject an invitation";s:7:"no_lang";s:1:"1";}}}s:4:"rows";i:1;s:4:"cols";i:2;s:4:"name";s:22:"delete[$row_cont[uid]]";s:5:"align";s:6:"center";s:5:"label";s:6:"Delete";s:8:"onchange";i:1;s:4:"size";s:6:"delete";}}}s:4:"rows";i:3;s:4:"cols";i:6;s:4:"size";s:17:"100%,200,,,,,auto";s:4:"name";s:12:"participants";s:7:"options";a:3:{i:0;s:4:"100%";i:1;s:3:"200";i:6;s:4:"auto";}}}','size' => '100%,200,,,,,auto','style' => '','modified' => '1229280346',);
$templ_data[] = array('name' => 'calendar.edit.recurrence','template' => '','lang' => '','group' => '0','version' => '1.7.002','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:6:{i:0;a:11:{s:2:"c1";s:3:"row";s:1:"A";s:2:"95";s:2:"c3";s:3:"row";s:2:"c4";s:3:"row";s:1:"D";s:3:"50%";s:2:"h1";s:12:",!@reference";s:2:"h3";s:2:"12";s:2:"c5";s:7:"row,top";s:2:"h4";s:2:"12";s:2:"h2";s:2:"12";s:2:"c2";s:2:"th";}i:1;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"Exception";}s:1:"B";a:4:{s:4:"type";s:9:"date-time";s:4:"span";s:5:",gray";s:8:"readonly";s:1:"1";s:4:"name";s:10:"recurrence";}s:1:"C";a:3:{s:4:"type";s:5:"label";s:4:"span";s:5:",gray";s:4:"name";s:9:"reference";}s:1:"D";a:3:{s:4:"type";s:5:"label";s:4:"span";s:5:",gray";s:4:"name";s:3:"uid";}}i:2;a:4:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"span";s:8:"all,gray";s:5:"label";s:27:"Repeating Event Information";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:16:"be back soon ;-)";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}}i:3;a:4:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"size";s:13:",,,recur_type";s:5:"label";s:11:"Repeat type";}s:1:"B";a:2:{s:4:"type";s:6:"select";s:4:"name";s:10:"recur_type";}s:1:"C";a:3:{s:4:"type";s:5:"label";s:4:"size";s:17:",,,recur_interval";s:5:"label";s:8:"Interval";}s:1:"D";a:4:{s:4:"type";s:13:"select-number";s:4:"name";s:14:"recur_interval";s:4:"help";s:53:"repeating interval, eg. 2 to repeat every second week";s:4:"size";s:9:"None,2,31";}}i:4;a:4:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"size";s:16:",,,recur_enddate";s:5:"label";s:8:"End date";}s:1:"B";a:3:{s:4:"type";s:4:"date";s:4:"name";s:13:"recur_enddate";s:4:"help";s:57:"repeat the event until which date (empty means unlimited)";}s:1:"C";a:3:{s:4:"type";s:5:"label";s:4:"size";s:7:",,,tzid";s:5:"label";s:8:"Timezone";}s:1:"D";a:3:{s:4:"type";s:15:"select-timezone";s:4:"name";s:4:"tzid";s:4:"help";s:49:"Timezone in which recurrences have identical time";}}i:5;a:4:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"size";s:13:",,,recur_data";s:5:"label";s:11:"Repeat days";}s:1:"B";a:4:{s:4:"type";s:10:"select-dow";s:4:"size";s:3:"6,1";s:4:"name";s:10:"recur_data";s:4:"help";s:44:"Days of the week for a weekly repeated event";}s:1:"C";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:6:"2,,0,0";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:10:"Exceptions";}i:2;a:5:{s:4:"type";s:6:"button";s:4:"name";s:17:"button[exception]";s:5:"label";s:16:"@exception_label";s:4:"help";s:38:"Create an exception for the given date";s:7:"no_lang";s:1:"1";}}s:1:"D";a:6:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:0:{}i:1;a:2:{s:1:"A";a:3:{s:4:"type";s:9:"date-time";s:4:"name";s:4:"$row";s:8:"readonly";s:1:"1";}s:1:"B";a:6:{s:4:"type";s:6:"button";s:5:"label";s:6:"Delete";s:4:"size";s:6:"delete";s:4:"name";s:27:"delete_exception[$row_cont]";s:4:"help";s:21:"Delete this exception";s:7:"onclick";s:40:"return confirm(\'Delete this exception\');";}}}s:4:"rows";i:1;s:4:"cols";i:2;s:4:"name";s:15:"recur_exception";s:7:"options";a:0:{}}}}s:4:"rows";i:5;s:4:"cols";i:4;s:4:"size";s:8:"100%,210";s:7:"options";a:2:{i:0;s:4:"100%";i:1;s:3:"210";}}}','size' => '100%,210','style' => '','modified' => '1210321464',);
$templ_data[] = array('name' => 'calendar.edit.recurrence','template' => '','lang' => '','group' => '0','version' => '1.7.003','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:6:{i:0;a:11:{s:2:"c1";s:3:"row";s:1:"A";s:2:"95";s:2:"c3";s:3:"row";s:2:"c4";s:3:"row";s:1:"D";s:3:"50%";s:2:"h1";s:12:",!@reference";s:2:"h3";s:2:"12";s:2:"c5";s:7:"row,top";s:2:"h4";s:2:"12";s:2:"h2";s:2:"12";s:2:"c2";s:2:"th";}i:1;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"Exception";}s:1:"B";a:4:{s:4:"type";s:9:"date-time";s:4:"span";s:5:",gray";s:8:"readonly";s:1:"1";s:4:"name";s:10:"recurrence";}s:1:"C";a:3:{s:4:"type";s:5:"label";s:4:"span";s:5:",gray";s:4:"name";s:9:"reference";}s:1:"D";a:3:{s:4:"type";s:5:"label";s:4:"span";s:5:",gray";s:4:"name";s:3:"uid";}}i:2;a:4:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"span";s:8:"all,gray";s:5:"label";s:27:"Repeating Event Information";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:16:"be back soon ;-)";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}}i:3;a:4:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"size";s:13:",,,recur_type";s:5:"label";s:11:"Repeat type";}s:1:"B";a:3:{s:4:"type";s:6:"select";s:4:"name";s:10:"recur_type";s:8:"onchange";s:34:"check_recur_type(\'recur_type\', 2);";}s:1:"C";a:3:{s:4:"type";s:5:"label";s:4:"size";s:17:",,,recur_interval";s:5:"label";s:8:"Interval";}s:1:"D";a:4:{s:4:"type";s:13:"select-number";s:4:"name";s:14:"recur_interval";s:4:"help";s:53:"repeating interval, eg. 2 to repeat every second week";s:4:"size";s:9:"None,2,31";}}i:4;a:4:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"size";s:16:",,,recur_enddate";s:5:"label";s:8:"End date";}s:1:"B";a:3:{s:4:"type";s:4:"date";s:4:"name";s:13:"recur_enddate";s:4:"help";s:57:"repeat the event until which date (empty means unlimited)";}s:1:"C";a:3:{s:4:"type";s:5:"label";s:4:"size";s:7:",,,tzid";s:5:"label";s:8:"Timezone";}s:1:"D";a:3:{s:4:"type";s:15:"select-timezone";s:4:"name";s:4:"tzid";s:4:"help";s:49:"Timezone in which recurrences have identical time";}}i:5;a:4:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"size";s:13:",,,recur_data";s:5:"label";s:11:"Repeat days";}s:1:"B";a:4:{s:4:"type";s:10:"select-dow";s:4:"size";s:3:"6,1";s:4:"name";s:10:"recur_data";s:4:"help";s:44:"Days of the week for a weekly repeated event";}s:1:"C";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:6:"2,,0,0";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:10:"Exceptions";}i:2;a:5:{s:4:"type";s:6:"button";s:4:"name";s:17:"button[exception]";s:5:"label";s:16:"@exception_label";s:4:"help";s:38:"Create an exception for the given date";s:7:"no_lang";s:1:"1";}}s:1:"D";a:6:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:0:{}i:1;a:2:{s:1:"A";a:3:{s:4:"type";s:9:"date-time";s:4:"name";s:4:"$row";s:8:"readonly";s:1:"1";}s:1:"B";a:6:{s:4:"type";s:6:"button";s:5:"label";s:6:"Delete";s:4:"size";s:6:"delete";s:4:"name";s:27:"delete_exception[$row_cont]";s:4:"help";s:21:"Delete this exception";s:7:"onclick";s:40:"return confirm(\'Delete this exception\');";}}}s:4:"rows";i:1;s:4:"cols";i:2;s:4:"name";s:15:"recur_exception";s:7:"options";a:0:{}}}}s:4:"rows";i:5;s:4:"cols";i:4;s:4:"size";s:8:"100%,210";s:7:"options";a:2:{i:0;s:4:"100%";i:1;s:3:"210";}}}','size' => '100%,210','style' => '','modified' => '1210321464',);
$templ_data[] = array('name' => 'calendar.edit_series','template' => '','lang' => '','group' => '0','version' => '1.7.001','data' => 'a:1:{i:0;a:10:{s:4:"type";s:8:"groupbox";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"size";s:1:"2";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:67:"Do you want to edit this event as an exception or the whole series?";}s:5:"label";s:30:"This event is part of a series";i:2;a:6:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"3";i:1;a:3:{s:4:"type";s:10:"buttononly";s:5:"label";s:14:"Edit exception";s:7:"onclick";s:17:"open_edit(false);";}i:2;a:3:{s:4:"type";s:10:"buttononly";s:5:"label";s:11:"Edit series";s:7:"onclick";s:16:"open_edit(true);";}i:3;a:3:{s:4:"type";s:10:"buttononly";s:5:"label";s:6:"Cancel";s:7:"onclick";s:62:"document.getElementById(\'edit_series\').style.display = \'none\';";}s:5:"align";s:6:"center";}s:4:"span";s:11:",editSeries";s:4:"name";s:11:"edit_series";}}','size' => '','style' => '#edit_series {
position: absolute;

View File

@ -119,7 +119,7 @@
.selectRole select { width: 100%; }
</styles>
</template>
<template id="calendar.edit.recurrence" template="" lang="" group="0" version="1.7.002">
<template id="calendar.edit.recurrence" template="" lang="" group="0" version="1.7.003">
<grid width="100%" height="210">
<columns>
<column width="95"/>
@ -143,7 +143,7 @@
<row class="row" height="12">
<description options=",,,recur_type" value="Repeat type"/>
<menulist>
<menupopup id="recur_type"/>
<menupopup id="recur_type" onchange="check_recur_type('recur_type', 2);"/>
</menulist>
<description options=",,,recur_interval" value="Interval"/>
<menulist>

View File

@ -39,6 +39,42 @@ else if (document.layers)
is_ns4 = true;
}
function egw_set_checkbox_multiselect_enabled(_id, _enabled)
{
//Retrieve the checkbox_multiselect base div
var ms = document.getElementById('exec['+_id+']');
if (ms !== null)
{
//Set the background color
var label_color = "";
if (_enabled)
{
ms.style.backgroundColor = "white";
label_color = "black";
}
else
{
ms.style.backgroundColor = "#EEEEEE";
label_color = "gray"
}
//Enable/Disable all children input elements
for (var i = 0; i <ms.childNodes.length; i++)
{
if (ms.childNodes[i].nodeName == 'LABEL')
{
ms.childNodes[i].style.color = label_color;
if ((ms.childNodes[i].childNodes.length >= 1) &&
(ms.childNodes[i].childNodes[0].nodeName == 'INPUT'))
{
ms.childNodes[i].childNodes[0].disabled = !_enabled;
ms.childNodes[i].childNodes[0].checked &= _enabled;
}
}
}
}
}
// works only correctly in Mozilla/FF and Konqueror
function egw_openWindowCentered2(_url, _windowName, _width, _height, _status)
{