mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-24 23:58:54 +01:00
non-et2 Favorites work in progress
Can now save & restore state. Still some UI needed, not fully integrated with et2 favorites.
This commit is contained in:
parent
343a72c3a8
commit
79498c5ae5
@ -518,8 +518,16 @@ app.classes.calendar = AppJS.extend(
|
||||
*/
|
||||
setState: function(state)
|
||||
{
|
||||
// State should be an object, not a string, but we'll parse
|
||||
if(typeof state == "string")
|
||||
{
|
||||
if(state.indexOf('{') != -1 || state =='null')
|
||||
{
|
||||
state = JSON.parse(state);
|
||||
}
|
||||
}
|
||||
// requested state is a listview and we are currently in a list-view
|
||||
if (state.view == 'listview' && view.name && this.et2 && this.et2.getWidgetById('nm'))
|
||||
if (state.state.view == 'listview' && state.name && this.et2 && this.et2.getWidgetById('nm'))
|
||||
{
|
||||
return this._super.apply(this, arguments); // call default implementation
|
||||
}
|
||||
@ -528,7 +536,7 @@ app.classes.calendar = AppJS.extend(
|
||||
var menuaction = 'calendar.calendar_uiviews.index';
|
||||
if (typeof state.view == 'undefined' || state.view == 'listview')
|
||||
{
|
||||
menuaction = 'calendar.calendar_uilist.index';
|
||||
menuaction = 'calendar.calendar_uilist.listview';
|
||||
if (state.name)
|
||||
{
|
||||
state = {favorite: state.name.replace(/[^A-Za-z0-9-_]/g, '_')};
|
||||
|
@ -1808,7 +1808,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['filter']) . ');';
|
||||
$href = "javascript:app.$app.setState(" . json_encode($filter) . ');';
|
||||
$html .= "<li 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>".
|
||||
|
@ -188,11 +188,13 @@ var AppJS = Class.extend(
|
||||
* The default implementation works with the favorites to apply filters to a nextmatch.
|
||||
*
|
||||
*
|
||||
* @param {object} state description
|
||||
* @param {{name: string, state: object}|string} state Object (or JSON string) for a state.
|
||||
* Only state is required, and its contents are application specific.
|
||||
* @param {type} name description
|
||||
*/
|
||||
setState: function(state)
|
||||
{
|
||||
// State should be an object, not a string, but we'll try
|
||||
// State should be an object, not a string, but we'll parse
|
||||
if(typeof state == "string")
|
||||
{
|
||||
if(state.indexOf('{') != -1 || state =='null')
|
||||
@ -383,13 +385,12 @@ var AppJS = Class.extend(
|
||||
// Add to the list
|
||||
name.val(name.val().replace(/(<([^>]+)>)/ig,""));
|
||||
var safe_name = name.val().replace(/[^A-Za-z0-9-_]/g,"_");
|
||||
self.stored_filters[safe_name] = {
|
||||
var favorite = {
|
||||
name: name.val(),
|
||||
group: (typeof self.favorite_popup.group != "undefined" &&
|
||||
self.favorite_popup.group.get_value() ? self.favorite_popup.group.get_value() : false),
|
||||
state: self.favorite_popup.state
|
||||
};
|
||||
self.init_filters(self);
|
||||
|
||||
var favorite_pref = favorite_prefix+safe_name;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user