Changeset 16677
- Timestamp:
- 2007/11/04 22:03:55 (15 years ago)
- Location:
- branches/feature-module-update
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/feature-module-update/data/Smarty/templates/default/admin/design/subnavi.tpl
r16582 r16677 1 <!--{*1 <!--{* 2 2 /* 3 * This file is part of EC-CUBE4 *5 3 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. 6 4 * 7 5 * http://www.lockon.co.jp/ 8 *9 * This program is free software; you can redistribute it and/or10 * modify it under the terms of the GNU General Public License11 * as published by the Free Software Foundation; either version 212 * of the License, or (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.22 6 */ 23 7 *}--> 24 8 <table width="141" border="0" cellspacing="0" cellpadding="0" summary=" " id="menu_navi"> 25 9 <!--ナビ--> 10 <!----> 26 11 <tr><td class=<!--{if $tpl_subno != 'layout'}-->"navi"<!--{else}-->"navi-on"<!--{/if}-->><a href="./index.php" onMouseOver="naviStyleChange('layout', '#a5a5a5')" <!--{if $tpl_subno != 'layout'}-->onMouseOut="naviStyleChange('layout', '#636469')"<!--{/if}--> id="layout"><img src="<!--{$TPL_DIR}-->img/contents/icon.jpg" width="15" height="9" alt="" border="0"><span class="navi_text">レイアウト設定</span></a></td></tr> 27 12 <tr><td><img src="<!--{$TPL_DIR}-->img/contents/navi_line.gif" width="140" height="2" alt=""></td></tr> … … 34 19 <tr><td class=<!--{if $tpl_subno != 'css'}-->"navi"<!--{else}-->"navi-on"<!--{/if}-->><a href="./css.php" onMouseOver="naviStyleChange('css', '#a5a5a5')" <!--{if $tpl_subno != 'css'}-->onMouseOut="naviStyleChange('css', '#636469')"<!--{/if}--> id="css"><img src="<!--{$TPL_DIR}-->img/contents/icon.jpg" width="15" height="9" alt="" border="0"><span class="navi_text">CSS編集</span></a></td></tr> 35 20 <tr><td><img src="<!--{$TPL_DIR}-->img/contents/navi_line.gif" width="140" height="2" alt=""></td></tr> 36 37 21 <tr><td class=<!--{if $tpl_subno != 'template'}-->"navi"<!--{else}-->"navi-on"<!--{/if}-->><a href="./template.php" onMouseOver="naviStyleChange('template', '#a5a5a5')" <!--{if $tpl_subno != 'template'}-->onMouseOut="naviStyleChange('template', '#636469')"<!--{/if}--> id="template"><img src="<!--{$TPL_DIR}-->img/contents/icon.jpg" width="15" height="9" alt="" border="0"><span class="navi_text">テンプレート設定</span></a></td></tr> 38 22 <tr><td><img src="<!--{$TPL_DIR}-->img/contents/navi_line.gif" width="140" height="2" alt=""></td></tr> 39 <!--{if $tpl_subno == 'template'}--> 40 <tr><td class=<!--{if $tpl_subno_template != 'top'}-->"subnavi"<!--{else}-->"subnavi-on"<!--{/if}-->><a href="./template.php?tpl_subno_template=<!--{$arrSubnavi.title.1}-->" onMouseOver="naviStyleChange('top', '#b7b7b7')" <!--{if $tpl_subno_template != 'top'}-->onMouseOut="naviStyleChange('top', '#818287')"<!--{/if}--> id="top"><span class="subnavi_text">TOPページ</span></a></td></tr> 41 <tr><td><img src="<!--{$TPL_DIR}-->img/contents/navi_subline.gif" width="140" height="2" alt=""></td></tr> 42 <tr><td class=<!--{if $tpl_subno_template != 'product'}-->"subnavi"<!--{else}-->"subnavi-on"<!--{/if}-->><a href="./template.php?tpl_subno_template=<!--{$arrSubnavi.title.2}-->" onMouseOver="naviStyleChange('product', '#b7b7b7')" <!--{if $tpl_subno_template != 'product'}-->onMouseOut="naviStyleChange('product', '#818287')"<!--{/if}--> id="product"><span class="subnavi_text">商品一覧ページ</span></a></td></tr> 43 <tr><td><img src="<!--{$TPL_DIR}-->img/contents/navi_subline.gif" width="140" height="2" alt=""></td></tr> 44 <tr><td class=<!--{if $tpl_subno_template != 'detail'}-->"subnavi"<!--{else}-->"subnavi-on"<!--{/if}-->><a href="./template.php?tpl_subno_template=<!--{$arrSubnavi.title.3}-->" onMouseOver="naviStyleChange('detail', '#b7b7b7')" <!--{if $tpl_subno_template != 'detail'}-->onMouseOut="naviStyleChange('detail', '#818287')"<!--{/if}--> id="detail"><span class="subnavi_text">商品詳細ページ</span></a></td></tr> 45 <tr><td><img src="<!--{$TPL_DIR}-->img/contents/navi_subline.gif" width="140" height="2" alt=""></td></tr> 46 <tr><td class=<!--{if $tpl_subno_template != 'mypage'}-->"subnavi"<!--{else}-->"subnavi-on"<!--{/if}-->><a href="./template.php?tpl_subno_template=<!--{$arrSubnavi.title.4}-->" onMouseOver="naviStyleChange('mypage', '#b7b7b7')" <!--{if $tpl_subno_template != 'mypage'}-->onMouseOut="naviStyleChange('mypage', '#818287')"<!--{/if}--> id="mypage"><span class="subnavi_text">MYページ</span></a></td></tr> 47 <tr><td><img src="<!--{$TPL_DIR}-->img/contents/navi_subline.gif" width="140" height="2" alt=""></td></tr> 48 <tr><td class=<!--{if $tpl_subno_template != 'upload'}-->"subnavi"<!--{else}-->"subnavi-on"<!--{/if}-->><a href="./upload.php" onMouseOver="naviStyleChange('upload', '#b7b7b7')" <!--{if $tpl_subno_template != 'upload'}-->onMouseOut="naviStyleChange('upload', '#818287')"<!--{/if}--> id="upload"><span class="subnavi_text">アップロード</span></a></td></tr> 49 <tr><td><img src="<!--{$TPL_DIR}-->img/contents/navi_subline.gif" width="140" height="2" alt=""></td></tr> 50 <!--{/if}--> 51 23 <tr><td class=<!--{if $tpl_subno != 'up_down'}-->"navi"<!--{else}-->"navi-on"<!--{/if}-->><a href="./up_down.php" onMouseOver="naviStyleChange('up_down', '#a5a5a5')" <!--{if $tpl_subno != 'up_down'}-->onMouseOut="naviStyleChange('up_down', '#636469')"<!--{/if}--> id="up_down"><img src="<!--{$TPL_DIR}-->img/contents/icon.jpg" width="15" height="9" alt="" border="0"><span class="navi_text">アップロード/ダウンロード</span></a></td></tr> 24 <tr><td><img src="<!--{$TPL_DIR}-->img/contents/navi_line.gif" width="140" height="2" alt=""></td></tr> 52 25 <!--ナビ--> 53 26 </table> -
branches/feature-module-update/data/Smarty/templates/default/admin/design/template.tpl
r16582 r16677 1 <!--{*1 <!--{* 2 2 /* 3 * This file is part of EC-CUBE4 *5 3 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. 6 4 * 7 5 * http://www.lockon.co.jp/ 8 *9 * This program is free software; you can redistribute it and/or10 * modify it under the terms of the GNU General Public License11 * as published by the Free Software Foundation; either version 212 * of the License, or (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.22 6 */ 23 7 *}--> 8 <script type="text/javascript"><!-- 9 function submitRegister() { 10 var form = document.form1; 11 var msg = "テンプレートを変更します。\n既存のデータは上書きされますがよろしいですか?"; 12 13 if (window.confirm(msg)) { 14 form['mode'].value = 'register'; 15 form.submit(); 16 } 17 } 18 // --> 19 </script> 24 20 <!--★★メインコンテンツ★★--> 25 21 <table width="878" border="0" cellspacing="0" cellpadding="0" summary=" "> 26 <form name="form1" id="form1" method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->" onsubmit="return lfnModeSubmit('confirm')"> 27 <!--{foreach from=$smarty.post key="key" item="item"}--> 28 <!--{if $key ne "mode"}--><input type="hidden" name="<!--{$key|escape}-->" value="<!--{$item|escape}-->"> 29 <!--{/if}--> 30 <!--{/foreach}--> 22 <form name="form1" method="post" action=""> 31 23 <input type="hidden" name="mode" value=""> 32 <input type="hidden" name="tpl_subno_template" value="<!--{$tpl_subno_template}-->"> 24 <input type="hidden" name="template_code_delete" value=""> 25 <input type="hidden" name="uniqid" value="<!--{$uniqid}-->"> 33 26 <tr valign="top"> 34 27 <td background="<!--{$TPL_DIR}-->img/contents/navi_bg.gif" height="402"> … … 57 50 <tr> 58 51 <td background="<!--{$TPL_DIR}-->img/contents/contents_title_left_bg.gif"><img src="<!--{$TPL_DIR}-->img/contents/contents_title_left.gif" width="22" height="12" alt=""></td> 59 <td bgcolor="#636469" width="638" class="fs14n"><span class="white"><!--コンテンツタイトル--> <!--{$template_name}--></span></td>52 <td bgcolor="#636469" width="638" class="fs14n"><span class="white"><!--コンテンツタイトル-->テンプレート設定</span></td> 60 53 <td background="<!--{$TPL_DIR}-->img/contents/contents_title_right_bg.gif"><img src="<!--{$TPL_DIR}-->img/common/_.gif" width="18" height="1" alt=""></td> 61 54 </tr> … … 67 60 </tr> 68 61 </table> 62 63 <table width="678" border="0" cellspacing="1" cellpadding="8" summary=" "> 64 <tr bgcolor="#f2f1ec" class="fs12n"> 65 <td> 66 テンプレートを選択し、「この内容で登録する」ボタンを押すと、<br> 67 選択したテンプレートへデザインを変更することが出来ます。<br> 68 <br> 69 変更した場合、下のファイルが上書きされます。 70 <ul> 71 <li>user_data/css/contents.css</li> 72 <li>user_data/include/*</li> 73 <li>user_data/templates/mypage/*</li> 74 <li>user_data/templates/detail.tpl</li> 75 <li>user_data/templates/list.tpl</li> 76 <li>user_data/templates/top.tpl</li> 77 </ul> 78 </td> 79 </tr> 80 <tr bgcolor="#ffffff" class="fs12n"> 81 <td> 82 <table width="650" bgcolor="#cccccc" border="0" cellspacing="1" cellpadding="5" summary=" "> 83 <tr bgcolor="#f2f1ec" align="center" class="fs12n"> 84 <td width="">選択</td> 85 <td width="">名前</td> 86 <td width="">保存先</td> 87 <!--<td width="50">確認</td>--> 88 <td width="50">削除</td> 89 </tr> 90 <tr bgcolor="#ffffff" align="center" class="fs12n"> 91 <td width=""><input type="radio" name="template_code" value="default" <!--{if !$tplcode}-->checked<!--{/if}-->></td> 92 <td width="" colspan="3">テンプレートを使用しない</td> 93 </tr> 94 <!--{foreach from=$templates item=tpl}--> 95 <!--{assign var=tplcode value=$tpl.template_code}--> 96 <tr bgcolor="#ffffff" align="center" class="fs12"> 97 <td width="" ><input type="radio" name="template_code" value="<!--{$tplcode|escape}-->" <!--{if $tplcode == $now_template}-->checked<!--{/if}-->></td> 98 <td width=""><!--{$tpl.template_name|escape}--></td> 99 <td width="">user_data/tpl_packages/<!--{$tplcode|escape}-->/</td> 100 <!--<td width=""><span class="icon_confirm"><a href="" onClick="">確認</span></a></td>--> 101 <td width=""><span class="icon_delete"><a href="" onClick="fnModeSubmit('delete','template_code_delete','<!--{$tplcode}-->');return false;">削除</a></span></td> 102 </tr> 103 <!--{/foreach}--> 69 104 70 <table width="678" border="0" cellspacing="1" cellpadding="8" summary=" "> 71 <tr class="fs12n"> 72 <td bgcolor="#f2f1ec" align="center"><strong>現在のテンプレート</strong></td> 73 </tr> 74 <tr class="fs12n"> 75 <td bgcolor="#ffffff" align="center"><img height=500 width=400 src="<!--{$smarty.const.URL_DIR}--><!--{$arrTemplate.image[$MainImage]}-->" name="main_img" ></td> 76 </tr> 77 </table> 78 79 <table width="678" border="0" cellspacing="0" cellpadding="0" summary=" "> 80 <tr><td colspan="3"><img src="<!--{$TPL_DIR}-->img/contents/main_bar.jpg" width="678" height="10" alt=""></td></tr> 105 </table> 106 </td> 107 </tr> 81 108 </table> 82 109 83 <table width="678" border="0" cellspacing="1" cellpadding="8" summary=" ">84 <tr class="fs12n">85 <td bgcolor="#f2f1ec" align="center" colspan="3"><strong>テンプレート一覧</strong></td>86 </tr>87 88 <!--{section name=template loop=$arrTemplate.image step=3}-->89 <!--{*foreach key=key item=item from=$arrTemplate.image*}-->90 <tr>91 <!--{assign var=cnt value=$smarty.section.template.iteration-1}-->92 <!--{assign var=key value=$cnt*$smarty.section.template.step}-->93 <!--{assign var=code value=$arrTemplate.code[$key]}-->94 <!--{assign var=image value=$arrTemplate.image[$code]}-->95 <td bgcolor="#ffffff" align="center"><!--{$arrTemplate[template]}-->96 <span class="fs12">【<!--{$arrTemplate.name[$key]}-->】</span><br/>97 <label for="radio<!--{$key}-->"><img src="<!--{$smarty.const.URL_DIR}--><!--{$image}-->" width="160" height="200" name="<!--{$key}-->" alt="<!--{$code}-->"></label><br>98 <span class="fs10n"><label for="radio<!--{$key}-->"><input type="radio" name="check_template" value="<!--{$code}-->" id="radio<!--{$key}-->" onClick="ChangeImage('<!--{$smarty.const.URL_DIR}--><!--{$image}-->');" <!--{if $arrTemplate.check[$code] != ""}-->checked<!--{/if}-->>選択</label></span>99 </td>100 <!--{assign var=cnt value=$smarty.section.template.iteration-1}-->101 <!--{assign var=key value=$cnt*$smarty.section.template.step+1}-->102 <!--{assign var=code value=$arrTemplate.code[$key]}-->103 <!--{assign var=image value=$arrTemplate.image[$code]}-->104 <!--{if $image != ""}-->105 <td bgcolor="#ffffff" align="center"><!--{$arrTemplate[template]}-->106 <span class="fs12">【<!--{$arrTemplate.name[$key]}-->】</span><br/>107 <label for="radio<!--{$key}-->"><img src="<!--{$smarty.const.URL_DIR}--><!--{$image}-->" width="160" height="200" name="<!--{$key}-->" alt="<!--{$code}-->></label><br>108 <span class="fs10n"><label for="radio<!--{$key}-->"><input type="radio" name="check_template" value="<!--{$code}-->" id="radio<!--{$key}-->" onClick="ChangeImage('<!--{$smarty.const.URL_DIR}--><!--{$image}-->');" <!--{if $arrTemplate.check[$code] != ""}-->checked<!--{/if}-->>選択</label></span>109 </td>110 <!--{/if}-->111 <!--{assign var=cnt value=$smarty.section.template.iteration-1}-->112 <!--{assign var=key value=$cnt*$smarty.section.template.step+2}-->113 <!--{assign var=code value=$arrTemplate.code[$key]}-->114 <!--{assign var=image value=$arrTemplate.image[$code]}-->115 <!--{if $image != ""}-->116 <td bgcolor="#ffffff" align="center"><!--{$arrTemplate[template]}-->117 <span class="fs12">【<!--{$code}-->】</span><br/>118 <label for="radio<!--{$key}-->"><img src="<!--{$smarty.const.URL_DIR}--><!--{$image}-->" width="160" height="200" name="<!--{$key}-->" alt="<!--{$code}-->></label><br>119 <span class="fs10n"><label for="radio<!--{$key}-->"><input type="radio" name="check_template" value="<!--{$code}-->" id="radio<!--{$key}-->" onClick="ChangeImage('<!--{$smarty.const.URL_DIR}--><!--{$image}-->');" <!--{if $arrTemplate.check[$code] != ""}-->checked<!--{/if}-->>選択</label></span>120 </td>121 <!--{/if}-->122 123 </tr>124 <!--{/section}-->125 </table>126 127 110 <table width="678" border="0" cellspacing="0" cellpadding="0" summary=" "> 128 111 <tr> … … 137 120 <tr> 138 121 <td> 139 <a href="javascript:fnModeSubmit('download', '', '');"><img onMouseover="chgImgImageSubmit('<!--{$TPL_DIR}-->img/contents/btn_download_on.jpg',this)" onMouseout="chgImgImageSubmit('<!--{$TPL_DIR}-->img/contents/btn_download.jpg',this)" src="<!--{$TPL_DIR}-->img/contents/btn_download.jpg" width="123" height="24" alt="ダウンロード" border="0" name="subm"></a> 140 <input type="image" onMouseover="chgImgImageSubmit('<!--{$TPL_DIR}-->img/contents/btn_regist_on.jpg',this)" onMouseout="chgImgImageSubmit('<!--{$TPL_DIR}-->img/contents/btn_regist.jpg',this)" src="<!--{$TPL_DIR}-->img/contents/btn_regist.jpg" width="123" height="24" alt="この内容で登録する" border="0" name="subm"> 122 <a href="" onClick="submitRegister();return false;"> 123 <img onMouseover="chgImgImageSubmit('<!--{$TPL_DIR}-->img/contents/btn_regist_on.jpg',this)" onMouseout="chgImgImageSubmit('<!--{$TPL_DIR}-->img/contents/btn_regist.jpg',this)" src="<!--{$TPL_DIR}-->img/contents/btn_regist.jpg" width="123" height="24" alt="この内容で登録する" border="0" name="subm"> 124 </a> 141 125 </td> 142 126 </tr> … … 167 151 </table> 168 152 <!--★★メインコンテンツ★★--> 169 170 <script type="text/javascript">171 function ChangeImage(strUrl)172 {173 document.main_img.src=strUrl;174 }175 176 // モードとキーを指定してSUBMITを行う。177 function lfnModeSubmit(mode) {178 if(!window.confirm('登録しても宜しいですか?')){179 return false;180 }181 document.form1['mode'].value = mode;182 return true;183 }184 185 186 </script> -
branches/feature-module-update/data/class/pages/admin/design/LC_Page_Admin_Design_Template.php
r16582 r16677 61 61 function init() { 62 62 parent::init(); 63 $this->arrTemplateName = $this->arrSubnavi; 64 $this->tpl_mainpage = 'design/template.tpl'; 65 $this->tpl_subnavi = 'design/subnavi.tpl'; 66 $this->tpl_subno = 'template'; 67 $this->tpl_subno_template = $this->arrSubnavi['title'][1]; 68 $this->tpl_TemplateName = $this->arrTemplateName['name'][1]; 69 $this->tpl_mainno = "design"; 70 $this->tpl_subtitle = 'テンプレート設定'; 63 $this->tpl_mainpage = 'design/template.tpl'; 64 $this->tpl_subnavi = 'design/subnavi.tpl'; 65 $this->tpl_subno = 'template'; 66 $this->tpl_mainno = "design"; 67 $this->tpl_subtitle = 'テンプレート設定'; 68 $this->arrErr = array(); 69 $this->arrForm = array(); 71 70 } 72 71 … … 77 76 */ 78 77 function process() { 79 $objView = new SC_AdminView(); 80 $objSess = new SC_Session(); 81 82 // 認証可否の判定 83 $objSess = new SC_Session(); 84 SC_Utils_Ex::sfIsSuccess($objSess); 85 86 // GETの値を受け取る 87 $get_tpl_subno_template = isset($_GET['tpl_subno_template']) 88 ? $_GET['tpl_subno_template'] : ""; 89 if (!isset($_POST['tpl_subno_template'])) $_POST['tpl_subno_template'] = ""; 90 if (!isset($_POST['mode'])) $_POST['mode'] = ""; 91 92 // GETで値が送られている場合にはその値を元に画面表示を切り替える 93 if ($get_tpl_subno_template != ""){ 94 // 送られてきた値が配列に登録されていなければTOPを表示 95 if (in_array($get_tpl_subno_template,$this->arrSubnavi['title'])){ 96 $tpl_subno_template = $get_tpl_subno_template; 97 }else{ 98 $tpl_subno_template = $this->arrSubnavi['title'][1]; 99 } 100 } else { 101 // GETで値がなければPOSTの値を使用する 102 if ($_POST['tpl_subno_template'] != ""){ 103 $tpl_subno_template = $_POST['tpl_subno_template']; 104 }else{ 105 $tpl_subno_template = $this->arrSubnavi['title'][1]; 106 } 107 } 108 $this->tpl_subno_template = $tpl_subno_template; 109 $key = array_keys($this->arrSubnavi['title'], $tpl_subno_template); 110 $this->template_name = $this->arrSubnavi['name'][$key[0]]; 111 112 // 登録を押された場合にはDBへデータを更新に行く 113 switch($_POST['mode']) { 114 case 'confirm': 115 // DBへデータ更新 116 $this->lfUpdData(); 117 118 // テンプレートの上書き 119 $this->lfChangeTemplate(); 120 121 // 完了メッセージ 122 $this->tpl_onload="alert('登録が完了しました。');"; 123 break; 124 case 'download': 125 $this->lfDownloadTemplate($_POST['check_template']); 126 break; 127 default: 128 break; 129 } 130 131 // POST値の引き継ぎ 132 $this->arrForm = $_POST; 133 134 // 画像取得 135 $tpl_arrTemplate = array(); 136 $this->arrTemplate = $this->lfgetTemplate(); 137 138 // デフォルトチェック取得 139 $this->MainImage = $this->arrTemplate['check']; 140 $this->arrTemplate['check'] = array($this->arrTemplate['check']=>"check"); 141 142 // 画面の表示 143 $objView->assignobj($this); 144 $objView->display(MAIN_FRAME); 145 78 // 認証可否の判定 79 $objSession = new SC_Session(); 80 SC_Utils::sfIsSuccess($objSession); 81 82 // uniqidをテンプレートへ埋め込み 83 $this->uniqid = $objSession->getUniqId(); 84 85 $objView = new SC_AdminView(); 86 87 switch($this->lfGetMode()) { 88 89 // 登録ボタン押下時 90 case 'register': 91 // 画面遷移の正当性チェック 92 if (!SC_Utils::sfIsValidTransition($objSession)) { 93 sfDispError(''); 94 } 95 // パラメータ検証 96 $objForm = $this->lfInitRegister(); 97 if ($objForm->checkError()) { 98 sfDispError(''); 99 } 100 101 $template_code = $objForm->getValue('template_code'); 102 103 if ($template_code == 'default') { 104 $this->lfRegisterTemplate(''); 105 $this->tpl_onload="alert('登録が完了しました。');"; 106 break; 107 } 108 109 // DBへ使用するテンプレートを登録 110 $this->lfRegisterTemplate($template_code); 111 112 // テンプレートの上書き 113 $this->lfChangeTemplate($template_code); 114 115 // XXX コンパイルファイルのクリア処理を行う 116 $objView->_smarty->clear_compiled_tpl(); 117 118 // 完了メッセージ 119 $this->tpl_onload="alert('登録が完了しました。');"; 120 break; 121 122 // 削除ボタン押下時 123 case 'delete': 124 // 画面遷移の正当性チェック 125 if (!sfIsValidTransition($objSession)) { 126 sfDispError(''); 127 } 128 // パラメータ検証 129 $objForm = $this->lfInitDelete(); 130 if ($objForm->checkError()) { 131 sfDispError(''); 132 } 133 134 $template_code = $objForm->getValue('template_code_delete'); 135 if ($template_code == $this->lfGetNowTemplate()) { 136 $this->tpl_onload = "alert('選択中のテンプレートは削除出来ません');"; 137 break; 138 } 139 140 $this->lfDeleteTemplate($template_code); 141 break; 142 143 // プレビューボタン押下時 144 case 'preview': 145 break; 146 147 default: 148 break; 149 } 150 151 // defaultパラメータのセット 152 $this->templates = $this->lfGetAllTemplates(); 153 $this->now_template = $this->lfGetNowtemplate(); 154 155 // 画面の表示 156 $objView->assignobj($this); 157 $objView->display(MAIN_FRAME); 146 158 } 147 159 … … 155 167 } 156 168 157 /** 158 * 画面に表示する画像を取得する. 159 * 160 * @return array 画面に表示する画像の配列 161 */ 162 function lfgetTemplate(){ 163 $filepath = "user_data/templates/"; 164 165 $arrTemplateImage = array(); // 画面表示画像格納用 166 $Image = ""; // イメージの配列要素名格納用 167 $disp = ""; 168 $arrDefcheck = array(); // radioボタンのデフォルトチェック格納用 169 170 // DBから現在選択されているデータ取得 171 $arrDefcheck = $this->lfgetTemplaeBaseData(); 172 173 // テンプレートデータを取得する 174 $objQuery = new SC_Query(); 175 $sql = "SELECT template_code,template_name FROM dtb_templates ORDER BY create_date DESC"; 176 $arrTemplate = $objQuery->getall($sql); 177 178 switch($this->tpl_subno_template) { 179 // TOP 180 case $this->arrSubnavi['title'][1]: 181 $Image = "TopImage.jpg"; // イメージの配列要素名格納用 182 $disp = $this->arrSubnavi['title'][1]; 183 break; 184 185 // 商品一覧 186 case $this->arrSubnavi['title'][2]: 187 $Image = "ProdImage.jpg"; // イメージの配列要素名格納用 188 $disp = $this->arrSubnavi['title'][2]; 189 break; 190 191 // 商品詳細 192 case $this->arrSubnavi['title'][3]: 193 $Image = "DetailImage.jpg"; // イメージの配列要素名格納用 194 $disp = $this->arrSubnavi['title'][3]; 195 break; 196 197 // MYページ 198 case $this->arrSubnavi['title'][4]: 199 $Image = "MypageImage.jpg"; //イメージの配列要素名格納用 200 $disp = $this->arrSubnavi['title'][4]; 201 break; 202 } 203 204 // 画像表示配列作成 205 foreach($arrTemplate as $key => $val){ 206 $arrTemplateImage['image'][$val['template_code']] = $filepath . $val['template_code'] . "/" . $Image; 207 $arrTemplateImage['code'][$key] = $val['template_code']; 208 $arrTemplateImage['name'][$key] = $val['template_name']; 209 } 210 211 // 初期チェック 212 if (isset($arrDefcheck[$disp])){ 213 $arrTemplateImage['check'] = $arrDefcheck[$disp]; 214 }else{ 215 $arrTemplateImage['check'] = 1; 216 } 217 218 return $arrTemplateImage; 219 } 220 221 /** 222 * DBに保存されているテンプレートデータを取得する. 223 * 224 * @return array DBに保存されているテンプレートデータの配列 225 */ 226 function lfgetTemplaeBaseData(){ 227 $objDBConn = new SC_DbConn; // DB操作オブジェクト 228 $sql = ""; // データ取得SQL生成用 229 $arrRet = array(); // データ取得用 230 231 $sql = "SELECT top_tpl AS top, product_tpl AS product, detail_tpl AS detail, mypage_tpl AS mypage FROM dtb_baseinfo"; 232 $arrRet = $objDBConn->getAll($sql); 233 234 return $arrRet[0]; 235 } 236 237 /** 238 * DBにデータを保存する. 239 * 240 * @return integer 成功した場合 1 241 */ 242 function lfUpdData(){ 243 $objDBConn = new SC_DbConn; // DB操作オブジェクト 244 $sql = ""; // データ取得SQL生成用 245 $arrRet = array(); // データ取得用(更新判定) 246 247 // データ取得 248 $sql = "SELECT top_tpl AS top, product_tpl AS product, detail_tpl AS detail, mypage_tpl AS mypage FROM dtb_baseinfo"; 249 $arrRet = $objDBConn->getAll($sql); 250 251 $chk_tpl = $_POST['check_template']; 252 // データが取得できなければINSERT、できればUPDATE 253 if (isset($arrRet[0])){ 254 // UPDATE 255 $arrVal = array($chk_tpl,$chk_tpl,$chk_tpl,$chk_tpl); 256 $sql= "update dtb_baseinfo set top_tpl = ?, product_tpl = ?, detail_tpl = ?, mypage_tpl = ?, update_date = now()"; 257 }else{ 258 // INSERT 259 $arrVal = array($chk_tpl,$chk_tpl,$chk_tpl,$chk_tpl); 260 $sql= "insert into dtb_baseinfo (top_tpl,product_tpl,detail_tpl,mypage_tpl, update_date) values (?,?,?,?,now());"; 261 } 262 263 // SQL実行 264 $arrRet = $objDBConn->query($sql,$arrVal); 265 266 return $arrRet; 267 } 268 269 /** 270 * テンプレートを変更する. 271 * 272 * @return void 273 */ 274 function lfChangeTemplate(){ 275 $data = array(); 276 $masterData = new SC_DB_MasterData_Ex(); 277 278 // FIXME DBのデータを更新 279 $masterData->updateMasterData("mtb_constants", array(), 280 array("TEMPLATE_NAME" => '"' . $_POST['check_template'] . '"')); 281 282 // 更新したデータを取得 283 $mtb_constants = $masterData->getDBMasterData("mtb_constants"); 284 285 // キャッシュを生成 286 $masterData->clearCache("mtb_constants"); 287 $masterData->createCache("mtb_constants", $mtb_constants, true, 288 array("id", "remarks", "rank")); 289 } 290 291 /** 292 * テンプレートファイル圧縮してダウンロードする. 293 * 294 * @param string テンプレートコード 295 * @return void 296 */ 297 function lfDownloadTemplate($template_code){ 298 require_once(CLASS_EX_PATH . "helper_extends/SC_Helper_FileManager_Ex.php"); 299 $objFileManager = new SC_Helper_FileManager_Ex(); 300 $filename = $template_code. ".tar.gz"; 301 $dl_file = USER_TEMPLATE_PATH.$filename; 302 $target_path = USER_TEMPLATE_PATH . $template_code . "/"; 303 304 $mess = ""; 305 // Smarty テンプレートをコピー 306 $target_smarty = $target_path . "Smarty/"; 307 $mess .= SC_Utils_Ex::sfCopyDir(DATA_PATH . "Smarty/templates/" . $template_code . "/", $target_smarty, $mess); 308 309 // ファイルの圧縮 310 $tar = new Archive_Tar($dl_file, TRUE); 311 // ファイル一覧取得 312 $arrFileHash = $objFileManager->sfGetFileList(USER_TEMPLATE_PATH.$template_code); 313 foreach($arrFileHash as $val) { 314 $arrFileList[] = $val['file_name']; 315 } 316 // ディレクトリを移動 317 chdir(USER_TEMPLATE_PATH.$template_code); 318 319 //圧縮をおこなう 320 $zip = $tar->create($arrFileList); 321 322 // ダウンロード開始 323 Header("Content-disposition: attachment; filename=${filename}"); 324 Header("Content-type: application/octet-stream; name=${dl_file}"); 325 header("Content-Length: " .filesize($dl_file)); 326 readfile ($dl_file); 327 // 圧縮ファイル削除 328 unlink($dl_file); 329 330 exit(); 331 } 169 function lfGetMode(){ 170 if (isset($_POST['mode'])) return $_POST['mode']; 171 } 172 173 function lfInitRegister() { 174 $objForm = new SC_FormParam(); 175 $objForm->addParam( 176 'template_code', 'template_code', STEXT_LEN, '', 177 array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "ALNUM_CHECK") 178 ); 179 $objForm->setParam($_POST); 180 181 return $objForm; 182 } 183 184 function lfInitDelete() { 185 $objForm = new SC_FormParam(); 186 $objForm->addParam( 187 'template_code_delete', 'template_code_delete', STEXT_LEN, '', 188 array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "ALNUM_CHECK") 189 ); 190 $objForm->setParam($_POST); 191 192 return $objForm; 193 } 194 195 /** 196 * 現在適用しているテンプレートパッケージ名を取得する. 197 * 198 * @param void 199 * @return string テンプレートパッケージ名 200 */ 201 function lfGetNowTemplate() { 202 $objQuery = new SC_Query(); 203 $arrRet = $objQuery->select('top_tpl', 'dtb_baseinfo'); 204 if (isset($arrRet[0]['top_tpl'])) { 205 return $arrRet[0]['top_tpl']; 206 } 207 return null; 208 } 209 210 /** 211 * 使用するテンプレートをDBへ登録する 212 */ 213 function lfRegisterTemplate($template_code) { 214 $objQuery = new SC_Query(); 215 $objQuery->update( 216 'dtb_baseinfo', 217 array('top_tpl'=> $template_code) 218 ); 219 } 220 /** 221 * テンプレートを上書きコピーする. 222 */ 223 function lfChangeTemplate($template_code){ 224 $from = TPL_PKG_PATH . $template_code . '/user_edit/'; 225 226 if (!file_exists($from)) { 227 $mess = $from . 'は存在しません'; 228 } else { 229 $to = USER_PATH; 230 $mess = sfCopyDir($from, $to, '', true); 231 } 232 return $mess; 233 } 234 235 function lfGetAllTemplates() { 236 $objQuery = new SC_Query(); 237 $arrRet = $objQuery->select('*', 'dtb_templates'); 238 if (empty($arrRet)) return array(); 239 240 return $arrRet; 241 } 242 243 function lfDeleteTemplate($template_code) { 244 $objQuery = new SC_Query(); 245 $objQuery->delete('dtb_templates', 'template_code = ?', array($template_code)); 246 247 sfDelFile(TPL_PKG_PATH . $template_code); 248 } 332 249 } 333 250 ?> -
branches/feature-module-update/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc.php
r16582 r16677 33 33 */ 34 34 class LC_Page_FrontParts_Bloc extends LC_Page { 35 36 35 /** 37 36 * ブロックファイルに応じて tpl_mainpage を設定する … … 41 40 */ 42 41 function setTplMainpage($bloc_file) { 43 if (is_file(USER_PATH . BLOC_DIR . $bloc_file)) { 44 $this->tpl_mainpage = USER_PATH . BLOC_DIR . $bloc_file; 42 $debug_message = ""; 43 $user_bloc_path = USER_PATH . BLOC_DIR . $bloc_file; 44 if (is_file($user_bloc_path)) { 45 $this->tpl_mainpage = $user_bloc_path; 45 46 } else { 46 47 $this->tpl_mainpage = BLOC_PATH . $bloc_file; 47 48 } 49 $debug_message = "block:" . $this->tpl_mainpage . "\n"; 50 GC_Utils::gfDebugLog($debug_message); 48 51 } 49 52 } -
branches/feature-module-update/data/class/util/SC_Utils.php
r16675 r16677 1637 1637 } 1638 1638 } 1639 1639 1640 /* 1641 * 関数名:sfGetFileList() 1642 * 説明 :指定パス配下のディレクトリ取得 1643 * 引数1 :取得するディレクトリパス 1644 */ 1645 function sfGetFileList($dir) { 1646 $arrFileList = array(); 1647 $arrDirList = array(); 1648 1649 if (is_dir($dir)) { 1650 if ($dh = opendir($dir)) { 1651 $cnt = 0; 1652 // 行末の/を取り除く 1653 while (($file = readdir($dh)) !== false) $arrDir[] = $file; 1654 $dir = ereg_replace("/$", "", $dir); 1655 // アルファベットと数字でソート 1656 natcasesort($arrDir); 1657 foreach($arrDir as $file) { 1658 // ./ と ../を除くファイルのみを取得 1659 if($file != "." && $file != "..") { 1660 1661 $path = $dir."/".$file; 1662 // SELECT内の見た目を整えるため指定文字数で切る 1663 $file_name = SC_Utils::sfCutString($file, FILE_NAME_LEN); 1664 $file_size = SC_Utils::sfCutString(SC_Utils::sfGetDirSize($path), FILE_NAME_LEN); 1665 $file_time = date("Y/m/d", filemtime($path)); 1666 1667 // ディレクトリとファイルで格納配列を変える 1668 if(is_dir($path)) { 1669 $arrDirList[$cnt]['file_name'] = $file; 1670 $arrDirList[$cnt]['file_path'] = $path; 1671 $arrDirList[$cnt]['file_size'] = $file_size; 1672 $arrDirList[$cnt]['file_time'] = $file_time; 1673 $arrDirList[$cnt]['is_dir'] = true; 1674 } else { 1675 $arrFileList[$cnt]['file_name'] = $file; 1676 $arrFileList[$cnt]['file_path'] = $path; 1677 $arrFileList[$cnt]['file_size'] = $file_size; 1678 $arrFileList[$cnt]['file_time'] = $file_time; 1679 $arrFileList[$cnt]['is_dir'] = false; 1680 } 1681 $cnt++; 1682 } 1683 } 1684 closedir($dh); 1685 } 1686 } 1687 1688 // フォルダを先頭にしてマージ 1689 return array_merge($arrDirList, $arrFileList); 1690 } 1691 1692 /* 1693 * 関数名:sfGetDirSize() 1694 * 説明 :指定したディレクトリのバイト数を取得 1695 * 引数1 :ディレクトリ 1696 */ 1697 function sfGetDirSize($dir) { 1698 if(file_exists($dir)) { 1699 // ディレクトリの場合下層ファイルの総量を取得 1700 if (is_dir($dir)) { 1701 $handle = opendir($dir); 1702 while ($file = readdir($handle)) { 1703 // 行末の/を取り除く 1704 $dir = ereg_replace("/$", "", $dir); 1705 $path = $dir."/".$file; 1706 if ($file != '..' && $file != '.' && !is_dir($path)) { 1707 $bytes += filesize($path); 1708 } else if (is_dir($path) && $file != '..' && $file != '.') { 1709 // 下層ファイルのバイト数を取得する為、再帰的に呼び出す。 1710 $bytes += SC_Utils::sfGetDirSize($path); 1711 } 1712 } 1713 } else { 1714 // ファイルの場合 1715 $bytes = filesize($dir); 1716 } 1717 } 1718 // ディレクトリ(ファイル)が存在しない場合は0byteを返す 1719 if($bytes == "") $bytes = 0; 1720 1721 return $bytes; 1722 } 1723 1724 /* 1725 * 関数名:sfDeleteDir() 1726 * 説明 :指定したディレクトリを削除 1727 * 引数1 :削除ファイル 1728 */ 1729 function sfDeleteDir($dir) { 1730 $arrResult = array(); 1731 if(file_exists($dir)) { 1732 // ディレクトリかチェック 1733 if (is_dir($dir)) { 1734 if ($handle = opendir("$dir")) { 1735 $cnt = 0; 1736 while (false !== ($item = readdir($handle))) { 1737 if ($item != "." && $item != "..") { 1738 if (is_dir("$dir/$item")) { 1739 sfDeleteDir("$dir/$item"); 1740 } else { 1741 $arrResult[$cnt]['result'] = @unlink("$dir/$item"); 1742 $arrResult[$cnt]['file_name'] = "$dir/$item"; 1743 } 1744 } 1745 $cnt++; 1746 } 1747 } 1748 closedir($handle); 1749 $arrResult[$cnt]['result'] = @rmdir($dir); 1750 $arrResult[$cnt]['file_name'] = "$dir/$item"; 1751 } else { 1752 // ファイル削除 1753 $arrResult[0]['result'] = @unlink("$dir"); 1754 $arrResult[0]['file_name'] = "$dir"; 1755 } 1756 } 1757 1758 return $arrResult; 1759 } 1760 1761 /* 1762 * 関数名:sfGetFileTree() 1763 * 説明 :ツリー生成用配列取得(javascriptに渡す用) 1764 * 引数1 :ディレクトリ 1765 * 引数2 :現在のツリーの状態開いているフォルダのパスが | 区切りで格納 1766 */ 1767 function sfGetFileTree($dir, $tree_status) { 1768 1769 $cnt = 0; 1770 $arrTree = array(); 1771 $default_rank = count(split('/', $dir)); 1772 1773 // 文末の/を取り除く 1774 $dir = ereg_replace("/$", "", $dir); 1775 // 最上位層を格納(user_data/) 1776 if(sfDirChildExists($dir)) { 1777 $arrTree[$cnt]['type'] = "_parent"; 1778 } else { 1779 $arrTree[$cnt]['type'] = "_child"; 1780 } 1781 $arrTree[$cnt]['path'] = $dir; 1782 $arrTree[$cnt]['rank'] = 0; 1783 $arrTree[$cnt]['count'] = $cnt; 1784 // 初期表示はオープン 1785 if($_POST['mode'] != '') { 1786 $arrTree[$cnt]['open'] = lfIsFileOpen($dir, $tree_status); 1787 } else { 1788 $arrTree[$cnt]['open'] = true; 1789 } 1790 $cnt++; 1791 1792 sfGetFileTreeSub($dir, $default_rank, $cnt, $arrTree, $tree_status); 1793 1794 return $arrTree; 1795 } 1796 1797 /* 1798 * 関数名:sfGetFileTree() 1799 * 説明 :ツリー生成用配列取得(javascriptに渡す用) 1800 * 引数1 :ディレクトリ 1801 * 引数2 :デフォルトの階層(/区切りで 0,1,2・・・とカウント) 1802 * 引数3 :連番 1803 * 引数4 :現在のツリーの状態開いているフォルダのパスが | 区切りで格納 1804 */ 1805 function sfGetFileTreeSub($dir, $default_rank, &$cnt, &$arrTree, $tree_status) { 1806 1807 if(file_exists($dir)) { 1808 if ($handle = opendir("$dir")) { 1809 while (false !== ($item = readdir($handle))) $arrDir[] = $item; 1810 // アルファベットと数字でソート 1811 natcasesort($arrDir); 1812 foreach($arrDir as $item) { 1813 if ($item != "." && $item != "..") { 1814 // 文末の/を取り除く 1815 $dir = ereg_replace("/$", "", $dir); 1816 $path = $dir."/".$item; 1817 // ディレクトリのみ取得 1818 if (is_dir($path)) { 1819 $arrTree[$cnt]['path'] = $path; 1820 if(sfDirChildExists($path)) { 1821 $arrTree[$cnt]['type'] = "_parent"; 1822 } else { 1823 $arrTree[$cnt]['type'] = "_child"; 1824 } 1825 1826 // 階層を割り出す 1827 $arrCnt = split('/', $path); 1828 $rank = count($arrCnt); 1829 $arrTree[$cnt]['rank'] = $rank - $default_rank + 1; 1830 $arrTree[$cnt]['count'] = $cnt; 1831 // フォルダが開いているか 1832 $arrTree[$cnt]['open'] = lfIsFileOpen($path, $tree_status); 1833 $cnt++; 1834 // 下層ディレクトリ取得の為、再帰的に呼び出す 1835 sfGetFileTreeSub($path, $default_rank, $cnt, $arrTree, $tree_status); 1836 } 1837 } 1838 } 1839 } 1840 closedir($handle); 1841 } 1842 } 1843 1844 /* 1845 * 関数名:sfDirChildExists() 1846 * 説明 :指定したディレクトリ配下にファイルがあるか 1847 * 引数1 :ディレクトリ 1848 */ 1849 function sfDirChildExists($dir) { 1850 if(file_exists($dir)) { 1851 if (is_dir($dir)) { 1852 $handle = opendir($dir); 1853 while ($file = readdir($handle)) { 1854 // 行末の/を取り除く 1855 $dir = ereg_replace("/$", "", $dir); 1856 $path = $dir."/".$file; 1857 if ($file != '..' && $file != '.' && is_dir($path)) { 1858 return true; 1859 } 1860 } 1861 } 1862 } 1863 1864 return false; 1865 } 1866 1867 /* 1868 * 関数名:lfIsFileOpen() 1869 * 説明 :指定したファイルが前回開かれた状態にあったかチェック 1870 * 引数1 :ディレクトリ 1871 * 引数2 :現在のツリーの状態開いているフォルダのパスが | 区切りで格納 1872 */ 1873 function lfIsFileOpen($dir, $tree_status) { 1874 $arrTreeStatus = split('\|', $tree_status); 1875 if(in_array($dir, $arrTreeStatus)) { 1876 return true; 1877 } 1878 1879 return false; 1880 } 1881 1882 /* 1883 * 関数名:sfDownloadFile() 1884 * 引数1 :ファイルパス 1885 * 説明 :ファイルのダウンロード 1886 */ 1887 function sfDownloadFile($file) { 1888 // ファイルの場合はダウンロードさせる 1889 Header("Content-disposition: attachment; filename=".basename($file)); 1890 Header("Content-type: application/octet-stream; name=".basename($file)); 1891 Header("Cache-Control: "); 1892 Header("Pragma: "); 1893 echo (sfReadFile($file)); 1894 } 1895 1896 /* 1897 * 関数名:sfCreateFile() 1898 * 引数1 :ファイルパス 1899 * 引数2 :パーミッション 1900 * 説明 :ファイル作成 1901 */ 1902 function sfCreateFile($file, $mode = "") { 1903 // 行末の/を取り除く 1904 if($mode != "") { 1905 $ret = @mkdir($file, $mode); 1906 } else { 1907 $ret = @mkdir($file); 1908 } 1909 1910 return $ret; 1911 } 1912 1913 /* 1914 * 関数名:sfReadFile() 1915 * 引数1 :ファイルパス 1916 * 説明 :ファイル読込 1917 */ 1918 function sfReadFile($filename) { 1919 $str = ""; 1920 // バイナリモードでオープン 1921 $fp = @fopen($filename, "rb" ); 1922 //ファイル内容を全て変数に読み込む 1923 if($fp) { 1924 $str = @fread($fp, filesize($filename)+1); 1925 } 1926 @fclose($fp); 1927 1928 return $str; 1929 } 1930 1640 1931 /* デバッグ用 ------------------------------------------------------------------------------------------------*/ 1641 1932 function sfPrintR($obj) { -
branches/feature-module-update/html/admin/design/upload.php
r16582 r16677 24 24 // {{{ requires 25 25 require_once("../../require.php"); 26 require_once(CLASS_EX_PATH . "page_extends/admin/design/LC_Page_Admin_Design_Up load_Ex.php");26 require_once(CLASS_EX_PATH . "page_extends/admin/design/LC_Page_Admin_Design_Up_Down_Ex.php"); 27 27 28 28 // }}} 29 29 // {{{ generate page 30 30 31 $objPage = new LC_Page_Admin_Design_Up load_Ex();31 $objPage = new LC_Page_Admin_Design_Up_Down_Ex(); 32 32 register_shutdown_function(array($objPage, "destroy")); 33 33 $objPage->init();
Note: See TracChangeset
for help on using the changeset viewer.