Changeset 20275
- Timestamp:
- 2011/02/21 00:30:56 (13 years ago)
- Location:
- branches/version-2_5-dev/data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/Smarty/templates/admin/design/header.tpl
r20116 r20275 32 32 <!--{* プレビューここから *}--> 33 33 <!--{if $header_prev == "on"}--> 34 <di cid="design-header-preview">34 <div id="design-header-preview"> 35 35 <!--{if $browser_type == 1}--> 36 36 <div style="zoom:0.8"><!--{include file="`$smarty.const.USER_REALDIR`include/preview/header.tpl"}--></div> … … 51 51 <textarea id="header-area" class="top" name="header" rows="<!--{$header_row}-->" wrap="off" style="width: 100%;"><!--{$header_data|smarty:nodefaults}--></textarea> 52 52 <div class="btn"> 53 <a id="header-area-resize-btn" class="btn-normal" href="javascript:;" onclick="ChangeSize('#header-area-resize-btn', '#header-area', 50, 13); return false;"><span>拡大</span></a>53 <a id="header-area-resize-btn" class="btn-normal" href="javascript:;" onclick="ChangeSize('#header-area-resize-btn', '#header-area', 50, 13); $('input[name=header_row]').val($('#header-area').attr('rows'));return false;"><span>拡大</span></a> 54 54 </div> 55 55 … … 57 57 <ul> 58 58 <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> 59 <li><a class="btn-action" href="javascript:;" name='subm' onclick="fnFormModeSubmit('form_header',' confirm','',''); return false;"><span class="btn-next">登録する</span></a></li>59 <li><a class="btn-action" href="javascript:;" name='subm' onclick="fnFormModeSubmit('form_header','regist','',''); return false;"><span class="btn-next">登録する</span></a></li> 60 60 </ul> 61 61 </div> … … 85 85 <textarea id="footer-area" class="top" name="footer" rows="<!--{$footer_row}-->" style="width: 100%;"><!--{$footer_data|smarty:nodefaults}--></textarea> 86 86 <div class="btn"> 87 <a id="footer-area-resize-btn" class="btn-normal" href="javascript:;" onclick="ChangeSize('#footer-area-resize-btn', '#footer-area', 50, 13); return false;"><span>拡大</span></a>87 <a id="footer-area-resize-btn" class="btn-normal" href="javascript:;" onclick="ChangeSize('#footer-area-resize-btn', '#footer-area', 50, 13); $('input[name=footer_row]').val($('#footer-area').attr('rows'));return false;"><span>拡大</span></a> 88 88 </div> 89 89 … … 91 91 <ul> 92 92 <li><a class="btn-action" href="javascript:;" name='preview' onclick="lfnSetBrowser('form_footer', 'browser_type'); fnFormModeSubmit('form_footer','preview','',''); return false;"><span class="btn-prev">プレビュー</span></a></li> 93 <li><a class="btn-action" href="javascript:;" name='subm' onclick="fnFormModeSubmit('form_footer',' confirm','',''); return false;"><span class="btn-next">登録する</span></a></li>93 <li><a class="btn-action" href="javascript:;" name='subm' onclick="fnFormModeSubmit('form_footer','regist','',''); return false;"><span class="btn-next">登録する</span></a></li> 94 94 </ul> 95 95 </div> -
branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Header.php
r20116 r20275 75 75 SC_Utils_Ex::sfIsSuccess($objSess); 76 76 77 $this->objLayout = new SC_Helper_PageLayout_Ex();78 79 77 // 端末種別IDを取得 80 78 if (isset($_REQUEST['device_type_id']) … … 84 82 $device_type_id = DEVICE_TYPE_PC; 85 83 } 84 $this->device_type_id = $device_type_id; 86 85 87 $division = isset($_POST['division']) ? $_POST['division'] : ""; 88 $pre_DIR = USER_INC_REALDIR . 'preview/'; 86 // テンプレートのパス 87 $template_path = $this->lfGetTemplatePath($device_type_id); 88 $preview_template_path = $this->lfGetPreviewTemplatePath(); 89 89 90 90 // データ更新処理 91 if ($division != ''){ 92 // プレビュー用テンプレートに書き込み 93 $fp = fopen($pre_DIR.$division.'.tpl',"w"); // TODO 94 fwrite($fp, $_POST[$division]); 95 fclose($fp); 91 if (isset($_POST['division']) && $_POST['division'] != '') { 92 $division = $_POST['division']; 93 $content = $_POST[$division]; // TODO no checked? 94 // プレビュー用のテンプレートに書き込む 95 $preview_template = $preview_template_path.'/'.$division.'.tpl'; 96 $this->lfUpdateTemplate($preview_template, $content); 96 97 97 // 登録時はプレビュー用テンプレートをコピーする98 98 switch ($this->getMode()) { 99 99 case 'regist': 100 copy($pre_DIR.$division.".tpl", $this->objLayout->getTemplatePath($device_type_id) . $division . ".tpl"); 101 // 完了メッセージ(プレビュー時は表示しない) 100 // 正規のテンプレートに書き込む 101 $template = $template_path . '/' . $division . '.tpl'; 102 $this->lfUpdateTemplate($template, $content); 102 103 $this->tpl_onload="alert('登録が完了しました。');"; 103 104 // テキストエリアの幅を元に戻す(処理の統一のため)105 $_POST['header_row'] = "";106 $_POST['footer_row'] = "";107 104 break; 108 105 case 'preview': 109 106 if ($division == "header") $this->header_prev = "on"; 110 107 if ($division == "footer") $this->footer_prev = "on"; 108 $this->header_row = isset($_POST['header_row']) ? $_POST['header_row'] : $this->header_row; 109 $this->footer_row = isset($_POST['footer_row']) ? $_POST['footer_row'] : $this->footer_row; 111 110 break; 112 111 default: 112 // なにもしない 113 113 break; 114 114 } 115 // ヘッダーファイルの読み込み(プレビューデータ)116 $header_data = file_get_contents($pre_DIR . "header.tpl");117 118 // フッターファイルの読み込み(プレビューデータ)119 $footer_data = file_get_contents($pre_DIR . "footer.tpl");120 115 }else{ 121 // postでデータが渡されなければ新規読み込みと判断をし、プレビュー用データを正規のデータで上書きする 122 if (!is_dir($pre_DIR)) { 123 mkdir($pre_DIR); 124 } 125 126 // ユーザーパスにテンプレートが存在しなければ, 127 // 指定テンプレートから読み込む 128 $header_tpl = $this->objLayout->getTemplatePath($device_type_id) . "header.tpl"; 129 $footer_tpl = $this->objLayout->getTemplatePath($device_type_id) . "footer.tpl"; 130 131 copy($header_tpl, $pre_DIR . "header.tpl"); 132 copy($footer_tpl, $pre_DIR . "footer.tpl"); 133 134 // ヘッダーファイルの読み込み 135 $header_data = file_get_contents($header_tpl); 136 // フッターファイルの読み込み 137 $footer_data = file_get_contents($footer_tpl); 116 // postでデータが渡されなければ新規読み込みと判断をし、 117 // プレビュー用テンプレートに正規のテンプレートをロードする 118 $templates = array( 119 'header.tpl', 120 'footer.tpl' 121 ); 122 $this->lfLoadPreviewTemplates($preview_template_path, $template_path, $templates); 138 123 } 139 124 140 125 // テキストエリアに表示 141 $this->header_data = $header_data; 142 $this->footer_data = $footer_data; 143 $this->device_type_id = $device_type_id; 144 145 if (isset($_POST['header_row']) && $_POST['header_row'] != ''){ 146 $this->header_row = $_POST['header_row']; 147 } 148 149 if (isset($_POST['footer_row']) && $_POST['footer_row'] != ''){ 150 $this->footer_row = $_POST['footer_row']; 151 } 126 $this->header_data = file_get_contents($preview_template_path . '/header.tpl'); 127 $this->footer_data = file_get_contents($preview_template_path . '/footer.tpl'); 152 128 153 129 // ブラウザタイプ 154 $this->browser_type = 155 isset($_POST['browser_type']) ? $_POST['browser_type'] : ""; 130 $this->browser_type = isset($_POST['browser_type']) ? $_POST['browser_type'] : ""; 131 } 132 133 protected function lfLoadPreviewTemplates($preview_template_path, $template_path, $templates) { 134 if (!is_dir($preview_template_path)) { 135 mkdir($preview_template_path); 136 } 137 foreach($templates as $template) { 138 $source = $template_path . '/' . $template; 139 $dest = $preview_template_path . '/' . $template; 140 copy($source, $dest); 141 } 142 } 143 144 protected function lfUpdateTemplate($template, $content) { 145 $fp = fopen($template,"w"); 146 fwrite($fp, $content); 147 fclose($fp); 148 } 149 150 protected function lfGetTemplatePath($device_type_id) { 151 $objLayout = new SC_Helper_PageLayout_Ex(); 152 return $objLayout->getTemplatePath($device_type_id); 153 } 154 155 protected function lfGetPreviewTemplatePath() { 156 return USER_INC_REALDIR . 'preview'; 156 157 } 157 158 … … 165 166 } 166 167 } 167 ?>
Note: See TracChangeset
for help on using the changeset viewer.