Fix some bugs:

- Always use et2
- Prevent duplicate portlets
- Prevent duplicate links in link list
This commit is contained in:
Nathan Gray 2013-09-17 17:04:57 +00:00
parent f60e402eb0
commit 6f9ea1e859
3 changed files with 18 additions and 4 deletions

View File

@ -62,7 +62,19 @@ class home_list_portlet extends home_portlet
// Add a new entry to the list
if($context['add'])
{
$context['list'][] = $context['add'];
$ok_to_add = true;
foreach($context['list'] as $key => $entry)
{
if($entry == $context['add'])
{
$ok_to_add = false;
break;
}
}
if($ok_to_add)
{
$context['list'][] = $context['add'];
}
unset($context['add']);
}

View File

@ -37,7 +37,7 @@ class home_ui
// CSS for Gridster grid layout
egw_framework::includeCSS('/phpgwapi/js/jquery/gridster/jquery.gridster.css');
$template = new etemplate('home.index');
$template = new etemplate_new('home.index');
$content = array(
'portlets' => $this->get_user_portlets($template)
@ -101,7 +101,7 @@ class home_ui
* Actual portlet content is provided by each portlet.
* @param template etemplate so attributes can be set
*/
protected function get_user_portlets(etemplate &$template)
protected function get_user_portlets(etemplate_new &$template)
{
$portlets = array(
'Just a hard-coded test',

View File

@ -83,8 +83,10 @@ app.home = AppJS.extend(
// call parent
this._super.apply(this, arguments);
this.et2 = et2.widgetContainer;
this.portlet_container = this.et2.getWidgetById("portlets");
// Don't do twice
if(this.portlet_container._children.length > 0) return;
// Add portlets
var content = this.et2.getArrayMgr("content").getEntry("portlets");