Wiki source for ControledLinks


Show raw source

=====Avoiding Errors with acls and link-handling=====
When building wakkalinks, wakkawiki doesn't care about acls of the target page and shows up an error-message, when s/o clicks on a link on which he has no apropriate rights. This is easy to avoid. We only have to tweak the $wakka->link function in wakka.php:

Lets have a look at the very last line in this function which looks similar to

return ($this->""LoadPage""($tag) ? "<a href='".$this->href($method, $tag)."'>".$text."</a>" : "<a class='missingpage' href='".$this->href($missing, $tag)."'>$text</a>");

replace it by these three lines:

$read = ($this->""HasAccess""("read", $tag) ? "<a href='".$this->href($method, $tag)."'>".$text."</a>" : $text);
$edit = ($this->""HasAccess""("write", $tag) ? "<a class='missingpage' href='".$this->href($missing, $tag)."'>$text</a>" : $text);
return ($this->""LoadPage""($tag) ? $read : $edit);

with this modification the hyperlink-stuff is dropped whereever the hasAccess-query failes and only the linking text is shown.

The $edit-variable is only useful, when the default write-access is restricted (configured in the index.php), because it always points to pages that don't exist. But then you can run a wakka-site with no "broken" links. dead links (i.e. those which normaly leads to an edit-form or to an error-page for those who have no write access) are only activated after an editor has createt the page, where that links points to, and thus your wakka-site won't look like to be "under construction".

----
WikkaModifications
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki