Revision [16825]

This is an old revision of SuggestionsBoard made by Je3Ffz on 2007-05-31 10:51:42.

 

Suggestions Message Board


Last edited by Je3Ffz
Thu, 31 May 2007 10:51 UTC [diff]


This action will allow your Wikka installation to have a Message Board.
Before you even try using the script you will need to have the following table inside your wikka mysql database :
CREATE TABLE `wikka_suggestions` (
    `id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
    `title` VARCHAR( 200 ) NOT NULL ,
    `postby` VARCHAR( 100 ) NOT NULL ,
    `time` DATETIME NOT NULL ,
    `status` ENUM( 'I', 'R', 'P' ) NOT NULL ,
    `content` TEXT NOT NULL ,
    `parent` INT UNSIGNED DEFAULT '0' NOT NULL ,
    PRIMARY KEY ( `id` ) ,
    INDEX ( `title` )
) COMMENT = 'suggestions table for the Wikka ...';


After this is done you will also need the /Wikka/actions/msgboard.php with the following contents:

%%(php)<?php
if there is no phase set then direct to display the "manage subscriptions" table ...
$phase = (isset($_GET['phase'])) ? $_GET['phase'] : 'manage_sugs';

$min_topic_length = 5;
$min_reply_length = 15;

$all_sugs = $this->LoadAll("SELECT * FROM ".$this->config["table_prefix"]."suggestions ORDER BY parent, time");
used for returning an array structure from the MySQL ...
function GetAllSuggestions($arr)
{

$finarr = array();
lets build the maintable...
foreach($arr as $i => $ar)
{
handle the parents first...
if ($ar['parent']
0)
{
$id = $ar['id'];
$finarr[$ar['id']] = array();
}
else handle the children...
{
$id = $ar['parent'];

}
foreach($ar as $idx=>$a)
{
$a = stripslashes($a);
}
put them in the big table ...
$finarr[$id][] = $ar;
}
return $finarr;
}

used for returning any Status from single letter to whole word .. : 'I' becomes 'Implemented'
function
GetStatusStr($str)
{

if ($str 'I') $str = "Implemented";
elseif ($str 'P') $str = "Pending";

return $str;
}
used for adding a dropdown-choose-status field for various parts of the script ...
function AddStatusDropDown($status)
{
$st = array( 'Rejected' => 0, 'Implemented' => 0, 'Pending' => 0);
$st[GetStatusStr($status)] = 1;
$finrow = "\n\t\t\t<select name=\"sug_status\">";
foreach($st as $msg=>$sta)
{
$finrow .= "\n\t\t\t\t<option value=\.substr($msg, 0,1)."\.(($sta
1) ? ' selected' : ).">$msg</option>";
}
$finrow .= "\n\t\t\t</select>\n";
var_dump($finrow);
return $finrow;
}

function
GetTitleFromID($id, $arr)
{
{
if ($id $data['id']) return $data['title'];
}
}
used on sorting the "Manage subscriptions" Table with various configurations...
function SortBy($arr, $func, $val)
{
$res = array();
if ($func
'author')
{
if ($val
There are 9 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki