[geeklog-cvs] geeklog-1.3/public_html/admin link.php,1.36,1.37

dhaun at geeklog.net dhaun at geeklog.net
Sun Nov 30 14:45:41 EST 2003


Update of /usr/cvs/geeklog/geeklog-1.3/public_html/admin
In directory geeklog_prod:/tmp/cvs-serv25720

Modified Files:
	link.php 
Log Message:
Changed the link list to use paging (bug #104) and fixed redirect after saving (introduced in the last revision of this file).


Index: link.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/admin/link.php,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** link.php	12 Sep 2003 11:53:41 -0000	1.36
--- link.php	30 Nov 2003 19:45:39 -0000	1.37
***************
*** 256,260 ****
          COM_rdfUpToDateCheck ();
  
!         return $_CONF['site_admin_url'] . '/link.php?msg=15';
  	} else {
  		$retval .= COM_siteHeader('menu');
--- 256,260 ----
          COM_rdfUpToDateCheck ();
  
!         return COM_refresh ($_CONF['site_admin_url'] . '/link.php?msg=15');
  	} else {
  		$retval .= COM_siteHeader('menu');
***************
*** 274,278 ****
  *
  */
! function listlinks() 
  {
      global $_CONF, $_TABLES, $LANG23, $LANG_ACCESS;
--- 274,278 ----
  *
  */
! function listlinks($page = 1) 
  {
      global $_CONF, $_TABLES, $LANG23, $LANG_ACCESS;
***************
*** 280,283 ****
--- 280,287 ----
      $retval = '';
  
+     if ($page <= 0) {
+         $page = 1;
+     }
+ 
      $retval .= COM_startBlock ($LANG23[11], '',
                                 COM_getBlockTemplate ('_admin_block', 'header'));
***************
*** 296,302 ****
      $link_templates->set_var('lang_linkurl', $LANG23[15]); 
  
! 	$result = DB_query("SELECT * FROM {$_TABLES['links']} ORDER BY category ASC,title");
  	$nrows = DB_numRows($result);
  	for ($i = 0; $i < $nrows; $i++) {
  		$A = DB_fetchArray($result);
  		$access = SEC_hasAccess($A['owner_id'],$A['group_id'],$A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']);
--- 300,308 ----
      $link_templates->set_var('lang_linkurl', $LANG23[15]); 
  
!     $limit = (50 * $page) - 50;
! 	$result = DB_query("SELECT * FROM {$_TABLES['links']}" . COM_getPermSQL () . " ORDER BY category ASC,title LIMIT $limit,50");
  	$nrows = DB_numRows($result);
  	for ($i = 0; $i < $nrows; $i++) {
+         $lcount = (50 * $page) - 50 + ($i + 1);
  		$A = DB_fetchArray($result);
  		$access = SEC_hasAccess($A['owner_id'],$A['group_id'],$A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']);
***************
*** 312,318 ****
--- 318,336 ----
              $link_templates->set_var('link_category', $A['category']);
              $link_templates->set_var('link_url', $A['url']);
+             $link_templates->set_var('row_num', $lcount);
              $link_templates->parse('link_row', 'row', true);
          }
  	}
+     $nresult = DB_query ("SELECT COUNT(*) AS count FROM {$_TABLES['links']}" . COM_getPermSQL ());
+     $N = DB_fetchArray ($nresult);
+     $numlinks = $N['count'];
+     if ($numlinks > 50) {
+         $baseurl = $_CONF['site_admin_url'] . '/link.php';
+         $numpages = ceil ($numlinks / 50);
+         $link_templates->set_var ('google_paging',
+                 COM_printPageNavigation ($baseurl, $page, $numpages));
+     } else {
+         $link_templates->set_var ('google_paging', '');
+     }
      $link_templates->parse('output','list');
      $retval .= $link_templates->finish($link_templates->get_var('output'));
***************
*** 349,353 ****
          $display .= COM_showMessage($msg);
      }
!     $display .= listlinks();
      $display .= COM_siteFooter();
  }
--- 367,371 ----
          $display .= COM_showMessage($msg);
      }
!     $display .= listlinks(COM_applyFilter($HTTP_GET_VARS['page'], true));
      $display .= COM_siteFooter();
  }





More information about the geeklog-cvs mailing list