mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
If a home favorite loses it's associated favorite (it gets deleted), open the config dialog so user can pick another instead of always being blank.
This commit is contained in:
parent
9e3676a8c9
commit
f1983a3f07
@ -64,13 +64,15 @@ class calendar_favorite_portlet extends home_favorite_portlet
|
||||
else
|
||||
{
|
||||
$ui = new calendar_uiviews();
|
||||
if ($this->favorite)
|
||||
{
|
||||
if($this->favorite['state']['start']) $ui->search_params['start'] = $this->favorite['state']['start'];
|
||||
if($this->favorite['state']['cat_id']) $ui->search_params['cat_id'] = $this->favorite['state']['cat_id'];
|
||||
// Owner can be 0 for current user
|
||||
if(array_key_exists('owner',$this->favorite['state'])) $ui->search_params['users'] = explode(',',$this->favorite['state']['owner']);
|
||||
if($this->favorite['state']['filter']) $ui->search_params['filter'] = $this->favorite['state']['filter'];
|
||||
if($this->favorite['state']['sortby']) $ui->search_params['sortby'] = $this->favorite['state']['sortby'];
|
||||
|
||||
}
|
||||
$etemplate->read('home.legacy');
|
||||
|
||||
$etemplate->set_dom_id($id);
|
||||
|
@ -186,9 +186,12 @@ class home_favorite_portlet extends home_portlet
|
||||
$favorites = egw_favorites::get_favorites($this->context['appname']);
|
||||
$favorite_list = array();
|
||||
foreach($favorites as $id => $favorite)
|
||||
{
|
||||
if($favorite)
|
||||
{
|
||||
$favorite_list[$id] = $favorite['name'];
|
||||
}
|
||||
}
|
||||
$favorite = array(
|
||||
'label' => lang('Favorite'),
|
||||
'name' => 'favorite',
|
||||
|
@ -873,6 +873,16 @@ app.classes.home.home_weather_portlet = app.classes.home.home_portlet.extend({
|
||||
}
|
||||
});
|
||||
app.classes.home.home_favorite_portlet = app.classes.home.home_portlet.extend({
|
||||
init: function(portlet) {
|
||||
// call parent
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
// Somehow favorite got lost, or is not set
|
||||
if(!portlet.options.settings.favorite)
|
||||
{
|
||||
portlet.edit_settings();
|
||||
}
|
||||
},
|
||||
observer: function(_msg, _app, _id, _type, _msg_type, _targetapp)
|
||||
{
|
||||
if(this.portlet.class.indexOf(_app) == 0 || this.portlet.class == 'home_favorite_portlet')
|
||||
|
Loading…
Reference in New Issue
Block a user