Comparing revisions for PageAdminAction
- [10126] 2005-07-19 08:20:57 by JavaWoman (unregistered user) [comment re truncated text]
- [20255] 2008-09-21 05:36:05 by QzqLe4 (unregistered user)
Additions:
=====Page Administration Action=====
>>==See also:==
~-AdminModules
~-RefactorWiki
~-MovePages
~-Are you an administrator of this site ? --- Give it a [[PageAdminTest try]]---''(temporarily broken - see WikkaBetaFeatures and WikkaCountingRecords)''
>>
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.::c::
----
== Sample output ==
=====Page Administration=====
""
<form action="#" method="post">
<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><div style="float:left; padding:10px; border:1px dotted #AAA; background-color:#EEE; width:60%">Search page by name: <input type ="text" name="q" title="Enter a search string" size="20" maxlength="50" value=" "/><input type="submit" value="Submit" accesskey="a" /><br /><br />Show <select name="l" title="Select records-per-page limit"><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><option value="480" >480</option></select> records per page <input type="submit" value="Apply" accesskey="a" /><br /><br />[Records (471): <strong>1-10</strong> | <a href="http://wikka.jsnx.com/PageAdminTest?l=10&sort=time&d=desc&s=10&q=" title="Show records from 11 to 20">11-20</a> (sorted by: <em>time, desc</em> )]</div></form>
<form action="#" method="get">
<div class="pagedata" style="clear:both"><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>Page Statistics</th> <th>Page Handlers</th> </tr> <tr> <td><input type="checkbox" id="5416" title="Select InitializeSessionWorkaround"/></td> <td><a href="http://wikka.jsnx.com/InitializeSessionWorkaround" title="Open InitializeSessionWorkaround">InitializeSessi~</a></td> <td><center>FreekNL</center></td> <td><center>FreekNL</center></td> <td><center><span style="font-size: .8em">2005-01-31 21:58:56</span> (<a href="http://wikka.jsnx.com/InitializeSessionWorkaround/history" title="Display InitializeSessionWorkaround's history">-</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/InitializeSessionWorkaround/revisions" title="Revisions of InitializeSessionWorkaround (1)">1</a>-<span style="color:#00CC00">0</span>-<span style="color:#0000CC">0</span>-<span style="color:#000000">0</span></center></td> <td><center> <a href="http://wikka.jsnx.com/InitializeSessionWorkaround/edit" title="Edit InitializeSessionWorkaround">edit</a> :: <a href="http://wikka.jsnx.com/InitializeSessionWorkaround/delete" title="Delete InitializeSessionWorkaround">delete</a> :: <a href="http://wikka.jsnx.com/InitializeSessionWorkaround/clone" title="Clone InitializeSessionWorkaround">clone</a> :: rename :: <a href="http://wikka.jsnx.com/InitializeSessionWorkaround/acls" title="Change ACLs for InitializeSessionWorkaround">acl</a> </center></td> </tr> <tr> <td><input type="checkbox" id="5415" title="Select GmBowen"/></td> <td><a href="http://wikka.jsnx.com/GmBowen" title="Open GmBowen">GmBowen</a></td> <td><center><a href="http://wikka.jsnx.com/GmBowen" title="Go to GmBowen's homepage">GmBowen</a></center></td> <td><center><a href="http://wikka.jsnx.com/GmBowen" title="Go to GmBowen's homepage">GmBowen</a></center></td> <td><center><span style="font-size: .8em">2005-01-31 19:54:17</span> (<a href="http://wikka.jsnx.com/GmBowen/history" title="Display GmBowen's history">-</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/GmBowen/revisions" title="Revisions of GmBowen (125)">125</a>-<a style="color:#00CC00" href="http://wikka.jsnx.com/GmBowen/show" title="Comments for GmBowen (8)">8</a>-<a style="color:#0000CC" href="http://wikka.jsnx.com/GmBowen/backlinks" title="Pages linking to GmBowen (41)">41</a>-<a style="color:#000000" href="http://wikka.jsnx.com/GmBowen/referrers" title="External sites linking to GmBowen (45)">45</a></center></td> <td><center> <a href="http://wikka.jsnx.com/GmBowen/edit" title="Edit GmBowen">edit</a> :: <a href="http://wikka.jsnx.com/GmBowen/delete" title="Delete GmBowen">delete</a> :: <a href="http://wikka.jsnx.com/GmBowen/clone" title="Clone GmBowen">clone</a> :: rename :: <a href="http://wikka.jsnx.com/GmBowen/acls" title="Change ACLs for GmBowen">acl</a> </center></td> </tr> <tr> <td><input type="checkbox" id="5413" title="Select SandBox"/></td> <td><a href="http://wikka.jsnx.com/SandBox" title="Open SandBox">SandBox</a></td> <td><center>(Public)</center></td> <td><center>ip076155.niehs.nih~</center></td> <td><center><span style="font-size: .8em">2005-01-31 18:59:42</span> (<a href="http://wikka.jsnx.com/SandBox/history" title="Display SandBox's history">-</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/SandBox/revisions" title="Revisions of SandBox (544)">544</a>-<a style="color:#00CC00" href="http://wikka.jsnx.com/SandBox/show" title="Comments for SandBox (6)">6</a>-<a style="color:#0000CC" href="http://wikka.jsnx.com/SandBox/backlinks" title="Pages linking to SandBox (13)">13</a>-<a style="color:#000000" href="http://wikka.jsnx.com/SandBox/referrers" title="External sites linking to SandBox (44)">44</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> </center></td> </tr> <tr> <td><input type="checkbox" id="5411" title="Select TheLounge"/></td> <td><a href="http://wikka.jsnx.com/TheLounge" title="Open TheLounge">TheLounge</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/JavaWoman" title="Go to JavaWoman's homepage">JavaWoman</a></center></td> <td><center><span style="font-size: .8em">2005-01-31 16:39:53</span> (<a href="http://wikka.jsnx.com/TheLounge/history" title="Last edit: added link FAQ about Nicknames">*</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/TheLounge/revisions" title="Revisions of TheLounge (31)">31</a>-<a style="color:#00CC00" href="http://wikka.jsnx.com/TheLounge/show" title="Comments for TheLounge (7)">7</a>-<a style="color:#0000CC" href="http://wikka.jsnx.com/TheLounge/backlinks" title="Pages linking to TheLounge (5)">5</a>-<a style="color:#000000" href="http://wikka.jsnx.com/TheLounge/referrers" title="External sites linking to TheLounge (26)">26</a></center></td> <td><center> <a href="http://wikka.jsnx.com/TheLounge/edit" title="Edit TheLounge">edit</a> :: <a href="http://wikka.jsnx.com/TheLounge/delete" title="Delete TheLounge">delete</a> :: <a href="http://wikka.jsnx.com/TheLounge/clone" title="Clone TheLounge">clone</a> :: rename :: <a href="http://wikka.jsnx.com/TheLounge/acls" title="Change ACLs for TheLounge">acl</a> </center></td> </tr> <tr> <td><input type="checkbox" id="5409" title="Select HandleCsvData"/></td> <td><a href="http://wikka.jsnx.com/HandleCsvData" title="Open HandleCsvData">HandleCsvData</a></td> <td><center><a href="http://wikka.jsnx.com/NilsLindenberg" title="Go to NilsLindenberg's homepage">NilsLindenberg</a></center></td> <td><center><a href="http://wikka.jsnx.com/NilsLindenberg" title="Go to NilsLindenberg's homepage">NilsLindenberg</a></center></td> <td><center><span style="font-size: .8em">2005-01-31 15:25:17</span> (<a href="http://wikka.jsnx.com/HandleCsvData/history" title="Last edit: version 0.3">*</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/HandleCsvData/revisions" title="Revisions of HandleCsvData (5)">5</a>-<span style="color:#00CC00">0</span>-<a style="color:#0000CC" href="http://wikka.jsnx.com/HandleCsvData/backlinks" title="Pages linking to HandleCsvData (3)">3</a>-<span style="color:#000000">0</span></center></td> <td><center> <a href="http://wikka.jsnx.com/HandleCsvData/edit" title="Edit HandleCsvData">edit</a> :: <a href="http://wikka.jsnx.com/HandleCsvData/delete" title="Delete HandleCsvData">delete</a> :: <a href="http://wikka.jsnx.com/HandleCsvData/clone" title="Clone HandleCsvData">clone</a> :: rename :: <a href="http://wikka.jsnx.com/HandleCsvData/acls" title="Change ACLs for HandleCsvData">acl</a> </center></td> </tr> <tr> <td><input type="checkbox" id="5408" title="Select PageAdminAction"/></td> <td><a href="http://wikka.jsnx.com/PageAdminAction" title="Open 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><span style="font-size: .8em">2005-01-31 14:43:34</span> (<a href="http://wikka.jsnx.com/PageAdminAction/history" title="Last edit: Uploading PageAdmin v.0.2.1">*</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/PageAdminAction/revisions" title="Revisions of PageAdminAction (11)">11</a>-<a style="color:#00CC00" href="http://wikka.jsnx.com/PageAdminAction/show" title="Comments for PageAdminAction (1)">1</a>-<a style="color:#0000CC" href="http://wikka.jsnx.com/PageAdminAction/backlinks" title="Pages linking to PageAdminAction (1)">1</a>-<span style="color:#000000">0</span></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> </center></td> </tr> <tr> <td><input type="checkbox" id="5406" title="Select WikkaBlog2"/></td> <td><a href="http://wikka.jsnx.com/WikkaBlog2" title="Open WikkaBlog2">WikkaBlog2</a></td> <td><center><a href="http://wikka.jsnx.com/GmBowen" title="Go to GmBowen's homepage">GmBowen</a></center></td> <td><center><a href="http://wikka.jsnx.com/GmBowen" title="Go to GmBowen's homepage">GmBowen</a></center></td> <td><center><span style="font-size: .8em">2005-01-31 14:38:24</span> (<a href="http://wikka.jsnx.com/WikkaBlog2/history" title="Last edit: update todo list for blog action">*</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/WikkaBlog2/revisions" title="Revisions of WikkaBlog2 (8)">8</a>-<a style="color:#00CC00" href="http://wikka.jsnx.com/WikkaBlog2/show" title="Comments for WikkaBlog2 (9)">9</a>-<a style="color:#0000CC" href="http://wikka.jsnx.com/WikkaBlog2/backlinks" title="Pages linking to WikkaBlog2 (3)">3</a>-<a style="color:#000000" href="http://wikka.jsnx.com/WikkaBlog2/referrers" title="External sites linking to WikkaBlog2 (1)">1</a></center></td> <td><center> <a href="http://wikka.jsnx.com/WikkaBlog2/edit" title="Edit WikkaBlog2">edit</a> :: <a href="http://wikka.jsnx.com/WikkaBlog2/delete" title="Delete WikkaBlog2">delete</a> :: <a href="http://wikka.jsnx.com/WikkaBlog2/clone" title="Clone WikkaBlog2">clone</a> :: rename :: <a href="http://wikka.jsnx.com/WikkaBlog2/acls" title="Change ACLs for WikkaBlog2">acl</a> </center></td> </tr> <tr> <td><input type="checkbox" id="5405" title="Select IanHayhurst"/></td> <td><a href="http://wikka.jsnx.com/IanHayhurst" title="Open IanHayhurst">IanHayhurst</a></td> <td><center><a href="http://wikka.jsnx.com/IanHayhurst" title="Go to IanHayhurst's homepage">IanHayhurst</a></center></td> <td><center><a href="http://wikka.jsnx.com/IanHayhurst" title="Go to IanHayhurst's homepage">IanHayhurst</a></center></td> <td><center><span style="font-size: .8em">2005-01-31 14:01:54</span> (<a href="http://wikka.jsnx.com/IanHayhurst/history" title="Display IanHayhurst's history">-</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/IanHayhurst/revisions" title="Revisions of IanHayhurst (3)">3</a>-<span style="color:#00CC00">0</span>-<span style="color:#0000CC">0</span>-<span style="color:#000000">0</span></center></td> <td><center> <a href="http://wikka.jsnx.com/IanHayhurst/edit" title="Edit IanHayhurst">edit</a> :: <a href="http://wikka.jsnx.com/IanHayhurst/delete" title="Delete IanHayhurst">delete</a> :: <a href="http://wikka.jsnx.com/IanHayhurst/clone" title="Clone IanHayhurst">clone</a> :: rename :: <a href="http://wikka.jsnx.com/IanHayhurst/acls" title="Change ACLs for IanHayhurst">acl</a> </center></td> </tr> <tr> <td><input type="checkbox" id="5402" title="Select FlexibleWikka"/></td> <td><a href="http://wikka.jsnx.com/FlexibleWikka" title="Open FlexibleWikka">FlexibleWikka</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><span style="font-size: .8em">2005-01-31 11:31:31</span> (<a href="http://wikka.jsnx.com/FlexibleWikka/history" title="Last edit: Adding link">*</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/FlexibleWikka/revisions" title="Revisions of FlexibleWikka (14)">14</a>-<a style="color:#00CC00" href="http://wikka.jsnx.com/FlexibleWikka/show" title="Comments for FlexibleWikka (4)">4</a>-<a style="color:#0000CC" href="http://wikka.jsnx.com/FlexibleWikka/backlinks" title="Pages linking to FlexibleWikka (7)">7</a>-<a style="color:#000000" href="http://wikka.jsnx.com/FlexibleWikka/referrers" title="External sites linking to FlexibleWikka (20)">20</a></center></td> <td><center> <a href="http://wikka.jsnx.com/FlexibleWikka/edit" title="Edit FlexibleWikka">edit</a> :: <a href="http://wikka.jsnx.com/FlexibleWikka/delete" title="Delete FlexibleWikka">delete</a> :: <a href="http://wikka.jsnx.com/FlexibleWikka/clone" title="Clone FlexibleWikka">clone</a> :: rename :: <a href="http://wikka.jsnx.com/FlexibleWikka/acls" title="Change ACLs for FlexibleWikka">acl</a> </center></td> </tr> <tr> <td><input type="checkbox" id="5401" title="Select CodeContributions"/></td> <td><a href="http://wikka.jsnx.com/CodeContributions" title="Open CodeContributions">CodeContributio~</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><span style="font-size: .8em">2005-01-31 11:29:49</span> (<a href="http://wikka.jsnx.com/CodeContributions/history" title="Last edit: Adding link">*</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/CodeContributions/revisions" title="Revisions of CodeContributions (79)">79</a>-<a style="color:#00CC00" href="http://wikka.jsnx.com/CodeContributions/show" title="Comments for CodeContributions (3)">3</a>-<a style="color:#0000CC" href="http://wikka.jsnx.com/CodeContributions/backlinks" title="Pages linking to CodeContributions (8)">8</a>-<a style="color:#000000" href="http://wikka.jsnx.com/CodeContributions/referrers" title="External sites linking to CodeContributions (12)">12</a></center></td> <td><center> <a href="http://wikka.jsnx.com/CodeContributions/edit" title="Edit CodeContributions">edit</a> :: <a href="http://wikka.jsnx.com/CodeContributions/delete" title="Delete CodeContributions">delete</a> :: <a href="http://wikka.jsnx.com/CodeContributions/clone" title="Clone CodeContributions">clone</a> :: rename :: <a href="http://wikka.jsnx.com/CodeContributions/acls" title="Change ACLs for CodeContributions">acl</a> </center></td> </tr></table></div><br />[<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.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).
~~&The standard symbol for truncated text is of course the ellipsis (... or rather …) - why not use that? --JavaWoman
**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;1)
<?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');
}
?>
%%
----
CategoryDevelopmentActions CategoryDevelopmentAdmin
>>==See also:==
~-AdminModules
~-RefactorWiki
~-MovePages
~-Are you an administrator of this site ? --- Give it a [[PageAdminTest try]]---''(temporarily broken - see WikkaBetaFeatures and WikkaCountingRecords)''
>>
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.::c::
----
== Sample output ==
=====Page Administration=====
""
<form action="#" method="post">
<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><div style="float:left; padding:10px; border:1px dotted #AAA; background-color:#EEE; width:60%">Search page by name: <input type ="text" name="q" title="Enter a search string" size="20" maxlength="50" value=" "/><input type="submit" value="Submit" accesskey="a" /><br /><br />Show <select name="l" title="Select records-per-page limit"><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><option value="480" >480</option></select> records per page <input type="submit" value="Apply" accesskey="a" /><br /><br />[Records (471): <strong>1-10</strong> | <a href="http://wikka.jsnx.com/PageAdminTest?l=10&sort=time&d=desc&s=10&q=" title="Show records from 11 to 20">11-20</a> (sorted by: <em>time, desc</em> )]</div></form>
<form action="#" method="get">
<div class="pagedata" style="clear:both"><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>Page Statistics</th> <th>Page Handlers</th> </tr> <tr> <td><input type="checkbox" id="5416" title="Select InitializeSessionWorkaround"/></td> <td><a href="http://wikka.jsnx.com/InitializeSessionWorkaround" title="Open InitializeSessionWorkaround">InitializeSessi~</a></td> <td><center>FreekNL</center></td> <td><center>FreekNL</center></td> <td><center><span style="font-size: .8em">2005-01-31 21:58:56</span> (<a href="http://wikka.jsnx.com/InitializeSessionWorkaround/history" title="Display InitializeSessionWorkaround's history">-</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/InitializeSessionWorkaround/revisions" title="Revisions of InitializeSessionWorkaround (1)">1</a>-<span style="color:#00CC00">0</span>-<span style="color:#0000CC">0</span>-<span style="color:#000000">0</span></center></td> <td><center> <a href="http://wikka.jsnx.com/InitializeSessionWorkaround/edit" title="Edit InitializeSessionWorkaround">edit</a> :: <a href="http://wikka.jsnx.com/InitializeSessionWorkaround/delete" title="Delete InitializeSessionWorkaround">delete</a> :: <a href="http://wikka.jsnx.com/InitializeSessionWorkaround/clone" title="Clone InitializeSessionWorkaround">clone</a> :: rename :: <a href="http://wikka.jsnx.com/InitializeSessionWorkaround/acls" title="Change ACLs for InitializeSessionWorkaround">acl</a> </center></td> </tr> <tr> <td><input type="checkbox" id="5415" title="Select GmBowen"/></td> <td><a href="http://wikka.jsnx.com/GmBowen" title="Open GmBowen">GmBowen</a></td> <td><center><a href="http://wikka.jsnx.com/GmBowen" title="Go to GmBowen's homepage">GmBowen</a></center></td> <td><center><a href="http://wikka.jsnx.com/GmBowen" title="Go to GmBowen's homepage">GmBowen</a></center></td> <td><center><span style="font-size: .8em">2005-01-31 19:54:17</span> (<a href="http://wikka.jsnx.com/GmBowen/history" title="Display GmBowen's history">-</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/GmBowen/revisions" title="Revisions of GmBowen (125)">125</a>-<a style="color:#00CC00" href="http://wikka.jsnx.com/GmBowen/show" title="Comments for GmBowen (8)">8</a>-<a style="color:#0000CC" href="http://wikka.jsnx.com/GmBowen/backlinks" title="Pages linking to GmBowen (41)">41</a>-<a style="color:#000000" href="http://wikka.jsnx.com/GmBowen/referrers" title="External sites linking to GmBowen (45)">45</a></center></td> <td><center> <a href="http://wikka.jsnx.com/GmBowen/edit" title="Edit GmBowen">edit</a> :: <a href="http://wikka.jsnx.com/GmBowen/delete" title="Delete GmBowen">delete</a> :: <a href="http://wikka.jsnx.com/GmBowen/clone" title="Clone GmBowen">clone</a> :: rename :: <a href="http://wikka.jsnx.com/GmBowen/acls" title="Change ACLs for GmBowen">acl</a> </center></td> </tr> <tr> <td><input type="checkbox" id="5413" title="Select SandBox"/></td> <td><a href="http://wikka.jsnx.com/SandBox" title="Open SandBox">SandBox</a></td> <td><center>(Public)</center></td> <td><center>ip076155.niehs.nih~</center></td> <td><center><span style="font-size: .8em">2005-01-31 18:59:42</span> (<a href="http://wikka.jsnx.com/SandBox/history" title="Display SandBox's history">-</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/SandBox/revisions" title="Revisions of SandBox (544)">544</a>-<a style="color:#00CC00" href="http://wikka.jsnx.com/SandBox/show" title="Comments for SandBox (6)">6</a>-<a style="color:#0000CC" href="http://wikka.jsnx.com/SandBox/backlinks" title="Pages linking to SandBox (13)">13</a>-<a style="color:#000000" href="http://wikka.jsnx.com/SandBox/referrers" title="External sites linking to SandBox (44)">44</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> </center></td> </tr> <tr> <td><input type="checkbox" id="5411" title="Select TheLounge"/></td> <td><a href="http://wikka.jsnx.com/TheLounge" title="Open TheLounge">TheLounge</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/JavaWoman" title="Go to JavaWoman's homepage">JavaWoman</a></center></td> <td><center><span style="font-size: .8em">2005-01-31 16:39:53</span> (<a href="http://wikka.jsnx.com/TheLounge/history" title="Last edit: added link FAQ about Nicknames">*</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/TheLounge/revisions" title="Revisions of TheLounge (31)">31</a>-<a style="color:#00CC00" href="http://wikka.jsnx.com/TheLounge/show" title="Comments for TheLounge (7)">7</a>-<a style="color:#0000CC" href="http://wikka.jsnx.com/TheLounge/backlinks" title="Pages linking to TheLounge (5)">5</a>-<a style="color:#000000" href="http://wikka.jsnx.com/TheLounge/referrers" title="External sites linking to TheLounge (26)">26</a></center></td> <td><center> <a href="http://wikka.jsnx.com/TheLounge/edit" title="Edit TheLounge">edit</a> :: <a href="http://wikka.jsnx.com/TheLounge/delete" title="Delete TheLounge">delete</a> :: <a href="http://wikka.jsnx.com/TheLounge/clone" title="Clone TheLounge">clone</a> :: rename :: <a href="http://wikka.jsnx.com/TheLounge/acls" title="Change ACLs for TheLounge">acl</a> </center></td> </tr> <tr> <td><input type="checkbox" id="5409" title="Select HandleCsvData"/></td> <td><a href="http://wikka.jsnx.com/HandleCsvData" title="Open HandleCsvData">HandleCsvData</a></td> <td><center><a href="http://wikka.jsnx.com/NilsLindenberg" title="Go to NilsLindenberg's homepage">NilsLindenberg</a></center></td> <td><center><a href="http://wikka.jsnx.com/NilsLindenberg" title="Go to NilsLindenberg's homepage">NilsLindenberg</a></center></td> <td><center><span style="font-size: .8em">2005-01-31 15:25:17</span> (<a href="http://wikka.jsnx.com/HandleCsvData/history" title="Last edit: version 0.3">*</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/HandleCsvData/revisions" title="Revisions of HandleCsvData (5)">5</a>-<span style="color:#00CC00">0</span>-<a style="color:#0000CC" href="http://wikka.jsnx.com/HandleCsvData/backlinks" title="Pages linking to HandleCsvData (3)">3</a>-<span style="color:#000000">0</span></center></td> <td><center> <a href="http://wikka.jsnx.com/HandleCsvData/edit" title="Edit HandleCsvData">edit</a> :: <a href="http://wikka.jsnx.com/HandleCsvData/delete" title="Delete HandleCsvData">delete</a> :: <a href="http://wikka.jsnx.com/HandleCsvData/clone" title="Clone HandleCsvData">clone</a> :: rename :: <a href="http://wikka.jsnx.com/HandleCsvData/acls" title="Change ACLs for HandleCsvData">acl</a> </center></td> </tr> <tr> <td><input type="checkbox" id="5408" title="Select PageAdminAction"/></td> <td><a href="http://wikka.jsnx.com/PageAdminAction" title="Open 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><span style="font-size: .8em">2005-01-31 14:43:34</span> (<a href="http://wikka.jsnx.com/PageAdminAction/history" title="Last edit: Uploading PageAdmin v.0.2.1">*</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/PageAdminAction/revisions" title="Revisions of PageAdminAction (11)">11</a>-<a style="color:#00CC00" href="http://wikka.jsnx.com/PageAdminAction/show" title="Comments for PageAdminAction (1)">1</a>-<a style="color:#0000CC" href="http://wikka.jsnx.com/PageAdminAction/backlinks" title="Pages linking to PageAdminAction (1)">1</a>-<span style="color:#000000">0</span></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> </center></td> </tr> <tr> <td><input type="checkbox" id="5406" title="Select WikkaBlog2"/></td> <td><a href="http://wikka.jsnx.com/WikkaBlog2" title="Open WikkaBlog2">WikkaBlog2</a></td> <td><center><a href="http://wikka.jsnx.com/GmBowen" title="Go to GmBowen's homepage">GmBowen</a></center></td> <td><center><a href="http://wikka.jsnx.com/GmBowen" title="Go to GmBowen's homepage">GmBowen</a></center></td> <td><center><span style="font-size: .8em">2005-01-31 14:38:24</span> (<a href="http://wikka.jsnx.com/WikkaBlog2/history" title="Last edit: update todo list for blog action">*</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/WikkaBlog2/revisions" title="Revisions of WikkaBlog2 (8)">8</a>-<a style="color:#00CC00" href="http://wikka.jsnx.com/WikkaBlog2/show" title="Comments for WikkaBlog2 (9)">9</a>-<a style="color:#0000CC" href="http://wikka.jsnx.com/WikkaBlog2/backlinks" title="Pages linking to WikkaBlog2 (3)">3</a>-<a style="color:#000000" href="http://wikka.jsnx.com/WikkaBlog2/referrers" title="External sites linking to WikkaBlog2 (1)">1</a></center></td> <td><center> <a href="http://wikka.jsnx.com/WikkaBlog2/edit" title="Edit WikkaBlog2">edit</a> :: <a href="http://wikka.jsnx.com/WikkaBlog2/delete" title="Delete WikkaBlog2">delete</a> :: <a href="http://wikka.jsnx.com/WikkaBlog2/clone" title="Clone WikkaBlog2">clone</a> :: rename :: <a href="http://wikka.jsnx.com/WikkaBlog2/acls" title="Change ACLs for WikkaBlog2">acl</a> </center></td> </tr> <tr> <td><input type="checkbox" id="5405" title="Select IanHayhurst"/></td> <td><a href="http://wikka.jsnx.com/IanHayhurst" title="Open IanHayhurst">IanHayhurst</a></td> <td><center><a href="http://wikka.jsnx.com/IanHayhurst" title="Go to IanHayhurst's homepage">IanHayhurst</a></center></td> <td><center><a href="http://wikka.jsnx.com/IanHayhurst" title="Go to IanHayhurst's homepage">IanHayhurst</a></center></td> <td><center><span style="font-size: .8em">2005-01-31 14:01:54</span> (<a href="http://wikka.jsnx.com/IanHayhurst/history" title="Display IanHayhurst's history">-</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/IanHayhurst/revisions" title="Revisions of IanHayhurst (3)">3</a>-<span style="color:#00CC00">0</span>-<span style="color:#0000CC">0</span>-<span style="color:#000000">0</span></center></td> <td><center> <a href="http://wikka.jsnx.com/IanHayhurst/edit" title="Edit IanHayhurst">edit</a> :: <a href="http://wikka.jsnx.com/IanHayhurst/delete" title="Delete IanHayhurst">delete</a> :: <a href="http://wikka.jsnx.com/IanHayhurst/clone" title="Clone IanHayhurst">clone</a> :: rename :: <a href="http://wikka.jsnx.com/IanHayhurst/acls" title="Change ACLs for IanHayhurst">acl</a> </center></td> </tr> <tr> <td><input type="checkbox" id="5402" title="Select FlexibleWikka"/></td> <td><a href="http://wikka.jsnx.com/FlexibleWikka" title="Open FlexibleWikka">FlexibleWikka</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><span style="font-size: .8em">2005-01-31 11:31:31</span> (<a href="http://wikka.jsnx.com/FlexibleWikka/history" title="Last edit: Adding link">*</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/FlexibleWikka/revisions" title="Revisions of FlexibleWikka (14)">14</a>-<a style="color:#00CC00" href="http://wikka.jsnx.com/FlexibleWikka/show" title="Comments for FlexibleWikka (4)">4</a>-<a style="color:#0000CC" href="http://wikka.jsnx.com/FlexibleWikka/backlinks" title="Pages linking to FlexibleWikka (7)">7</a>-<a style="color:#000000" href="http://wikka.jsnx.com/FlexibleWikka/referrers" title="External sites linking to FlexibleWikka (20)">20</a></center></td> <td><center> <a href="http://wikka.jsnx.com/FlexibleWikka/edit" title="Edit FlexibleWikka">edit</a> :: <a href="http://wikka.jsnx.com/FlexibleWikka/delete" title="Delete FlexibleWikka">delete</a> :: <a href="http://wikka.jsnx.com/FlexibleWikka/clone" title="Clone FlexibleWikka">clone</a> :: rename :: <a href="http://wikka.jsnx.com/FlexibleWikka/acls" title="Change ACLs for FlexibleWikka">acl</a> </center></td> </tr> <tr> <td><input type="checkbox" id="5401" title="Select CodeContributions"/></td> <td><a href="http://wikka.jsnx.com/CodeContributions" title="Open CodeContributions">CodeContributio~</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><span style="font-size: .8em">2005-01-31 11:29:49</span> (<a href="http://wikka.jsnx.com/CodeContributions/history" title="Last edit: Adding link">*</a>)</center></td> <td><center><span style="color:#666">0</span>-<a style="color:#CC0000" href="http://wikka.jsnx.com/CodeContributions/revisions" title="Revisions of CodeContributions (79)">79</a>-<a style="color:#00CC00" href="http://wikka.jsnx.com/CodeContributions/show" title="Comments for CodeContributions (3)">3</a>-<a style="color:#0000CC" href="http://wikka.jsnx.com/CodeContributions/backlinks" title="Pages linking to CodeContributions (8)">8</a>-<a style="color:#000000" href="http://wikka.jsnx.com/CodeContributions/referrers" title="External sites linking to CodeContributions (12)">12</a></center></td> <td><center> <a href="http://wikka.jsnx.com/CodeContributions/edit" title="Edit CodeContributions">edit</a> :: <a href="http://wikka.jsnx.com/CodeContributions/delete" title="Delete CodeContributions">delete</a> :: <a href="http://wikka.jsnx.com/CodeContributions/clone" title="Clone CodeContributions">clone</a> :: rename :: <a href="http://wikka.jsnx.com/CodeContributions/acls" title="Change ACLs for CodeContributions">acl</a> </center></td> </tr></table></div><br />[<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.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).
~~&The standard symbol for truncated text is of course the ellipsis (... or rather …) - why not use that? --JavaWoman
**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;1)
<?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');
}
?>
%%
----
CategoryDevelopmentActions CategoryDevelopmentAdmin
Deletions:
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