Ignore:
Timestamp:
2010/12/30 18:50:01 (13 years ago)
Author:
Seasoft
Message:

#825(ページクラスとテンプレートのファイル名を一致させる)
#748(モバイル/スマートフォンのデザイン管理機能)

  • 新規ブロックを登録できない不具合を改修
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Bloc.php

    r19768 r19795  
    8080            $bloc_id = $_REQUEST['bloc_id']; 
    8181        } else { 
    82             $bloc_id = 1; 
     82            $bloc_id = null; 
    8383        } 
    8484        $this->bloc_id = $bloc_id; 
     
    9393 
    9494        $this->objLayout = new SC_Helper_PageLayout_Ex(); 
    95         $package_path = $this->objLayout->getTemplatePath($device_type_id); 
     95        $package_path = $this->objLayout->getTemplatePath($device_type_id) . BLOC_DIR; 
    9696 
    9797        // ブロック一覧を取得 
     
    103103                                                array($bloc_id, $device_type_id)); 
    104104 
    105             $arrBlocData[0]['tpl_path'] = $this->objLayout->getTemplatePath($device_type_id) . $arrBlocData[0]['tpl_path']; 
     105            $tplPath = $package_path . $arrBlocData[0]['filename'] . '.tpl'; 
    106106 
    107107            // テンプレートファイルの読み込み 
    108             $arrBlocData[0]['tpl_data'] = file_get_contents($arrBlocData[0]['tpl_path']); 
     108            $arrBlocData[0]['tpl_data'] = file_get_contents($tplPath); 
    109109            $this->arrBlocData = $arrBlocData[0]; 
    110110        } 
     
    124124            // ディレクトリの作成 
    125125            SC_Utils::sfMakeDir($prev_path); 
    126             $fp = fopen($prev_path,"w"); 
    127             fwrite($fp, $_POST['bloc_html']); // FIXME いきなり POST はちょっと... 
    128             fclose($fp); 
     126            $res = file_put_contents($new_bloc_path, $_POST['bloc_html']); 
     127            if ($res === false) { 
     128                SC_Utils_Ex::sfDispException(); 
     129            } 
    129130 
    130131            // プレビューデータ表示 
     
    147148 
    148149                // 旧ファイルの削除 
    149                 $old_bloc_path = $package_path . $arrBlocData[0]['tpl_path']; 
    150                 if (file_exists($old_bloc_path)) { 
    151                     unlink($old_bloc_path); 
     150                if (file_exists($tplPath)) { 
     151                    unlink($tplPath); 
    152152                } 
    153153 
    154154                // ファイル作成 
    155                 $new_bloc_path = $package_path . BLOC_DIR . $_POST['filename'] . ".tpl"; 
     155                $new_bloc_path = $package_path . $_POST['filename'] . ".tpl"; 
    156156                // ディレクトリの作成 
    157157                SC_Utils::sfMakeDir($new_bloc_path); 
    158                 $fp = fopen($new_bloc_path,"w"); 
    159                 fwrite($fp, $_POST['bloc_html']); // FIXME いきなり POST はちょっと... 
    160                 fclose($fp); 
     158                $res = file_put_contents($new_bloc_path, $_POST['bloc_html']); 
     159                if ($res === false) { 
     160                    SC_Utils_Ex::sfDispException(); 
     161                } 
    161162 
    162163                $arrBlocData = $this->lfGetBlocData("filename = ? AND device_type_id = ?", 
     
    198199 
    199200                // ファイルの削除 
    200                 $del_file = $package_path . BLOC_DIR . $arrBlocData[0]['filename']. '.tpl'; 
    201                 if(file_exists($del_file)){ 
    202                     unlink($del_file); 
     201                if (file_exists($tplPath)) { 
     202                    unlink($tplPath); 
    203203                } 
    204204            } 
     
    254254        // 更新データ生成 
    255255        $arrUpdData = array("bloc_name" => $arrData['bloc_name'], 
    256                             "tpl_path" => BLOC_DIR . $arrData['filename'] . '.tpl', 
     256                            "tpl_path" => $arrData['filename'] . '.tpl', 
    257257                            "filename" => $arrData['filename']); 
    258258 
Note: See TracChangeset for help on using the changeset viewer.