[pLog-svn] r2012 - in plugins/trunk: . stickyposts stickyposts/class stickyposts/class/action stickyposts/class/view stickyposts/locale stickyposts/templates

mark at devel.plogworld.net mark at devel.plogworld.net
Tue May 17 06:32:17 GMT 2005


Author: mark
Date: 2005-05-17 06:32:17 +0000 (Tue, 17 May 2005)
New Revision: 2012

Added:
   plugins/trunk/stickyposts/
   plugins/trunk/stickyposts/class/
   plugins/trunk/stickyposts/class/action/
   plugins/trunk/stickyposts/class/action/pluginstickypostsconfigaction.class.php
   plugins/trunk/stickyposts/class/action/pluginstickypostsupdateconfigaction.class.php
   plugins/trunk/stickyposts/class/view/
   plugins/trunk/stickyposts/class/view/pluginstickypostsconfigview.class.php
   plugins/trunk/stickyposts/locale/
   plugins/trunk/stickyposts/locale/locale_en_UK.php
   plugins/trunk/stickyposts/locale/locale_es_ES.php
   plugins/trunk/stickyposts/locale/locale_zh_CN.php
   plugins/trunk/stickyposts/locale/locale_zh_TW.php
   plugins/trunk/stickyposts/pluginstickyposts.class.php
   plugins/trunk/stickyposts/readme-zh_TW.txt
   plugins/trunk/stickyposts/readme.txt
   plugins/trunk/stickyposts/templates/
   plugins/trunk/stickyposts/templates/stickyposts.template
Log:


Added: plugins/trunk/stickyposts/class/action/pluginstickypostsconfigaction.class.php
===================================================================
--- plugins/trunk/stickyposts/class/action/pluginstickypostsconfigaction.class.php	2005-05-17 05:26:12 UTC (rev 2011)
+++ plugins/trunk/stickyposts/class/action/pluginstickypostsconfigaction.class.php	2005-05-17 06:32:17 UTC (rev 2012)
@@ -0,0 +1,27 @@
+<?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/stickyposts/class/view/pluginstickypostsconfigview.class.php" );	
+
+	/**
+	 * shows a form with the current configuration
+	 */
+	class PluginStickyPostsConfigAction extends AdminAction
+	{
+		
+		function PluginRecentCommentsConfigAction( $actionInfo, $request )
+		{
+			$this->AdminAction( $actionInfo, $request );
+		}
+		
+		function perform()
+		{
+            $this->_view = new PluginStickyPostsConfigView( $this->_blogInfo );
+			
+			$this->setCommonData();
+			
+			return true;
+		}
+	}
+?>
\ No newline at end of file

Added: plugins/trunk/stickyposts/class/action/pluginstickypostsupdateconfigaction.class.php
===================================================================
--- plugins/trunk/stickyposts/class/action/pluginstickypostsupdateconfigaction.class.php	2005-05-17 05:26:12 UTC (rev 2011)
+++ plugins/trunk/stickyposts/class/action/pluginstickypostsupdateconfigaction.class.php	2005-05-17 06:32:17 UTC (rev 2012)
@@ -0,0 +1,103 @@
+<?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/stickyposts/class/view/pluginstickypostsconfigview.class.php" );	
+		
+	/**
+	 * updates the plugin configuration
+	 */
+	class PluginStickyPostsUpdateConfigAction extends AdminAction
+	{
+		var $_pluginEnabled;
+		var $_maxStickys;
+		var $_maxAnnounces;
+		var $_stickyCategoryId;
+		var $_announceCategoryId;
+		
+		function PluginStickyPostsUpdateConfigAction( $actionInfo, $request )
+		{
+			$this->AdminAction( $actionInfo, $request );
+		}
+		
+		function validate()
+		{
+            $errorMessages = array();
+			$this->_pluginEnabled = $this->_request->getValue( "pluginEnabled" );
+            $this->_pluginEnabled = ($this->_pluginEnabled != "" );			
+            
+			$this->_maxStickys = $this->_request->getValue( "maxStickys" );
+            if( $this->_maxStickys <= 0  || !ctype_digit($this->_maxStickys) ) {
+                $errorMessages[] = "stickyposts_error_maxstickys";
+				$isError = true;
+			}
+			
+			$this->_maxAnnounces = $this->_request->getValue( "maxAnnounces" );
+            if( $this->_maxAnnounces <= 0  || !ctype_digit($this->_maxAnnounces) ) {
+                $errorMessages[] = "stickyposts_error_maxannounces";
+				$isError = true;
+			}
+			
+			$this->_stickyCategoryId = $this->_request->getValue( "stickyCategoryId" );
+			if( $this->_stickyCategoryId == ""){
+                $errorMessages[] = "stickyposts_error_stickyCategoryId";
+				$isError = true;
+			}
+			
+			$this->_announceCategoryId = $this->_request->getValue( "announceCategoryId" );
+			if( $this->_announceCategoryId == ""){
+                $errorMessages[] = "stickyposts_error_announceCategoryId";
+				$isError = true;
+			}
+
+			if( count($errorMessages) > 0 ) {
+                $this->_view = new PluginStickyPostsConfigView( $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_stickyposts_enabled", $this->_pluginEnabled );
+            $blogSettings->setValue( "plugin_stickyposts_maxstickys", $this->_maxStickys );
+            $blogSettings->setValue( "plugin_stickyposts_maxannounces", $this->_maxAnnounces );
+            $blogSettings->setValue( "plugin_stickyposts_stickycategoryid", $this->_stickyCategoryId );
+            $blogSettings->setValue( "plugin_stickyposts_announcecategoryid", $this->_announceCategoryId );
+            $this->_blogInfo->setSettings( $blogSettings ); 
+		
+			// save the blogs settings
+			$blogs = new Blogs();
+            if( !$blogs->updateBlog( $this->_blogInfo->getId(), $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 PluginStickyPostsConfigView( $this->_blogInfo );
+			$this->_view->setSuccessMessage( $this->_locale->tr("stickyposts_settings_saved_ok"));
+			$this->setCommonData();
+			
+			// clear the cache
+			CacheControl::resetBlogCache( $this->_blogInfo->getId());				
+            
+            return true;		
+		}
+	}
+?>

Added: plugins/trunk/stickyposts/class/view/pluginstickypostsconfigview.class.php
===================================================================
--- plugins/trunk/stickyposts/class/view/pluginstickypostsconfigview.class.php	2005-05-17 05:26:12 UTC (rev 2011)
+++ plugins/trunk/stickyposts/class/view/pluginstickypostsconfigview.class.php	2005-05-17 06:32:17 UTC (rev 2012)
@@ -0,0 +1,48 @@
+<?php
+	
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+
+	/**
+	 * implements the main view of the feed reader plugin
+	 */
+	class PluginStickyPostsConfigView extends AdminPluginTemplatedView
+	{
+
+		function PluginStickyPostsConfigView( $blogInfo )
+		{
+			$this->AdminPluginTemplatedView( $blogInfo, "stickyposts", "stickyposts" );
+		}
+		
+		function render()
+		{
+			// load some configuration settings
+			$blogSettings = $this->_blogInfo->getSettings();
+			$pluginEnabled = $blogSettings->getValue( "plugin_stickyposts_enabled" );
+			$stickyCategoryId = $blogSettings->getValue( "plugin_stickyposts_stickycategoryid");
+			$announceCategoryId = $blogSettings->getValue( "plugin_stickyposts_announcecategoryid");
+			$maxStickys = $blogSettings->getValue( "plugin_stickyposts_maxstickys" );
+			$maxAnnounces = $blogSettings->getValue( "plugin_stickyposts_maxAnnounces" );
+			if ($maxStickys == "") $maxStickys = 5;
+			if ($maxAnnounce == "") $maxAnnounces = 5;
+			
+			//get all categories's id and name as an assoication array
+			$categories = new articleCategories();
+			$blogId = $this->_blogInfo->getId();
+			$allCategories = $categories->getBlogCategories( $blogId );
+			$catNameId = array();
+			foreach( $allCategories as $aCategory ){
+				$catNameId[$aCategory->getId()] = $aCategory->getName();
+			}
+			
+			// create a view and export the settings to the template
+			$this->setValue( "pluginEnabled", $pluginEnabled );
+			$this->setValue( "stickyCategoryId", $stickyCategoryId );
+			$this->setValue( "announceCategoryId", $announceCategoryId );
+			$this->setValue( "catNameId", $catNameId );
+			$this->setValue( "maxStickys", $maxStickys );
+			$this->setValue( "maxAnnounces", $maxAnnounces );
+			
+			parent::render();
+		}
+	}
+?>

Added: plugins/trunk/stickyposts/locale/locale_en_UK.php
===================================================================
--- plugins/trunk/stickyposts/locale/locale_en_UK.php	2005-05-17 05:26:12 UTC (rev 2011)
+++ plugins/trunk/stickyposts/locale/locale_en_UK.php	2005-05-17 06:32:17 UTC (rev 2012)
@@ -0,0 +1,17 @@
+<?php
+$messages["manageRecentPlugins"] = "Recent Activities Management";
+$messages["RecentComments"] = "Recent Comments";
+$messages["recentcomments"] = "Recent Comments";
+$messages["view_comment_by"] = "View comment by %s";
+
+$messages["recentcomments_maxcomments"] = "Maximum Showed Comments";
+$messages["recentcomments_plugin_enabled"] = "Enable this plugin";
+$messages["recentcomments_plugin"] = "Recent Comments Plugin";
+
+$messages["recentcomments_settings_saved_ok"] = "Recent Comments settings saved successfully!";
+$messages["recentcomments_error_maxcomments"] = "Maximum Showed Comments Should > 0!";
+
+$messages["label_configuration"] = "Configuration";
+$messages["label_enable"] = "Enable";
+$messages["label_maxcomments"] = "Max Comments";
+?>
\ No newline at end of file

Added: plugins/trunk/stickyposts/locale/locale_es_ES.php
===================================================================
--- plugins/trunk/stickyposts/locale/locale_es_ES.php	2005-05-17 05:26:12 UTC (rev 2011)
+++ plugins/trunk/stickyposts/locale/locale_es_ES.php	2005-05-17 06:32:17 UTC (rev 2012)
@@ -0,0 +1,22 @@
+<?php
+
+// Translation by Andres Bianciotto plog at a-b.com.ar
+// Date 09/Apr/2005
+//
+
+$messages["manageRecentPlugins"] = "Actividades recientes";
+$messages["RecentComments"] = "Comentarios Recientes";
+$messages["recentcomments"] = "Comentarios recientes";
+$messages["view_comment_by"] = "Ver comentario %s";
+
+$messages["recentcomments_maxcomments"] = "M&aacute;ximo de coment. a mostrar";
+$messages["recentcomments_plugin_enabled"] = "Activar este plugin";
+$messages["recentcomments_plugin"] = "Plugin Comentarios recientes";
+
+$messages["recentcomments_settings_saved_ok"] = "Los datos se han guardado con &eacute;xito";
+$messages["recentcomments_error_maxcomments"] = "El m&aacute;ximo debe ser mayor a 0!";
+
+$messages["label_configuration"] = "Configuraci&oacute;n";
+$messages["label_enable"] = "Activar";
+$messages["label_maxcomments"] = "Comentarios M&aacute;x";
+?>
\ No newline at end of file

Added: plugins/trunk/stickyposts/locale/locale_zh_CN.php
===================================================================
--- plugins/trunk/stickyposts/locale/locale_zh_CN.php	2005-05-17 05:26:12 UTC (rev 2011)
+++ plugins/trunk/stickyposts/locale/locale_zh_CN.php	2005-05-17 06:32:17 UTC (rev 2012)
@@ -0,0 +1,25 @@
+<?php
+$messages["manageRecentPlugins"] = "网志最近活动管理";
+$messages["stickyposts"] = "置顶及公告文章设定";
+$messages["StickyPosts"] = "置顶及公告文章设定";
+
+$messages["stickyposts_maxstikcys"] = "置顶文章显示数量";
+$messages["stickyposts_maxannounces"] = "公告文章显示数量";
+$messages["stickyposts_stickycategory"] = "选择置顶文章的分类";
+$messages["stickyposts_announcecategory"] = "选择公告文章的分类";
+$messages["stickyposts_plugin_enabled"] = "启动外挂程序";
+$messages["stickyposts_plugin"] = "置顶及公告文章外挂程序";
+
+$messages["stickyposts_settings_saved_ok"] = "置顶及公告文章设定储存成功。";
+$messages["stickyposts_error_maxstickys"] = "置顶文章显示数量必须要 > 0!";
+$messages["stickyposts_error_maxannounces"] = "公告文章显示数量必须要 > 0!";
+$messages["stickyposts_error_stickycategoryid"] = "请选择一个分类存放置顶文章。";
+$messages["stickyposts_error_announcecategoryid"] = "请选择一个分类存放置顶文章。";
+
+$messages["label_configuration"] = "设定";
+$messages["label_enable"] = "启动";
+$messages["label_maxstickys"] = "显示置顶文章数目";
+$messages["label_maxannounces"] = "显示公告文章数目";
+$messages["label_stickycategory"] = "显示置顶文章的分类";
+$messages["label_announcecategory"] = "显示公告文章的分类";
+?>
\ No newline at end of file

Added: plugins/trunk/stickyposts/locale/locale_zh_TW.php
===================================================================
--- plugins/trunk/stickyposts/locale/locale_zh_TW.php	2005-05-17 05:26:12 UTC (rev 2011)
+++ plugins/trunk/stickyposts/locale/locale_zh_TW.php	2005-05-17 06:32:17 UTC (rev 2012)
@@ -0,0 +1,25 @@
+<?php
+$messages["manageRecentPlugins"] = "網誌最近活動管理";
+$messages["stickyposts"] = "置頂及公告文章設定";
+$messages["StickyPosts"] = "置頂及公告文章設定";
+
+$messages["stickyposts_maxstickys"] = "置頂文章顯示數量";
+$messages["stickyposts_maxannounces"] = "公告文章顯示數量";
+$messages["stickyposts_stickycategory"] = "選擇置頂文章的分類";
+$messages["stickyposts_announcecategory"] = "選擇公告文章的分類";
+$messages["stickyposts_plugin_enabled"] = "啟動外掛程式";
+$messages["stickyposts_plugin"] = "置頂及公告文章外掛程式";
+
+$messages["stickyposts_settings_saved_ok"] = "置頂及公告文章設定儲存成功。";
+$messages["stickyposts_error_maxstickys"] = "置頂文章顯示數量必須要 > 0!";
+$messages["stickyposts_error_maxannounces"] = "公告文章顯示數量必須要 > 0!";
+$messages["stickyposts_error_stickycategoryid"] = "請選擇一個分類存放置頂文章。";
+$messages["stickyposts_error_announcecategoryid"] = "請選擇一個分類存放置頂文章。";
+
+$messages["label_configuration"] = "設定";
+$messages["label_enable"] = "å•Ÿå‹•";
+$messages["label_maxstickys"] = "顯示置頂文章數目";
+$messages["label_maxannounces"] = "顯示公告文章數目";
+$messages["label_stickycategory"] = "顯示置頂文章的分類";
+$messages["label_announcecategory"] = "顯示公告文章的分類";
+?>

Added: plugins/trunk/stickyposts/pluginstickyposts.class.php
===================================================================
--- plugins/trunk/stickyposts/pluginstickyposts.class.php	2005-05-17 05:26:12 UTC (rev 2011)
+++ plugins/trunk/stickyposts/pluginstickyposts.class.php	2005-05-17 06:32:17 UTC (rev 2012)
@@ -0,0 +1,97 @@
+<?php
+
+    include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
+    include_once( PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" );
+    include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );
+    
+    /**
+	* Plugin that offers features to get all articles from specific article cateogries 
+	* as announcements and sticky articles.
+	*/
+    class PluginStickyPosts extends PluginBase
+    {
+        var $pluginEnabled;
+        var $stickyCategoryId;			//store stickyCategoryId
+        var $announceCategoryId;		//store AnnounceCategoryId
+		var $maxStickys;
+		var $maxAnnounces;
+        
+        function PluginStickyPosts()
+        {
+			$this->PluginBase();
+			
+            $this->id = "stickyposts";
+            $this->author = "lss";
+            $this->desc = "This plugin offers features to get all articles from specific article cateogries as announcements and sticky articles.";
+  
+            $this->locales = Array( "en_UK" , "zh_TW" , "zh_CN", "es_ES" );
+            
+            $this->init();
+        }
+
+		function init()
+		{
+			$this->registerAdminAction( "stickyposts", "PluginStickyPostsConfigAction" );
+			$this->registerAdminAction( "updatestickyposts", "PluginStickyPostsUpdateConfigAction" );
+			
+			$menu =& Menu::getMenu();
+			if( !$menu->entryExists( "/menu/controlCenter/manageRecentPlugins" ))						
+				$this->addMenuEntry( "/menu/controlCenter", "manageRecentPlugins", "", "", true, false );			
+            $this->addMenuEntry( "/menu/controlCenter/manageRecentPlugins", "StickyPosts", "?op=stickyposts");
+		}
+
+		function register()
+		{
+		    $blogSettings = $this->blogInfo->getSettings();
+		    $this->pluginEnabled = $blogSettings->getValue( "plugin_stickyposts_enabled" );
+	        $this->stickyCategoryId = $blogSettings->getValue( "plugin_stickyposts_stickycategoryid" );
+	        $this->announceCategoryId = $blogSettings->getValue( "plugin_stickyposts_announcecategoryid" );
+	        $this->maxStickys = $blogSettings->getValue( "plugin_stickyposts_maxstickys" );
+	        $this->maxAnnounces = $blogSettings->getValue( "plugin_stickyposts_maxannounces" );
+	    }
+	    
+	    function isEnabled()
+	    {
+	        return $this->pluginEnabled;
+	    }
+
+        /**
+		* Returns the stickyposts articles object of current blog
+		*/
+        function getArticles( $catId )
+        {
+			if ( 'sticky' == $catId ){
+				$catId = $this->stickyCategoryId;
+				$maxpost = $this->maxStickys;
+			} else if ( 'announce' == $catId ){
+				$catId = $this->announceCategoryId;
+				$maxpost = $this->maxAnnounces;
+			} else if ( is_int( $catId ) ){
+				$maxpost = -1;
+			}else return null;
+						
+			$blogId = $this->blogInfo->getId();
+			
+			$articles = new Articles();
+			$ret_articles = $articles->getBlogArticles( $blogId, -1, $maxpost, $catId, 'published' );
+			
+			return $ret_articles;
+        }
+        
+        function getCategory( $catId )
+        {
+			if ( 'sticky' == $catId ){
+				$catId = $this->stickyCategoryId;
+			} else if ( 'announce' == $catId ){
+				$catId = $this->announceCategoryId;
+			} else if ( !is_int( $catId ) ) return null;
+						
+			$blogId = $this->blogInfo->getId();
+			
+			$categories = new ArticleCategories();
+			$ret_category = $categories->getCategory( $catId, $blogId );
+			
+			return $ret_category;
+        }
+    }
+?>

Added: plugins/trunk/stickyposts/readme-zh_TW.txt
===================================================================
--- plugins/trunk/stickyposts/readme-zh_TW.txt	2005-05-17 05:26:12 UTC (rev 2011)
+++ plugins/trunk/stickyposts/readme-zh_TW.txt	2005-05-17 06:32:17 UTC (rev 2012)
@@ -0,0 +1,74 @@
+PLog 1.0/Plugins/stickyposts
+From PLog ¤¤¤å¤å¥ó­pµe
+
+¦WºÙ¡G ¤å³¹¸m³»¤Î¤½§i
+ª©¥»¡G 1.0
+¤U¸ü³sµ²¡G http://sourceforge.net/project/plog/xxx
+µ{¦¡±ÂÅv¡G GPL
+§@ªÌ¡G lss
+
+¥Î³~
+
+´£¨Ñºô»x°µ¤å³¹¸m³»¤Î¥Î¤å³¹°µ¬°ºô¯¸¤½§i¡C
+
+³]©w
+
+«á¥xºÞ²z³¡¥÷¡G
+
+   1. ­º¥ý½Ð«Ø¥ß¨â­Ó¤å³¹¤ÀÃþ¦s©ñ¤½§i¤Î¸m³»¤å³¹¡C
+   2. §A¥i¥H¦b ­Ó¤Hºô»x³]©w >> ¸m³»¤Î¤½§i¤å³¹³]©w ¶i¦æ¦U¶µ³]©w¡C
+   3. ¹w³]ªº¸m³»¤å³¹¼Æ¥Ø¤Î¤½§i¤å³¹¼Æ¥Ø¬O 5 ½g¤å³¹¡A§A¥i¥H­×§ï¦¨§A­nÅã¥Üªº¼Æ¥Ø¡C
+   4. ¦b¿ï³æ¤¤¿ï¾Ü¦s©ñ¸m³»¤å³¹¤Î¤½§i¤å³¹ªº¤ÀÃþ¡C 
+
+¦b¼Ëª©Àɮ׸̡A§A¥i¥H¨Ï¥Î¡G
+
+   1. $stickyposts->isEnabled() Àˬd plugin ¬O§_¤w¸g±Ò¥Î¡C
+   2. $stickyposts->getArticles( 'sticky' ) ¶Ç¦^¸m³»¤å³¹ªº article °}¦C¡A³Ì¦h¶Ç¦^©Ò³]©wªº¸m³»¤å³¹¼Æ¥Ø¡C
+   3. $stickyposts->getArticles( 'announce' ) ¶Ç¦^¤½§i¤å³¹ªº article °}¦C¡A³Ì¦h¶Ç¦^©Ò³]©wªº¤½§i¤å³¹¼Æ¥Ø¡C
+   4. $stickyposts->getArticles( 12 ) ¶Ç¦^«ü©w¤å³¹¤ÀÃþ ID ªº©Ò¦³¤å³¹ article °}¦C¡C¥»¨Ò¤¤ªº 12 ¬°¤å³¹¤ÀÃþ ID¡C
+   5. $stickyposts->getCategory( 'sticky' ) ¶Ç¦^¥Î©ó¸m³»¤å³¹ªº category ª«¥ó¡A¥i¥Î¨Ó°µ¦¨§ó¦h¸m³»¤å³¹¶W³sµ²¡C
+   6. $stickyposts->getCategory( 'announce' ) ¶Ç¦^¥Î©ó¤½§i¤å³¹ªº category ª«¥ó¡A¥i¥Î¨Ó°µ¦¨§ó¦h¤½§i¤å³¹¶W³sµ²¡C
+   7. $stickyposts->getCategory( 12 ) ¶Ç¦^«ü©w¤å³¹¤ÀÃþ ID ªº category ª«¥ó¡C 
+
+¨ä¤¤ 'sticky' ©M 'announce' ¬O plugin ªº«O¯d¦r¡C
+
+¼Ëª©Àɽd¨Ò¡G
+
+³o¬O¤@­Ó«D±`²³æªº¼Ëª©Àɽd¨Ò¡A¥Î¨Ó®i¥Ü Sticky Posts Plugin ªº¥Îªk¡C¥¦¬O¥H 'blueish' ¼Ëª©¬°¨Ò°µ­×§ï¡C
+
+{include file="$blogtemplate/header.template"}
+<div id="content">
+{if $stickyposts->isEnabled()}
+  <h2>Sticky Posts</h2>
+  {assign var=stickys value=$stickyposts->getArticles('sticky')}
+  {foreach from=$stickys item=post}
+      <h2 class="title"><a href="{$url->postPermalink($post)}">{$post->getTopic()}</a></h2>
+  {/foreach}
+  {assign var=stickyCategory value=$stickyposts->getCategory('sticky')}
+  <h4><a href="{$url->categoryLink($stickyCategory)}">more sticky posts</a></h4>
+  
+  <h2>Announce Posts</h2>
+  {assign var=stickys value=$stickyposts->getArticles('announce')}
+  {foreach from=$stickys item=post}
+      <h2 class="title"><a href="{$url->postPermalink($post)}">{$post->getTopic()}</a></h2>
+  {/foreach}
+  {assign var=announceCategory value=$stickyposts->getCategory('announce')}
+  <h4><a href="{$url->categoryLink($announceCategory)}">more announce posts</a></h4>
+  
+  {foreach from=$posts item=post}
+    {include file="$blogtemplate/post.template"}
+  {/foreach}
+{/if}
+</div>
+{include file="$blogtemplate/panel.template"}
+{include file="$blogtemplate/footer.template"}
+
+
+ª`·N¨Æ¶µ
+
+¤W­±ªº¼Ëª©Àɽd¨Ò¬O¤@­Ó«Ü®tªº½d¨Ò¡A½Ð¼Ëª©°ª¤â»s§@¤S¦n¤Sº}«Gªº¼Ëª©¡A¨Ã½ÐÀH¤â±N³o­Ó½d¨Ò´«±¼¡C
+
+
+¨ú¦Û"http://wiki.plogworld.org.tw/index.php/PLog_1.0/Plugins/stickyposts"
+
+­¶­±¤ÀÃþ: Plugins
\ No newline at end of file

Added: plugins/trunk/stickyposts/readme.txt
===================================================================
--- plugins/trunk/stickyposts/readme.txt	2005-05-17 05:26:12 UTC (rev 2011)
+++ plugins/trunk/stickyposts/readme.txt	2005-05-17 06:32:17 UTC (rev 2012)
@@ -0,0 +1,69 @@
+Name: stickyposts
+Latest version: 1.0
+Download link: http://sourceforge.net/project/plog/xxx
+License: GPL
+Author: lss
+
+Description
+
+This plugin offers features to get all articles from specific article cateogries as announcements and sticky articles.
+
+Configuration
+
+In ControlCenter:
+
+   1. Create two categories for Sticky and Annouce.
+   2. You can configure this plugin in controlcetner >> StickyPosts .
+   3. maxStickys and maxAnnouces are numbers of sticky/announce articles for display in blog. The default value is 5.
+   4. Select category for store sticky/announce articles. 
+
+In tempalte file, You can use:
+
+   1. $stickyposts->isEnabled() to check the plugin is enabled or not.
+   2. $stickyposts->getArticles( 'sticky' ) to get an array of articles for sticky.
+      This will get max articles you set in controlcenter.
+   3. $stickyposts->getArticles( 'announce' ) to get an array of articles for announce.
+      This will get max articles you set in controlcenter.
+   4. $stickyposts->getArticles( 12 ) to get an array of all articles for categoryId = 12.
+   5. $stickyposts->getCategory( 'sticky' ) to get an category object for sticky articles.
+   6. $stickyposts->getCategory( 'announce' ) to get an category object for annuonce articles.
+   7. $stickyposts->getCategory( 12 ) to get an category object for categoryId = 12. 
+
+Where the 'sticky' and 'announce' are plugin reverse string.
+
+Example: This is a very simple example for use stikcyposts plugin in template, Rewrite it as you like. This example modifies main.template of template 'blueish'.
+
+{include file="$blogtemplate/header.template"}
+<div id="content">
+{if $stickyposts->isEnabled()}
+  <h2>Sticky Posts</h2>
+  {assign var=stickys value=$stickyposts->getArticles('sticky')}
+  {foreach from=$stickys item=post}
+      <h2 class="title"><a href="{$url->postPermalink($post)}">{$post->getTopic()}</a></h2>
+  {/foreach}
+  {assign var=stickyCategory value=$stickyposts->getCategory('sticky')}
+  <h4><a href="{$url->categoryLink($stickyCategory)}">more sticky posts</a></h4>
+  
+  <h2>Announce Posts</h2>
+  {assign var=stickys value=$stickyposts->getArticles('announce')}
+  {foreach from=$stickys item=post}
+      <h2 class="title"><a href="{$url->postPermalink($post)}">{$post->getTopic()}</a></h2>
+  {/foreach}
+  {assign var=announceCategory value=$stickyposts->getCategory('announce')}
+  <h4><a href="{$url->categoryLink($announceCategory)}">more announce posts</a></h4>
+  
+  {foreach from=$posts item=post}
+    {include file="$blogtemplate/post.template"}
+  {/foreach}
+{/if}  
+</div>
+{include file="$blogtemplate/panel.template"}
+{include file="$blogtemplate/footer.template"}
+
+Notes
+
+May someone kindly make an good example of template. I make a very bad one.
+
+Retrieved from "http://wiki.plogworld.net/index.php/PLog_1.0/Plugins/stickyposts"
+
+Categories: Plugins
\ No newline at end of file

Added: plugins/trunk/stickyposts/templates/stickyposts.template
===================================================================
--- plugins/trunk/stickyposts/templates/stickyposts.template	2005-05-17 05:26:12 UTC (rev 2011)
+++ plugins/trunk/stickyposts/templates/stickyposts.template	2005-05-17 06:32:17 UTC (rev 2012)
@@ -0,0 +1,57 @@
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=StickyPosts title=$locale->tr("stickyposts_plugin")}
+<form name="stickypostsPluginConfig" method="post">
+ <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("stickyposts_plugin_enabled")}
+   </div>
+  </div>
+  
+  <div class="field">
+   <label for="maxStickys">{$locale->tr("label_maxstickys")}</label>
+   <span class="required">*</span>
+   <div class="formHelp">{$locale->tr("stickyposts_maxstickys")}</div>
+   <input class="text" type="text" name="maxStickys" id="maxStickys" value="{$maxStickys}" width="10" />
+  </div>
+  
+  <div class="field">
+   <label for="StickyCategory">{$locale->tr("label_stickycategory")}</label>
+   <span class="required">*</span>
+   <div class="formHelp">{$locale->tr("stickyposts_stickycategory")}</div>
+	<select name=stickyCategoryId>
+		{html_options options=$catNameId selected=$stickyCategoryId}
+	</select>
+   </div>
+  
+  <div class="field">
+   <label for="maxAnnounces">{$locale->tr("label_maxannounces")}</label>
+   <span class="required">*</span>
+   <div class="formHelp">{$locale->tr("stickyposts_maxannounces")}</div>
+   <input class="text" type="text" name="maxAnnounces" id="maxAnnounces" value="{$maxAnnounces}" width="10" />
+  </div>
+  
+  <div class="field">
+   <label for="AnnounceCategory">{$locale->tr("label_announcecategory")}</label>
+   <span class="required">*</span>
+   <div class="formHelp">{$locale->tr("stickyposts_announcecategory")}</div>
+	<select name=announceCategoryId>
+		{html_options options=$catNameId selected=$announceCategoryId}
+	</select>
+   </div>
+  
+ </fieldset>
+ 
+ <div class="buttons">  
+  <input type="hidden" name="op" value="updatestickyposts" />
+  <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