Revision history for KlenWell


Revision [23514]

Last edited on 2016-05-20 07:38:48 by KlenWell [Replaces old-style internal links with new pipe-split links.]
Additions:
password: [[http://mushpup.org/ | m{ this.domain/KlenWell }]]
wush.net [[http://wush.net/trac/wikka/login | login]]: klenwell / m{ wush.net/that.user }
Since upgrading to version 1.2, I've become more interested in exploring Wikka and developing some extension and features. More information on the development projects I'm working on can be found on [[http://klenwell.com/is/ProjectWikka | my wiki]].
I've redesigned my wiki site using the [[http://docs.wikkawiki.org/WikkaThemes | new theming system]]. The source code for that, and other wikka features I'm working on, can be found at [[http://code.google.com/p/klenwell/source/browse/trunk/projects/php/wikka/#wikka/templates/klenwell | my Google code site]].
[[KlenwellAdminOnlyInstaller | Admin-Only Installer]]
[[http://klenwell.com/is/WikkaRecaptchaLoginRegistration | ReCaptcha Registration/Login Action]]
[[http://klenwell.com/is/WikkaRecaptchaCommentForm | ReCaptcha Comment Form]]
[[http://klenwell.com/is/WikkaActivitySummaryAction | Activity Summary Action]]
[[http://klenwell.com/is/WikkaBaseActionClass | Wikka Base Action Class]]
[[http://klenwell.com/is/WikkaSimpleActionClass | Wikka Action as a Class]]
[[http://klenwell.com/is/WikkaActionRedirect | Redirect Action]]
[[http://code.google.com/p/klenwell/source/browse/trunk/projects/php/wikka/cli.php | Command Line Interface]] (esp. for cron jobs)
[[http://stackoverflow.com/questions/11752250/ | MySQL 5.5 Incompatible with Install Script]] ([[https://wush.net/trac/wikka/ticket/1049 | Ticket 1049]])
Deletions:
password: [[http://mushpup.org/ m{ this.domain/KlenWell }]]
wush.net [[http://wush.net/trac/wikka/login login]]: klenwell / m{ wush.net/that.user }
Since upgrading to version 1.2, I've become more interested in exploring Wikka and developing some extension and features. More information on the development projects I'm working on can be found on [[http://klenwell.com/is/ProjectWikka my wiki]].
I've redesigned my wiki site using the [[http://docs.wikkawiki.org/WikkaThemes new theming system]]. The source code for that, and other wikka features I'm working on, can be found at [[http://code.google.com/p/klenwell/source/browse/trunk/projects/php/wikka/#wikka/templates/klenwell my Google code site]].
[[KlenwellAdminOnlyInstaller Admin-Only Installer]]
[[http://klenwell.com/is/WikkaRecaptchaLoginRegistration ReCaptcha Registration/Login Action]]
[[http://klenwell.com/is/WikkaRecaptchaCommentForm ReCaptcha Comment Form]]
[[http://klenwell.com/is/WikkaActivitySummaryAction Activity Summary Action]]
[[http://klenwell.com/is/WikkaBaseActionClass Wikka Base Action Class]]
[[http://klenwell.com/is/WikkaSimpleActionClass Wikka Action as a Class]]
[[http://klenwell.com/is/WikkaActionRedirect Redirect Action]]
[[http://code.google.com/p/klenwell/source/browse/trunk/projects/php/wikka/cli.php Command Line Interface]] (esp. for cron jobs)
[[http://stackoverflow.com/questions/11752250/ MySQL 5.5 Incompatible with Install Script]] ([[https://wush.net/trac/wikka/ticket/1049 Ticket 1049]])


Revision [21730]

Edited on 2012-08-01 09:29:32 by KlenWell [Replaces old-style internal links with new pipe-split links.]
Additions:
[[http://stackoverflow.com/questions/11752250/ MySQL 5.5 Incompatible with Install Script]] ([[https://wush.net/trac/wikka/ticket/1049 Ticket 1049]])
Deletions:
[[http://stackoverflow.com/questions/11752250/ MySQL 5.5 Incompatible with Install Script]]


Revision [21729]

Edited on 2012-07-31 22:51:54 by KlenWell [bug report: MySQL 5.5 Incompatible with Installer]
Additions:
===Bug Reports===
[[http://stackoverflow.com/questions/11752250/ MySQL 5.5 Incompatible with Install Script]]


Revision [21669]

Edited on 2012-01-23 00:45:14 by KlenWell [bug report: MySQL 5.5 Incompatible with Installer]
Additions:
password: [[http://mushpup.org/ m{ this.domain/KlenWell }]]
wush.net [[http://wush.net/trac/wikka/login login]]: klenwell / m{ wush.net/that.user }
Deletions:
password: [[http://mushpup.org/ m{this.domain/KlenWell}]]
wush.net [[http://wush.net/trac/wikka/login login]]: klenwell / m{wush.net/that.user}


Revision [21668]

Edited on 2012-01-23 00:44:18 by KlenWell [bug report: MySQL 5.5 Incompatible with Installer]
Deletions:
The wish list below includes a sampling of features I'd like to find or develop for the Wikka package. The [[http://klenwell.com/is/ProjectWikka updated list]] is available at my site.


Revision [21662]

Edited on 2012-01-17 21:24:10 by KlenWell [bug report: MySQL 5.5 Incompatible with Installer]
Additions:
[[KlenwellAdminOnlyInstaller Admin-Only Installer]]
Deletions:
===Note on Installer===
(I can't seem to post this anywhere else):
Is it possible to restrict the installer pages to an admin? I upgraded to 1.3.2 just now. I had completed the install on a local dev version and planned to just upload that. But I found I needed to run the installer on my production site, too, to make the database updates. I noticed that while it was running, the install/upgrade pages were accessible to non-logged-in guests. This seems like a potential security vulnerability as it may display the config file.
Next time, I upgrade, I'll look into adding this restriction myself if it doesn't already exist.


Revision [21661]

Edited on 2012-01-17 01:23:22 by KlenWell [re: installer]
Additions:
===Note on Installer===
(I can't seem to post this anywhere else):
Is it possible to restrict the installer pages to an admin? I upgraded to 1.3.2 just now. I had completed the install on a local dev version and planned to just upload that. But I found I needed to run the installer on my production site, too, to make the database updates. I noticed that while it was running, the install/upgrade pages were accessible to non-logged-in guests. This seems like a potential security vulnerability as it may display the config file.
Next time, I upgrade, I'll look into adding this restriction myself if it doesn't already exist.


Revision [21188]

Edited on 2010-05-12 00:04:53 by KlenWell [Adding link to base action class]
Additions:
[[http://klenwell.com/is/WikkaBaseActionClass Wikka Base Action Class]]


Revision [21185]

Edited on 2010-05-11 23:32:28 by KlenWell [Adding link to base action class]
Additions:
----
CodeContributions
Deletions:
===Wikka Wish List===
ReCaptcha-protected Comment and Login Forms


Revision [21184]

Edited on 2010-05-11 23:31:00 by KlenWell [This may be of interest to this stie.]
Additions:
[[http://klenwell.com/is/WikkaRecaptchaLoginRegistration ReCaptcha Registration/Login Action]]


Revision [21180]

Edited on 2010-04-30 00:18:07 by KlenWell [This may be of interest to this stie.]
Additions:
[[http://klenwell.com/is/WikkaRecaptchaCommentForm ReCaptcha Comment Form]]


Revision [21104]

Edited on 2010-04-16 01:18:38 by KlenWell [This may be of interest to this stie.]
Additions:
[[http://klenwell.com/is/WikkaActivitySummaryAction Activity Summary Action]]
Deletions:
Daily Report Scripts (run as cron jobs with CLI)
Gmail Integration


Revision [21100]

Edited on 2010-04-08 22:16:10 by KlenWell [This may be of interest to this stie.]
Additions:
[[http://klenwell.com/is/WikkaSimpleActionClass Wikka Action as a Class]]


Revision [21086]

Edited on 2010-03-28 14:38:57 by KlenWell [This may be of interest to this stie.]
Additions:
===Additions and Enhancements===
[[http://klenwell.com/is/WikkaActionRedirect Redirect Action]]


Revision [21085]

Edited on 2010-03-26 01:37:04 by KlenWell [This may be of interest to this stie.]
Additions:
[[http://code.google.com/p/klenwell/source/browse/trunk/projects/php/wikka/cli.php Command Line Interface]] (esp. for cron jobs)
Deletions:
Command Line Interface (esp. for cron jobs)


Revision [21073]

Edited on 2010-03-22 22:34:53 by KlenWell [This may be of interest to this stie.]
Additions:
my wikka site: http://klenwell.com/is/
blog: http://klenwell.com/press/
===Wikka Development===
Since upgrading to version 1.2, I've become more interested in exploring Wikka and developing some extension and features. More information on the development projects I'm working on can be found on [[http://klenwell.com/is/ProjectWikka my wiki]].
I've redesigned my wiki site using the [[http://docs.wikkawiki.org/WikkaThemes new theming system]]. The source code for that, and other wikka features I'm working on, can be found at [[http://code.google.com/p/klenwell/source/browse/trunk/projects/php/wikka/#wikka/templates/klenwell my Google code site]].
The wish list below includes a sampling of features I'd like to find or develop for the Wikka package. The [[http://klenwell.com/is/ProjectWikka updated list]] is available at my site.
===Wikka Wish List===
Command Line Interface (esp. for cron jobs)
Daily Report Scripts (run as cron jobs with CLI)
Gmail Integration
ReCaptcha-protected Comment and Login Forms
Deletions:
my wikka site: http://www.klenwell.net/is/HomePage
blog: http://phosphorusandlime.blogspot.com/
===Code Contributions===
[[http://www.klenwell.net/is/WikkaSkinCustomization Wikka 3-Column Layout Customization]]
[[http://www.klenwell.net/is/WikkaChangeNotifier Wikka Recent Changes Notifier]]
""<a id="handler_source"></a>""
===Proposed Page Handler Revision===
A good first step in intelligently refactoring the page handler code would be identifying the discrete html elements that make up the html it outputs. I've created the following page to list out the html elements and controller events that output core wikka page:
HandlerShowSchema
The page-rendering code (''handlers/page/show.php'') for wikka, at the moment, is a bit disorganized. I notice there are some references to a new templating model in [[http://wush.net/trac/wikka/browser/trunk/handlers/show/show.php the latest release]] and notice the improvement being made. But I think this part of the code could benefit by following a more organized controller logic. Find my proposed revision of ''handlers/page/show.php'' below:
**Its advantages**
- eliminates confusing mixture of logic and presentation layers
- preserves all elements of the current source code
- offers a controller for more cleanly determining which elements of the page get displayed
- distinctly identifies each element of the resulting layout
- provides a simple prototype for a templating model
- makes it easier to change major layout elements for web designers
- my tests of it thus far have been successful
Note: this was submitted to Wikkawiki dev site as [[http://wush.net/trac/wikka/ticket/532 Ticket #532]]
**Code Source**
[[KlenwellCodeHandlerShow564 show.20070712.php]] (based on [[http://wush.net/trac/wikka/changeset/564 revision #564]])
[[KlenwellCodeHandlerShow637 show.20070805.php]] (based on [[http://wush.net/trac/wikka/changeset/637 revision #637]])


Revision [19324]

Edited on 2008-01-28 00:15:16 by KlenWell [Modified links pointing to docs server]

No Differences

Revision [17367]

Edited on 2007-08-08 00:57:17 by KlenWell [Modified links pointing to docs server]
Additions:
A good first step in intelligently refactoring the page handler code would be identifying the discrete html elements that make up the html it outputs. I've created the following page to list out the html elements and controller events that output core wikka page:
HandlerShowSchema


Revision [17340]

Edited on 2007-08-06 00:40:57 by KlenWell [Modified links pointing to docs server]
Additions:
[[KlenwellCodeHandlerShow564 show.20070712.php]] (based on [[http://wush.net/trac/wikka/changeset/564 revision #564]])
[[KlenwellCodeHandlerShow637 show.20070805.php]] (based on [[http://wush.net/trac/wikka/changeset/637 revision #637]])
Deletions:
[[KlenwellCodeHandlerShow564 show.20070712.php]] (based on [[http://wush.net/trac/wikka/browser/trunk/handlers/show/show.php?rev=564 revision #564]])


Revision [17337]

Edited on 2007-08-06 00:22:37 by KlenWell [Modified links pointing to docs server]
Additions:
[[KlenwellCodeHandlerShow564 show.20070712.php]] (based on [[http://wush.net/trac/wikka/browser/trunk/handlers/show/show.php?rev=564 revision #564]])
Deletions:
[[KlenwellCodeShow564 show.20070712.php]] (based on [[http://wush.net/trac/wikka/browser/trunk/handlers/show/show.php?rev=564 revision #564]])


Revision [17336]

Edited on 2007-08-06 00:22:04 by KlenWell [Modified links pointing to docs server]
Additions:
**Code Source**
[[KlenwellCodeShow564 show.20070712.php]] (based on [[http://wush.net/trac/wikka/browser/trunk/handlers/show/show.php?rev=564 revision #564]])
Deletions:
**The Source**
%%(php)
<?php
/**
* Display a page if the user has read access or is an admin.
*
* This is the default page handler used by Wikka when no other handler is specified.
* Depending on user privileges, it displays the page body or an error message. It also
* displays footer comments and a form to post comments, depending on ACL and general
* config settings.
*
* @package Handlers
* @subpackage Page
* @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
* @filesource
*
* @uses Wakka::Format()
* @uses Wakka::FormClose()
* @uses Wakka::FormOpen()
* @uses Wakka::GetConfigValue()
* @uses Wakka::GetPageTag()
* @uses Wakka::GetUser()
* @uses Wakka::GetUserName()
* @uses Wakka::HasAccess()
* @uses Wakka::Href()
* @uses Wakka::htmlspecialchars_ent()
* @uses Wakka::LoadComments()
* @uses Wakka::LoadPage()
* @uses Wakka::LoadUser()
* @uses Wakka::UserIsOwner()
* @uses Config::$anony_delete_own_comments
* @uses Config::$hide_comments
*
* @todo move <div> to template;
* @todo replace $_REQUEST with either $_GET or $_POST (or both if really
* necessary) - #312
*/

// *** Show Flags for Controller
$_SHOW['page_start'] = 0;
$_SHOW['no_access'] = 0;
$_SHOW['not_exists'] = 0;
$_SHOW['page_body'] = 0;
$_SHOW['revision_info'] = 0;
$_SHOW['revision_edit_form'] = 0;
$_SHOW['comments'] = 0;
$_SHOW['hidden_comments'] = 0;
$_SHOW['no_comments'] = 0;
$_SHOW['comment_form'] = 0;
$_SHOW['page_close'] = 0;
// *** HTML Blocks
$_HTML['page'] = '';
$_HTML['page_start'] = '';
$_HTML['no_access'] = '';
$_HTML['not_exists'] = '';
$_HTML['revision_info'] = '';
$_HTML['page_body'] = '';
$_HTML['revision_edit_form'] = '';
$_HTML['page_close_div'] = '';
$_HTML['comments_header'] = '';
$_HTML['comments'] = '';
$_HTML['comment_form'] = '';
$_HTML['hidden_comments'] = '';
$_HTML['page_close'] = '';
// *** Controller
// Default Shows
$_SHOW['page_start'] = 1;
$_SHOW['page_close'] = 1;
// Has Page Access
if (!$this->HasAccess('read'))
{
$_SHOW['no_access'] = 1;
}
// Page Exists
if ( !$this->page )
{
$_SHOW['not_exists'] = 1;
}
else
{
$_SHOW['page_body'] = 1;
}

// As Revision
if ($this->page['latest'] == 'N')
{
$_SHOW['revision_info'] = 1;
}
// Revision w/ write access
if ( ($this->page['latest'] == 'N' && $this->HasAccess('write')) && ($latest = $this->LoadPage($this->tag)) )
{
$_SHOW['revision_edit_form'] = 1;
}

// Show Comment Form
if ( $this->GetConfigValue('hide_comments') != 1 )
{
// get page tag
$tag = $this->GetPageTag();

// session settings?
if ( !isset($_SESSION['show_comments'][$tag]) )
{
$_SESSION['show_comments'][$tag] = ($this->UserWantsComments() ? '1' : '0');
}

// GET setting takes precedence
if ( isset($_GET['show_comments']) ) #312
{
if ( $_GET['show_comments'] == 0 )
{
$_SESSION['show_comments'][$tag] = 0;
}
elseif ( $_GET['show_comments'] == 1 )
{
$_SESSION['show_comments'][$tag] = 1;
}
}

if ($_SESSION['show_comments'][$tag])
{
$_SHOW['comment_form'] = 1;
}
else
{
$_SHOW['hidden_comments'] = 1;
}
}

// Show Comments?
$comments = $this->LoadComments($this->tag);
if ( $_SESSION['show_comments'][$tag] && $comments )
{
$_SHOW['comments'] = 1;
}



// *** Viewer Blocks
// Page Start
if ( $_SHOW['page_start'] )
{
$_js = ( ($user = $this->GetUser()) && ($user['doubleclickedit'] == 'N') || !$this->HasAccess('write') ) ? '' : 'ondblclick="document.location=\''.$this->Href('edit').'\';" ';
$_HTML['page_start'] = <<<HTML
<!--starting page content-->
<div class="page" {$_js }>
HTML;
}
// Generic
if ( $_SHOW['no_access'] )
{
$_HTML['no_access'] = <<<HTML

<p><em class="error">You aren't allowed to read this page.</em></p>
</div>

HTML;
}
// Page does not exist yet
if ( $_SHOW['not_exists'] )
{
$_HTML['not_exists'] = <<<HTML

<p>This page doesn't exist yet. Maybe you want to <a href="{$this->Href('edit')}">create</a> it?</p>
</div>

HTML;
}
// Revision Info
if ( $_SHOW['revision_info'] )
{

$href = $this->Href();
$alabel = $this->GetPageTag();
$ptime = $this->page['time'];
$_HTML['revision_info'] = <<<HTML
<div class="revisioninfo">
This is an old revision of <a href="{$href}">{$alabel}</a> from {$ptime}
</div>
HTML;
}
// Page Body
if ( $_SHOW['page_body'] )
{
$_HTML['page_body'] = $this->Format($this->page['body'], 'wakka');
$_HTML['page_close_div'] = "</div>\n";
}
// Revision Edit Form
if ( $_SHOW['revision_edit_form'] )
{
$form_start = $this->FormOpen('edit');
$lid = $latest['id'];
$hvalue = $this->htmlspecialchars_ent($this->page['body']);
$form_close = $this->FormClose();

$_HTML['revision_edit_form'] = <<<HTML

<br />
$form_start
<input type="hidden" name="previous" value="$lid" />
<input type="hidden" name="body" value="$hvalue" />
<input type="submit" value="Re-edit this old revision" />
$form_close

HTML;
}
// Comments Header and Form
if ( $_SHOW['comment_form'] )
{
$href = $this->Href('', '', 'show_comments=0');

$_HTML['comments_header'] = <<<HTML
<div class="commentsheader">
<span id="comments"> </span>Comments [<a href="$href">Hide comments/form</a>]
</div>
HTML;
$form_start = $this->FormOpen('addcomment');
$form_close = $this->FormClose();
$_HTML['comment_form'] = <<<HTML
<div class="commentform">
$form_start
<label for="commentbox">Add a comment to this page:<br />
<textarea id="commentbox" name="body" rows="6" cols="78"></textarea><br />
<input type="submit" value="Add Comment" accesskey="s" />
</label>
$form_close
</div>

HTML;
}
// comments themselves
if ( $_SHOW['comments'] )
{
$current_user = $this->GetUserName();
$comment_stack = '';

foreach ($comments as $comment)
{
$comment_stack .= '<div class="comment">'."\n";
$comment_stack .= '<span id="comment_'.$comment['id'].'"></span>'.$comment['comment']."\n";
$comment_stack .= "\t".'<div class="commentinfo">'."\n-- ";
$comment_stack .= ( $this->LoadUser($comment['user']) ) ? $this->Format($comment['user']) : $comment['user'];
$comment_stack .= ' ('.$comment['time'].')'."\n";

// does comment get delete form?
if ($this->UserIsOwner() || $current_user == $comment['user'] || ($this->config['anony_delete_own_comments'] && $current_user == $comment['user']) )
{
$comment_stack .= $this->FormOpen("delcomment");
$comment_stack .= '<input type="hidden" name="comment_id" value="' . $comment['id'] . '" />';
$comment_stack .= '<input type="submit" value="Delete Comment" />';
$comment_stack .= $this->FormClose();
}

$comment_stack .= "\n\t".'</div>'."\n";
$comment_stack .= '</div>'."\n";
}
$_HTML['comments'] = $comment_stack;
}
// hidden comments
if ( $_SHOW['hidden_comments'] )
{
switch (count($comments))
{
case 0:
$comment_count = '<p>There are no comments on this page. ';
$showcomments_text = 'Add comment';
break;

case 1:
$comment_count = '<p>There is one comment on this page. ';
$showcomments_text = 'Display comment';
break;

default:
$comment_count = '<p>There are '.count($comments).' comments on this page. ';
$showcomments_text = 'Display comments';
}
$href = $this->Href('', '', 'show_comments=1#comments');
$_HTML['hidden_comments'] = <<<HTML

<div class="commentsheader">
$comment_count
[<a href="$href">$showcomments_text</a>]</p>
</div>
HTML;
}
// Page Close
if ( $_SHOW['page_close'] )
{
$_HTML['page_close'] = <<<HTML
</div>
<!--closing page content-->
HTML;
}
// End Viewer Blocks
// *** TEMPLATE: stitch it all together
$_HTML['page'] = <<<HTML
{$_HTML['page_start']}
{$_HTML['no_access']}
{$_HTML['not_exists']}
{$_HTML['revision_info']}
{$_HTML['page_body']}
{$_HTML['revision_edit_form']}
{$_HTML['page_close_div']}
{$_HTML['comments_header']}
{$_HTML['comments']}
{$_HTML['comment_form']}
{$_HTML['hidden_comments']}
{$_HTML['page_close']}
HTML;
echo $_HTML['page'];
?>
%%


Revision [17263]

Edited on 2007-07-14 20:17:16 by KlenWell [Modified links pointing to docs server]
Additions:
The page-rendering code (''handlers/page/show.php'') for wikka, at the moment, is a bit disorganized. I notice there are some references to a new templating model in [[http://wush.net/trac/wikka/browser/trunk/handlers/show/show.php the latest release]] and notice the improvement being made. But I think this part of the code could benefit by following a more organized controller logic. Find my proposed revision of ''handlers/page/show.php'' below:
**Its advantages**
Deletions:
The page-rendering code (''handlers/page/show.php'') for wikka, at the moment, is pretty sloppy. I notice there are some references to a new templating model in [[http://wush.net/trac/wikka/browser/trunk/handlers/show/show.php the latest release]] and notice the improvement being made. But I think this part of the code could benefit by following a more organized controller logic. Find my proposed revision of ''handlers/page/show.php'' below:
**It's advantages**


Revision [17257]

Edited on 2007-07-12 20:36:55 by KlenWell [handler anchor]
Additions:
""<a id="handler_source"></a>""


Revision [17256]

Edited on 2007-07-12 18:54:35 by KlenWell [Proposed Page Handler Revision]
Additions:
- eliminates confusing mixture of logic and presentation layers
Deletions:
- eliminates sloppy mixture of rendering logic and output


Revision [17255]

Edited on 2007-07-12 18:51:47 by KlenWell [Proposed Page Handler Revision]
Additions:
<p><em class="error">You aren't allowed to read this page.</em></p>
Deletions:
<p><em class="error">You aren\'t allowed to read this page.</em></p>


Revision [17254]

Edited on 2007-07-12 18:50:08 by KlenWell [Proposed Page Handler Revision]

No Differences

Revision [17253]

Edited on 2007-07-12 18:46:09 by KlenWell [Proposed Page Handler Revision]
Additions:
Note: this was submitted to Wikkawiki dev site as [[http://wush.net/trac/wikka/ticket/532 Ticket #532]]


Revision [17252]

Edited on 2007-07-12 18:42:48 by KlenWell [proposed page handler revision]
Additions:
===Proposed Page Handler Revision===
Deletions:
===New Page Template===


Revision [17251]

Edited on 2007-07-12 18:35:04 by KlenWell [proposed page handler revision]
Additions:
The page-rendering code (''handlers/page/show.php'') for wikka, at the moment, is pretty sloppy. I notice there are some references to a new templating model in [[http://wush.net/trac/wikka/browser/trunk/handlers/show/show.php the latest release]] and notice the improvement being made. But I think this part of the code could benefit by following a more organized controller logic. Find my proposed revision of ''handlers/page/show.php'' below:
Deletions:
The page-rendering code (''handlers/page/show.php'') for wikka, at the moment, is pretty sloppy. I notice there are some references to a new templating model in the latest release and I admit that I have not investigated it yet. But I did rewrite the code to follow more of a MVC pattern. Find below the actual rewritten file for ''handlers/page/show.php''.


Revision [17250]

Edited on 2007-07-12 18:28:13 by KlenWell [proposed page handler revision]
Additions:
password: [[http://mushpup.org/ m{this.domain/KlenWell}]]
wush.net [[http://wush.net/trac/wikka/login login]]: klenwell / m{wush.net/that.user}
Deletions:
password: [[http://mushpup.org/ m{this.domain/this.user}]]


Revision [17249]

Edited on 2007-07-12 15:08:26 by KlenWell [proposed page handler revision]
Additions:
===New Page Template===
The page-rendering code (''handlers/page/show.php'') for wikka, at the moment, is pretty sloppy. I notice there are some references to a new templating model in the latest release and I admit that I have not investigated it yet. But I did rewrite the code to follow more of a MVC pattern. Find below the actual rewritten file for ''handlers/page/show.php''.
**It's advantages**
- eliminates sloppy mixture of rendering logic and output
- preserves all elements of the current source code
- offers a controller for more cleanly determining which elements of the page get displayed
- distinctly identifies each element of the resulting layout
- provides a simple prototype for a templating model
- makes it easier to change major layout elements for web designers
- my tests of it thus far have been successful
**The Source**
%%(php)
<?php
/**
* Display a page if the user has read access or is an admin.
*
* This is the default page handler used by Wikka when no other handler is specified.
* Depending on user privileges, it displays the page body or an error message. It also
* displays footer comments and a form to post comments, depending on ACL and general
* config settings.
*
* @package Handlers
* @subpackage Page
* @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
* @filesource
*
* @uses Wakka::Format()
* @uses Wakka::FormClose()
* @uses Wakka::FormOpen()
* @uses Wakka::GetConfigValue()
* @uses Wakka::GetPageTag()
* @uses Wakka::GetUser()
* @uses Wakka::GetUserName()
* @uses Wakka::HasAccess()
* @uses Wakka::Href()
* @uses Wakka::htmlspecialchars_ent()
* @uses Wakka::LoadComments()
* @uses Wakka::LoadPage()
* @uses Wakka::LoadUser()
* @uses Wakka::UserIsOwner()
* @uses Config::$anony_delete_own_comments
* @uses Config::$hide_comments
*
* @todo move <div> to template;
* @todo replace $_REQUEST with either $_GET or $_POST (or both if really
* necessary) - #312
*/

// *** Show Flags for Controller
$_SHOW['page_start'] = 0;
$_SHOW['no_access'] = 0;
$_SHOW['not_exists'] = 0;
$_SHOW['page_body'] = 0;
$_SHOW['revision_info'] = 0;
$_SHOW['revision_edit_form'] = 0;
$_SHOW['comments'] = 0;
$_SHOW['hidden_comments'] = 0;
$_SHOW['no_comments'] = 0;
$_SHOW['comment_form'] = 0;
$_SHOW['page_close'] = 0;
// *** HTML Blocks
$_HTML['page'] = '';
$_HTML['page_start'] = '';
$_HTML['no_access'] = '';
$_HTML['not_exists'] = '';
$_HTML['revision_info'] = '';
$_HTML['page_body'] = '';
$_HTML['revision_edit_form'] = '';
$_HTML['page_close_div'] = '';
$_HTML['comments_header'] = '';
$_HTML['comments'] = '';
$_HTML['comment_form'] = '';
$_HTML['hidden_comments'] = '';
$_HTML['page_close'] = '';
// *** Controller
// Default Shows
$_SHOW['page_start'] = 1;
$_SHOW['page_close'] = 1;
// Has Page Access
if (!$this->HasAccess('read'))
{
$_SHOW['no_access'] = 1;
}
// Page Exists
if ( !$this->page )
{
$_SHOW['not_exists'] = 1;
}
else
{
$_SHOW['page_body'] = 1;
}

// As Revision
if ($this->page['latest'] == 'N')
{
$_SHOW['revision_info'] = 1;
}
// Revision w/ write access
if ( ($this->page['latest'] == 'N' && $this->HasAccess('write')) && ($latest = $this->LoadPage($this->tag)) )
{
$_SHOW['revision_edit_form'] = 1;
}

// Show Comment Form
if ( $this->GetConfigValue('hide_comments') != 1 )
{
// get page tag
$tag = $this->GetPageTag();

// session settings?
if ( !isset($_SESSION['show_comments'][$tag]) )
{
$_SESSION['show_comments'][$tag] = ($this->UserWantsComments() ? '1' : '0');
}

// GET setting takes precedence
if ( isset($_GET['show_comments']) ) #312
{
if ( $_GET['show_comments'] == 0 )
{
$_SESSION['show_comments'][$tag] = 0;
}
elseif ( $_GET['show_comments'] == 1 )
{
$_SESSION['show_comments'][$tag] = 1;
}
}

if ($_SESSION['show_comments'][$tag])
{
$_SHOW['comment_form'] = 1;
}
else
{
$_SHOW['hidden_comments'] = 1;
}
}

// Show Comments?
$comments = $this->LoadComments($this->tag);
if ( $_SESSION['show_comments'][$tag] && $comments )
{
$_SHOW['comments'] = 1;
}



// *** Viewer Blocks
// Page Start
if ( $_SHOW['page_start'] )
{
$_js = ( ($user = $this->GetUser()) && ($user['doubleclickedit'] == 'N') || !$this->HasAccess('write') ) ? '' : 'ondblclick="document.location=\''.$this->Href('edit').'\';" ';
$_HTML['page_start'] = <<<HTML
<!--starting page content-->
<div class="page" {$_js }>
HTML;
// Generic
if ( $_SHOW['no_access'] )
{
$_HTML['no_access'] = <<<HTML

<p><em class="error">You aren\'t allowed to read this page.</em></p>
</div>

HTML;
}
// Page does not exist yet
if ( $_SHOW['not_exists'] )
{
$_HTML['not_exists'] = <<<HTML

<p>This page doesn't exist yet. Maybe you want to <a href="{$this->Href('edit')}">create</a> it?</p>
</div>

HTML;
}
// Revision Info
if ( $_SHOW['revision_info'] )
{

$href = $this->Href();
$alabel = $this->GetPageTag();
$ptime = $this->page['time'];
$_HTML['revision_info'] = <<<HTML
<div class="revisioninfo">
This is an old revision of <a href="{$href}">{$alabel}</a> from {$ptime}
</div>
HTML;
}
// Page Body
if ( $_SHOW['page_body'] )
{
$_HTML['page_body'] = $this->Format($this->page['body'], 'wakka');
$_HTML['page_close_div'] = "</div>\n";
}
// Revision Edit Form
if ( $_SHOW['revision_edit_form'] )
{
$form_start = $this->FormOpen('edit');
$lid = $latest['id'];
$hvalue = $this->htmlspecialchars_ent($this->page['body']);
$form_close = $this->FormClose();

$_HTML['revision_edit_form'] = <<<HTML

<br />
$form_start
<input type="hidden" name="previous" value="$lid" />
<input type="hidden" name="body" value="$hvalue" />
<input type="submit" value="Re-edit this old revision" />
$form_close

HTML;
}
// Comments Header and Form
if ( $_SHOW['comment_form'] )
{
$href = $this->Href('', '', 'show_comments=0');

$_HTML['comments_header'] = <<<HTML
<div class="commentsheader">
<span id="comments"> </span>Comments [<a href="$href">Hide comments/form</a>]
</div>
HTML;
$form_start = $this->FormOpen('addcomment');
$form_close = $this->FormClose();
$_HTML['comment_form'] = <<<HTML
<div class="commentform">
$form_start
<label for="commentbox">Add a comment to this page:<br />
<textarea id="commentbox" name="body" rows="6" cols="78"></textarea><br />
<input type="submit" value="Add Comment" accesskey="s" />
</label>
$form_close
</div>

HTML;
}
// comments themselves
if ( $_SHOW['comments'] )
{
$current_user = $this->GetUserName();
$comment_stack = '';

foreach ($comments as $comment)
{
$comment_stack .= '<div class="comment">'."\n";
$comment_stack .= '<span id="comment_'.$comment['id'].'"></span>'.$comment['comment']."\n";
$comment_stack .= "\t".'<div class="commentinfo">'."\n-- ";
$comment_stack .= ( $this->LoadUser($comment['user']) ) ? $this->Format($comment['user']) : $comment['user'];
$comment_stack .= ' ('.$comment['time'].')'."\n";

// does comment get delete form?
if ($this->UserIsOwner() || $current_user == $comment['user'] || ($this->config['anony_delete_own_comments'] && $current_user == $comment['user']) )
{
$comment_stack .= $this->FormOpen("delcomment");
$comment_stack .= '<input type="hidden" name="comment_id" value="' . $comment['id'] . '" />';
$comment_stack .= '<input type="submit" value="Delete Comment" />';
$comment_stack .= $this->FormClose();
}

$comment_stack .= "\n\t".'</div>'."\n";
$comment_stack .= '</div>'."\n";
}
$_HTML['comments'] = $comment_stack;
}
// hidden comments
if ( $_SHOW['hidden_comments'] )
{
switch (count($comments))
{
case 0:
$comment_count = '<p>There are no comments on this page. ';
$showcomments_text = 'Add comment';
break;

case 1:
$comment_count = '<p>There is one comment on this page. ';
$showcomments_text = 'Display comment';
break;

default:
$comment_count = '<p>There are '.count($comments).' comments on this page. ';
$showcomments_text = 'Display comments';
}
$href = $this->Href('', '', 'show_comments=1#comments');
$_HTML['hidden_comments'] = <<<HTML

<div class="commentsheader">
$comment_count
[<a href="$href">$showcomments_text</a>]</p>
</div>
HTML;
}
// Page Close
if ( $_SHOW['page_close'] )
{
$_HTML['page_close'] = <<<HTML
</div>
<!--closing page content-->
HTML;
}

}
// End Viewer Blocks
// *** TEMPLATE: stitch it all together
$_HTML['page'] = <<<HTML
{$_HTML['page_start']}
{$_HTML['no_access']}
{$_HTML['not_exists']}
{$_HTML['revision_info']}
{$_HTML['page_body']}
{$_HTML['revision_edit_form']}
{$_HTML['page_close_div']}
{$_HTML['comments_header']}
{$_HTML['comments']}
{$_HTML['comment_form']}
{$_HTML['hidden_comments']}
{$_HTML['page_close']}
HTML;
echo $_HTML['page'];
?>
%%


Revision [16305]

Edited on 2007-03-17 17:57:46 by KlenWell [proposed page handler revision]
Additions:
[[http://www.klenwell.net/is/WikkaChangeNotifier Wikka Recent Changes Notifier]]
Deletions:
[[http://www.klenwell.net/is/WikkaChangeNotifier Wikka Changes Notifier]]


Revision [16299]

Edited on 2007-03-17 17:45:54 by KlenWell [proposed page handler revision]
Additions:
blog: http://phosphorusandlime.blogspot.com/
===Code Contributions===
Deletions:
====Code Contributions====


Revision [16297]

The oldest known version of this page was created on 2007-03-17 17:16:57 by KlenWell [proposed page handler revision]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki