Revision history for CloneACLs
Additions:
>>Currently in trunk: Will be included in 1.1.7
Working for 1.1.6.0 to 1.1.6.4. See comments for possible bug.>>::c::
if (!preg_match("/^[A-Zƒ÷‹]+[a-zfl‰ˆ¸]+[A-Z0-9ƒ÷‹][A-Za-z0-9ƒ÷‹fl‰ˆ¸]*$/s", $to))
Working for 1.1.6.0 to 1.1.6.4. See comments for possible bug.>>::c::
if (!preg_match("/^[A-Zƒ÷‹]+[a-zfl‰ˆ¸]+[A-Z0-9ƒ÷‹][A-Za-z0-9ƒ÷‹fl‰ˆ¸]*$/s", $to))
Deletions:
if (!preg_match("/^[A-Zƒ÷‹]+[a-zfl‰ˆ¸]+[A-Z0-9ƒ÷‹][A-Za-z0-9ƒ÷‹fl‰ˆ¸]*$/s", $to))
Revision [19014]
Edited on 2008-01-28 00:13:40 by BrianKoontz [Modified links pointing to docs server]No Differences
Additions:
>>Currently in trunk: Will be included in 1.1.7>>::c::
Deletions:
Additions:
==Clone ACLs Patch (1.1.6.1)==
==Clone ACLs Patch (1.1.6.2)==
%%(php)
--- clone.php.orig Tue Aug 22 18:05:01 2006
+++ clone.php Tue Aug 22 18:07:58 2006
@@ -56,6 +58,7 @@
$note = sprintf(CLONED_FROM, $from);
$editoption = '';
$box = PLEASE_FILL_VALID_TARGET;
@@ -82,7 +85,9 @@
$to = isset($_POST['to']) && $_POST['to'] ? $_POST['to'] : $to;
$note = isset($_POST['note']) && $_POST['note'] ? $_POST['note'] : $note;
$editoption = (isset($_POST['editoption']))? 'checked="checked"' : '';
+ $cloneaclsoption = (isset($_POST['cloneaclsoption']))? 'checked="checked"' : '';
+
// 3. check target pagename validity
if (!preg_match(VALID_PAGENAME_PATTERN, $to)) //TODO use central regex library
{
@@ -107,6 +112,17 @@
$thepage=$this->LoadPage($from); # load the source page
if ($thepage) $pagecontent = $thepage['body']; # get its content
$this->SavePage($to, $pagecontent, $note); #create target page
if ($editoption == 'checked="checked"')
{
// quick edit
@@ -135,6 +151,12 @@
'<td></td>'."\n".
'<td>'."\n".
'<input type="checkbox" name="editoption" '.$editoption.' id="editoption" /><label for="editoption">'.LABEL_EDIT_OPTION.'</label>'."\n".
'<input type="submit" name="create" value="'.LABEL_CLONE.'" />'."\n".
'</td>'."\n".
'</tr>'."\n".
==Clone ACLs Patch (1.1.6.2)==
%%(php)
--- clone.php.orig Tue Aug 22 18:05:01 2006
+++ clone.php Tue Aug 22 18:07:58 2006
@@ -56,6 +58,7 @@
$note = sprintf(CLONED_FROM, $from);
$editoption = '';
$box = PLEASE_FILL_VALID_TARGET;
@@ -82,7 +85,9 @@
$to = isset($_POST['to']) && $_POST['to'] ? $_POST['to'] : $to;
$note = isset($_POST['note']) && $_POST['note'] ? $_POST['note'] : $note;
$editoption = (isset($_POST['editoption']))? 'checked="checked"' : '';
+ $cloneaclsoption = (isset($_POST['cloneaclsoption']))? 'checked="checked"' : '';
+
// 3. check target pagename validity
if (!preg_match(VALID_PAGENAME_PATTERN, $to)) //TODO use central regex library
{
@@ -107,6 +112,17 @@
$thepage=$this->LoadPage($from); # load the source page
if ($thepage) $pagecontent = $thepage['body']; # get its content
$this->SavePage($to, $pagecontent, $note); #create target page
if ($editoption == 'checked="checked"')
{
// quick edit
@@ -135,6 +151,12 @@
'<td></td>'."\n".
'<td>'."\n".
'<input type="checkbox" name="editoption" '.$editoption.' id="editoption" /><label for="editoption">'.LABEL_EDIT_OPTION.'</label>'."\n".
'<input type="submit" name="create" value="'.LABEL_CLONE.'" />'."\n".
'</td>'."\n".
'</tr>'."\n".
Deletions:
Additions:
>>Implemented in release 1.1.6.3>>::c::
Additions:
CategoryUserContributions
Deletions:
Additions:
A patch you can apply to handlers/page/clone.php that will optionally copy the ACLs from the source page to the new page while cloning a page.
<<==A note about patches==
The ##patch## utility is included in most *nix systems and allows all changes to files to be packaged into one convenient
'patch file' for distribution. I've found that in the process of transferring files with embedded tabs from the development machine to the wiki environment, the tabs are lost when using copy-and-paste. Consequently, the ##patch## command will sometimes fail, since the tabs have been munged up. I've found that ##patch -p0 -l < some.patch## (note the "dash el" option -- not "dash one") seems to handle munged-up whitespace quite nicely.<<
::c::
==Clone ACLs Patch==
%%
--- clone.php 2006/03/11 05:26:01 1.1
+++ clone.php 2006/03/11 06:03:04
@@ -29,6 +29,8 @@
*
* @input boolean $editoption optional: if true, the new page will be opened for edition on creation
* default is false (to allow multiple cloning of the same source)
+ * @input boolean $cloneaclsoption optional: if true, ACLs will be copied from the source page to the new page
+ * default is false
*
* @todo Use central library for valid pagenames.
*
@@ -39,6 +41,7 @@
$to = $this->tag;
$note = 'Cloned from '.$from; #i18n
$editoption = '';
+$cloneaclsoption = '';
$box = 'Please fill in a valid target ""PageName"" and an (optional) edit note.'; #i18n
// print header
@@ -65,6 +68,8 @@
$to = ($_POST['to'])? $_POST['to'] : $to;
$note = ($_POST['note'])? $_POST['note'] : $note;
$editoption = (isset($_POST['editoption']))? 'checked="checked"' : '';
+ $cloneaclsoption = (isset($_POST['cloneaclsoption']))? 'checked="checked"' : '';
+
// 3. check target pagename validity
if (!preg_match("/^[A-Zƒ÷‹]+[a-zfl‰ˆ¸]+[A-Z0-9ƒ÷‹][A-Za-z0-9ƒ÷‹fl‰ˆ¸]*$/s", $to))
@@ -90,6 +95,17 @@
$thepage=$this->LoadPage($from); # load the source page
if ($thepage) $pagecontent = $thepage['body']; # get its content
$this->SavePage($to, $pagecontent, $note); #create target page
+ // Clone ACLs if requested
+ if($cloneaclsoption == 'checked="checked"')
+ {
+ $read_acl = $this->LoadACL($from, "read", 0);
+ $write_acl = $this->LoadACL($from, "write", 0);
+ $comment_acl = $this->LoadACL($from, "comment", 0);
+ $this->SaveACL($to, "read", $this->TrimACLs($read_acl["read_acl"]));
+ $this->SaveACL($to, "write", $this->TrimACLs($write_acl["write_acl"]));
+ $this->SaveACL($to, "comment", $this->TrimACLs($comment_acl["comment_acl"]));
+ }
+ // Open editor if requested
if ($editoption == 'checked="checked"')
{
// quick edit
@@ -118,6 +134,11 @@
'<td></td>'.
'<td>'.
'<input type="checkbox" name="editoption" '.$editoption.' /> Edit after creation '.
+ '<input type="checkbox" name="cloneaclsoption" '.$cloneaclsoption.' /> Clone ACLs '.
+ '</tr>'.
+ '<tr>'.
+ '<td></td>'.
+ '<td>'.
'<input type="submit" name="create" value="Clone" />'.
'</td>'.
'</tr>'.
%%
----
==Categories==
CategoryUserContribution