From: Reini U. <ru...@us...> - 2004-05-24 17:35:04
|
Update of /cvsroot/phpwiki/phpwiki/lib/plugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4432/plugin Modified Files: WikiAdminRename.php WikiAdminSetAcl.php Log Message: use ACLs Index: WikiAdminRename.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/plugin/WikiAdminRename.php,v retrieving revision 1.10 retrieving revision 1.11 diff -u -2 -b -p -d -r1.10 -r1.11 --- WikiAdminRename.php 6 Apr 2004 20:00:11 -0000 1.10 +++ WikiAdminRename.php 24 May 2004 17:34:53 -0000 1.11 @@ -25,8 +25,10 @@ rcs_id('$Id$'); * @author: Reini Urban <ru...@x-...> * + * TODO: support case-insensitive checkbox + * support regex checkbox and renaming + * * KNOWN ISSUES: - * Currently we must be Admin. - * Future versions will support PagePermissions. - * requires PHP 4.2 so far. + * Enabled now PagePermissions. + * Requires PHP 4.2 so far. */ require_once('lib/PageList.php'); @@ -62,4 +64,5 @@ extends WikiPlugin_WikiAdminSelect } + //TODO: regex option function renameHelper($name, $from, $to) { return str_replace($from,$to,$name); @@ -71,6 +74,10 @@ extends WikiPlugin_WikiAdminSelect foreach ($pages as $name) { if ( ($newname = $this->renameHelper($name,$from,$to)) and - $newname != $name and - $dbi->renamePage($name,$newname,$updatelinks) ) { + $newname != $name ) { + if ($dbi->isWikiPage($newname)) + $ul->pushContent(HTML::li(fmt("Page %s already exists. Ignored.",WikiLink($newname)))); + elseif (!mayAccessPage('change',$name)) + $ul->pushContent(HTML::li(fmt("Access denied to change page '%s'.",WikiLink($name)))); + elseif ( $dbi->renamePage($name,$newname,$updatelinks)) { /* not yet implemented for all backends */ $ul->pushContent(HTML::li(fmt("Renamed page '%s' to '%s'.",$name,WikiLink($newname)))); @@ -79,12 +86,13 @@ extends WikiPlugin_WikiAdminSelect $ul->pushContent(HTML::li(fmt("Couldn't rename page '%s' to '%s'.", $name, $newname))); } + } else { + $ul->pushContent(HTML::li(fmt("Couldn't rename page '%s' to '%s'.", $name, $newname))); + } } if ($count) { $dbi->touch(); - return HTML($ul, - HTML::p(fmt("%s pages have been permanently renamed.",$count))); + return HTML($ul, HTML::p(fmt("%s pages have been permanently renamed.",$count))); } else { - return HTML($ul, - HTML::p(fmt("No pages renamed."))); + return HTML($ul, HTML::p(fmt("No pages renamed."))); } } @@ -111,8 +119,10 @@ extends WikiPlugin_WikiAdminSelect // FIXME: check individual PagePermissions + /* if (!$request->_user->isAdmin()) { $request->_notAuthorized(WIKIAUTH_ADMIN); $this->disabled("! user->isAdmin"); } + */ // FIXME: error message if not admin. @@ -172,5 +182,5 @@ extends WikiPlugin_WikiAdminSelect array('admin_rename')), HiddenInputs(array('admin_rename[action]' => $next_action, - 'require_authority_for_post' => WIKIAUTH_ADMIN)), + /*'require_authority_for_post' => WIKIAUTH_ADMIN */)), $buttons); } @@ -184,7 +194,8 @@ extends WikiPlugin_WikiAdminSelect 'value' => $post_args['to']))); $header->pushContent(' '._("(no regex, case-sensitive)")); - if (1) { // not yet tested + if (DEBUG) { // not yet tested $header->pushContent(HTML::br()); $header->pushContent(_("Change pagename in all linked pages also?")); + $header->pushContent(HTML::em(_("Currently not working)"))); $checkbox = HTML::input(array('type' => 'checkbox', 'name' => 'admin_rename[updatelinks]', @@ -217,4 +228,7 @@ class _PageList_Column_renamed_pagename // $Log$ +// Revision 1.11 2004/05/24 17:34:53 rurban +// use ACLs +// // Revision 1.10 2004/04/06 20:00:11 rurban // Cleanup of special PageList column types Index: WikiAdminSetAcl.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/plugin/WikiAdminSetAcl.php,v retrieving revision 1.8 retrieving revision 1.9 diff -u -2 -b -p -d -r1.8 -r1.9 --- WikiAdminSetAcl.php 16 May 2004 22:32:54 -0000 1.8 +++ WikiAdminSetAcl.php 24 May 2004 17:34:53 -0000 1.9 @@ -240,5 +240,5 @@ extends WikiPlugin_WikiAdminSelect // 'value' => $post_args['acl']))); $header->pushContent(HTML::br()); - if (!empty($pages)) { + if (!empty($pages) and DEBUG) { $checkbox = HTML::input(array('type' => 'checkbox', 'name' => 'admin_setacl[updatechildren]', @@ -248,5 +248,7 @@ extends WikiPlugin_WikiAdminSelect _("Propagate new permissions to all subpages?"), HTML::raw(" "), - HTML::em(_("(disable individual page permissions, enable inheritance)?"))); + HTML::em(_("(disable individual page permissions, enable inheritance)?")), + HTML::em(_("(Currently not working)")) + ); } $header->pushContent(HTML::hr(),HTML::p()); @@ -286,4 +288,7 @@ class _PageList_Column_perm extends _Pag // $Log$ +// Revision 1.9 2004/05/24 17:34:53 rurban +// use ACLs +// // Revision 1.8 2004/05/16 22:32:54 rurban // setacl icons |