Changeset 20618 for branches/version-2_5-dev
- Timestamp:
- 2011/03/13 19:34:53 (13 years ago)
- 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 29 29 30 30 <!--{* ▼ブロック設定 *}--> 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 39 31 <table> 40 32 <tr> … … 65 57 <div class="btn-area"> 66 58 <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>68 59 <li><a class="btn-action" href="javascript:;" name='subm' onclick="fnFormModeSubmit('form_bloc','confirm','',''); return false;"><span class="btn-next">登録する</span></a></li> 69 60 </ul> -
branches/version-2_5-dev/data/Smarty/templates/admin/design/header.tpl
r20512 r20618 30 30 <!--{* ▼ヘッダー編集ここから *}--> 31 31 <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 44 32 <form name="form_header" id="form_header" method="post" action="?" > 45 33 <input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" /> … … 57 45 <div class="btn-area"> 58 46 <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>60 47 <li><a class="btn-action" href="javascript:;" name='subm' onclick="fnFormModeSubmit('form_header','regist','',''); return false;"><span class="btn-next">登録する</span></a></li> 61 48 </ul> -
branches/version-2_5-dev/data/Smarty/templates/admin/design/index.tpl
r20601 r20618 321 321 <div class="btn-area"> 322 322 <ul> 323 <!--{if $device_type_id == $smarty.const.DEVICE_TYPE_PC}--> 323 324 <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}--> 324 326 <li><a class="btn-action" href="javascript:;" name='subm' onclick="fnTargetSelf(); fnFormModeSubmit('form1','confirm','',''); return false;"><span class="btn-next">登録する</span></a></li> 325 327 </ul> -
branches/version-2_5-dev/data/Smarty/templates/admin/design/main_edit.tpl
r20516 r20618 24 24 <script type="text/javascript"> 25 25 <!-- 26 function doPreview(){27 document.form_edit.mode.value="preview"28 document.form_edit.target = "_blank";29 document.form_edit.submit();30 }31 32 26 function fnTargetSelf(){ 33 27 document.form_edit.target = "_self"; … … 103 97 <div class="btn-area"> 104 98 <ul> 105 <li><a class="btn-action" href="javascript:;" name='preview' onclick="doPreview(); return false;"><span class="btn-prev">プレビュー</span></a></li>106 99 <li><a class="btn-action" href="javascript:;" name='subm' onclick="fnTargetSelf(); fnFormModeSubmit('form_edit','confirm','',''); return false;"><span class="btn-next">登録する</span></a></li> 107 100 </ul> -
branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Bloc.php
r20560 r20618 117 117 118 118 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;137 119 case 'confirm': 138 $this->preview = 'off';139 120 // エラーチェック 140 121 $this->arrErr = $this->lfErrorCheck($_POST); … … 176 157 break; 177 158 case 'delete': 178 $this->preview = 'off';179 159 // DBへデータを更新する 180 160 $objQuery = new SC_Query_Ex(); // DB操作オブジェクト -
branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Header.php
r20560 r20618 87 87 // テンプレートのパス 88 88 $template_path = $this->lfGetTemplatePath($device_type_id); 89 $preview_template_path = $this->lfGetPreviewTemplatePath();90 89 91 90 // データ更新処理 … … 93 92 $division = $_POST['division']; 94 93 $content = $_POST[$division]; // TODO no checked? 95 // プレビュー用のテンプレートに書き込む96 $preview_template = $preview_template_path.'/'.$division.'.tpl';97 $this->lfUpdateTemplate($preview_template, $content);98 94 99 95 switch ($this->getMode()) { … … 104 100 $this->tpl_onload="alert('登録が完了しました。');"; 105 101 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;112 102 default: 113 103 // なにもしない 114 104 break; 115 105 } 116 }else{117 // postでデータが渡されなければ新規読み込みと判断をし、118 // プレビュー用テンプレートに正規のテンプレートをロードする119 $templates = array(120 'header.tpl',121 'footer.tpl'122 );123 $this->lfLoadPreviewTemplates($preview_template_path, $template_path, $templates);124 106 } 125 107 126 108 // テキストエリアに表示 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'); 129 111 130 112 // ブラウザタイプ 131 113 $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 }143 114 } 144 115 … … 154 125 } 155 126 156 protected function lfGetPreviewTemplatePath() {157 return USER_INC_REALDIR . 'preview';158 }159 160 127 /** 161 128 * デストラクタ. -
branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_MainEdit.php
r20560 r20618 106 106 107 107 switch ($this->getMode()) { 108 case 'preview':109 $this->lfPreviewPageData($page_id, $device_type_id);110 exit;111 break;112 113 108 case 'delete': 114 109 if (!$this->objLayout->lfCheckBaseData($page_id, $device_type_id)) { … … 166 161 167 162 return $arrPageData[0]; 168 }169 170 /**171 * プレビュー画面を表示する.172 *173 * @param integer $page_id_old 元のページID174 * @param integer $device_type_id 端末種別ID175 * @return void176 */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']));218 163 } 219 164
Note: See TracChangeset
for help on using the changeset viewer.