From: <var...@us...> - 2021-08-09 13:47:18
|
Revision: 10464 http://sourceforge.net/p/phpwiki/code/10464 Author: vargenau Date: 2021-08-09 13:47:12 +0000 (Mon, 09 Aug 2021) Log Message: ----------- lib/plugin/WikiAdminUtils.php: revert, use Alert again Modified Paths: -------------- trunk/lib/plugin/WikiAdminUtils.php Modified: trunk/lib/plugin/WikiAdminUtils.php =================================================================== --- trunk/lib/plugin/WikiAdminUtils.php 2021-08-09 13:43:43 UTC (rev 10463) +++ trunk/lib/plugin/WikiAdminUtils.php 2021-08-09 13:47:12 UTC (rev 10464) @@ -107,14 +107,12 @@ $message = call_user_func(array(&$this, $method), $request, $args); - // If needed, clean URL of previous message, remove '?' and after - $return_url = $args['return_url']; - if (strpos($return_url, '?')) { - $return_url = substr($return_url, 0, strpos($return_url, '?')); - } - $url = WikiURL($return_url, array('warningmsg' => $message)); - - return $request->redirect($url); + // display as separate page or as alert? + $alert = new Alert(fmt("WikiAdminUtils %s returned:", $args['action']), + $message, + array(_("Back") => $args['return_url'])); + $alert->show(); // noreturn + return ''; } private function _getLabel($action) @@ -143,7 +141,7 @@ { $dbi = $request->getDbh(); $count = 0; - $list = ''; + $list = HTML::ol(array('class' => 'align-left')); $pages = $dbi->getAllPages('include_empty'); // Do we really want the empty ones too? while (($page = $pages->next())) { $pagename = $page->getName(); @@ -150,7 +148,7 @@ $wpn = new WikiPageName($pagename); if (!$wpn->isValid()) { $dbi->purgePage($pagename); - $list .= "\n" . $pagename; + $list->pushContent(HTML::li($pagename)); $count++; } } @@ -158,7 +156,8 @@ if (!$count) { return _("No pages with bad names had to be deleted."); } else { - return fmt("Deleted %d pages with invalid names:", $count) . $list; + return HTML(fmt("Deleted %d pages with invalid names:", $count), + HTML::div(array('class' => 'align-left'), $list)); } } @@ -174,7 +173,7 @@ $dbi = $request->getDbh(); $count = 0; $notpurgable = 0; - $list = ''; + $list = HTML::ol(array('class' => 'align-left')); $pages = $dbi->getAllPages('include_empty'); while (($page = $pages->next())) { if (!$page->exists() @@ -183,10 +182,10 @@ ) { $pagename = $page->getName(); if ($pagename == 'global_data' or $pagename == '.') continue; - if ($dbi->purgePage($pagename)) { - $list .= "\n" . $pagename . ' ' . _("[purged]"); - } else { - $list .= "\n" . $pagename . ' ' . _("[not purgable]"); + if ($dbi->purgePage($pagename)) + $list->pushContent(HTML::li($pagename . ' ' . _("[purged]"))); + else { + $list->pushContent(HTML::li($pagename . ' ' . _("[not purgable]"))); $notpurgable++; } $count++; @@ -196,11 +195,12 @@ if (!$count) { return _("No empty, unreferenced pages were found."); } else { - return fmt("Deleted %d unreferenced pages:", $count) . $list - . ($notpurgable ? + return HTML(fmt("Deleted %d unreferenced pages:", $count), + HTML::div(array('class' => 'align-left'), $list), + ($notpurgable ? fmt("The %d not-purgable pages/links are links in some page(s). You might want to edit them.", $notpurgable) - : ''); + : '')); } } @@ -229,7 +229,7 @@ } // pagelist with enable/disable button - private function _do_email_verification($request, &$args) + private function _do_email_verification($request, $args) { $dbi = $request->getDbh(); $pagelist = new PageList('pagename', array(), $args); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |