Frank Chestnut


Currently co-developer of the PostNuke CMS, I am building a PostNuke module based on pnWikka.
Currently working and living in France since 1999 in a family-own professional software company for music publisher.

pnWikka
pnWikka is a module for PostNuke based on Wikka. Since PostNuke already gives different technologies like an API, user management, permission system and a template engine, pnWikka became a "fork" of Wikka for PostNuke. Most if not all aspect of Wikka was rewritten to be PostNuke Compliant.

pnWikka is not available yet...



Example
Example of a simple action rewritten in pnWikka:

The function...
function pnWikka_actionapi_ownedpages()
{

    // Check if user is logged in, if not, return with the appropriate message
    if (!pnUserLoggedIn()) {
        return pnVarPrepForDisplay(_NOTLOGGEDIN);
    }

    // Get the username
    $uname = pnUserGetVar('uname');

    // Get the pages
    $pages = pnModAPIFunc('pnWikka', 'user', 'LoadAllPagesOwnedByUser', array('uname' => $uname));

    // If no pages - Todo: Make a difference between error and no pages
    if (!$pages) {
        return 'Error getting pages';
    }

    // Initializing template engine
    $pnRender =& New pnRender('pnWikka');
    //$pnRender->caching = false;

    // Assign the values to the template
    $pnRender->Assign($pages);
    $pnRender->Assign('uname', $uname);
    $pnRender->Assign('percent', round(($pages['count']/$pages['total'])*100, 2));

    // Return the template to the system
    return $pnRender->Fetch('pnwikka_action_ownedpages.tpl', $uname);

}


The "Load All pages Owned By User" function...
function pnWikka_userapi_LoadAllPagesOwnedByUser($args)
{

    extract($args);
    unset($args);

    if (!isset($uname)) {
        return false;
    }

    $dbconn  =& pnDBGetConn(true);
    $pntable =& pnDBGetTables();

    $tbl = &$pntable['pnwikka_pages'];
    $col = &$pntable['pnwikka_pages_column'];

    $sql = "SELECT    $col[id],
                      $col[tag],
                      $col[time],
                      $col[body],
                      $col[owner],
                      $col[user],
                      $col[note],
                      $col[handler]
            FROM      $tbl
            WHERE     $col[owner]  = '"
.pnVarPrepForStore($uname)."'
            AND       $col[latest] = 'Y'
            ORDER BY  $col[tag] ASC"
;

    $result =& $dbconn->Execute($sql);

    if ($dbconn->ErrorNo() != 0) {
        pnSessionSetVar('errormsg', pnVarPrepForDisplay(_PNWIKKA_GETLOADALLPAGESBYUSERFAILED."".$dbconn->ErrorMsg()));
        return false;
    }

    $pages = array();
    $i     = 0;

    for (; !$result->EOF; $result->MoveNext()) {
        list($id,
             $tag,
             $time,
             $body,
             $owner,
             $user,
             $note,
             $handler) = $result->fields;

        // Permission check
        if (pnSecAuthAction(0, 'pnWikka::', "page::$page_tag", ACCESS_READ)) {
            $i++;
            $pages[] = array('id'       => $id,
                              'tag'     => $tag,
                              'time'    => $time,
                              'body'    => $body,
                              'owner'   => $owner,
                              'user'    => $user,
                              'note'    => $note,
                              'handler' => $handler);
        }

    }

    $result->Close();

    $allpages = array();

    $allpages['pages'] = $pages;
    $allpages['count'] = $i;
    $allpages['total'] = pnModAPIFunc('pnWikka', 'user', 'CountAllPages');

    return $allpages;

}


The template...
<blockquote>
  You own <strong><!--[$count]--></strong> pages out of the <strong><!--[$total]--></strong> pages on this wiki.<br />
  This means you own <strong><!--[$percent]-->%</strong> of the total.
</blockquote>


The template is translated via a language file containing a define :
<?php

if (!defined('_PNWIKKA_ACTION_OWNEDPAGES')) {
    define('_PNWIKKA_ACTION_OWNEDPAGES',      'You own <strong>%count%</strong> pages out of the <strong>%total%</strong> pages on this wiki.<br />This means you own <strong>%percent% %</strong> of the total.');
    define('_PNWIKKA_ACTION_OWNEDPAGESERROR', 'Error getting pages !');
}

?>


The final template after being translated uses a PostNuke Smarty plugin:
<blockquote>
  <!--[pnml name='_PNWIKKA_ACTION_OWNEDPAGES' count=$count total=$total percent=$percent html=true]-->
</blockquote>



Wikka was chosen for all the good reasons already mentioned here and there and it would be very repetitive to write them all again. Let's just say that it was simply the best out there and the easiest to work on. ;-)



Also

DatabaseAbstraction
SpamSafeEmail


CategoryUsers
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki