From b03bff1b08d2e8d2ab580ad0e3f71a6d2a72d2b2 Mon Sep 17 00:00:00 2001 From: Penny Leach Date: Tue, 13 Jun 2006 21:54:21 +1200 Subject: [PATCH] progress on gallery --- plugins/serendipity_plugin_gallery/lib.php | 27 ++++--------- .../serendipity_plugin_gallery.php | 40 ++++++++++++++++--- 2 files changed, 42 insertions(+), 25 deletions(-) diff --git a/plugins/serendipity_plugin_gallery/lib.php b/plugins/serendipity_plugin_gallery/lib.php index 76d2693..e05d799 100644 --- a/plugins/serendipity_plugin_gallery/lib.php +++ b/plugins/serendipity_plugin_gallery/lib.php @@ -16,30 +16,19 @@ function make_tree($start,$indent,$show,$expand,$expanded) { foreach ($children as $path => $name) { - echo ''; if ($expanded[$path] == 1) { - echo 'expand '."\n"; - if ($show != $path) { - echo ''.stripslashes($name).'
'."\n"; - } - else { - echo ''.stripslashes($name).'
'."\n"; - } + echo '[-]'."\n"; + echo ''.stripslashes($name).'
'."\n"; make_tree($path,$indent+10,$show,$expand,$expanded); } else { if (has_children($path)) { - echo 'expand '."\n"; - } - else { - echo 'No children '."\n"; - } - if ($show != $path) { - echo ''.stripslashes($name).'
'."\n"; + echo '[+]'."\n"; } else { - echo ''.stripslashes($name).'
'."\n"; + echo '[+] '."\n"; } + echo ''.stripslashes($name).'
'."\n"; } } } @@ -86,7 +75,7 @@ function make_search($query) { function make_directory($show) { global $serendipity; $content .='
'; - $content .='

showing images in: '.get_heading($show).':

'; + $content .='

showing images in: '.get_heading($show).':

'; if (file_exists(SGN_DIR_ROOT.$show.'/summary.inc')) { $content .='

»» '; $content .= implode('',file(SGN_DIR_ROOT.$show.'/summary.inc')); @@ -109,7 +98,7 @@ function make_directory($show) { $caption = implode('',file(SGN_DIR_ROOT.$show.str_replace($f[count($f)-1],'inc',$file))); } $content .=''.$caption.''; - if ($count == 3) { + if ($count == 3 && $count != count($files)) { $content .=''; $count = 1; } @@ -120,7 +109,7 @@ function make_directory($show) { $content .=''; } $content .='

'; - $content .='

subdirectories:

'; + $content .='

subdirectories:

'; $children = get_children($show); diff --git a/plugins/serendipity_plugin_gallery/serendipity_plugin_gallery.php b/plugins/serendipity_plugin_gallery/serendipity_plugin_gallery.php index 917bbb9..4dfb9bc 100644 --- a/plugins/serendipity_plugin_gallery/serendipity_plugin_gallery.php +++ b/plugins/serendipity_plugin_gallery/serendipity_plugin_gallery.php @@ -40,17 +40,47 @@ class serendipity_plugin_gallery extends serendipity_plugin global $serendipity; $title = $this->title; + // parse the url + + $requestpath = $_SERVER['REQUEST_URI']; + $bits = explode('/',$requestpath); + + $action = ''; + $path = ''; + + foreach ($bits as $i => $b) { + if (empty($b)) { + continue; + } + if ($b == 'gallery') { + $actionnext = true; + continue; + } + if (!empty($actionnext)) { + $action = $b; + $actionnext = false; + $finished = true; + continue; + } + if (!empty($finished)) { + $path .= '/'.$b; + } + } - $show = $_GET['show']; - if (!isset($show)) { + if ($action == 'show') { + $show = $path; + } else { $show = (isset($_SESSION['show'])) ? $_SESSION['show'] : ''; } $_SESSION['show'] = $show; - $expand = $_GET['expand']; - if (!isset($_GET['expand'])) { + + if ($action == 'expand') { + $expand = $path; + } else { $expand =(isset($_SESSION['expand'])) ? $_SESSION['expand'] : ''; } $_SESSION['expand'] = $expand; + $expanded = $_SESSION['expanded']; if (!isset($expanded)) { $expanded = array(); @@ -61,8 +91,6 @@ class serendipity_plugin_gallery extends serendipity_plugin $expanded[$collapse] = 0; } $_SESSION['expanded'] = $expanded; - $op = $_GET['op']; - make_tree('/',1,$show,$expand,$expanded); } -- 2.39.5