fix clicking on favorite in filemanager does not work when showing shared files (or any other view then current index-url), thought setting of favorite still fails

r51522: Update favorite GET fallback to use new style of favorite
This commit is contained in:
Ralf Becker 2015-02-02 17:28:54 +00:00
parent bb8920aa3c
commit 1177acd3d3
5 changed files with 33 additions and 18 deletions

View File

@ -140,16 +140,21 @@ class etemplate_widget_nextmatch extends etemplate_widget
}
unset($send_value['col_filter']);
}
// Old type
if($favorite && $favorite['filter'])
{
$send_value = array_merge($value, $favorite['filter']);
$favorite['state'] = $favorite['filter'];
}
if($favorite && $favorite['state'])
{
$send_value = array_merge($value, $favorite['state']);
// Ajax call can handle the saved sort here, but this can't
if($favorite['filter']['sort'])
if($favorite['state']['sort'])
{
unset($send_value['sort']);
$send_value['order'] = $favorite['filter']['sort']['id'];
$send_value['sort'] = $favorite['filter']['sort']['asc'] ? 'ASC' : 'DESC';
$send_value['order'] = $favorite['state']['sort']['id'];
$send_value['sort'] = $favorite['state']['sort']['asc'] ? 'ASC' : 'DESC';
}
}
}

View File

@ -141,7 +141,7 @@ var et2_textbox = et2_inputWidget.extend([et2_IResizeable],
getValue: function()
{
if(this.options.blur && this.input.val() == this.options.blur) return "";
if(this.options && this.options.blur && this.input.val() == this.options.blur) return "";
return this._super.apply(this, arguments);
},

View File

@ -195,7 +195,7 @@ var et2_vfsName = et2_textbox.extend(
this._super.apply(this,[_value]);
},
getValue: function() {
return egw.encodePath(this._super.apply(this));
return egw.encodePath(this._super.apply(this)||'');
}
});
et2_register_widget(et2_vfsName, ["vfs-name"]);
@ -334,7 +334,7 @@ var et2_vfsMime = expose(et2_valueWidget.extend([et2_IDetachedDOM],
type: _value.mime,
poster:'', // TODO: Should be changed by correct video thumbnail later
thumbnail:this.egw().mime_icon(_value['mime'], _value['path']) ,
href: base_url + _value.download_url,
href: base_url + _value.download_url
}];
}
else

View File

@ -123,7 +123,7 @@ app.classes.filemanager = AppJS.extend(
state = JSON.parse(state);
}
}
var result = this._super.call(this,state);
var result = this._super.call(this, state, 'filemanager.index');
// This has to happen after the parent, changing to tile recreates
// nm controller

View File

@ -248,10 +248,10 @@ 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.
*
* @param {string} template template name to check, instead of trying all templates of current app
* @return {boolean} false - Returns false to stop event propagation
*/
setState: function(state)
setState: function(state, template)
{
// State should be an object, not a string, but we'll parse
if(typeof state == "string")
@ -279,7 +279,7 @@ var AppJS = Class.extend(
// Try and find a nextmatch widget, and set its filters
var nextmatched = false;
var et2 = etemplate2.getByApplication(this.appname);
var et2 = template ? etemplate2.getByTemplate(template) : etemplate2.getByApplication(this.appname);
for(var i = 0; i < et2.length; i++)
{
et2[i].widgetContainer.iterateOver(function(_widget) {
@ -297,11 +297,21 @@ var AppJS = Class.extend(
if(nextmatched) return false;
}
// 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);
var url = '/'+this.appname+'/index.php';
// Try a redirect to list, if app defines a "list" value in registry
if (egw.link_get_registry(this.appname, 'list'))
{
url = egw.link('/index.php', jQuery.extend({'favorite': safe_name}, egw.link_get_registry(this.appname, 'list')));
}
// if no list try index value from application
else if (egw.app(this.appname).index)
{
url = egw.link('/index.php', 'menuaction='+egw.app(this.appname).index+'&favorite='+safe_name);
}
egw.open_link(url, undefined, undefined, this.appname);
return false;
},
@ -705,9 +715,9 @@ var AppJS = Class.extend(
return false;
},
/**
* Fix scrolling iframe browsed by iPhone/iPod/iPad touch devices
* Fix scrolling iframe browsed by iPhone/iPod/iPad touch devices
*/
_fix_iFrameScrolling: function()
{
@ -732,7 +742,7 @@ var AppJS = Class.extend(
});
}
},
/**
* Set document title, uses getWindowTitle to get the correct title,
* otherwise set it with uniqueID as default title
@ -745,11 +755,11 @@ var AppJS = Class.extend(
document.title = this.et2._inst.uniqueId + ": " + title;
}
},
/**
* Window title getter function in order to set the window title
* this can be overridden on each application app.js file to customize the title value
*
*
* @returns {string} window title
*/
getWindowTitle: function ()