[pLog-svn] r2014 - in plugins/trunk: . remembercommentdata remembercommentdata/class remembercommentdata/class/action remembercommentdata/class/view remembercommentdata/js remembercommentdata/locale remembercommentdata/templates

mark at devel.plogworld.net mark at devel.plogworld.net
Tue May 17 07:10:28 GMT 2005


Author: mark
Date: 2005-05-17 07:10:27 +0000 (Tue, 17 May 2005)
New Revision: 2014

Added:
   plugins/trunk/remembercommentdata/
   plugins/trunk/remembercommentdata/class/
   plugins/trunk/remembercommentdata/class/action/
   plugins/trunk/remembercommentdata/class/action/pluginremembercommentdataconfigaction.class.php
   plugins/trunk/remembercommentdata/class/action/pluginremembercommentdataupdateconfigaction.class.php
   plugins/trunk/remembercommentdata/class/view/
   plugins/trunk/remembercommentdata/class/view/pluginremembercommentdataconfigview.class.php
   plugins/trunk/remembercommentdata/js/
   plugins/trunk/remembercommentdata/js/remembercommentdata.js
   plugins/trunk/remembercommentdata/locale/
   plugins/trunk/remembercommentdata/locale/locale_en_UK.php
   plugins/trunk/remembercommentdata/locale/locale_es_ES.php
   plugins/trunk/remembercommentdata/pluginremembercommentdata.class.php
   plugins/trunk/remembercommentdata/readme.txt
   plugins/trunk/remembercommentdata/templates/
   plugins/trunk/remembercommentdata/templates/remembercommentdata.template
Log:


Added: plugins/trunk/remembercommentdata/class/action/pluginremembercommentdataconfigaction.class.php
===================================================================
--- plugins/trunk/remembercommentdata/class/action/pluginremembercommentdataconfigaction.class.php	2005-05-17 06:48:49 UTC (rev 2013)
+++ plugins/trunk/remembercommentdata/class/action/pluginremembercommentdataconfigaction.class.php	2005-05-17 07:10:27 UTC (rev 2014)
@@ -0,0 +1,27 @@
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/remembercommentdata/class/view/pluginremembercommentdataconfigview.class.php" );
+
+	/**
+	 * shows a form with the current configuration
+	 */
+	class PluginRememberCommentDataConfigAction extends AdminAction
+	{
+
+		function PluginRememberCommentDataConfigAction( $actionInfo, $request )
+		{
+			$this->AdminAction( $actionInfo, $request );
+		}
+
+		function perform()
+		{
+            $this->_view = new PluginRememberCommentDataConfigView( $this->_blogInfo );
+
+			$this->setCommonData();
+
+			return true;
+		}
+	}
+?>
\ No newline at end of file

Added: plugins/trunk/remembercommentdata/class/action/pluginremembercommentdataupdateconfigaction.class.php
===================================================================
--- plugins/trunk/remembercommentdata/class/action/pluginremembercommentdataupdateconfigaction.class.php	2005-05-17 06:48:49 UTC (rev 2013)
+++ plugins/trunk/remembercommentdata/class/action/pluginremembercommentdataupdateconfigaction.class.php	2005-05-17 07:10:27 UTC (rev 2014)
@@ -0,0 +1,59 @@
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/remembercommentdata/class/view/pluginremembercommentdataconfigview.class.php" );
+
+	/**
+	 * updates the plugin configuration
+	 */
+	class PluginRememberCommentDataUpdateConfigAction extends AdminAction
+	{
+		var $_pluginEnabled;
+
+		function PluginRememberCommentDataUpdateConfigAction( $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_remembercommentdata_enabled", $this->_pluginEnabled );
+            $this->_blogInfo->setSettings( $blogSettings );
+
+			// save the blogs settings
+			$blogs = new Blogs();
+            if( !$blogs->updateBlog( $this->_blogInfo->getId(), $this->_blogInfo )) {
+                $this->_view = new PluginRememberCommentDataConfigView( $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 PluginRememberCommentDataConfigView( $this->_blogInfo );
+			$this->_view->setSuccessMessage( $this->_locale->tr("remcommdata_settings_saved_ok"));
+			$this->setCommonData();
+
+			// clear the cache
+			CacheControl::resetBlogCache( $this->_blogInfo->getId());
+
+            return true;
+		}
+	}
+?>
\ No newline at end of file

Added: plugins/trunk/remembercommentdata/class/view/pluginremembercommentdataconfigview.class.php
===================================================================
--- plugins/trunk/remembercommentdata/class/view/pluginremembercommentdataconfigview.class.php	2005-05-17 06:48:49 UTC (rev 2013)
+++ plugins/trunk/remembercommentdata/class/view/pluginremembercommentdataconfigview.class.php	2005-05-17 07:10:27 UTC (rev 2014)
@@ -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 PluginRememberCommentDataConfigView extends AdminPluginTemplatedView
+	{
+
+		function PluginRememberCommentDataConfigView( $blogInfo )
+		{
+			$this->AdminPluginTemplatedView( $blogInfo, "remembercommentdata", "remembercommentdata" );
+		}
+
+		function render()
+		{
+			// load some configuration settings
+			$blogSettings = $this->_blogInfo->getSettings();
+			$pluginEnabled = $blogSettings->getValue( "plugin_remembercommentdata_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/remembercommentdata/js/remembercommentdata.js
===================================================================
--- plugins/trunk/remembercommentdata/js/remembercommentdata.js	2005-05-17 06:48:49 UTC (rev 2013)
+++ plugins/trunk/remembercommentdata/js/remembercommentdata.js	2005-05-17 07:10:27 UTC (rev 2014)
@@ -0,0 +1,48 @@
+function createCookie(name,value,days) {
+	if (days)
+	{
+		var date = new Date();
+		date.setTime(date.getTime()+(days*24*60*60*1000));
+		var expires = "; expires="+date.toGMTString();
+	}
+	else var expires = "";
+	document.cookie = name+"="+value+expires+"; path=/";
+}
+
+function readCookie(name) {
+	var nameEQ = name + "=";
+	var ca = document.cookie.split(';');
+	for(var i=0;i < ca.length;i++)
+	{
+		var c = ca[i];
+		while (c.charAt(0)==' ') c = c.substring(1,c.length);
+		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
+	}
+	return null;
+}
+
+function eraseCookie(name) {
+	createCookie(name,"",-1);
+}
+
+function setCookies() {
+    var theForm = document.forms['NewComment'];
+    createCookie("plog_cm_name", theForm.userName.value, 180);
+    createCookie("plog_cm_email", theForm.userEmail.value, 180);
+    createCookie("plog_cm_url", theForm.userUrl.value, 180);
+    return true;
+}
+
+function readCookies() {
+    var theForm = document.forms['NewComment'];
+    var theName = readCookie("plog_cm_name");
+    var theAddr = readCookie("plog_cm_email");
+    var theUrl = readCookie("plog_cm_url");
+    theForm.userName.value = (theName==null)?"":theName;
+    theForm.userEmail.value = (theAddr==null)?"":theAddr;
+    theForm.userUrl.value = (theUrl==null)?"":theUrl;
+}
+
+document.forms['NewComment'].onsubmit = setCookies;
+
+setTimeout("readCookies()", 3000);

Added: plugins/trunk/remembercommentdata/locale/locale_en_UK.php
===================================================================
--- plugins/trunk/remembercommentdata/locale/locale_en_UK.php	2005-05-17 06:48:49 UTC (rev 2013)
+++ plugins/trunk/remembercommentdata/locale/locale_en_UK.php	2005-05-17 07:10:27 UTC (rev 2014)
@@ -0,0 +1,12 @@
+<?php
+$messages["manageAppearancePlugins"] = "Appearance Management";
+$messages["RememberCommentData"] = "Remember Comments Data";
+
+$messages["remcommdata_plugin_enabled"] = "Enable this plugin";
+$messages["remcommdata_plugin"] = "Remember Comments Data Plugin";
+
+$messages["remcommdata_settings_saved_ok"] = "Settings saved successfully!";
+
+$messages["label_configuration"] = "Configuration";
+$messages["label_enable"] = "Enable";
+?>
\ No newline at end of file

Added: plugins/trunk/remembercommentdata/locale/locale_es_ES.php
===================================================================
--- plugins/trunk/remembercommentdata/locale/locale_es_ES.php	2005-05-17 06:48:49 UTC (rev 2013)
+++ plugins/trunk/remembercommentdata/locale/locale_es_ES.php	2005-05-17 07:10:27 UTC (rev 2014)
@@ -0,0 +1,17 @@
+<?php
+
+// Translation by Andres Bianciotto plog at a-b.com.ar
+// Date 09/Apr/2005
+//
+
+$messages["manageAppearancePlugins"] = "Apariencia";
+$messages["RememberCommentData"] = "Comentarios con Memoria";
+
+$messages["remcommdata_plugin_enabled"] = "Activar este plugin";
+$messages["remcommdata_plugin"] = "Plugin Comentarios con Memoria";
+
+$messages["remcommdata_settings_saved_ok"] = "La configuraci&oacute;n se ha guardado con &eacute;xito";
+
+$messages["label_configuration"] = "Configuraci&oacute;n";
+$messages["label_enable"] = "Activar";
+?>
\ No newline at end of file

Added: plugins/trunk/remembercommentdata/pluginremembercommentdata.class.php
===================================================================
--- plugins/trunk/remembercommentdata/pluginremembercommentdata.class.php	2005-05-17 06:48:49 UTC (rev 2013)
+++ plugins/trunk/remembercommentdata/pluginremembercommentdata.class.php	2005-05-17 07:10:27 UTC (rev 2014)
@@ -0,0 +1,53 @@
+<?php
+	include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
+	include_once( PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" );
+
+	class PluginRememberCommentData extends PluginBase
+	{
+		var $pluginEnabled;
+
+		function PluginRememberCommentData()
+		{
+			$this->PluginBase();
+
+			$this->id      = "remembercommentdata";
+			$this->author  = "Andres Bianciotto";
+			$this->desc    = "Fills the comment form fields with last entered data (cookie based)";
+
+			$this->locales = Array( "en_UK" , "es_ES" );
+
+			$this->init();
+		}
+
+		function init()
+		{
+            $this->registerAdminAction( "remembercommentdata", "PluginRememberCommentDataConfigAction" );
+			$this->registerAdminAction( "updateRememberCommentDataConfig", "PluginRememberCommentDataUpdateConfigAction" );
+
+			$menu =& Menu::getMenu();
+			if( !$menu->entryExists( "/menu/controlCenter/manageAppearancePlugins" ))
+				$this->addMenuEntry( "/menu/controlCenter", "manageAppearancePlugins", "", "", true, false );
+            $this->addMenuEntry( "/menu/controlCenter/manageAppearancePlugins", "RememberCommentData", "?op=remembercommentdata", "" );
+		}
+
+		function register()
+		{
+		    $blogSettings = $this->blogInfo->getSettings();
+			$this->pluginEnabled = $blogSettings->getValue( "plugin_remembercommentdata_enabled" );
+		}
+
+	    function isEnabled()
+	    {
+	        return $this->pluginEnabled;
+	    }
+
+		function show()
+		{
+		    $rg = $this->blogInfo->getBlogRequestGenerator();
+            $baseUrl = $rg->getBaseUrl();
+            $retValue = "<script src=\"$baseUrl/plugins/remembercommentdata/js/remembercommentdata.js\" language=\"JavaScript\" type=\"text/javascript\"></script>";
+		    return $retValue;
+		}
+
+	}
+?>
\ No newline at end of file

Added: plugins/trunk/remembercommentdata/readme.txt
===================================================================
--- plugins/trunk/remembercommentdata/readme.txt	2005-05-17 06:48:49 UTC (rev 2013)
+++ plugins/trunk/remembercommentdata/readme.txt	2005-05-17 07:10:27 UTC (rev 2014)
@@ -0,0 +1,21 @@
+Plugin: Remember Comment Data	
+Author: Andres Bianciotto
+Release Date: 2005/05/15
+Version: 1.0
+
+This plugin makes the blog "remember" the personal information users enter on the comments form.
+
+Install:
+1. Configurate your Remember Comment Data plugin in your pLog control center
+
+
+Usage:
+Place this BELOW the </form> tag in the commentform.template file
+
+{if $remembercommentdata->isEnabled()}
+{$remembercommentdata->show()}
+{/if}
+
+Notes:
+The form MUST be named "NewComment".
+The users must enable cookies for this plugin to work

Added: plugins/trunk/remembercommentdata/templates/remembercommentdata.template
===================================================================
--- plugins/trunk/remembercommentdata/templates/remembercommentdata.template	2005-05-17 06:48:49 UTC (rev 2013)
+++ plugins/trunk/remembercommentdata/templates/remembercommentdata.template	2005-05-17 07:10:27 UTC (rev 2014)
@@ -0,0 +1,24 @@
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=RememberCommentData title=$locale->tr("remcommdata_plugin")}
+<form name="remcommdataPluginConfig" 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("remcommdata_plugin_enabled")}
+   </div>
+  </div>
+
+ </fieldset>
+
+ <div class="buttons">
+  <input type="hidden" name="op" value="updateRememberCommentDataConfig" />
+  <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