From f0e21a7198c137861c9f75d9b8750118b86123a6 Mon Sep 17 00:00:00 2001 From: rurban Date: Tue, 8 Jun 2004 10:05:12 +0000 Subject: [PATCH] simplified admin action shortcuts git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@3635 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/PagePerm.php | 23 +++++++++++++------- lib/main.php | 31 ++++++++++++++++----------- lib/plugin/WikiAdminChown.php | 9 +++++--- lib/plugin/WikiAdminRemove.php | 10 ++++++--- lib/plugin/WikiAdminRename.php | 10 ++++++--- lib/plugin/WikiAdminSearchReplace.php | 10 +++++++-- lib/plugin/WikiAdminSetAcl.php | 10 +++++++-- lib/ziplib.php | 11 ++++++++-- 8 files changed, 79 insertions(+), 35 deletions(-) diff --git a/lib/PagePerm.php b/lib/PagePerm.php index 262cff163..de494367b 100644 --- a/lib/PagePerm.php +++ b/lib/PagePerm.php @@ -1,5 +1,5 @@ sanify(); foreach ($this->perm as $access => $groups) { - // TODO: unify groups for same access+bool - // +CREATOR,OWNER:view - // TODO: unify access for same groups+bool - // +OWNER:view,edit + // unify groups for same access+bool + // view:CREATOR,-OWNER, + $s .= $access.':'; foreach ($groups as $group => $bool) { - $s .= ($bool?'+':'-').$this->groupName($group).':'.$access."\n"; + $s .= ($bool?'':'-').$group.","; } + if (substr($s,-1,1) == ',') + $s = substr($s,-1)."; "; + else + $s = ''; } return $s; } @@ -691,6 +695,9 @@ class PagePermission { } // $Log: not supported by cvs2svn $ +// Revision 1.22 2004/06/07 22:44:14 rurban +// added simplified chown, setacl actions +// // Revision 1.21 2004/06/07 22:28:03 rurban // add acl field to mimified dump // diff --git a/lib/main.php b/lib/main.php index bffd5fc27..64659a50f 100644 --- a/lib/main.php +++ b/lib/main.php @@ -1,5 +1,5 @@ version = phpwiki_version(); case 'upgrade': case 'chown': case 'setacl': + case 'rename': return WIKIAUTH_ADMIN; /* authcheck occurs only in the plugin. @@ -760,26 +761,29 @@ $this->version = phpwiki_version(); actionPage($this, $action); } - function action_chown () { - $action = $this->findActionPage(_("PhpWikiAdministration/Chown")); + function adminActionSubpage ($subpage) { + $page = _("PhpWikiAdministration")."/".$subpage; + $action = $this->findActionPage($page); if ($action) { $this->setArg('s',$this->getArg('pagename')); $this->setArg('verify',1); + $this->setArg('action',$action); $this->actionpage($action); } else { - trigger_error(_("PhpWikiAdministration/Chown").": Cannot find action page", E_USER_WARNING); + trigger_error($page.": Cannot find action page", E_USER_WARNING); } } + function action_chown () { + $this->adminActionSubpage(_("Chown")); + } + function action_setacl () { - $action = $this->findActionPage(_("PhpWikiAdministration/SetAcl")); - if ($action) { - $this->setArg('s',$this->getArg('pagename')); - $this->setArg('verify',1); - $this->actionpage($action); - } else { - trigger_error(_("PhpWikiAdministration/SetAcl").": Cannot find action page", E_USER_WARNING); - } + $this->adminActionSubpage(_("SetAcl")); + } + + function action_rename () { + $this->adminActionSubpage(_("Rename")); } function action_dump () { @@ -1026,6 +1030,9 @@ main(); // $Log: not supported by cvs2svn $ +// Revision 1.161 2004/06/07 22:58:40 rurban +// simplified chown, setacl, dump actions +// // Revision 1.160 2004/06/07 22:44:14 rurban // added simplified chown, setacl actions // diff --git a/lib/plugin/WikiAdminChown.php b/lib/plugin/WikiAdminChown.php index 266ea5bd0..88fb31bf3 100644 --- a/lib/plugin/WikiAdminChown.php +++ b/lib/plugin/WikiAdminChown.php @@ -1,5 +1,5 @@ getArg('action') != 'browse') - if (!$request->getArg('action') == _("PhpWikiAdministration%2FChown")) + if (!$request->getArg('action') == _("PhpWikiAdministration/Chown")) return $this->disabled("(action != 'browse')"); $args = $this->getArgs($argstr, $request); @@ -191,6 +191,9 @@ extends WikiPlugin_WikiAdminSelect } // $Log: not supported by cvs2svn $ +// Revision 1.2 2004/06/07 18:59:42 rurban +// added Chown link to Owner in statusbar +// // Revision 1.1 2004/06/07 17:58:58 rurban // new chown plugin // diff --git a/lib/plugin/WikiAdminRemove.php b/lib/plugin/WikiAdminRemove.php index 1e953a926..d0c019f52 100644 --- a/lib/plugin/WikiAdminRemove.php +++ b/lib/plugin/WikiAdminRemove.php @@ -1,5 +1,5 @@ getArg('action') != 'browse') - return $this->disabled("(action != 'browse')"); + if ($request->getArg('action') != _("PhpWikiAdministration/Remove")) + return $this->disabled("(action != 'browse')"); $args = $this->getArgs($argstr, $request); if (!is_numeric($args['min_age'])) @@ -244,6 +245,9 @@ class _PageList_Column_remove extends _PageList_Column { // $Log: not supported by cvs2svn $ +// Revision 1.23 2004/06/03 22:24:48 rurban +// reenable admin check on !ENABLE_PAGEPERM, honor s=Wildcard arg, fix warning after Remove +// // Revision 1.22 2004/05/16 22:07:35 rurban // check more config-default and predefined constants // various PagePerm fixes: diff --git a/lib/plugin/WikiAdminRename.php b/lib/plugin/WikiAdminRename.php index 2c96e3591..6ab0a693e 100644 --- a/lib/plugin/WikiAdminRename.php +++ b/lib/plugin/WikiAdminRename.php @@ -1,5 +1,5 @@ getArg('action') != 'browse') - return $this->disabled("(action != 'browse')"); + if ($request->getArg('action') != _("PhpWikiAdministration/Rename")) + return $this->disabled("(action != 'browse')"); $args = $this->getArgs($argstr, $request); $this->_args = $args; @@ -252,6 +253,9 @@ class _PageList_Column_renamed_pagename extends _PageList_Column { }; // $Log: not supported by cvs2svn $ +// Revision 1.16 2004/06/07 18:57:31 rurban +// fix rename: Change pagename in all linked pages +// // Revision 1.15 2004/06/04 20:32:54 rurban // Several locale related improvements suggested by Pierrick Meignen // LDAP fix by John Cole diff --git a/lib/plugin/WikiAdminSearchReplace.php b/lib/plugin/WikiAdminSearchReplace.php index a4859e971..a7b88c8b0 100644 --- a/lib/plugin/WikiAdminSearchReplace.php +++ b/lib/plugin/WikiAdminSearchReplace.php @@ -1,5 +1,5 @@ getArg('action') != 'browse') return $this->disabled("(action != 'browse')"); @@ -246,6 +247,11 @@ function stri_replace($find,$replace,$string) { } // $Log: not supported by cvs2svn $ +// Revision 1.11 2004/06/04 20:32:54 rurban +// Several locale related improvements suggested by Pierrick Meignen +// LDAP fix by John Cole +// reanable admin check without ENABLE_PAGEPERM in the admin plugins +// // Revision 1.10 2004/06/03 22:24:48 rurban // reenable admin check on !ENABLE_PAGEPERM, honor s=Wildcard arg, fix warning after Remove // diff --git a/lib/plugin/WikiAdminSetAcl.php b/lib/plugin/WikiAdminSetAcl.php index 0d791f977..28697f645 100644 --- a/lib/plugin/WikiAdminSetAcl.php +++ b/lib/plugin/WikiAdminSetAcl.php @@ -1,5 +1,5 @@ disabled("WikiAdminSetAcl not yet enabled. Set DEBUG to try it."); + if ($request->getArg('action') != 'browse') + if ($request->getArg('action') != _("PhpWikiAdministration/SetAcl")) + return $this->disabled("(action != 'browse')"); $args = $this->getArgs($argstr, $request); $this->_args = $args; @@ -291,6 +294,9 @@ class _PageList_Column_perm extends _PageList_Column { }; // $Log: not supported by cvs2svn $ +// Revision 1.14 2004/06/07 22:28:06 rurban +// add acl field to mimified dump +// // Revision 1.13 2004/06/04 20:32:54 rurban // Several locale related improvements suggested by Pierrick Meignen // LDAP fix by John Cole diff --git a/lib/ziplib.php b/lib/ziplib.php index 6b8c5387c..1abb72559 100644 --- a/lib/ziplib.php +++ b/lib/ziplib.php @@ -1,4 +1,4 @@ -get('perm')) { $acl = getPagePermissions($page); $params['acl'] = $acl->asAclLines(); + //TODO: convert to multiple lines? acl-view => groups,...; acl-edit => groups,... } $params['charset'] = $GLOBALS['charset']; @@ -577,6 +578,8 @@ function MimeifyPageRevision ($revision) { // special handling) --- so we urlencode all parameter values. foreach ($params as $key => $val) $params[$key] = rawurlencode($val); + if (isset($params['acl'])) + $params['acl'] = str_replace(array("%3A","%2C%0A","%2C","%0A"),array(":","; ",",","; "),$params['acl']); $out = MimeContentTypeHeader('application', 'x-phpwiki', $params); $out .= sprintf("Content-Transfer-Encoding: %s\r\n", @@ -738,7 +741,8 @@ function ParseMimeifiedPages ($data) $pagedata = array(); $versiondata = array(); $pagedata['date'] = strtotime($headers['date']); - + + //FIXME: support owner and acl foreach ($params as $key => $value) { if (empty($value)) continue; @@ -793,6 +797,9 @@ function ParseMimeifiedPages ($data) } // $Log: not supported by cvs2svn $ +// Revision 1.37 2004/06/07 22:28:04 rurban +// add acl field to mimified dump +// // Revision 1.36 2004/06/07 19:50:40 rurban // add owner field to mimified dump // -- 2.45.0