[pLog-svn] r4512 - in plugins/trunk/unported/gravatar: . templates

oscar at devel.lifetype.net oscar at devel.lifetype.net
Thu Jan 4 23:59:29 GMT 2007


Author: oscar
Date: 2007-01-04 23:59:28 +0000 (Thu, 04 Jan 2007)
New Revision: 4512

Modified:
   plugins/trunk/unported/gravatar/plugingravatar.class.php
   plugins/trunk/unported/gravatar/templates/gravatar.template
Log:
another plugin ported, and this time it includes some changes so that it uses the new global plugin settings framework to allow administrators to globally control certain parameters of the plugin. The changes concentrate in the PluginBase::getPluginConfigurationKeys() method, that now returns an array with all the public plugin settings, their type, validation class and list of options (if needed) In addition to that, the UI template with the configuration also needs to be modified so that it notifies users when a field has been configured by administrators not to be overridden by user settings.


Modified: plugins/trunk/unported/gravatar/plugingravatar.class.php
===================================================================
--- plugins/trunk/unported/gravatar/plugingravatar.class.php	2007-01-04 23:54:36 UTC (rev 4511)
+++ plugins/trunk/unported/gravatar/plugingravatar.class.php	2007-01-04 23:59:28 UTC (rev 4512)
@@ -95,5 +95,20 @@
 
             return $gravatar_url;
         }
+
+		/**
+		 * Settings supported by this plugin
+		 */
+		function getPluginConfigurationKeys()
+		{
+			lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
+			
+			return( Array(
+			  Array( "name" => "plugin_gravatar_enabled", "type" => "boolean" ),
+			  Array( "name" => "plugin_gravatar_rating", "type" => "list", "options" => Array( "G" => "G", "PG" => "PG", "R" => "R", "X" => "X" )),			
+			  Array( "name" => "plugin_gravatar_size", "type" => "list", "options" => Array( "30" => "30", "40" => "40", "50" => "50", "60" => "60", "70" => "70", "80" => "80" )),
+			  Array( "name" => "plugin_gravatar_default", "type" => "list", "options" => Array( "baby.jpg" => "baby.jpg", "bigson.jpg" => "bigson.jpg", "daughter.jpg" => "daughter.jpg", "default.jpg" => "default.jpg", "father.jpg" => "father.jpg", "mother.jpg" => "mother.jpg" ))
+			));			
+		}
     }
 ?>

Modified: plugins/trunk/unported/gravatar/templates/gravatar.template
===================================================================
--- plugins/trunk/unported/gravatar/templates/gravatar.template	2007-01-04 23:54:36 UTC (rev 4511)
+++ plugins/trunk/unported/gravatar/templates/gravatar.template	2007-01-04 23:59:28 UTC (rev 4512)
@@ -9,7 +9,8 @@
    <label for="pluginEnabled">{$locale->tr("label_enable")}</label>
    <span class="required"></span>
    <div class="formHelp">
-     <input class="checkbox" type="checkbox" name="pluginEnabled" id="pluginEnabled" {if $pluginEnabled} checked="checked" {/if} value="1" />{$locale->tr("gravatar_plugin_enabled")}
+	
+     <input class="checkbox" type="checkbox" name="pluginEnabled" id="pluginEnabled" {if $pluginEnabled} checked="checked" {/if} value="1" {user_cannot_override key=plugin_gravatar_enabled}disabled="disabled"{/user_cannot_override}/>{$locale->tr("gravatar_plugin_enabled")}
    </div>
   </div> 
 
@@ -17,7 +18,7 @@
    <label for="rating">{$locale->tr("label_rating")}</label>
    <span class="required"></span>
    <div class="formHelp">{$locale->tr("gravatar_rating")}</div>
-   <select name="rating" id="rating">
+   <select name="rating" id="rating" {user_cannot_override key=plugin_gravatar_rating}disabled="disabled"{/user_cannot_override}>
     <option value="G" {if $rating=="G"}selected="selected"{/if}>G</option>
     <option value="PG" {if $rating=="PG"}selected="selected"{/if}>PG</option>
     <option value="R" {if $rating=="R"}selected="selected"{/if}>R</option>
@@ -29,7 +30,7 @@
    <label for="size">{$locale->tr("label_size")}</label>
    <div class="formHelp">{$locale->tr("gravatar_size")}</div>
    <span class="required"></span>
-   <select name="size" id="size">
+   <select name="size" id="size" {user_cannot_override key=plugin_gravatar_size}disabled="disabled"{/user_cannot_override}>
     <option value="30" {if $size==30}selected="selected"{/if}>30x30</option>
     <option value="40" {if $size==40}selected="selected"{/if}>40x40</option>
     <option value="50" {if $size==50}selected="selected"{/if}>50x50</option>
@@ -55,7 +56,7 @@
      {foreach from=$avatars item=avatar}
      <tr>
       <td>
-       <input class="radio" type="radio" name="default" id="default" value="{$avatar}" {if $default==$avatar} checked="checked" {/if} />
+       <input class="radio" type="radio" name="default" id="default" value="{$avatar}" {if $default==$avatar} checked="checked" {/if}  {user_cannot_override key=plugin_gravatar_default}disabled="disabled"{/user_cannot_override}/>
       </td>
       <td>
        {$avatar}



More information about the pLog-svn mailing list