plugins/gallery/browser.php
changeset 39 e9a7e37bdadd
parent 38 512951548faa
child 42 7c6e2e97aa08
equal deleted inserted replaced
38:512951548faa 39:e9a7e37bdadd
    14 
    14 
    15 ##
    15 ##
    16 ## BROWSER INTERFACE
    16 ## BROWSER INTERFACE
    17 ##
    17 ##
    18 
    18 
    19 $plugins->attachHook('base_classes_initted', '
    19 $plugins->attachHook('session_started', 'register_special_page("Gallery", "Image gallery");');
    20   global $paths;
       
    21     $paths->add_page(Array(
       
    22       \'name\'=>\'Image gallery\',
       
    23       \'urlname\'=>\'Gallery\',
       
    24       \'namespace\'=>\'Special\',
       
    25       \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
       
    26       ));
       
    27   ');
       
    28 
    20 
    29 /**
    21 /**
    30  * Class to handle building the HTML for gallery pages. Called by the pagination function.
    22  * Class to handle building the HTML for gallery pages. Called by the pagination function.
    31  * @package Enano
    23  * @package Enano
    32  * @subpackage Snapr
    24  * @subpackage Snapr
   279     
   271     
   280     $template->tpl_strings['PAGE_NAME'] = $title;
   272     $template->tpl_strings['PAGE_NAME'] = $title;
   281     
   273     
   282     $first_row = $row;
   274     $first_row = $row;
   283     
   275     
   284     $db->sql_data_seek(0, $img_query);
   276     if ( $db->numrows($img_query) > 0 )
       
   277       $db->sql_data_seek(0, $img_query);
   285     
   278     
   286     /* $folders = $folders_old; */
   279     /* $folders = $folders_old; */
   287   }
   280   }
   288   else if ( !empty($parms) )
   281   else if ( !empty($parms) )
   289   {
   282   {
   428             <a href="' . $url_sort_mod_asc   . '">Date of last modification (oldest first)</a>
   421             <a href="' . $url_sort_mod_asc   . '">Date of last modification (oldest first)</a>
   429           </div>
   422           </div>
   430         </div>
   423         </div>
   431         <div class="select-pad">&nbsp;</div>';
   424         <div class="select-pad">&nbsp;</div>';
   432   
   425   
   433   $db->sql_data_seek(0, $img_query);
   426   if ( $db->numrows($img_query) > 0 )
       
   427 	$db->sql_data_seek(0, $img_query);
   434   
   428   
   435   //
   429   //
   436   // Main fetcher
   430   // Main fetcher
   437   //
   431   //
   438   
   432   
   450   }
   444   }
   451   
   445   
   452   $per_page = 25;
   446   $per_page = 25;
   453   
   447   
   454   $html = paginate($img_query, '{img_id}', $db->numrows($img_query), makeUrl($paths->fullpage, 'sort=' . $sort_column . '&order=' . $sort_order . '&start=%s', false), $start, $per_page, $callers, '<ul class="snapr-gallery">', '</ul><span class="menuclear"></span>');
   448   $html = paginate($img_query, '{img_id}', $db->numrows($img_query), makeUrl($paths->fullpage, 'sort=' . $sort_column . '&order=' . $sort_order . '&start=%s', false), $start, $per_page, $callers, '<ul class="snapr-gallery">', '</ul><span class="menuclear"></span>');
   455   echo $html;
   449   if ( empty($html) )
       
   450   {
       
   451   	  echo '<h2 class="emptymessage">No images</h2>';
       
   452   }
       
   453   else
       
   454   {
       
   455 	  echo $html;
       
   456   }
   456   
   457   
   457   if ( $session->user_level >= USER_LEVEL_ADMIN )
   458   if ( $session->user_level >= USER_LEVEL_ADMIN )
   458   {
   459   {
   459     echo '<div class="select-outer">Create new folder';
   460     echo '<div class="select-outer">Create new folder';
   460     echo '<div class="select-inner" style="padding-top: 4px;">';
   461     echo '<div class="select-inner" style="padding-top: 4px;">';