mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
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');
|
||||
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 .= "<a href='$href' class='ui-corner-all' tabindex='-1'>";
|
||||
$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
|
||||
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);
|
||||
},
|
||||
|
||||
@ -193,7 +198,9 @@ var AppJS = Class.extend(
|
||||
*
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
@ -215,6 +222,12 @@ var AppJS = Class.extend(
|
||||
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
|
||||
var nextmatched = false;
|
||||
var et2 = etemplate2.getByApplication(this.appname);
|
||||
@ -226,15 +239,15 @@ var AppJS = Class.extend(
|
||||
_widget.applyFilters();
|
||||
nextmatched = true;
|
||||
}, this, et2_nextmatch);
|
||||
if(nextmatched) return false;
|
||||
}
|
||||
|
||||
// No nextmatch? 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, '_');
|
||||
egw.open('',this.appname,'list',{'favorite': safe_name},this.appname);
|
||||
}
|
||||
// Try a redirect to list
|
||||
// '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, '_');
|
||||
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;
|
||||
id = id_data.id;
|
||||
if(typeof id_data.type != 'undefined')
|
||||
{
|
||||
type = id_data.type;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (app != 'file')
|
||||
|
Loading…
Reference in New Issue
Block a user