]> git.mjollnir.org Git - s9y.git/commitdiff
progress on gallery
authorPenny Leach <mjollnir@titania.local>
Tue, 13 Jun 2006 09:54:21 +0000 (21:54 +1200)
committerPenny Leach <penny@catalyst.net.nz>
Tue, 8 Apr 2008 00:00:26 +0000 (12:00 +1200)
plugins/serendipity_plugin_gallery/lib.php
plugins/serendipity_plugin_gallery/serendipity_plugin_gallery.php

index 76d269363b3ab3ba322d2a9c25e76dcc09bbd29e..e05d799790d3b5d64688c2dc0d97fc8fd4631b5c 100644 (file)
@@ -16,30 +16,19 @@ function make_tree($start,$indent,$show,$expand,$expanded) {
 
 
     foreach ($children as $path => $name) {
-        echo '<img src="'.$spacer.'" height="1" width="'.$indent.'" />';
         if ($expanded[$path] == 1) {
-            echo '<a href="'.$serendipity['baseURL'].'gallery/collapse'.$path.'"><img src="'.$minus.'" alt="expand" /></a>&nbsp;'."\n";
-            if ($show != $path) {
-                echo '<a href="'.$serendipity['baseURL'].'gallery/show'.$path.'">'.stripslashes($name).'</a><br />'."\n"; 
-            }
-            else {
-                echo '<span class="selected">'.stripslashes($name).'</span><br />'."\n";
-            }
+            echo '<span class="gallery_minus" style="padding-left:'.$indent.'px;"><a href="'.$serendipity['baseURL'].'gallery/collapse'.$path.'">[-]</a></span>'."\n";
+            echo '<a href="'.$serendipity['baseURL'].'gallery/show'.$path.'">'.stripslashes($name).'</a><br />'."\n"; 
             make_tree($path,$indent+10,$show,$expand,$expanded);
         }
         else {
             if (has_children($path)) {
-                echo '<a href="'.$serendipity['baseURL'].'gallery/expand'.$path.'"><img src="'.$plus.'" alt="expand" /></a>&nbsp;'."\n";
-            }
-            else {
-                echo '<img src="'.$plusGrey.'" alt="No children" />&nbsp;'."\n";
-            }
-            if ($show != $path) {
-                echo '<a href="'.$serendipity['baseURL'].'gallery/show'.$path.'">'.stripslashes($name).'</a><br />'."\n";
+                echo '<span class="gallery_plus" style="padding-left:'.$indent.'px;"><a href="'.$serendipity['baseURL'].'gallery/expand'.$path.'">[+]</a></span>'."\n";
             }
             else {
-                echo '<span class="selected">'.stripslashes($name).'</span><br />'."\n";
+                echo '<span class="gallery_plus_grey" style="padding-left:'.$indent.'px;">[+]</span>&nbsp;'."\n";
             }
+            echo '<a href="'.$serendipity['baseURL'].'gallery/show'.$path.'">'.stripslashes($name).'</a><br />'."\n";
         }
     }
 }
@@ -86,7 +75,7 @@ function make_search($query) {
 function make_directory($show) {
     global $serendipity;
     $content .='<div style="padding-left:20px">';
-    $content .='<p><b>showing images in: '.get_heading($show).':</b></p>';
+    $content .='<p>showing images in: '.get_heading($show).':</p>';
     if (file_exists(SGN_DIR_ROOT.$show.'/summary.inc')) {
         $content .='<p>&raquo;&raquo;&nbsp;';
         $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 .='<td><a href="'.$serendipity['baseURL'].'gallery/view.php?f='.$show.'/'.$file.'"><img src="'.SGN_WEB_ROOT.$thumb.'" alt="'.$caption.'" /></a></td>';
-            if ($count == 3) {
+            if ($count == 3 && $count != count($files)) {
                 $content .='</tr><tr>';
                 $count = 1;
             }
@@ -120,7 +109,7 @@ function make_directory($show) {
         $content .='</tr></table>';
     }
     $content .='<div style="padding-left:20px">';
-    $content .='<p><b>subdirectories:</b></p>';
+    $content .='<p>subdirectories:</p>';
 
     $children = get_children($show);
 
index 917bbb9d214104e1948732dba1b115132534e043..4dfb9bc62add19ad1e9bff4402682445992e0e8d 100644 (file)
@@ -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);
     }