diff --git a/home/inc/class.home_link_portlet.inc.php b/home/inc/class.home_link_portlet.inc.php index 5df7eef421..05a7682e9e 100644 --- a/home/inc/class.home_link_portlet.inc.php +++ b/home/inc/class.home_link_portlet.inc.php @@ -47,6 +47,8 @@ class home_link_portlet extends home_portlet if($context['entry'] && is_array($context['entry'])); { $this->title = $context['entry']['title'] = egw_link::title($context['entry']['app'], $context['entry']['id']); + + $need_reload |= (boolean)$context['entry']['id']; } $this->context = $context; } diff --git a/home/inc/class.home_portlet.inc.php b/home/inc/class.home_portlet.inc.php index b2abeae548..57cc63db99 100644 --- a/home/inc/class.home_portlet.inc.php +++ b/home/inc/class.home_portlet.inc.php @@ -107,4 +107,9 @@ abstract class home_portlet { return false; } + + public function __toString() + { + return get_called_class() . ' Context:' . array2string($this->context); + } } diff --git a/home/inc/class.home_ui.inc.php b/home/inc/class.home_ui.inc.php index d87ade5a6b..8c2460b9b7 100644 --- a/home/inc/class.home_ui.inc.php +++ b/home/inc/class.home_ui.inc.php @@ -44,7 +44,6 @@ class home_ui 'portlets' => $this->get_user_portlets($template) ); $template->setElementAttribute('home.index','actions',$this->get_actions()); - //$template->setElementAttribute('portlets[1]','settings',$settings[1]); $GLOBALS['egw_info']['flags']['app_header'] = lang('home'); $GLOBALS['egw_info']['flags']['currentapp'] = 'home'; @@ -59,6 +58,20 @@ class home_ui if(!$id) continue; $portlet = $this->get_portlet($id, $p_data, $content, $attrs, true); } + + // Main screen message + translation::add_app('mainscreen'); + $greeting = translation::translate('mainscreen_message',false,''); + + if($greeting == 'mainscreen_message'|| empty($greeting)) + { + translation::add_app('mainscreen','en'); // trying the en one + $greeting = translation::translate('mainscreen_message',false,''); + } + if(!($greeting == 'mainscreen_message'|| empty($greeting))) + { + $content['mainscreen_message'] = $greeting; + } } /** @@ -367,7 +380,7 @@ class home_ui else { // Get portlet settings, and merge new with old - $context = $values+(array)$portlets[$portlet_id]; //array('class'=>$attributes['class']); + $context = $values+(array)$portlets[$portlet_id]; // Handle add IDs $classname =& $context['class']; diff --git a/home/js/app.js b/home/js/app.js index 7419c857d3..aa5c046ae8 100644 --- a/home/js/app.js +++ b/home/js/app.js @@ -156,7 +156,14 @@ app.classes.home = AppJS.extend( add: function(action, source) { // Put it in the last row, first column, since the mouse position is unknown var max_row = Math.max.apply(null,$j('div',this.portlet_container.div).map(function() {return $j(this).attr('data-row');})); - var attrs = {id: this._create_id(), row: max_row + 1, col: 1}; + + var attrs = {id: this._create_id(), row: 1, col: 1}; + if(action.menu_context) + { + var $portlet_container = $j(this.portlet_container.getDOMNode()); + attrs.row = Math.round((action.menu_context.posy - $portlet_container.offset().top )/ this.GRID)+1; + attrs.col = Math.max(1,Math.round((action.menu_context.posx - $portlet_container.offset().left) / this.GRID)+1); + } var portlet = et2_createWidget('portlet',attrs, this.portlet_container); // Override content ID so etemplate loads