A few minor bugfixes and visual enhancements for admins
authorDan
Wed, 25 Jul 2007 20:25:02 -0400
changeset 4 ad3b061a1c76
parent 3 10d663f5ed88
child 5 c0c324f0eeb5
A few minor bugfixes and visual enhancements for admins
plugins/gallery/browser.php
plugins/gallery/search.php
--- a/plugins/gallery/browser.php	Wed Jul 25 18:25:24 2007 -0400
+++ b/plugins/gallery/browser.php	Wed Jul 25 20:25:02 2007 -0400
@@ -86,6 +86,11 @@
       $image_url  = makeUrlNS('Special', 'GalleryFetcher/thumb/' . $row['img_id']);
     }
     
+    if ( isset($row['score']) )
+    {
+      $row['score'] = number_format($row['score'], 2);
+    }
+    
     $image_url_js = addslashes($image_link);
     $jsclick = ( $session->user_level < USER_LEVEL_ADMIN ) ? ' onclick="window.location=\'' . $image_url_js . '\'"' : '';
     
@@ -96,11 +101,11 @@
     
     if ( $session->user_level < USER_LEVEL_ADMIN )
     {
-      $out .= $title_safe;
+      $out .= $title_safe . ( isset($row['score']) ? "<br /><small>Relevance: {$row['score']}</small>" : '' );
     }
     else if ( $session->user_level >= USER_LEVEL_ADMIN )
     {
-      $out .= '<div class="menu_nojs" style="text-align: center;"><a href="#" onclick="return false;" style="margin: 0 auto;">' . $title_safe . '</a>';
+      $out .= '<div class="menu_nojs" style="text-align: center;"><a href="#" onclick="return false;" style="width: 74px;">' . $title_safe . ( isset($row['score']) ? "<br /><small>Relevance: {$row['score']}</small>" : '' ) . '</a>';
       
       $url_delete = makeUrlNS('Special', 'GalleryUpload', 'rm=' . $row['img_id'], true);
       $url_edit   = makeUrlNS('Special', 'GalleryUpload', 'edit_img=' . $row['img_id'], true);
--- a/plugins/gallery/search.php	Wed Jul 25 18:25:24 2007 -0400
+++ b/plugins/gallery/search.php	Wed Jul 25 20:25:02 2007 -0400
@@ -29,10 +29,10 @@
   global $db, $session, $paths, $template, $plugins; // Common objects
   
   $fulltext_col = 'MATCH(img_title, img_desc) AGAINST (\'' . $db->escape($q) . '\' IN BOOLEAN MODE)';
-  $sql = "SELECT img_id, img_title, img_desc, $fulltext_col AS score, CHAR_LENGTH(img_desc) AS length FROM ".table_prefix."gallery
+  $sql = "SELECT img_id, img_title, img_desc, is_folder, $fulltext_col AS score, CHAR_LENGTH(img_desc) AS length FROM ".table_prefix."gallery
               WHERE $fulltext_col > 0
-                AND is_folder=0
-              ORDER BY score DESC;";
+                AND ( ( is_folder=1 AND folder_parent IS NULL ) OR is_folder!=1 )
+              ORDER BY is_folder DESC, score DESC, img_title ASC;";
   if ( !$db->sql_unbuffered_query($sql) )
   {
     echo $db->get_error();
@@ -43,11 +43,14 @@
   {
     echo '<table border="0" cellspacing="8"><tr>';
     $renderer = new SnaprFormatter();
+    $fullpage = $paths->fullpage;
+    $paths->fullpage = $paths->nslist['Special'] . 'Gallery';
     do
     {
       echo $renderer->render(false, $row, false);
     }
     while ( $row = $db->fetchrow() );
+    $paths->fullpage = $fullpage;
     echo '</tr></table>';
   }
   else