Revision [14293]

This is an old revision of BrianKoontz made by BrianKoontz on 2006-05-20 23:34:17.


Why I'm here

I'm the coordinator for the Computer Science and Open Source Technology (OST) programs at North Lake College in Irving, TX. I've worked my way through several versions of the Wakka->Wacko->Wikka progeny line. Wakka dead-ended on me, while my Russian never did get any better with Wacko (no, I don't speak Russian, which made it very difficult to work with Wacko beyond the level of an end user). I'm currently using Wikka to host the course notes and other miscellaneous items for the OST program. I would like to see, at some point down the road, a merger of the best of features in both Wacko and Wikka...I believe both have their strong points, and it would be such a waste to see features in one lost on the other.

Wikka stuff

Stuff I've written

Stuff others have written that I've found useful

Stuff I'd like to implement if/when I get the time

Contact info

Brian Koontz
North Lake College
Irving, TX

Misc. Code (see above for descriptions)

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.


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-z&#64258;‰ˆ¸]+[A-Z0-9ƒ÷‹][A-Za-z0-9ƒ÷‹&#64258;‰ˆ¸]*$/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 @@
 			'<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" />'.

Valid XHTML :: Valid CSS: :: Powered by WikkaWiki