OSDN Git Service

「イベントメイン」ウィジェットに画像管理画面追加。
authornaoki hirata <naoki@magic3.org>
Sun, 15 Mar 2015 10:37:55 +0000 (19:37 +0900)
committernaoki hirata <naoki@magic3.org>
Sun, 15 Mar 2015 10:37:55 +0000 (19:37 +0900)
widgets/event_main/include/container/admin_event_mainEntryWidgetContainer.php
widgets/event_main/include/container/admin_event_mainImageWidgetContainer.php
widgets/event_main/include/template/admin_entry_detail.tmpl.html
widgets/event_main/include/template/admin_image.tmpl.html

index 8152ec4..3d5cf20 100644 (file)
@@ -295,7 +295,7 @@ class admin_event_mainEntryWidgetContainer extends admin_event_mainBaseWidgetCon
                $act = $request->trimValueOf('act');
                $this->langId = $request->trimValueOf('item_lang');                             // 現在メニューで選択中の言語
                if (empty($this->langId)) $this->langId = $this->gEnv->getDefaultLanguage();                    // 言語が選択されていないときは、デフォルト言語を設定
-               $this->entryId = $request->trimValueOf('entryid');              // 記事エントリーID
+               $this->entryId = $request->trimValueOf(M3_REQUEST_PARAM_EVENT_ID);              // 記事エントリーID
                $this->serialNo = $request->trimValueOf('serial');              // 選択項目のシリアル番号
                $name = $request->trimValueOf('item_name');
                $html = $request->valueOf('item_html');
@@ -650,7 +650,30 @@ class admin_event_mainEntryWidgetContainer extends admin_event_mainBaseWidgetCon
                                }
                        }
                } else {        // 初期画面表示のとき
-                       $reloadData = true;             // データの再ロード
+                       // ##### ブログ記事IDが設定されているとき(他ウィジェットからの表示)は、データを取得 #####
+                       if (empty($this->entryId)){
+                               if (!empty($this->serialNo)){           // シリアル番号で指定の場合
+                                       $reloadData = true;             // データの再読み込み
+                               }
+                       } else {
+                               // 多言語対応の場合は、言語を取得
+                               if ($this->isMultiLang){                // 多言語対応の場合
+                                       $langId = $request->trimValueOf(M3_REQUEST_PARAM_OPERATION_LANG);               // lang値を取得
+                                       if (!empty($langId)) $this->langId = $langId;
+                               }
+               
+                               // ブログ記事を取得
+                               $ret = self::$_mainDb->getEntryItem($this->entryId, $this->langId, $row);
+                               if ($ret){
+                                       $this->serialNo = $row['ee_serial'];            // シリアル番号
+                                       $reloadData = true;             // データの再読み込み
+                               } else {
+                                       $this->serialNo = 0;
+                               }
+                       }
+                       if (empty($this->serialNo)){
+                               $reloadData = true;             // 初期データ取得
+                       }
                }
                
                // 設定データを再取得
@@ -785,7 +808,9 @@ class admin_event_mainEntryWidgetContainer extends admin_event_mainBaseWidgetCon
                        // デフォルト言語を最初に登録
 //                     $this->tmpl->addVar("default_lang", "default_lang", $defaultLangName);
 //                     $this->tmpl->setAttribute('default_lang', 'visibility', 'visible');
-                       $this->tmpl->addVar('_widget', 'preview_btn_disabled', 'disabled');// プレビューボタン使用不可
+                       $this->tmpl->addVar('_widget', 'preview_btn_disabled', 'disabled');             // プレビューボタン使用不可
+                       $this->tmpl->addVar('_widget', 'image_btn_disabled', 'disabled');               // 画像ボタン使用不可
+                       $this->tmpl->addVar('cancel_button', 'new_btn_disabled', 'disabled');   // 「新規」ボタン使用不可
                } else {
                        $this->tmpl->addVar('_widget', 'id', $this->entryId);
                        
index 13ee0e2..317c84e 100644 (file)
@@ -60,7 +60,7 @@ class admin_event_mainImageWidgetContainer extends admin_event_mainBaseWidgetCon
                $userId         = $this->gEnv->getCurrentUserId();
                $langId = $this->gEnv->getDefaultLanguage();            // 表示言語を取得
                $act = $request->trimValueOf('act');
-               $entryId = $request->trimValueOf(M3_REQUEST_PARAM_EVENT_ENTRY_ID);
+               $entryId = $request->trimValueOf(M3_REQUEST_PARAM_EVENT_ID);
                $act = $request->trimValueOf('act');
                
                $reloadData = false;            // データを再取得するかどうか
@@ -156,12 +156,12 @@ class admin_event_mainImageWidgetContainer extends admin_event_mainBaseWidgetCon
 
                $ret = self::$_mainDb->getEntryItem($entryId, $langId, $row);
                if ($ret){
-                       $html           = $row['be_html'];                              // HTML
-                       $html2          = $row['be_html_ext'];                  // HTML続き
+                       $html           = $row['ee_html'];                              // HTML
+                       $html2          = $row['ee_html_ext'];                  // HTML続き
                
                        // ### 現在設定されているアイキャッチ画像 ###
                        // 最大サイズのアイキャッチ画像を取得。公開ディレクトリになければデフォルト画像を表示。
-                       $eyecatchUrl = event_mainCommonDef::getEyecatchImageUrl($row['be_thumb_filename'], self::$_configArray[event_mainCommonDef::CF_ENTRY_DEFAULT_IMAGE]);
+                       $eyecatchUrl = event_mainCommonDef::getEyecatchImageUrl($row['ee_thumb_filename'], self::$_configArray[event_mainCommonDef::CF_ENTRY_DEFAULT_IMAGE]);
                        
                        // ### 置き換え用アイキャッチ画像 ###
                        // 画像ファイル名、フォーマット取得
@@ -185,7 +185,7 @@ class admin_event_mainImageWidgetContainer extends admin_event_mainBaseWidgetCon
                        $originalEyecatchUrl = '';
                        $privateThumbDir = $this->gInstance->getImageManager()->getSystemPrivateThumbPath(M3_VIEW_TYPE_EVENT, event_mainCommonDef::$_deviceType);
                        $imagePath = $privateThumbDir . '/' . $filename;
-                       if (!empty($row['be_thumb_filename']) && !file_exists($imagePath)){// 画像が作成されていて、非公開ディレクトリに画像がない場合
+                       if (!empty($row['ee_thumb_filename']) && !file_exists($imagePath)){// 画像が作成されていて、非公開ディレクトリに画像がない場合
                                // アイキャッチを作成したソース画像を取得
                                $originalEyecatchPath = $this->gInstance->getImageManager()->getFirstImagePath($html);
                                if (empty($originalEyecatchPath) && !empty($html2)) $originalEyecatchPath = $this->gInstance->getImageManager()->getFirstImagePath($html2);             // 本文1に画像がないときは本文2を検索
@@ -193,7 +193,7 @@ class admin_event_mainImageWidgetContainer extends admin_event_mainBaseWidgetCon
                        }
                        
                        // アイキャッチ画像削除用ボタンを表示
-                       if (!empty($row['be_thumb_filename'])) $this->tmpl->setAttribute('delete_eyecatch_button', 'visibility', 'visible');
+                       if (!empty($row['ee_thumb_filename'])) $this->tmpl->setAttribute('delete_eyecatch_button', 'visibility', 'visible');
                }
                // Ajax用URL
                $ajaxUrl = M3_REQUEST_PARAM_OPERATION_COMMAND . '=' . M3_REQUEST_CMD_CONFIG_WIDGET . '&widget=' . $this->gEnv->getCurrentWidgetId();
@@ -228,7 +228,7 @@ class admin_event_mainImageWidgetContainer extends admin_event_mainBaseWidgetCon
         */
        function createCropImage($request)
        {
-               $entryId = $request->trimValueOf(M3_REQUEST_PARAM_EVENT_ENTRY_ID);
+               $entryId = $request->trimValueOf(M3_REQUEST_PARAM_EVENT_ID);
                $type = $request->trimValueOf('type');          // 画像タイプ
                $src = $request->trimValueOf('src');    // 画像URL
                $x = $request->trimValueOf('x');
@@ -276,7 +276,7 @@ class admin_event_mainImageWidgetContainer extends admin_event_mainBaseWidgetCon
         */
        function getImageByType($request)
        {
-               $entryId = $request->trimValueOf(M3_REQUEST_PARAM_EVENT_ENTRY_ID);
+               $entryId = $request->trimValueOf(M3_REQUEST_PARAM_EVENT_ID);
                $type = $request->trimValueOf('type');          // 画像タイプ
                
                // 作業ディレクトリを取得
@@ -328,7 +328,7 @@ class admin_event_mainImageWidgetContainer extends admin_event_mainBaseWidgetCon
                $imageUrl .= '&' . M3_REQUEST_PARAM_WIDGET_ID . '=' . $this->gEnv->getCurrentWidgetId();        // ウィジェットID
                $imageUrl .= '&' . M3_REQUEST_PARAM_OPERATION_TASK . '=' . self::TASK_IMAGE;
                $imageUrl .= '&' . M3_REQUEST_PARAM_OPERATION_ACT . '=' . self::ACT_GET_IMAGE;
-               $imageUrl .= '&' . M3_REQUEST_PARAM_EVENT_ENTRY_ID . '=' . $entryId;
+               $imageUrl .= '&' . M3_REQUEST_PARAM_EVENT_ID . '=' . $entryId;
 //             $imageUrl .= '&type=' . $type;
                $imageUrl .= '&' . date('YmdHis');
                return $imageUrl;
index 52e800f..8995ae6 100644 (file)
 <patTemplate:tmpl name="_widget">\r
 <script type="text/javascript">\r
 //<![CDATA[\r
+function newItem(){\r
+       document.main.act.value = 'new';\r
+       document.main.submit();\r
+       return true;\r
+}\r
 function addItem(){\r
        if (!window.confirm('項目を新規追加しますか?')) return false;\r
        \r
@@ -80,7 +85,7 @@ function previewInOtherWindow()
        return true;\r
 }\r
 function editEntry(serial){\r
-       document.main.entryid.value = '';               // 値キャンセル\r
+       document.main.eventid.value = '';               // 値キャンセル\r
        document.main.task.value = 'entry_detail';\r
        document.main.act.value = 'edit';\r
        document.main.serial.value = serial;\r
@@ -142,11 +147,11 @@ $(function(){
 <input type="hidden" name="task" value="entry_detail" />\r
 <input type="hidden" name="act" />\r
 <input type="hidden" name="serial" value="{SERIAL}" />\r
-<input type="hidden" name="entryid" value="{ENTRY}" />\r
+<input type="hidden" name="eventid" value="{ENTRY}" />\r
 <h3 class="m3config_h"><span {_HELP_ENTRY_DETAIL}>イベント記事詳細</span></h3>\r
 <patTemplate:tmpl name="cancel_button" visibility="visible">\r
 <div class="m3config_h_side_buttons pull-right"><div {_HELP_ENTRY_BUTTONS}><div class="btn-group">\r
-<input type="button" class="button" onclick="listItem();" value="戻る" />\r
+<input type="button" class="button" onclick="newItem();" value="新規" {NEW_BTN_DISABLED} /><input type="button" class="button" onclick="listItem();" value="戻る" />\r
 </div></div></div>\r
 </patTemplate:tmpl>\r
 <div class="m3config_h_side_buttons pull-right" style="margin-right:10px;"><div {_HELP_ENTRY_BUTTONS2}><div class="btn-group">\r
index 96f6a43..97d9bb9 100644 (file)
@@ -104,7 +104,7 @@ function createEyecatch(url)
        dialogText += '<form method="post" id="modalform" name="modalform">';
        dialogText += '<input type="hidden" name="task" value="image" />';
        dialogText += '<input type="hidden" name="act" value="createimage" />';
-       dialogText += '<input type="hidden" name="entryid" value="{ENTRY_ID}" />';
+       dialogText += '<input type="hidden" name="eventid" value="{ENTRY_ID}" />';
        dialogText += '<input type="hidden" id="src" name="src" value="' + url + '" />';
        dialogText += '<input type="hidden" id="x" name="x" />';
        dialogText += '<input type="hidden" id="y" name="y" />';
@@ -196,7 +196,7 @@ $(function()
 <form method="post" name="main">
 <input type="hidden" name="task" value="image" />
 <input type="hidden" name="act" />
-<input type="hidden" name="entryid" value="{ENTRY_ID}" />
+<input type="hidden" name="eventid" value="{ENTRY_ID}" />
 <input type="hidden" name="originaleyecatchurl" value="{ORIGINAL_EYECATCH_URL}" />
 <!-- m3:PostParam -->
 <h3 class="m3config_h"><span {_HELP_IMAGE_IMAGE}>イベント記事画像</span></h3>