[geeklog-cvs] geeklog-1.3/plugins/staticpages config.php,1.7,1.8 functions.inc,1.35,1.36
dhaun at iowaoutdoors.org
dhaun at iowaoutdoors.org
Sat Jul 24 09:19:55 EDT 2004
Update of /var/cvs/geeklog-1.3/plugins/staticpages
In directory www:/tmp/cvs-serv6015/plugins/staticpages
Modified Files:
config.php functions.inc
Log Message:
Added an option to sort the static pages added to the site's menu by id, label, title, or date.
Index: functions.inc
===================================================================
RCS file: /var/cvs/geeklog-1.3/plugins/staticpages/functions.inc,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** functions.inc 11 Jul 2004 18:18:06 -0000 1.35
--- functions.inc 24 Jul 2004 13:19:53 -0000 1.36
***************
*** 61,75 ****
function plugin_getmenuitems_staticpages()
{
! global $_CONF, $_TABLES;
! $result = DB_query ('SELECT sp_id, sp_label, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon FROM ' . $_TABLES['staticpage'] . ' WHERE sp_onmenu = 1');
$nrows = DB_numRows ($result);
$menuitems = array ();
! for ($i = 1; $i <= $nrows; $i++) {
$A = DB_fetchArray ($result);
if (SEC_hasAccess ($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon'])) {
! $menuitems[$A['sp_label']] = COM_buildURL ($_CONF['site_url'] . "/staticpages/index.php?page={$A['sp_id']}");
}
}
return $menuitems;
}
--- 61,90 ----
function plugin_getmenuitems_staticpages()
{
! global $_CONF, $_TABLES, $_SP_CONF;
! $order = '';
! if (!empty ($_SP_CONF['sort_menu_by'])) {
! $order = ' ORDER BY ';
! if ($_SP_CONF['sort_menu_by'] == 'date') {
! $order .= 'sp_date DESC';
! } else if ($_SP_CONF['sort_menu_by'] == 'label') {
! $order .= 'sp_label';
! } else if ($_SP_CONF['sort_menu_by'] == 'title') {
! $order .= 'sp_title';
! } else { // default to "sort by id"
! $order .= 'sp_id';
! }
! }
!
! $result = DB_query ('SELECT sp_id, sp_label, group_id, owner_id, perm_owner, perm_group, perm_members, perm_anon FROM ' . $_TABLES['staticpage'] . ' WHERE sp_onmenu = 1' . $order);
$nrows = DB_numRows ($result);
$menuitems = array ();
! for ($i = 0; $i < $nrows; $i++) {
$A = DB_fetchArray ($result);
if (SEC_hasAccess ($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon'])) {
! $menuitems[$A['sp_label']] = COM_buildURL ($_CONF['site_url'] . '/staticpages/index.php?page=' . $A['sp_id']);
}
}
+
return $menuitems;
}
Index: config.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/plugins/staticpages/config.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** config.php 14 Feb 2004 17:20:41 -0000 1.7
--- config.php 24 Jul 2004 13:19:53 -0000 1.8
***************
*** 15,18 ****
--- 15,24 ----
+ // sort the static pages that are listed in the site's menu
+ // (assuming you're using a theme that uses the {plg_menu_elements} variable)
+
+ $_SP_CONF['sort_menu_by'] = 'label'; // can be 'id', 'label', 'title', 'date'
+
+
// When a user is deleted, ownership of static pages created by that user can
// be transfered to a user in the Root group (= 0) or the pages can be
More information about the geeklog-cvs
mailing list