Tools To Use Wiki As a Pim

Last edited by DanieleCruciani
Sun, 28 Jun 2009 17:03 UTC [diff]

One use of Wikka is as a Personal Information Manager. For some things the free-form writing nature of a wiki is useful (and, dare-I-say, liberating). However, as some of our usage at this site suggests, there are tools that can be developed AS actions in wikka that can make some aspects of information management a bit easier. In the past six months I've modified/developed two tools (with more forthcoming) with this purpose. One tool is a collection of actions so that schedules can be kept and organized on line. Its components include a "rapid entry" tool (scheduler.php, which should be kept on a page called ScheDuler), a monthly schedule view (monthschedule.php which should be kept on a page called MonthSchedule) and a day view (dayview.php which should be kept on a page called DaySchedule). These actions depend on a function which must be included as a file in the scripts directory. A year-view calendar is also available at GmBowenCalendar.

The other available action is a task manager (based on gbtask). The badwordfunction is at the bottom of the page (and currently is needed by the task manager & must be included in wikka.php).

Scheduler

Scheduler is an action which allows a person to keep a day calendar (or diary for that matter). Although the entry formatting is simple, at the same time it provides flexibility. A user can enter a day schedule.....

8:00 am - meeting with joe
9:00 am - coffee with angie
10:00 am - clients from budapest

or use it to keep a to-do list, or even a diary for the day. The schedule for a day can be viewed with the entry tool, in the monthly view, or in the day view. The day viewer is formatted for printing out usable schedules, & you can designate a specific user with it and see somebody else's schedule (I intend on modifying this so that there will be an easy-to-use text entry box for entering user names).
http://gmbtst.msvu.ca/wikitest/scheduler.jpg

Code for table in data base.....
CREATE TABLE `wakka_scheduler` (
  `id` INT(10) NOT NULL AUTO_INCREMENT,
  `user` VARCHAR(80) NOT NULL DEFAULT '',
  `day` tinyint(2) NOT NULL DEFAULT '0',
  `month` tinyint(2) NOT NULL DEFAULT '0',
  `year` mediumint(4) NOT NULL DEFAULT '0',
  `dayschedule` text,
  PRIMARY KEY  (`id`)
) TYPE=MyISAM;


These actions rely on a "bad word function" which must be placed as a file called badwordfunction.php located in a directory called scripts located in the wiki root directory.
  1. <?php
  2. //remove bad word filter
  3. //Must be called badwordfunction.php and be placed in a directory called "scripts" in wakka root.
  4.  
  5. function BadWordFunction($RemoveBadWordText) {
  6.     $RemoveBadWordText = eregi_replace("fuc?k|[kc]unt|motherfucker|cocksucker|bitch|son of a bitch|asshole|shit|fag|wank|dick|pu[zs]?[zs][yi]|bastard|s[kc]rew|mole[zs]ter|mole[sz]t|coc?k", "", $RemoveBadWordText);
  7. return $RemoveBadWordText;
  8. }
  9. ?>


below code added to actions directory as scheduler.php. The action should be placed on a page called "ScheDule".
  1. <?php
  2. // Scheduler Version 1.1f - Jan 7, 2005 - bad word function call
  3. // The original parts of this script were developed by G. Michael Bowen And Mark Kasper for a SSHRC research project using wikka wiki.
  4. // As far as it is possible to tell (because the code exists all over the web), we provide credit to the original calendar code for the
  5. // to Marcus Kazmierczak and released at www.blazonry.com, although this script builds considerably on that code.
  6. // Code additions copyright GMBowen & Mark Kasper, 2004. Released to public domain under GPL. Modify, improve, change as you wish.
  7. // There are two complementary actions. dayschedule.php allows anyone to designate an owner & date to see their schedule (see line 140)
  8. // and the should be placed on a page named "DaySchedule". The other action, monthschedule.php, is a
  9. // larger version of the dayschedule action which shows entries for an entire month on one page.
  10. ?>
  11. <div align="center">
  12. <P><TABLE BORDER=0>
  13.    <TR>
  14.       <TD>
  15.          <P>
  16. <?php
  17. $month = (!isset($_GET['month'])) ? date("n",mktime()) : $_GET['month'];    
  18. $year = (!isset($_GET['year'])) ? date("Y",mktime()) : $_GET['year'];
  19. $today = (!isset($_GET['day'])) ? date("d",mktime()) : $_GET['day'];
  20.  
  21. $site_base = $this->GetConfigValue("base_url");
  22. $thispage=$this->GetPageTag();
  23.  
  24. // badword array for replacing badwords (not initialized as currently using added function in wakka.php)
  25. //$badwords = Array ('/motherfucker/i', '/cunt/i', '/fuck/i', '/cocksucker/i', '/bitch/i', '/son of a bitch/i', '/asshole/i', '/shit/i', '/fag/i', '/wank/i', '/dick/i', '/pussy/i', '/bastard/i', '/molester/i', '/molezter/i', '/cock/i');
  26. //$changeto = '****';
  27.  
  28. // gets username
  29. $username = $this->GetUserName();
  30.  
  31. // kasper
  32. //  NOTE VERY IMPORTANT,  if the table is totally empty the function will not work, you
  33. //                        must add one in maually, for this function to work
  34. //                        I could add it in the code but very messy, will come up with better way.
  35.  
  36. $dayschedule = $_POST['dayscheduleX'];
  37.  
  38. include_once("./scripts/badwordfunction.php");
  39. $dayschedule = BadWordFunction($dayschedule);
  40. $dayschedule = addslashes($dayschedule);  // for single quotes to work
  41.  
  42.  
  43. // replace above function call with line below if wakka.php doesn't have a bad word function code in it
  44. //$dayschedule = preg_replace($badwords, $changeto, $dayschedule);
  45.  
  46. $query = "select * from ".$this->config['table_prefix']."scheduler";
  47. $result = mysql_query($query);
  48.  
  49. if ($_POST['save']){
  50.     // Kasper added to delete the empty schedule
  51.   $del = "delete from ".$this->config['table_prefix']."scheduler where dayschedule = ''";
  52.   $delresult = mysql_query($del);
  53.   $up = 0;
  54.     while ($row = mysql_fetch_object($result))
  55.     {      
  56.         if($row->user == $username && $row->month == $month && $row->day == $today && $row->year == $year)
  57.         {
  58.          $up = 1;      
  59.          $ro = $row->id;      
  60.         }                    
  61.     }
  62.  
  63.     if($up == 1)
  64.     {        
  65.         $query = "UPDATE ".$this->config['table_prefix']."scheduler SET dayschedule='$dayschedule' WHERE user='$username' AND id='$ro'";
  66.         $result = mysql_query($query);
  67.     }else{      
  68.         $query = "INSERT into ".$this->config['table_prefix']."scheduler (user,dayschedule,month,day,year) VALUES ('$username','$dayschedule','$month','$today','$year')";
  69.         $result = mysql_query($query);              
  70.     }
  71. }
  72.  
  73. // end kasper
  74. ?>
  75.  
  76. <table BGCOLOR="#DDccbb">
  77.     <tr>
  78.         <td valign="top">
  79. <?php
  80.     /*== get what weekday the first is on ==*/
  81.     $tmpd = getdate(mktime(0,0,0,$month,1,$year));
  82.     $monthname = $tmpd["month"];
  83.     $firstwday= $tmpd["wday"];
  84.     $lastday = mk_getLastDayofMonth($month,$year);
  85. ?>
  86. <table cellpadding="2" cellspacing="0" border="1">
  87.     <tr BGCOLOR="#ffffff">
  88.         <td colspan="7">
  89.             <table cellpadding="0" cellspacing="0" border="0" width="100%">
  90.                 <tr  BGCOLOR="#ffffff">
  91.                     <td width="20"><a href="<?php echo $this->href("", "", "month="); echo (($month-1)<1) ? 12 : $month-1 ; ?>&year=<?php echo (($month-1)<1) ? $year-1 : $year ; ?>"><<<</a></td>
  92.                     <td align="center"><font size="2"><?php echo "$monthname $year"; ?></font></td>
  93.                     <td width="20"><a href="<?php echo $this->href("", "", "month="); echo (($month+1)>12) ? 1 : $month+1 ; ?>&year=<?php echo (($month+1)>12) ? $year+1 : $year ; ?>">>>></a></td>
  94.                 </tr>
  95.             </table>
  96.       </td>
  97.     </tr>
  98.     <tr BGCOLOR="#DDccbb">
  99.         <td width="22">Su</td>
  100.         <td width="22">Mo</td>
  101.         <td width="22">Tu</td>
  102.         <td width="22">We</td>
  103.         <td width="22">Th</td>
  104.         <td width="22">Fr</td>
  105.         <td width="22">Sa</td>
  106.     </tr>
  107.     <?php
  108.     $day = 1;
  109.     $wday = $firstwday;
  110.     $firstweek = true;
  111.  
  112.     /*== loop through all the days of the month ==*/
  113.     while ( $day <= $lastday)
  114.     {
  115.         /*== set up blank days for first week ==*/
  116.         if ($firstweek) {
  117.             print "    <tr  BGCOLOR=\"#ffffff\">";
  118.             for ($i=1; $i<=$firstwday; $i++)
  119.             { print "        <td><font size=\"2\"> </font></td>"; }
  120.             $firstweek = false;
  121.         }
  122.  
  123.         /*== Sunday start week with <tr> ==*/
  124.         if ($wday==0) { print "    <tr BGCOLOR=\"#ffffff\">\n"; }
  125.  
  126.          /*== check for event ==*/
  127.          print "        <td>";
  128.         if($day<10) {
  129.             if($month<10) {
  130.                 $tag = "$year:0$month:0$day";
  131.             } else {
  132.                 $tag = "$year:$month:0$day";
  133.             }
  134.         } else {
  135.             if($month<10) {
  136.                 $tag = "$year:0$month:$day";
  137.             } else {
  138.                 $tag = "$year:$month:$day";
  139.             }
  140.         }
  141.        
  142.         $todaydate = date("Y:m:d",mktime());
  143.         if($tag==$todaydate)
  144.         {
  145.             $font1 = "<font color=\"#FF0000\"><b>";
  146.             $font2 = "</b></font>";
  147.         }
  148.         else
  149.         {
  150.             $font1 = "";
  151.             $font2 = "";
  152.         }
  153.         print "<a href=".$site_base.$thispage."&day=$day&month=$month&year=$year>$font1$day$font2</a>";
  154.         print "</td>\n";
  155.  
  156.         /*== Saturday week with </tr> ==*/
  157.         if ($wday==6) { print "    </tr>\n"; }
  158.  
  159.         $wday++;
  160.         $wday = $wday % 7;
  161.         $day++;
  162.     }
  163. ?>
  164.     </tr>
  165. </table>
  166.  
  167.         </td>
  168.     </tr>
  169. </table>
  170.  
  171. <?php
  172. /*== get the last day of the month ==*/
  173. function mk_getLastDayofMonth($mon,$year)
  174. {
  175.   for ($tday=28; $tday <= 31; $tday++)
  176.   {
  177.     $tdate = getdate(mktime(0,0,0,$mon,$tday,$year));
  178.     if ($tdate["mon"] != $mon) break;
  179.   }
  180. $tday--;
  181. return $tday;
  182. }
  183. ?>
  184. <!-- Comment line below out if you don't want to link to the formatted schedule page-->
  185. <center><a href=<? echo $site_base; ?>DaySchedule&<? echo "month=".$month."&day=".$today."&year=".$year; ?>><small>Day Schedule</small></a>
  186.  | 
  187. <a href=<? echo $site_base; ?>MonthSchedule&<? echo "month=".$month."&day=".$today."&year=".$year; ?>><small>Month Schedule</small></a></center>
  188.       </TD>
  189.       <TD WIDTH=500>
  190.     <P>
  191.  
  192. <?php
  193. if ($user = $this->GetUser())
  194. {
  195.   $dayschedule = str_replace("\n", ",", $_POST['dayschedule']);
  196.  
  197.     // title over textarea box
  198.   $printowner = $username."'s Schedule for ";
  199.   $dayschedule = $this->LoadSingle("SELECT dayschedule FROM ".$this->config["table_prefix"]."scheduler WHERE user='".$username."' AND day='".$today."' AND month='".$month."' AND year='".$year."'");
  200. // replaced a comma with XXZXX below....I don't know what the purpose of the code is...
  201.   $dayschedule = str_replace("XXZXX", "\n", $dayschedule[dayschedule]);
  202.   $output = str_replace(",", " ", $dayschedule[dayschedule]);
  203. ?>
  204.          <br><a href="<?php echo $this->href("", "", "day="); echo (($today-1)<1) ? $lastday : $today-1 ; ?>&year=<?php echo $year; ?>&month=<?php echo $month; ?>"><<</a>
  205.         <b><? echo "$printowner$monthname $today, $year:"; ?></b>
  206.         <a href="<?php echo $this->href("", "", "day="); echo (($today+1)>$lastday) ? 1 : $today+1 ; ?>&year=<?php echo $year; ?>&month=<?php echo $month; ?>">>></a>
  207.         <form action="" method="post">
  208.             <textarea cols="65" rows="12" name="dayscheduleX"><?php echo $dayschedule; ?></textarea>
  209.             <input type="submit" value="Submit" />
  210.                <input type="hidden" name="save" value="true" />
  211.         </form>
  212. <?
  213. }
  214. else
  215. {
  216. echo "<em>The Scheduler only works for logged-in users.</em>";
  217. } ?>
  218. </P>
  219.       </TD>
  220.    </TR>
  221. </TABLE>
  222. </div>


The following is the action which shows a formatted output for a selected day....the current day (by default) or for any other day (using a link from the scheduler.php & monthview.php actions)....it should be saved into the actions directory as dayschedule.php and for proper functioning with scheduler.php should be placed on a page called DaySchedule.
  1. <?php
  2. // This script was developed by G. Michael Bowen for a SSHRC research project using wikka wiki.
  3. // This action complements the scheduler.php action showing the day schedule for that user.
  4. // DaySchedule Version 1c -- Jan 6, 2005
  5. // This action should be placed on a page called "DaySchedule" to work with the scheduler.
  6. // Code copyright GMBowen. Released to public domain under GPL. Modify, improve, change as you wish.
  7.  
  8. $month = (!isset($_GET['month'])) ? date("n",mktime()) : $_GET['month'];    
  9. // $monthname = $month;
  10. $tmpd = getdate(mktime(0,0,0,$month,1,$year));
  11. $monthname = $tmpd["month"];
  12. $year = (!isset($_GET['year'])) ? date("Y",mktime()) : $_GET['year'];
  13. $today = (!isset($_GET['day'])) ? date("d",mktime()) : $_GET['day'];
  14. $site_base = $this->GetConfigValue("base_url");
  15. $thispage=$this->GetPageTag();
  16. $lastday = getLastDayofMonth($month,$year);
  17.  
  18. /*== get the last day of the month ==*/
  19. function getLastDayofMonth($mon,$year)
  20. {
  21.   for ($tday=28; $tday <= 31; $tday++)
  22.   {
  23.     $tdate = getdate(mktime(0,0,0,$mon,$tday,$year));
  24.     if ($tdate["mon"] != $mon) break;
  25.   }
  26. $tday--;
  27. return $tday;
  28. }
  29.  
  30. // gets username
  31. $username = $this->GetUserName();
  32. $user = $username;
  33.  
  34. $dayschedule = $this->LoadSingle("SELECT dayschedule FROM ".$this->config["table_prefix"]."scheduler WHERE user='".$username."' AND day='".$today."' AND month='".$month."' AND year='".$year."'");
  35. $printout = str_replace("\n", "<HR></TD></TR><TR ALIGN='left'><TD>", $dayschedule[dayschedule]);   
  36. $printowner = $username."'s entries for ";
  37. ?>
  38. <div align="center">
  39. <center>      <a href="<?php echo $this->href("", "", "day="); echo (($today-1)<1) ? $lastday : $today-1 ; ?>&year=<?php echo $year; ?>&month=<?php echo $month; ?>"><<</a>
  40.         <b><? echo "$printowner$monthname $today, $year:"; ?></b>
  41.         <a href="<?php echo $this->href("", "", "day="); echo (($today+1)>$lastday) ? 1 : $today+1 ; ?>&year=<?php echo $year; ?>&month=<?php echo $month; ?>">>></a>
  42.  
  43. <TABLE class='box' width='600' border='1' CELLSPACING='1' CELLPADDING='7' BGCOLOR='#DDccbb'>
  44.    <TR>
  45.       <TD>
  46. <P><TABLE class='box' width='100%' border='0' CELLSPACING='0' CELLPADDING='2' BGCOLOR='#ffffff'>
  47.    <TR ALIGN='left'>
  48.       <TD>
  49.          <P>
  50. <?
  51. if ($user = $this->GetUser())
  52. {
  53.     if(!empty($printout))
  54.         {
  55.         echo $printout;
  56.         }
  57.         else
  58.         {
  59.         echo "There are no entries on this day.";
  60.         }
  61. }
  62. else
  63. {
  64. echo "<em>Showing the day schedule only works for logged-in users.</em>";
  65. }
  66. ?>
  67. </P>
  68.       </TD>
  69.    </TR>
  70. </TABLE>
  71.       </TD>
  72.    </TR>
  73. </TABLE>
  74. <center><a href=<? echo $site_base; ?>ScheDuler&<? echo "month=".$month."&day=".$today."&year=".$year; ?>><small>Small Scheduler</small></a>
  75.  | 
  76. <a href=<? echo $site_base; ?>MonthSchedule&<? echo "month=".$month."&day=".$today."&year=".$year; ?>><small>Month Scheduler</small></a></center>
  77. </center></div>

This is a screenshot of the dayschedule.php output...
http://gmbtst.msvu.ca/wikitest/dayschedule.jpg

This final action show a month-view with all of the entries. It should be saved into the actions directory as monthscheduler.php and for proper functioning with scheduler.php the action should be placed on a page called MonthSchedule.
  1. <?php
  2. // Month Scheduler Version 1.0c - Jan 7, 2005 - bad word function call
  3. // The original parts of this script were developed by G. Michael Bowen And Mark Kasper for a SSHRC research project using wikka wiki.
  4. // As far as it is possible to tell (because the code exists all over the web), we provide credit for the original calendar code
  5. // to Marcus Kazmierczak which was released at www.blazonry.com, although this script builds considerably on that code.
  6. // Code additions copyright GMBowen & Mark Kasper, 2004. Released to public domain under GPL. Modify, improve, change as you wish.
  7. // There are two complementary actions. dayschedule.php allows anyone to designate an owner & date to see their schedule (see line 140)
  8. // and it should be placed on a page named "DaySchedule". The other action, scheduler.php, is a small version of the calendar action
  9. // which allows easy and fast entering of data on different days.
  10. ?>
  11. <div align="center">
  12. <P><TABLE BORDER=0 width=100%>
  13.    <TR>
  14.       <TD>
  15.          <P>
  16. <?php
  17. $month = (!isset($_GET['month'])) ? date("n",mktime()) : $_GET['month'];    
  18. $year = (!isset($_GET['year'])) ? date("Y",mktime()) : $_GET['year'];
  19. $today = (!isset($_GET['day'])) ? date("d",mktime()) : $_GET['day'];
  20.  
  21. $site_base = $this->GetConfigValue("base_url");
  22. $thispage=$this->GetPageTag();
  23. $username = $this->GetUserName();
  24.  
  25. // badword array for replacing badwords (not initialized as currently using added function in wakka.php)
  26. //$badwords = Array ('/motherfucker/i', '/cunt/i', '/fuck/i', '/cocksucker/i', '/bitch/i', '/son of a bitch/i', '/asshole/i', '/shit/i', '/fag/i', '/wank/i', '/dick/i', '/pussy/i', '/bastard/i', '/molester/i', '/molezter/i', '/cock/i');
  27. //$changeto = '****';
  28.  
  29. // gets username
  30. $username = $this->GetUserName();
  31.  
  32. // kasper
  33. //  NOTE VERY IMPORTANT,  if the table is totally empty the function will not work, you
  34. //                        must add one in maually for this function to work.
  35. //                        I could add it in the code but very messy, will come up with better way.
  36.  
  37. $dayschedule = $_POST['dayscheduleX'];
  38. include_once("./scripts/badwordfunction.php");
  39. $dayschedule = BadWordFunction($dayschedule);
  40. $dayschedule = addslashes($dayschedule);  // for single quotes to work
  41.  
  42.  
  43. // replace above function call with line below if wakka.php doesn't have a bad word function code in it
  44. //$dayschedule = preg_replace($badwords, $changeto, $dayschedule);
  45.  
  46. $query = "select * from ".$this->config['table_prefix']."scheduler";
  47. $result = mysql_query($query);
  48.  
  49. if ($_POST['save']){
  50.     // Kasper added to delete the empty schedule
  51.   $del = "delete from ".$this->config['table_prefix']."scheduler where dayschedule = ''";
  52.   $delresult = mysql_query($del);
  53.   $up = 0;
  54.     while ($row = mysql_fetch_object($result))
  55.     {      
  56.         if($row->user == $username && $row->month == $month && $row->day == $today && $row->year == $year)
  57.         {
  58.          $up = 1;      
  59.          $ro = $row->id;      
  60.         }                    
  61.     }
  62.  
  63.     if($up == 1)
  64.     {        
  65.         $query = "UPDATE ".$this->config['table_prefix']."scheduler SET dayschedule='$dayschedule' WHERE user='$username' AND id='$ro'";
  66.         $result = mysql_query($query);
  67.     }else{      
  68.         $query = "INSERT into ".$this->config['table_prefix']."scheduler (user,dayschedule,month,day,year) VALUES ('$username','$dayschedule','$month','$today','$year')";
  69.         $result = mysql_query($query);              
  70.     }
  71. }
  72. // end kasper
  73. ?>
  74. <table>
  75.     <tr>
  76.         <td valign="top">
  77. <?php
  78.     /*== get what weekday the first is on ==*/
  79.     $tmpd = getdate(mktime(0,0,0,$month,1,$year));
  80.     $monthname = $tmpd["month"];
  81.     $firstwday= $tmpd["wday"];
  82.     $lastday = mk_getLastDayofMonth($month,$year);
  83. ?>
  84. <table cellpadding="2" cellspacing="0" border="1">
  85.     <tr>
  86.         <td colspan="7">
  87.             <table cellpadding="0" cellspacing="0" border="0" width="100%">
  88.                 <tr>
  89.                     <td width="20"><a href="<?php echo $this->href("", "", "month="); echo (($month-1)<1) ? 12 : $month-1 ; ?>&year=<?php echo (($month-1)<1) ? $year-1 : $year ; ?>"><<<</a></td>
  90.                     <td align="center"><font size="2"><strong><? echo $username ?>'s Calendar for <?php echo "$monthname $year"; ?></strong></font></td>
  91.                     <td width="20"><a href="<?php echo $this->href("", "", "month="); echo (($month+1)>12) ? 1 : $month+1 ; ?>&year=<?php echo (($month+1)>12) ? $year+1 : $year ; ?>">>>></a></td>
  92.                 </tr>
  93.             </table>
  94.       </td>
  95.     </tr>
  96.     <tr BGCOLOR="#DDccbb">
  97.         <td>Sunday</td>
  98.         <td>Monday</td>
  99.         <td>Tuesday</td>
  100.         <td>Wednesday</td>
  101.         <td>Thursday</td>
  102.         <td>Friday</td>
  103.         <td>Saturday</td>
  104.     </tr>
  105.     <?php
  106.     $day = 1;
  107.     $wday = $firstwday;
  108.     $firstweek = true;
  109.  
  110.     /*== loop through all the days of the month ==*/
  111.     while ( $day <= $lastday)
  112.     {
  113.         /*== set up blank days for first week ==*/
  114.         if ($firstweek) {
  115.             print "    <tr>";
  116.             for ($i=1; $i<=$firstwday; $i++)
  117.             { print "        <td VALIGN=top ALIGN=left HEIGHT=70><font size=\"2\"> </font></td>"; }
  118.             $firstweek = false;
  119.         }
  120.  
  121.         /*== Sunday start week with <tr> ==*/
  122.         if ($wday==0) { print "    <tr>\n"; }
  123.  
  124.          /*== check for event ==*/
  125.          print "        <td VALIGN=top ALIGN=left WIDTH=150 HEIGHT=70>";
  126.         if($day<10) {
  127.             if($month<10) {
  128.                 $tag = "$year:0$month:0$day";
  129.             } else {
  130.                 $tag = "$year:$month:0$day";
  131.             }
  132.         } else {
  133.             if($month<10) {
  134.                 $tag = "$year:0$month:$day";
  135.             } else {
  136.                 $tag = "$year:$month:$day";
  137.             }
  138.         }
  139.        
  140.         $todaydate = date("Y:m:d",mktime());
  141.         if($tag==$todaydate)
  142.         {
  143.             $font1 = "<font color=\"#FF0000\"><b>";
  144.             $font2 = "</b></font>";
  145.         $token="yes";  
  146.         }
  147.         else
  148.         {
  149.             $font1 = "";
  150.             $font2 = "";
  151.         $token="no";
  152.         }
  153. // code to determine what data should be entered into each cell
  154.     $thisdayschedule = $this->LoadSingle("SELECT dayschedule FROM ".$this->config["table_prefix"]."scheduler WHERE user='".$username."' AND day='".$day."' AND month='".$month."' AND year='".$year."'");
  155.     $dayoutput = str_replace("\n", "<br> ", $thisdayschedule[dayschedule]);
  156.     if ($token=="yes")
  157.         {
  158.         $printme="<a href=".$site_base."DaySchedule&month=".$month."&day=".$today."&year=".$year."><small>[Print Day]</small></a>";
  159.         }
  160.         else
  161.         {
  162.         $printme="";
  163.         }
  164.         print "<table width=\"100%\"><TR BGCOLOR=\"#E4DFDA\"><td><a href=".$site_base.$thispage."&day=$day&month=$month&year=$year#EntryBox> $font1$day$font2</a> $printme</td</tr><tr><td><small>$dayoutput</small></td></tr></table>";
  165.         print "</td>\n";
  166.  
  167.         /*== Saturday week with </tr> ==*/
  168.         if ($wday==6) { print "    </tr>\n"; }
  169.  
  170.         $wday++;
  171.         $wday = $wday % 7;
  172.         $day++;
  173.     }
  174. ?>
  175.     </tr>
  176. </table>
  177.  
  178.         </td>
  179.     </tr>
  180. </table>
  181. <?php
  182. /*== get the last day of the month ==*/
  183. function mk_getLastDayofMonth($mon,$year)
  184. {
  185.   for ($tday=28; $tday <= 31; $tday++)
  186.   {
  187.     $tdate = getdate(mktime(0,0,0,$mon,$tday,$year));
  188.     if ($tdate["mon"] != $mon) break;
  189.   }
  190. $tday--;
  191. return $tday;
  192. }
  193. ?>
  194. <!-- Comment below 3 lines out if you don't want to link to the formatted schedule page & scheduler page.-->
  195. <center><a href=<? echo $site_base; ?>DaySchedule&<? echo "month=".$month."&day=".$today."&year=".$year; ?>><small>Formatted Day Page</small></a>
  196.  | 
  197. <a href=<? echo $site_base; ?>Scheduler&<? echo "month=".$month."&day=".$today."&year=".$year; ?>><small>Small Monthly Calendar</small></a></center>
  198.  
  199.        </TD>
  200.     </tr><tr>
  201.       <TD WIDTH=500>
  202.     <P>
  203. <?
  204. if ($user = $this->GetUser())
  205. {
  206.   $dayschedule = str_replace("\n", ",", $_POST['dayschedule']);
  207.  
  208.     // title over textarea box
  209.   $printowner = $username."'s Schedule for ";
  210.   $dayschedule = $this->LoadSingle("SELECT dayschedule FROM ".$this->config["table_prefix"]."scheduler WHERE user='".$username."' AND day='".$today."' AND month='".$month."' AND year='".$year."'");
  211. // replaced a comma with XXZXX below....I don't know what the purpose of the code is...
  212.   $dayschedule = str_replace("XXZXX", "\n", $dayschedule[dayschedule]);
  213.   $output = str_replace(",", " ", $dayschedule[dayschedule]);
  214. ?>
  215. <center><A NAME=EntryBox></A>
  216.       <a href="<?php echo $this->href("", "", "day="); echo (($today-1)<1) ? $lastday : $today-1 ; ?>&year=<?php echo $year; ?>&month=<?php echo $month; ?>"><<</a>
  217.         <b><? echo "$printowner$monthname $today, $year:"; ?></b>
  218.         <a href="<?php echo $this->href("", "", "day="); echo (($today+1)>$lastday) ? 1 : $today+1 ; ?>&year=<?php echo $year; ?>&month=<?php echo $month; ?>">>></a>
  219.         <center><form action="" method="post">
  220.             <textarea cols="65" rows="12" name="dayscheduleX"><?php echo $dayschedule; ?></textarea>
  221.             <input type="submit" value="Submit" />
  222.                <input type="hidden" name="save" value="true" />
  223.         </form></center>   
  224. </center>
  225. <?
  226.     }
  227.     else
  228.     {
  229. echo "<em>The Scheduler only works for logged-in users.</em>";
  230.     }
  231. ?>
  232. </P>
  233.       </TD>
  234.    </TR>
  235. </TABLE>
  236. </div>

The following is a screen shot of the monthscheduler.
http://gmbtst.msvu.ca/wikitest/monthview.jpg

Task Manager

The task manager has two components. One is called mytasks.php which shows the task list of the logged in user & allows you to edit your task lists. The other is a (highly) modified version called usertasks.php which can be used to look at the task list of other users. It allows multiple instances of the action on the same page (so you can keep the task lists of all 3 people on the project in one page at once). It REQUIRES the usertasksfunctions.php file to be placed in a directory called "scripts" in the wiki root directory. The functions in it have been re-named from those in mytasks.php so you can have mytasks.php & usertasks.php on the same page (but only ONE copy of mytasks.php).
http://gmbtst.msvu.ca/wikitest/taskmanager.jpg

Note that there is a function code conflict in the mytasks.php action that causes problems if two copies are put on one page. JavaWoman steered me towards include_once() and require_once() which I implemented in wikkaforum & usertasks.php which works quite well. I'll work at implementing it here for the mytasks.php manager code in the coming week.


Save the below code as mytasks.php and place in the actions directory (REMEMBER, it needs the Bad Word Function included in wakka.php for now...the code is at the bottom of the page).
  1. <?
  2. // This {{action}} script for derivations of wakka wiki is heavily modified from a standalone single-script package
  3. // produced by and provided by the author identified in the text box below....although it is released by her as a "free to use"
  4. // script, no mention is made of any problems with commercial use. If you intend on using this action script modified from the
  5. // geniusbug code, especially for commercial purposes, you should contact the original author for permission to use the original
  6. // components. All modifications of the original script by G. Michael Bowen & Mark Kasper are provided under a GPL license.
  7. // Ongoing attribution of authorial contributions in any future modifications would be appreciated.
  8. ////////////////////////////////////////
  9. //  GBTask Task Manager               //
  10. //  Naomi C. Martinson                //
  11. //  2002 © http://www.geniusbug.com   //
  12. //  Don't remove this message         //
  13. //  Contact: [email protected]      //
  14. ////////////////////////////////////////
  15. if ($this->method == "show") {
  16. global $linktm;
  17. $linktm = $this->config["base_url"].$this->MiniHref($method, $tag);
  18. $delete_id = $_REQUEST['delete_id'];
  19. $edit_id = $_REQUEST['edit_id'];
  20. $task_id = $_REQUEST['task_id'];
  21. $add_id = $_POST['add_id'];
  22. $task_title = $_POST['task_title'];
  23. $task_content = $_POST['task_content'];
  24. $task_status = $_POST['task_status'];
  25. $order1 = $_REQUEST['order1'];
  26. $dir1 = $_REQUEST['dir1'];
  27.  
  28. $task_owner = $this->GetUserName();
  29.  
  30. // kasper
  31. if($_REQUEST['tm_page'] == '' || $_REQUEST['tm_page'] == NULL){$tm_page = '1';}else{$tm_page = $_REQUEST['tm_page'];}
  32.  
  33. $update_id = $_POST[update_id];
  34. $tm_direction = $_REQUEST[dir];
  35. $keyword = $_POST[keyword];
  36. if ($items == '' || $items =='0') { $items = 10;}
  37. $items_per_page = $items;
  38.  
  39. session_register("records_page");
  40. $records_page = $items_per_page;
  41.  
  42. if(isset($tm_order)){
  43.     session_register("list_order");
  44.     $list_order = $tm_order;
  45. }
  46.  
  47. if(isset($tm_direction)){
  48.     session_register("list_dir");
  49.     $list_dir = $tm_direction;
  50. }
  51.  
  52. if(isset($set_theme)){
  53.     session_register("theme");
  54.     $theme = $set_theme;
  55. }
  56.  
  57. if (isset($showsource)) {
  58.     show_source($HTTP_SERVER_VARS["SCRIPT_FILENAME"]);
  59.     exit;
  60. }
  61.  
  62. //delete statement
  63. if (strlen($delete_id) > 0){
  64.     $strSQL = "UPDATE ".$this->config["table_prefix"]."task SET task_delete = '1' WHERE task_id = ".$delete_id;
  65.     mysql_query($strSQL);
  66. }
  67.  
  68. if (strlen($update_id) > 0){
  69.  
  70. // Bad Word Filter For Messages - Just erase the below line if you want people to be able to enter bad words.
  71. $task_content = BadWordFunc($task_content);
  72. $task_title = BadWordFunc($task_title);
  73.  
  74.     $strSQL = "UPDATE ".$this->config["table_prefix"]."task SET user = '".$task_owner."', task_title = '".$task_title."', task_content = '".$task_content."', task_status = '".$task_status."' WHERE task_id=".$update_id;
  75.     mysql_query($strSQL);
  76.  
  77. //redirect sending a header to the server
  78. header("Location: ".$linktm."&tm_page=".$tm_page);
  79. }
  80.  
  81. $delete_id = $_REQUEST['delete_id'];
  82. $edit_id = $_REQUEST['edit_id'];
  83. //$tm_page = $_REQUEST['tm_page'];
  84. $task_id = $_REQUEST['task_id'];
  85. $add_id = $_POST['add_id'];
  86. $task_title = $_POST['task_title'];
  87. $task_content = $_POST['task_content'];
  88. $task_status = $_POST['task_status'];
  89. //$task_owner = $this->GetPageOwner();
  90.  
  91. //add statement
  92. if (strlen($add_id) > 0){
  93.     $task_timestamp = date("Y-m-d H:i:s",mktime());    
  94.  
  95. //$task_status = "Incomplete";
  96.  
  97. // Bad Word Filter For Messages - Just erase the below line if you want people to be able to enter bad words.
  98. $task_content = BadWordFunc($task_content);
  99. $task_title = BadWordFunc($task_title);
  100.  
  101.     $strSQL = "INSERT Into ".$this->config["table_prefix"]."task (user, task_timestamp, task_title, task_content, task_status) VALUES ('$task_owner','$task_timestamp', '$task_title', '$task_content', '$task_status')";
  102.     mysql_query($strSQL);
  103.  
  104. //redirect sending a header to the server    
  105. header("Location: ".$linktm."&tm_page=".$tm_page);
  106. }
  107.  
  108. //resume to 10 items per page
  109. if(!isset($records_page)){
  110.     $records_page = 10;
  111. }
  112.  
  113. // GMB Changed below line to include "where" statement
  114.  
  115. $strSQL = "SELECT * From ".$this->config["table_prefix"]."task WHERE user = '$task_owner' AND task_delete = '0'";
  116. $query = mysql_query($strSQL);
  117.  
  118. $total_records = mysql_num_rows($query);
  119.  
  120. if (!isset($tm_page)) {
  121.     $tm_page=1;
  122. }
  123. $num_pages = ceil($total_records / $records_page);
  124. for ($i=1;$i<=$num_pages;$i++) {
  125.     $tm_page_nav = $tm_page_nav."[<a href=\"".$linktm."&tm_page=".$i."\">".$i."</a>] \n";
  126. }
  127.  
  128. //header
  129. echo "<html><head>\n";
  130. //echo "<style type=\"text/css\">\n";
  131. echo "<!-- \n";
  132. echo "body {color:gray; font-size:10px; font-family:verdana,arial;}\n";
  133. echo "td {color:gray; font-size:10px; font-family:verdana,arial;}\n";
  134. echo "--> \n";
  135. echo "</style>\n";
  136. echo "</head>\n";
  137. echo "<body bgcolor=\"white\">\n";
  138.  
  139. echo "<table width=90% cellpadding=0 cellspacing=0 border=0 align=center><tr><td bgcolor=white align=\"center\" valign=top>\n";
  140.  
  141. //html header, search form items, per page form
  142. echo "<form method=post action=\"".$linktm."\">\n";
  143. echo "<span style='color:gray; font-size:10px; font-family:verdana,arial;'> Task Owner: $task_owner </span>";
  144. echo "<table width=75% cellpadding=0 cellspacing=0 border=0 valign=bottom><tr>\n";
  145. echo "<td bgcolor=\"#949AE7\" valign=bottom><img src=\"images/trs.gif\" width=1 height=1></td>\n";
  146. echo "</tr></table>\n";
  147. echo "<table width=75% cellpadding=0 cellspacing=0 border=0><tr>\n";
  148. echo "<td bgcolor=\"E9EBF3\">
  149.        <table width=100%><tr>
  150.           <td align=left>
  151.           <span style='color:gray; font-size:10px; font-family:verdana,arial;'> <!-- Page Owner: $task_owner -->
  152.           Pages: $tm_page_nav <a href=\"$linktm#tip1\"><font color=\"red\"><b><u>*</u></b></font></a> (Pg: $tm_page)</td>
  153.           <td align=center><a href=\"$linktm\"><b>
  154.           <span style='color:gray; font-size:10px; font-family:verdana,arial;'>
  155.           [HOME]</b></a>  <a href=\"".$linktm."&task_id=ALL&tm_page=$tm_page&order1=task_title&dir1=DESC\"><b><span style='color:gray; font-size:10px; font-family:verdana,arial;'>[SHOW ALL]</b></a></td>
  156.           <td align=right><input type=text size=15 value=\"keyword\" name=\"keyword\"><input type=submit value=\"Search\"></td>
  157.         </tr></table>
  158.       </td>\n";
  159. echo "</tr></table>\n";
  160. echo "</form>\n";
  161.  
  162. //search function
  163. function get_results($keyword, $linktm, $tm_page, $task_owner, $owner) {        
  164.     //search the database
  165.     $strSQL = "SELECT * From ".$this->config["table_prefix"]."task WHERE task_delete = '0' AND user = '$task_owner' AND task_title LIKE '%".$keyword."%' OR task_content LIKE '%".$keyword."%'";
  166.     $results = mysql_query($strSQL);
  167.    
  168.     if (mysql_num_rows($results) > 0) {
  169.        
  170.         echo "<br>Your keyword is: <b>".$keyword."</b><P>\n";
  171.         echo "<table width=75% cellpadding=4 cellspacing=2 border=0>\n";
  172.         while($mykey = mysql_fetch_array($results)){
  173.            
  174.             //list the results
  175.             echo "<tr>\n";
  176.             echo "<td bgcolor=\"#E9E9E9\" align=left valign=top><font color=white><img src=\"images/trs.gif\" width=70 height=1><br><nobr>\n";
  177.            
  178.             switch ($mykey["task_status"]) {
  179.             case "Incomplete":
  180.             echo "<font color=red>".$mykey["task_status"]."</font>\n";
  181.             break;
  182.            
  183.             case "In Progress":
  184.             echo "<font color=blue>".$mykey["task_status"]."</font>\n";
  185.             break;
  186.            
  187.             case "Complete":
  188.             echo "<font color=green>".$mykey["task_status"]."</font>\n";
  189.             break;
  190.             }
  191.            
  192.             echo "</nobr></font></td>\n";
  193.             echo "<td bgcolor=\"#F3F0F9\" align=left valign=top width=75%><a href=\"".$linktm."&task_id=".$mykey["task_id"]."&tm_page=$page\">".$mykey["task_title"]."</a> (posted on:".$mykey["task_timestamp"].")</td>\n";
  194.             echo "</tr>\n";
  195.         }
  196.         echo "</table>\n";
  197.     }else{
  198.         echo "<P><font color=red>SORRY, NO MATCH!</font><P>\n";
  199.     }
  200.     mysql_free_result($results);
  201. }
  202.  
  203. //view item after search function
  204. function item($task_id, $linktm, $tm_page, $task_owner, $owner, $order1, $dir1) {
  205.     if($task_id == 'ALL'){
  206.    
  207.      $strSQL = "SELECT * From ".$this->config["table_prefix"]."task WHERE task_delete = '0' AND user='$task_owner' ORDER By $order1 $dir1"; //kasper AND task_id =".$task_id;
  208.      $query = mysql_query($strSQL);
  209.    
  210.     echo "<table width=75% cellpadding=4 cellspacing=2 border=0>\n";
  211.     echo "<tr>";
  212.     echo "<td bgcolor=\"#BBBDD9\" width=112px valign=top><b>STATUS <a href=\"".$linktm."&task_id=ALL&order1=task_title&dir1=DESC&num=\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=ALL&order1=task_title&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  213.     echo "<td bgcolor=\"#BBBDD9\" valign=top><b>TASK</b> <a href=\"".$linktm."&task_id=ALL&order1=task_status&dir1=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=ALL&order1=task_status&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  214.     echo "<td bgcolor=\"#BBBDD9\" width=192px valign=top><b>ENTERED ON</b> <a href=\"".$linktm."&task_id=ALL&order1=task_timestamp&dir1=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=ALL&order1=task_timestamp&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  215.     echo "  
  216.           </tr>
  217.           </table>";
  218.            
  219.            
  220.       while ($item = mysql_fetch_object($query)){
  221.            
  222.            echo "<table width=76% cellpadding=4 cellspacing=2 border=0><tr><td>\n";
  223.            echo "<table width=100% cellpadding=1 cellspacing=1 border=0>\n";
  224.            echo "<tr><td bgcolor=\"#E9E9E9\" width=120px align=left valign=top><font color=white><img src=\"images/trs.gif\" width=70 height=1><br><nobr>  \n";
  225.  
  226.            switch ($item->task_status) {
  227.               case "Incomplete":
  228.               echo "<font color=red>".$item->task_status."</font>\n";
  229.               break;
  230.    
  231.               case "In Progress":
  232.               echo "<font color=blue>".$item->task_status."</font>\n";
  233.               break;
  234.    
  235.               case "Complete":
  236.               echo "<font color=green>".$item->task_status."</font>\n";
  237.               break;
  238.            }
  239.    
  240.            echo "</nobr></font></td>\n";
  241.            echo "<td bgcolor=\"#BBBDD9\" align=left valign=top ><font color=white><b>  ".strtoupper($item->task_title)."</b></font></td>";    
  242.            echo "<td width=200px bgcolor=\"#E9E9E9\" align=left valign=top ><center><font color=black>".$item->task_timestamp."</font></center></td></tr></table>\n";
  243.            echo "<table width=100% cellpadding=1 cellspacing=1 border=0><tr><td colspan=3 bgcolor=\"#E9E9E9\" align=left valign=top colspan=2>    ".str_replace("\n", "<br>", $item->task_content)."</td></tr>\n";
  244.            echo "</table></tr></td></table>\n";
  245.       }
  246.     }
  247.     else
  248.     {
  249.        $strSQL = "SELECT * From ".$this->config["table_prefix"]."task WHERE task_delete = '0' AND user='$task_owner' AND task_id =".$task_id;
  250.        $query = mysql_query($strSQL);
  251.        $item = mysql_fetch_array($query);
  252.        echo "<table width=75% cellpadding=4 cellspacing=2 border=0>\n";
  253.        echo "<td width=5% bgcolor=\"#E9E9E9\" align=left valign=top><font color=white><img src=\"images/trs.gif\" width=70 height=1><br><nobr>\n";
  254.  
  255.        switch ($item["task_status"]) {
  256.        case "Incomplete":
  257.        echo "<font color=red>".$item["task_status"]."</font>\n";
  258.        break;
  259.  
  260.        case "In Progress":
  261.        echo "<font color=blue>".$item["task_status"]."</font>\n";
  262.        break;
  263.  
  264.        case "Complete":
  265.        echo "<font color=green>".$item["task_status"]."</font>\n";
  266.        break;
  267.        }
  268.        echo "</nobr></font></td>\n";    
  269.        echo "<td bgcolor=\"#BBBDD9\" align=left valign=top width=75%><font color=white><b>".strtoupper($item["task_title"])."</b> (posted on: ".$item["task_timestamp"].")</font></td></tr>\n";
  270.        echo "<tr><td bgcolor=\"#F3F0F9\" align=left valign=top colspan=2>".str_replace("\n", "<br>", $item["task_content"])."</td></tr>\n";
  271.          
  272.           echo "<tr><td bgcolor=\"#F3F0F9\" align=left valign=top colspan=2><nobr><a href=\"".$linktm."&edit_id=".$item["task_id"]."&tm_page=$tm_page\"><b>EDIT</b></a> | \n";
  273.           echo "<a href=\"javascript: if(confirm('Are you sure you want to delete this item?')){ window.}\"><b>DELETE</b></a></nobr></td></tr>\n";    
  274.        
  275.        echo "</table>\n";
  276.     }
  277. }
  278.  
  279. //list items function
  280. function list_todo($tm_order, $tm_direction, $linktm, $tm_page, $records_page, $task_timestamp, $task_status, $task_owner, $owner) {
  281.  
  282.     if (!isset($tm_order)) {
  283.         $tm_order = "task_timestamp";
  284.     }
  285.    
  286.     if (!isset($tm_direction)) {
  287.         $tm_direction = "DESC";
  288.     }
  289.  
  290.     $begin = (($tm_page-1)*$records_page);
  291.     $strSQL = "SELECT * From ".$this->config["table_prefix"]."task WHERE task_delete = '0' AND user = '$task_owner' ORDER By $tm_order $tm_direction LIMIT $begin,$records_page";
  292.     $query = mysql_query($strSQL);
  293.  
  294. //ECHO 'START of list of items in the cell header information';
  295.  
  296.     echo "<table width=75% cellpadding=2 cellspacing=2 border=0>\n";
  297.     echo "<tr>\n";
  298.     echo "<td bgcolor=\"#BBBDD9\" valign=top>\n";
  299.     echo "<b>TASK <a href=\"".$linktm."&order=task_title&dir=DESC&num=\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&order=task_title&dir=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  300.     echo "<td bgcolor=\"#BBBDD9\" valign=top>\n";
  301.     echo "<b>ENTERED ON</b> <a href=\"".$linktm."&order=task_timestamp&dir=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&order=task_timestamp&dir=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  302.     echo "<td bgcolor=\"#BBBDD9\" valign=top>\n";
  303.     echo "<b>STATUS</b> <a href=\"".$linktm."&order=task_status&dir=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&order=$task_status&dir=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  304.      
  305.         echo "<td bgcolor=\"#BBBDD9\" valign=top><b>MODIFY</b> <img src=\"images/trs.gif\" width=11 height=16 border=0></td>\n";
  306.    
  307.     echo "</tr>\n";
  308.  
  309. //ECHO 'START of list of items after HEADER information (why is this in the wrong place??)';
  310.     //list todo items
  311.     while ($todo = mysql_fetch_array($query)) {
  312.     echo "<tr>\n";
  313.     echo "<td align=left bgcolor=\"#F3F0F9\" valign=top><span title=\"Description: ".$todo["task_content"]."\">".$todo["task_title"]."</span></td>\n";
  314.  
  315.     echo "<td bgcolor=\"#F3F0F9\" valign=top>".$todo["task_timestamp"]."</td>\n";
  316.        
  317.         //items status case
  318.         switch ($todo["task_status"]) {
  319.             case "Incomplete":        
  320.             echo "<td bgcolor=\"#E9E9E9\" valign=top><font color=red>".$todo["task_status"]."</font></td>\n";
  321.             break;
  322.  
  323.             case "In Progress":
  324.             echo "<td bgcolor=\"#E9E9E9\" valign=top><font color=blue>".$todo["task_status"]."</font></td>\n";
  325.             break;
  326.  
  327.             case "Complete":
  328.             echo "<td bgcolor=\"#E9E9E9\" valign=top><font color=green>".$todo["task_status"]."</font></td>\n";
  329.             break;
  330.         }
  331.        
  332.     //modify action
  333.      
  334.         echo "<td bgcolor=\"#F3F0F9\" valign=top><nobr>[<a href=\"".$linktm."&task_id=".$todo["task_id"]."&tm_page=$tm_page\"><b>view</b></a>|<a href=\"".$linktm."&edit_id=".$todo["task_id"]."&tm_page=$tm_page\"><b>edit</b></a></font>|";
  335.         echo "<a href=\"javascript: if(confirm('Are you sure you want to delete this item?')){ window.}\"><b>delete</b></a>]</nobr></td>\n";
  336.  
  337.     echo "</tr>\n";    
  338.     }
  339.     echo "</table>\n";
  340.     mysql_free_result($query);
  341.    
  342.     //add todo item form
  343.  
  344.  
  345.     echo "<form method=post action=\"$linktm\">\n";
  346.     echo "<input type=hidden name=\"add_id\" value=1>\n";
  347.     echo "<input type=hidden name=\"page\" value=\"$page\">\n";
  348.     echo "<table width=75% cellpadding=4 cellspacing=1 border=0>\n";
  349.     echo "<tr><td bgcolor=\"#DADBEB\" align=right valign=top>\n";
  350.     echo "<font color=\"#000000\"><b>\n";
  351.     echo "NEW TITLE: </b></font></td>\n";
  352.     echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";
  353.     echo "<input type=text size=30 name=\"task_title\"></td>\n";
  354.     echo "</tr><tr>\n";
  355.     echo "<td bgcolor=\"#DADBEB\" align=right valign=top>\n";
  356.     echo "<font color=\"#000000\"><b>\n";
  357.     echo "DESCRIPTION: </b></font></td>\n";
  358.     echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";
  359.     echo "<textarea rows=10 cols=60 name=\"task_content\"></textarea> </td>\n";
  360.     echo "</tr><tr>\n";
  361.     echo "<td bgcolor=\"#DADBEB\" align=right valign=top>\n";
  362.     echo "<font color=\"#000000\"><b>\n";
  363.     echo "SELECT STATUS: </b></font></td>\n";
  364.     echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";
  365.  
  366.     echo "<select name=task_status>\n";
  367.     echo "<option selected>Incomplete</option>\n";
  368.     echo "<option>In Progress</option>\n";
  369.     echo "<option>Complete</option>\n";
  370.     echo "</select> </td>\n";
  371.     echo "</tr><tr>\n";
  372.     echo "<td bgcolor=\"#DADBEB\" align=left valign=bottom>
  373.            <span style='color:gray; font-size:10px; font-family:verdana,arial;'>
  374.            Modified from code<br> © <a href=\"http://www.geniusbug.com\" target=\"_new\">geniusbug</a>\n";
  375.     echo "</td>\n";
  376.     echo "<td bgcolor=\"#DADBEB\" align=left valign=top>
  377.           <span style='color:gray; font-size:10px; font-family:verdana,arial;'>\n";
  378.     echo "<input type=submit value=\"Add\"><div align=\"right\"><a name=\"tip1\"><font color=red><b><u>*</u></b></font></a> Each page holds ".$records_page." items.</div></td>\n";
  379.     echo "</form>\n";
  380.     echo "</td><tr>\n";
  381.     echo "</table>\n";    
  382.     }
  383.  
  384. //edit item function    
  385.   function edit_todo($edit_id, $linktm, $tm_page, $edittodo, $task_status, $task_owner, $owner) {
  386.     $strSQL = "SELECT * From ".$this->config["table_prefix"]."task WHERE user = '$task_owner' AND task_id = ".$edit_id;
  387.     $query = mysql_query($strSQL);
  388.     $edittodo = mysql_fetch_array($query);
  389.    
  390.    
  391.     //edit item form
  392.    
  393.     echo "<table width=75% cellpadding=4 cellspacing=1 border=0>\n";
  394.      echo "<div align=left> EDITING: <b>".strtoupper($edittodo["task_title"])." </b></div>\n";
  395.     echo "<form method=post action=\"$linktm\">\n";
  396.     echo "<input type=hidden name=\"update_id\" value=\"".$edittodo["task_id"]."\">\n";
  397.     echo "<input type=hidden name=\"page\" value=\"$tm_page\">\n";
  398.     echo "<tr><td bgcolor=\"#DADBEB\" align=right valign=top>\n";
  399.     echo "<font color=\"#000000\"><b>\n";
  400.     echo "TITLE: </b></font></td>\n";
  401.     echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";
  402.     echo "<input type=text size=30 name=\"task_title\" value=\"".$edittodo["task_title"]."\"> </td>\n";
  403.     echo "</tr><tr>\n";
  404.     echo "<td bgcolor=\"#DADBEB\" align=right valign=top>\n";
  405.     echo "<font color=\"#000000\"><b>\n";
  406.     echo "DESCRIPTION: </b></font></td>\n";
  407.     echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";
  408.     echo "<textarea rows=15 cols=40 name=\"task_content\">".$edittodo["task_content"]."</textarea> </td>\n";
  409.     echo "</tr><tr>\n";
  410.     echo "<td bgcolor=\"#DADBEB\" align=right valign=top>\n";
  411.     echo "<font color=\"#000000\"><b>\n";
  412.     echo "SELECT STATUS: </b></font></td>\n";
  413.     echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";
  414.     echo "<select name=\"task_status\">\n";
  415.    
  416.     if ($edittodo["task_status"] == "Incomplete") {
  417.     echo "<option selected>Incomplete</option>\n";
  418.     }else{
  419.     echo "<option>Incomplete</option>\n";
  420.     }
  421.    
  422.     if ($edittodo["task_status"] == "In Progress") {
  423.     echo "<option selected>In Progress</option>\n";
  424.     }else{
  425.     echo "<option>In Progress</option>\n";
  426.     }
  427.    
  428.     if ($edittodo["task_status"] == "Complete") {
  429.     echo "<option selected>Complete</option>\n";
  430.     }else{
  431.     echo "<option>Complete</option>\n";
  432.     }
  433.    
  434.     echo "</select> </td>\n";
  435.     echo "</tr><tr>\n";
  436.     echo "<td bgcolor=\"#DADBEB\" valign=top>\n";
  437.     echo "  </td>\n";
  438.     echo "<td bgcolor=\"#DADBEB\" align=left valign=top>\n";
  439.     echo "<input type=submit value=\"Update\">\n";
  440.     echo "</form>\n";
  441.     echo "</td><tr>\n";
  442.     echo "</table>\n";        
  443.  
  444. mysql_free_result($query);    
  445. }
  446.  
  447. //organize events order
  448. if (strlen($edit_id) > 0) {
  449.     edit_todo($edit_id, $linktm, $tm_page, $edittodo, $task_status, $task_owner, $owner);
  450.    
  451. }elseif(strlen($keyword) > 0) {
  452.     get_results($keyword, $linktm, $tm_page, $task_owner, $owner);
  453.  
  454. }elseif(strlen($task_id) > 0) {
  455.     item($task_id, $linktm, $tm_page, $task_owner, $owner, $order1, $dir1);
  456.    
  457. }else{
  458.     list_todo($list_order, $list_dir, $linktm, $tm_page, $records_page, $task_timestamp, $task_status, $task_owner, $owner);
  459. }
  460.  
  461. $fd = fopen ($HTTP_SERVER_VARS["SCRIPT_FILENAME"], "r");
  462.  
  463. $line=0;
  464. if($fd){
  465.     while (!feof ($fd)) {
  466.         $buffer = fgets($fd, 4096);
  467.         $line++;
  468.     }
  469.     fclose ($fd);
  470.  
  471. }
  472. echo "</table>";
  473. echo "</body>";
  474. echo "</html>";
  475. }
  476. ?>


NOTE that usertasks.php also requires the file usertasksfunctions.php (code farther below) to be placed in a directory called scripts in the wikka root.

The following code is for usertasks.php which should be placed in the actions directory...it allows you to look at others' schedules using the parameter="username" as in {{usertasks owner="username"}}...you can place several copies of it on the same page to see task lists for several people (like all members of a working group) at once.

The code requires three gif files: up.gif, down.gif and trs.gif.

  1. <?
  2. <?
  3. // usertasks.php Version 2.0 - January 7, 2005 - removed code for editing, removed functions
  4. // USE: {{usertasks [owner="UserName"] [items="#"]}}, owner & items parameters are optional
  5. // Multiple instances may occur on a single page.
  6. // REQUIRES usertasksfunctions.php which should be placed in the "scripts" directory in the wikka root
  7. // Owner parameter is to allow seeing someone else's to-do list, items parameter is for # items on a page (default 10)
  8. // Modified by GmBowen for use in wikka wiki for a SSHRC researh project. Modifications copyright 2005, provided under a GPL license.
  9. // Ongoing attribution of authorial contribution in any future modifications would be appreciated.
  10. // This {{action}} script for derivations of wakka wiki is heavily modified from a standalone single-script package
  11. // produced by and provided by the author identified in the text box below....although it is released by her as a "free to use"
  12. // script, no mention is made of any problems with commercial use. If you intend on using this action script modified from the
  13. // geniusbug code, especially for commercial purposes, you should contact the original author for permission to use
  14. // the original components.
  15. ////////////////////////////////////////
  16. //  GBTask Task Manager               //
  17. //  Naomi C. Martinson                //
  18. //  2002 © http://www.geniusbug.com   //
  19. //  Don't remove this message         //
  20. //  Contact: [email protected]      //
  21. ////////////////////////////////////////
  22. $table=$this->config["table_prefix"];
  23. global $linktm, $use;
  24. $linktm = $this->config["base_url"].$this->MiniHref($method, $tag);
  25. $task_id = $_REQUEST['task_id'];
  26. $task_title = $_POST['task_title'];
  27. $task_content = $_POST['task_content'];
  28. $task_status = $_POST['task_status'];
  29. $order1 = $_REQUEST['order1'];
  30. $dir1 = $_REQUEST['dir1'];
  31. $dir = $_REQUEST['dir'];
  32.  
  33. if($owner != NULL){$task_owner = $owner; }else { $task_owner = $this->GetPageOwner();}
  34.  
  35. if($_REQUEST['tm_page'] == '' || $_REQUEST['tm_page'] == NULL){$tm_page = '1';}else{$tm_page = $_REQUEST['tm_page'];}
  36.  
  37. $tm_direction = $_REQUEST[dir];
  38. $tm_order = $_REQUEST[order];
  39. $keyword = $_POST[keyword];
  40. if ($items == '' || $items =='0') { $items = 10;}
  41. $items_per_page = $items;
  42.  
  43. session_register("records_page");
  44. $records_page = $items_per_page;
  45.  
  46. if(isset($tm_order)){
  47.     session_register("list_order");
  48.     $list_order = $tm_order;
  49. }
  50.  
  51. if(isset($tm_direction)){
  52.     session_register("list_dir");
  53.  
  54.     $list_dir = $tm_direction;
  55. }
  56.  
  57. if(isset($set_theme)){
  58.     session_register("theme");
  59.     $theme = $set_theme;
  60. }
  61.  
  62. if (isset($showsource)) {
  63.     show_source($HTTP_SERVER_VARS["SCRIPT_FILENAME"]);
  64.     exit;
  65. }
  66.  
  67.  
  68.  
  69. $task_id = $_REQUEST['task_id'];
  70. $add_id = $_POST['add_id'];
  71. $task_title = $_POST['task_title'];
  72. $task_content = $_POST['task_content'];
  73. $task_status = $_POST['task_status'];
  74.  
  75. //resume to 10 items per page
  76. if(!isset($records_page)){
  77.     $records_page = 10;
  78. }
  79.  
  80. $strSQL = "SELECT * From ".$this->config["table_prefix"]."task WHERE user = '$task_owner' AND task_delete = '0'";
  81. $query = mysql_query($strSQL);
  82.  
  83. $total_records = mysql_num_rows($query);
  84.  
  85. if (!isset($tm_page)) {
  86.     $tm_page=1;
  87. }
  88. $num_pages = ceil($total_records / $records_page);
  89. for ($i=1;$i<=$num_pages;$i++) {
  90.     $tm_page_nav = $tm_page_nav."[<a href=\"".$linktm."&tm_page=".$i."\">".$i."</a>] \n";
  91. }
  92.  
  93. echo "<table width=95% cellpadding=0 cellspacing=0 border=0 align=center><tr><td bgcolor=white align=\"center\" valign=top>\n";
  94.  
  95. //html header, search form items, per page form
  96. echo "<form method=post action=\"".$linktm."\">\n";
  97. echo "<span style='color:gray; font-size:10px; font-family:verdana,arial;'> <strong>Task Owner: $task_owner </strong></span>";
  98. echo "<table width=75% cellpadding=0 cellspacing=0 border=0 valign=bottom><tr>\n";
  99. echo "<td bgcolor=\"#949AE7\" valign=bottom><img src=\"images/trs.gif\" width=1 height=1></td>\n";
  100. echo "</tr></table>\n";
  101. echo "<table width=75% cellpadding=0 cellspacing=0 border=0><tr>\n";
  102. echo "<td bgcolor=\"E9EBF3\">
  103.        <table width=100%><tr>
  104.           <td align=left>
  105.           <span style='color:gray; font-size:10px; font-family:verdana,arial;'> <!-- Page Owner: $task_owner -->
  106.           Pages: $tm_page_nav (Pg: $tm_page)</td>
  107.           <td align=center><a href=\"$linktm\"><b>
  108.           <span style='color:gray; font-size:10px; font-family:verdana,arial;'>
  109.           [HOME]</b></a>  SHOW:[<a href=\"".$linktm."&task_id=ALL&tm_page=$tm_page&order1=task_title&dir1=DESC\"><b><span style='color:gray; font-size:10px; font-family:verdana,arial;'>ALL</b></a>|<a href=\"".$linktm."&task_id=INCOMPLETE&tm_page=$tm_page&order1=task_title&dir1=DESC\"><b><span style='color:gray; font-size:10px; font-family:verdana,arial;'>INCOMPLETE</b></a>|<a href=\"".$linktm."&task_id=INPROGRESS&tm_page=$tm_page&order1=task_title&dir1=DESC\"><b><span style='color:gray; font-size:10px; font-family:verdana,arial;'>IN PROGRESS</b></a>|<a href=\"".$linktm."&task_id=COMPLETE&tm_page=$tm_page&order1=task_title&dir1=DESC\"><b><span style='color:gray; font-size:10px; font-family:verdana,arial;'>COMPLETE</b></a>]
  110.         </td>
  111.           <td align=right><input type=text size=10 value=\"keyword\" name=\"keyword\"><input type=submit value=\"Search\"></td>
  112.         </tr></table>
  113.       </td>\n";
  114. echo "</tr></table>\n";
  115. echo "</form>\n";
  116.  
  117. // functions include
  118. include_once("./scripts/usertasksfunctions.php");
  119.  
  120. //organize events order
  121. if (strlen($keyword) > 0) {
  122.     get_results2($keyword, $linktm, $tm_page, $task_owner, $owner, $table);
  123.  
  124. }elseif(strlen($task_id) > 0) {
  125.     item2($task_id, $linktm, $tm_page, $task_owner, $owner, $order1, $dir1, $table);
  126.    
  127. }else{
  128.     list_todo2($list_order, $list_dir, $linktm, $tm_page, $records_page, $task_timestamp, $task_status, $task_owner, $owner, $table);
  129. }
  130.  
  131. $fd = fopen ($HTTP_SERVER_VARS["SCRIPT_FILENAME"], "r");
  132.  
  133. $line=0;
  134. if($fd){
  135.     while (!feof ($fd)) {
  136.         $buffer = fgets($fd, 4096);
  137.         $line++;
  138.     }
  139.     fclose ($fd);
  140.  
  141. }
  142. echo "</table>";
  143. ?>


In addition the following file (usertasksfunctions.php) must be placed in a directory called scripts in the wikka root.
  1. <?
  2. // usertasksfunctions.php Version 1.0 - January 7, 2005
  3. // USE: REQUIRED for usertasks.php
  4. // Modifications for use in wikka wiki by GmBowen copyright 2005, provided under a GPL license.
  5. // Ongoing attribution of authorial contribution in any future modifications would be appreciated.
  6. // The functions in this script derive from GBTask produced by and provided by the author identified in the text box below
  7. // ....although it is released by her as a "free to use" script, no mention is made of any problems with commercial use.
  8. // If you intend on using this action script modified from the geniusbug code, especially for commercial purposes,
  9. // you should contact the original author for permission to use the original components.
  10. ////////////////////////////////////////
  11. //  GBTask Task Manager               //
  12. //  Naomi C. Martinson                //
  13. //  2002 © http://www.geniusbug.com   //
  14. //  Don't remove this message         //
  15. //  Contact: [email protected]      //
  16. ////////////////////////////////////////
  17.  
  18. //search function
  19. function get_results2($keyword, $linktm, $tm_page, $task_owner, $owner, $table) {        
  20.     //search the database
  21.     $strSQL = "SELECT * From ".$table."task WHERE task_delete = '0' AND user = '$task_owner' AND task_title LIKE '%".$keyword."%' OR task_content LIKE '%".$keyword."%'";
  22.     $results = mysql_query($strSQL);
  23.    
  24.     if (mysql_num_rows($results) > 0) {
  25.        
  26.         echo "<br>Your keyword is: <b>".$keyword."</b><P>\n";
  27.         echo "<table width=75% cellpadding=4 cellspacing=2 border=0>\n";
  28.         while($mykey = mysql_fetch_array($results)){
  29.            
  30.             //list the results
  31.             echo "<tr>\n";
  32.             echo "<td bgcolor=\"#E9E9E9\" align=left valign=top><font color=white><img src=\"images/trs.gif\" width=70 height=1><br><nobr>\n";
  33.            
  34.             switch ($mykey["task_status"]) {
  35.             case "Incomplete":
  36.             echo "<font color=red>".$mykey["task_status"]."</font>\n";
  37.             break;
  38.            
  39.             case "In Progress":
  40.             echo "<font color=blue>".$mykey["task_status"]."</font>\n";
  41.             break;
  42.            
  43.             case "Complete":
  44.             echo "<font color=green>".$mykey["task_status"]."</font>\n";
  45.             break;
  46.             }
  47.            
  48.             echo "</nobr></font></td>\n";
  49.  
  50.             echo "<td bgcolor=\"#F3F0F9\" align=left valign=top width=75%><a href=\"".$linktm."&task_id=".$mykey["task_id"]."&tm_page=$page\">".$mykey["task_title"]."</a> X(posted:".$mykey["task_timestamp"].")</td>\n";
  51.             echo "</tr>\n";
  52.         }
  53.         echo "</table>\n";
  54.     }else{
  55.         echo "<P><font color=red>SORRY, NO MATCH!</font><P>\n";
  56.     }
  57.     mysql_free_result($results);
  58. }
  59.  
  60. //view item after search function
  61. function item2($task_id, $linktm, $tm_page, $task_owner, $owner, $order1, $dir1, $table) {
  62.     if($task_id == 'ALL'){
  63.    
  64.      $strSQL = "SELECT * From ".$table."task WHERE task_delete = '0' AND user='$task_owner' ORDER By $order1 $dir1"; //kasper AND task_id =".$task_id;
  65.      $query = mysql_query($strSQL);
  66.    
  67.     echo "<table width=75% cellpadding=4 cellspacing=2 border=0>\n";
  68.     echo "<tr>";
  69.     echo "<td bgcolor=\"#BBBDD9\" width=112px valign=top><b>STATUS <a href=\"".$linktm."&task_id=ALL&order1=task_status&dir1=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=ALL&order1=task_status&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  70.     echo "<td bgcolor=\"#BBBDD9\" valign=top><b>TASK</b> <a href=\"".$linktm."&task_id=ALL&order1=task_title&dir1=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=ALL&order1=task_title&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  71.     echo "<td bgcolor=\"#BBBDD9\" width=192px valign=top><b>ENTERED ON</b> <a href=\"".$linktm."&task_id=ALL&order1=task_timestamp&dir1=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=ALL&order1=task_timestamp&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  72.     echo "  
  73.           </tr>
  74.           </table>";
  75.            
  76.            
  77.       while ($item = mysql_fetch_object($query)){
  78.            
  79.            echo "<table width=76% cellpadding=4 cellspacing=2 border=0><tr><td>\n";
  80.            echo "<table width=100% cellpadding=1 cellspacing=1 border=0>\n";
  81.            echo "<tr><td bgcolor=\"#E9E9E9\" width=120px align=left valign=top><font color=white><img src=\"images/trs.gif\" width=70 height=1><br><nobr>  \n";
  82.  
  83.            switch ($item->task_status) {
  84.               case "Incomplete":
  85.               echo "<font color=red>".$item->task_status."</font>\n";
  86.               break;
  87.    
  88.               case "In Progress":
  89.               echo "<font color=blue>".$item->task_status."</font>\n";
  90.               break;
  91.    
  92.               case "Complete":
  93.               echo "<font color=green>".$item->task_status."</font>\n";
  94.               break;
  95.            }
  96.    
  97.            echo "</nobr></font></td>\n";
  98.            echo "<td bgcolor=\"#BBBDD9\" align=left valign=top ><font color=white><b>  ".strtoupper($item->task_title)."</b></font></td>";    
  99.            echo "<td width=200px bgcolor=\"#E9E9E9\" align=left valign=top ><center><font color=black>".$item->task_timestamp."</font></center></td></tr></table>\n";
  100.            echo "<table width=100% cellpadding=1 cellspacing=1 border=0><tr><td colspan=3 bgcolor=\"#E9E9E9\" align=left valign=top colspan=2>    ".str_replace("\n", "<br>", $item->task_content)."</td></tr>\n";
  101.            echo "</table></tr></td></table>\n";
  102.       }
  103.     }
  104.     elseif ($task_id == 'INCOMPLETE'){
  105.    
  106.     $strSQL = "SELECT * From ".$table."task WHERE task_delete = '0' AND user='$task_owner' AND task_status='Incomplete' ORDER By $order1 $dir1"; //kasper AND task_id =".$task_id;
  107.     $query = mysql_query($strSQL);
  108.    
  109.     echo "<table width=75% cellpadding=4 cellspacing=2 border=0>\n";
  110.     echo "<tr>";
  111.     echo "<td bgcolor=\"#BBBDD9\" width=112px valign=top><b>STATUS <a href=\"".$linktm."&task_id=INCOMPLETE&order1=task_status&dir1=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=INCOMPLETE&order1=task_status&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  112.     echo "<td bgcolor=\"#BBBDD9\" valign=top><b>TASK</b> <a href=\"".$linktm."&task_id=INCOMPLETE&order1=task_title&dir1=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=INCOMPLETE&order1=task_title&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  113.     echo "<td bgcolor=\"#BBBDD9\" width=192px valign=top><b>ENTERED ON</b> <a href=\"".$linktm."&task_id=INCOMPLETE&order1=task_timestamp&dir1=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=INCOMPLETE&order1=task_timestamp&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  114.     echo "  
  115.           </tr>
  116.           </table>";
  117.            
  118.            
  119.       while ($item = mysql_fetch_object($query)){
  120.            
  121.            echo "<table width=76% cellpadding=4 cellspacing=2 border=0><tr><td>\n";
  122.            echo "<table width=100% cellpadding=1 cellspacing=1 border=0>\n";
  123.            echo "<tr><td bgcolor=\"#E9E9E9\" width=120px align=left valign=top><font color=white><img src=\"images/trs.gif\" width=70 height=1><br><nobr>  \n";
  124.  
  125.            switch ($item->task_status) {
  126.               case "Incomplete":
  127.               echo "<font color=red>".$item->task_status."</font>\n";
  128.               break;
  129.    
  130.               case "In Progress":
  131.               echo "<font color=blue>".$item->task_status."</font>\n";
  132.               break;
  133.    
  134.               case "Complete":
  135.               echo "<font color=green>".$item->task_status."</font>\n";
  136.               break;
  137.            }
  138.    
  139.            echo "</nobr></font></td>\n";
  140.            echo "<td bgcolor=\"#BBBDD9\" align=left valign=top ><font color=white><b>  ".strtoupper($item->task_title)."</b></font></td>";    
  141.            echo "<td width=200px bgcolor=\"#E9E9E9\" align=left valign=top ><center><font color=black>".$item->task_timestamp."</font></center></td></tr></table>\n";
  142.            echo "<table width=100% cellpadding=1 cellspacing=1 border=0><tr><td colspan=3 bgcolor=\"#E9E9E9\" align=left valign=top colspan=2>    ".str_replace("\n", "<br>", $item->task_content)."</td></tr>\n";
  143.            echo "</table></tr></td></table>\n";
  144.       }
  145.     }
  146.     elseif ($task_id == 'INPROGRESS'){
  147.    
  148.     $strSQL = "SELECT * From ".$table."task WHERE task_delete = '0' AND user='$task_owner' AND task_status='In Progress' ORDER By $order1 $dir1"; //kasper AND task_id =".$task_id;
  149.     $query = mysql_query($strSQL);
  150.    
  151.     echo "<table width=75% cellpadding=4 cellspacing=2 border=0>\n";
  152.     echo "<tr>";
  153.     echo "<td bgcolor=\"#BBBDD9\" width=112px valign=top><b>STATUS <a href=\"".$linktm."&task_id=INPROGRESS&order1=task_status&dir1=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=INPROGRESS&order1=task_status&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  154.     echo "<td bgcolor=\"#BBBDD9\" valign=top><b>TASK</b> <a href=\"".$linktm."&task_id=INPROGRESS&order1=task_title&dir1=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=INPROGRESS&order1=task_title&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  155.     echo "<td bgcolor=\"#BBBDD9\" width=192px valign=top><b>ENTERED ON</b> <a href=\"".$linktm."&task_id=INPROGRESS&order1=task_timestamp&dir1=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=INPROGRESS&order1=task_timestamp&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  156.     echo "  
  157.           </tr>
  158.           </table>";
  159.            
  160.            
  161.       while ($item = mysql_fetch_object($query)){
  162.            
  163.            echo "<table width=76% cellpadding=4 cellspacing=2 border=0><tr><td>\n";
  164.            echo "<table width=100% cellpadding=1 cellspacing=1 border=0>\n";
  165.            echo "<tr><td bgcolor=\"#E9E9E9\" width=120px align=left valign=top><font color=white><img src=\"images/trs.gif\" width=70 height=1><br><nobr>  \n";
  166.  
  167.            switch ($item->task_status) {
  168.               case "Incomplete":
  169.               echo "<font color=red>".$item->task_status."</font>\n";
  170.               break;
  171.    
  172.               case "In Progress":
  173.               echo "<font color=blue>".$item->task_status."</font>\n";
  174.               break;
  175.    
  176.               case "Complete":
  177.               echo "<font color=green>".$item->task_status."</font>\n";
  178.               break;
  179.            }
  180.    
  181.            echo "</nobr></font></td>\n";
  182.            echo "<td bgcolor=\"#BBBDD9\" align=left valign=top ><font color=white><b>  ".strtoupper($item->task_title)."</b></font></td>";    
  183.            echo "<td width=200px bgcolor=\"#E9E9E9\" align=left valign=top ><center><font color=black>".$item->task_timestamp."</font></center></td></tr></table>\n";
  184.            echo "<table width=100% cellpadding=1 cellspacing=1 border=0><tr><td colspan=3 bgcolor=\"#E9E9E9\" align=left valign=top colspan=2>    ".str_replace("\n", "<br>", $item->task_content)."</td></tr>\n";
  185.            echo "</table></tr></td></table>\n";
  186.       }
  187.     }
  188.     elseif ($task_id == 'COMPLETE'){
  189.    
  190.     $strSQL = "SELECT * From ".$table."task WHERE task_delete = '0' AND user='$task_owner' AND task_status='Complete' ORDER By $order1 $dir1"; //kasper AND task_id =".$task_id;
  191.     $query = mysql_query($strSQL);
  192.    
  193.     echo "<table width=75% cellpadding=4 cellspacing=2 border=0>\n";
  194.     echo "<tr>";
  195.     echo "<td bgcolor=\"#BBBDD9\" width=112px valign=top><b>STATUS <a href=\"".$linktm."&task_id=COMPLETE&order1=task_status&dir1=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=COMPLETE&order1=task_status&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  196.     echo "<td bgcolor=\"#BBBDD9\" valign=top><b>TASK</b> <a href=\"".$linktm."&task_id=COMPLETE&order1=task_title&dir1=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=COMPLETE&order1=task_title&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  197.     echo "<td bgcolor=\"#BBBDD9\" width=192px valign=top><b>ENTERED ON</b> <a href=\"".$linktm."&task_id=COMPLETE&order1=task_timestamp&dir1=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&task_id=COMPLETE&order1=task_timestamp&dir1=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  198.     echo "  
  199.           </tr>
  200.           </table>";
  201.            
  202.            
  203.       while ($item = mysql_fetch_object($query)){
  204.            
  205.            echo "<table width=76% cellpadding=4 cellspacing=2 border=0><tr><td>\n";
  206.            echo "<table width=100% cellpadding=1 cellspacing=1 border=0>\n";
  207.            echo "<tr><td bgcolor=\"#E9E9E9\" width=120px align=left valign=top><font color=white><img src=\"images/trs.gif\" width=70 height=1><br><nobr>  \n";
  208.  
  209.            switch ($item->task_status) {
  210.               case "Incomplete":
  211.               echo "<font color=red>".$item->task_status."</font>\n";
  212.               break;
  213.    
  214.               case "In Progress":
  215.               echo "<font color=blue>".$item->task_status."</font>\n";
  216.               break;
  217.    
  218.               case "Complete":
  219.               echo "<font color=green>".$item->task_status."</font>\n";
  220.               break;
  221.            }
  222.    
  223.            echo "</nobr></font></td>\n";
  224.            echo "<td bgcolor=\"#BBBDD9\" align=left valign=top ><font color=white><b>  ".strtoupper($item->task_title)."</b></font></td>";    
  225.            echo "<td width=200px bgcolor=\"#E9E9E9\" align=left valign=top ><center><font color=black>".$item->task_timestamp."</font></center></td></tr></table>\n";
  226.            echo "<table width=100% cellpadding=1 cellspacing=1 border=0><tr><td colspan=3 bgcolor=\"#E9E9E9\" align=left valign=top colspan=2>    ".str_replace("\n", "<br>", $item->task_content)."</td></tr>\n";
  227.            echo "</table></tr></td></table>\n";
  228.       }
  229.     }
  230.     else
  231.     {
  232.        $strSQL = "SELECT * From ".$table."task WHERE task_delete = '0' AND user='$task_owner' AND task_id =".$task_id;
  233.        $query = mysql_query($strSQL);
  234.        $item = mysql_fetch_array($query);
  235.        echo "<table width=75% cellpadding=4 cellspacing=2 border=0>\n";
  236.        echo "<td width=5% bgcolor=\"#E9E9E9\" align=left valign=top><font color=white><img src=\"images/trs.gif\" width=70 height=1><br><nobr>\n";
  237.  
  238.        switch ($item["task_status"]) {
  239.        case "Incomplete":
  240.        echo "<font color=red>".$item["task_status"]."</font>\n";
  241.        break;
  242.  
  243.        case "In Progress":
  244.        echo "<font color=blue>".$item["task_status"]."</font>\n";
  245.        break;
  246.  
  247.        case "Complete":
  248.        echo "<font color=green>".$item["task_status"]."</font>\n";
  249.        break;
  250.        }
  251.        echo "</nobr></font></td>\n";    
  252.        echo "<td bgcolor=\"#BBBDD9\" align=left valign=top width=75%><font color=black><b>".strtoupper($item["task_title"])."</b> (posted: ".$item["task_timestamp"].")</font></td></tr>\n";
  253.        echo "<tr><td bgcolor=\"#F3F0F9\" align=left valign=top colspan=2>".str_replace("\n", "<br>", $item["task_content"])."</td></tr>\n";
  254.     echo "</table>\n";
  255.     }
  256. }
  257.  
  258. //list items function
  259. function list_todo2($tm_order, $tm_direction, $linktm, $tm_page, $records_page, $task_timestamp, $task_status, $task_owner, $owner, $table) {
  260.  
  261.     if (!isset($tm_order)) {
  262.         $tm_order = "task_timestamp";
  263.     }
  264.    
  265.     if (!isset($tm_direction)) {
  266.         $tm_direction = "DESC";
  267.     }
  268.  
  269.     $begin = (($tm_page-1)*$records_page);
  270.     $strSQL = "SELECT * From ".$table."task WHERE task_delete = '0' AND user = '$task_owner' ORDER By $tm_order $tm_direction LIMIT $begin,$records_page";
  271.     $query = mysql_query($strSQL);
  272.  
  273. //ECHO 'START of list of items in the cell header information';
  274.  
  275.     echo "<table width=75% cellpadding=2 cellspacing=2 border=0>\n";
  276.     echo "<tr>\n";
  277.     echo "<td bgcolor=\"#BBBDD9\" valign=top>\n";
  278.     echo "<b>TASK <a href=\"".$linktm."&order=task_title&dir=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&order=task_title&dir=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  279.     echo "<td bgcolor=\"#BBBDD9\" valign=top width=192px>\n";
  280.     echo "<b>ENTERED ON</b> <a href=\"".$linktm."&order=task_timestamp&dir=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&order=task_timestamp&dir=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  281.     echo "<td bgcolor=\"#BBBDD9\" valign=top width=112px >\n";
  282.     echo "<b>STATUS</b> <a href=\"".$linktm."&order=task_status&dir=DESC\"><img src=\"images/up.gif\" width=11 height=16 border=0></a> <a href=\"".$linktm."&order=task_status&dir=ASC\"><img src=\"images/down.gif\" width=11 height=16 border=0></a></td>\n";
  283.     echo "<td bgcolor=\"#BBBDD9\" valign=top width=112px><b>View?</b> <img src=\"images/trs.gif\" width=11 height=16 border=0></td>\n";
  284.     echo "</tr>\n";
  285.  
  286. //ECHO 'START of list of items after HEADER information (why is this in the wrong place??)';
  287.     //list todo items
  288.     while ($todo = mysql_fetch_array($query)) {
  289.     echo "<tr>\n";
  290.     echo "<td align=left bgcolor=\"#F3F0F9\" valign=top><span title=\"Description: ".$todo["task_content"]."\">".$todo["task_title"]."</span></td>\n";
  291.     echo "<td bgcolor=\"#F3F0F9\" valign=top>".$todo["task_timestamp"]."</td>\n";
  292.        
  293.         //items status case
  294.         switch ($todo["task_status"]) {
  295.             case "Incomplete":        
  296.             echo "<td bgcolor=\"#E9E9E9\" valign=top><font color=red>".$todo["task_status"]."</font></td>\n";
  297.             break;
  298.  
  299.             case "In Progress":
  300.             echo "<td bgcolor=\"#E9E9E9\" valign=top><font color=blue>".$todo["task_status"]."</font></td>\n";
  301.             break;
  302.  
  303.             case "Complete":
  304.             echo "<td bgcolor=\"#E9E9E9\" valign=top><font color=green>".$todo["task_status"]."</font></td>\n";
  305.             break;
  306.         }
  307.     echo "<td bgcolor=\"#F3F0F9\" valign=top><nobr>[<a href=\"".$linktm."&task_id=".$todo["task_id"]."&tm_page=$tm_page\"><b>view</b></a>]";
  308.     echo "</tr>\n";    
  309.     }
  310.     echo "</table>\n";
  311.     mysql_free_result($query);
  312. }
  313. ?>


Ultimately, it is intended that a text entry box and a submit button will be added to this code for entering user names so the schedule of any user can be easily obtained without editing the page.

Remember, multiple copies of mytasks.php cannot be on the same page at once.

And, of course, you need to create a new table in your database....
Remember that you may need to replace wikka_ (first line) with your wikkas table prefix
CREATE TABLE `wikka_task` (
  `task_id` INT(11) NOT NULL AUTO_INCREMENT,
  `user` text NOT NULL,
  `task_timestamp` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `task_title` VARCHAR(255) NOT NULL DEFAULT '',
  `task_content` text NOT NULL,
  `task_status` VARCHAR(255) DEFAULT NULL,
  `task_delete` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY  (`task_id`)

) TYPE=MyISAM;


The mytasks.php function on this page use a "bad word function" that should be placed in the wakka.php file in the wiki root directory. The following code needs to be placed in the wakka.php file (just after the microtime function which starts "function getmicrotime" and ends with a "}". This code is placed immediately after the "}".

//GMB remove bad word filter
function BadWordFunc($RemoveBadWordText) {
    $RemoveBadWordText = eregi_replace("fuc?k|[kc]unt|motherfucker|cocksucker|bitch|son of a bitch|asshole|shit|fag|wank|dick|pu[zs]?[zs][yi]|bastard|s[kc]rew|mole[zs]ter|mole[sz]t|coc?k", "", $RemoveBadWordText);
return $RemoveBadWordText;




In mytasks.php use something like this:
if ($this->method == "show") {
  global $tableprefix;
  $tableprefix = $this->config["table_prefix"];


and inside function use global $tableprefix; and in query "... FROM ${tableprefix}task ...." do not use $this->config["table_prefix"] inside function PHP 5.1.x do not understand


CategoryUserContributions
There are 33 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki