Revision [8604]
This is an old revision of PageAdminAction made by JavaWoman on 2005-05-28 17:19:34.
Page Administration Action
See also:
- Documentation: PageAdminActionInfo.
- Are you an administrator of this site ?
Give it a PageAdminTest try
This is the development page for the Page Administration action.
This action, inspired by the UserAdmin action, is meant to allow Wikka Administrators to manage pages and perform several maintenance operations.
It displays the standard PageIndex to non-admins.
Sample output
Page Administration
Current Version
Last available version is 0.3.1.
Features:
- displays a pageable, sortable and searchable list of pages;
- displays detailed and clickable page statistics (revisions, comments, backlinks, referrers)
- generates links to different handlers with titles;
- shortens long pagenames and hostnames;
- shows last edit notes (if available);
- adds 'claim' links to pages with no owner;
- shows plain-text username in owner/lastauthor fields if user has no homepage;
- supports a bunch of configurable options (including max. length of displayed pagename, max. length of hostname, symbol for truncated text).
Bugfixes and modifications:
- added constant section;
- added titles to different form elements;
- added configurable hostname and pagename length limit;
- fixed problem with search keyword not read by pager;
- added submit buttons after menus;
- fixed invalid markup resulting in green text on the whole page.
To Do
To do:
- Code optimization;
- Mass-operations (mass-page deletion, mass-page rename, mass-page ACLs etc.);
- Handlers: add rename handler;
- Page statistics: add page hits;
- CSS-driven layout;
- Can I advocate for a "Page Hide/Unhide" option here?....H instead of Y or N for most recent works well. In some communities, particularly where there might be legal/administrative follow-ups to what was posted, it is quite useful to be able to "keep" the contents of the page in the database, but make them inaccessible to the wiki users. --GmBowen
- Mike, as you can see this interface does not add any specific handler or page feature which is not already supported by Wikka: it is just a hub for existing handlers (the multiple-page operations will require new handlers, though). So if you want to propose something like a 'hide/unhide' handler, I suggest you open a dedicated page. -- DarTar
- To be more precise, this action does include two forthcoming features (rename handler, page hits) but only as placeholders. The development of each of these functionalities should be take place elsewhere, not on this page. -- DarTar
The code
Save the code below as actions/pageadmin.php and use it as {{pageadmin}}.
<?php
/**
* Display an interface allowing Wikka administrators to perform multiple operations on Wikka pages.
*
* @package Actions
* @name PageAdmin
*
* @author {@link http://wikka.jsnx.com/DarTar Dario Taraborelli}
* @version 0.3.1
* @since Wikka 1.1.X.X
*
* @output A list of pages available on the current Wikka server.
*
* @todo - mass-operations
* - handlers: rename handler
* - statistics: page hits
* - full-text page search
* - i18n support
* - CSS-driven layout
*/
// set default values as constants
define('DEFAULT_RECORDS_LIMIT', '20'); # number of records per page
define('DEFAULT_REC_LIMIT_STEP', '10'); # step for selectable records limit
define('DEFAULT_SORT_FIELD', 'time'); # sort field
define('DEFAULT_SORT_ORDER', 'desc'); # sort order, ascendant or descendant
define('DEFAULT_START', '0'); # start record
define('DEFAULT_SEARCH', ''); # keyword to restrict page search
define('DEFAULT_TAG_LENGTH', '15'); # max. length of displayed pagename
define('DEFAULT_URL_LENGTH', '18'); # max. length of displayed user host
define('DEFAULT_TERMINATOR', '~'); # symbol replacing truncated text
// restrict access to admins
if ($this->IsAdmin($this->GetUser())) {
// perform mass-operations if required (forthcoming)
if ($_GET["action"] == "massdelete") {
echo $this->Action("massdelete");
} else if ($_GET["action"] == "massrename"){
echo $this->Action("massrename");
} else if ($_GET["action"] == "massacls"){
echo $this->Action("massacls");
} else {
// process URL variables
// number of records per page
$l = (!$_POST['l'])? $_GET['l'] : $_POST['l'];
if (!$_POST['l'] && !$_GET['l']) $l = DEFAULT_RECORDS_LIMIT;
// sort field
$sort = ($_GET['sort'])? $_GET['sort'] : DEFAULT_SORT_FIELD;
// sort order
$d = ($_GET['d'])? $_GET['d'] : DEFAULT_SORT_ORDER;
// start record
$s = ($_GET['s'])? $_GET['s'] : DEFAULT_START;
// search string
$q = (!$_POST['q'])? $_GET['q'] : $_POST['q'];
if (!$_POST['q'] && !$_GET['q']) $q = DEFAULT_SEARCH;
// restrict MySQL query by search string
$where = 'WHERE tag LIKE "%'.$q.'%"and latest = "Y"';
// get total number of pages
$pages = $this->LoadSingle('SELECT count(*) as n FROM '.$this->config['table_prefix'].'pages '.$where);
$numpages = $pages['n'];
// print page header
echo $this->Format('===== Page Administration ===== --- --- ');
// build pager form
echo $this->FormOpen('','','post');
$form1 = '<div style="float:left; padding:10px; border:1px dotted #AAA; background-color:#EEE; width:60%">';
$form1 .= 'Search page by name: <input type ="text" name="q" title="Enter a search string" size="20" maxlength="50" value="'.$q.'"/><input type="submit" value="Submit" accesskey="a" /><br /><br />';
$form1 .= 'Show <select name="l" title="Select records-per-page limit">';
// build drop-down menu
for ($rec=DEFAULT_REC_LIMIT_STEP; $rec < ($numpages+DEFAULT_REC_LIMIT_STEP); $rec+=DEFAULT_REC_LIMIT_STEP) {
$selected = ($l == $rec)? 'selected' : '';
$form1 .= '<option value="'.$rec.'" '.$selected.'>'.$rec.'</option>';
}
$form1 .= '</select> records per page <input type="submit" value="Apply" accesskey="a" /><br /><br />';
// build pager links
if($s > 0)
$prev = '<a href="' .$this->Href('','','l='.$l.'&sort='.$sort.'&d='.$d.'&s='.($s-$l)).'&q='.$q.'" title="Show records from '.($s-$l+1).' to '.$s.'">'.($s-$l+1).'-'.$s.'</a> | ';
if($numpages > ($s + $l))
$next = ' | <a href="'.$this->Href('','','l='.$l.'&sort='.$sort.'&d='.$d.'&s='.($s+$l)).'&q='.$q.'" title="Show records from '.($s+$l+1).' to '.($s+2*$l).'">'.($s+$l+1).'-'.($s+2*$l).'</a>';
$form1 .= '[Records ('.$numpages.'): '.$prev.'<strong>'.($s+1).'-'.($s+$l).'</strong>'.$next.' (sorted by: <em>'.$sort.', '.$d.'</em> )]';
$form1 .= '</div>'.$this->FormClose();
// print form and infobox
$infobox = '<div style="float:right; margin-bottom: 20px;padding:10px; border:1px dotted #AAA; background-color:#EEE; width:30%"><strong>Page Statistics:</strong><br /><ul style="list-style-type: none"><li><span style="color: #666">hits</a></li><li><span style="color: #CC0000">revisions</a></li><li><span style="color:#00CC00">comments</span></li><li><span style="color: #0000CC">backlinks</span></li><li><span style="color: #000000">referrers</span></li></ul></div>';
echo $infobox;
echo $form1;
// get page list
$pagedata = $this->LoadAll("SELECT * FROM ".$this->config["table_prefix"]."pages ".
$where." ORDER BY ".$sort." ".$d." limit ".$s.", ".$l);
if ($pagedata) {
// build table headers
$tagheader = '<a href="'.$this->Href('','', (($sort == 'tag' && $d == 'asc')? 'l='.$l.'&sort=tag&d=desc&q='.$q : 'l='.$l.'&sort=tag&d=asc&q='.$q)).'" title="Sort by page name">Page Name</a>';
$ownerheader = '<a href="'.$this->Href('','', (($sort == 'owner' && $d == 'asc')? 'l='.$l.'&sort=owner&d=desc&q='.$q : 'l='.$l.'&sort=owner&d=asc&q='.$q)).'" title="Sort by page owner">Owner</a>';
$userheader = '<a href="'.$this->Href('','', (($sort == 'user' && $d == 'asc')? 'l='.$l.'&sort=user&d=desc&q='.$q : 'l='.$l.'&sort=user&d=asc&q='.$q)).'" title="Sort by author name">Last Author</a>';
$lasteditheader = '<a href="'.$this->Href('','', (($sort == 'time' && $d == 'desc')? 'l='.$l.'&sort=time&d=asc&q='.$q : 'l='.$l.'&sort=time&d=desc&q='.$q)).'" title="Sort by edit time">Last Edit</a>';
$htmlout = '<div class="pagedata" style="clear:both"><table width="100%" border="1px">'.
' <tr>'.
' <th> </th>'.
' <th>'.$tagheader.'</th>'.
' <th>'.$ownerheader.'</th>'.
' <th>'.$userheader.'</th>'.
' <th>'.$lasteditheader.'</th>'.
' <th>Page Statistics</th>'.
' <th>Page Handlers</th>'.
' </tr>';
// feed table with data
foreach($pagedata as $page) {
// truncate long page names
$pagename = (strlen($page['tag']) > DEFAULT_TAG_LENGTH)? substr($page['tag'], 0, DEFAULT_TAG_LENGTH).DEFAULT_TERMINATOR : $page['tag'];
// build handler links
$lastedit = '<span style="font-size: .8em">'.$page['time'].'</span>';
$lastedit .= ($page['note'])? ' (<a href="'.$this->Href('history', $page['tag'], '').'" title="Last edit: '.$page['note'].'">*</a>)' : ' (<a href="'.$this->Href('history', $page['tag'], '').'" title="Display '.$page['tag'].'\'s history">-</a>)';
$showpage = '<a href="'.$this->Href('',$page['tag'], '').'" title="Open '.$page['tag'].'">'.$pagename.'</a>';
$editpage = '<a href="'.$this->Href('edit',$page['tag'], '').'" title="Edit '.$page['tag'].'">edit</a>';
$deletepage = '<a href="'.$this->Href('delete',$page['tag'], '').'" title="Delete '.$page['tag'].'">delete</a>';
$clonepage = '<a href="'.$this->Href('clone',$page['tag'], '').'" title="Clone '.$page['tag'].'">clone</a>';
$aclpage = '<a href="'.$this->Href('acls',$page['tag'], '').'" title="Change ACLs for '.$page['tag'].'">acl</a>';
// get page owner
if ($page['owner']) {
// is the owner a registered user?
if ($this->LoadUser($page['owner'])) {
// does user's homepage exist?
if ($this->ExistsPage($page['owner'])) {
$owner = $this->Link($page['owner'],'','','','','Go to '.$page['owner'].'\'s homepage');
} else {
$owner = $page['owner'];
}
} else {
$owner = $page['owner'];
}
} else {
// page has empty owner field: print claim link
$owner = $this->Link($page['tag'], 'claim','(Nobody)','','','Take ownership of '.$page['tag']);
}
// get last author
if ($page['user']) {
// is the author a registered user?
if ($this->LoadUser($page['user'])) {
// does user's homepage exist?
if ($this->ExistsPage($page['user'])) {
$user = $this->Link($page['user'],'','','','','Go to '.$page['user'].'\'s homepage');
} else {
$user = $page['user'];
}
} else {
// truncate long host names
$user = (strlen($page['user']) > DEFAULT_URL_LENGTH)? substr($page['user'], 0, DEFAULT_URL_LENGTH).DEFAULT_TERMINATOR : $page['user'];
}
} else {
// page has empty user field
$user = '(Nobody)';
}
// get page hits (forthcoming)
$hitspage = '<span style="color:#666">0</span>';
// get page revisions and create revision link if needed
$revisions = $this->LoadRevisions($page['tag']);
$rv = count($revisions);
$revpage = ($rv > 0)? '<a style="color:#CC0000" href="'.$this->Href('revisions',$page['tag'], '').'" title="Revisions of '.$page['tag'].' ('.$rv.')">'.$rv.'</a>' : '<span style="color:#CC0000">0</span>';
// get page comments and create comments link if needed
$comments = $this->LoadComments($page['tag']);
$cn = count($comments);
$commentspage = ($cn > 0)? '<a style="color:#00CC00" href="'.$this->Href('',$page['tag'], 'show_comments=1#comments').'" title="Comments for '.$page['tag'].' ('.$cn.')">'.$cn.'</a>' : '<span style="color:#00CC00">0</span>';
// get page backlinks and create backlinks link
$backlinks = $this->LoadPagesLinkingTo($page['tag']);
$bn = count($backlinks);
$backlinkpage = ($bn > 0)? '<a style="color:#0000CC" href="'.$this->Href('backlinks',$page['tag'], '').'" title="Pages linking to '.$page['tag'].' ('.$bn.')">'.$bn.'</a>' : '<span style="color:#0000CC">0</span>';
// get page referrers and create referrer link
$referrers = $this->LoadReferrers($page['tag']);
$rn = count($referrers);
$refpage = ($rn > 0)? '<a style="color:#000000" href="'.$this->Href('referrers',$page['tag'], '').'" title="External sites linking to '.$page['tag'].' ('.$rn.')">'.$rn.'</a>' : '<span style="color:#000000">0</span>';
$htmlout .= ' <tr>'.
' <td><input type="checkbox" id="'.$page['id'].'" '.(($_GET['selectall'] == 1)? 'checked="checked"' : '').' title="Select '.$page['tag'].'"/></td>'.
' <td>'.$showpage.'</td>'.
' <td><center>'.$owner.'</center></td>'.
' <td><center>'.$user.'</center></td>'.
' <td><center>'.$lastedit.'</center></td>'.
' <td><center>'.$hitspage.'-'.$revpage.'-'.$commentspage.'-'.$backlinkpage.'-'.$refpage.'</center></td>'.
' <td><center> '.$editpage.' :: '.$deletepage.' :: '.$clonepage.' :: rename :: '.$aclpage.' </center></td>'.
' </tr>';
}
$htmlout .= '</table></div>';
// print the table
echo $this->FormOpen('','','get');
echo $htmlout;
// multiple-page operations (forthcoming)
echo '<br />';
echo '[<a href="'.$this->Href('','','l='.$l.'&sort='.$sort.'&d='.$d.'&s='.$s.'&q='.$q.'&selectall=1').'" title="Check all results">Check all</a> | <a href="'.$this->Href('','','l='.$l.'&sort='.$sort.'&d='.$d.'&s='.$s.'&q='.$q.'&selectall=0').'" title="Uncheck all results">Uncheck all</a>]';
echo ' With selected: <select name="action">';
echo '<option value="" selected="selected">---</option>';
echo '<option value="massdelete">Delete</option>';
echo '<option value="massrename">Rename</option>';
echo '<option value="massacls">Change ACLs</option>';
echo '</select> <input type="submit" value="Submit" accesskey="s" />';
echo $this->FormClose();
} else {
// no records matching the search string: print error message
echo '<p><span class="error">Sorry, there are no pages matching</span> <strong>"'.$q.'"</strong></p>';
}
}
} else {
// current user is not admin: show plain page index
echo $this->Action('pageindex');
}
?>
/**
* Display an interface allowing Wikka administrators to perform multiple operations on Wikka pages.
*
* @package Actions
* @name PageAdmin
*
* @author {@link http://wikka.jsnx.com/DarTar Dario Taraborelli}
* @version 0.3.1
* @since Wikka 1.1.X.X
*
* @output A list of pages available on the current Wikka server.
*
* @todo - mass-operations
* - handlers: rename handler
* - statistics: page hits
* - full-text page search
* - i18n support
* - CSS-driven layout
*/
// set default values as constants
define('DEFAULT_RECORDS_LIMIT', '20'); # number of records per page
define('DEFAULT_REC_LIMIT_STEP', '10'); # step for selectable records limit
define('DEFAULT_SORT_FIELD', 'time'); # sort field
define('DEFAULT_SORT_ORDER', 'desc'); # sort order, ascendant or descendant
define('DEFAULT_START', '0'); # start record
define('DEFAULT_SEARCH', ''); # keyword to restrict page search
define('DEFAULT_TAG_LENGTH', '15'); # max. length of displayed pagename
define('DEFAULT_URL_LENGTH', '18'); # max. length of displayed user host
define('DEFAULT_TERMINATOR', '~'); # symbol replacing truncated text
// restrict access to admins
if ($this->IsAdmin($this->GetUser())) {
// perform mass-operations if required (forthcoming)
if ($_GET["action"] == "massdelete") {
echo $this->Action("massdelete");
} else if ($_GET["action"] == "massrename"){
echo $this->Action("massrename");
} else if ($_GET["action"] == "massacls"){
echo $this->Action("massacls");
} else {
// process URL variables
// number of records per page
$l = (!$_POST['l'])? $_GET['l'] : $_POST['l'];
if (!$_POST['l'] && !$_GET['l']) $l = DEFAULT_RECORDS_LIMIT;
// sort field
$sort = ($_GET['sort'])? $_GET['sort'] : DEFAULT_SORT_FIELD;
// sort order
$d = ($_GET['d'])? $_GET['d'] : DEFAULT_SORT_ORDER;
// start record
$s = ($_GET['s'])? $_GET['s'] : DEFAULT_START;
// search string
$q = (!$_POST['q'])? $_GET['q'] : $_POST['q'];
if (!$_POST['q'] && !$_GET['q']) $q = DEFAULT_SEARCH;
// restrict MySQL query by search string
$where = 'WHERE tag LIKE "%'.$q.'%"and latest = "Y"';
// get total number of pages
$pages = $this->LoadSingle('SELECT count(*) as n FROM '.$this->config['table_prefix'].'pages '.$where);
$numpages = $pages['n'];
// print page header
echo $this->Format('===== Page Administration ===== --- --- ');
// build pager form
echo $this->FormOpen('','','post');
$form1 = '<div style="float:left; padding:10px; border:1px dotted #AAA; background-color:#EEE; width:60%">';
$form1 .= 'Search page by name: <input type ="text" name="q" title="Enter a search string" size="20" maxlength="50" value="'.$q.'"/><input type="submit" value="Submit" accesskey="a" /><br /><br />';
$form1 .= 'Show <select name="l" title="Select records-per-page limit">';
// build drop-down menu
for ($rec=DEFAULT_REC_LIMIT_STEP; $rec < ($numpages+DEFAULT_REC_LIMIT_STEP); $rec+=DEFAULT_REC_LIMIT_STEP) {
$selected = ($l == $rec)? 'selected' : '';
$form1 .= '<option value="'.$rec.'" '.$selected.'>'.$rec.'</option>';
}
$form1 .= '</select> records per page <input type="submit" value="Apply" accesskey="a" /><br /><br />';
// build pager links
if($s > 0)
$prev = '<a href="' .$this->Href('','','l='.$l.'&sort='.$sort.'&d='.$d.'&s='.($s-$l)).'&q='.$q.'" title="Show records from '.($s-$l+1).' to '.$s.'">'.($s-$l+1).'-'.$s.'</a> | ';
if($numpages > ($s + $l))
$next = ' | <a href="'.$this->Href('','','l='.$l.'&sort='.$sort.'&d='.$d.'&s='.($s+$l)).'&q='.$q.'" title="Show records from '.($s+$l+1).' to '.($s+2*$l).'">'.($s+$l+1).'-'.($s+2*$l).'</a>';
$form1 .= '[Records ('.$numpages.'): '.$prev.'<strong>'.($s+1).'-'.($s+$l).'</strong>'.$next.' (sorted by: <em>'.$sort.', '.$d.'</em> )]';
$form1 .= '</div>'.$this->FormClose();
// print form and infobox
$infobox = '<div style="float:right; margin-bottom: 20px;padding:10px; border:1px dotted #AAA; background-color:#EEE; width:30%"><strong>Page Statistics:</strong><br /><ul style="list-style-type: none"><li><span style="color: #666">hits</a></li><li><span style="color: #CC0000">revisions</a></li><li><span style="color:#00CC00">comments</span></li><li><span style="color: #0000CC">backlinks</span></li><li><span style="color: #000000">referrers</span></li></ul></div>';
echo $infobox;
echo $form1;
// get page list
$pagedata = $this->LoadAll("SELECT * FROM ".$this->config["table_prefix"]."pages ".
$where." ORDER BY ".$sort." ".$d." limit ".$s.", ".$l);
if ($pagedata) {
// build table headers
$tagheader = '<a href="'.$this->Href('','', (($sort == 'tag' && $d == 'asc')? 'l='.$l.'&sort=tag&d=desc&q='.$q : 'l='.$l.'&sort=tag&d=asc&q='.$q)).'" title="Sort by page name">Page Name</a>';
$ownerheader = '<a href="'.$this->Href('','', (($sort == 'owner' && $d == 'asc')? 'l='.$l.'&sort=owner&d=desc&q='.$q : 'l='.$l.'&sort=owner&d=asc&q='.$q)).'" title="Sort by page owner">Owner</a>';
$userheader = '<a href="'.$this->Href('','', (($sort == 'user' && $d == 'asc')? 'l='.$l.'&sort=user&d=desc&q='.$q : 'l='.$l.'&sort=user&d=asc&q='.$q)).'" title="Sort by author name">Last Author</a>';
$lasteditheader = '<a href="'.$this->Href('','', (($sort == 'time' && $d == 'desc')? 'l='.$l.'&sort=time&d=asc&q='.$q : 'l='.$l.'&sort=time&d=desc&q='.$q)).'" title="Sort by edit time">Last Edit</a>';
$htmlout = '<div class="pagedata" style="clear:both"><table width="100%" border="1px">'.
' <tr>'.
' <th> </th>'.
' <th>'.$tagheader.'</th>'.
' <th>'.$ownerheader.'</th>'.
' <th>'.$userheader.'</th>'.
' <th>'.$lasteditheader.'</th>'.
' <th>Page Statistics</th>'.
' <th>Page Handlers</th>'.
' </tr>';
// feed table with data
foreach($pagedata as $page) {
// truncate long page names
$pagename = (strlen($page['tag']) > DEFAULT_TAG_LENGTH)? substr($page['tag'], 0, DEFAULT_TAG_LENGTH).DEFAULT_TERMINATOR : $page['tag'];
// build handler links
$lastedit = '<span style="font-size: .8em">'.$page['time'].'</span>';
$lastedit .= ($page['note'])? ' (<a href="'.$this->Href('history', $page['tag'], '').'" title="Last edit: '.$page['note'].'">*</a>)' : ' (<a href="'.$this->Href('history', $page['tag'], '').'" title="Display '.$page['tag'].'\'s history">-</a>)';
$showpage = '<a href="'.$this->Href('',$page['tag'], '').'" title="Open '.$page['tag'].'">'.$pagename.'</a>';
$editpage = '<a href="'.$this->Href('edit',$page['tag'], '').'" title="Edit '.$page['tag'].'">edit</a>';
$deletepage = '<a href="'.$this->Href('delete',$page['tag'], '').'" title="Delete '.$page['tag'].'">delete</a>';
$clonepage = '<a href="'.$this->Href('clone',$page['tag'], '').'" title="Clone '.$page['tag'].'">clone</a>';
$aclpage = '<a href="'.$this->Href('acls',$page['tag'], '').'" title="Change ACLs for '.$page['tag'].'">acl</a>';
// get page owner
if ($page['owner']) {
// is the owner a registered user?
if ($this->LoadUser($page['owner'])) {
// does user's homepage exist?
if ($this->ExistsPage($page['owner'])) {
$owner = $this->Link($page['owner'],'','','','','Go to '.$page['owner'].'\'s homepage');
} else {
$owner = $page['owner'];
}
} else {
$owner = $page['owner'];
}
} else {
// page has empty owner field: print claim link
$owner = $this->Link($page['tag'], 'claim','(Nobody)','','','Take ownership of '.$page['tag']);
}
// get last author
if ($page['user']) {
// is the author a registered user?
if ($this->LoadUser($page['user'])) {
// does user's homepage exist?
if ($this->ExistsPage($page['user'])) {
$user = $this->Link($page['user'],'','','','','Go to '.$page['user'].'\'s homepage');
} else {
$user = $page['user'];
}
} else {
// truncate long host names
$user = (strlen($page['user']) > DEFAULT_URL_LENGTH)? substr($page['user'], 0, DEFAULT_URL_LENGTH).DEFAULT_TERMINATOR : $page['user'];
}
} else {
// page has empty user field
$user = '(Nobody)';
}
// get page hits (forthcoming)
$hitspage = '<span style="color:#666">0</span>';
// get page revisions and create revision link if needed
$revisions = $this->LoadRevisions($page['tag']);
$rv = count($revisions);
$revpage = ($rv > 0)? '<a style="color:#CC0000" href="'.$this->Href('revisions',$page['tag'], '').'" title="Revisions of '.$page['tag'].' ('.$rv.')">'.$rv.'</a>' : '<span style="color:#CC0000">0</span>';
// get page comments and create comments link if needed
$comments = $this->LoadComments($page['tag']);
$cn = count($comments);
$commentspage = ($cn > 0)? '<a style="color:#00CC00" href="'.$this->Href('',$page['tag'], 'show_comments=1#comments').'" title="Comments for '.$page['tag'].' ('.$cn.')">'.$cn.'</a>' : '<span style="color:#00CC00">0</span>';
// get page backlinks and create backlinks link
$backlinks = $this->LoadPagesLinkingTo($page['tag']);
$bn = count($backlinks);
$backlinkpage = ($bn > 0)? '<a style="color:#0000CC" href="'.$this->Href('backlinks',$page['tag'], '').'" title="Pages linking to '.$page['tag'].' ('.$bn.')">'.$bn.'</a>' : '<span style="color:#0000CC">0</span>';
// get page referrers and create referrer link
$referrers = $this->LoadReferrers($page['tag']);
$rn = count($referrers);
$refpage = ($rn > 0)? '<a style="color:#000000" href="'.$this->Href('referrers',$page['tag'], '').'" title="External sites linking to '.$page['tag'].' ('.$rn.')">'.$rn.'</a>' : '<span style="color:#000000">0</span>';
$htmlout .= ' <tr>'.
' <td><input type="checkbox" id="'.$page['id'].'" '.(($_GET['selectall'] == 1)? 'checked="checked"' : '').' title="Select '.$page['tag'].'"/></td>'.
' <td>'.$showpage.'</td>'.
' <td><center>'.$owner.'</center></td>'.
' <td><center>'.$user.'</center></td>'.
' <td><center>'.$lastedit.'</center></td>'.
' <td><center>'.$hitspage.'-'.$revpage.'-'.$commentspage.'-'.$backlinkpage.'-'.$refpage.'</center></td>'.
' <td><center> '.$editpage.' :: '.$deletepage.' :: '.$clonepage.' :: rename :: '.$aclpage.' </center></td>'.
' </tr>';
}
$htmlout .= '</table></div>';
// print the table
echo $this->FormOpen('','','get');
echo $htmlout;
// multiple-page operations (forthcoming)
echo '<br />';
echo '[<a href="'.$this->Href('','','l='.$l.'&sort='.$sort.'&d='.$d.'&s='.$s.'&q='.$q.'&selectall=1').'" title="Check all results">Check all</a> | <a href="'.$this->Href('','','l='.$l.'&sort='.$sort.'&d='.$d.'&s='.$s.'&q='.$q.'&selectall=0').'" title="Uncheck all results">Uncheck all</a>]';
echo ' With selected: <select name="action">';
echo '<option value="" selected="selected">---</option>';
echo '<option value="massdelete">Delete</option>';
echo '<option value="massrename">Rename</option>';
echo '<option value="massacls">Change ACLs</option>';
echo '</select> <input type="submit" value="Submit" accesskey="s" />';
echo $this->FormClose();
} else {
// no records matching the search string: print error message
echo '<p><span class="error">Sorry, there are no pages matching</span> <strong>"'.$q.'"</strong></p>';
}
}
} else {
// current user is not admin: show plain page index
echo $this->Action('pageindex');
}
?>
CategoryDevelopmentActions CategoryDevelopmentAdmin