[pLog-svn] r3729 - in plugins/trunk: . commentsCom
commentsCom/class commentsCom/class/action
commentsCom/class/view commentsCom/locale commentsCom/templates
pwestbro at devel.lifetype.net
pwestbro at devel.lifetype.net
Mon Jul 17 00:26:00 GMT 2006
Author: pwestbro
Date: 2006-07-17 00:25:59 +0000 (Mon, 17 Jul 2006)
New Revision: 3729
Added:
plugins/trunk/commentsCom/
plugins/trunk/commentsCom/README.txt
plugins/trunk/commentsCom/class/
plugins/trunk/commentsCom/class/action/
plugins/trunk/commentsCom/class/action/plugincommentscomconfigaction.class.php
plugins/trunk/commentsCom/class/action/plugincommentscomupdateconfigaction.class.php
plugins/trunk/commentsCom/class/action/showcommentsaction.class.php
plugins/trunk/commentsCom/class/view/
plugins/trunk/commentsCom/class/view/plugincommentscomconfigview.class.php
plugins/trunk/commentsCom/locale/
plugins/trunk/commentsCom/locale/locale_en_UK.php
plugins/trunk/commentsCom/plugincommentsCom.class.php
plugins/trunk/commentsCom/templates/
plugins/trunk/commentsCom/templates/commentsCom.template
Log:
Adding the co.mments.com plugin.
Now LifeType posts can be tracked by the co.mments.com service
Note: It would have been cool to name this plugin co.mments, but this fails
because it isn't a valid php class name. Also, it didn't work to call the
plugin comments, as this smarty variable is use for the array of comments
for a post
Added: plugins/trunk/commentsCom/README.txt
===================================================================
--- plugins/trunk/commentsCom/README.txt 2006-07-16 20:40:26 UTC (rev 3728)
+++ plugins/trunk/commentsCom/README.txt 2006-07-17 00:25:59 UTC (rev 3729)
@@ -0,0 +1,16 @@
+[USAGES]:
+1. Upload: Upload all the extract files and directorys to $LifeType_Install_Dir/plugin/commentsCom
+2. Modify template: Use $commentsCom->show($postId) in template file to all a LifeType post to be tracked.
+
+
+
+[EXAMPLE]:
+Add the following code in post.template to replace </form>:
+
+Code:
+{assign var="postId" value=$post->getId()}
+{$commentsCom->show($postId)}
+</form>
+
+[TODO]:
+1) Admin option for appearance
\ No newline at end of file
Added: plugins/trunk/commentsCom/class/action/plugincommentscomconfigaction.class.php
===================================================================
--- plugins/trunk/commentsCom/class/action/plugincommentscomconfigaction.class.php 2006-07-16 20:40:26 UTC (rev 3728)
+++ plugins/trunk/commentsCom/class/action/plugincommentscomconfigaction.class.php 2006-07-17 00:25:59 UTC (rev 3729)
@@ -0,0 +1,26 @@
+<?php
+
+ include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/commentsCom/class/view/plugincommentscomconfigview.class.php" );
+
+ /**
+ * shows a form with the current configuration
+ */
+ class PluginCommentsComConfigAction extends AdminAction
+ {
+
+ function PluginCommentsComConfigAction( $actionInfo, $request )
+ {
+ $this->AdminAction( $actionInfo, $request );
+ }
+
+ function perform()
+ {
+ $this->_view = new PluginCommentsConfigView( $this->_blogInfo );
+
+ $this->setCommonData();
+
+ return true;
+ }
+ }
+?>
\ No newline at end of file
Added: plugins/trunk/commentsCom/class/action/plugincommentscomupdateconfigaction.class.php
===================================================================
--- plugins/trunk/commentsCom/class/action/plugincommentscomupdateconfigaction.class.php 2006-07-16 20:40:26 UTC (rev 3728)
+++ plugins/trunk/commentsCom/class/action/plugincommentscomupdateconfigaction.class.php 2006-07-17 00:25:59 UTC (rev 3729)
@@ -0,0 +1,58 @@
+<?php
+
+ include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+ include_once( PLOG_CLASS_PATH."plugins/commentsCom/class/view/plugincommentscomconfigview.class.php" );
+
+ /**
+ * updates the plugin configuration
+ */
+ class PluginCommentsComUpdateConfigAction extends AdminAction
+ {
+ var $_pluginEnabled;
+
+ function PluginCommentsComUpdateConfigAction( $actionInfo, $request )
+ {
+ $this->AdminAction( $actionInfo, $request );
+ }
+
+ function validate()
+ {
+ $this->_pluginEnabled = $this->_request->getValue( "pluginEnabled" );
+ $this->_pluginEnabled = ($this->_pluginEnabled != "" );
+
+ return true;
+ }
+
+ function perform()
+ {
+ // update the plugin configurations to blog setting
+ $blogSettings = $this->_blogInfo->getSettings();
+ $blogSettings->setValue( "plugin_co.mments_enabled", $this->_pluginEnabled );
+ $this->_blogInfo->setSettings( $blogSettings );
+
+ // save the blogs settings
+ $blogs = new Blogs();
+ if( !$blogs->updateBlog( $this->_blogInfo )) {
+ $this->_view = new PluginCommentsConfigView( $this->_blogInfo );
+ $this->_view->setErrorMessage( $this->_locale->tr("error_updating_settings"));
+ $this->setCommonData();
+
+ return false;
+ }
+
+ // if everything went ok...
+ $this->_blogInfo->setSettings( $blogSettings );
+ $this->_session->setValue( "blogInfo", $this->_blogInfo );
+ $this->saveSession();
+
+ $this->_view = new PluginCommentsConfigView( $this->_blogInfo );
+ $this->_view->setSuccessMessage( $this->_locale->tr("comments_settings_saved_ok"));
+ $this->setCommonData();
+
+ // clear the cache
+ CacheControl::resetBlogCache( $this->_blogInfo->getId());
+
+ return true;
+ }
+ }
+?>
\ No newline at end of file
Added: plugins/trunk/commentsCom/class/action/showcommentsaction.class.php
===================================================================
--- plugins/trunk/commentsCom/class/action/showcommentsaction.class.php 2006-07-16 20:40:26 UTC (rev 3728)
+++ plugins/trunk/commentsCom/class/action/showcommentsaction.class.php 2006-07-17 00:25:59 UTC (rev 3729)
@@ -0,0 +1,25 @@
+<?php
+
+ include_once( PLOG_CLASS_PATH."class/action/blogaction.class.php" );
+ include_once( PLOG_CLASS_PATH."class/view/plugintemplatedview.class.php" );
+
+ class ShowCommentsAction extends BlogAction
+ {
+ var $_commentsTemplate;
+
+ function ShowCommentsAction( $actionInfo, $request )
+ {
+ $this->BlogAction( $actionInfo, $request );
+ }
+
+ function perform()
+ {
+ $this->_commentsTemplate = $this->_request->getValue( "show" );
+
+ $this->_view = new PluginTemplatedView( $this->_blogInfo, "comments", $this->_commentsTemplate );
+ $this->setCommonData();
+
+ return true;
+ }
+ }
+?>
\ No newline at end of file
Added: plugins/trunk/commentsCom/class/view/plugincommentscomconfigview.class.php
===================================================================
--- plugins/trunk/commentsCom/class/view/plugincommentscomconfigview.class.php 2006-07-16 20:40:26 UTC (rev 3728)
+++ plugins/trunk/commentsCom/class/view/plugincommentscomconfigview.class.php 2006-07-17 00:25:59 UTC (rev 3729)
@@ -0,0 +1,28 @@
+<?php
+
+ include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+
+ /**
+ * implements the main view of the feed reader plugin
+ */
+ class PluginCommentsConfigView extends AdminPluginTemplatedView
+ {
+
+ function PluginCommentsConfigView( $blogInfo )
+ {
+ $this->AdminPluginTemplatedView( $blogInfo, "commentsCom", "commentsCom" );
+ }
+
+ function render()
+ {
+ // load some configuration settings
+ $blogSettings = $this->_blogInfo->getSettings();
+ $pluginEnabled = $blogSettings->getValue( "plugin_co.mments_enabled" );
+
+ // create a view and export the settings to the template
+ $this->setValue( "pluginEnabled", $pluginEnabled );
+
+ parent::render();
+ }
+ }
+?>
\ No newline at end of file
Added: plugins/trunk/commentsCom/locale/locale_en_UK.php
===================================================================
--- plugins/trunk/commentsCom/locale/locale_en_UK.php 2006-07-16 20:40:26 UTC (rev 3728)
+++ plugins/trunk/commentsCom/locale/locale_en_UK.php 2006-07-17 00:25:59 UTC (rev 3729)
@@ -0,0 +1,13 @@
+<?php
+$messages["manageAppearancePlugins"] = "Appearance Management";
+$messages["commentsCom"] = "co.mments";
+
+$messages["comments_plugin_enabled"] = "Enable this plugin";
+$messages["comments_plugin"] = "co.mments Plugin";
+$messages["detail"] = "Detail";
+
+$messages["comments_settings_saved_ok"] = "co.mments settings saved successfully!";
+
+$messages["label_configuration"] = "Configuration";
+$messages["label_enable"] = "Enable";
+?>
\ No newline at end of file
Added: plugins/trunk/commentsCom/plugincommentsCom.class.php
===================================================================
--- plugins/trunk/commentsCom/plugincommentsCom.class.php 2006-07-16 20:40:26 UTC (rev 3728)
+++ plugins/trunk/commentsCom/plugincommentsCom.class.php 2006-07-17 00:25:59 UTC (rev 3729)
@@ -0,0 +1,67 @@
+<?php
+ include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
+ include_once( PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" );
+
+ class PluginCommentsCom extends PluginBase
+ {
+ var $pluginEnabled;
+
+ function PluginCommentsCom()
+ {
+ $this->PluginBase();
+
+ $this->id = "commentsCom";
+ $this->author = "Paul Westbrook";
+ $this->desc = "Integrate co.mments into LifeType commentform template.";
+
+ $this->locales = Array( "en_UK");
+
+ $this->init();
+ }
+
+ function init()
+ {
+ // $this->registerBlogAction( "comments", "ShowCommentsAction" );
+ $this->registerAdminAction( "commentsConfig", "PluginCommentsComConfigAction" );
+ $this->registerAdminAction( "updateCommentsConfig", "PluginCommentsComUpdateConfigAction" );
+
+ $menu =& Menu::getMenu();
+ if( !$menu->entryExists( "/menu/controlCenter/manageAppearancePlugins" ))
+ $this->addMenuEntry( "/menu/controlCenter", "manageAppearancePlugins", "", "", true, false );
+ $this->addMenuEntry( "/menu/controlCenter/manageAppearancePlugins", "commentsCom", "?op=commentsConfig", "" );
+ }
+
+ function register()
+ {
+ $blogSettings = $this->blogInfo->getSettings();
+ $this->pluginEnabled = $blogSettings->getValue( "plugin_co.mments_enabled" );
+ }
+
+ function isEnabled()
+ {
+ return $this->pluginEnabled;
+ }
+
+ function show($postId)
+ {
+
+ $str = '';
+
+ if ($this->isEnabled())
+ {
+
+ // articles object
+ $articles = new Articles;
+
+
+ $rg = $this->blogInfo->getBlogRequestGenerator();
+ $post = $articles->getBlogArticle($postId);
+
+ $str = '<a href="http://co.mments.com/track?url=' . urlencode($rg->postPermalink($post)) . '"';
+ $str .= 'title="Track this post with co.mments">Track with co.mments</a>';
+ $str .= ' <img src="http://co.mments.com/images/track.gif" style="vertical-align:middle" /> ';
+ }
+ return $str;
+ }
+ }
+?>
\ No newline at end of file
Added: plugins/trunk/commentsCom/templates/commentsCom.template
===================================================================
--- plugins/trunk/commentsCom/templates/commentsCom.template 2006-07-16 20:40:26 UTC (rev 3728)
+++ plugins/trunk/commentsCom/templates/commentsCom.template 2006-07-17 00:25:59 UTC (rev 3729)
@@ -0,0 +1,24 @@
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=commentsCom title=$locale->tr("comments_plugin")}
+<form name="commentPluginConfig" method="post">
+ <fieldset class="inputField">
+ <legend>{$locale->tr("label_configuration")}</legend>
+ {include file="$admintemplatepath/successmessage.template"}
+ {include file="$admintemplatepath/errormessage.template"}
+ <div class="field">
+ <label for="pluginEnabled">{$locale->tr("label_enable")}</label>
+ <div class="formHelp">
+ <input class="checkbox" type="checkbox" name="pluginEnabled" id="pluginEnabled" {if $pluginEnabled} checked="checked" {/if} value="1" />{$locale->tr("comments_plugin_enabled")}
+ </div>
+ </div>
+
+ </fieldset>
+
+ <div class="buttons">
+ <input type="hidden" name="op" value="updateCommentsConfig" />
+ <input type="reset" name="{$locale->tr("reset")}" />
+ <input type="submit" name="{$locale->tr("update_settings")}" value="{$locale->tr("update")}" />
+ </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