[pLog-svn] r815 - in plugins/trunk/gravatar/class: . action view

mark at devel.plogworld.net mark at devel.plogworld.net
Mon Jan 24 08:57:44 GMT 2005


Author: mark
Date: 2005-01-24 08:57:44 +0000 (Mon, 24 Jan 2005)
New Revision: 815

Added:
   plugins/trunk/gravatar/class/view/
   plugins/trunk/gravatar/class/view/plugingravatarconfigview.class.php
Modified:
   plugins/trunk/gravatar/class/action/plugingravatarconfigaction.class.php
   plugins/trunk/gravatar/class/action/plugingravatarupdateconfigaction.class.php
Log:


Modified: plugins/trunk/gravatar/class/action/plugingravatarconfigaction.class.php
===================================================================
--- plugins/trunk/gravatar/class/action/plugingravatarconfigaction.class.php	2005-01-24 07:56:07 UTC (rev 814)
+++ plugins/trunk/gravatar/class/action/plugingravatarconfigaction.class.php	2005-01-24 08:57:44 UTC (rev 815)
@@ -1,7 +1,8 @@
 <?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."class/view/admin/adminplugintemplatedview.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/gravatar/class/view/plugingravatarconfigview.class.php" );		
 
 	/**
 	 * shows a form with the current configuration
@@ -16,26 +17,8 @@
 		
 		function perform()
 		{
-			// load some configuration settings
-			$blogSettings = $this->_blogInfo->getSettings();
-			$pluginEnabled = $blogSettings->getValue( "plugin_gravatar_enabled" );
-			$rating = $blogSettings->getValue( "plugin_gravatar_rating" );
-			if ($rating == "") $rating = "G";
-			$default = $blogSettings->getValue( "plugin_gravatar_default" );
-			if ($default == "") $default = "default.jpg";
-			$size = $blogSettings->getValue( "plugin_gravatar_size" );
-			if ($size == "") $size = 40;	
+            $this->_view = new PluginGravatarConfigView( $this->_blogInfo );
 			
-			$avatars = Avatars::scanAvatarImages();	
-			
-			// create a view and export the settings to the template
-			$this->_view = new AdminPluginTemplatedView( $this->_blogInfo, "gravatar", "gravatar", true );
-			$this->_view->setValue( "pluginEnabled", $pluginEnabled );
-			$this->_view->setValue( "rating", $rating );
-			$this->_view->setValue( "default", $default );
-			$this->_view->setValue( "avatars", $avatars );
-			$this->_view->setValue( "size", $size );
-			
 			$this->setCommonData();
 			
 			return true;

Modified: plugins/trunk/gravatar/class/action/plugingravatarupdateconfigaction.class.php
===================================================================
--- plugins/trunk/gravatar/class/action/plugingravatarupdateconfigaction.class.php	2005-01-24 07:56:07 UTC (rev 814)
+++ plugins/trunk/gravatar/class/action/plugingravatarupdateconfigaction.class.php	2005-01-24 08:57:44 UTC (rev 815)
@@ -2,6 +2,7 @@
 
 	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/gravatar/class/view/plugingravatarconfigview.class.php" );		
 
 		
 	/**
@@ -43,7 +44,7 @@
 			// save the blogs settings
 			$blogs = new Blogs();
             if( !$blogs->updateBlog( $this->_blogInfo->getId(), $this->_blogInfo )) {
-                $this->_view = new AdminPluginTemplatedView( $this->_blogInfo, "gravatar", "gravatar" );
+                $this->_view = new PluginGravatarConfigView( $this->_blogInfo );
                 $this->_view->setErrorMessage( $this->_locale->tr("error_updating_settings"));
                 $this->setCommonData();
 
@@ -55,7 +56,7 @@
             $this->_session->setValue( "blogInfo", $this->_blogInfo );
             $this->saveSession();
 			
-			$this->_view = new AdminPluginTemplatedView( $this->_blogInfo, "gravatar", "gravatar" );
+			$this->_view = new PluginGravatarConfigView( $this->_blogInfo );
 			$this->_view->setSuccessMessage( $this->_locale->tr("gravatar_settings_saved_ok"));
 			$this->setCommonData();
             

Added: plugins/trunk/gravatar/class/view/plugingravatarconfigview.class.php
===================================================================
--- plugins/trunk/gravatar/class/view/plugingravatarconfigview.class.php	2005-01-24 07:56:07 UTC (rev 814)
+++ plugins/trunk/gravatar/class/view/plugingravatarconfigview.class.php	2005-01-24 08:57:44 UTC (rev 815)
@@ -0,0 +1,39 @@
+<?php
+	
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+
+	/**
+	 * implements the main view of the feed reader plugin
+	 */
+	class PluginGravatarConfigView extends AdminPluginTemplatedView
+	{
+
+		function PluginGravatarConfigView( $blogInfo )
+		{
+			$this->AdminPluginTemplatedView( $blogInfo, "gravatar", "gravatar" );
+		}
+		
+		function render()
+		{
+			$blogSettings = $this->_blogInfo->getSettings();
+			$pluginEnabled = $blogSettings->getValue( "plugin_gravatar_enabled" );
+			$rating = $blogSettings->getValue( "plugin_gravatar_rating" );
+			if ($rating == "") $rating = "G";
+			$default = $blogSettings->getValue( "plugin_gravatar_default" );
+			if ($default == "") $default = "default.jpg";
+			$size = $blogSettings->getValue( "plugin_gravatar_size" );
+			if ($size == "") $size = 40;	
+			
+			$avatars = Avatars::scanAvatarImages();	
+			
+			// create a view and export the settings to the template
+			$this->setValue( "pluginEnabled", $pluginEnabled );
+			$this->setValue( "rating", $rating );
+			$this->setValue( "default", $default );
+			$this->setValue( "avatars", $avatars );
+			$this->setValue( "size", $size );
+			
+			parent::render();
+		}
+	}
+?>
\ No newline at end of file




More information about the pLog-svn mailing list