[pLog-svn] r5853 - in plugins/branches/lifetype-1.2/recentcomments: . class/action class/view locale templates

Jon Daley plogworld at jon.limedaley.com
Wed Aug 22 08:54:11 EDT 2007


 	What do you think Mark?  I think this was a good compromise for 
everyone.

On Wed, 22 Aug 2007, jondaley at devel.lifetype.net wrote:

> Author: jondaley
> Date: 2007-08-22 08:22:04 -0400 (Wed, 22 Aug 2007)
> New Revision: 5853
>
> Modified:
>   plugins/branches/lifetype-1.2/recentcomments/class/action/pluginrecentcommentsupdateconfigaction.class.php
>   plugins/branches/lifetype-1.2/recentcomments/class/view/pluginrecentcommentsconfigview.class.php
>   plugins/branches/lifetype-1.2/recentcomments/class/view/pluginrecentcommentsrssview.class.php
>   plugins/branches/lifetype-1.2/recentcomments/locale/locale_en_UK.php
>   plugins/branches/lifetype-1.2/recentcomments/pluginrecentcomments.class.php
>   plugins/branches/lifetype-1.2/recentcomments/templates/recentcomments.template
> Log:
> added trackback option as talked about in early July on the svn list subject: 'recent comments plugin change: rev 5277'
>
> Modified: plugins/branches/lifetype-1.2/recentcomments/class/action/pluginrecentcommentsupdateconfigaction.class.php
> ===================================================================
> --- plugins/branches/lifetype-1.2/recentcomments/class/action/pluginrecentcommentsupdateconfigaction.class.php	2007-08-21 20:24:42 UTC (rev 5852)
> +++ plugins/branches/lifetype-1.2/recentcomments/class/action/pluginrecentcommentsupdateconfigaction.class.php	2007-08-22 12:22:04 UTC (rev 5853)
> @@ -12,6 +12,8 @@
> 	{
> 		var $_pluginEnabled;
> 		var $_maxComments;
> +		var $_includeComments;
> +		var $_includeTrackbacks;
>
> 		function PluginRecentCommentsUpdateConfigAction( $actionInfo, $request )
> 		{
> @@ -31,6 +33,10 @@
>
>                 return false;
>             }
> +            $this->_includeComments = $this->_request->getValue( "includeComments" );
> +            $this->_includeComments = ($this->_includeComments != "" );
> +            $this->_includeTrackbacks = $this->_request->getValue( "includeTrackbacks" );
> +            $this->_includeTrackbacks = ($this->_includeTrackbacks != "" );
>
> 			return true;
> 		}
> @@ -41,6 +47,8 @@
> 			$blogSettings = $this->_blogInfo->getSettings();
>             $blogSettings->setValue( "plugin_recentcomments_enabled", $this->_pluginEnabled );
>             $blogSettings->setValue( "plugin_recentcomments_maxcomments", $this->_maxComments );
> +            $blogSettings->setValue( "plugin_recentcomments_include_comments", $this->_includeComments );
> +            $blogSettings->setValue( "plugin_recentcomments_include_trackbacks", $this->_includeTrackbacks );
>             $this->_blogInfo->setSettings( $blogSettings );
>
> 			// save the blogs settings
>
> Modified: plugins/branches/lifetype-1.2/recentcomments/class/view/pluginrecentcommentsconfigview.class.php
> ===================================================================
> --- plugins/branches/lifetype-1.2/recentcomments/class/view/pluginrecentcommentsconfigview.class.php	2007-08-21 20:24:42 UTC (rev 5852)
> +++ plugins/branches/lifetype-1.2/recentcomments/class/view/pluginrecentcommentsconfigview.class.php	2007-08-22 12:22:04 UTC (rev 5853)
> @@ -19,11 +19,15 @@
> 			$blogSettings = $this->_blogInfo->getSettings();
> 			$pluginEnabled = $blogSettings->getValue( "plugin_recentcomments_enabled" );
> 			$maxComments = $blogSettings->getValue( "plugin_recentcomments_maxcomments" );
> +			$includeComments = $blogSettings->getValue( "plugin_recentcomments_include_comments" );
> +			$includeTrackbacks = $blogSettings->getValue( "plugin_recentcomments_include_trackbacks" );
> 			if ($maxComments == "") $maxComments = DEFAULT_ITEMS_PER_PAGE;
>
> 			// create a view and export the settings to the template
> 			$this->setValue( "pluginEnabled", $pluginEnabled );
> 			$this->setValue( "maxComments", $maxComments );
> +			$this->setValue( "includeComments", $includeComments );
> +			$this->setValue( "includeTrackbacks", $includeTrackbacks );
>
> 			parent::render();
> 		}
>
> Modified: plugins/branches/lifetype-1.2/recentcomments/class/view/pluginrecentcommentsrssview.class.php
> ===================================================================
> --- plugins/branches/lifetype-1.2/recentcomments/class/view/pluginrecentcommentsrssview.class.php	2007-08-21 20:24:42 UTC (rev 5852)
> +++ plugins/branches/lifetype-1.2/recentcomments/class/view/pluginrecentcommentsrssview.class.php	2007-08-22 12:22:04 UTC (rev 5853)
> @@ -15,15 +15,28 @@
> 			$maxComments = $blogSettings->getValue( "plugin_recentcomments_maxcomments" );
> 			if($maxComments == "")
>                 $maxComments = DEFAULT_ITEMS_PER_PAGE;
> +		    $includeComments = $blogSettings->getValue( "plugin_recentcomments_include_comments" );
> +		    $includeTrackbacks = $blogSettings->getValue( "plugin_recentcomments_include_trackbacks" );
>
> -            $blogComments = array();
> -            $articleComments = new ArticleComments();
> -            $blogComments = $articleComments->getBlogComments($this->_blogInfo->getId(),
> -                                                              COMMENT_ORDER_NEWEST_FIRST,
> -                                                              COMMENT_STATUS_NONSPAM,
> -                                                              "",
> -                                                              1,
> -                                                              $maxComments);
> +            $commentType = COMMENT_TYPE_ANY;
> +            if($includeComments == 0 || $includeTrackbacks == 0){
> +                if($includeComments){
> +                    $commentType = COMMENT_TYPE_COMMENT;
> +                }
> +                else if($includeTrackbacks){
> +                    $commentType = COMMENT_TYPE_TRACKBACK;
> +                }
> +                else{
> +                        // TODO: they unchecked both??
> +                        // for now, assume that since the plugin is enabled,
> +                        // they wanted data to be shown...
> +                }
> +            }
> +
> +            $commentsCommon = new CommentsCommon();
> +            $comments = $commentsCommon->getBlogComments( $blogId, COMMENT_ORDER_NEWEST_FIRST,
> +                                                          COMMENT_STATUS_NONSPAM, $commentType,
> +                                                          "", 1, $maxComments );
>
> 			$this->setValue("comments", $blogComments);
>             $this->setContentType( 'text/xml' );
>
> Modified: plugins/branches/lifetype-1.2/recentcomments/locale/locale_en_UK.php
> ===================================================================
> --- plugins/branches/lifetype-1.2/recentcomments/locale/locale_en_UK.php	2007-08-21 20:24:42 UTC (rev 5852)
> +++ plugins/branches/lifetype-1.2/recentcomments/locale/locale_en_UK.php	2007-08-22 12:22:04 UTC (rev 5853)
> @@ -8,10 +8,15 @@
> $messages["recentcomments_plugin_enabled"] = "Enable this plugin";
> $messages["recentcomments_plugin"] = "Recent Comments Plugin";
>
> +$messages["recentcomments_label_include"] = "Show comment and/or trackbacks";
> +$messages["recentcomments_include_comments"] = "Include recent comments";
> +$messages["recentcomments_include_trackbacks"] = "Include recent trackbacks";
> +
> $messages["recentcomments_settings_saved_ok"] = "Recent Comments settings saved successfully!";
> $messages["recentcomments_error_maxcomments"] = "Maximum Showed Comments Should > 0!";
>
> $messages["label_configuration"] = "Configuration";
> $messages["label_enable"] = "Enable";
> $messages["label_maxcomments"] = "Max Comments";
> +
> ?>
> \ No newline at end of file
>
> Modified: plugins/branches/lifetype-1.2/recentcomments/pluginrecentcomments.class.php
> ===================================================================
> --- plugins/branches/lifetype-1.2/recentcomments/pluginrecentcomments.class.php	2007-08-21 20:24:42 UTC (rev 5852)
> +++ plugins/branches/lifetype-1.2/recentcomments/pluginrecentcomments.class.php	2007-08-22 12:22:04 UTC (rev 5853)
> @@ -9,12 +9,14 @@
>     {
>         var $pluginEnabled;
>         var $maxComments;
> +        var $includeComments;
> +        var $includeTrackbacks;
>
>         function PluginRecentComments($source = "")
>         {
>             $this->PluginBase($source);
>             $this->id = "recentcomments";
> -            $this->version = "20070406";
> +            $this->version = "20070822";
>
>             $this->author = "Mark Wu";
>             $this->desc = "This plugin offers the most recently posted article comments.";
> @@ -45,6 +47,8 @@
> 		    $blogSettings = $this->blogInfo->getSettings();
> 		    $this->pluginEnabled = $blogSettings->getValue( "plugin_recentcomments_enabled" );
> 	        $this->maxComments = $blogSettings->getValue( "plugin_recentcomments_maxcomments", DEFAULT_ITEMS_PER_PAGE );
> +		    $this->includeComments = $blogSettings->getValue( "plugin_recentcomments_include_comments" );
> +		    $this->includeTrackbacks = $blogSettings->getValue( "plugin_recentcomments_include_trackbacks" );
> 	    }
>
> 	    function isEnabled()
> @@ -53,15 +57,32 @@
> 	    }
>
>         /**
> -         * Returns the recent comments object of current blog
> +         * Returns the recent comments and/or trackbacks object of current blog
>          */
>         function getRecentComments()
>         {
> -            lt_include( PLOG_CLASS_PATH."class/dao/articlecomments.class.php" );
> +            lt_include( PLOG_CLASS_PATH."class/dao/commentscommon.class.php" );
>
> +            $commentType = COMMENT_TYPE_ANY;
> +            if($this->includeComments == 0 || $this->includeTrackbacks == 0){
> +                if($this->includeComments){
> +                    $commentType = COMMENT_TYPE_COMMENT;
> +                }
> +                else if($this->includeTrackbacks){
> +                    $commentType = COMMENT_TYPE_TRACKBACK;
> +                }
> +                else{
> +                        // TODO: they unchecked both??
> +                        // for now, assume that since the plugin is enabled,
> +                        // they wanted data to be shown...
> +                }
> +            }
> +
>             $blogId = $this->blogInfo->getId();
> -            $articleComments = new ArticleComments();
> -            $comments = $articleComments->getBlogComments( $blogId, COMMENT_ORDER_NEWEST_FIRST, COMMENT_STATUS_NONSPAM, "", 1, $this->maxComments );
> +            $commentsCommon = new CommentsCommon();
> +            $comments = $commentsCommon->getBlogComments( $blogId, COMMENT_ORDER_NEWEST_FIRST,
> +                                                          COMMENT_STATUS_NONSPAM, $commentType,
> +                                                          "", 1, $this->maxComments );
>
>             return( $comments );
>         }
> @@ -98,6 +119,10 @@
>                         Array("name" => "plugin_recentcomments_maxcomments",
>                               "validator" => new IntegerValidator(),
>                               "type" => "integer", "allowEmpty" => true ),
> +                        Array("name" => "plugin_recentcomments_include_comments",
> +                              "type" => "boolean"),
> +                        Array("name" => "plugin_recentcomments_include_trackbacks",
> +                              "type" => "boolean"),
>                         )
>                    );
>         }
>
> Modified: plugins/branches/lifetype-1.2/recentcomments/templates/recentcomments.template
> ===================================================================
> --- plugins/branches/lifetype-1.2/recentcomments/templates/recentcomments.template	2007-08-21 20:24:42 UTC (rev 5852)
> +++ plugins/branches/lifetype-1.2/recentcomments/templates/recentcomments.template	2007-08-22 12:22:04 UTC (rev 5853)
> @@ -30,7 +30,29 @@
>           {/user_cannot_override}
>           value="{$maxComments}" width="10" />
>   </div>
> -
> +
> +  <div class="field">
> +   <label for="includeComments">{$locale->tr("recentcomments_label_include")}</label>
> +   <div class="formHelp">
> +    <input class="checkbox" type="checkbox" name="includeComments"
> +           id="includeComments" {if $includeComments} checked="checked" {/if}
> +           {user_cannot_override
> +             key=plugin_recentcomments_include_comments}disabled="disabled"
> +           {/user_cannot_override}
> +           value="1"
> +     />{$locale->tr("recentcomments_include_comments")}
> +   </div>
> +   <div class="formHelp">
> +    <input class="checkbox" type="checkbox" name="includeTrackbacks"
> +           id="includeTrackbacks" {if $includeTrackbacks} checked="checked" {/if}
> +           {user_cannot_override
> +             key=plugin_recentcomments_include_trackbacks}disabled="disabled"
> +           {/user_cannot_override}
> +           value="1"
> +     />{$locale->tr("recentcomments_include_trackbacks")}
> +   </div>
> +  </div>
> +
>  </fieldset>
>
>  <div class="buttons">
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://limedaley.com/mailman/listinfo/plog-svn
>

-- 
Jon Daley
http://jon.limedaley.com/

And when it rains on your parade, look up rather than down.
Without the rain, there would be no rainbow.
-- Jerry Chin


More information about the pLog-svn mailing list