From: <var...@us...> - 2009-06-23 17:54:24
|
Revision: 6952 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6952&view=rev Author: vargenau Date: 2009-06-23 17:54:20 +0000 (Tue, 23 Jun 2009) Log Message: ----------- Better user interface and feedback messages Modified Paths: -------------- trunk/lib/plugin/WikiAdminChown.php trunk/lib/plugin/WikiAdminMarkup.php trunk/lib/plugin/WikiAdminPurge.php trunk/lib/plugin/WikiAdminRemove.php trunk/lib/plugin/WikiAdminRename.php trunk/lib/plugin/WikiAdminSearchReplace.php trunk/lib/plugin/WikiAdminSetAcl.php trunk/lib/plugin/WikiAdminSetExternal.php Modified: trunk/lib/plugin/WikiAdminChown.php =================================================================== --- trunk/lib/plugin/WikiAdminChown.php 2009-06-23 09:31:35 UTC (rev 6951) +++ trunk/lib/plugin/WikiAdminChown.php 2009-06-23 17:54:20 UTC (rev 6952) @@ -60,6 +60,7 @@ } function chownPages(&$dbi, &$request, $pages, $newowner) { + $result = HTML::div(); $ul = HTML::ul(); $count = 0; foreach ($pages as $name) { @@ -74,7 +75,7 @@ $version = $current->getVersion(); $meta = $current->_data; $text = $current->getPackedContent(); - $meta['summary'] = sprintf(_("Change page owner from %s to %s"), $owner, $newowner); + $meta['summary'] = "Change page owner from '".$owner."' to '".$newowner."'"; $meta['is_minor_edit'] = 0; $meta['author'] = $request->_user->UserName(); unset($meta['mtime']); // force new date @@ -93,10 +94,18 @@ } if ($count) { $dbi->touch(); - return HTML($ul, HTML::p(fmt("%s pages have been permanently changed.", - $count))); + $result->setAttr('class', 'feedback'); + if ($count == 1) { + $result->pushContent(HTML::p("One page has been permanently changed:")); + } else { + $result->pushContent(HTML::p(fmt("%s pages have been permanently changed:", $count))); + } + $result->pushContent($ul); + return $result; } else { - return HTML($ul, HTML::p(fmt("No pages changed."))); + $result->setAttr('class', 'error'); + $result->pushContent(HTML::p("No pages changed.")); + return $result; } } @@ -155,10 +164,14 @@ $args['info'] = "checkbox,pagename,owner,mtime"; } */ - $pagelist = new PageList_Selectable($args['info'], $args['exclude'], $args); + if ($next_action == 'select') { + $pagelist = new PageList_Selectable($args['info'], $args['exclude'], $args); + } else { + $pagelist = new PageList_Unselectable($args['info'], $args['exclude'], $args); + } $pagelist->addPageList($pages); - $header = HTML::div(); + $header = HTML::fieldset(); if ($next_action == 'verify') { $button_label = _("Yes"); $header->pushContent( @@ -168,17 +181,17 @@ } else { $button_label = _("Change owner of selected pages"); - $header->pushContent(HTML::p(_("Select the pages to change the owner:"))); + $header->pushContent(HTML::legend(_("Select the pages to change the owner"))); $header = $this->chownForm($header, $post_args); } $buttons = HTML::p(Button('submit:admin_chown[chown]', $button_label, 'wikiadmin'), Button('submit:admin_chown[cancel]', _("Cancel"), 'button')); + $header->pushContent($buttons); return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, - $buttons, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, @@ -193,7 +206,8 @@ $header->pushContent(_("Change owner")." "); $header->pushContent(' '._("to").': '); $header->pushContent(HTML::input(array('name' => 'admin_chown[user]', - 'value' => $post_args['user']))); + 'value' => $post_args['user'], + 'size' => 40))); return $header; } } Modified: trunk/lib/plugin/WikiAdminMarkup.php =================================================================== --- trunk/lib/plugin/WikiAdminMarkup.php 2009-06-23 09:31:35 UTC (rev 6951) +++ trunk/lib/plugin/WikiAdminMarkup.php 2009-06-23 17:54:20 UTC (rev 6952) @@ -98,7 +98,11 @@ if ($count) { $dbi->touch(); $result->setAttr('class', 'feedback'); - $result->pushContent(HTML::p(fmt("%s pages have been permanently changed:", $count))); + if ($count == 1) { + $result->pushContent(HTML::p("One page has been permanently changed:")); + } else { + $result->pushContent(HTML::p(fmt("%s pages have been permanently changed:", $count))); + } $result->pushContent($ul); return $result; } else { Modified: trunk/lib/plugin/WikiAdminPurge.php =================================================================== --- trunk/lib/plugin/WikiAdminPurge.php 2009-06-23 09:31:35 UTC (rev 6951) +++ trunk/lib/plugin/WikiAdminPurge.php 2009-06-23 17:54:20 UTC (rev 6952) @@ -55,10 +55,23 @@ } function collectPages(&$list, &$dbi, $sortby, $limit=0) { + + $allPages = $dbi->getAllPages('include_empty',$sortby,$limit); + while ($pagehandle = $allPages->next()) { + $pagename = $pagehandle->getName(); + $current = $pagehandle->getCurrentRevision(); + if ($current->getVersion() < 1) { + continue; // No versions in database + } + if (empty($list[$pagename])) { + $list[$pagename] = false; + } + } return $list; } function purgePages(&$request, $pages) { + $result = HTML::div(); $ul = HTML::ul(); $dbi = $request->getDbh(); $count = 0; foreach ($pages as $name) { @@ -71,11 +84,23 @@ $ul->pushContent(HTML::li(fmt("Didn't purge page '%s'. Access denied.", $name))); } } - if ($count) $dbi->touch(); - return HTML($ul, - HTML::p(fmt("%d pages have been permanently purged.",$count))); + if ($count) { + $dbi->touch(); + $result->setAttr('class', 'feedback'); + if ($count == 1) { + $result->pushContent(HTML::p("One page has been permanently purged:")); + } else { + $result->pushContent(HTML::p(fmt("%s pages have been permanently purged:", $count))); + } + $result->pushContent($ul); + return $result; + } else { + $result->setAttr('class', 'error'); + $result->pushContent(HTML::p("No pages purged.")); + return $result; + } } - + function run($dbi, $argstr, &$request, $basepage) { if ($request->getArg('action') != 'browse') if ($request->getArg('action') != _("PhpWikiAdministration/Purge")) @@ -126,25 +151,25 @@ $pagelist = new PageList_Selectable($args['info'], $args['exclude'], array()); $pagelist->addPageList($pages); - $header = HTML::p(); + $header = HTML::fieldset(); if ($next_action == 'verify') { $button_label = _("Yes"); - $header->pushContent(HTML::strong( - _("Are you sure you want to permanently purge the following files?"))); + $header->pushContent(HTML::p(HTML::strong( + _("Are you sure you want to permanently purge the following files?")))); } else { - $button_label = _("Purge selected pages"); - $header->pushContent(_("Permanently purge the selected files:"),HTML::br()); + $button_label = _("Permanently purge selected pages"); + $header->pushContent(HTML::legend(_("Select the files to purge"))); } $buttons = HTML::p(Button('submit:admin_purge[purge]', $button_label, 'wikiadmin'), Button('submit:admin_purge[cancel]', _("Cancel"), 'button')); + $header->pushContent($buttons); // TODO: quick select by regex javascript? return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, - $buttons, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, Modified: trunk/lib/plugin/WikiAdminRemove.php =================================================================== --- trunk/lib/plugin/WikiAdminRemove.php 2009-06-23 09:31:35 UTC (rev 6951) +++ trunk/lib/plugin/WikiAdminRemove.php 2009-06-23 17:54:20 UTC (rev 6952) @@ -2,7 +2,7 @@ rcs_id('$Id$'); /* Copyright 2002,2004 $ThePhpWikiProgrammingTeam - Copyright 2008 Marc-Etienne Vargenau, Alcatel-Lucent + Copyright 2008-2009 Marc-Etienne Vargenau, Alcatel-Lucent This file is part of PhpWiki. @@ -108,6 +108,7 @@ } function removePages(&$request, $pages) { + $result = HTML::div(); $ul = HTML::ul(); $dbi = $request->getDbh(); $count = 0; foreach ($pages as $name) { @@ -120,9 +121,21 @@ $ul->pushContent(HTML::li(fmt("Didn't remove page '%s'. Access denied.", $name))); } } - if ($count) $dbi->touch(); - return HTML($ul, - HTML::p(fmt("%d pages have been permanently removed.",$count))); + if ($count) { + $dbi->touch(); + $result->setAttr('class', 'feedback'); + if ($count == 1) { + $result->pushContent(HTML::p("One page has been permanently removed:")); + } else { + $result->pushContent(HTML::p(fmt("%s pages have been permanently removed:", $count))); + } + $result->pushContent($ul); + return $result; + } else { + $result->setAttr('class', 'error'); + $result->pushContent(HTML::p("No pages removed.")); + return $result; + } } function run($dbi, $argstr, &$request, $basepage) { @@ -184,41 +197,37 @@ => new _PageList_Column_remove('remove', _("Remove"))))); $pagelist->addPageList($pages); - $header = HTML::p(); + $header = HTML::fieldset(); if ($next_action == 'verify') { $button_label = _("Yes"); - $header->pushContent(HTML::strong( - _("Are you sure you want to permanently remove the selected files?"))); + $header->pushContent(HTML::p(HTML::strong( + _("Are you sure you want to permanently remove the selected files?")))); } else { $button_label = _("Remove selected pages"); - $header->pushContent(_("Permanently remove the selected files:"),HTML::br()); + $header->pushContent(HTML::legend(_("Select the files to remove"))); if ($args['min_age'] > 0) { $header->pushContent( fmt("Also pages which have been deleted at least %s days.", $args['min_age'])); } - else { - $header->pushContent(_("List all pages.")); - } - + if ($args['max_age'] > 0) { $header->pushContent( " ", - fmt("(Pages which have been deleted at least %s days are already checked.)", + fmt("Pages which have been deleted at least %s days are already checked.", $args['max_age'])); } } - $buttons = HTML::p(Button('submit:admin_remove[remove]', $button_label, 'wikiadmin'), Button('submit:admin_remove[cancel]', _("Cancel"), 'button')); + $header->pushContent($buttons); // TODO: quick select by regex javascript? return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, - $buttons, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, Modified: trunk/lib/plugin/WikiAdminRename.php =================================================================== --- trunk/lib/plugin/WikiAdminRename.php 2009-06-23 09:31:35 UTC (rev 6951) +++ trunk/lib/plugin/WikiAdminRename.php 2009-06-23 17:54:20 UTC (rev 6952) @@ -81,7 +81,7 @@ and $newname != $name ) { if ($dbi->isWikiPage($newname)) - $ul->pushContent(HTML::li(fmt("Page %s already exists. Ignored.", + $ul->pushContent(HTML::li(fmt("Page '%s' already exists. Ignored.", WikiLink($newname)))); elseif (! mayAccessPage('edit', $name)) $ul->pushContent(HTML::li(fmt("Access denied to rename page '%s'.", @@ -121,17 +121,21 @@ if ($count) { $dbi->touch(); $result->setAttr('class', 'feedback'); - $result->pushContent(HTML::p(fmt("%s pages have been permanently renamed:", $count))); + if ($count == 1) { + $result->pushContent(HTML::p("One page has been permanently renamed:")); + } else { + $result->pushContent(HTML::p(fmt("%s pages have been permanently renamed:", $count))); + } $result->pushContent($ul); return $result; } else { $result->setAttr('class', 'error'); - $result->pushContent(HTML::p(fmt("No pages renamed:"))); + $result->pushContent(HTML::p(fmt("No pages renamed."))); $result->pushContent($ul); return $result; } } - + function run($dbi, $argstr, &$request, $basepage) { $action = $request->getArg('action'); if ($action != 'browse' and $action != 'rename' Modified: trunk/lib/plugin/WikiAdminSearchReplace.php =================================================================== --- trunk/lib/plugin/WikiAdminSearchReplace.php 2009-06-23 09:31:35 UTC (rev 6951) +++ trunk/lib/plugin/WikiAdminSearchReplace.php 2009-06-23 17:54:20 UTC (rev 6952) @@ -92,6 +92,7 @@ function searchReplacePages(&$dbi, &$request, $pages, $from, $to) { if (empty($from)) return HTML::p(HTML::strong(fmt("Error: Empty search string."))); + $result = HTML::div(); $ul = HTML::ul(); $count = 0; $post_args = $request->getArg('admin_replace'); @@ -100,8 +101,7 @@ foreach ($pages as $pagename) { if (!mayAccessPage('edit', $pagename)) { $ul->pushContent(HTML::li(fmt("Access denied to change page '%s'.",$pagename))); - } elseif (($result = $this->replaceHelper($dbi, $request, $pagename, $from, $to, - $case_exact, $regex))) + } elseif ($this->replaceHelper($dbi, $request, $pagename, $from, $to, $case_exact, $regex)) { $ul->pushContent(HTML::li(fmt("Replaced '%s' with '%s' in page '%s'.", $from, $to, WikiLink($pagename)))); @@ -113,11 +113,18 @@ } if ($count) { $dbi->touch(); - return HTML($ul, - HTML::p(fmt("%s pages changed.",$count))); + $result->setAttr('class', 'feedback'); + if ($count == 1) { + $result->pushContent(HTML::p("One page has been permanently changed:")); + } else { + $result->pushContent(HTML::p(fmt("%s pages have been permanently changed:", $count))); + } + $result->pushContent($ul); + return $result; } else { - return HTML($ul, - HTML::p(fmt("No pages changed."))); + $result->setAttr('class', 'error'); + $result->pushContent(HTML::p("No pages changed.")); + return $result; } } @@ -182,7 +189,7 @@ $pagelist->addPageList($pages); - $header = HTML::div(); + $header = HTML::fieldset(); if (empty($post_args['from'])) $header->pushContent( HTML::p(HTML::em(_("Warning: The search string cannot be empty!")))); @@ -196,7 +203,7 @@ else { $button_label = _("Search & Replace"); $this->replaceForm($header, $post_args); - $header->pushContent(HTML::p(_("Select the pages to search:"))); + $header->pushContent(HTML::legend(_("Select the pages to search and replace"))); } Modified: trunk/lib/plugin/WikiAdminSetAcl.php =================================================================== --- trunk/lib/plugin/WikiAdminSetAcl.php 2009-06-23 09:31:35 UTC (rev 6951) +++ trunk/lib/plugin/WikiAdminSetAcl.php 2009-06-23 17:54:20 UTC (rev 6952) @@ -2,6 +2,7 @@ rcs_id('$Id$'); /* Copyright 2004 $ThePhpWikiProgrammingTeam + Copyright 2009 Marc-Etienne Vargenau, Alcatel-Lucent This file is part of PhpWiki. @@ -164,7 +165,7 @@ $pages = $p; elseif ($this->_list) $pages = $this->_list; - $header = HTML::div(); + $header = HTML::fieldset(); if ($p && $request->isPost() && !empty($post_args['acl']) && empty($post_args['cancel'])) { // without individual PagePermissions: @@ -174,9 +175,7 @@ } if ($post_args['action'] == 'verify') { // Real action - $header->pushContent( - $this->setaclPages($request, array_keys($p), - $request->getArg('acl'))); + return $this->setaclPages($request, array_keys($p), $request->getArg('acl')); } if ($post_args['action'] == 'select') { if (!empty($post_args['acl'])) @@ -207,21 +206,21 @@ $header = $this->setaclForm($header, $post_args, $pages); $header->pushContent( HTML::p(HTML::strong( - _("Are you sure you want to permanently change access to the selected files?")))); + _("Are you sure you want to permanently change access rights to the selected files?")))); } else { - $button_label = _("SetAcl"); + $button_label = _("Change Access Rights"); $header = $this->setaclForm($header, $post_args, $pages); - $header->pushContent(HTML::p(_("Select the pages to change:"))); + $header->pushContent(HTML::legend(_("Select the pages where to change access rights"))); } $buttons = HTML::p(Button('submit:admin_setacl[acl]', $button_label, 'wikiadmin'), Button('submit:admin_setacl[cancel]', _("Cancel"), 'button')); + $header->pushContent($buttons); return HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), $header, - $buttons, $pagelist->getContent(), HiddenInputs($request->getArgs(), false, Modified: trunk/lib/plugin/WikiAdminSetExternal.php =================================================================== --- trunk/lib/plugin/WikiAdminSetExternal.php 2009-06-23 09:31:35 UTC (rev 6951) +++ trunk/lib/plugin/WikiAdminSetExternal.php 2009-06-23 17:54:20 UTC (rev 6952) @@ -82,7 +82,11 @@ if ($count) { $dbi->touch(); $result->setAttr('class', 'feedback'); - $result->pushContent(HTML::p(fmt("%s pages have been permanently changed:", $count))); + if ($count == 1) { + $result->pushContent(HTML::p("One page has been permanently changed:")); + } else { + $result->pushContent(HTML::p(fmt("%s pages have been permanently changed:", $count))); + } $result->pushContent($ul); return $result; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |