[pLog-svn] r5394 - in plugins/branches/lifetype-1.2/unported/editcomments: . class/action class/view templates
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Fri May 11 03:14:40 EDT 2007
Author: jondaley
Date: 2007-05-11 03:14:40 -0400 (Fri, 11 May 2007)
New Revision: 5394
Removed:
plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminplugineditcommentsaction.class.php
plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminpluginedittrackbacksaction.class.php
plugins/branches/lifetype-1.2/unported/editcomments/class/view/admineditcommentsview.class.php
plugins/branches/lifetype-1.2/unported/editcomments/class/view/adminedittrackbacksview.class.php
plugins/branches/lifetype-1.2/unported/editcomments/templates/editcomments.template
plugins/branches/lifetype-1.2/unported/editcomments/templates/edittrackbacks.template
Modified:
plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminedittrackbackaction.class.php
plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminupdatecommentaction.class.php
plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminupdatetrackbackaction.class.php
plugins/branches/lifetype-1.2/unported/editcomments/class/view/admineditcommentview.class.php
plugins/branches/lifetype-1.2/unported/editcomments/class/view/adminedittrackbackview.class.php
plugins/branches/lifetype-1.2/unported/editcomments/plugineditcomments.class.php
plugins/branches/lifetype-1.2/unported/editcomments/readme.txt
plugins/branches/lifetype-1.2/unported/editcomments/templates/editcomment.template
plugins/branches/lifetype-1.2/unported/editcomments/templates/edittrackback.template
Log:
ported to 1.2
Modified: plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminedittrackbackaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminedittrackbackaction.class.php 2007-05-11 06:50:06 UTC (rev 5393)
+++ plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminedittrackbackaction.class.php 2007-05-11 07:14:40 UTC (rev 5394)
@@ -13,7 +13,7 @@
}
function perform(){
- $trackbackId = $this->_request->getValue("trackbackId");
+ $trackbackId = $this->_request->getValue("commentId");
$this->_view = new AdminEditTrackbackView($this->_blogInfo, $trackbackId);
Deleted: plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminplugineditcommentsaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminplugineditcommentsaction.class.php 2007-05-11 06:50:06 UTC (rev 5393)
+++ plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminplugineditcommentsaction.class.php 2007-05-11 07:14:40 UTC (rev 5394)
@@ -1,15 +0,0 @@
-<?php
- lt_include( PLOG_CLASS_PATH."plugins/editcomments/class/view/admineditcommentsview.class.php" );
- lt_include( PLOG_CLASS_PATH."class/action/admin/admineditcommentsaction.class.php" );
-
- /**
- * actions that displays the list of comments in the blog.
- */
- class AdminPluginEditCommentsAction extends AdminEditCommentsAction{
- function AdminPluginEditCommentsAction($actionInfo, $request){
- $this->AdminEditCommentsAction($actionInfo, $request);
- $this->_viewClass = "AdminEditCommentsView";
- }
-
- }
-?>
\ No newline at end of file
Deleted: plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminpluginedittrackbacksaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminpluginedittrackbacksaction.class.php 2007-05-11 06:50:06 UTC (rev 5393)
+++ plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminpluginedittrackbacksaction.class.php 2007-05-11 07:14:40 UTC (rev 5394)
@@ -1,17 +0,0 @@
-<?php
- lt_include( PLOG_CLASS_PATH."plugins/editcomments/class/view/adminedittrackbacksview.class.php" );
- lt_include( PLOG_CLASS_PATH."class/action/admin/adminedittrackbacksaction.class.php" );
-
- /**
- * actions that displays the list of trackbacks in the blog.
- */
- class AdminPluginEditTrackbacksAction extends AdminEditTrackbacksAction {
-
- function AdminPluginEditTrackbacksAction ($actionInfo, $request) {
-
- $this->AdminEditCommentsAction($actionInfo, $request);
- $this->_viewClass = "AdminEditTrackbacksView";
- }
-
- }
-?>
\ No newline at end of file
Modified: plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminupdatecommentaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminupdatecommentaction.class.php 2007-05-11 06:50:06 UTC (rev 5393)
+++ plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminupdatecommentaction.class.php 2007-05-11 07:14:40 UTC (rev 5394)
@@ -6,8 +6,8 @@
lt_include( PLOG_CLASS_PATH."class/data/validator/emailvalidator.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/validator/httpurlvalidator.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/validator/usernamevalidator.class.php" );
+lt_include( PLOG_CLASS_PATH."class/view/admin/adminarticlecommentslistview.class.php" );
lt_include( PLOG_CLASS_PATH."plugins/editcomments/class/view/admineditcommentview.class.php" );
-lt_include( PLOG_CLASS_PATH."plugins/editcomments/class/view/admineditcommentsview.class.php" );
lt_include( PLOG_CLASS_PATH."class/view/admin/adminpostslistview.class.php" );
class AdminUpdateCommentAction extends AdminAction{
@@ -38,7 +38,7 @@
$this->_articleId = $this->_request->getValue( "articleId" );
if($this->_op == "updateComment"){
- $view = new AdminEditCommentView($this->_blogInfo, $commentId);
+ $view = new AdminEditCommentView($this->_blogInfo);
$this->registerFieldValidator("commentId", new IntegerValidator());
$this->registerFieldValidator("commentText", new StringValidator());
@@ -130,8 +130,9 @@
$articles = new Articles();
$article = $articles->getBlogArticle($this->_articleId,
$this->_blogInfo->getId());
- $this->_view = new AdminEditCommentsView($this->_blogInfo,
- array("article" => $article));
+ $this->_view = new AdminArticleCommentsListView(
+ $this->_blogInfo,
+ array("article" => $article));
}
else{
$this->_view = new AdminPostsListView( $this->_blogInfo );
@@ -140,7 +141,8 @@
CacheControl::resetBlogCache( $this->_blogInfo->getId());
}
else{
- $this->_view = new AdminEditCommentView($this->_blogInfo, $id);
+ $this->_view = new AdminArticleCommentsListView(
+ $this->_blogInfo);
$this->_view->setErrorMessage( $this->_locale->tr("pluginEditCommentsFailed") );
}
}
@@ -149,7 +151,9 @@
$articles = new Articles();
$article = $articles->getBlogArticle( $this->_articleId, $this->_blogInfo->getId());
- $this->_view = new AdminEditCommentsView($this->_blogInfo, array("article" => $article));
+ $this->_view = new AdminArticleCommentsListView(
+ $this->_blogInfo,
+ array("article" => $article));
$this->_view->setSuccessMessage( $this->_locale->tr("pluginEditCommentsCancelled") );
}
else{
Modified: plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminupdatetrackbackaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminupdatetrackbackaction.class.php 2007-05-11 06:50:06 UTC (rev 5393)
+++ plugins/branches/lifetype-1.2/unported/editcomments/class/action/adminupdatetrackbackaction.class.php 2007-05-11 07:14:40 UTC (rev 5394)
@@ -7,7 +7,7 @@
lt_include( PLOG_CLASS_PATH."class/data/validator/httpurlvalidator.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/validator/usernamevalidator.class.php" );
lt_include( PLOG_CLASS_PATH."plugins/editcomments/class/view/adminedittrackbackview.class.php" );
-lt_include( PLOG_CLASS_PATH."plugins/editcomments/class/view/adminedittrackbacksview.class.php" );
+lt_include( PLOG_CLASS_PATH."class/view/admin/adminarticletrackbackslistview.class.php" );
lt_include( PLOG_CLASS_PATH."class/view/admin/adminpostslistview.class.php" );
class AdminUpdateTrackbackAction extends AdminAction {
@@ -38,11 +38,8 @@
$this->_articleId = $this->_request->getValue( "articleId" );
if($this->_op == "updateTrackback"){
+ $view = new AdminEditTrackbackView($this->_blogInfo);
- // there is actually no trackbackId here, don't know if it's used somewhere else.
- // I'm programming with no clue...
- $view = new AdminEditTrackbackView($this->_blogInfo, $trackbackId);
-
$this->registerFieldValidator("trackbackId", new IntegerValidator());
$this->registerFieldValidator("commentText", new StringValidator());
$this->registerFieldValidator("authorName", new StringValidator());
@@ -131,8 +128,9 @@
$articles = new Articles();
$article = $articles->getBlogArticle($this->_articleId,
$this->_blogInfo->getId());
- $this->_view = new AdminEditTrackbacksView ($this->_blogInfo,
- array("article" => $article));
+ $this->_view = new AdminArticleTrackbacksListView(
+ $this->_blogInfo,
+ array("article" => $article));
}
else {
$this->_view = new AdminPostsListView( $this->_blogInfo );
@@ -141,7 +139,7 @@
CacheControl::resetBlogCache( $this->_blogInfo->getId());
}
else {
- $this->_view = new AdminEditTrackbacksView ($this->_blogInfo, $id);
+ $this->_view = new AdminArticleTrackbacksListView ($this->_blogInfo);
$this->_view->setErrorMessage( $this->_locale->tr("pluginEditTrackbacksFailed") );
}
}
@@ -150,7 +148,9 @@
$articles = new Articles();
$article = $articles->getBlogArticle( $this->_articleId, $this->_blogInfo->getId());
- $this->_view = new AdminEditTrackbacksView ($this->_blogInfo, array("article" => $article));
+ $this->_view = new AdminArticleTrackbacksListView(
+ $this->_blogInfo,
+ array("article" => $article));
$this->_view->setSuccessMessage( $this->_locale->tr("pluginEditTrackbacksCancelled") );
}
else{
Deleted: plugins/branches/lifetype-1.2/unported/editcomments/class/view/admineditcommentsview.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/editcomments/class/view/admineditcommentsview.class.php 2007-05-11 06:50:06 UTC (rev 5393)
+++ plugins/branches/lifetype-1.2/unported/editcomments/class/view/admineditcommentsview.class.php 2007-05-11 07:14:40 UTC (rev 5394)
@@ -1,124 +0,0 @@
-<?php
-
- lt_include( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
- lt_include( PLOG_CLASS_PATH."class/dao/articlecomments.class.php" );
- lt_include( PLOG_CLASS_PATH."class/dao/articlecommentstatus.class.php" );
- lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
- lt_include( PLOG_CLASS_PATH."class/data/pager/pager.class.php" );
-
- class AdminEditCommentsView extends AdminPluginTemplatedView
- {
- var $_article;
- var $_commentStatus;
- var $_page;
-
- function AdminEditCommentsView( $blogInfo, $params = Array() ){
- $this->AdminPluginTemplatedView( $blogInfo, "editcomments", "editcomments" );
- $this->_setParameters( $params );
- $this->_page = $this->getCurrentPageFromRequest();
- }
-
- /**
- * @private
- */
- function _setParameters( $params )
- {
- // fetch the article id
- $this->_article = null;
- if( isset( $params["article"] ))
- $this->_article = $params["article"];
-
- // load the status
- if( isset( $params["showStatus"] ))
- $this->_commentStatus = $params["showStatus"];
-
- if( !ArticleCommentStatus::isValidStatus( $this->_commentStatus ))
- $this->_commentStatus = COMMENT_STATUS_ALL;
-
- // laod the search terms
- $this->_searchTerms = "";
- if( isset( $params["searchTerms"] ))
- $this->_searchTerms = $params["searchTerms"];
- }
-
- /**
- * show the contents of the view
- */
- function render()
- {
- // load the comments and throw the correct event
- $comments = new CommentsCommon();
- if( $this->_article ) {
- // id of the article, for the pager...
- $articleId = $this->_article->getId();
-
- // load only the comments of the given post
- $postComments = $comments->getPostComments( $articleId,
- COMMENT_ORDER_NEWEST_FIRST,
- $this->_commentStatus,
- COMMENT_TYPE_COMMENT,
- $this->_page,
- DEFAULT_ITEMS_PER_PAGE );
- // number of comments
- $numPostComments = $comments->getNumPostComments( $articleId,
- $this->_commentStatus,
- COMMENT_TYPE_COMMENT );
- }
- else {
- // load all comments given the current status
- $postComments = $comments->getBlogComments( $this->_blogInfo->getId(),
- COMMENT_ORDER_NEWEST_FIRST,
- $this->_commentStatus,
- COMMENT_TYPE_COMMENT,
- $this->_searchTerms,
- $this->_page,
- DEFAULT_ITEMS_PER_PAGE );
- // number of comments
- $numPostComments = $comments->getNumBlogComments( $this->_blogInfo->getId(),
- $this->_commentStatus,
- COMMENT_TYPE_COMMENT,
- $this->_searchTerms );
- // no article id...
- $articleId = 0;
- }
- $this->notifyEvent( EVENT_COMMENTS_LOADED, Array( "comments", &$postComments ));
-
- $pagerUrl = "?op=editComments";
-
- if( $this->_commentStatus > -1 ){
- $pagerUrl .= "&articleId={$articleId}&showStatus=".
- $this->_commentStatus."&searchTerms=".
- $this->_searchTerms."&page=";
- }
- else{
- $pagerUrl .= "&articleId={$articleId}&searchTerms=".
- $this->_searchTerms."&page=";
- }
- // calculate the pager url
- $pager = new Pager( $pagerUrl,
- $this->_page,
- $numPostComments,
- DEFAULT_ITEMS_PER_PAGE );
-
- // get a list with all the different comment status
- $statusList = ArticleCommentStatus::getStatusList( true );
- $statusListWithoutAll = ArticleCommentStatus::getStatusList( false );
-
- // and pass all the information to the templates
- $this->setValue( "comments", $postComments);
- $this->setValue( "commentstatus", $statusList );
- $this->setValue( "commentstatusWithoutAll", $statusListWithoutAll );
- $this->setValue( "currentstatus", $this->_commentStatus );
- $this->setValue( "searchTerms", $this->_searchTerms );
-
- // pass the pager to the view
- $this->setValue( "pager", $pager );+
-
- // pass the common data to the templates
- $this->setValue( "post", $this->_article );
-
- parent::render();
- }
-
- }
-?>
\ No newline at end of file
Modified: plugins/branches/lifetype-1.2/unported/editcomments/class/view/admineditcommentview.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/editcomments/class/view/admineditcommentview.class.php 2007-05-11 06:50:06 UTC (rev 5393)
+++ plugins/branches/lifetype-1.2/unported/editcomments/class/view/admineditcommentview.class.php 2007-05-11 07:14:40 UTC (rev 5394)
@@ -7,7 +7,7 @@
{
var $_commentId;
- function AdminEditCommentView($blogInfo, $commentId){
+ function AdminEditCommentView($blogInfo, $commentId=0){
$this->_commentId = $commentId;
$this->AdminPluginTemplatedView( $blogInfo, "editcomments", "editcomment" );
}
@@ -18,12 +18,10 @@
$comment = $articleComments->getComment($this->_commentId);
if($comment){
- $commentDate = $comment->getDateObject();
- $this->setValue( "commentYear", $commentDate->getYear());
- $this->setValue( "commentMonth", $commentDate->getMonth());
- $this->setValue( "commentDay", $commentDate->getDay());
- $this->setValue( "commentHour", $commentDate->getHour());
- $this->setValue( "commentMinutes", $commentDate->getMinutes());
+ $t = $comment->getDateObject();
+ $this->setValue( "commentDateTime", $t->getDay()."/".
+ $t->getMonth()."/".$t->getYear()." ".
+ $t->getHour().":".$t->getMinutes());
}
$statusList = ArticleCommentStatus::getStatusList();
Deleted: plugins/branches/lifetype-1.2/unported/editcomments/class/view/adminedittrackbacksview.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/editcomments/class/view/adminedittrackbacksview.class.php 2007-05-11 06:50:06 UTC (rev 5393)
+++ plugins/branches/lifetype-1.2/unported/editcomments/class/view/adminedittrackbacksview.class.php 2007-05-11 07:14:40 UTC (rev 5394)
@@ -1,124 +0,0 @@
-<?php
-
- lt_include( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
- lt_include( PLOG_CLASS_PATH."class/dao/trackbacks.class.php" );
- lt_include( PLOG_CLASS_PATH."class/dao/articlecommentstatus.class.php" );
- lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
- lt_include( PLOG_CLASS_PATH."class/data/pager/pager.class.php" );
-
- class AdminEditTrackbacksView extends AdminPluginTemplatedView
- {
- var $_article;
- var $_commentStatus;
- var $_page;
- var $_type;
-
- function AdminEditTrackbacksView ( $blogInfo, $params = Array() ){
- $this->AdminPluginTemplatedView( $blogInfo, "editcomments", "edittrackbacks" );
- $this->_setParameters( $params );
- $this->_page = $this->getCurrentPageFromRequest();
- $this->_type = COMMENT_TYPE_TRACKBACK;
- }
-
- /**
- * @private
- */
- function _setParameters( $params )
- {
- // fetch the article id
- $this->_article = null;
- if( isset( $params["article"] ))
- $this->_article = $params["article"];
-
- // load the status
- if( isset( $params["showStatus"] ))
- $this->_commentStatus = $params["showStatus"];
-
- if( !ArticleCommentStatus::isValidStatus( $this->_commentStatus ))
- $this->_commentStatus = COMMENT_STATUS_ALL;
-
- // laod the search terms
- $this->_searchTerms = "";
- if( isset( $params["searchTerms"] ))
- $this->_searchTerms = $params["searchTerms"];
- }
-
- /**
- * show the contents of the view
- */
- function render()
- {
- // load the comments and throw the correct event
- $comments = new CommentsCommon();
- if( $this->_article ) {
- // load only the comments of the given post
- $postComments = $comments->getPostComments( $this->_article->getId(),
- COMMENT_ORDER_NEWEST_FIRST,
- $this->_commentStatus,
- $this->_type,
- $this->_page,
- DEFAULT_ITEMS_PER_PAGE );
- // number of comments
- $numPostComments = $comments->getNumPostComments( $this->_article->getId(),
- $this->_commentStatus,
- $this->_type );
- // id of the article, for the pager...
- $articleId = $this->_article->getId();
- }
- else {
- // load all comments given the current status
- $postComments = $comments->getBlogComments( $this->_blogInfo->getId(),
- COMMENT_ORDER_NEWEST_FIRST,
- $this->_commentStatus,
- $this->_type,
- $this->_searchTerms,
- $this->_page,
- DEFAULT_ITEMS_PER_PAGE );
- // number of comments
- $numPostComments = $comments->getNumBlogComments( $this->_blogInfo->getId(),
- $this->_commentStatus,
- $this->_type,
- $this->_searchTerms );
- // no article id...
- $articleId = 0;
- }
- $this->notifyEvent( EVENT_COMMENTS_LOADED, Array( "comments", &$postComments ));
-
- if( $this->_type == COMMENT_TYPE_COMMENT )
- $pagerUrl = "?op=editComments";
- else
- $pagerUrl = "?op=editTrackbacks";
-
- if( $this->_commentStatus > -1 )
- $pagerUrl .= "&articleId={$articleId}&showStatus=".$this->_commentStatus."&searchTerms=".$this->_searchTerms."&page=";
- else
- $pagerUrl .= "&articleId={$articleId}&searchTerms=".$this->_searchTerms."&page=";
-
- // calculate the pager url
- $pager = new Pager( $pagerUrl,
- $this->_page,
- $numPostComments,
- DEFAULT_ITEMS_PER_PAGE );
-
- // get a list with all the different comment status
- $statusList = ArticleCommentStatus::getStatusList( true );
- $statusListWithoutAll = ArticleCommentStatus::getStatusList( false );
-
- // and pass all the information to the templates
- $this->setValue( "comments", $postComments);
- $this->setValue( "commentstatus", $statusList );
- $this->setValue( "commentstatusWithoutAll", $statusListWithoutAll );
- $this->setValue( "currentstatus", $this->_commentStatus );
- $this->setValue( "searchTerms", $this->_searchTerms );
-
- // pass the pager to the view
- $this->setValue( "pager", $pager );+
-
- // pass the common data to the templates
- $this->setValue( "post", $this->_article );
-
- parent::render();
- }
-
- }
-?>
\ No newline at end of file
Modified: plugins/branches/lifetype-1.2/unported/editcomments/class/view/adminedittrackbackview.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/editcomments/class/view/adminedittrackbackview.class.php 2007-05-11 06:50:06 UTC (rev 5393)
+++ plugins/branches/lifetype-1.2/unported/editcomments/class/view/adminedittrackbackview.class.php 2007-05-11 07:14:40 UTC (rev 5394)
@@ -7,7 +7,7 @@
{
var $_trackbackId;
- function AdminEditTrackbackView($blogInfo, $trackbackId){
+ function AdminEditTrackbackView($blogInfo, $trackbackId=0){
$this->_trackbackId = $trackbackId;
$this->AdminPluginTemplatedView( $blogInfo, "editcomments", "edittrackback" );
}
@@ -18,12 +18,10 @@
$tb = $trackbacks->getTrackBack($this->_trackbackId);
if($tb){
- $tbDate = $tb->getDateObject();
- $this->setValue( "tbYear", $tbDate->getYear());
- $this->setValue( "tbMonth", $tbDate->getMonth());
- $this->setValue( "tbDay", $tbDate->getDay());
- $this->setValue( "tbHour", $tbDate->getHour());
- $this->setValue( "tbMinutes", $tbDate->getMinutes());
+ $t = $tb->getDateObject();
+ $this->setValue( "commentDateTime", $t->getDay()."/".
+ $t->getMonth()."/".$t->getYear()." ".
+ $t->getHour().":".$t->getMinutes());
}
$statusList = ArticleCommentStatus::getStatusList();
Modified: plugins/branches/lifetype-1.2/unported/editcomments/plugineditcomments.class.php
===================================================================
--- plugins/branches/lifetype-1.2/unported/editcomments/plugineditcomments.class.php 2007-05-11 06:50:06 UTC (rev 5393)
+++ plugins/branches/lifetype-1.2/unported/editcomments/plugineditcomments.class.php 2007-05-11 07:14:40 UTC (rev 5394)
@@ -3,25 +3,25 @@
class PluginEditComments extends PluginBase{
- function PluginEditComments(){
- $this->PluginBase();
+ function PluginEditComments($source = ""){
+ $this->PluginBase($source);
$this->id = "editcomments";
$this->desc = "Allows blog owner to edit comment text";
$this->author = "Jon Daley";
$this->locales = Array( "en_UK" );
-
- $this->init();
+ $this->version = "20070511";
+
+ if($source == "admin")
+ $this->initAdmin();
}
/**
* registers all of the actions that we're going to use
*/
- function init(){
- // Override(!) the default editComments action. Cool
- $this->registerAdminAction( "editComments", "AdminPluginEditCommentsAction" );
- $this->registerAdminAction( "editTrackbacks", "AdminPluginEditTrackbacksAction" );
-
+ function initAdmin(){
+ $this->registerNotification( EVENT_PROCESS_BLOG_ADMIN_TEMPLATE_OUTPUT );
+
// Here are our additional features that we are adding to the regular
// comment adding
$this->registerAdminAction( "editComment", "AdminEditCommentAction" );
@@ -30,5 +30,58 @@
$this->registerAdminAction( "editTrackback", "AdminEditTrackbackAction" );
$this->registerAdminAction( "updateTrackback", "AdminUpdateTrackbackAction" );
}
- }
+
+ function process($event, $params){
+ // only process our expected event
+ if($event != EVENT_PROCESS_BLOG_ADMIN_TEMPLATE_OUTPUT)
+ return;
+
+ // only process the editcomments and edittrackbacks template
+ if($params["template"] == "editcomments")
+ $action = "editComment";
+ else if($params["template"] == "edittrackbacks")
+ $action = "editTrackback";
+ else
+ return;
+
+ // load the current contents of the template
+ $content = $params["content"];
+ $regexp = "/<div class=\"list_action_button\">.*?<\/div>/s";
+ preg_match_all($regexp, $content, $matches, PREG_SET_ORDER);
+
+ // now process each one of the matches and do the replacements
+ foreach($matches as $match){
+ if($action == "editTrackback"){
+ // fetch the trackback id
+ $res = preg_match(
+ "/<a href=\"\?op=deleteTrackback&articleId=[0-9]+&trackbackId=([0-9]+)\"/i",
+ $match[0], $result);
+ }
+ else if($action == "editComment"){
+ // fetch the comment id
+ $res = preg_match(
+ "/<a href=\"\?op=deleteComment&commentId=([0-9]+)&/i",
+ $match[0], $result);
+ }
+
+
+ if($res){
+ // regenerate the block, adding the new markup
+ $artId = $result[1];
+ $toAdd = "<a href='?op=$action&commentId={$artId}'>".
+ "<img src='imgs/admin/icon_edit-16.png' " .
+ "alt='{\$locale->tr('edit')}' /></a></div>";
+ $newStr = str_replace( "</div>", $toAdd, $match[0] );
+ // and now replace the old block with the new one in the global $content variable
+ $content = str_replace( $match[0], $newStr, $content );
+ }
+ else{
+ print "couldn't find id";
+ }
+ }
+
+ $params["content"] = $content;
+ }
+
+ }
?>
\ No newline at end of file
Modified: plugins/branches/lifetype-1.2/unported/editcomments/readme.txt
===================================================================
--- plugins/branches/lifetype-1.2/unported/editcomments/readme.txt 2007-05-11 06:50:06 UTC (rev 5393)
+++ plugins/branches/lifetype-1.2/unported/editcomments/readme.txt 2007-05-11 07:14:40 UTC (rev 5394)
@@ -1,7 +1,6 @@
Plugin: EditComments
Author: Jon Daley
Release Date: 2006/12/03
-Version: 1.2
This plugin allows the blog owner to edit comments and trackbacks
via the administration interface to fix typos, etc.
@@ -17,4 +16,4 @@
3. Click that button, and you should be able to see the topic, text,
username, url, etc. to manually edit.
-(editing trackbacks works exactly the same way)
\ No newline at end of file
+(editing trackbacks works exactly the same way)
Modified: plugins/branches/lifetype-1.2/unported/editcomments/templates/editcomment.template
===================================================================
--- plugins/branches/lifetype-1.2/unported/editcomments/templates/editcomment.template 2007-05-11 06:50:06 UTC (rev 5393)
+++ plugins/branches/lifetype-1.2/unported/editcomments/templates/editcomment.template 2007-05-11 07:14:40 UTC (rev 5394)
@@ -1,6 +1,13 @@
{include file="$admintemplatepath/header.template"}
{include file="$admintemplatepath/navigation.template" showOpt=editComments title=$locale->tr("pluginEditCommentsEdit")}
-<script type="text/javascript" src="js/calendar/datetimepicker.js"></script>
+<link rel="stylesheet" type="text/css" media="all"
+ href="js/jscalendar/calendar-win2k-cold-1.css" title="win2k-cold-1" />
+ <script type="text/javascript"
+ src="js/jscalendar/calendar_stripped.js"></script>
+ <script type="text/javascript"
+ src="js/jscalendar/lang/calendar-en.js"></script>
+ <script type="text/javascript"
+ src="js/jscalendar/calendar-setup_stripped.js"></script>
<form id="editComment" action="admin.php" method="post">
<div id="list">
@@ -36,14 +43,28 @@
<tr>
<th>{$locale->tr("date")}</th>
<td>
- {$locale->tr("pluginEditCommentsDateFormat")}<br/>
- <input name="commentDateTime" id="commentDateTime" class="dateTime"
- readonly="true" type="text" size="20"
- value="{$commentDay}/{$commentMonth}/{$commentYear} {$commentHour}:{$commentMinutes}" />
- <a href="javascript:NewCal('commentDateTime','ddmmyyyy',true,24);">
- <img src="imgs/admin/cal.jpg"
- alt="{$locale->tr("pick_date")}"
- style="border:0px" /></a>
+ <input name="commentDateTime" id="commentDateTime" class="dateTime"
+ readonly="true" type="text" size="16" value="{$commentDateTime}"
+ style="margin-bottom: 4px;" />
+ <img src="imgs/admin/cal.jpg" id="commentDateTimeSelector"
+ alt="{$locale->tr("date")}" style="cursor: pointer; border: 0px;
+ width: 16px; height: 14px; padding: 0;" />
+ <script type="text/javascript">
+ var MondayFirstDay = ( {$locale->firstDayOfWeek()} == 1);
+ {literal}
+ Calendar.setup({
+ inputField : "commentDateTime",
+ ifFormat : "%d/%m/%Y %H:%M",
+ button : "commentDateTimeSelector",
+ showsTime : true,
+ timeFormat : "24",
+ electric : false,
+ align : "Bl",
+ firstDay : MondayFirstDay,
+ singleClick : true
+ });
+ {/literal}
+ </script>
</td>
</tr>
<tr>
Deleted: plugins/branches/lifetype-1.2/unported/editcomments/templates/editcomments.template
===================================================================
--- plugins/branches/lifetype-1.2/unported/editcomments/templates/editcomments.template 2007-05-11 06:50:06 UTC (rev 5393)
+++ plugins/branches/lifetype-1.2/unported/editcomments/templates/editcomments.template 2007-05-11 07:14:40 UTC (rev 5394)
@@ -1,142 +0,0 @@
-{include file="$admintemplatepath/header.template"}
-{include file="$admintemplatepath/navigation.template" showOpt=editComments title=$locale->tr("editComments")}
- <script type="text/javascript" src="js/ui/plogui.js"></script>
- <script type="text/javascript">
- var errorCommentStatusMsg = '{$locale->tr("error_comment_status")}';
- var showMassiveChangeOption = '{$locale->tr("show_massive_change_option")}';
- var hideMassiveChangeOption = '{$locale->tr("hide_massive_change_option")}';
- </script>
- <div id="list_nav_bar">
- <div id="list_nav_select">
-
- <form id="showBy" action="admin.php" method="post">
- <fieldset>
- <legend>{$locale->tr("show_by")} {if $post}({$post->getTopic()}){/if}</legend>
-
- <div class="list_nav_option">
- <label for="showStatus">{$locale->tr("status")}</label>
- <br />
- <select name="showStatus" id="showStatus">
- {foreach from=$commentstatus key=name item=status}
- <option value="{$status}" {if $currentstatus == $status} selected="selected"{/if}>{$locale->tr($name)}</option>
- {/foreach}
- </select>
- </div>
-
- <div class="list_nav_option">
- <label for="search">{$locale->tr("search_terms")}</label>
- <br />
- <input type="text" name="searchTerms" value="{$searchTerms}" size="15" id="search" />
- </div>
-
- <div class="list_nav_option">
- <br />
- <input type="hidden" name="op" value="editComments" />
- <input type="hidden" name="articleId" value="{if $post}{$post->getId()}{else}0{/if}" />
- <input type="submit" name="show" value="{$locale->tr("show")}" class="submit" />
- </div>
- </fieldset>
- </form>
- </div>
- <br style="clear:both;" />
- </div>
-
- <form id="postCommentsList" action="admin.php" method="post">
- <div class="optionIcon">
- <a id="optionIconLink" href="#bulkEdit" title="{$locale->tr("show_massive_change_option")}" onclick="switchMassiveOption()">{$locale->tr("show_massive_change_option")}</a>
- </div>
- <div id="list">
- {include file="$admintemplatepath/successmessage.template"}
- {include file="$admintemplatepath/errormessage.template"}
- <table class="info">
- <thead>
- <tr>
- <th style="width:10px;"><input class="checkbox" type="checkbox" name="all" id="all" value="1" onclick="toggleAllChecks('postCommentsList');" /></th>
- <th style="width:85px;">{$locale->tr("topic")}</th>
- <th style="width:360px;">{$locale->tr("text")}</th>
- <th style="width:70px;">{$locale->tr("author")}</th>
- <th style="width:60px;">{$locale->tr("date")}</th>
- <th style="width:60px;">{$locale->tr("status")}</th>
- <th style="width:45px;">IP</th>
- <th style="width:95px;">{$locale->tr("actions")}</th>
- </tr>
- </thead>
- <tbody>
- {foreach from=$comments item=comment}
- <tr class="{cycle values="odd, even"}">
- <td>
- <input class="checkbox" type="checkbox" name="commentIds[{$comment->getId()}]" id="checks_{$comment->getId()}" value="{$comment->getId()}" />
- </td>
- <td class="col_highlighted">
- {$comment->getTopic()|strip_tags|utf8_wordwrap:12:"<br/>":true}
- </td>
- <td>
- {$comment->getText()|strip_tags|utf8_wordwrap:35:"<br/>":true}
- </td>
- <td>
- <a href="mailto:{$comment->getUserEmail()}">
- {$comment->getUsername()}
- </a>
- </td>
- <td>
- {assign var=date value=$comment->getDateObject()}
- {$locale->formatDate($date)}
- </td>
- <td>
- {foreach from=$commentstatus key=name item=status}
- {if $comment->getStatus() == $status}{$locale->tr($name)}{/if}
- {/foreach}
- </td>
- <td style="text-align: center;">
- {$comment->getClientIp()}
- </td>
- <td>
- <div class="list_action_button">
- <a href="?op=deleteComment&commentId={$comment->getId()}&articleId={if $post}{$post->getId()}{else}0{/if}" title="{$locale->tr("delete")}">
- <img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" />
- </a>
- {if $comment->getStatus() == 0}
- <a href="?op=markComment&mode=1&articleId={if $post}{$comment->getArticleId()}{else}0{/if}&commentId={$comment->getId()}" title="{$locale->tr("mark_as_spam")}">
- <img src="imgs/admin/icon_spam-16.png" alt="{$locale->tr("mark_as_spam")}" />
- </a>
- {elseif $comment->getStatus() == 1}
- <a href="?op=markComment&mode=0&articleId={if $post}{$comment->getArticleId()}{else}0{/if}&commentId={$comment->getId()}" title="{$locale->tr("mark_as_no_spam")}">
- <img src="imgs/admin/icon_nospam-16.png" alt="{$locale->tr("mark_as_no_spam")}" />
- </a>
- {/if}
- {if $comment->getUserUrl()}
- <a href="{$comment->getUserUrl()}" title="{$locale->tr("url")}">
- <img src="imgs/admin/icon_url-16.png" alt="{$locale->tr("url")}" />
- </a>
- {/if}
- <a href="?op=editComment&commentId={$comment->getId()}"><img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" /></a>
- </div>
- </td>
- </tr>
- {/foreach}
- </tbody>
- </table>
- </div>
- <a name="bulkEdit"></a>
- <div id="list_action_bar">
- {adminpager style=list}
- <input type="hidden" name="articleId" value="{if $post}{$post->getId()}{else}0{/if}" />
- <input type="button" name="delete" value="{$locale->tr("delete")}" class="submit" onClick="javascript:submitCommentsList('deleteComments');" />
- <input type="hidden" name="op" value="" />
- <div id="massiveChangeOption" style="display: none">
- <fieldset>
- <legend>{$locale->tr("massive_change_option")}</legend>
- <label for="commentStatus">{$locale->tr("status")}</label>
- <select name="commentStatus" id="commentStatus">
- <option value="-1">-{$locale->tr("select")}-</option>
- {foreach from=$commentstatusWithoutAll key=name item=status}
- <option value="{$status}">{$locale->tr($name)}</option>
- {/foreach}
- </select>
- <input type="button" name="changeCommentsStatus" value="{$locale->tr("change_status")}" class="submit" onClick="javascript:submitCommentsList('changeCommentsStatus');" />
- </fieldset>
- </div>
- </div>
- </form>
-{include file="$admintemplatepath/footernavigation.template"}
-{include file="$admintemplatepath/footer.template"}
Modified: plugins/branches/lifetype-1.2/unported/editcomments/templates/edittrackback.template
===================================================================
--- plugins/branches/lifetype-1.2/unported/editcomments/templates/edittrackback.template 2007-05-11 06:50:06 UTC (rev 5393)
+++ plugins/branches/lifetype-1.2/unported/editcomments/templates/edittrackback.template 2007-05-11 07:14:40 UTC (rev 5394)
@@ -1,6 +1,13 @@
{include file="$admintemplatepath/header.template"}
{include file="$admintemplatepath/navigation.template" showOpt=editTrackbacks title=$locale->tr("pluginEditTrackbacksEdit")}
-<script type="text/javascript" src="js/calendar/datetimepicker.js"></script>
+<link rel="stylesheet" type="text/css" media="all"
+ href="js/jscalendar/calendar-win2k-cold-1.css" title="win2k-cold-1" />
+ <script type="text/javascript"
+ src="js/jscalendar/calendar_stripped.js"></script>
+ <script type="text/javascript"
+ src="js/jscalendar/lang/calendar-en.js"></script>
+ <script type="text/javascript"
+ src="js/jscalendar/calendar-setup_stripped.js"></script>
<form id="editComment" action="admin.php" method="post">
<div id="list">
@@ -36,14 +43,28 @@
<tr>
<th>{$locale->tr("date")}</th>
<td>
- {$locale->tr("pluginEditCommentsDateFormat")}<br/>
- <input name="commentDateTime" id="commentDateTime" class="dateTime"
- readonly="true" type="text" size="20"
- value="{$tbDay}/{$tbMonth}/{$tbYear} {$tbHour}:{$tbMinutes}" />
- <a href="javascript:NewCal('commentDateTime','ddmmyyyy',true,24);">
- <img src="imgs/admin/cal.jpg"
- alt="{$locale->tr("pick_date")}"
- style="border:0px" /></a>
+ <input name="commentDateTime" id="commentDateTime" class="dateTime"
+ readonly="true" type="text" size="16" value="{$commentDateTime}"
+ style="margin-bottom: 4px;" />
+ <img src="imgs/admin/cal.jpg" id="commentDateTimeSelector"
+ alt="{$locale->tr("date")}" style="cursor: pointer; border: 0px;
+ width: 16px; height: 14px; padding: 0;" />
+ <script type="text/javascript">
+ var MondayFirstDay = ( {$locale->firstDayOfWeek()} == 1);
+ {literal}
+ Calendar.setup({
+ inputField : "commentDateTime",
+ ifFormat : "%d/%m/%Y %H:%M",
+ button : "commentDateTimeSelector",
+ showsTime : true,
+ timeFormat : "24",
+ electric : false,
+ align : "Bl",
+ firstDay : MondayFirstDay,
+ singleClick : true
+ });
+ {/literal}
+ </script>
</td>
</tr>
<tr>
Deleted: plugins/branches/lifetype-1.2/unported/editcomments/templates/edittrackbacks.template
===================================================================
--- plugins/branches/lifetype-1.2/unported/editcomments/templates/edittrackbacks.template 2007-05-11 06:50:06 UTC (rev 5393)
+++ plugins/branches/lifetype-1.2/unported/editcomments/templates/edittrackbacks.template 2007-05-11 07:14:40 UTC (rev 5394)
@@ -1,144 +0,0 @@
-{include file="$admintemplatepath/header.template"}
-{include file="$admintemplatepath/navigation.template" showOpt=editTrackbacks title=$locale->tr("editTrackbacks")}
- <script type="text/javascript" src="js/ui/plogui.js"></script>
- <script type="text/javascript">
- var errorTrackbackStatusMsg = '{$locale->tr("error_trackback_status")}';
- var showMassiveChangeOption = '{$locale->tr("show_massive_change_option")}';
- var hideMassiveChangeOption = '{$locale->tr("hide_massive_change_option")}';
- </script>
- <div id="list_nav_bar">
- <div id="list_nav_select">
-
- <form id="showBy" action="admin.php" method="post">
- <fieldset>
- <legend>{$locale->tr("show_by")} {if $post}( {$post->getTopic()} ){/if}</legend>
-
- <div class="list_nav_option">
- <label for="showStatus">{$locale->tr("status")}</label>
- <br />
- <select name="showStatus" id="showStatus">
- {foreach from=$commentstatus key=name item=status}
- <option value="{$status}" {if $currentstatus == $status} selected="selected"{/if}>{$locale->tr($name)}</option>
- {/foreach}
- </select>
- </div>
-
- <div class="list_nav_option">
- <label for="search">{$locale->tr("search_terms")}</label>
- <br />
- <input type="text" name="searchTerms" value="{$searchTerms}" size="15" id="search" />
- </div>
-
- <div class="list_nav_option">
- <br />
- <input type="hidden" name="op" value="editTrackbacks" />
- {if $post}<input type="hidden" name="articleId" value="{$post->getId()}" />{/if}
- <input type="submit" name="show" value="{$locale->tr("show")}" class="submit" />
- </div>
-
- </fieldset>
- </form>
- </div>
- <br style="clear:both;" />
- </div>
-
- <form id="postTrackbacksList" action="admin.php" method="post">
- <div class="optionIcon">
- <a id="optionIconLink" href="#bulkEdit" title="{$locale->tr("show_massive_change_option")}" onclick="switchMassiveOption()">{$locale->tr("show_massive_change_option")}</a>
- </div>
- <div id="list">
- {include file="$admintemplatepath/successmessage.template"}
- {include file="$admintemplatepath/errormessage.template"}
- <table class="info">
- <thead>
- <tr>
- <th style="width:10px;"><input class="checkbox" type="checkbox" name="all" id="all" value="1" onclick="toggleAllChecks('postTrackbacksList');" /></th>
- <th style="width:85px;">{$locale->tr("topic")}</th>
- <th style="width:360px;">{$locale->tr("text")}</th>
- <th style="width:70px;">{$locale->tr("author")}</th>
- <th style="width:60px;">{$locale->tr("date")}</th>
- <th style="width:60px;">{$locale->tr("status")}</th>
- <th style="width:45px;">IP</th>
- <th style="width:95px;">{$locale->tr("actions")}</th>
- </tr>
- </thead>
- <tbody>
- {foreach from=$comments item=trackback}
- <tr class="{cycle values="odd,even"}">
- <td>
- <input class="checkbox" type="checkbox" name="trackbackIds[{$trackback->getId()}]" id="trackbackIds[{$trackback->getId()}]" value="{$trackback->getId()}" />
- </td>
- <td class="col_highlighted">
- {$trackback->getTopic()|strip_tags|utf8_wordwrap:12:"<br/>":true}
- </td>
- <td>
- {$trackback->getText()|strip_tags|utf8_wordwrap:35:"<br/>":true}
- </td>
- <td>
- <a href="{$trackback->getUserUrl()}">{$trackback->getUserName()}</a>
- </td>
- <td>
- {assign var=date value=$trackback->getDateObject()}
- {$locale->formatDate($date)}
- </td>
- <td>
- {foreach from=$commentstatus key=name item=status}
- {if $trackback->getStatus() == $status}{$locale->tr($name)}{/if}
- {/foreach}
- </td>
- <td style="text-align: center;">
- {$trackback->getClientIp()}
- </td>
- <td>
- <div class="list_action_button">
- <a href="?op=deleteTrackback&articleId={if $post}{$post->getId()}{else}0{/if}&trackbackId={$trackback->getId()}" title="{$locale->tr("delete_trackback")}">
- <img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete_trackback")}" />
- </a>
- {if $bayesian_filter_enabled}
- {if $trackback->getStatus() == 0}
- <a href="?op=markTrackback&mode=1&articleId={if $post}{$post->getId()}{else}0{/if}&trackbackId={$trackback->getId()}" title="{$locale->tr("mark_as_spam")}">
- <img src="imgs/admin/icon_spam-16.png" alt="{$locale->tr("mark_as_spam")}" />
- </a>
- {elseif $trackback->getStatus() == 1}
- <a href="?op=markTrackback&mode=0&articleId={if $post}{$post->getId()}{else}0{/if}&trackbackId={$trackback->getId()}" title="{$locale->tr("mark_as_no_spam")}">
- <img src="imgs/admin/icon_nospam-16.png" alt="{$locale->tr("mark_as_no_spam")}" />
- </a>
- {/if}
- {/if}
- {if $trackback->getUserUrl()}
- <a href="{$trackback->getUserUrl()}" title="{$locale->tr("url")}">
- <img src="imgs/admin/icon_url-16.png" alt="{$locale->tr("url")}" />
- </a>
- {/if}
- <a href="?op=editTrackback&trackbackId={$trackback->getId()}"><img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" /></a>
- </div>
- </td>
- </tr>
- {/foreach}
- </tbody>
- </table>
- </div>
- <a name="bulkEdit"></a>
- <div id="list_action_bar">
- {adminpager style=list}
- <input type="hidden" name="articleId" value="{if $post}{$post->getId()}{else}0{/if}" />
- <input type="button" name="delete" value="{$locale->tr("delete")}" class="submit" onClick="javascript:submitTrackbacksList('deleteTrackbacks');" />
- <input type="hidden" name="op" value="" />
- <div id="massiveChangeOption" style="display: none;">
- <fieldset>
- <legend>{$locale->tr("massive_change_option")}</legend>
- <label for="trackbackStatus">{$locale->tr("status")}</label>
- <select name="trackbackStatus" id="trackbackStatus">
- <option value="-1">-{$locale->tr("select")}-</option>
- {foreach from=$commentstatusWithoutAll key=name item=status}
- {if ($status != 0 && $status != 1) || $bayesian_filter_enabled}<option value="{$status}">{$locale->tr($name)}</option>{/if}
- {/foreach}
- </select>
- <input type="button" name="changeTrackbacksStatus" value="{$locale->tr("change_status")}" class="submit" onClick="javascript:submitTrackbacksList('changeTrackbacksStatus');" />
- </fieldset>
- </div>
- </div>
-
- </form>
-{include file="$admintemplatepath/footernavigation.template"}
-{include file="$admintemplatepath/footer.template"}
\ No newline at end of file
More information about the pLog-svn
mailing list