Changeset 16676


Ignore:
Timestamp:
2007/11/04 20:07:39 (16 years ago)
Author:
naka
Message:

テンプレート生成時にディレクトリがない場合は自動生成

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update/data/class/pages/admin/design/LC_Page_Admin_Design_Bloc.php

    r16582 r16676  
    106106 
    107107        if (!isset($_POST['mode'])) $_POST['mode'] = ""; 
    108  
    109         // プレビュー表示 
    110         if ($_POST['mode'] == "preview") { 
     108                 
     109        switch($_POST['mode']) { 
     110        case 'preview': 
    111111            // プレビューファイル作成 
    112112            $prev_path = USER_INC_PATH . 'preview/bloc_preview.tpl'; 
    113             // TODO 一応, is_write 等でチェックすべき? 
     113            // ディレクトリの作成             
     114            SC_Utils::sfMakeDir($prev_path);             
    114115            $fp = fopen($prev_path,"w"); 
    115116            fwrite($fp, $_POST['bloc_html']); // FIXME いきなり POST はちょっと... 
     
    123124            $this->arrBlocData['filename'] = $_POST['filename']; 
    124125            $this->text_row = $_POST['html_area_row']; 
    125         }else{ 
    126             $this->preview = "off"; 
    127         } 
    128  
    129         // データ登録処理 
    130         if ($_POST['mode'] == 'confirm') { 
    131  
     126            break; 
     127        case 'confirm': 
     128            $this->preview = "off"; 
    132129            // エラーチェック 
    133130            $this->arrErr = $this->lfErrorCheck($_POST); 
     
    138135                $this->lfEntryBlocData($_POST); 
    139136 
    140                 // ファイルの削除 
    141                 //$del_file=BLOC_PATH . $arrBlocData[0]['filename']. '.tpl'; 
    142                 $del_file = USER_PATH . $arrBlocData[0]['tpl_path']; 
    143                 if (file_exists($del_file)) { 
    144                     unlink($del_file); 
     137                // 旧ファイルの削除 
     138                $old_bloc_path = USER_PATH . $arrBlocData[0]['tpl_path']; 
     139                if (file_exists($old_bloc_path)) { 
     140                    unlink($old_bloc_path); 
    145141                } 
    146  
     142                 
    147143                // ファイル作成 
    148                 $fp = fopen(USER_PATH . BLOC_DIR . $_POST['filename'] . '.tpl',"w"); 
     144                $new_bloc_path = USER_PATH . BLOC_DIR . $_POST['filename'] . ".tpl"; 
     145                // ディレクトリの作成             
     146                SC_Utils::sfMakeDir($new_bloc_path); 
     147                $fp = fopen($new_bloc_path,"w"); 
    149148                fwrite($fp, $_POST['bloc_html']); // FIXME いきなり POST はちょっと... 
    150149                fclose($fp); 
     
    160159                $this->arrBlocData = $_POST; 
    161160            } 
    162         } 
    163  
    164         // データ削除処理 
    165         if ($_POST['mode'] == 'delete') { 
    166  
    167             // DBへデータを更新する 
    168             $objDBConn = new SC_DbConn;     // DB操作オブジェクト 
    169             $sql = "";                      // データ更新SQL生成用 
    170             $ret = "";                      // データ更新結果格納用 
    171             $arrDelData = array();          // 更新データ生成用 
     161            break; 
     162        case 'delete': 
     163            $this->preview = "off"; 
     164             // DBへデータを更新する 
     165            $objDBConn = new SC_DbConn;     // DB操作オブジェクト 
     166            $sql = "";                      // データ更新SQL生成用 
     167            $ret = "";                      // データ更新結果格納用 
     168            $arrDelData = array();          // 更新データ生成用 
    172169 
    173170            // 更新データ生成 
     
    193190            } 
    194191            $this->sendRedirect($this->getLocation("./bloc.php")); 
    195         } 
     192            break; 
     193        default: 
     194            if(isset($_POST['mode'])) { 
     195               GC_Utils::gfPrintLog("MODEエラー:".$_POST['mode']); 
     196            } 
     197            break; 
     198        }         
    196199 
    197200        // 画面の表示 
Note: See TracChangeset for help on using the changeset viewer.