Revision [2023]

This is an old revision of GmBowen made by GmBowen on 2004-10-26 14:25:13.

 

I'm a university prof who is modifying parts of wikka so that it can be used by high school kids to collaborate on school project work and writing. I chose wakka/wikka because it seemed to be the wiki with the most flexibility for doing the sorts of things I was interested in. I'm not a programmer myself, although I do understand lots about programming, and so I've hired a recent grad from my university to implement some features for me that I think my target audience for using the wiki will need. The wiki is only one of the central tools they'll be using, and has to coordinate with numerous other tools (such as a graph drawing and an on-line drawing tool).

One of our first modifications was completed by my programming guy (Mark Kasper) in June '04 and was a modification of the pageindex.php code that has now been modified and incorporated into wikka as part of the release [Mod041fPageIndexByLetter] .....it should make the wiki's more useable for high-use sites because it provides a letter index for pageindex.php. It can either be used as usual, {{pageindex}}, or using a parameter indicating which letter you would like to see a listing for (for example, {{pageindex start="a"}}...or whatever letter you wish to show a listing for). If you enter a letter that there is not yet a listing for, then it defaults to "all".

Graphic Oriented Mods

I have a modified file-upload utility (just for graphic images)......The "upload" script is a mod of one of the ones at wakka or wikka (can't remember which)....I've made it available at http://131.202.167.33/wiki/actions/uploadimage.phps .... to use it you will of course have to change phps to php. This script only allows 10 uploaded files with the users prefix in the upload directory (although you can change that easily), and checks the wikka_users database to see (a) how many files are allowed in total and (b) what number the user is at.

The changes in the wikka_users table are adding these two fields....
+-----------------------------------------------------------------------------------------------------------+
| wikka_users                                                                                               |
+-----------------------------------------------------------------------------------------------------------+
+-----------------+------------------+------+-----+-------------------------------------------------+-------+
| Field           | Type             | Null | Key | Default                                         | Extra |
+-----------------+------------------+------+-----+-------------------------------------------------+-------+
+ images_allowed  + smallint(4)      +      +     + 30                                              +       +
+ images_uploaded + int(6)           +      + PRI + 0                                               +       +
+-----------------+------------------+------+-----+-------------------------------------------------+-------+


The current max allowed image upload is "30"...set at the database level. When the images are uploaded to the directory the username is concatonated to the front of the filename. I have a modified version of OTF Gallery that allows you to preview and "approve" each image and will then copy the files to a directory that exists for each individual user and strip the user name from the front of the file (this is from a modification of a registration script extraneous to Wikka that makes a directory for each registrant)[Modified OTF] (note that this will require some fiddling as they were not really modified for release purposes....I've included comments about the things we've changed in the PHP scripts, but you should probably read the instructions for OTF gallery in general). Or, if you're not interested in doing that, I have a modified version of the "gallery" action available for wikka that you could change so it would just shows thumbnails of images of the logged in user and allows erasing images...currently it just goes to the users personal directory, but you could change that (my programming guy modded this so it generates thumbnails using GD....the original version of the gallery required you to generate the thumbnails yourself)[Code Available Here]. Hope this helps. If you're interested in the gallery software for wikka let me know....you'd be on your own for modifying it to only show files with the username prefix cuz my php skills aren't good enough to do those changes.

For a "user resources" page we created an action that would just list the graphical images in the directory (and let the user delete them if so desired).....

<?php
$dst = '../../../approvalgallery/userdeletegallery/';
if(empty($owner)){ $username = $this->GetUserName();} else {$username = $owner;}
if(empty($owner)){ $username2 = $this->GetUserName();} else {$username2 = $owner;}
$username = strtolower($username);
$fl = substr($username,0,1);
$homelink = $this->config["base_url"].$this->MiniHref($method, $tag);

$imgstr = "graphicsgallery/".$fl."/".$username."/";
$tmbstr = "thumbnailgallery/".$fl."/".$username."/";

if(!empty($_REQUEST[action])){
            $file = $_REQUEST['file'];
            chdir($imgstr);
            unlink($file);
            chdir("../../../");
            chdir($tmbstr);
            unlink($file);
            chdir("../../../");
        }
///     if(!empty($_REQUEST[image])){
//          $file = $_REQUEST['file'];
//          echo "<div align=left><img src=".$imgstr.$file."></div>";
//      }

    $dir = opendir($imgstr);
echo "<b>$username2's Image Files: </b>";
    while ($file = readdir($dir)) {
        if ($file != '.' && $file != '..') {
                        $num++;
                 if ($this->HasAccess('write')) {
//              if ($this->IsAdmin()) {
                        $delete_link = "<a href=\"$homelink&action=delete&amp;file=$file&tmbnail=\" onmouseover=\"this.T_WIDTH=130;this.T_BGCOLOR='#FF3300';this.T_FONTCOLOR='#000000';this.T_FONTWEIGHT='bold';return escape('Delete this image file')\">x</a>";
//                      $delete_link = "<a href=\"".$this->href('files.xml',$this->GetPageTag(),'action=delete&amp;file='.urlencode($file))."\">x</a>";


                    } else {
                        $delete_link = "";
                }
// <a href='$homelink&image=show&file=$file' onmouseover=\"return escape('<img src='$imgstr'.'$file'>')\">{$file}</a>
                        print  "

                                        <tr>
                                          <td valign='top' align='center'>
                                                &nbsp;
                                                {$delete_link}
                                                 {$file}
                                                &nbsp;
                                          </td>
                                        </tr>

                                "
;
        }
    }
   - closedir($dir);

// below added by GMB
echo "<script language=\"JavaScript\" type=\"text/javascript\" src=\"./actions/wz_tooltip.js\"></script>";

        // print n/a if no files currently exist
        if (!$num)  print "<tr><td>&nbsp;</td><td colspan='3' align='center'><font color='gray' size='-1'><i>You have no image files yet!</i></font></td></tr>";
        else  print "<tr><td>&nbsp;</td></tr>";
?>


The action uses a javascript tool (in the actions directory on my system) that allows a "hover" window in bright red that shows that the "x" is to delete the files. The wz_tooltip.js allows "better" tooltips (in this case, more visible) & is available at http://www.walterzorn.com/tooltip/tooltip_e.htm as a free download.

"Erase History" Actions

When I'm developing pages I find I generate lots of "history" that I don't care to remain in the database. Or, as is sometimes the case, sometimes some of the actions I'm developing cause the "history" feature to crap out. Rather than just erasing the rows manually, I thought it might be easier to have a couple of actions. The first one is one that can be embedded on the page and only erases history if an administrator clicks on the "erase history" button (otherwise it shows text saying only an administrator can use the action). Another way this is useful for me is that I might have kids who write "inappropriate" information in the wiki (racist, sexist etc) and I'd like to be able to easily expunge the record for this (I know, I know, this is anti-wiki....but things are different when you're working at a publicly funded institution and providing a site for kids to use). The second action automatically erases history every time the page loads (for the "flakey" actions I've developed that cause the history feature to blow up (the task manager we're working on, for instance)). I think the second is a bit of a "security risk" wrt wiki users using it, so I'd suggest calling it something that is non-obvious and embedding it only on pages that you don't care to have history for and that nobody else has write-access to.
<?
// code developed by GMBowen & JGoguen to allow admins to erase history on a given page
if ($this->IsAdmin())
{
    echo '<table><tr><td><form action="" method="post">
    <input type="submit" name="erasehistory" value="Erase History of Page"></td></table> <br /></form>'
;
}
if ($_POST['erasehistory'] && $this->IsAdmin())
{
$thispage=$this->GetPageTag();
$sql = "DELETE FROM ".$this->config["table_prefix"]."pages WHERE tag='$thispage' AND latest='N'";
mysql_query($sql) or die("Unable to process query: " . mysql_error());
}
elseif ($_POST['erasehistory'] && !$this->IsAdmin())
{
echo "<i>History can only be erased by an administrator.</i>";
}
?>

auto erasing of history.....
<?
// code developed by GMBowen to allow automatically erasing the history of a given page
$thispage=$this->GetPageTag();
$sql = "DELETE FROM ".$this->config["table_prefix"]."pages WHERE tag='$thispage' AND latest='N'";
mysql_query($sql) or die("Unable to process query: " . mysql_error());
?>

Calendar Action

A useful little action is found at GmBowenCalendar....it's a calendar that you can embed in a wikipage....

Modified Mypages action --> menu

Much of what we do is designed to help students work collaboratively in teams. I modified the mypages action into one that students can use as a simple menu....which I've called mypagesmenu.php .... basically it just lists the pages you own horizontally (although you can designate not having a title AND specify a menu list for a specific user....for us the latter will allow a listing of pages owned by different members all on the same project by just listing the action multiple times with different owners). It's not anything that the DarTar's & Jason's and JavaWoman's of the world couldn't do....but nine months ago I couldn't have done it myself & so I'm posting it for the more "casual" wikka user that I used to be (and, the DT's etc are welcome to do any fixes that they see necessary {grin}). -- Mike

<?php /*dotmg modifications : contact m.randimbisoa@dotmg.net*/ ?>
<?php
//  modification by GMBowen of actions/mypages.php written by Carlo Zottmann for wakkawiki
// parameter title="no" or title="off"; can list pages for a specific person by using parameter owner="username"
$title = strtolower($title);
$username = $this->UserName();
if ($owner != '')
{
  $username=$owner;
}
if ($user = $this->GetUser())
{
    if ($title != 'off' && $title !='no')
    {
    print("<strong>Pages owned by $username:</strong>\n");
    }
    $my_pages_count = 0;

    if ($pages = $this->LoadAllPages())
    {
        foreach ($pages as $page)
        {
            //#dotmg [1 line modified]: added [0-9]+$ to regular expression
            if ($username == $page["owner"] && !preg_match("/^Comment[0-9]+$/", $page["tag"]))
            {
                print("[".$this->Link($page["tag"])."]"."\n");
               
                $my_pages_count++;
            }
        }
       
        if ($my_pages_count == 0)
        {
            print("<em>$username does not own any pages.</em>");
        }
    }
    else
    {
        print("<em>No pages found.</em>");
    }
}
else
{
    print("<em>You're not logged in, thus the list of your pages couldn't be retrieved.</em>");
}

?>

Language Translation

Hmmm....neat. I found that you can include two small actions that allow you to have your page translated using alta vista's SYSTRAN service. You can just include both in your actions directory. Kinda inelegant, but better than paying for your own translation service.

translateenglish.php
<hr>
<table>
<tr><strong><font size="-2">English Translation</font></strong></tr>
<tr><script language="JavaScript1.2" src="http://www.altavista.com/static/scripts/translate_engl.js"></script></tr>
<tr><font size="-2">Note that translation sometimes works better if you right-click the flag and open the translation in a new window.</font></tr>
</table>


translatefrench.php
<hr>
<table>
<tr><strong><font size="-2">Traduction Française</font></strong></tr>
<tr><script language="JavaScript1.2" src="http://www.altavista.com/static/scripts/translate_french.js"></script></tr>
<tr><font size="-2">Notez que la traduction semble fonctionner mieux si vous right-clic le drapeau et ouvrir la traduction dans une nouvelle fenĂȘtre.</font></tr>
</table>

(I used the translation tool to translate into the French in the second one. If it's incorrect, please feel free to fix it)
Um, okay, weird. This works fine on my version of wikka 1.0.2, but not at all on 1.1.5.3 ....anybody have any sense as to why?? I'd appreciate any insights. On further investigation, even if I go to http://babelfish.altavista.com/ and enter http://131.202.167.33/helpwiki/wikka.php?wakka=HomePage it won't translate the page, whereas if I enter http://wikka.jsnx.com/HomePage (which are both the same version of Wikka) it will translate that page. Since my using the feature that allows Jason to have the "shortform" of the web address is not an option for me (as far as I know...although I'm happy to be corrected on this), is there any solution??

Other Mods in development

Many current mods in development...a "chat" that as an embedded flash chat (vchat modded from flatfile to database)....altho' it's difficult to pass to someone else cuz the fla file needs to be edited for each website (we've not been able to solve the absolute/relative path statement issue). Another action in development is the interactive table action which is a "big" one for our interests...it is like a *very* simple spreadsheet tool -- an interactive table actually -- that will do sum, count, frequency & average on the column entries....but we're currently having a problem with the foreach() statement which is why we've not released it yet). As we complete various tools I'll post them here when completed. Also, I'm working on a simple scheduler partly based on GmBowenCalendar, but having problems with writing to the database consistently....but it will be useful for doing some PIM functions, and collaborating on timetables. Another thing we're working on is a wiki-based private messaging system....but that'll be awhile before it shows up as I'm trying to do it myself from more or less scratch (it'll allow kids to send messages to each other w/o using email.....a security issue eh?) to help learn programming better. As you've probably noticed, I'm trying to develop tools that are portal-like but embedded in the wiki so it can expand beyond its traditional use. We've "mostly" finished a "pagewatches" action that allows you to keep a list of pages that you're looking to see if changes have been made on. The code for the action and the table info for it will be posted soonish.....on Monday/Tuesday next..... And what's my dream with regarding the wiki?? A rich text editor choice (in addition to wikiedit)...it'll make it more user friendly for kids, but methinks that must be a hard thing to accomplish (since nobody has progressed with the idea much). -- Mike

Other Recent Code Releases/Submissions

Valid XHTML :: Valid CSS: :: Powered by WikkaWiki