[pLog-svn] r5215 - in plugins/branches/lifetype-1.2: . embedmedia embedmedia/class embedmedia/class/action embedmedia/class/view embedmedia/locale embedmedia/templates

mark at devel.lifetype.net mark at devel.lifetype.net
Thu Mar 29 01:53:31 EDT 2007


Author: mark
Date: 2007-03-29 01:53:31 -0400 (Thu, 29 Mar 2007)
New Revision: 5215

Added:
   plugins/branches/lifetype-1.2/embedmedia/
   plugins/branches/lifetype-1.2/embedmedia/class/
   plugins/branches/lifetype-1.2/embedmedia/class/action/
   plugins/branches/lifetype-1.2/embedmedia/class/action/pluginembedmediaconfigaction.class.php
   plugins/branches/lifetype-1.2/embedmedia/class/action/pluginembedmediaupdateconfigaction.class.php
   plugins/branches/lifetype-1.2/embedmedia/class/view/
   plugins/branches/lifetype-1.2/embedmedia/class/view/pluginembedmediaconfigview.class.php
   plugins/branches/lifetype-1.2/embedmedia/locale/
   plugins/branches/lifetype-1.2/embedmedia/locale/locale_en_UK.php
   plugins/branches/lifetype-1.2/embedmedia/locale/locale_zh_TW.php
   plugins/branches/lifetype-1.2/embedmedia/pluginembedmedia.class.php
   plugins/branches/lifetype-1.2/embedmedia/readme-zh_TW.txt
   plugins/branches/lifetype-1.2/embedmedia/readme.txt
   plugins/branches/lifetype-1.2/embedmedia/templates/
   plugins/branches/lifetype-1.2/embedmedia/templates/embedmedia.template
Log:
Commit a new embed background music plugin from user contribution here:
http://forum.lifetype.org.tw/index.php?topic=3529.0

Added: plugins/branches/lifetype-1.2/embedmedia/class/action/pluginembedmediaconfigaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/embedmedia/class/action/pluginembedmediaconfigaction.class.php	                        (rev 0)
+++ plugins/branches/lifetype-1.2/embedmedia/class/action/pluginembedmediaconfigaction.class.php	2007-03-29 05:53:31 UTC (rev 5215)
@@ -0,0 +1,23 @@
+<?php
+
+lt_include(PLOG_CLASS_PATH.'class/action/admin/adminaction.class.php');
+lt_include(PLOG_CLASS_PATH.'class/view/admin/adminplugintemplatedview.class.php');
+lt_include(PLOG_CLASS_PATH.'plugins/embedmedia/class/view/pluginembedmediaconfigview.class.php');
+
+// shows a form with the current configuration
+class PluginEmbedMediaConfigAction extends AdminAction
+{
+	function PluginEmbedMediaConfigAction($actionInfo, $request)
+	{
+		$this->AdminAction($actionInfo, $request);
+	}
+
+	function perform()
+	{
+        $this->_view = new PluginEmbedMediaConfigView($this->_blogInfo);
+		$this->setCommonData();
+		return true;
+	}
+}
+
+?>

Added: plugins/branches/lifetype-1.2/embedmedia/class/action/pluginembedmediaupdateconfigaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/embedmedia/class/action/pluginembedmediaupdateconfigaction.class.php	                        (rev 0)
+++ plugins/branches/lifetype-1.2/embedmedia/class/action/pluginembedmediaupdateconfigaction.class.php	2007-03-29 05:53:31 UTC (rev 5215)
@@ -0,0 +1,99 @@
+<?php
+
+lt_include(PLOG_CLASS_PATH.'class/action/admin/adminaction.class.php');
+lt_include(PLOG_CLASS_PATH.'class/view/admin/adminplugintemplatedview.class.php');
+lt_include(PLOG_CLASS_PATH.'plugins/embedmedia/class/view/pluginembedmediaconfigview.class.php');
+
+// updates the plugin configuration
+class PluginEmbedMediaUpdateConfigAction extends AdminAction
+{
+    var $_pluginEnabled;
+    var $_SRC;
+    var $_Auto;
+    var $_Loop;
+    var $_MusicName;
+    var $_Vol;
+    var $_Width;
+    var $_Height;
+    var $_Hidden;
+
+	function PluginStickyPostsUpdateConfigAction($actionInfo, $request)
+	{
+		$this->AdminAction($actionInfo, $request);
+	}
+
+	function validate()
+	{
+        $errorMessages = array();
+		$this->_pluginEnabled = $this->_request->getValue('pluginEnabled');
+        $this->_pluginEnabled = ($this->_pluginEnabled != '');
+
+		$this->_SRC = $this->_request->getValue('SRC');
+		if ($this->_pluginEnabled && empty($this->_SRC)) {
+            $errorMessages[] = 'embedmedia_error_SRC';
+			$isError = true;
+		}
+
+		$this->_Auto = $this->_request->getValue('Auto');
+		$this->_Loop = $this->_request->getValue('Loop');
+		$this->_MusicName = $this->_request->getValue('MusicName');
+		$this->_Vol = $this->_request->getValue('Vol');
+		$this->_Width = $this->_request->getValue('Width');
+		$this->_Height = $this->_request->getValue('Height');
+		$this->_Hidden = $this->_request->getValue('Hidden');
+
+		if (count($errorMessages) > 0) {
+            $this->_view = new PluginEmbedMediaConfigView($this->_blogInfo);
+			$allerror='';
+			foreach ($errorMessages as $error) {
+				$allerror .= $this->_locale->tr($error).'<br />';
+			}
+            $this->_view->setErrorMessage($this->_locale->tr($allerror));
+            $this->setCommonData();
+            return false;
+        }
+
+        return true;
+    }
+
+	function perform()
+	{
+        // // update the plugin configurations to blog setting
+		$blogSettings = $this->_blogInfo->getSettings();
+        $blogSettings->setValue('plugin_embedmedia_enabled', $this->_pluginEnabled);
+        $blogSettings->setValue('plugin_embedmedia_SRC', $this->_SRC);
+        $blogSettings->setValue('plugin_embedmedia_Auto', $this->_Auto);
+        $blogSettings->setValue('plugin_embedmedia_Loop', $this->_Loop);
+        $blogSettings->setValue('plugin_embedmedia_MusicName', $this->_MusicName);
+        $blogSettings->setValue('plugin_embedmedia_Vol', $this->_Vol);
+        $blogSettings->setValue('plugin_embedmedia_Width', $this->_Width);
+        $blogSettings->setValue('plugin_embedmedia_Height', $this->_Height);
+        $blogSettings->setValue('plugin_embedmedia_Hidden', $this->_Hidden);
+        $this->_blogInfo->setSettings($blogSettings);
+
+        // save the blogs settings
+		$blogs = new Blogs();
+        if (!$blogs->updateBlog($this->_blogInfo)) {
+            $this->_view = new PluginStickyPostsConfigView($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 PluginEmbedMediaConfigView($this->_blogInfo);
+		$this->_view->setSuccessMessage($this->_locale->tr('embedmedia_settings_saved_ok'));
+		$this->setCommonData();
+
+		// clear the cache
+		CacheControl::resetBlogCache($this->_blogInfo->getId());
+
+        return true;
+	}
+}
+
+?>

Added: plugins/branches/lifetype-1.2/embedmedia/class/view/pluginembedmediaconfigview.class.php
===================================================================
--- plugins/branches/lifetype-1.2/embedmedia/class/view/pluginembedmediaconfigview.class.php	                        (rev 0)
+++ plugins/branches/lifetype-1.2/embedmedia/class/view/pluginembedmediaconfigview.class.php	2007-03-29 05:53:31 UTC (rev 5215)
@@ -0,0 +1,42 @@
+<?php
+
+lt_include(PLOG_CLASS_PATH.'class/view/admin/adminplugintemplatedview.class.php');
+
+// implements the main view of the google adsense plugin
+class PluginEmbedMediaConfigView extends AdminPluginTemplatedView
+{
+    function PluginEmbedMediaConfigView($blogInfo)
+	{
+		$this->AdminPluginTemplatedView($blogInfo, 'embedmedia', 'embedmedia');
+	}
+
+	function render()
+	{
+		// load some configuration settings
+		$blogSettings = $this->_blogInfo->getSettings();
+		$pluginEnabled = $blogSettings->getValue('plugin_embedmedia_enabled');
+		$SRC = $blogSettings->getValue('plugin_embedmedia_SRC');
+		$Auto = $blogSettings->getValue('plugin_embedmedia_Auto');
+		$Loop = $blogSettings->getValue('plugin_embedmedia_Loop');
+		$MusicName = $blogSettings->getValue('plugin_embedmedia_MusicName');
+		$Vol = $blogSettings->getValue('plugin_embedmedia_Vol');
+		$Width = $blogSettings->getValue('plugin_embedmedia_Width');
+		$Height = $blogSettings->getValue('plugin_embedmedia_Height');
+		$Hidden = $blogSettings->getValue('plugin_embedmedia_Hidden');
+
+		// create a view and export the settings to the template
+		$this->setValue('pluginEnabled', $pluginEnabled);
+		$this->setValue('SRC', $SRC);
+		$this->setValue('Auto', $Auto);
+		$this->setValue('Loop', $Loop);
+		$this->setValue('MusicName', $MusicName);
+		$this->setValue('Vol', $Vol);
+		$this->setValue('Width', $Width);
+		$this->setValue('Height', $Height);
+		$this->setValue('Hidden', $Hidden);
+
+		parent::render();
+	}
+}
+
+?>

Added: plugins/branches/lifetype-1.2/embedmedia/locale/locale_en_UK.php
===================================================================
--- plugins/branches/lifetype-1.2/embedmedia/locale/locale_en_UK.php	                        (rev 0)
+++ plugins/branches/lifetype-1.2/embedmedia/locale/locale_en_UK.php	2007-03-29 05:53:31 UTC (rev 5215)
@@ -0,0 +1,32 @@
+<?php
+
+$messages['embedmedia'] = 'Embed Media';
+$messages['EmbedMedia'] = 'Embed Media';
+$messages['embedmedia_plugin'] = 'Embed Media Configuration';
+
+$messages['embedmedia_plugin_enabled'] = 'Enable Embed Media.';
+
+$messages['label_MusicName'] = 'MusicName';
+$messages['embedmedia_MusicName'] = 'Choice.';
+
+$messages['label_SRC'] = 'mediafiles URL';
+$messages['embedmedia_SRC'] = 'Please type your media URL.';
+$messages['embedmedia_error_SRC'] = 'You must fill in the mediafile URL.';
+
+$messages['label_Auto'] = 'AutoStart';
+$messages['embedmedia_plugin_Auto'] = 'Enable AutoStart.';
+$messages['label_Loop'] = 'Loop';
+$messages['embedmedia_Loop'] = 'Enable Loop.';
+$messages['label_Vol'] = 'Volume';
+$messages['embedmedia_Vol'] = 'Volume 0-99.';
+$messages['label_Width'] = 'Embed (width)';
+$messages['embedmedia_Width'] = '(width)¡Aex:150.';
+$messages['label_Height'] = 'Embed (height)';
+$messages['embedmedia_Height'] = '(height)¡Aex:45.';
+$messages['label_Hidden'] = 'Embad Visable';
+$messages['embedmedia_Hidden'] = 'Disabele Hidden Embed.';
+
+$messages['embedmedia_settings_saved_ok'] = 'Embed Media configuration update successed!';
+
+?>
+

Added: plugins/branches/lifetype-1.2/embedmedia/locale/locale_zh_TW.php
===================================================================
--- plugins/branches/lifetype-1.2/embedmedia/locale/locale_zh_TW.php	                        (rev 0)
+++ plugins/branches/lifetype-1.2/embedmedia/locale/locale_zh_TW.php	2007-03-29 05:53:31 UTC (rev 5215)
@@ -0,0 +1,31 @@
+<?php
+
+$messages['embedmedia'] = '多媒體播放器';
+$messages['EmbedMedia'] = '多媒體播放器';
+$messages['embedmedia_plugin'] = '多媒體播放器設定';
+
+$messages['embedmedia_plugin_enabled'] = '啟用多媒體播放器外掛程式.';
+
+$messages['label_MusicName'] = '顯示名稱';
+$messages['embedmedia_MusicName'] = '請填入你的媒體檔顯示名稱.';
+
+$messages['label_SRC'] = '媒體位置';
+$messages['embedmedia_SRC'] = '請填入你的媒體檔案網址.';
+$messages['embedmedia_error_SRC'] = '你必須填入媒體檔案位置.';
+
+$messages['label_Auto'] = '自動播放';
+$messages['embedmedia_plugin_Auto'] = '啟用自動播放.';
+$messages['label_Loop'] = '循環播放';
+$messages['embedmedia_Loop'] = '啟用循環播放.';
+$messages['label_Vol'] = '聲音大小';
+$messages['embedmedia_Vol'] = '設定聲音大小 0-99.';
+$messages['label_Width'] = '播放器寬度 (width)';
+$messages['embedmedia_Width'] = '播放器寬度 (width),建議 150.';
+$messages['label_Height'] = '播放器高度 (height)';
+$messages['embedmedia_Height'] = '播放器寬度 (height),建議 45.';
+$messages['label_Hidden'] = '顯示播放器';
+$messages['embedmedia_Hidden'] = '取消勾選的話則隱藏播放器.';
+
+$messages['embedmedia_settings_saved_ok'] = '多媒體播放器設定儲存成功!';
+
+?>

Added: plugins/branches/lifetype-1.2/embedmedia/pluginembedmedia.class.php
===================================================================
--- plugins/branches/lifetype-1.2/embedmedia/pluginembedmedia.class.php	                        (rev 0)
+++ plugins/branches/lifetype-1.2/embedmedia/pluginembedmedia.class.php	2007-03-29 05:53:31 UTC (rev 5215)
@@ -0,0 +1,102 @@
+<?php
+
+lt_include(PLOG_CLASS_PATH.'class/plugin/pluginbase.class.php');
+
+class PluginEmbedMedia extends PluginBase
+{
+    var $pluginEnabled;
+    var $SRC;
+    var $Auto;
+    var $Loop;
+    var $MusicName;
+    var $Vol;
+    var $Width;
+    var $Height;
+    var $Hidden;
+
+    function PluginEmbedMedia($source = "")
+    {
+        $this->PluginBase($source);
+        $this->id = 'embedmedia';
+        $this->author = 'Marco Yan';
+        $this->desc = "This plugin offers features to support Media Embed.";
+        $this->version = '1.0';
+        $this->locales = array('en_UK', 'zh_TW');
+	if ($source == "admin")
+            $this->initAdmin();
+    }
+
+    function initAdmin()
+    {
+        $this->registerAdminAction('embedmedia', 'PluginEmbedMediaConfigAction');
+        $this->registerAdminAction('updateembedmedia', 'PluginEmbedMediaUpdateConfigAction');
+        $menu =& Menu::getMenu();
+        $this->addMenuEntry('/menu/controlCenter/manageSettings', 'EmbedMedia', '?op=embedmedia');
+    }
+
+    function register()
+	{
+        $blogSettings = $this->blogInfo->getSettings();
+        $this->pluginEnabled = $blogSettings->getValue('plugin_embedmedia_enabled');
+
+        $this->SRC = $blogSettings->getValue('plugin_embedmedia_SRC');
+        $this->Auto = $blogSettings->getValue('plugin_embedmedia_Auto');
+        $this->Loop = $blogSettings->getValue('plugin_embedmedia_Loop');
+        $this->MusicName = $blogSettings->getValue('plugin_embedmedia_MusicName');
+        $this->Vol = $blogSettings->getValue('plugin_embedmedia_Vol');
+        $this->Width = $blogSettings->getValue('plugin_embedmedia_Width');
+        $this->Height = $blogSettings->getValue('plugin_embedmedia_Height');
+        $this->Hidden = $blogSettings->getValue('plugin_embedmedia_Hidden');
+
+    }
+
+    function isEnabled()
+    {
+        return $this->pluginEnabled;
+    }
+    
+    // content
+    function getSRC()
+    {
+        return $this->SRC;
+    }
+
+    function getAuto()
+    {
+        return $this->Auto;
+    }
+
+    function getLoop()
+    {
+        return $this->Loop;
+    }
+
+    function getMusicName()
+    {
+        return $this->MusicName;
+    }
+
+    function getVol()
+    {
+        return $this->Vol;
+    }
+
+    // suggestion
+    function getWidth()
+    {
+        return $this->Width;
+    }
+
+    function getHeight()
+    {
+        return $this->Height;
+    }
+
+    function getHidden()
+    {
+        return $this->Hidden;
+    }
+
+}
+
+?>

Added: plugins/branches/lifetype-1.2/embedmedia/readme-zh_TW.txt
===================================================================
--- plugins/branches/lifetype-1.2/embedmedia/readme-zh_TW.txt	                        (rev 0)
+++ plugins/branches/lifetype-1.2/embedmedia/readme-zh_TW.txt	2007-03-29 05:53:31 UTC (rev 5215)
@@ -0,0 +1,29 @@
+Embed Media Plugin v1.0(20070328)
+
+說明
+這個外掛程式提供管理介面中設定多媒體播放器的相關參數.
+
+安裝
+將下載的外掛程式 zip 檔解壓縮到 lifetype 的 plugins 目錄下, 然後在管理介面的外掛程式中心重新整理網頁,
+便可看到 Embed Media 外掛已經安裝了.
+
+設定
+1.進入管理介面 -> 個人網誌設定 -> 多媒體播放器
+2.啟用外掛程式,並且輸入你的媒體檔案等相關設定.
+
+限制條件
+1.寬度、高度限制在3個字元
+2.顯示名稱限制在40個字元
+3.聲音大小限制在2個字元
+
+
+修改樣版
+{if $embedmedia && $embedmedia->isEnabled()}
+<h2> = Music </h2><p>
+<div>{if $embedmedia->getMusicName()}{$embedmedia->getMusicName()}{/if}
+<div>
+<embed src="{$embedmedia->getSRC()}" height="{$embedmedia->getHeight()}" width="{$embedmedia->getWidth()}" autoStart="{if $embedmedia->getAuto()}{$embedmedia->getAuto()}{else}false{/if}" loop="{if $embedmedia->getLoop()}{$embedmedia->getLoop()}{else}false{/if}" enableContextMenu="0" playcount="65535" volume="{$embedmedia->getVol()}" ShowPositionControls="0" Hidden="{$embedmedia->getHidden()}"></embed>
+
+</div>
+</div>
+{/if}

Added: plugins/branches/lifetype-1.2/embedmedia/readme.txt
===================================================================
--- plugins/branches/lifetype-1.2/embedmedia/readme.txt	                        (rev 0)
+++ plugins/branches/lifetype-1.2/embedmedia/readme.txt	2007-03-29 05:53:31 UTC (rev 5215)
@@ -0,0 +1,23 @@
+Embed Media Plugin v1.0 (20070328)
+
+Description
+Offer setting for Embed Media in LifeType.
+
+Installation
+Just unpack the pluing zip file to your lifetype plugins folder, then refresh browser in plugins center.
+You can find embedmedia plugin installed.
+
+Configuration
+1.Enter admin page, goto control center -> Embed Media.
+2.Enable this plugin and fill in you client code, and detial setting for content, suggestion and search of Embed Media.
+
+Tempalte
+{if $embedmedia && $embedmedia->isEnabled()}
+<h2> = Music </h2><p>
+<div>{if $embedmedia->getMusicName()}{$embedmedia->getMusicName()}{/if}
+<div>
+<embed src="{$embedmedia->getSRC()}" height="{$embedmedia->getHeight()}" width="{$embedmedia->getWidth()}" autoStart="{if $embedmedia->getAuto()}{$embedmedia->getAuto()}{else}false{/if}" loop="{if $embedmedia->getLoop()}{$embedmedia->getLoop()}{else}false{/if}" enableContextMenu="0" playcount="65535" volume="{$embedmedia->getVol()}" ShowPositionControls="0" Hidden="{$embedmedia->getHidden()}"></embed>
+
+</div>
+</div>
+{/if}
\ No newline at end of file

Added: plugins/branches/lifetype-1.2/embedmedia/templates/embedmedia.template
===================================================================
--- plugins/branches/lifetype-1.2/embedmedia/templates/embedmedia.template	                        (rev 0)
+++ plugins/branches/lifetype-1.2/embedmedia/templates/embedmedia.template	2007-03-29 05:53:31 UTC (rev 5215)
@@ -0,0 +1,77 @@
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=EmbedMedia MusicName=$locale->tr("embedmedia_plugin")}
+<form name="embedmediaPluginConfig" method="post">
+ <fieldset class="inputField">
+ <legend>{$locale->tr("embedmedia_plugin")}</legend>
+  {include file="$admintemplatepath/successmessage.template"}
+  {include file="$admintemplatepath/errormessage.template"}
+
+  <div class="field"><p>
+   <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("embedmedia_plugin_enabled")}
+   </div>
+  </div>
+
+  <div class="field">
+   <label for="MusicName">{$locale->tr("label_MusicName")}</label>
+   <span class="required">*</span>
+   <div class="formHelp">{$locale->tr("embedmedia_MusicName")}</div>
+   <input class="text" type="text" name="MusicName" id="MusicName" value="{$MusicName}" width="40" maxlength="40"/>
+  </div>
+
+  <div class="field">
+   <label for="SRC">{$locale->tr("label_SRC")}</label>
+   <span class="required">*</span>
+   <div class="formHelp">{$locale->tr("embedmedia_SRC")}</div>
+   <input class="text" type="text" name="SRC" id="SRC" value="{$SRC}" width="30" />
+  </div>
+
+  <!-- content -->
+  <div class="field">
+   <label for="Auto">{$locale->tr("label_Auto")}</label>
+   <span class="required"></span>
+   <div class="formHelp">
+    <input class="checkbox" type="checkbox" name="Auto" id="Auto" {if $Auto} checked="checked" {/if} value="1" />{$locale->tr("embedmedia_plugin_Auto")}
+   </div>
+  </div>
+
+  <div class="field">
+   <label for="Loop">{$locale->tr("label_Loop")}</label>
+   <div class="formHelp">
+   <input class="checkbox" type="checkbox" name="Loop" id="Loop" {if $Loop} checked="checked" {/if} value="1" />{$locale->tr("embedmedia_Loop")}</div>
+  </div>
+
+  <div class="field">
+   <label for="Vol">{$locale->tr("label_Vol")}</label>
+   <div class="formHelp">{$locale->tr("embedmedia_Vol")}</div>
+   <input class="text" type="text" name="Vol" id="Vol" value="{$Vol}" width="2" maxlength="2"/>
+  </div>
+
+  <div class="field">
+   <label for="Width">{$locale->tr("label_Width")}</label>
+   <div class="formHelp">{$locale->tr("embedmedia_Width")}</div>
+   <input class="text" type="text" name="Width" id="Width" value="{$Width}" width="3" maxlength="3"/>
+  </div>
+
+  <div class="field">
+   <label for="Height">{$locale->tr("label_Height")}</label>
+   <div class="formHelp">{$locale->tr("embedmedia_Height")}</div>
+   <input class="text" type="text" name="Height" id="Height" value="{$Height}" width="3" maxlength="3"/>
+  </div>
+
+  <div class="field">
+   <label for="Hidden">{$locale->tr("label_Hidden")}</label>
+   <div class="formHelp">
+   <input class="checkbox" type="checkbox" name="Hidden" id="Hidden" {if $Hidden} checked="checked" {/if} value="1" />{$locale->tr("embedmedia_Hidden")}</div>
+  </div>
+  </div>
+
+ <div class="buttons">
+  <input type="hidden" name="op" value="updateembedmedia" />
+  <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"}



More information about the pLog-svn mailing list