[pLog-svn] r1133 - in plugins/trunk/karma: . class/action locale templates

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


Author: mark
Date: 2005-02-19 09:39:11 +0000 (Sat, 19 Feb 2005)
New Revision: 1133

Modified:
   plugins/trunk/karma/class/action/karmarateaction.class.php
   plugins/trunk/karma/class/action/viewmoderateddownaction.class.php
   plugins/trunk/karma/class/action/viewmoderateddownarticleaction.class.php
   plugins/trunk/karma/locale/locale_en_UK.php
   plugins/trunk/karma/locale/locale_zh_TW.php
   plugins/trunk/karma/pluginkarma.class.php
   plugins/trunk/karma/templates/moderateddownlist.template
Log:
Modified locales and also modifed moderated down list. Karma plugins is down.

Modified: plugins/trunk/karma/class/action/karmarateaction.class.php
===================================================================
--- plugins/trunk/karma/class/action/karmarateaction.class.php	2005-02-19 09:07:22 UTC (rev 1132)
+++ plugins/trunk/karma/class/action/karmarateaction.class.php	2005-02-19 09:39:11 UTC (rev 1133)
@@ -33,7 +33,7 @@
 			$val1 = new IntegerValidator();
 			if( !$val1->validate( $this->_blogId )) {
 				$this->_view = new ErrorView( $this->_blogInfo );
-				$this->_view->setValue( "message", "The blog identifier is not valid." );
+				$this->_view->setValue( "message", $this->_locale->tr("error_karma_blogid_not_valid") );
 				$this->setCommonData();
 				
 				return false;
@@ -42,7 +42,7 @@
 			$val2 = new IntegerValidator();
 			if( !$val2->validate( $this->_articleId )) {
 				$this->_view = new ErrorView( $this->_blogInfo );
-				$this->_view->setValue( "message", "The article identifier is not valid." );
+				$this->_view->setValue( "message", $this->_locale->tr("error_karma_articleid_not_valid") );
 				$this->setCommonData();
 				
 				return false;
@@ -51,7 +51,7 @@
 			$val3 = new IntegerValidator();
 			if( !$val3->validate( $this->_mode )) {
 				$this->_view = new ErrorView( $this->_blogInfo );
-				$this->_view->setValue( "message", "The mode identifier is not valid." );
+				$this->_view->setValue( "message", $this->_locale->tr("error_karma_modeid_not_valid") );
 				$this->setCommonData();
 				
 				return false;
@@ -62,7 +62,7 @@
 			$this->_article = $articles->getBlogArticle( $this->_articleId, $this->_blogId );
 			if( !$this->_article ) {
 				$this->_view = new ErrorView( $this->_blogInfo );
-				$this->_view->setValue( "message", "The article does not exist!" );
+				$this->_view->setValue( "message", $this->_locale->tr("error_karma_article_not_exist") );
 				$this->setCommonData();
 				
 				return false;
@@ -92,7 +92,7 @@
 						$voteAllowed = false;
 						_debug("user $clientIp has already voted!<br/>");
 						$this->_view = new ErrorView( $this->_blogInfo );
-						$message = "Sorry, cou can only vote once per article.";
+						$message = $this->_locale->tr("error_karma_vote_per_article");
 						$this->_view->setValue( "message", $message );
 						$this->setCommonData();
 						
@@ -122,7 +122,7 @@
 			// and check how it went
 			if( !$result ) {
 				$this->_view = new ErrorView( $this->_blogInfo );
-				$this->_view->setValue( "message", "There was an error storing the vote." );
+				$this->_view->setValue( "message", $this->_locale->tr("error_karma_storing_vote") );
 				$this->setCommonData();
 			}
 
@@ -151,7 +151,6 @@
 						$articles->updateArticle( $article );
 					}						
 				}
-			
 				// move the action flow to "ViewArticle" if the article is moderated up... if not, then
 				// we have to use an alternative action
 				if( $article->getStatus() == POST_STATUS_PUBLISHED )

Modified: plugins/trunk/karma/class/action/viewmoderateddownaction.class.php
===================================================================
--- plugins/trunk/karma/class/action/viewmoderateddownaction.class.php	2005-02-19 09:07:22 UTC (rev 1132)
+++ plugins/trunk/karma/class/action/viewmoderateddownaction.class.php	2005-02-19 09:39:11 UTC (rev 1133)
@@ -31,7 +31,7 @@
 			
 			$this->_postAmount = -1;
 			// also, inform the template that we're showing them all!
-			$this->_view =  new PluginTemplatedView( $this->_blogInfo, "karma", "moderateddownlist" );
+			$this->_view =  new PluginTemplatedView( $this->_blogInfo, "karma", "moderateddownlist", SMARTY_VIEW_CACHE_DISABLE );
 			
 			$this->_view->setValue( "showAll", true );
 			// another flag indicating that we are showing the list of moderated down posts
@@ -44,7 +44,7 @@
             // if we couldn't fetch the articles, send an error and quit
             if( $blogArticles == false ) {
             	$this->_view = new ErrorView( $this->_blogInfo );
-                $this->_view->setValue( "message", "error_fetching_moderated_down_articles" );
+                $this->_view->setValue( "message", $this->_locale->tr("error_fetching_moderated_down_articles") );
             }
 			
 			// this is a little kludge... but it needs to be fixed!! 

Modified: plugins/trunk/karma/class/action/viewmoderateddownarticleaction.class.php
===================================================================
--- plugins/trunk/karma/class/action/viewmoderateddownarticleaction.class.php	2005-02-19 09:07:22 UTC (rev 1132)
+++ plugins/trunk/karma/class/action/viewmoderateddownarticleaction.class.php	2005-02-19 09:39:11 UTC (rev 1133)
@@ -30,7 +30,7 @@
 		function _setErrorView()
 		{
 			$this->_view = new ErrorView( $this->_blogInfo );
-			$this->_view->setValue( "message", "error_fetching_moderated_down_article" );
+			$this->_view->setValue( "message", $this->_locale->tr("error_fetching_moderated_down_article") );
 			$this->setCommonData();		
 		}
 

Modified: plugins/trunk/karma/locale/locale_en_UK.php
===================================================================
--- plugins/trunk/karma/locale/locale_en_UK.php	2005-02-19 09:07:22 UTC (rev 1132)
+++ plugins/trunk/karma/locale/locale_en_UK.php	2005-02-19 09:39:11 UTC (rev 1133)
@@ -2,6 +2,7 @@
 $messages["manageAppearancePlugins"] = "Appearance Management";
 $messages["karmaPluginSettings"] = "Karma";
 $messages["karma"] = "Karma";
+$messages["karma_moderated_down_articles"] = "Moderated Down Articles";
 
 $messages["karma_disablenegative"] = "Remove the the moderated down articles from the main page, until they have enough positive karma to be brought back to the main page.";
 $messages["karma_negativethreshold"] = "Minimum amount of negative votes needed to disable an article.";
@@ -24,6 +25,14 @@
 $messages["karma_1.5_times"] = "50% More";
 $messages["karma_2_times"] ="Twice More";
 
+$messages["error_fetching_moderated_down_article"] = "There were errors when fetching the moderated down articels.";
+$messages["error_karma_blogid_not_valid"] = "The blog identifier is not valid.";
+$messages["error_karma_articleid_not_valid"] = "The article identifier is not valid.";
+$messages["error_karma_modeid_not_valid"] = "The mode identifier is not valid.";
+$messages["error_karma_article_not_exist"] = "The article does not exist!";
+$messages["error_karma_vote_per_article"] = "Sorry, cou can only vote once per article.";
+$messages["error_karma_storing_vote"] = "There was an error storing the vote.";
+
 $messages["karma_settings_saved_ok"] = "karma settings saved successfully!";
 
 $messages["post_status_karma_moderated_down"] = "Moderated Down";

Modified: plugins/trunk/karma/locale/locale_zh_TW.php
===================================================================
--- plugins/trunk/karma/locale/locale_zh_TW.php	2005-02-19 09:07:22 UTC (rev 1132)
+++ plugins/trunk/karma/locale/locale_zh_TW.php	2005-02-19 09:39:11 UTC (rev 1133)
@@ -2,6 +2,7 @@
 $messages["manageAppearancePlugins"] = "網誌外觀管理";
 $messages["karmaPluginSettings"] = "文章評鑑設定";
 $messages["karma"] = "文章評鑑";
+$messages["karma_moderated_down_articles"] = "下架文章";
 
 $messages["karma_disablenegative"] = "從網誌主頁面移除下架的文章,除非能有足夠的正向評鑑才能使這篇文章再上架";
 $messages["karma_negativethreshold"] = "文章下架所需要的最少負負向評鑑分數。";
@@ -24,6 +25,14 @@
 $messages["karma_1.5_times"] = "正向評鑑的價值是負向評價的 1.5 倍";
 $messages["karma_2_times"] = "正向評鑑的價值是負向評價的 2 倍";
 
+$messages["error_fetching_moderated_down_article"] = "在讀取下架文章時發生錯誤。";
+$messages["error_karma_blogid_not_valid"] = "網誌代碼錯誤。";
+$messages["error_karma_articleid_not_valid"] = "文章代碼錯誤。";
+$messages["error_karma_modeid_not_valid"] = "文章評鑑操作代碼錯誤。";
+$messages["error_karma_article_not_exist"] = "您要讀取的文章不存在。";
+$messages["error_karma_vote_per_article"] = "抱歉!每一文章只能評鑑一次。";
+$messages["error_karma_storing_vote"] = "當儲存文章評鑑結果時發生錯誤。";
+
 $messages["karma_settings_saved_ok"] = "文章評鑑設定儲存成功。";
 
 $messages["post_status_karma_moderated_down"] = "下架";

Modified: plugins/trunk/karma/pluginkarma.class.php
===================================================================
--- plugins/trunk/karma/pluginkarma.class.php	2005-02-19 09:07:22 UTC (rev 1132)
+++ plugins/trunk/karma/pluginkarma.class.php	2005-02-19 09:39:11 UTC (rev 1133)
@@ -1,6 +1,7 @@
 <?php
 
 	include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
+    include_once( PLOG_CLASS_PATH."class/net/requestgenerator.class.php" );	
 	
 	/**
 	 * our custom status for posts
@@ -52,6 +53,18 @@
 	    {
 	        return $this->pluginEnabled;
 	    }
+
+        function pluginTemplatePage()
+        {
+ 			$rg = new RawRequestGenerator($this->blogInfo);
+            
+        	$rg->addParameter( "op", "viewModeratedDown" );
+            $rg->addParameter( "blogId", $this->blogInfo->getId());
+
+            $templatePage = $rg->getIndexUrl().$rg->getRequest();
+
+            return $templatePage;
+        }	    
 		
 		/**
 		 * returns the correct url to the action that scores the points

Modified: plugins/trunk/karma/templates/moderateddownlist.template
===================================================================
--- plugins/trunk/karma/templates/moderateddownlist.template	2005-02-19 09:07:22 UTC (rev 1132)
+++ plugins/trunk/karma/templates/moderateddownlist.template	2005-02-19 09:39:11 UTC (rev 1133)
@@ -1,5 +1,16 @@
 {include file="$blogtemplate/header.template"}
+<h2>{$locale->tr("posts")}: {$locale->tr("karma_moderated_down_articles")}</h2>
 {foreach from=$moderateddown item=article}
- <a href="{$karma->moderatedDownLink($article)}">{$article->getTopic()}</a><br/>
+ <h3><a href="{$karma->moderatedDownLink($article)}">{$article->getTopic()}</a></h3>
+ <div>
+  {$article->getText()|strip_tags|truncate:300:"...":false}
+ </div>
+
+ <p class="footer">
+  {foreach name=categories from=$article->getCategories() item=articleCategory}
+   <a href="{$url->categoryLink($articleCategory)}">{$articleCategory->getName()}</a> 
+   {if !$smarty.foreach.categories.last}, {/if}
+  {/foreach}
+ </p>
 {/foreach}
 {include file="$blogtemplate/footer.template"}
\ No newline at end of file




More information about the pLog-svn mailing list