Ignore:
Timestamp:
2011/03/13 19:34:53 (13 years ago)
Author:
kotani
Message:

#920 (デザイン管理でプレビューを押すとシステムエラー)

  • PC以外のデバイスではプレビューできないようにした
  • レイアウト設定以外ではプレビューできないようにした
Location:
branches/version-2_5-dev/data
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/Smarty/templates/admin/design/bloc.tpl

    r20572 r20618  
    2929 
    3030    <!--{* ▼ブロック設定 *}--> 
    31  
    32     <!--{if $arrBlocData.tpl_path != '' and $preview == on}--> 
    33     <h3>プレビュー:</h3> 
    34     <div id="design-bloc-preview"> 
    35         <!--{include file=$arrBlocData.tpl_path}--> 
    36     </div> 
    37     <!--{/if}--> 
    38  
    3931    <table> 
    4032        <tr> 
     
    6557    <div class="btn-area"> 
    6658        <ul> 
    67             <li><a class="btn-action" href="javascript:;" name='preview' onclick="fnFormModeSubmit('form_bloc','preview','',''); return false;"><span class="btn-prev">プレビュー</span></a></li> 
    6859            <li><a class="btn-action" href="javascript:;" name='subm' onclick="fnFormModeSubmit('form_bloc','confirm','',''); return false;"><span class="btn-next">登録する</span></a></li> 
    6960        </ul> 
  • branches/version-2_5-dev/data/Smarty/templates/admin/design/header.tpl

    r20512 r20618  
    3030    <!--{* ▼ヘッダー編集ここから *}--> 
    3131    <h2>ヘッダー編集</h2> 
    32     <!--{* プレビューここから *}--> 
    33     <!--{if $header_prev == "on"}--> 
    34     <div id="design-header-preview"> 
    35         <!--{if $browser_type == 1}--> 
    36             <div style="zoom:0.8"><!--{include file="`$smarty.const.USER_REALDIR`include/preview/header.tpl"}--></div> 
    37         <!--{else}--> 
    38             <span class="attention"><strong>プレビューはIEでのみ表示されます。</strong></span> 
    39         <!--{/if}--> 
    40     </div> 
    41     <!--{/if}--> 
    42     <!--{* プレビューここまで *}--> 
    43  
    4432    <form name="form_header" id="form_header" method="post" action="?" > 
    4533    <input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" /> 
     
    5745        <div class="btn-area"> 
    5846                <ul> 
    59                     <li><a class="btn-action" href="javascript:;" name='preview' onclick="lfnSetBrowser('form_header', 'browser_type'); fnFormModeSubmit('form_header','preview','',''); return false;"><span class="btn-prev">プレビュー</span></a></li> 
    6047                    <li><a class="btn-action" href="javascript:;" name='subm' onclick="fnFormModeSubmit('form_header','regist','',''); return false;"><span class="btn-next">登録する</span></a></li> 
    6148                </ul> 
  • branches/version-2_5-dev/data/Smarty/templates/admin/design/index.tpl

    r20601 r20618  
    321321        <div class="btn-area"> 
    322322            <ul> 
     323            <!--{if $device_type_id == $smarty.const.DEVICE_TYPE_PC}--> 
    323324                <li><a class="btn-action" href="javascript:;" name='preview' onclick="doPreview();"<!--{if $page_id == "0" or $exists_page == "0"}--> DISABLED<!--{/if}-->><span class="btn-prev">プレビュー</span></a></li> 
     325            <!--{/if}--> 
    324326                <li><a class="btn-action" href="javascript:;" name='subm' onclick="fnTargetSelf(); fnFormModeSubmit('form1','confirm','',''); return false;"><span class="btn-next">登録する</span></a></li> 
    325327            </ul> 
  • branches/version-2_5-dev/data/Smarty/templates/admin/design/main_edit.tpl

    r20516 r20618  
    2424<script type="text/javascript"> 
    2525<!-- 
    26 function doPreview(){ 
    27     document.form_edit.mode.value="preview" 
    28     document.form_edit.target = "_blank"; 
    29     document.form_edit.submit(); 
    30 } 
    31  
    3226function fnTargetSelf(){ 
    3327    document.form_edit.target = "_self"; 
     
    10397    <div class="btn-area"> 
    10498        <ul> 
    105             <li><a class="btn-action" href="javascript:;" name='preview' onclick="doPreview(); return false;"><span class="btn-prev">プレビュー</span></a></li> 
    10699            <li><a class="btn-action" href="javascript:;" name='subm' onclick="fnTargetSelf(); fnFormModeSubmit('form_edit','confirm','',''); return false;"><span class="btn-next">登録する</span></a></li> 
    107100        </ul> 
  • branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Bloc.php

    r20560 r20618  
    117117 
    118118        switch($this->getMode()) { 
    119         case 'preview': 
    120             // プレビューファイル作成 
    121             $prev_path = USER_INC_REALDIR . 'preview/bloc_preview.tpl'; 
    122             // ディレクトリの作成 
    123             SC_Utils_Ex::sfMakeDir($prev_path); 
    124             $res = file_put_contents($prev_path, $_POST['bloc_html']); 
    125             if ($res === false) { 
    126                 SC_Utils_Ex::sfDispException(); 
    127             } 
    128  
    129             // プレビューデータ表示 
    130             $this->preview = 'on'; 
    131             $this->arrBlocData['tpl_data'] = $_POST['bloc_html']; 
    132             $this->arrBlocData['tpl_path'] = $prev_path; 
    133             $this->arrBlocData['bloc_name'] = $_POST['bloc_name']; 
    134             $this->arrBlocData['filename'] = $_POST['filename']; 
    135             $this->text_row = $_POST['html_area_row']; 
    136             break; 
    137119        case 'confirm': 
    138             $this->preview = 'off'; 
    139120            // エラーチェック 
    140121            $this->arrErr = $this->lfErrorCheck($_POST); 
     
    176157            break; 
    177158        case 'delete': 
    178             $this->preview = 'off'; 
    179159             // DBへデータを更新する 
    180160            $objQuery = new SC_Query_Ex();     // DB操作オブジェクト 
  • branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Header.php

    r20560 r20618  
    8787        // テンプレートのパス 
    8888        $template_path = $this->lfGetTemplatePath($device_type_id); 
    89         $preview_template_path = $this->lfGetPreviewTemplatePath(); 
    9089 
    9190        // データ更新処理 
     
    9392            $division = $_POST['division']; 
    9493            $content = $_POST[$division]; // TODO no checked? 
    95             // プレビュー用のテンプレートに書き込む 
    96             $preview_template = $preview_template_path.'/'.$division.'.tpl'; 
    97             $this->lfUpdateTemplate($preview_template, $content); 
    9894 
    9995            switch ($this->getMode()) { 
     
    104100                $this->tpl_onload="alert('登録が完了しました。');"; 
    105101                break; 
    106             case 'preview': 
    107                 if ($division == 'header') $this->header_prev = 'on'; 
    108                 if ($division == 'footer') $this->footer_prev = 'on'; 
    109                 $this->header_row = isset($_POST['header_row']) ? $_POST['header_row'] : $this->header_row; 
    110                 $this->footer_row = isset($_POST['footer_row']) ? $_POST['footer_row'] : $this->footer_row; 
    111                 break; 
    112102            default: 
    113103                // なにもしない 
    114104                break; 
    115105            } 
    116         }else{ 
    117             // postでデータが渡されなければ新規読み込みと判断をし、 
    118             // プレビュー用テンプレートに正規のテンプレートをロードする 
    119             $templates = array( 
    120                 'header.tpl', 
    121                 'footer.tpl' 
    122             ); 
    123             $this->lfLoadPreviewTemplates($preview_template_path, $template_path, $templates); 
    124106        } 
    125107 
    126108        // テキストエリアに表示 
    127         $this->header_data = file_get_contents($preview_template_path . '/header.tpl'); 
    128         $this->footer_data = file_get_contents($preview_template_path . '/footer.tpl'); 
     109        $this->header_data = file_get_contents($template_path . '/header.tpl'); 
     110        $this->footer_data = file_get_contents($template_path . '/footer.tpl'); 
    129111 
    130112        // ブラウザタイプ 
    131113        $this->browser_type = isset($_POST['browser_type']) ? $_POST['browser_type'] : ""; 
    132     } 
    133  
    134     protected function lfLoadPreviewTemplates($preview_template_path, $template_path, $templates) { 
    135         if (!is_dir($preview_template_path)) { 
    136             mkdir($preview_template_path); 
    137         } 
    138         foreach($templates as $template) { 
    139             $source = $template_path . '/' . $template; 
    140             $dest = $preview_template_path . '/' . $template; 
    141             copy($source, $dest); 
    142         } 
    143114    } 
    144115 
     
    154125    } 
    155126 
    156     protected function lfGetPreviewTemplatePath() { 
    157         return USER_INC_REALDIR . 'preview'; 
    158     } 
    159  
    160127    /** 
    161128     * デストラクタ. 
  • branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_MainEdit.php

    r20560 r20618  
    106106 
    107107        switch ($this->getMode()) { 
    108         case 'preview': 
    109             $this->lfPreviewPageData($page_id, $device_type_id); 
    110             exit; 
    111             break; 
    112  
    113108        case 'delete': 
    114109            if (!$this->objLayout->lfCheckBaseData($page_id, $device_type_id)) { 
     
    166161 
    167162        return $arrPageData[0]; 
    168     } 
    169  
    170     /** 
    171      * プレビュー画面を表示する. 
    172      * 
    173      * @param integer $page_id_old 元のページID 
    174      * @param integer $device_type_id 端末種別ID 
    175      * @return void 
    176      */ 
    177     function lfPreviewPageData($page_id_old, $device_type_id) { 
    178  
    179         // プレビューの場合ページIDを0にセットする。 
    180         $page_id = '0'; 
    181         $url = 'preview/index'; 
    182  
    183         $arrPreData = $this->objLayout->lfGetPageData("page_id = ? AND device_type_id = ?", 
    184                                                       array($page_id, $device_type_id)); 
    185  
    186         // DBへデータを更新する 
    187         $this->lfEntryPageData( 
    188             $device_type_id, 
    189             $page_id, 
    190             $_POST['page_name'], 
    191             $url, 
    192             $_POST['header_chk'], 
    193             $_POST['footer_chk'] 
    194         ); 
    195  
    196         // TPLファイル作成 
    197         $cre_tpl = $this->objLayout->getTemplatePath($device_type_id) . "{$url}.tpl"; 
    198         $this->lfCreateFile($cre_tpl, $_POST['tpl_data']); 
    199  
    200         // blocposition を削除 
    201         $objQuery = new SC_Query_Ex(); // DB操作オブジェクト 
    202         $ret = $objQuery->delete('dtb_blocposition', 'page_id = 0 AND device_type_id = ?', array($device_type_id)); 
    203  
    204         if ($page_id_old != "") { 
    205             // 登録データを取得 
    206             $sql = 'SELECT target_id, bloc_id, bloc_row FROM dtb_blocposition WHERE page_id = ? AND device_type_id = ?'; 
    207             $ret = $objQuery->getAll($sql, array($page_id_old, $device_type_id)); 
    208  
    209             // blocposition を複製 
    210             foreach($ret as $row){ 
    211                 $row['page_id'] = $page_id; 
    212                 $row['device_type_id'] = $device_type_id; 
    213                 $objQuery->insert('dtb_blocposition', $row); 
    214             } 
    215         } 
    216         $_SESSION['preview'] = 'ON'; 
    217         SC_Response_Ex::sendRedirectFromUrlPath('preview/' . DIR_INDEX_PATH, array('filename' => $arrPageData[0]['filename'])); 
    218163    } 
    219164 
Note: See TracChangeset for help on using the changeset viewer.