r4596 - in plog/trunk: class/plugin templates/admin

oscar at devel.lifetype.net oscar at devel.lifetype.net
Sat Jan 27 12:49:47 EST 2007


Author: oscar
Date: 2007-01-27 12:49:47 -0500 (Sat, 27 Jan 2007)
New Revision: 4596

Modified:
   plog/trunk/class/plugin/pluginbase.class.php
   plog/trunk/templates/admin/pluginsettings.template
Log:
plugins that don't offer global configuration options do not appear in the list anymore.


Modified: plog/trunk/class/plugin/pluginbase.class.php
===================================================================
--- plog/trunk/class/plugin/pluginbase.class.php	2007-01-27 17:34:04 UTC (rev 4595)
+++ plog/trunk/class/plugin/pluginbase.class.php	2007-01-27 17:49:47 UTC (rev 4596)
@@ -322,6 +322,16 @@
 		}
 		
 		/**
+		 * Returns true if the plugin has any global configuration key or false otherwise
+		 *
+		 * @return true if the plugin has any global configuration key or false otherwise
+		 */
+		function hasPluginConfigurationKeys()
+		{
+			return( count( $this->getPluginConfigurationKeys()) > 0 );
+		}
+		
+		/**
 		 * Tells the plugin manager which custom tables have been created by this plugin. It will
 		 * help when making a back-up of the database structure, since the back-up feature will be able
 		 * to back-up the plugins' database tables too.

Modified: plog/trunk/templates/admin/pluginsettings.template
===================================================================
--- plog/trunk/templates/admin/pluginsettings.template	2007-01-27 17:34:04 UTC (rev 4595)
+++ plog/trunk/templates/admin/pluginsettings.template	2007-01-27 17:49:47 UTC (rev 4596)
@@ -8,52 +8,53 @@
   {include file="$admintemplatepath/formvalidate.template"}
 
   {foreach from=$plugins item=plugin} 
-     <h4>{$plugin->getId()}</h4>
-  <table style="width:100%">
-	<thead>
-	 <tr>	 
-	  <th style="width:10%;align:left">{$locale->tr("parameter")}</th>
-	  <th style="width:80%:align:left">{$locale->tr("value")}</th>
-	  <th style="width:10%:align:center">{$locale->tr("override")}</th>	
-	 </tr>
-	</thead>	
-
-	{assign var=pluginsettings value=$plugin->getPluginConfigurationKeys()}
-	{foreach from=$pluginsettings item=setting}
-	 <tr>
-		{assignvar var=key value=$setting.name}
-		{assign var=name value=$setting.name}
-		{assign var=overrideValue value=$canOverride[$setting.name]}
+	{if $plugin->hasPluginConfigurationKeys()}
+	     <h4>{$plugin->getId()}</h4>
+	  <table style="width:100%">
+		<thead>
+		 <tr>	 
+		  <th style="width:10%;align:left">{$locale->tr("parameter")}</th>
+		  <th style="width:80%:align:left">{$locale->tr("value")}</th>
+		  <th style="width:10%:align:center">{$locale->tr("override")}</th>	
+		 </tr>
+		</thead>	
+		{assign var=pluginsettings value=$plugin->getPluginConfigurationKeys()}
+		{foreach from=$pluginsettings item=setting}
+		 <tr>
+			{assignvar var=key value=$setting.name}
+			{assign var=name value=$setting.name}
+			{assign var=overrideValue value=$canOverride[$setting.name]}
 		
-		<td>{$setting.name}</td>
-		<td style="width:100%">
-			{if $setting.type=="boolean"}								 
-			 <input type="checkbox" name="{$setting.name}" value="1" class="checkbox" {if $key}checked="checked"{/if}/>
-			 {elseif $setting.type=="string"}		 
-			 <input type="text" name="{$setting.name}" value="{$key}" />
-			 {elseif $setting.type=="integer"}
-			 <input type="text" name="{$setting.name}" value="{$key}" />
-			 {elseif $setting.type=="list"}
-			  <select name="{$setting.name}">
-				{assign var=options value=$setting.options}
-				{foreach from=$options item=name key=value}
-					<option value="{$value}" {if $key==$value}selected="selected"{/if}>{$name}</option>
-				{/foreach}
-			  </select>
-			{elseif $setting.type=="text"}
-				<textarea name="{$setting.name}" rows="5" style="width:100%">{$key}</textarea>
-			{/if}			
-			{include file="$admintemplatepath/validate.template" field=$setting.name message=$locale->tr("error_incorrect_value")}			
-		</td>
-		<td>
-			<select name="canOverride[{$setting.name}]">		 
-				<option value="1" {if $overrideValue==1}selected="selected"{/if}>{$locale->tr("user_can_override")}</option>
-				<option value="2" {if $overrideValue==2}selected="selected"{/if}>{$locale->tr("user_cannot_override")}</option>
-			</select>			
-		</td>
-		</tr>
-	 {/foreach}
-	  </table>	
+			<td>{$setting.name}</td>
+			<td style="width:100%">
+				{if $setting.type=="boolean"}								 
+				 <input type="checkbox" name="{$setting.name}" value="1" class="checkbox" {if $key}checked="checked"{/if}/>
+				 {elseif $setting.type=="string"}		 
+				 <input type="text" name="{$setting.name}" value="{$key}" />
+				 {elseif $setting.type=="integer"}
+				 <input type="text" name="{$setting.name}" value="{$key}" />
+				 {elseif $setting.type=="list"}
+				  <select name="{$setting.name}">
+					{assign var=options value=$setting.options}
+					{foreach from=$options item=name key=value}
+						<option value="{$value}" {if $key==$value}selected="selected"{/if}>{$name}</option>
+					{/foreach}
+				  </select>
+				{elseif $setting.type=="text"}
+					<textarea name="{$setting.name}" rows="5" style="width:100%">{$key}</textarea>
+				{/if}			
+				{include file="$admintemplatepath/validate.template" field=$setting.name message=$locale->tr("error_incorrect_value")}			
+			</td>
+			<td>
+				<select name="canOverride[{$setting.name}]">		 
+					<option value="1" {if $overrideValue==1}selected="selected"{/if}>{$locale->tr("user_can_override")}</option>
+					<option value="2" {if $overrideValue==2}selected="selected"{/if}>{$locale->tr("user_cannot_override")}</option>
+				</select>			
+			</td>
+			</tr>
+		 {/foreach}
+		  </table>
+	  {/if}	
    {/foreach}
 </fieldset>
 <div id="list_action_bar">



More information about the pLog-svn mailing list