Is Drupal Wiki ready for primetime?

public
group: Wiki
Miraploy - Sun, 2008-03-09 03:48

I'm debating whether to integrate wiki (a simple solution that I'm familiar with and would basically take care of all my needs in 1 fell swoop), or use various modules to do a native Drupal wiki.

So to help me make this decision, I'm asking if the Drupal wiki modules are able to duplicate at least all the basic functions of mediawiki. I'm a little confused about freelinking module. Is it neccessary? Shouldn't the wikitools module be able to do the same thing? Or am I missing something?

i am a drupal wiki believer, and would be happy to help you set

Ricco - Sun, 2008-03-09 04:16

Hey There... I have used both the mediawiki and drupal/wiki, and what I like about the drupal world, is that that started out with user permissioning, so as time goes on, things tend to work and things get more complex.

I am no expert but I would would be happy to help you set one up, or just show you some of the reasons I went with the drupal solution.

I would also look at OG (organic groups) AND OG user roles. the OG user roles module allows you to give different people different permissions dynamically when they are in groups. allowing you to have cooks edit cooking wiki pages, and mechanics wedit car wiki pages.

you can find me on dal.net or freenode.net. Just PM me as Ricco, and I will be happy to spend a day, and walk you though a setup.

I would look at gathering these things core, OG, OR user roles, wiki tools, The Geshi filter, i think you need the group forums for some of the user roles to work too. Modules are easy to add, you simply unpack them, and add them to the /modules folder, then activate them on the admin screen via the modules choice.

Also. you will want to get comfortable hand editing your themes; NODE and PAGE files. this will allow you to tweak the behaviour of things simply.

I have never understood why drupal has not created wiki.drupal.org. I think that if people could start using a drupal wiki they would fall in love.

I can also give you a block of like 30 lines of code that you can drop into your theme node file that will show links in two different colors as media wiki does., Drupal currently does not offer that, but I hacked up a simple working solution, and would be happy to give it to you and show you how if you plop it right in front of the printing of $content in the theme node file, you magically get different colors for links that have pages, and borken links.

Cheers! Ricco

RE: "I can also give you a

billfitzgerald's picture
billfitzgerald - Sun, 2008-03-09 12:45

RE: "I can also give you a block of like 30 lines of code that you can drop into your theme node file that will show links in two different colors as media wiki does"

Could you document that here as well? That would be a great snippet, and could probably be useful in the handbooks as well.

Thanks,

Bill

FunnyMonkey
Tools for Teachers


broken link code snippet

Ricco - Sun, 2008-03-09 19:50

Just stick this code in your theme's node.tpl.php code right before you print out $contents.

<?php
// put it in the theme/node page, right before you print $content
// assumes $content, and gives back colorized $content
$theHTML = $content;
$result = "";
$strLength = strlen($theHTML);
while (
true) {
  
$spot = strpos($theHTML, "<a ");
  if (!
$spot) {
      break;
} else {
      
$result = $result . substr($theHTML,0,$spot);
     
$theHTML = substr($theHTML, $spot, strlen($theHTML) - $spot);
     
$spot2 = strpos($theHTML, ">");
       if ( !
spot2 ) {
            break;
     } else {
          
$theLink = substr($theHTML, 0, $spot2+4);
          if (
strpos($theLink, "href=\"/wiki/")) {
               
$start = strpos($theLink, "href=\"/wiki/");
            
$end = strpos($theLink, "\">");
             
$start = $start +12;
              
$xtitle = substr($theLink, $start, $end-$start);
              
$start = strpos($theLink, "href=\"\">");
               
$start2 = strpos($theLink, "\">", $start);
              
$start3 = strpos($theLink, "\">", $start2);
             
$end = strpos($theLink, "</a>");
              
$start3 = $start3 +3;
             
$titletext = substr($theLink, $start3-1, $end-$start3+1);
             
$xtitle = str_replace("%2C", ",", $xtitle);
               
$xtitle = str_replace("_", " ", $xtitle);
             
$MrNode = node_load(array('title' => $xtitle));
              
$theTitle = $MrNode->xtitle;
               
$theNode = $MrNode->nid;
                if ( !
$theNode > 0 ) {
                 
$theLink = str_replace("class=\"\"", "class=\"broken\"", $theLink);
                   
$theLink = str_replace("style=\"\"", "style=\"color: grey; font-weight: 100\"", $theLink);
             }
          }
         
$result = $result . $theLink;
         
$theHTML = substr($theHTML, $spot2 +4, strlen($theHTML) - $spot2);
     }
  }
 
$strLength = strlen($theHTML);
}
$result = $result . $theHTML;
$content = $result;
?>

Error version 6.2

rovo - Fri, 2008-05-30 17:20

I've tried a few variations on adding this code to my node.tpl.php file, but I just get this error:

Parse error: syntax error, unexpected T_VARIABLE in /home/wikistoc/public_html/themes/artistsC01/node.tpl.php on line 19

Do you know what I might be doing wrong?

Lots of things are wrong with the given code

cwgordon7@drupal.org's picture
cwgordon7@drupal.org - Fri, 2008-05-30 21:18

For starters,

<?php
if ( !spot2 ) {
?>

should be
<?php
if (!$spot2) {
?>

Plus, this does not comply to Drupal's coding standards.


needs more work than that?

rovo - Sat, 2008-05-31 20:19

Do you think it needs more work than that to get it working? This would be a great addition to freelinking module, so that visitors know the difference between the links. I find it difficult, groups.drupal.org, to track new replies?

Everyone, this code is of

Garrett Albright - Thu, 2008-07-24 03:50

Everyone, this code is of poor quality. It may "work," but it's pretty ratty. Regular expressions should be used in a case like this; not a bunch of substr/strpos commands. Also, if (!$theNode > 0) is pretty much gibberish…

And this should probably be implemented as an input filter…

Thanks Ricco, that would be

Miraploy - Mon, 2008-03-10 05:38

Thanks Ricco, that would be very cool. I'll try to grab you next weekend.