[pLog-svn] r1050 - in plugins/trunk/smileys: . class class/action class/view icons/default icons/default-small icons/msn icons/simple locale templates

mark at devel.plogworld.net mark at devel.plogworld.net
Sat Feb 12 19:12:26 GMT 2005


Author: mark
Date: 2005-02-12 19:12:26 +0000 (Sat, 12 Feb 2005)
New Revision: 1050

Added:
   plugins/trunk/smileys/class/view/
   plugins/trunk/smileys/class/view/pluginsmileysconfigview.class.php
   plugins/trunk/smileys/locale/locale_zh_TW.php
Removed:
   plugins/trunk/smileys/icons/default/CVS/
   plugins/trunk/smileys/icons/msn/CVS/
   plugins/trunk/smileys/icons/simple/CVS/
Modified:
   plugins/trunk/smileys/class/action/pluginsmileysconfigaction.class.php
   plugins/trunk/smileys/class/action/pluginsmileysupdateconfigaction.class.php
   plugins/trunk/smileys/icons/default-small/emoticons.properties.php
   plugins/trunk/smileys/icons/default/emoticons.properties.php
   plugins/trunk/smileys/icons/msn/emoticons.properties.php
   plugins/trunk/smileys/icons/simple/emoticons.properties.php
   plugins/trunk/smileys/locale/locale_en_UK.php
   plugins/trunk/smileys/pluginsmileys.class.php
   plugins/trunk/smileys/templates/smileys.template
Log:
Apply smileys plugin follow new UI guideline, and also add new locale - zh_TW.

Modified: plugins/trunk/smileys/class/action/pluginsmileysconfigaction.class.php
===================================================================
--- plugins/trunk/smileys/class/action/pluginsmileysconfigaction.class.php	2005-02-12 19:10:33 UTC (rev 1049)
+++ plugins/trunk/smileys/class/action/pluginsmileysconfigaction.class.php	2005-02-12 19:12:26 UTC (rev 1050)
@@ -1,7 +1,7 @@
 <?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/smileys/class/view/pluginsmileysconfigview.class.php" );		
 
 	/**
 	 * shows a form with the current configuration
@@ -16,18 +16,8 @@
 		
 		function perform()
 		{
-			// load some configuration settings
-			$blogSettings = $this->_blogInfo->getSettings();
-			$pluginEnabled = $blogSettings->getValue( "plugin_smileys_enabled" );
-			$smileySet = $blogSettings->getValue( "plugin_smileys_iconset" );
-			$smileySets = Smileys::scanSmileysFolder();
+            $this->_view = new PluginSmileysConfigView( $this->_blogInfo );
 			
-			// create a view and export the settings to the template
-			$this->_view = new AdminPluginTemplatedView( $this->_blogInfo, "smileys", "smileys", true );
-			$this->_view->setValue( "pluginEnabled", $pluginEnabled );
-			$this->_view->setValue( "smileyset", $smileySet );
-			$this->_view->setValue( "smileysets", $smileySets );			
-			
 			$this->setCommonData();
 			
 			return true;

Modified: plugins/trunk/smileys/class/action/pluginsmileysupdateconfigaction.class.php
===================================================================
--- plugins/trunk/smileys/class/action/pluginsmileysupdateconfigaction.class.php	2005-02-12 19:10:33 UTC (rev 1049)
+++ plugins/trunk/smileys/class/action/pluginsmileysupdateconfigaction.class.php	2005-02-12 19:12:26 UTC (rev 1050)
@@ -1,8 +1,7 @@
 <?php
 
 	include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
-    include_once( PLOG_CLASS_PATH."class/view/admin/adminerrorview.class.php" );
-	include_once( PLOG_CLASS_PATH."class/view/admin/adminmessageview.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/smileys/class/view/pluginsmileysconfigview.class.php" );		
 		
 	/**
 	 * updates the plugin configuration
@@ -23,8 +22,7 @@
             $this->_pluginEnabled = $this->_request->getValue( "pluginEnabled" );
             $this->_pluginEnabled = ($this->_pluginEnabled != "" );			
             $this->_smileySet = $this->_request->getValue( "setId" );
-            if( $smileySet == "" )
-                $smileySet = DEFAULT_SMILEY_SET;
+            if( $smileySet == "" ) $smileySet = DEFAULT_SMILEY_SET;
 			
 			return true;
 		}
@@ -40,8 +38,8 @@
 			// save the blogs settings
 			$blogs = new Blogs();
             if( !$blogs->updateBlog( $this->_blogInfo->getId(), $this->_blogInfo )) {
-                $this->_view = new AdminErrorView( $this->_blogInfo );
-                $this->_view->setValue( "message", $this->_locale->tr("error_updating_settings"));
+                $this->_view = new PluginSmileysConfigView( $this->_blogInfo );
+                $this->_view->setErrorMessage( $this->_locale->tr("error_updating_settings"));
                 $this->setCommonData();
 
                 return false;
@@ -52,8 +50,8 @@
             $this->_session->setValue( "blogInfo", $this->_blogInfo );
             $this->saveSession();
 			
-			$this->_view = new AdminMessageView( $this->_blogInfo );
-			$this->_view->setMessage( $this->_locale->tr("smiley_settings_saved_ok"));
+			$this->_view = new PluginSmileysConfigView( $this->_blogInfo );
+			$this->_view->setSuccessMessage( $this->_locale->tr("smileys_settings_saved_ok"));
 			$this->setCommonData();
             
             return true;		

Added: plugins/trunk/smileys/class/view/pluginsmileysconfigview.class.php
===================================================================
--- plugins/trunk/smileys/class/view/pluginsmileysconfigview.class.php	2005-02-12 19:10:33 UTC (rev 1049)
+++ plugins/trunk/smileys/class/view/pluginsmileysconfigview.class.php	2005-02-12 19:12:26 UTC (rev 1050)
@@ -0,0 +1,33 @@
+<?php
+	
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+
+	/**
+	 * implements the main view of the feed reader plugin
+	 */
+	class PluginSmileysConfigView extends AdminPluginTemplatedView
+	{
+
+		function PluginSmileysConfigView( $blogInfo )
+		{
+			$this->AdminPluginTemplatedView( $blogInfo, "smileys", "smileys" );
+		}
+		
+		function render()
+		{
+			$blogSettings = $this->_blogInfo->getSettings();
+			$pluginEnabled = $blogSettings->getValue( "plugin_smileys_enabled" );
+			$smileySet = $blogSettings->getValue( "plugin_smileys_iconset" );
+			if ($smileySet == "") $smileySet = "default";
+			
+			$smileySets = Smileys::scanSmileysFolder();
+			
+			// create a view and export the settings to the template
+			$this->setValue( "pluginEnabled", $pluginEnabled );
+			$this->setValue( "smileyset", $smileySet );
+			$this->setValue( "smileysets", $smileySets );
+			
+			parent::render();
+		}
+	}
+?>
\ No newline at end of file

Modified: plugins/trunk/smileys/icons/default/emoticons.properties.php
===================================================================
--- plugins/trunk/smileys/icons/default/emoticons.properties.php	2005-02-12 19:10:33 UTC (rev 1049)
+++ plugins/trunk/smileys/icons/default/emoticons.properties.php	2005-02-12 19:12:26 UTC (rev 1050)
@@ -4,7 +4,7 @@
      * emoticons file mapping
      */
      
-    $smileys_description = "Default set of smileys";
+    $smileys_description = "Default";
     
     $smileys = Array (
         "=)" => "regular_smile.gif",

Modified: plugins/trunk/smileys/icons/default-small/emoticons.properties.php
===================================================================
--- plugins/trunk/smileys/icons/default-small/emoticons.properties.php	2005-02-12 19:10:33 UTC (rev 1049)
+++ plugins/trunk/smileys/icons/default-small/emoticons.properties.php	2005-02-12 19:12:26 UTC (rev 1050)
@@ -4,7 +4,7 @@
      * emoticons file mapping
      */
      
-    $smileys_description = "Default set of smileys, in 12x12 pixels size";
+    $smileys_description = "Small";
     
     $smileys = Array (
         "=)" => "regular_smile.gif",

Modified: plugins/trunk/smileys/icons/msn/emoticons.properties.php
===================================================================
--- plugins/trunk/smileys/icons/msn/emoticons.properties.php	2005-02-12 19:10:33 UTC (rev 1049)
+++ plugins/trunk/smileys/icons/msn/emoticons.properties.php	2005-02-12 19:12:26 UTC (rev 1050)
@@ -4,7 +4,7 @@
      * emoticons file mapping
      */
      
-    $smileys_description = "Smiley files borrowed from MSN Messenger"; 
+    $smileys_description = "MSN Messenger"; 
     
     $smileys = Array (
         ":)" => "smile.png",

Modified: plugins/trunk/smileys/icons/simple/emoticons.properties.php
===================================================================
--- plugins/trunk/smileys/icons/simple/emoticons.properties.php	2005-02-12 19:10:33 UTC (rev 1049)
+++ plugins/trunk/smileys/icons/simple/emoticons.properties.php	2005-02-12 19:12:26 UTC (rev 1050)
@@ -4,7 +4,7 @@
      * emoticons file mapping
      */
      
-    $smileys_description = "Simpler smiley set";
+    $smileys_description = "Simpler";
     
     $smileys = Array (
         "=)" => "smiley_smile.gif",

Modified: plugins/trunk/smileys/locale/locale_en_UK.php
===================================================================
--- plugins/trunk/smileys/locale/locale_en_UK.php	2005-02-12 19:10:33 UTC (rev 1049)
+++ plugins/trunk/smileys/locale/locale_en_UK.php	2005-02-12 19:12:26 UTC (rev 1050)
@@ -1,7 +1,16 @@
 <?php
-$messages["smileys_select_one"] = "Please select one of the following sets of smileys:";
+$messages["manageAppearancePlugins"] = "Appearance Management";
+$messages["Smileys"] = "Smileys";
+
+$messages["smileys_default"] = "Choose Default Smileys Set";
+$messages["smileys_name"] = "Name";
+$messages["smileys_image"] = "Smileys Set";
 $messages["smileys_plugin_enabled"] = "Enable this plugin";
 $messages["smileys_plugin"] = "Smileys Plugin";
-$messages["smiley_settings_saved_ok"] = "Smiley settings saved successfully!";
-$messages["Smileys"] = "Smileys";
+
+$messages["smileys_settings_saved_ok"] = "Smileys settings saved successfully!";
+
+$messages["label_configuration"] = "Configuration";
+$messages["label_enable"] = "Enable";
+$messages["label_default"] = "Default";
 ?>
\ No newline at end of file

Added: plugins/trunk/smileys/locale/locale_zh_TW.php
===================================================================
--- plugins/trunk/smileys/locale/locale_zh_TW.php	2005-02-12 19:10:33 UTC (rev 1049)
+++ plugins/trunk/smileys/locale/locale_zh_TW.php	2005-02-12 19:12:26 UTC (rev 1050)
@@ -0,0 +1,16 @@
+<?php
+$messages["manageAppearancePlugins"] = "網誌外觀管理";
+$messages["Smileys"] = "表情符號設定";
+
+$messages["smileys_default"] = "選擇預設表情符號";
+$messages["smileys_name"] = "檔名";
+$messages["smileys_image"] = "圖像";
+$messages["smileys_plugin_enabled"] = "啟動外掛程式";
+$messages["smileys_plugin"] = "表情符號外掛程式";
+
+$messages["smileys_settings_saved_ok"] = "表情符號設定儲存成功。";
+
+$messages["label_configuration"] = "設定";
+$messages["label_enable"] = "å•Ÿå‹•";
+$messages["label_default"] = "預設";
+?>
\ No newline at end of file

Modified: plugins/trunk/smileys/pluginsmileys.class.php
===================================================================
--- plugins/trunk/smileys/pluginsmileys.class.php	2005-02-12 19:10:33 UTC (rev 1049)
+++ plugins/trunk/smileys/pluginsmileys.class.php	2005-02-12 19:12:26 UTC (rev 1050)
@@ -2,7 +2,6 @@
 
     include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );	
 	include_once( PLOG_CLASS_PATH."plugins/smileys/class/smileys/smileys.class.php" );
-	
 	include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
     
     define( "DEFAULT_SMILEY_SET", "default" );
@@ -24,26 +23,39 @@
 			// ---
 			// set some information
 			// ---
-            $this->desc = "A sample plugin, but waaaay too complex...";
+			$this->id = "smileys";
             $this->author = "The pLog Team";
-			$this->id = "smileys";
-			$this->locales = Array( "en_UK" );
-			
+            $this->desc = "The plugin offer smiley to comment and article.";
+
+			$this->locales = Array( "en_UK", "zh_TW" );
+
+            $this->init();  
+        }
+
+		function init()
+		{
 			// ---
 			// register two actions for this plugin plus an option in the menu
 			// ---
             $this->registerAdminAction( "smileys", "PluginSmileysConfigAction" );
 			$this->registerAdminAction( "updateSmileysConfig", "PluginSmileysUpdateConfigAction" );
-            $this->addMenuEntry( "/menu/controlCenter/manageSettings", "Smileys", "?op=smileys", "" );
 			
 			// ---
+			// register two actions for this plugin plus an option in the menu
+			// ---
+			$menu =& Menu::getMenu();
+			if( !$menu->entryExists( "/menu/controlCenter/manageAppearancePlugins" ))						
+				$this->addMenuEntry( "/menu/controlCenter", "manageAppearancePlugins", "", "", true, false );			
+            $this->addMenuEntry( "/menu/controlCenter/manageAppearancePlugins", "Smileys", "?op=smileys", "" );
+
+			// ---
 			// finally, register the event-based plugin that will finally take care of 
 			// 'translating' the smileys
 			// ---
 			$this->registerNotification( EVENT_POST_LOADED );
 			$this->registerNotification( EVENT_POSTS_LOADED );			
-        }
-		
+		}
+
 		function _smileizePost( $post, $smileySet, $smileys )
 		{
 			// modify the text...

Modified: plugins/trunk/smileys/templates/smileys.template
===================================================================
--- plugins/trunk/smileys/templates/smileys.template	2005-02-12 19:10:33 UTC (rev 1049)
+++ plugins/trunk/smileys/templates/smileys.template	2005-02-12 19:12:26 UTC (rev 1050)
@@ -1,24 +1,54 @@
 {include file="$admintemplatepath/header.template"}
-{include file="$admintemplatepath/navigation.template" showOpt=Smileys title=$locale->tr("Smileys")}
+{include file="$admintemplatepath/navigation.template" showOpt=Smileys title=$locale->tr("smileys_plugin")}
 <form name="smileysPluginConfig" method="post">
-  
- <p>{$locale->tr("smileys_select_one")}</p>
+ <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>
+   <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("smileys_plugin_enabled")}
+   </div>
+  </div> 
 
- {foreach from=$smileysets item=set key=setkey}
-  <p>
-  <b>{$set.description}</b><br/>
-  <input type="radio" name="setId" value="{$setkey}" {if $smileyset==$setkey} checked="checked" {/if} />
-  {foreach from=$set.smileys key=smiley item=img}
-   <img src="{$url->getUrl("/plugins/smileys/icons/$setkey/$img")}" alt="{$smiley}" />
-  {/foreach}
-  </p>
- {/foreach}
-
- {$locale->tr("smileys_plugin_enabled")}
- <input type="checkbox" name="pluginEnabled" {if $pluginEnabled} checked="checked" {/if} value="1" />
- <br/><br/>
- <input type="hidden" name="op" value="updateSmileysConfig" />
- <input type="submit" name="{$locale->tr("update_settings")}" value="{$locale->tr("update")}" />
+  <div class="field">
+  <label for="default">{$locale->tr("label_default")}</label>
+  <span class="required"></span>
+  <div class="formHelp">{$locale->tr("smileys_default")}</div>
+    <table>
+    <thead>
+     <tr>
+      <th style="width:20px;"></th>
+      <th style="width:130px;">{$locale->tr("smileys_name")}</th>
+      <th style="width:450px;">{$locale->tr("smileys_image")}</th>
+     </tr>
+    </thead>
+    <tbody> 
+     {foreach from=$smileysets item=set key=setkey}
+     <tr>
+      <td>
+       <input class="radio" type="radio" name="setId" id="setId" value="{$setkey}" {if $smileyset==$setkey} checked="checked" {/if} />
+      </td>
+      <td>
+       {$set.description}
+      </td>
+      <td>
+       {foreach from=$set.smileys key=smiley item=img}
+        <img src="{$url->getUrl("/plugins/smileys/icons/$setkey/$img")}" alt="{$smiley}" />
+       {/foreach}
+     </tr> 
+     {/foreach}
+    </tbody>
+   </table>
+    </div>
+ </fieldset>
+ <div class="buttons">
+  <input type="hidden" name="op" value="updateSmileysConfig" />
+  <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