Comparing revisions for PageAdminAction
- [5392] 2005-01-31 10:18:50 by DarTar (unregistered user) [Uploading PageAdmin v.0.2]
- [20255] 2008-09-21 05:36:05 by QzqLe4 (unregistered user)
Additions:
=====Page Administration Action=====
{{lastedit}}
>>==See also:==
Documentation: ""PageAdminActionInfo"".
Are you a site administrator? Give it a [[PageAdminTest try]]>>This is the development page for the Page Administration action.::c::
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 ==
""
<form action="#" method="post">
Search page by name: <input type ="text" name="q" size="20" maxlength="50" value=" "/><input type="submit" value="Submit" accesskey="a" /><br /><br />Show <select name="l"><option value="10" selected>10</option><option value="20" >20</option><option value="30" >30</option><option value="40" >40</option><option value="50" >50</option><option value="60" >60</option><option value="70" >70</option><option value="80" >80</option><option value="90" >90</option><option value="100" >100</option><option value="110" >110</option><option value="120" >120</option><option value="130" >130</option><option value="140" >140</option><option value="150" >150</option><option value="160" >160</option><option value="170" >170</option><option value="180" >180</option><option value="190" >190</option><option value="200" >200</option><option value="210" >210</option><option value="220" >220</option><option value="230" >230</option><option value="240" >240</option><option value="250" >250</option><option value="260" >260</option><option value="270" >270</option><option value="280" >280</option><option value="290" >290</option><option value="300" >300</option><option value="310" >310</option><option value="320" >320</option><option value="330" >330</option><option value="340" >340</option><option value="350" >350</option><option value="360" >360</option><option value="370" >370</option><option value="380" >380</option><option value="390" >390</option><option value="400" >400</option><option value="410" >410</option><option value="420" >420</option><option value="430" >430</option><option value="440" >440</option><option value="450" >450</option><option value="460" >460</option><option value="470" >470</option></select> records per page <input type="submit" value="Apply" accesskey="a" /><br /><br />[Records (468): <strong>1-10</strong> | <a href="http://wikka.jsnx.com/PageAdminTest?l=10&sort=time&d=desc&s=10&q=">11-20</a> (sorted by: <em>time, desc</em> )]<br /><br /><table width="100%" border="1px"> <tr> <th> </th> <th><a href="http://wikka.jsnx.com/PageAdminTest?l=10&sort=tag&d=asc&q=" title="Sort by page name">Page Name</a></th> <th><a href="http://wikka.jsnx.com/PageAdminTest?l=10&sort=owner&d=asc&q=" title="Sort by page owner">Owner</a></th> <th><a href="http://wikka.jsnx.com/PageAdminTest?l=10&sort=user&d=asc&q=" title="Sort by author name">Last Author</a></th> <th><a href="http://wikka.jsnx.com/PageAdminTest?l=10&sort=time&d=asc&q=" title="Sort by edit time">Last Edit</a></th> <th>Handle</th> </tr> <tr> <td><input type="checkbox" id="5388" /></td> <td><a href="http://wikka.jsnx.com/SandBox" title="Go to SandBox">SandBox</a></td> <td><center>(Public)</center></td><td><center>84.4.13.15</center></td><td><center>2005-01-31 08:18:49 (<a href="http://wikka.jsnx.com/SandBox/history" title="Display SandBox's history">-</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/SandBox/edit" title="Edit SandBox">edit</a> :: <a href="http://wikka.jsnx.com/SandBox/delete" title="Delete SandBox">delete</a> :: <a href="http://wikka.jsnx.com/SandBox/clone" title="Clone SandBox">clone</a> :: rename :: <a href="http://wikka.jsnx.com/SandBox/acls" title="Change ACLs for SandBox">acl</a> :: <a href="http://wikka.jsnx.com/SandBox/revisions" title="Compare previous versions of SandBox">rev</a></center></td> </tr> <tr> <td><input type="checkbox" id="5385" /></td> <td><a href="http://wikka.jsnx.com/PluginsInDevelopment" title="Go to PluginsInDevelopment">PluginsInDevelo~</a></td> <td><center>(Public)</center></td><td><center><a href="http://wikka.jsnx.com/GmBowen" title="Go to GmBowen's homepage">GmBowen</a></center></td><td><center>2005-01-31 04:51:13 (<a href="http://wikka.jsnx.com/PluginsInDevelopment/history" title="Last edit: updated example links of PMS & progress update">*</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/PluginsInDevelopment/edit" title="Edit PluginsInDevelopment">edit</a> :: <a href="http://wikka.jsnx.com/PluginsInDevelopment/delete" title="Delete PluginsInDevelopment">delete</a> :: <a href="http://wikka.jsnx.com/PluginsInDevelopment/clone" title="Clone PluginsInDevelopment">clone</a> :: rename :: <a href="http://wikka.jsnx.com/PluginsInDevelopment/acls" title="Change ACLs for PluginsInDevelopment">acl</a> :: <a href="http://wikka.jsnx.com/PluginsInDevelopment/revisions" title="Compare previous versions of PluginsInDevelopment">rev</a></center></td> </tr> <tr> <td><input type="checkbox" id="5384" /></td> <td><a href="http://wikka.jsnx.com/ProgrammingHelp" title="Go to ProgrammingHelp">ProgrammingHelp</a></td> <td><center>(Public)</center></td><td><center><a href="http://wikka.jsnx.com/GmBowen" title="Go to GmBowen's homepage">GmBowen</a></center></td><td><center>2005-01-31 03:38:56 (<a href="http://wikka.jsnx.com/ProgrammingHelp/history" title="Last edit: update on problem with date conversion from MYSQL string to readable">*</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/ProgrammingHelp/edit" title="Edit ProgrammingHelp">edit</a> :: <a href="http://wikka.jsnx.com/ProgrammingHelp/delete" title="Delete ProgrammingHelp">delete</a> :: <a href="http://wikka.jsnx.com/ProgrammingHelp/clone" title="Clone ProgrammingHelp">clone</a> :: rename :: <a href="http://wikka.jsnx.com/ProgrammingHelp/acls" title="Change ACLs for ProgrammingHelp">acl</a> :: <a href="http://wikka.jsnx.com/ProgrammingHelp/revisions" title="Compare previous versions of ProgrammingHelp">rev</a></center></td> </tr> <tr> <td><input type="checkbox" id="5381" /></td> <td><a href="http://wikka.jsnx.com/IndependentWikkaReviews" title="Go to IndependentWikkaReviews">IndependentWikk~</a></td> <td><center><a href="http://wikka.jsnx.com/FreeNSK" title="Go to FreeNSK's homepage">FreeNSK</a></center></td><td><center><a href="http://wikka.jsnx.com/JavaWoman" title="Go to JavaWoman's homepage">JavaWoman</a></center></td><td><center>2005-01-30 18:50:58 (<a href="http://wikka.jsnx.com/IndependentWikkaReviews/history" title="Last edit: small title correction">*</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/IndependentWikkaReviews/edit" title="Edit IndependentWikkaReviews">edit</a> :: <a href="http://wikka.jsnx.com/IndependentWikkaReviews/delete" title="Delete IndependentWikkaReviews">delete</a> :: <a href="http://wikka.jsnx.com/IndependentWikkaReviews/clone" title="Clone IndependentWikkaReviews">clone</a> :: rename :: <a href="http://wikka.jsnx.com/IndependentWikkaReviews/acls" title="Change ACLs for IndependentWikkaReviews">acl</a> :: <a href="http://wikka.jsnx.com/IndependentWikkaReviews/revisions" title="Compare previous versions of IndependentWikkaReviews">rev</a></center></td> </tr> <tr> <td><input type="checkbox" id="5380" /></td> <td><a href="http://wikka.jsnx.com/SuggestionBox" title="Go to SuggestionBox">SuggestionBox</a></td> <td><center>(Public)</center></td><td><center><a href="http://wikka.jsnx.com/DarTar" title="Go to DarTar's homepage">DarTar</a></center></td><td><center>2005-01-30 18:04:39 (<a href="http://wikka.jsnx.com/SuggestionBox/history" title="Last edit: Replying to JeroenJansen">*</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/SuggestionBox/edit" title="Edit SuggestionBox">edit</a> :: <a href="http://wikka.jsnx.com/SuggestionBox/delete" title="Delete SuggestionBox">delete</a> :: <a href="http://wikka.jsnx.com/SuggestionBox/clone" title="Clone SuggestionBox">clone</a> :: rename :: <a href="http://wikka.jsnx.com/SuggestionBox/acls" title="Change ACLs for SuggestionBox">acl</a> :: <a href="http://wikka.jsnx.com/SuggestionBox/revisions" title="Compare previous versions of SuggestionBox">rev</a></center></td> </tr> <tr> <td><input type="checkbox" id="5378" /></td> <td><a href="http://wikka.jsnx.com/CategorySystemOverhaul" title="Go to CategorySystemOverhaul">CategorySystemO~</a></td> <td><center><a href="http://wikka.jsnx.com/JsnX" title="Go to JsnX's homepage">JsnX</a></center></td><td><center><a href="http://wikka.jsnx.com/DarTar" title="Go to DarTar's homepage">DarTar</a></center></td><td><center>2005-01-30 17:56:28 (<a href="http://wikka.jsnx.com/CategorySystemOverhaul/history" title="Last edit: Adding FreeMind suggestion">*</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/CategorySystemOverhaul/edit" title="Edit CategorySystemOverhaul">edit</a> :: <a href="http://wikka.jsnx.com/CategorySystemOverhaul/delete" title="Delete CategorySystemOverhaul">delete</a> :: <a href="http://wikka.jsnx.com/CategorySystemOverhaul/clone" title="Clone CategorySystemOverhaul">clone</a> :: rename :: <a href="http://wikka.jsnx.com/CategorySystemOverhaul/acls" title="Change ACLs for CategorySystemOverhaul">acl</a> :: <a href="http://wikka.jsnx.com/CategorySystemOverhaul/revisions" title="Compare previous versions of CategorySystemOverhaul">rev</a></center></td> </tr> <tr> <td><input type="checkbox" id="5377" /></td> <td><a href="http://wikka.jsnx.com/PageAdminAction" title="Go to PageAdminAction">PageAdminAction</a></td> <td><center><a href="http://wikka.jsnx.com/DarTar" title="Go to DarTar's homepage">DarTar</a></center></td><td><center><a href="http://wikka.jsnx.com/DarTar" title="Go to DarTar's homepage">DarTar</a></center></td><td><center>2005-01-30 17:49:48 (<a href="http://wikka.jsnx.com/PageAdminAction/history" title="Last edit: Replying to Mike and adding ToDo item">*</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/PageAdminAction/edit" title="Edit PageAdminAction">edit</a> :: <a href="http://wikka.jsnx.com/PageAdminAction/delete" title="Delete PageAdminAction">delete</a> :: <a href="http://wikka.jsnx.com/PageAdminAction/clone" title="Clone PageAdminAction">clone</a> :: rename :: <a href="http://wikka.jsnx.com/PageAdminAction/acls" title="Change ACLs for PageAdminAction">acl</a> :: <a href="http://wikka.jsnx.com/PageAdminAction/revisions" title="Compare previous versions of PageAdminAction">rev</a></center></td> </tr> <tr> <td><input type="checkbox" id="5373" /></td> <td><a href="http://wikka.jsnx.com/JeremyYip" title="Go to JeremyYip">JeremyYip</a></td> <td><center><a href="http://wikka.jsnx.com/JeremyYip" title="Go to JeremyYip's homepage">JeremyYip</a></center></td><td><center><a href="http://wikka.jsnx.com/JeremyYip" title="Go to JeremyYip's homepage">JeremyYip</a></center></td><td><center>2005-01-30 12:53:53 (<a href="http://wikka.jsnx.com/JeremyYip/history" title="Last edit: Minor edit, added a link">*</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/JeremyYip/edit" title="Edit JeremyYip">edit</a> :: <a href="http://wikka.jsnx.com/JeremyYip/delete" title="Delete JeremyYip">delete</a> :: <a href="http://wikka.jsnx.com/JeremyYip/clone" title="Clone JeremyYip">clone</a> :: rename :: <a href="http://wikka.jsnx.com/JeremyYip/acls" title="Change ACLs for JeremyYip">acl</a> :: <a href="http://wikka.jsnx.com/JeremyYip/revisions" title="Compare previous versions of JeremyYip">rev</a></center></td> </tr> <tr> <td><input type="checkbox" id="5371" /></td> <td><a href="http://wikka.jsnx.com/PageAdminTest" title="Go to PageAdminTest">PageAdminTest</a></td> <td><center><a href="http://wikka.jsnx.com/DarTar" title="Go to DarTar's homepage">DarTar</a></center></td><td><center><a href="http://wikka.jsnx.com/DarTar" title="Go to DarTar's homepage">DarTar</a></center></td><td><center>2005-01-30 11:36:08 (<a href="http://wikka.jsnx.com/PageAdminTest/history" title="Last edit: Test pageadmin action">*</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/PageAdminTest/edit" title="Edit PageAdminTest">edit</a> :: <a href="http://wikka.jsnx.com/PageAdminTest/delete" title="Delete PageAdminTest">delete</a> :: <a href="http://wikka.jsnx.com/PageAdminTest/clone" title="Clone PageAdminTest">clone</a> :: rename :: <a href="http://wikka.jsnx.com/PageAdminTest/acls" title="Change ACLs for PageAdminTest">acl</a> :: <a href="http://wikka.jsnx.com/PageAdminTest/revisions" title="Compare previous versions of PageAdminTest">rev</a></center></td> </tr> <tr> <td><input type="checkbox" id="5368" /></td> <td><a href="http://wikka.jsnx.com/WikkaOptimization" title="Go to WikkaOptimization">WikkaOptimizati~</a></td> <td><center><a href="http://wikka.jsnx.com/DotMG" title="Go to DotMG's homepage">DotMG</a></center></td><td><center><a href="http://wikka.jsnx.com/JavaWoman" title="Go to JavaWoman's homepage">JavaWoman</a></center></td><td><center>2005-01-30 08:22:17 (<a href="http://wikka.jsnx.com/WikkaOptimization/history" title="Last edit: reply to DotMG">*</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/WikkaOptimization/edit" title="Edit WikkaOptimization">edit</a> :: <a href="http://wikka.jsnx.com/WikkaOptimization/delete" title="Delete WikkaOptimization">delete</a> :: <a href="http://wikka.jsnx.com/WikkaOptimization/clone" title="Clone WikkaOptimization">clone</a> :: rename :: <a href="http://wikka.jsnx.com/WikkaOptimization/acls" title="Change ACLs for WikkaOptimization">acl</a> :: <a href="http://wikka.jsnx.com/WikkaOptimization/revisions" title="Compare previous versions of WikkaOptimization">rev</a></center></td> </tr></table><br /><form action="#" method="get">
[<a href="http://wikka.jsnx.com/PageAdminTest?l=10&sort=time&d=desc&s=0&q=&selectall=1" title="Check all results">Check all</a> | <a href="http://wikka.jsnx.com/PageAdminTest?l=10&sort=time&d=desc&s=0&q=&selectall=0" title="Uncheck all results">Uncheck all</a>] With selected: <select name="action"><option value=" " selected="selected">---</option><option value="massdelete">Delete</option><option value="massrename">Rename</option><option value="massacls">Change ACLs</option></select> <input type="submit" value="Submit" accesskey="s" /></form>
""
=== Current Version ===
Last available version is **0.2**.
**Features:**
~-pageable, sortable and searchable list of pages;
~-links to different handlers with titles;
~-shortens long pagename and hostnames;
~-shows plain-text usernames if user has no homepage
**Bugfixes and modifications:**
~-added constant section;
~-added configurable hostname and pagename length limit;
~-fixed problem with search keyword not read by pager;
=== To Do===
To do:
~-Code optimization;
~-Mass-operations (mass-page deletion, mass-page rename, mass-page ACLs etc.);
~-Rename handler;
~-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
===The code ===
Save the code below as ##actions/pageadmin.php## and use it as ##""{{pageadmin}}""##.
%%(php)
<?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.2
* @since Wikka 1.1.X.X
*
* @output list of pages available on the current server
*
* @todo - mass-operations
* - rename handler
* - full-text search
* - i18n support
* - CSS-driven layout
*/
// set default values as constants
define('DEFAULT_RECORDS_LIMIT', '10'); # number of records per page
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
// this is admin-only functionality
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 {
// URL variables
// limit 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 results
$q = (!$_POST['q'])? $_GET['q'] : $_POST['q'];
if (!$_POST['q'] && !$_GET['q']) $q = DEFAULT_SEARCH;
$where = 'WHERE tag LIKE "%'.$q.'%"and latest = "Y"';
echo $this->Format('===== Page Administration ===== --- --- ');
// 1. Get total number of pages
$pages = $this->LoadSingle('SELECT count(*) as n FROM '.$this->config['table_prefix'].'pages '.$where);
$numpages = $pages['n'];
// 2. Display pager form
$form = $this->FormOpen('','','post');
$form .= 'Search page by name: <input type ="text" name="q" size="20" maxlength="50" value="'.$q.'"/><input type="submit" value="Submit" accesskey="a" /><br /><br />';
$form .= 'Show <select name="l">';
for ($rec=10; $rec < ($numpages+10); $rec+=10) {
$selected = ($l == $rec)? 'selected' : '';
$form .= '<option value="'.$rec.'" '.$selected.'>'.$rec.'</option>';
}
$form .= '</select> records per page <input type="submit" value="Apply" accesskey="a" /><br /><br />';
$this->FormClose();
echo $form;
// build pager links
if($s > 0)
$prev = '<a href="' .$this->Href('','','l='.$l.'&sort='.$sort.'&d='.$d.'&s='.($s-$l)).'&q='.$q.'">'.($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.'">'.($s+$l+1).'-'.($s+2*$l).'</a>';
echo '[Records ('.$numpages.'): '.$prev.'<strong>'.($s+1).'-'.($s+$l).'</strong>'.$next.' (sorted by: <em>'.$sort.', '.$d.'</em> )]<br /><br />';
// get page data
$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 = '<table width="100%" border="1px">'.
' <tr>'.
' <th> </th>'.
' <th>'.$tagheader.'</th>'.
' <th>'.$ownerheader.'</th>'.
' <th>'.$userheader.'</th>'.
' <th>'.$lasteditheader.'</th>'.
' <th>Handle</th>'.
' </tr>';
// feed table
foreach($pagedata as $page) {
// avoid long page names
$pagename = (strlen($page['tag']) > DEFAULT_TAG_LENGTH)? substr($page['tag'], 0, DEFAULT_TAG_LENGTH).'~' : $page['tag'];
// build links
$lastedit = $page['time'];
$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="Go to '.$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>';
$revpage = '<a href="'.$this->Href('revisions',$page['tag'], '').'" title="Compare previous versions of '.$page['tag'].'">rev</a>';
// check owner
if ($page['owner']) {
// is the owner a registered user?
$owner = ($this->LoadUser($page['owner']) && $this->ExistsPage($page['owner']))? $this->Link($page['owner'],'','','','','Go to '.$page['owner'].'\'s homepage') : $page['owner'];
} else {
// page has empty owner field
$owner = '(Nobody)';
}
// check 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 {
// avoid long host names
$user = (strlen($page['user']) > DEFAULT_URL_LENGTH)? substr($page['user'], 0, DEFAULT_URL_LENGTH).'~' : $page['user'];
}
} else {
// page has empty user field
$user = '(Nobody)';
}
$htmlout .= ' <tr>';
$htmlout .= ' <td><input type="checkbox" id="'.$page['id'].'" '.(($_GET['selectall'] == 1)? 'checked="checked"' : '').' /></td>';
$htmlout .= ' <td>'.$showpage.'</td> <td><center>'.$owner.
'</center></td><td><center>'.$user.'</center></td><td><center>'.$lastedit.
'</center></td> <td><center> '.$editpage.' :: '.$deletepage.' :: '.$clonepage.' :: rename :: '.$aclpage.' :: '.$revpage.'</center></td>';
$htmlout .= ' </tr>';
}
$htmlout .= '</table>';
// print the table
echo $htmlout;
// multiple-page operations (forthcoming)
echo '<br />'.$this->FormOpen('','','get');
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 {
// 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
echo $this->Action('pageindex');
}
?>
%%
----
CategoryDevelopment
{{lastedit}}
>>==See also:==
Documentation: ""PageAdminActionInfo"".
Are you a site administrator? Give it a [[PageAdminTest try]]>>This is the development page for the Page Administration action.::c::
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 ==
""
<form action="#" method="post">
Search page by name: <input type ="text" name="q" size="20" maxlength="50" value=" "/><input type="submit" value="Submit" accesskey="a" /><br /><br />Show <select name="l"><option value="10" selected>10</option><option value="20" >20</option><option value="30" >30</option><option value="40" >40</option><option value="50" >50</option><option value="60" >60</option><option value="70" >70</option><option value="80" >80</option><option value="90" >90</option><option value="100" >100</option><option value="110" >110</option><option value="120" >120</option><option value="130" >130</option><option value="140" >140</option><option value="150" >150</option><option value="160" >160</option><option value="170" >170</option><option value="180" >180</option><option value="190" >190</option><option value="200" >200</option><option value="210" >210</option><option value="220" >220</option><option value="230" >230</option><option value="240" >240</option><option value="250" >250</option><option value="260" >260</option><option value="270" >270</option><option value="280" >280</option><option value="290" >290</option><option value="300" >300</option><option value="310" >310</option><option value="320" >320</option><option value="330" >330</option><option value="340" >340</option><option value="350" >350</option><option value="360" >360</option><option value="370" >370</option><option value="380" >380</option><option value="390" >390</option><option value="400" >400</option><option value="410" >410</option><option value="420" >420</option><option value="430" >430</option><option value="440" >440</option><option value="450" >450</option><option value="460" >460</option><option value="470" >470</option></select> records per page <input type="submit" value="Apply" accesskey="a" /><br /><br />[Records (468): <strong>1-10</strong> | <a href="http://wikka.jsnx.com/PageAdminTest?l=10&sort=time&d=desc&s=10&q=">11-20</a> (sorted by: <em>time, desc</em> )]<br /><br /><table width="100%" border="1px"> <tr> <th> </th> <th><a href="http://wikka.jsnx.com/PageAdminTest?l=10&sort=tag&d=asc&q=" title="Sort by page name">Page Name</a></th> <th><a href="http://wikka.jsnx.com/PageAdminTest?l=10&sort=owner&d=asc&q=" title="Sort by page owner">Owner</a></th> <th><a href="http://wikka.jsnx.com/PageAdminTest?l=10&sort=user&d=asc&q=" title="Sort by author name">Last Author</a></th> <th><a href="http://wikka.jsnx.com/PageAdminTest?l=10&sort=time&d=asc&q=" title="Sort by edit time">Last Edit</a></th> <th>Handle</th> </tr> <tr> <td><input type="checkbox" id="5388" /></td> <td><a href="http://wikka.jsnx.com/SandBox" title="Go to SandBox">SandBox</a></td> <td><center>(Public)</center></td><td><center>84.4.13.15</center></td><td><center>2005-01-31 08:18:49 (<a href="http://wikka.jsnx.com/SandBox/history" title="Display SandBox's history">-</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/SandBox/edit" title="Edit SandBox">edit</a> :: <a href="http://wikka.jsnx.com/SandBox/delete" title="Delete SandBox">delete</a> :: <a href="http://wikka.jsnx.com/SandBox/clone" title="Clone SandBox">clone</a> :: rename :: <a href="http://wikka.jsnx.com/SandBox/acls" title="Change ACLs for SandBox">acl</a> :: <a href="http://wikka.jsnx.com/SandBox/revisions" title="Compare previous versions of SandBox">rev</a></center></td> </tr> <tr> <td><input type="checkbox" id="5385" /></td> <td><a href="http://wikka.jsnx.com/PluginsInDevelopment" title="Go to PluginsInDevelopment">PluginsInDevelo~</a></td> <td><center>(Public)</center></td><td><center><a href="http://wikka.jsnx.com/GmBowen" title="Go to GmBowen's homepage">GmBowen</a></center></td><td><center>2005-01-31 04:51:13 (<a href="http://wikka.jsnx.com/PluginsInDevelopment/history" title="Last edit: updated example links of PMS & progress update">*</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/PluginsInDevelopment/edit" title="Edit PluginsInDevelopment">edit</a> :: <a href="http://wikka.jsnx.com/PluginsInDevelopment/delete" title="Delete PluginsInDevelopment">delete</a> :: <a href="http://wikka.jsnx.com/PluginsInDevelopment/clone" title="Clone PluginsInDevelopment">clone</a> :: rename :: <a href="http://wikka.jsnx.com/PluginsInDevelopment/acls" title="Change ACLs for PluginsInDevelopment">acl</a> :: <a href="http://wikka.jsnx.com/PluginsInDevelopment/revisions" title="Compare previous versions of PluginsInDevelopment">rev</a></center></td> </tr> <tr> <td><input type="checkbox" id="5384" /></td> <td><a href="http://wikka.jsnx.com/ProgrammingHelp" title="Go to ProgrammingHelp">ProgrammingHelp</a></td> <td><center>(Public)</center></td><td><center><a href="http://wikka.jsnx.com/GmBowen" title="Go to GmBowen's homepage">GmBowen</a></center></td><td><center>2005-01-31 03:38:56 (<a href="http://wikka.jsnx.com/ProgrammingHelp/history" title="Last edit: update on problem with date conversion from MYSQL string to readable">*</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/ProgrammingHelp/edit" title="Edit ProgrammingHelp">edit</a> :: <a href="http://wikka.jsnx.com/ProgrammingHelp/delete" title="Delete ProgrammingHelp">delete</a> :: <a href="http://wikka.jsnx.com/ProgrammingHelp/clone" title="Clone ProgrammingHelp">clone</a> :: rename :: <a href="http://wikka.jsnx.com/ProgrammingHelp/acls" title="Change ACLs for ProgrammingHelp">acl</a> :: <a href="http://wikka.jsnx.com/ProgrammingHelp/revisions" title="Compare previous versions of ProgrammingHelp">rev</a></center></td> </tr> <tr> <td><input type="checkbox" id="5381" /></td> <td><a href="http://wikka.jsnx.com/IndependentWikkaReviews" title="Go to IndependentWikkaReviews">IndependentWikk~</a></td> <td><center><a href="http://wikka.jsnx.com/FreeNSK" title="Go to FreeNSK's homepage">FreeNSK</a></center></td><td><center><a href="http://wikka.jsnx.com/JavaWoman" title="Go to JavaWoman's homepage">JavaWoman</a></center></td><td><center>2005-01-30 18:50:58 (<a href="http://wikka.jsnx.com/IndependentWikkaReviews/history" title="Last edit: small title correction">*</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/IndependentWikkaReviews/edit" title="Edit IndependentWikkaReviews">edit</a> :: <a href="http://wikka.jsnx.com/IndependentWikkaReviews/delete" title="Delete IndependentWikkaReviews">delete</a> :: <a href="http://wikka.jsnx.com/IndependentWikkaReviews/clone" title="Clone IndependentWikkaReviews">clone</a> :: rename :: <a href="http://wikka.jsnx.com/IndependentWikkaReviews/acls" title="Change ACLs for IndependentWikkaReviews">acl</a> :: <a href="http://wikka.jsnx.com/IndependentWikkaReviews/revisions" title="Compare previous versions of IndependentWikkaReviews">rev</a></center></td> </tr> <tr> <td><input type="checkbox" id="5380" /></td> <td><a href="http://wikka.jsnx.com/SuggestionBox" title="Go to SuggestionBox">SuggestionBox</a></td> <td><center>(Public)</center></td><td><center><a href="http://wikka.jsnx.com/DarTar" title="Go to DarTar's homepage">DarTar</a></center></td><td><center>2005-01-30 18:04:39 (<a href="http://wikka.jsnx.com/SuggestionBox/history" title="Last edit: Replying to JeroenJansen">*</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/SuggestionBox/edit" title="Edit SuggestionBox">edit</a> :: <a href="http://wikka.jsnx.com/SuggestionBox/delete" title="Delete SuggestionBox">delete</a> :: <a href="http://wikka.jsnx.com/SuggestionBox/clone" title="Clone SuggestionBox">clone</a> :: rename :: <a href="http://wikka.jsnx.com/SuggestionBox/acls" title="Change ACLs for SuggestionBox">acl</a> :: <a href="http://wikka.jsnx.com/SuggestionBox/revisions" title="Compare previous versions of SuggestionBox">rev</a></center></td> </tr> <tr> <td><input type="checkbox" id="5378" /></td> <td><a href="http://wikka.jsnx.com/CategorySystemOverhaul" title="Go to CategorySystemOverhaul">CategorySystemO~</a></td> <td><center><a href="http://wikka.jsnx.com/JsnX" title="Go to JsnX's homepage">JsnX</a></center></td><td><center><a href="http://wikka.jsnx.com/DarTar" title="Go to DarTar's homepage">DarTar</a></center></td><td><center>2005-01-30 17:56:28 (<a href="http://wikka.jsnx.com/CategorySystemOverhaul/history" title="Last edit: Adding FreeMind suggestion">*</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/CategorySystemOverhaul/edit" title="Edit CategorySystemOverhaul">edit</a> :: <a href="http://wikka.jsnx.com/CategorySystemOverhaul/delete" title="Delete CategorySystemOverhaul">delete</a> :: <a href="http://wikka.jsnx.com/CategorySystemOverhaul/clone" title="Clone CategorySystemOverhaul">clone</a> :: rename :: <a href="http://wikka.jsnx.com/CategorySystemOverhaul/acls" title="Change ACLs for CategorySystemOverhaul">acl</a> :: <a href="http://wikka.jsnx.com/CategorySystemOverhaul/revisions" title="Compare previous versions of CategorySystemOverhaul">rev</a></center></td> </tr> <tr> <td><input type="checkbox" id="5377" /></td> <td><a href="http://wikka.jsnx.com/PageAdminAction" title="Go to PageAdminAction">PageAdminAction</a></td> <td><center><a href="http://wikka.jsnx.com/DarTar" title="Go to DarTar's homepage">DarTar</a></center></td><td><center><a href="http://wikka.jsnx.com/DarTar" title="Go to DarTar's homepage">DarTar</a></center></td><td><center>2005-01-30 17:49:48 (<a href="http://wikka.jsnx.com/PageAdminAction/history" title="Last edit: Replying to Mike and adding ToDo item">*</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/PageAdminAction/edit" title="Edit PageAdminAction">edit</a> :: <a href="http://wikka.jsnx.com/PageAdminAction/delete" title="Delete PageAdminAction">delete</a> :: <a href="http://wikka.jsnx.com/PageAdminAction/clone" title="Clone PageAdminAction">clone</a> :: rename :: <a href="http://wikka.jsnx.com/PageAdminAction/acls" title="Change ACLs for PageAdminAction">acl</a> :: <a href="http://wikka.jsnx.com/PageAdminAction/revisions" title="Compare previous versions of PageAdminAction">rev</a></center></td> </tr> <tr> <td><input type="checkbox" id="5373" /></td> <td><a href="http://wikka.jsnx.com/JeremyYip" title="Go to JeremyYip">JeremyYip</a></td> <td><center><a href="http://wikka.jsnx.com/JeremyYip" title="Go to JeremyYip's homepage">JeremyYip</a></center></td><td><center><a href="http://wikka.jsnx.com/JeremyYip" title="Go to JeremyYip's homepage">JeremyYip</a></center></td><td><center>2005-01-30 12:53:53 (<a href="http://wikka.jsnx.com/JeremyYip/history" title="Last edit: Minor edit, added a link">*</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/JeremyYip/edit" title="Edit JeremyYip">edit</a> :: <a href="http://wikka.jsnx.com/JeremyYip/delete" title="Delete JeremyYip">delete</a> :: <a href="http://wikka.jsnx.com/JeremyYip/clone" title="Clone JeremyYip">clone</a> :: rename :: <a href="http://wikka.jsnx.com/JeremyYip/acls" title="Change ACLs for JeremyYip">acl</a> :: <a href="http://wikka.jsnx.com/JeremyYip/revisions" title="Compare previous versions of JeremyYip">rev</a></center></td> </tr> <tr> <td><input type="checkbox" id="5371" /></td> <td><a href="http://wikka.jsnx.com/PageAdminTest" title="Go to PageAdminTest">PageAdminTest</a></td> <td><center><a href="http://wikka.jsnx.com/DarTar" title="Go to DarTar's homepage">DarTar</a></center></td><td><center><a href="http://wikka.jsnx.com/DarTar" title="Go to DarTar's homepage">DarTar</a></center></td><td><center>2005-01-30 11:36:08 (<a href="http://wikka.jsnx.com/PageAdminTest/history" title="Last edit: Test pageadmin action">*</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/PageAdminTest/edit" title="Edit PageAdminTest">edit</a> :: <a href="http://wikka.jsnx.com/PageAdminTest/delete" title="Delete PageAdminTest">delete</a> :: <a href="http://wikka.jsnx.com/PageAdminTest/clone" title="Clone PageAdminTest">clone</a> :: rename :: <a href="http://wikka.jsnx.com/PageAdminTest/acls" title="Change ACLs for PageAdminTest">acl</a> :: <a href="http://wikka.jsnx.com/PageAdminTest/revisions" title="Compare previous versions of PageAdminTest">rev</a></center></td> </tr> <tr> <td><input type="checkbox" id="5368" /></td> <td><a href="http://wikka.jsnx.com/WikkaOptimization" title="Go to WikkaOptimization">WikkaOptimizati~</a></td> <td><center><a href="http://wikka.jsnx.com/DotMG" title="Go to DotMG's homepage">DotMG</a></center></td><td><center><a href="http://wikka.jsnx.com/JavaWoman" title="Go to JavaWoman's homepage">JavaWoman</a></center></td><td><center>2005-01-30 08:22:17 (<a href="http://wikka.jsnx.com/WikkaOptimization/history" title="Last edit: reply to DotMG">*</a>)</center></td> <td><center> <a href="http://wikka.jsnx.com/WikkaOptimization/edit" title="Edit WikkaOptimization">edit</a> :: <a href="http://wikka.jsnx.com/WikkaOptimization/delete" title="Delete WikkaOptimization">delete</a> :: <a href="http://wikka.jsnx.com/WikkaOptimization/clone" title="Clone WikkaOptimization">clone</a> :: rename :: <a href="http://wikka.jsnx.com/WikkaOptimization/acls" title="Change ACLs for WikkaOptimization">acl</a> :: <a href="http://wikka.jsnx.com/WikkaOptimization/revisions" title="Compare previous versions of WikkaOptimization">rev</a></center></td> </tr></table><br /><form action="#" method="get">
[<a href="http://wikka.jsnx.com/PageAdminTest?l=10&sort=time&d=desc&s=0&q=&selectall=1" title="Check all results">Check all</a> | <a href="http://wikka.jsnx.com/PageAdminTest?l=10&sort=time&d=desc&s=0&q=&selectall=0" title="Uncheck all results">Uncheck all</a>] With selected: <select name="action"><option value=" " selected="selected">---</option><option value="massdelete">Delete</option><option value="massrename">Rename</option><option value="massacls">Change ACLs</option></select> <input type="submit" value="Submit" accesskey="s" /></form>
""
=== Current Version ===
Last available version is **0.2**.
**Features:**
~-pageable, sortable and searchable list of pages;
~-links to different handlers with titles;
~-shortens long pagename and hostnames;
~-shows plain-text usernames if user has no homepage
**Bugfixes and modifications:**
~-added constant section;
~-added configurable hostname and pagename length limit;
~-fixed problem with search keyword not read by pager;
=== To Do===
To do:
~-Code optimization;
~-Mass-operations (mass-page deletion, mass-page rename, mass-page ACLs etc.);
~-Rename handler;
~-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
===The code ===
Save the code below as ##actions/pageadmin.php## and use it as ##""{{pageadmin}}""##.
%%(php)
<?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.2
* @since Wikka 1.1.X.X
*
* @output list of pages available on the current server
*
* @todo - mass-operations
* - rename handler
* - full-text search
* - i18n support
* - CSS-driven layout
*/
// set default values as constants
define('DEFAULT_RECORDS_LIMIT', '10'); # number of records per page
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
// this is admin-only functionality
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 {
// URL variables
// limit 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 results
$q = (!$_POST['q'])? $_GET['q'] : $_POST['q'];
if (!$_POST['q'] && !$_GET['q']) $q = DEFAULT_SEARCH;
$where = 'WHERE tag LIKE "%'.$q.'%"and latest = "Y"';
echo $this->Format('===== Page Administration ===== --- --- ');
// 1. Get total number of pages
$pages = $this->LoadSingle('SELECT count(*) as n FROM '.$this->config['table_prefix'].'pages '.$where);
$numpages = $pages['n'];
// 2. Display pager form
$form = $this->FormOpen('','','post');
$form .= 'Search page by name: <input type ="text" name="q" size="20" maxlength="50" value="'.$q.'"/><input type="submit" value="Submit" accesskey="a" /><br /><br />';
$form .= 'Show <select name="l">';
for ($rec=10; $rec < ($numpages+10); $rec+=10) {
$selected = ($l == $rec)? 'selected' : '';
$form .= '<option value="'.$rec.'" '.$selected.'>'.$rec.'</option>';
}
$form .= '</select> records per page <input type="submit" value="Apply" accesskey="a" /><br /><br />';
$this->FormClose();
echo $form;
// build pager links
if($s > 0)
$prev = '<a href="' .$this->Href('','','l='.$l.'&sort='.$sort.'&d='.$d.'&s='.($s-$l)).'&q='.$q.'">'.($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.'">'.($s+$l+1).'-'.($s+2*$l).'</a>';
echo '[Records ('.$numpages.'): '.$prev.'<strong>'.($s+1).'-'.($s+$l).'</strong>'.$next.' (sorted by: <em>'.$sort.', '.$d.'</em> )]<br /><br />';
// get page data
$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 = '<table width="100%" border="1px">'.
' <tr>'.
' <th> </th>'.
' <th>'.$tagheader.'</th>'.
' <th>'.$ownerheader.'</th>'.
' <th>'.$userheader.'</th>'.
' <th>'.$lasteditheader.'</th>'.
' <th>Handle</th>'.
' </tr>';
// feed table
foreach($pagedata as $page) {
// avoid long page names
$pagename = (strlen($page['tag']) > DEFAULT_TAG_LENGTH)? substr($page['tag'], 0, DEFAULT_TAG_LENGTH).'~' : $page['tag'];
// build links
$lastedit = $page['time'];
$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="Go to '.$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>';
$revpage = '<a href="'.$this->Href('revisions',$page['tag'], '').'" title="Compare previous versions of '.$page['tag'].'">rev</a>';
// check owner
if ($page['owner']) {
// is the owner a registered user?
$owner = ($this->LoadUser($page['owner']) && $this->ExistsPage($page['owner']))? $this->Link($page['owner'],'','','','','Go to '.$page['owner'].'\'s homepage') : $page['owner'];
} else {
// page has empty owner field
$owner = '(Nobody)';
}
// check 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 {
// avoid long host names
$user = (strlen($page['user']) > DEFAULT_URL_LENGTH)? substr($page['user'], 0, DEFAULT_URL_LENGTH).'~' : $page['user'];
}
} else {
// page has empty user field
$user = '(Nobody)';
}
$htmlout .= ' <tr>';
$htmlout .= ' <td><input type="checkbox" id="'.$page['id'].'" '.(($_GET['selectall'] == 1)? 'checked="checked"' : '').' /></td>';
$htmlout .= ' <td>'.$showpage.'</td> <td><center>'.$owner.
'</center></td><td><center>'.$user.'</center></td><td><center>'.$lastedit.
'</center></td> <td><center> '.$editpage.' :: '.$deletepage.' :: '.$clonepage.' :: rename :: '.$aclpage.' :: '.$revpage.'</center></td>';
$htmlout .= ' </tr>';
}
$htmlout .= '</table>';
// print the table
echo $htmlout;
// multiple-page operations (forthcoming)
echo '<br />'.$this->FormOpen('','','get');
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 {
// 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
echo $this->Action('pageindex');
}
?>
%%
----
CategoryDevelopment
Deletions:
{{lastedit}}
This is the development page for the Page Administration action. The Page Administration module has been committed to the [[http://wush.net/websvn/wikka/listing.php?repname=wikka