[pLog-svn] r3481 - in plog/trunk: class/action/admin class/data class/locale class/view/admin locale templates/admin

mark at devel.lifetype.net mark at devel.lifetype.net
Sun May 28 19:36:21 GMT 2006


Author: mark
Date: 2006-05-28 19:36:20 +0000 (Sun, 28 May 2006)
New Revision: 3481

Modified:
   plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php
   plog/trunk/class/data/plogcalendar.class.php
   plog/trunk/class/locale/locale.class.php
   plog/trunk/class/view/admin/adminblogsettingsview.class.php
   plog/trunk/locale/locale_en_UK.php
   plog/trunk/locale/locale_zh_TW.php
   plog/trunk/templates/admin/blogsettings.template
Log:
This feature http://bugs.lifetype.net/view.php?id=911 implemented!!

1. Now, we can use $messages['first_day_of_week] = 0 or 1 to control the start day of week

2. We also can allow user to specific it in their blog settings.

I think it should be enough to fulfill most situations.

Modified: plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php	2006-05-28 14:09:35 UTC (rev 3480)
+++ plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php	2006-05-28 19:36:20 UTC (rev 3481)
@@ -38,6 +38,7 @@
 			$this->registerField( "blogCommentsEnabled" );
 			$this->registerField( "blogCommentsOrder" );
 			$this->registerField( "blogShowFuturePosts" );
+			$this->registerField( "blogFirstDayOfWeek" );
 			$this->registerField( "blogTimeOffset" );
 			$this->registerField( "properties" );
 			$this->registerField( "blogCategoriesOrder" );
@@ -70,6 +71,7 @@
            	$blogSettings->setValue( "pull_down_menu_enabled", Textfilter::checkboxToBoolean($this->_request->getValue( "blogEnablePullDownMenu" )));
            	$blogSettings->setValue( "comments_enabled", Textfilter::checkboxToBoolean($this->_request->getValue( "blogCommentsEnabled" )));
            	$blogSettings->setValue( "show_future_posts_in_calendar",  Textfilter::checkboxToBoolean($this->_request->getValue( "blogShowFuturePosts" )));
+           	$blogSettings->setValue( "first_day_of_week",  $this->_request->getValue( "blogFirstDayOfWeek" ));
            	$blogSettings->setValue( "new_drafts_autosave_enabled", Textfilter::checkboxToBoolean($this->_request->getValue( "blogEnableAutosaveDrafts" )));
             $blogSettings->setValue( "comments_order", $this->_request->getValue( "blogCommentsOrder" ));
             $blogSettings->setValue( "default_send_notification", $this->_request->getValue( "blogSendNotification" ));

Modified: plog/trunk/class/data/plogcalendar.class.php
===================================================================
--- plog/trunk/class/data/plogcalendar.class.php	2006-05-28 14:09:35 UTC (rev 3480)
+++ plog/trunk/class/data/plogcalendar.class.php	2006-05-28 19:36:20 UTC (rev 3481)
@@ -21,7 +21,8 @@
     class PlogCalendar extends Calendar    {
 
         var $_dayPosts;
-        var $_blogInfo;        var $rg;
+        var $_blogInfo;
+        var $rg;
 
         /**
          * Constructor.
@@ -48,8 +49,9 @@
             $this->_dayPosts = $dayPosts;
             $this->_blogInfo = $blogInfo;
 
-            // set the first day of the week according to our locale
-            $this->startDay = $locale->firstDayOfWeek();
+            // set the first day of the week according to our blogsetting
+            $blogSettings =  $this->_blogInfo->getSettings();
+            $this->startDay = $blogSettings->getValue( 'first_day_of_week', $locale->firstDayOfWeek() );
             //array_push( $this->monthsNames, $locale->tr("January"));
             $this->monthNames = $locale->getMonthNames();
             // abbreviations of the days of the week

Modified: plog/trunk/class/locale/locale.class.php
===================================================================
--- plog/trunk/class/locale/locale.class.php	2006-05-28 14:09:35 UTC (rev 3480)
+++ plog/trunk/class/locale/locale.class.php	2006-05-28 19:36:20 UTC (rev 3481)
@@ -39,6 +39,11 @@
      * default direction for texts, if the locale does not specify one
      */
 	define( "DEFAULT_DIRECTION", "ltr" );
+	
+    /**
+     * default first day fot calendar
+     */
+	define( "DEFAULT_FIRST_DAY_OF_WEEK", 1 );
 
     /**
 	 * \ingroup Locale
@@ -78,6 +83,7 @@
         var $_charset;
 		var $_description;
 		var $_dateFormat;
+		var $_firstDayOfWeek;
 
         /**
          * Constructor.
@@ -145,6 +151,7 @@
             $this->_charset = isset($this->_messages["encoding"]) ? $this->_messages["encoding"] : DEFAULT_ENCODING;
 			$this->_direction = isset($this->_messages["direction"]) ? $this->_messages["direction"] : DEFAULT_DIRECTION;
 			$this->_dateFormat = isset($this->_messages["date_format"]) ? $this->_messages["date_format"] : DEFAULT_LOCALE_FORMAT;
+			$this->_firstDayOfWeek = isset($this->_messages["first_day_of_week"]) ? $this->_messages["first_day_of_week"] : DEFAULT_FIRST_DAY_OF_WEEK;
 			
 			unset( $this->_messages );
 			
@@ -341,15 +348,7 @@
          */
         function firstDayOfWeek()
         {
-        	switch($this->getCountryId()) {
-            	case "US":
-                case "AU":
-                case "IE":
-                case "UK": $day = 0; break;
-                default: $day = 1; break;
-            }
-
-            return $day;
+            return $this->_firstDayOfWeek;
         }
 
         /**

Modified: plog/trunk/class/view/admin/adminblogsettingsview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminblogsettingsview.class.php	2006-05-28 14:09:35 UTC (rev 3480)
+++ plog/trunk/class/view/admin/adminblogsettingsview.class.php	2006-05-28 19:36:20 UTC (rev 3481)
@@ -33,6 +33,8 @@
 			$this->setValue( "blogEnablePullDownMenu", $blogSettings->getValue( "pull_down_menu_enabled" ));
 			$this->setValue( "blogCommentsEnabled", $blogSettings->getValue( "comments_enabled" ));
 			$this->setValue( "blogShowFuturePosts", $blogSettings->getValue( "show_future_posts_in_calendar" ));
+			$locale =& Locales::getLocale( $blogSettings->getValue( "locale" ) );
+			$this->setValue( "blogFirstDayOfWeek", $blogSettings->getValue( "first_day_of_week", $locale->firstDayOfWeek() ));
 			$this->setValue( "blogEnableAutosaveDrafts", $blogSettings->getValue( "new_drafts_autosave_enabled" ));
 			$this->setValue( "blogCommentsOrder", $blogSettings->getValue( "comments_order" ));
 			$this->setValue( "blogCategory", $this->_blogInfo->getBlogCategoryId());

Modified: plog/trunk/locale/locale_en_UK.php
===================================================================
--- plog/trunk/locale/locale_en_UK.php	2006-05-28 14:09:35 UTC (rev 3480)
+++ plog/trunk/locale/locale_en_UK.php	2006-05-28 19:36:20 UTC (rev 3481)
@@ -1025,18 +1025,22 @@
 
 $messages['warning_autosave_message'] = '<img src="imgs/admin/icon_warning-16.png" alt="Error" class="InfoIcon"/><p class="ErrorText">You seem to have left here without saving your post. If so, you may <a href="#" onclick="restoreAutoSave();">click here to restore it</a> or <a href="#" onclick="eraseAutoSave();">delete it</a>.</p>';
 
-$messages['error_rule_email_dns_server_temp_fail'] = 'Temporary failure - try again later.';
-$messages['error_rule_email_dns_server_unreachable'] = 'Email server unreachable.';
-$messages['error_rule_email_dns_not_permitted'] = 'E-mail not permitted.';
-
 $messages['before_unload_message'] = 'It seems you have unsaved post, are you sure you want to leave?\n (If you don\\\'t press the "Ok" button in restart-seconds seconds, the auto save mechanisim will restart again.)';
 
 $messages['check_username'] = 'Check User Name';
 $messages['check_username_ok'] = 'Congradulations! The user name is available!';
 $messages['error_username_exist'] = 'Sorry! The user name is not available, please try others.';
 
+$messages['error_rule_email_dns_server_temp_fail'] = 'Temporary failure - try again later.';
+$messages['error_rule_email_dns_server_unreachable'] = 'Email server unreachable.';
+$messages['error_rule_email_dns_not_permitted'] = 'E-mail not permitted.';
+
 $messages['blog_users_help'] = 'Users who have access to this blog.';
 
 $messages['summary_welcome_paragraph'] = 'You should place here whatever welcome message you would like your users to see. Or remove this one completely and rearrange the whole page. Or something :) Take a look at templates/summary, that is where all template files that make up this page are stored. You are free to change them in any way you like.';
 
+$messages['first_day_of_week'] = 0;
+$messages['first_day_of_week_label'] = 'First Day of Week';
+$messages['first_day_of_week_help'] = 'First Day of Week in calendar';
+
 ?>
\ No newline at end of file

Modified: plog/trunk/locale/locale_zh_TW.php
===================================================================
--- plog/trunk/locale/locale_zh_TW.php	2006-05-28 14:09:35 UTC (rev 3480)
+++ plog/trunk/locale/locale_zh_TW.php	2006-05-28 19:36:20 UTC (rev 3481)
@@ -648,7 +648,6 @@
 $messages['blog_owner_help'] = '網誌站台管理者,將擁有完整的權限來修改網誌設定。';
 $messages['users'] = '使用者';
 $messages['blog_quota_help'] = '檔案容量限度(單位:bytes)。設為0或空白將使用系統的全域檔案限度做為預設值。';
-$messages['blog_users_help'] = '可以存取這個網誌的使用者。請從左邊選取使用者將他移到右邊提供該使用者存取網誌的權限。';
 $messages['edit_blog_settings_updated_ok'] = '網誌 「%s」已順利更新。';
 $messages['error_updating_blog_settings'] = '更新網誌站台 「%s」時發生錯誤。';
 $messages['error_incorrect_blog_owner'] = '要設定為網誌站台管理員的使用者帳號不存在。';
@@ -1030,6 +1029,18 @@
 
 $messages['check_username'] = '檢查使用者名稱';
 $messages['check_username_ok'] = '恭喜!這個使用者名稱還沒有任何人使用。';
-$messages['error_username_exist'] = '抱歉!這個使用者名稱已經被別人用了,試試其他的吧!';
+$messages['error_username_exist'] = '抱歉!這個使用者名稱已經被別人用了,試試其他的吧!';
 
 
+$messages['error_rule_email_dns_server_temp_fail'] = 'Temporary failure - try again later.';
+$messages['error_rule_email_dns_server_unreachable'] = 'Email server unreachable.';
+$messages['error_rule_email_dns_not_permitted'] = 'E-mail not permitted.'; 
+
+$messages['blog_users_help'] = '可以存取這個網誌的使用者。請從左邊選取使用者將他移到右邊提供該使用者存取網誌的權限。'; 
+
+$messages['summary_welcome_paragraph'] = 'You should place here whatever welcome message you would like your users to see. Or remove this one completely and rearrange the whole page. Or something :) Take a look at templates/summary, that is where all template files that make up this page are stored. You are free to change them in any way you like.'; 
+
+$messages['first_day_of_week'] = 1;
+$messages['first_day_of_week_label'] = '每一週的開始';
+$messages['first_day_of_week_help'] = '在首頁月曆中的顯示方式。';
+
 ?>
\ No newline at end of file

Modified: plog/trunk/templates/admin/blogsettings.template
===================================================================
--- plog/trunk/templates/admin/blogsettings.template	2006-05-28 14:09:35 UTC (rev 3480)
+++ plog/trunk/templates/admin/blogsettings.template	2006-05-28 19:36:20 UTC (rev 3481)
@@ -124,6 +124,15 @@
 	    {$locale->tr("show_future_posts_help")}
 	  </div>
     </div>
+
+     <div class="field">
+      <label for="blogFirstDayOfWeek">{$locale->tr("first_day_of_week_label")}</label>
+      <div class="formHelp">{$locale->tr("first_day_of_week_help")}</div>
+     <select name="blogFirstDayOfWeek" id="blogFirstDayOfWeek">
+       <option value="0" {if $blogFirstDayOfWeek == 0 } selected="selected" {/if}>{$locale->tr("Sunday")}</option>
+       <option value="1" {if $blogFirstDayOfWeek == 1 } selected="selected" {/if}>{$locale->tr("Monday")}</option>
+      </select>
+    </div>
 	
      <div class="field">
       <label for="blogShowInSummary">{$locale->tr("show_in_summary")}</label>



More information about the pLog-svn mailing list