forked from extern/egroupware
non-et2 Favorites work in progress
Handle states that are id_data objects for egw.open()
This commit is contained in:
parent
ac04ff9f6c
commit
72c37e0849
@ -1809,7 +1809,7 @@ $LAB.setOptions({AlwaysPreserveOrder:true,BasePath:"'.$GLOBALS['egw_info']['serv
|
|||||||
if(!$registry) $registry = egw_link::get_registry($app,'index');
|
if(!$registry) $registry = egw_link::get_registry($app,'index');
|
||||||
foreach($filters as $name => $filter)
|
foreach($filters as $name => $filter)
|
||||||
{
|
{
|
||||||
$href = "javascript:app.$app.setState(" . json_encode($filter) . ');';
|
$href = "javascript:app.$app.setState(" . json_encode($filter,JSON_FORCE_OBJECT) . ');';
|
||||||
$html .= "<li data-id='$name' class='ui-menu-item' role='menuitem'>\n";
|
$html .= "<li data-id='$name' class='ui-menu-item' role='menuitem'>\n";
|
||||||
$html .= "<a href='$href' class='ui-corner-all' tabindex='-1'>";
|
$html .= "<a href='$href' class='ui-corner-all' tabindex='-1'>";
|
||||||
$html .= "<div class='" . ($name == $default_filter ? 'ui-icon ui-icon-heart' : 'sideboxstar') . "'></div>".
|
$html .= "<div class='" . ($name == $default_filter ? 'ui-icon ui-icon-heart' : 'sideboxstar') . "'></div>".
|
||||||
|
@ -87,6 +87,11 @@ var AppJS = Class.extend(
|
|||||||
|
|
||||||
// Initialize sidebox - ID set server side
|
// Initialize sidebox - ID set server side
|
||||||
var sidebox = jQuery('#favorite_sidebox_'+this.appname);
|
var sidebox = jQuery('#favorite_sidebox_'+this.appname);
|
||||||
|
if(sidebox.length == 0 && egw_getFramework() != null)
|
||||||
|
{
|
||||||
|
var egw_fw = egw_getFramework();
|
||||||
|
sidebox= $j('#favorite_sidebox_'+this.appname,egw_fw.sidemenuDiv);
|
||||||
|
}
|
||||||
this._init_sidebox(sidebox);
|
this._init_sidebox(sidebox);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -193,7 +198,9 @@ var AppJS = Class.extend(
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param {{name: string, state: object}|string} state Object (or JSON string) for a state.
|
* @param {{name: string, state: object}|string} state Object (or JSON string) for a state.
|
||||||
* Only state is required, and its contents are application specific.
|
* Only state is required, and its contents are application specific.
|
||||||
|
*
|
||||||
|
* @return {boolean} false - Returns false to stop event propagation
|
||||||
*/
|
*/
|
||||||
setState: function(state)
|
setState: function(state)
|
||||||
{
|
{
|
||||||
@ -215,6 +222,12 @@ var AppJS = Class.extend(
|
|||||||
state = {};
|
state = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for egw.open() parameters
|
||||||
|
if(state.state && state.state.id && state.state.app)
|
||||||
|
{
|
||||||
|
return egw.open(state.state,undefined,undefined,{},'_self');
|
||||||
|
}
|
||||||
|
|
||||||
// Try and find a nextmatch widget, and set its filters
|
// Try and find a nextmatch widget, and set its filters
|
||||||
var nextmatched = false;
|
var nextmatched = false;
|
||||||
var et2 = etemplate2.getByApplication(this.appname);
|
var et2 = etemplate2.getByApplication(this.appname);
|
||||||
@ -226,15 +239,15 @@ var AppJS = Class.extend(
|
|||||||
_widget.applyFilters();
|
_widget.applyFilters();
|
||||||
nextmatched = true;
|
nextmatched = true;
|
||||||
}, this, et2_nextmatch);
|
}, this, et2_nextmatch);
|
||||||
|
if(nextmatched) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No nextmatch? Try a redirect to list
|
// Try a redirect to list
|
||||||
if(!nextmatched && state.name)
|
// 'blank' is the special name for no filters, send that instead of the nice translated name
|
||||||
{
|
var safe_name = jQuery.isEmptyObject(state) || jQuery.isEmptyObject(state.state||state.filter) ? 'blank' : state.name.replace(/[^A-Za-z0-9-_]/g, '_');
|
||||||
// 'blank' is the special name for no filters, send that instead of the nice translated name
|
egw.open('',this.appname,'list',{'favorite': safe_name},this.appname);
|
||||||
var safe_name = jQuery.isEmptyObject(state) || jQuery.isEmptyObject(state.state||state.filter) ? 'blank' : state.name.replace(/[^A-Za-z0-9-_]/g, '_');
|
|
||||||
egw.open('',this.appname,'list',{'favorite': safe_name},this.appname);
|
return false
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -144,6 +144,10 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd) {
|
|||||||
{
|
{
|
||||||
app = id_data.app;
|
app = id_data.app;
|
||||||
id = id_data.id;
|
id = id_data.id;
|
||||||
|
if(typeof id_data.type != 'undefined')
|
||||||
|
{
|
||||||
|
type = id_data.type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (app != 'file')
|
else if (app != 'file')
|
||||||
|
Loading…
Reference in New Issue
Block a user