SF.net SVN: phpwiki:[10804] trunk/lib/plugin/WikiAdminPurge.php

vargenau--- via phpwiki-checkins <[email protected]>
Newsgroups gmane.comp.web.wiki.phpwiki.checkins
Message-ID <[email protected]>
Revision: 10804
          http://sourceforge.net/p/phpwiki/code/10804
Author:   vargenau
Date:     2022-01-02 12:05:05 +0000 (Sun, 02 Jan 2022)
Log Message:
-----------
WikiAdminPurge: add new column "Purge" (like in WikiAdminRemove)

Modified Paths:
--------------
    trunk/lib/plugin/WikiAdminPurge.php

Modified: trunk/lib/plugin/WikiAdminPurge.php
===================================================================
--- trunk/lib/plugin/WikiAdminPurge.php	2022-01-01 13:06:07 UTC (rev 10803)
+++ trunk/lib/plugin/WikiAdminPurge.php	2022-01-02 12:05:05 UTC (rev 10804)
@@ -25,6 +25,7 @@
 
 /**
  * Usage:   <<WikiAdminPurge>>
+ * Author:  Marc-Etienne Vargenau, based on WikiAdminRemove by Reini Urban
  */
 
 require_once 'lib/PageList.php';
@@ -117,7 +118,7 @@
         if ($p && $request->isPost() &&
             !empty($post_args['purge']) && empty($post_args['cancel'])
         ) {
-            // without individual PagePermissions:
+            // check individual PagePermissions
             if (!ENABLE_PAGEPERM and !$request->_user->isAdmin()) {
                 $request->_notAuthorized(WIKIAUTH_ADMIN);
                 $this->disabled("! user->isAdmin");
@@ -147,7 +148,10 @@
         }
 
         $header = HTML::fieldset();
-        $pagelist = new PageList_Selectable($args['info'], $args['exclude'], array());
+        $pagelist = new PageList_Selectable($args['info'], $args['exclude'],
+            array('types' =>
+            array('purge'
+            => new PageList_Column_purge('purge', _("Purge")))));
         $pagelist->addPageList($pages);
         if ($next_action == 'verify') {
             $button_label = _("Yes");
@@ -175,3 +179,12 @@
                 'require_authority_for_post' => WIKIAUTH_ADMIN)));
     }
 }
+
+class PageList_Column_purge extends _PageList_Column
+{
+    function _getValue($page_handle, $revision_handle)
+    {
+        return Button(array('action' => 'purge'), _("Purge"),
+            $page_handle->getName());
+    }
+}

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.