mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +01:00
W.I.P of Calendar holiday report:
- Handle holiday_report preference on server-side
This commit is contained in:
parent
1764ee826c
commit
035c544529
@ -57,7 +57,7 @@ class calendar_holiday_report extends calendar_ui{
|
|||||||
if (is_null($content))
|
if (is_null($content))
|
||||||
{
|
{
|
||||||
$cats = $cat->return_sorted_array($start=0, false, '', 'ASC', 'cat_name', true, 0, true);
|
$cats = $cat->return_sorted_array($start=0, false, '', 'ASC', 'cat_name', true, 0, true);
|
||||||
|
$cats_status = $GLOBALS['egw_info']['user']['preferences']['calendar']['holiday_report'];
|
||||||
foreach ($cats as &$value)
|
foreach ($cats as &$value)
|
||||||
{
|
{
|
||||||
$content['grid'][] = array(
|
$content['grid'][] = array(
|
||||||
@ -69,6 +69,10 @@ class calendar_holiday_report extends calendar_ui{
|
|||||||
'enable' => true
|
'enable' => true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (is_array($cats_status))
|
||||||
|
{
|
||||||
|
$content['grid'] = array_replace_recursive($content['grid'], $cats_status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -81,7 +85,11 @@ class calendar_holiday_report extends calendar_ui{
|
|||||||
// report button pressed
|
// report button pressed
|
||||||
if (!empty($button))
|
if (!empty($button))
|
||||||
{
|
{
|
||||||
Api\Preferences::change_preference($content, $name, $value);
|
// shift the grid content by one because of the reserved first row
|
||||||
|
// for the header.
|
||||||
|
array_shift($content['grid']);
|
||||||
|
Api\Framework::ajax_set_preference('calendar', 'holiday_report',$content['grid']);
|
||||||
|
|
||||||
foreach ($content['grid'] as $row)
|
foreach ($content['grid'] as $row)
|
||||||
{
|
{
|
||||||
if ($row['enable'])
|
if ($row['enable'])
|
||||||
@ -138,6 +146,8 @@ class calendar_holiday_report extends calendar_ui{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Add an extra row for the grid header
|
||||||
|
array_unshift($content['grid'],array(''=> ''));
|
||||||
$preserv = $content;
|
$preserv = $content;
|
||||||
$this->tmpl->exec('calendar.calendar_holiday_report.index', $content, array(), array(), $preserv, 2);
|
$this->tmpl->exec('calendar.calendar_holiday_report.index', $content, array(), array(), $preserv, 2);
|
||||||
}
|
}
|
||||||
|
@ -3749,7 +3749,7 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
|||||||
holiday_report_init: function ()
|
holiday_report_init: function ()
|
||||||
{
|
{
|
||||||
var content = this.et2.getArrayMgr('content').data;
|
var content = this.et2.getArrayMgr('content').data;
|
||||||
for (var i=0;i<content.grid.length;i++)
|
for (var i=1;i<content.grid.length;i++)
|
||||||
{
|
{
|
||||||
if (content.grid[i] != null) this.holiday_report_enable({name:i+'', checked:content.grid[i]['enable']});
|
if (content.grid[i] != null) this.holiday_report_enable({name:i+'', checked:content.grid[i]['enable']});
|
||||||
}
|
}
|
||||||
@ -3766,22 +3766,11 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
|||||||
var widgets = ['[user]','[weekend]','[holidays]','[min_days]'];
|
var widgets = ['[user]','[weekend]','[holidays]','[min_days]'];
|
||||||
var row_id = _widget.name.match(/\d+/);
|
var row_id = _widget.name.match(/\d+/);
|
||||||
var w = {};
|
var w = {};
|
||||||
for (var i=0;i<widgets.length;i++)
|
for (var i=1;i<widgets.length;i++)
|
||||||
{
|
{
|
||||||
w = this.et2.getWidgetById(row_id+widgets[i]);
|
w = this.et2.getWidgetById(row_id+widgets[i]);
|
||||||
if (w) w.set_readonly(!_widget.checked);
|
if (w) w.set_readonly(!_widget.checked);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {type} _widget
|
|
||||||
* @returns {undefined}
|
|
||||||
*/
|
|
||||||
holiday_report_send: function (_widget)
|
|
||||||
{
|
|
||||||
var content = this.et2.getArrayMgr('content').data;
|
|
||||||
egw.set_preference('calendar','holiday_report',JSON.stringify(content.grid));
|
|
||||||
this.et2._inst.submit(_widget);
|
|
||||||
}
|
}
|
||||||
});}).call(this);
|
});}).call(this);
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ Egroupware
|
|||||||
<description value="Date range"/>
|
<description value="Date range"/>
|
||||||
<date id="start" label="Start"/>
|
<date id="start" label="Start"/>
|
||||||
<date id="end" label="End"/>
|
<date id="end" label="End"/>
|
||||||
<button id="button[report]" label="Report" background_image="1" image="template" onclick="app.calendar.holiday_report_send" />
|
<button id="button[report]" label="Report" background_image="1" image="template"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
</template>
|
</template>
|
||||||
</overlay>
|
</overlay>
|
||||||
|
Loading…
Reference in New Issue
Block a user