mirror of
https://github.com/friendica/friendica
synced 2024-12-23 03:20:15 +00:00
Ensure theme consistency when using filebrowser
- Send frio filebrowser result to current frame instead of parent one
This commit is contained in:
parent
611220cb53
commit
a88df9b259
3 changed files with 14 additions and 13 deletions
|
@ -11,6 +11,7 @@ use Friendica\Core\Renderer;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
/**
|
||||
* @param App $a
|
||||
|
@ -27,6 +28,12 @@ function fbrowser_content(App $a)
|
|||
exit();
|
||||
}
|
||||
|
||||
// Needed to match the correct template in a module that uses a different theme than the user/site/default
|
||||
$theme = Strings::sanitizeFilePathItem(defaults($_GET, 'theme', null));
|
||||
if ($theme && is_file("view/theme/$theme/config.php")) {
|
||||
$a->setCurrentTheme($theme);
|
||||
}
|
||||
|
||||
$template_file = "filebrowser.tpl";
|
||||
|
||||
$o = '';
|
||||
|
|
|
@ -99,7 +99,7 @@ var FileBrowser = {
|
|||
// Click on album link
|
||||
$(".fbrowser").on("click", ".folders a, .path a", function(e) {
|
||||
e.preventDefault();
|
||||
var url = baseurl + "/fbrowser/" + FileBrowser.type + "/" + this.dataset.folder + "?mode=none";
|
||||
var url = baseurl + "/fbrowser/" + FileBrowser.type + "/" + this.dataset.folder + "?mode=none&theme=frio";
|
||||
FileBrowser.folder = this.dataset.folder;
|
||||
|
||||
FileBrowser.loadContent(url);
|
||||
|
@ -134,7 +134,7 @@ var FileBrowser = {
|
|||
|
||||
console.log(FileBrowser.event, this.dataset.filename, embed, FileBrowser.id);
|
||||
|
||||
parent.$("body").trigger(FileBrowser.event, [
|
||||
$("body").trigger(FileBrowser.event, [
|
||||
this.dataset.filename,
|
||||
embed,
|
||||
FileBrowser.id,
|
||||
|
@ -152,7 +152,7 @@ var FileBrowser = {
|
|||
e.preventDefault();
|
||||
FileBrowser.type = this.getAttribute("data-mode");
|
||||
$(".fbrowser").removeClass().addClass("fbrowser " + FileBrowser.type);
|
||||
url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=none";
|
||||
url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=none&theme=frio";
|
||||
|
||||
FileBrowser.loadContent(url);
|
||||
});
|
||||
|
@ -183,10 +183,7 @@ var FileBrowser = {
|
|||
return;
|
||||
}
|
||||
|
||||
// location = baseurl + "/fbrowser/image/?mode=none"+location['hash'];
|
||||
// location.reload(true);
|
||||
|
||||
var url = baseurl + "/fbrowser/" + FileBrowser.type + "/" + FileBrowser.folder + "?mode=none";
|
||||
var url = baseurl + "/fbrowser/" + FileBrowser.type + "/" + FileBrowser.folder + "?mode=none&theme=frio";
|
||||
// load new content to fbrowser window
|
||||
FileBrowser.loadContent(url);
|
||||
}
|
||||
|
@ -214,10 +211,7 @@ var FileBrowser = {
|
|||
return;
|
||||
}
|
||||
|
||||
// location = baseurl + "/fbrowser/file/?mode=none"+location['hash'];
|
||||
// location.reload(true);
|
||||
|
||||
var url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=none";
|
||||
var url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=none&theme=frio";
|
||||
// Load new content to fbrowser window
|
||||
FileBrowser.loadContent(url);
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ Dialog.show = function(url, title) {
|
|||
Dialog._get_url = function(type, name, id) {
|
||||
var hash = name;
|
||||
if (id !== undefined) hash = hash + "-" + id;
|
||||
return "fbrowser/"+type+"/?mode=none#"+hash;
|
||||
return "fbrowser/"+type+"/?mode=none&theme=frio#"+hash;
|
||||
};
|
||||
|
||||
// Does load the filebrowser into the jot modal.
|
||||
|
@ -148,7 +148,7 @@ Dialog._load = function(url) {
|
|||
var type = $("#fb-type").attr("value");
|
||||
|
||||
// Try to fetch the hash form the url.
|
||||
var match = url.match(/fbrowser\/[a-z]+\/\?mode=none(.*)/);
|
||||
var match = url.match(/fbrowser\/[a-z]+\/.*(#.*)/);
|
||||
if (match===null) return; //not fbrowser
|
||||
var hash = match[1];
|
||||
|
||||
|
|
Loading…
Reference in a new issue