OSDN Git Service

管理者向けメッセージ機能追加。 v2.17.2
authornaoki hirata <naoki@magic3.org>
Thu, 8 Sep 2016 01:13:56 +0000 (10:13 +0900)
committernaoki hirata <naoki@magic3.org>
Thu, 8 Sep 2016 01:13:56 +0000 (10:13 +0900)
include/manager/messageManager.php
widgets/admin_main/include/container/admin_mainConfigmessageWidgetContainer.php
widgets/admin_main/include/container/admin_mainWidgetContainer.php
widgets/admin_main/include/template/configmessage.tmpl.html

index e248b34..dffe03f 100644 (file)
@@ -32,6 +32,7 @@ class MessageManager extends Core
        const MSG_SITE_IN_MAINTENANCE = 'msg_site_in_maintenance';                      // サイトメンテナンス中メッセージ
        const MSG_ACCESS_DENY = 'msg_access_deny';                                                      // アクセス不可メッセージ
        const MSG_PAGE_NOT_FOUND = 'msg_page_not_found';                                                        // ページが見つからないメッセージ
+       const MSG_ADMIN_POPUP_LOGIN = 'msg_admin_popup_login';                          // ログイン時管理者向けポップアップメッセージ
        const DEFAULT_MSG_SITE_IN_MAINTENANCE = 'ただいまサイトのメンテナンス中です';// サイトメンテナンス中メッセージのデフォルト値
        const DEFAULT_MSG_ACCESS_DENY = 'アクセスできません';                                          // アクセス不可メッセージのデフォルト値
        const DEFAULT_MSG_PAGE_NOT_FOUND = 'ページが見つかりません';                                         // ページが見つからないメッセージのデフォルト値
index 54935e3..66929c7 100644 (file)
@@ -8,9 +8,9 @@
  *
  * @package    Magic3 Framework
  * @author     平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
- * @copyright  Copyright 2006-2013 Magic3 Project.
+ * @copyright  Copyright 2006-2016 Magic3 Project.
  * @license    http://www.gnu.org/copyleft/gpl.html  GPL License
- * @version    SVN: $Id: admin_mainConfigmessageWidgetContainer.php 5726 2013-02-25 05:45:25Z fishbone $
+ * @version    SVN: $Id$
  * @link       http://www.magic3.org
  */
 require_once($gEnvManager->getCurrentWidgetContainerPath() .   '/admin_mainConfigsystemBaseWidgetContainer.php');
@@ -71,6 +71,7 @@ class admin_mainConfigmessageWidgetContainer extends admin_mainConfigsystemBaseW
                $useContentAccessDeny = ($request->trimValueOf('item_use_content_access_deny') == 'on') ? 1 : 0;                // アクセス不可用コンテンツを汎用コンテンツから取得するかどうか
                $msg_pageNotFound = $request->trimValueOf('item_msg_page_not_found');           // 存在しない画面メッセージ
                $useContentPageNotFound = ($request->trimValueOf('item_use_content_page_not_found') == 'on') ? 1 : 0;           // 存在しない画面用コンテンツを汎用コンテンツから取得するかどうか
+               $msg_adminPopupLogin = $request->trimValueOf('item_msg_admin_popup_login');             // ログイン時管理者向けポップアップメッセージ
                
                $replaceNew = false;            // データを再取得するかどうか
                if ($act == 'update'){          // 設定更新のとき
@@ -91,6 +92,9 @@ class admin_mainConfigmessageWidgetContainer extends admin_mainConfigsystemBaseW
                                if (!$this->gInstance->getMessageManager()->updateMessage(MessageManager::MSG_PAGE_NOT_FOUND, $msg_pageNotFound, $this->langId)) $isErr = true;
                        }
                        if (!$isErr){
+                               if (!$this->gInstance->getMessageManager()->updateMessage(MessageManager::MSG_ADMIN_POPUP_LOGIN, $msg_adminPopupLogin, $this->langId)) $isErr = true;
+                       }
+                       if (!$isErr){
                                if (!$this->db->updateSystemConfig(self::CF_USE_CONTENT_PAGE_NOT_FOUND, $useContentPageNotFound)) $isErr = true;                // 存在しない画面用コンテンツを汎用コンテンツから取得するかどうか
                        }
                        if ($isErr){            // エラー発生のとき
@@ -114,26 +118,29 @@ class admin_mainConfigmessageWidgetContainer extends admin_mainConfigsystemBaseW
                        $useContentAccessDeny   = $this->db->getSystemConfig(self::CF_USE_CONTENT_ACCESS_DENY);                 // アクセス不可用コンテンツを汎用コンテンツから取得するかどうか
                        $msg_pageNotFound = $this->gInstance->getMessageManager()->getMessage(MessageManager::MSG_PAGE_NOT_FOUND, $this->langId);// 存在しない画面メッセージ
                        $useContentPageNotFound = $this->db->getSystemConfig(self::CF_USE_CONTENT_PAGE_NOT_FOUND);                      // 存在しない画面用コンテンツを汎用コンテンツから取得するかどうか
+                       $msg_adminPopupLogin = $this->gInstance->getMessageManager()->getMessage(MessageManager::MSG_ADMIN_POPUP_LOGIN, $this->langId);         // ログイン時管理者向けポップアップメッセージ
                }
                
                // 画面にデータを埋め込む
-               $this->tmpl->addVar("_widget", "msg_site_in_maintenance", $msg_siteInMaintenance);// メンテナンスメッセージ
-               $this->tmpl->addVar("_widget", "content_key_maintenance", M3_CONTENT_KEY_MAINTENANCE);          // メンテナンス用コンテンツ取得キー
+               $this->tmpl->addVar("_widget", "msg_site_in_maintenance", $this->convertToDispString($msg_siteInMaintenance));// メンテナンスメッセージ
+               $this->tmpl->addVar("_widget", "content_key_maintenance", $this->convertToDispString(M3_CONTENT_KEY_MAINTENANCE));              // メンテナンス用コンテンツ取得キー
                $checked = '';
                if (!empty($useContentMaintenance)) $checked = 'checked';
                $this->tmpl->addVar("_widget", "use_content_maintenance", $checked);// メンテナンス画面用コンテンツを汎用コンテンツから取得するかどうか
                
-               $this->tmpl->addVar("_widget", "msg_access_deny", $msg_accessDeny);                             // アクセス不可メッセージ
-               $this->tmpl->addVar("_widget", "content_key_access_deny", M3_CONTENT_KEY_ACCESS_DENY);          // アクセス不可用コンテンツ取得キー
+               $this->tmpl->addVar("_widget", "msg_access_deny", $this->convertToDispString($msg_accessDeny));                         // アクセス不可メッセージ
+               $this->tmpl->addVar("_widget", "content_key_access_deny", $this->convertToDispString(M3_CONTENT_KEY_ACCESS_DENY));              // アクセス不可用コンテンツ取得キー
                $checked = '';
                if (!empty($useContentAccessDeny)) $checked = 'checked';
                $this->tmpl->addVar("_widget", "use_content_access_deny", $checked);// アクセス不可用コンテンツを汎用コンテンツから取得するかどうか
                
-               $this->tmpl->addVar("_widget", "msg_page_not_found", $msg_pageNotFound);                                // 存在しない画面メッセージ
-               $this->tmpl->addVar("_widget", "content_key_page_not_found", M3_CONTENT_KEY_PAGE_NOT_FOUND);            // 存在しない画面用コンテンツ取得キー
+               $this->tmpl->addVar("_widget", "msg_page_not_found", $this->convertToDispString($msg_pageNotFound));                            // 存在しない画面メッセージ
+               $this->tmpl->addVar("_widget", "content_key_page_not_found", $this->convertToDispString(M3_CONTENT_KEY_PAGE_NOT_FOUND));                // 存在しない画面用コンテンツ取得キー
                $checked = '';
                if (!empty($useContentPageNotFound)) $checked = 'checked';
                $this->tmpl->addVar("_widget", "use_content_page_not_found", $checked);// 存在しない画面用コンテンツを汎用コンテンツから取得するかどうか
+               
+               $this->tmpl->addVar("_widget", "msg_admin_popup_login", $this->convertToDispString($msg_adminPopupLogin));                              // ログイン時管理者向けポップアップメッセージ
        }
 }
 ?>
index 5469be5..5190d48 100644 (file)
@@ -24,7 +24,8 @@ class admin_mainWidgetContainer extends admin_mainBaseWidgetContainer
        const CF_USE_CONTENT_MAINTENANCE = 'use_content_maintenance';           // メンテナンス画面に汎用コンテンツを使用するかどうか
        const CF_USE_CONTENT_ACCESS_DENY = 'use_content_access_deny';           // アクセス不可画面に汎用コンテンツを使用するかどうか
        const CF_USE_CONTENT_PAGE_NOT_FOUND = 'use_content_page_not_found';             // 存在しないページ画面に汎用コンテンツを使用するかどうか
-
+       const SK_SHOW_POPUP_STATUS = 'show_popup_status';               // ポップアップメッセージの表示状態
+       
        /**
         * コンストラクタ
         */
@@ -145,9 +146,20 @@ class admin_mainWidgetContainer extends admin_mainBaseWidgetContainer
                } else {
                        $retValue = $this->gPage->standardLoginLogoutRedirect($request, $success, $url);
                }
-               if ($retValue == 0){
+               if ($retValue == 0){            // 何も処理を行わなかったとき
                        if ($this->gEnv->isCurrentUserLogined()){       // ログインしている場合
                                if ($this->gEnv->isSystemAdmin()){      // システム管理者の場合
+                                       // ##### ポップアップメッセージ表示状態を取得 #####
+                                       $popupStatus = intval($this->getWidgetSession(self::SK_SHOW_POPUP_STATUS));
+                                       if (empty($popupStatus)){                       // 1度もメッセージが表示されていない場合
+                                               // セッションにログイン状態を更新
+                                               $this->setWidgetSession(self::SK_SHOW_POPUP_STATUS, 1);
+                                               
+                                               // ログイン直後のダッシュボードでメッセージを表示
+                                               $message = $this->gInstance->getMessageManager()->getMessage(MessageManager::MSG_ADMIN_POPUP_LOGIN, $this->_langId);
+                                               if (!empty($message)) $this->gInstance->getMessageManager()->addPopupMsg($message);
+                                       }
+                               
                                        // 表示画面を決定
                                        $task = $request->trimValueOf(M3_REQUEST_PARAM_OPERATION_TASK);
                                        $taskSrc = $task;
@@ -323,9 +335,11 @@ class admin_mainWidgetContainer extends admin_mainBaseWidgetContainer
                        } else {                // ログインしていないとき
                                // メッセージは何も表示しないでログイン画面へ
                        }
-               } else if ($retValue == 1 && $success == false){        // ログイン失敗の場合
-                       $this->SetMsg(self::MSG_APP_ERR, $this->_('Failed to login.'));                 // ログインに失敗しました
-                       if (!empty($url)) $this->redirectUrl = $url;    // リダイレクト先が設定されている場合は再設定
+               } else if ($retValue == 1){             // ログインの場合
+                       if (!$success){         // ログイン失敗の場合
+                               $this->SetMsg(self::MSG_APP_ERR, $this->_('Failed to login.'));                 // ログインに失敗しました
+                               if (!empty($url)) $this->redirectUrl = $url;    // リダイレクト先が設定されている場合は再設定
+                       }
                } else if ($retValue == 3){                     // パスワード送信のとき
 //                     $this->setGuidanceMsg($this->_('Password sent.'));              // パスワードを送信しました
                        $this->setSuccessMsg($this->_('Password sent.'));               // パスワードを送信しました
index 90eeffc..3a9d205 100644 (file)
@@ -5,7 +5,7 @@
  *\r
  * @package    Magic3 Framework\r
  * @author     平田直毅(Naoki Hirata) <naoki@aplo.co.jp>\r
- * @copyright  Copyright 2006-2014 Magic3 Project.\r
+ * @copyright  Copyright 2006-2016 Magic3 Project.\r
  * @license    http://www.gnu.org/copyleft/gpl.html  GPL License\r
  * @version    SVN: $Id$\r
  * @link       http://www.magic3.org\r
@@ -21,6 +21,7 @@ function updateItem(){
 }\r
 $(function() {\r
        m3SetConfigTable('config_table');\r
+       m3SetConfigTable('config_table2');\r
 });\r
 //]]>\r
 </script>\r
@@ -29,7 +30,7 @@ $(function() {
 <form method="post" name="main">\r
 <input type="hidden" name="task" value="configmessage" />\r
 <input type="hidden" name="act" />\r
-<h3><span {_HELP_CONFIGMESSAGE_MESSAGE}>メッセージ</span></h3>\r
+<h3><span {_HELP_CONFIGMESSAGE_MESSAGE}>ã\83\95ã\83­ã\83³ã\83\88ç\94»é\9d¢ç\94¨ã\83¡ã\83\83ã\82»ã\83¼ã\82¸</span></h3>\r
 <table id="config_table">\r
     <tbody>\r
     <tr>\r
@@ -49,6 +50,16 @@ $(function() {
        </tr>\r
     </tbody>\r
 </table>\r
+<h3>管理画面用メッセージ</h3>\r
+<table id="config_table2">\r
+    <tbody>\r
+    <tr>\r
+           <th><span {_HELP_CONFIGMESSAGE_ADMIN_POPUP_LOGIN}>ログイン時<br />ポップアップ</span></th>\r
+           <td><input type="text" name="item_msg_admin_popup_login" class="form-control" value="{MSG_ADMIN_POPUP_LOGIN}" maxlength="200" />\r
+           </td>\r
+       </tr>\r
+    </tbody>\r
+</table>\r
 <div class="well m3config_update_buttons"><input type="button" class="button" onclick="updateItem();" value="更新" /></div>\r
 </form>\r
 </div>\r