From f5657e283ccbd30acbb345851661161338cb5826 Mon Sep 17 00:00:00 2001 From: Fabrixxm Date: Wed, 29 Jul 2015 11:55:26 +0200 Subject: [PATCH] fix folder links in filebrowser dialog --- js/filebrowser.js | 7 +++++++ mod/fbrowser.php | 8 ++++---- view/templates/filebrowser_plain.tpl | 4 ++-- view/templates/jot-header.tpl | 8 ++++---- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/js/filebrowser.js b/js/filebrowser.js index 8f7b78d197..c203151e14 100644 --- a/js/filebrowser.js +++ b/js/filebrowser.js @@ -67,6 +67,13 @@ var FileBrowser = { } console.log("FileBrowser:", nickname, type,FileBrowser.event, FileBrowser.id ); + + $(".folders a, .path a").on("click", function(e){ + e.preventDefault(); + var url = baseurl + "/fbrowser/" + FileBrowser.type + "/" + this.dataset.folder + "?mode=minimal" + location['hash']; + location.href = url; + }); + $(".photo-album-photo-link").on('click', function(e){ e.preventDefault(); diff --git a/mod/fbrowser.php b/mod/fbrowser.php index bf6842faf5..b2bda82879 100644 --- a/mod/fbrowser.php +++ b/mod/fbrowser.php @@ -29,7 +29,7 @@ function fbrowser_content($a){ switch($a->argv[1]){ case "image": - $path = array( array($a->get_baseurl()."/fbrowser/image/".$mode, t("Photos"))); + $path = array( array("", t("Photos"))); $albums = false; $sql_extra = ""; $sql_extra2 = " ORDER BY created DESC LIMIT 0, 10"; @@ -39,7 +39,7 @@ function fbrowser_content($a){ intval(local_user()) ); // anon functions only from 5.3.0... meglio tardi che mai.. - $folder1 = function($el) use ($mode) {return array(bin2hex($el['album']).$mode,$el['album']);}; + $folder1 = function($el) use ($mode) {return array(bin2hex($el['album']),$el['album']);}; $albums = array_map( $folder1 , $albums); } @@ -49,7 +49,7 @@ function fbrowser_content($a){ $album = hex2bin($a->argv[2]); $sql_extra = sprintf("AND `album` = '%s' ",dbesc($album)); $sql_extra2 = ""; - $path[]=array($a->get_baseurl()."/fbrowser/image/".$a->argv[2]."/".$mode, $album); + $path[]=array($a->argv[2], $album); } $r = q("SELECT `resource-id`, `id`, `filename`, type, min(`scale`) AS `hiq`,max(`scale`) AS `loq`, `desc` @@ -119,7 +119,7 @@ function fbrowser_content($a){ $o = replace_macros($tpl, array( '$type' => 'file', '$baseurl' => $a->get_baseurl(), - '$path' => array( array($a->get_baseurl()."/fbrowser/file/", t("Files")) ), + '$path' => array( array( "", t("Files")) ), '$folders' => false, '$files' =>$files, '$cancel' => t('Cancel'), diff --git a/view/templates/filebrowser_plain.tpl b/view/templates/filebrowser_plain.tpl index 9b70fbf852..7517ca632c 100644 --- a/view/templates/filebrowser_plain.tpl +++ b/view/templates/filebrowser_plain.tpl @@ -13,13 +13,13 @@
- {{foreach $path as $p}}{{$p.1}}{{/foreach}} + {{foreach $path as $p}}{{$p.1}}{{/foreach}}
{{if $folders }}
    - {{foreach $folders as $f}}
  • {{$f.1}}
  • {{/foreach}} + {{foreach $folders as $f}}
  • {{$f.1}}
  • {{/foreach}}
{{/if}} diff --git a/view/templates/jot-header.tpl b/view/templates/jot-header.tpl index c4934f10b6..8d009fd40c 100644 --- a/view/templates/jot-header.tpl +++ b/view/templates/jot-header.tpl @@ -142,21 +142,21 @@ function enableOnUser(){ **/ /* callback */ - $('body').on('fbrowser.image', function(e, filename, embedcode, id) { + $('body').on('fbrowser.image.main', function(e, filename, embedcode, id) { $.colorbox.close(); addeditortext(embedcode); }); - $('body').on('fbrowser.file', function(e, filename, embedcode, id) { + $('body').on('fbrowser.file.main', function(e, filename, embedcode, id) { $.colorbox.close(); addeditortext(embedcode); }); $('#wall-image-upload').on('click', function(){ - $.colorbox({href: baseurl + "/fbrowser/image/?mode=minimal", iframe:true,innerWidth:'500px',innerHeight:'400px'}) + $.colorbox({href: baseurl + "/fbrowser/image/?mode=minimal#main", iframe:true,innerWidth:'500px',innerHeight:'400px'}) }); $('#wall-file-upload').on('click', function(){ - $.colorbox({href: baseurl + "/fbrowser/file/?mode=minimal", iframe:true,innerWidth:'500px',innerHeight:'400px'}) + $.colorbox({href: baseurl + "/fbrowser/file/?mode=minimal#main", iframe:true,innerWidth:'500px',innerHeight:'400px'}) }); /** -- 2.39.5