====Wikka Forum==== {{lastedit}} <<**Mods:** ~- [[DaveFullard | Delete forum posts]]<<::c:: Often one finds wiki's used as adjuncts to other tools....discussion forums for instance. In those forums the main topic threads are determined by the administrator(s) and out of the hands of most of the users. Wiki's, such as Wikka, are meant to provide considerable flexibility for the users and place the control in their hands. At the same time, this freedom can lead to very unstructured and difficult to follow discussions. Below is code for a forum tool that allows an individual user to set up a structured forum thread on **any** page. The page owner can control the contributers to the forum discussions, or leave it open for all to participate. Apart from this, it's easier to set up the wiki & registration into it with a forum tool that can be used in the wiki than it is to set up both a wiki & a forum (plus, there's consistency in registration names). Forums created on one page can be viewed on another (but not edited). A forumcounter action allows seeing the contributions to any particular forum. With functionality similar to "regular" bulletin boards (such as ""PunBB""), this forum tool can use simple wiki mark-up is **considerably** faster and easier to set up....and "empowers" regular wiki users to set up structured discussions in a manner not normally possible (unless you have access to a server, etc). Additionally, you can add comments and links FAR more easily on the main and on individual forum pages in the clone than one can in the real forum software (because you can use wiki markup). Combined with the wiki mail tool I wrote (WikkaMail) I use this forum approach for my courses instead of real bulletin board software since I have all the needed functionality and more in one spot. [Currently this forum tool uses wiki markup for the "front end" of the bulletin board. In current development is an action (wikkabb.php) which will allow bulletin board management & a look quite similar to traditional bulletin boards but through the wiki (and this wikkaforum tool). There are two advantages this will offer over traditional bb's (from a "community" perspective AND from a teaching/learning perspective in classroom use). Firstly, individual forums discussions can be shared across communities and forums. This is a considerable departure from regular BB's where one is either entirely in one community or not....whereas this tool will permit crossing-over between different communities/classes. Secondly (and consistent with what was written earlier), it allows these inter-linked bulletin boards to be generated by users for their own (community) purposes....not something usually possible with bulletin boards. Development on this tool should conclude in the next few weeks, it will be field tested, and then it will be released here.] The //wikkaforum// action allows you to open the discussion threads on any page using ""{{wikkaforum page="pagename"}}"", although entries cannot be made anywhere but the home page (for security reasons). The page owner can designate a user list and a topic title (example: ""{{wikkaforum share="JavaWoman DarTar GmBowen" topic="Paged Comments"}}"") or leave the discussion threads open to all users. If a "collection" of threads is made (see my course clone example) then a main="collectionpage" designation can be made and that will be added to the navigation system automatically. The //forumcounter// action allows one to designate a particular thread and determine the number of threads and, optionally, time of last contribution. Create the follow table in your wikka database (note that you might have to change the table prefix to what you use for your wikka) %% CREATE TABLE `wakka_wikkaforum` ( `id` int(11) NOT NULL auto_increment, `wid` int(11) NOT NULL default '0', `for_ptitle` varchar(255) NOT NULL default '', `for_text` text NOT NULL, `tag` varchar(50) NOT NULL default '', `for_data` datetime NOT NULL default '0000-00-00 00:00:00', `for_dataw` datetime NOT NULL default '0000-00-00 00:00:00', `for_ip` varchar(15) NOT NULL default '000.000.000.000', `for_name` varchar(255) NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM; %% Place the following code as ##wikkaforum.php## in the ##actions## directory. %%(php) config["base_url"].$this->MiniHref($method, $tag); $username=$this->GetUserName(); $prefix=$this->config["table_prefix"]; if (empty($page)) { $tag=$this->getPageTag(); $pageX=$tag; } else { $tag=$page; } // code to determine who can contribute to the threads if(empty($share)){$share = 'ALL';} $tok = strtok($share, " \n\t"); while ($tok) { if($tok == $this->GetUserName() || $tok == "ALL") { $use = 'true';} $tok = strtok(" \n\t"); } if (strtoupper($this->GetUserName())==strtoupper($this->GetPageOwner())){$use = 'true';} // check so that when there are multiple instances of the action one cannot "add" to the database // in response to having a thread from another page open (trust me, this code is necessary) $tablepgname = $this->LoadSingle("SELECT tag FROM ".$this->config['table_prefix']."wikkaforum WHERE wid='".$_GET['wid']."' LIMIT 0,1"); $shouldwrite = $tablepgname[tag]; if (($shouldwrite==$this->getPageTag()) || (empty($shouldwrite))) {$use2 = 'true';} // CLASS STATEMENT STARTS HERE. Using include_once prevents function conflicts & allows multiple instances on the same page include_once("./scripts/wikkaforumfunctions.php"); // CLASS STATEMENT ENDS HERE. if (!isset($forum)) { $forum = new SForum; } ?>
Show_SFname($topic);
if ($main==""){
if (!empty($_GET['wid'])) {
echo " Return to Thread List\n";
print(" \n"); } else { echo " \n"; print(" \n"); } } else { if ($this->IsWikiName($main)) {$link2 = "config["base_url"].$main."\">".$main."";} else { echo $main; } if (!empty($_GET['wid'])) {$joiner=">>";} if (empty($topic) && ($page!=$this->getPageTag())) {$topic=$tag;} else{ $topic=$this->MiniHref($method, $tag); } echo $link2.">>".$topic."".$joiner; $forum->Show_SForum_Thread_Name($_GET['wid'], $tag, $prefix); } if (isset($_POST['submit'])) { if (!empty($_POST['frm_ptitle'])) { if(empty($page)) { $forum->Add_new_post($_POST['frm_ptitle'],$_POST['frm_text'],$tag,$_POST['frm_ip'],$username,$_POST['frm_wid'],$prefix); } } } if (isset($_GET['wid'])) { #phpinfo(); $forum->Show_SForum_Threads($_GET['wid'], $tag, $prefix); $forum->pansw = $_GET['wid']; } else { $forum->Show_SForum($link, $tag, $prefix); $forum->pansw = 0; } print("\n"); if ($main==""){ if (!empty($_GET['wid'])) { echo " Return to Thread List\n"; print(" \n"); } else { echo " \n"; print(" \n"); } } else { if ($this->IsWikiName($main)) {$link2 = "config["base_url"].$main."\">".$main."";} else { echo $main; } if (!empty($_GET['wid'])) {$joiner=">>";} if (empty($topic) && ($page!=$this->getPageTag())) {$topic=$tag;} else{ $topic=$this->MiniHref($method, $tag); } echo $link2.">>".$topic."".$joiner; $forum->Show_SForum_Thread_Name($_GET['wid'], $tag, $prefix); } if ($user = $this->GetUser()) { if ($pageX==$this->getPageTag()) { if ($use == 'true') { if(empty($page)) { if ($use2 == 'true') { $forum->Show_frm($forum->ptitle, $link, $_GET['wid']); } } } } else { echo " This forum originates from ".$page.". "; } } else { print("Sorry, you need to be a registered & logged-in user to contribute to the forums."); if ($pageX!=$this->getPageTag()){print(" This forum originates from ".$pageX.". ");} } ?> |
$link2".$this->ptitle." | Replies: ".$this->react." | ".$row['for_name']." | ".$row['for_dataw']." |
".$this->ptitle." $pmail".$row['for_name']."$kmail ".$row['for_data']." \n\n");
print("".$printtext." |