[Svn-src-all:838] [version-2_5-dev 19725] #748(モバイル/スマートフォンのデザイン管理)
nanasess
admin @ mail.ec-cube.net
2010年 12月 15日 (水) 18:06:23 JST
Subversion committed to /home/svn/open 19725
http://svn.ec-cube.net/open_trac/changeset/19725
┌────────────────────────────┐
│更新者 : nanasess │
│更新日時: 2010-12-15 18:06:23 +0900 (水, 15 12月 2010)│
└────────────────────────────┘
Log:
--------------------------------------------------------
#748(モバイル/スマートフォンのデザイン管理)
* テンプレートの取得方法を修正
Changed: [U:修正,A:追加,D:削除]
--------------------------------------------------------
U branches/version-2_5-dev/data/Smarty/templates/admin/design/bloc.tpl
U branches/version-2_5-dev/data/Smarty/templates/admin/design/css.tpl
U branches/version-2_5-dev/data/class/SC_View.php
U branches/version-2_5-dev/data/class/helper/SC_Helper_PageLayout.php
U branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Bloc.php
U branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_CSS.php
U branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Header.php
U branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_MainEdit.php
U branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Template.php
変更: branches/version-2_5-dev/data/Smarty/templates/admin/design/bloc.tpl
===================================================================
--- branches/version-2_5-dev/data/Smarty/templates/admin/design/bloc.tpl 2010-12-15 00:50:43 UTC (rev 19724)
+++ branches/version-2_5-dev/data/Smarty/templates/admin/design/bloc.tpl 2010-12-15 09:06:23 UTC (rev 19725)
@@ -78,7 +78,7 @@
<tr style="background-color:<!--{if $item.bloc_id == $bloc_id}--><!--{$smarty.const.SELECT_RGB}--><!--{else}-->#ffffff<!--{/if}-->;">
<td><!--{$item.bloc_name}--></td>
<td>
- <a href="<!--{$smarty.server.PHP_SELF|escape}-->?bloc_id=<!--{$item.bloc_id}-->" >編集</a>
+ <a href="<!--{$smarty.server.PHP_SELF|escape}-->?bloc_id=<!--{$item.bloc_id}-->&device_type_id=<!--{$device_type_id}-->" >編集</a>
</td>
<td>
<!--{if $item.del_flg == 0}-->
変更: branches/version-2_5-dev/data/Smarty/templates/admin/design/css.tpl
===================================================================
--- branches/version-2_5-dev/data/Smarty/templates/admin/design/css.tpl 2010-12-15 00:50:43 UTC (rev 19724)
+++ branches/version-2_5-dev/data/Smarty/templates/admin/design/css.tpl 2010-12-15 09:06:23 UTC (rev 19725)
@@ -69,7 +69,7 @@
<tr>
<td><!--{$item.file_name}--></td>
<td style="background:<!--{if $item.css_name == $css_name}--><!--{$smarty.const.SELECT_RGB}--><!--{else}-->#ffffff<!--{/if}-->;">
- <a href="<!--{$smarty.server.PHP_SELF}-->?css_name=<!--{$item.css_name}-->">編集</a>
+ <a href="<!--{$smarty.server.PHP_SELF|escape}-->?css_name=<!--{$item.css_name}-->&device_type_id=<!--{$device_type_id}-->">編集</a>
</td>
<td style="background:<!--{if $item.css_name == $css_name}--><!--{$smarty.const.SELECT_RGB}--><!--{else}-->#ffffff<!--{/if}-->;">
<a href="javascript:;" onclick="fnFormModeSubmit('form_css','delete','css_name','<!--{$item.css_name}-->');">削除</a>
@@ -78,7 +78,7 @@
<!--{/foreach}-->
<!--{else}-->
<tr>
- <td colspan="2">CSSファイルが存在しません。</td>
+ <td colspan="3">CSSファイルが存在しません。</td>
</tr>
<!--{/if}-->
</table>
変更: branches/version-2_5-dev/data/class/SC_View.php
===================================================================
--- branches/version-2_5-dev/data/class/SC_View.php 2010-12-15 00:50:43 UTC (rev 19724)
+++ branches/version-2_5-dev/data/class/SC_View.php 2010-12-15 09:06:23 UTC (rev 19725)
@@ -172,6 +172,34 @@
$this->assignarray($array);
}
+ /**
+ * テンプレートパスをアサインする.
+ *
+ * @param integer $device_type_id 端末種別ID
+ */
+ function assignTemplatePath($device_type_id) {
+
+ // テンプレート変数を割り当て
+ $this->assign("TPL_DIR", SC_Helper_PageLayout_Ex::getUserDir($device_type_id, true));
+
+ // ヘッダとフッタを割り当て
+ $templatePath = SC_Helper_PageLayout_Ex::getTemplatePath($device_type_id, true);
+ $header_tpl = $templatePath . "header.tpl";
+ $footer_tpl = $templatePath . "footer.tpl";
+
+ // ユーザー作成のテンプレートが無ければ, 指定テンプレートを割り当て
+ $templatePath = SC_Helper_PageLayout_Ex::getTemplatePath($device_type_id);
+ if (!$this->_smarty->template_exists($header_tpl)) {
+ $header_tpl = $templatePath . "header.tpl";
+ }
+ if (!$this->_smarty->template_exists($footer_tpl)) {
+ $footer_tpl = $templatePath . "footer.tpl";
+ }
+
+ $this->assign("header_tpl", $header_tpl);
+ $this->assign("footer_tpl", $footer_tpl);
+ }
+
// デバッグ
function debug($var = true){
$this->_smarty->debugging = $var;
@@ -184,7 +212,7 @@
$this->_smarty->template_dir = TEMPLATE_ADMIN_DIR;
$this->_smarty->compile_dir = COMPILE_ADMIN_DIR;
$this->assign('TPL_DIR_DEFAULT', URL_DIR . USER_DIR . USER_PACKAGE_DIR . DEFAULT_TEMPLATE_NAME . '/');
- $this->assign('TPL_DIR', URL_DIR . USER_DIR . USER_PACKAGE_DIR . 'admin/');
+ $this->assign('TPL_DIR', URL_DIR . USER_DIR . USER_PACKAGE_DIR . ADMIN_DIR);
$this->initpath();
}
}
@@ -196,24 +224,7 @@
$this->_smarty->template_dir = TEMPLATE_DIR;
$this->_smarty->compile_dir = COMPILE_DIR;
- // テンプレート変数を割り当て
- $this->assign("TPL_DIR", URL_DIR . USER_DIR . USER_PACKAGE_DIR . TEMPLATE_NAME . "/");
-
- // ヘッダとフッタを割り当て
- $header_tpl = USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/" . "header.tpl";
- $footer_tpl = USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/" . "footer.tpl";
-
- // ユーザー作成のテンプレートが無ければ, 指定テンプレートを割り当て
- if (!$this->_smarty->template_exists($header_tpl)) {
- $header_tpl = TEMPLATE_DIR . "header.tpl";
- }
- if (!$this->_smarty->template_exists($footer_tpl)) {
- $footer_tpl = TEMPLATE_DIR . "footer.tpl";
- }
-
- $this->assign("header_tpl", $header_tpl);
- $this->assign("footer_tpl", $footer_tpl);
-
+ $this->assignTemplatePath(DEVICE_TYPE_PC);
$this->initpath();
if ($setPrevURL) {
@@ -244,8 +255,7 @@
parent::SC_SiteView($setPrevURL);
$this->_smarty->template_dir = MOBILE_TEMPLATE_DIR;
$this->_smarty->compile_dir = MOBILE_COMPILE_DIR;
- // テンプレート変数を割り当て
- $this->assign("TPL_DIR", URL_DIR . MOBILE_DIR . USER_DIR . USER_PACKAGE_DIR . MOBILE_TEMPLATE_NAME . "/");
+ $this->assignTemplatePath(DEVICE_TYPE_MOBILE);
}
}
@@ -254,8 +264,7 @@
parent::SC_SiteView($setPrevURL);
$this->_smarty->template_dir = SMARTPHONE_TEMPLATE_DIR;
$this->_smarty->compile_dir = SMARTPHONE_COMPILE_DIR;
- // テンプレート変数を割り当て
- $this->assign("TPL_DIR", URL_DIR . SMARTPHONE_DIR . USER_DIR . USER_PACKAGE_DIR . SMARTPHONE_TEMPLATE_NAME . "/");
+ $this->assignTemplatePath(DEVICE_TYPE_SMARTPHONE);
}
}
?>
変更: branches/version-2_5-dev/data/class/helper/SC_Helper_PageLayout.php
===================================================================
--- branches/version-2_5-dev/data/class/helper/SC_Helper_PageLayout.php 2010-12-15 00:50:43 UTC (rev 19724)
+++ branches/version-2_5-dev/data/class/helper/SC_Helper_PageLayout.php 2010-12-15 09:06:23 UTC (rev 19725)
@@ -311,10 +311,14 @@
/**
* DocumentRoot から user_data のパスを取得する.
*
+ * 引数 $hasPackage を true にした場合は, user_data/packages/template_name
+ * を取得する.
+ *
* @param integer $device_type_id 端末種別ID
+ * @param boolean $hasPackage パッケージのパスも含める場合 true
* @return string 端末に応じた DocumentRoot から user_data までのパス
*/
- function getUserDir($device_type_id = DEVICE_TYPE_PC) {
+ function getUserDir($device_type_id = DEVICE_TYPE_PC, $hasPackage = false) {
switch ($device_type_id) {
case DEVICE_TYPE_MOBILE:
$userDir = URL_DIR . MOBILE_DIR . USER_DIR;
@@ -323,12 +327,17 @@
case DEVICE_TYPE_SMARTPHONE:
$userDir = URL_DIR . SMARTPHONE_DIR . USER_DIR;
+ $templateName = SMARTPHONE_TEMPLATE_NAME;
break;
case DEVICE_TYPE_PC:
default:
$userDir = URL_DIR . USER_DIR;
+ $templateName = TEMPLATE_NAME;
}
+ if ($hasPackage) {
+ return $userDir . USER_PACKAGE_DIR . $templateName . "/";
+ }
return $userDir;
}
}
変更: branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Bloc.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Bloc.php 2010-12-15 00:50:43 UTC (rev 19724)
+++ branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Bloc.php 2010-12-15 09:06:23 UTC (rev 19725)
@@ -70,8 +70,6 @@
* @return void
*/
function action() {
- $this->objLayout = new SC_Helper_PageLayout_Ex();
- $package_path = USER_TEMPLATE_PATH . "/" . TEMPLATE_NAME . "/";
// 認証可否の判定
$objSess = new SC_Session();
@@ -93,6 +91,9 @@
$device_type_id = DEVICE_TYPE_PC;
}
+ $this->objLayout = new SC_Helper_PageLayout_Ex();
+ $package_path = $this->objLayout->getTemplatePath($device_type_id, true);
+
// ブロック一覧を取得
$this->arrBlocList = $this->lfgetBlocData("device_type_id = ?", array($device_type_id));
@@ -107,7 +108,7 @@
// 存在しない場合は指定テンプレートのブロックを取得
} else {
- $arrBlocData[0]['tpl_path'] = TEMPLATE_DIR . $arrBlocData[0]['tpl_path'];
+ $arrBlocData[0]['tpl_path'] = $this->objLayout->getTemplatePath($device_type_id) . $arrBlocData[0]['tpl_path'];
}
// テンプレートファイルの読み込み
@@ -149,7 +150,7 @@
// エラーがなければ更新処理を行う
if (count($this->arrErr) == 0) {
// DBへデータを更新する
- $this->lfEntryBlocData($_POST);
+ $this->lfEntryBlocData($_POST, $device_type_id);
// 旧ファイルの削除
$old_bloc_path = $package_path . $arrBlocData[0]['tpl_path'];
@@ -247,9 +248,10 @@
* ブロック情報を更新する.
*
* @param array $arrData 更新データ
+ * @param integer $device_type_id 端末種別ID
* @return integer 更新結果
*/
- function lfEntryBlocData($arrData){
+ function lfEntryBlocData($arrData, $device_type_id){
$objQuery = new SC_Query(); // DB操作オブジェクト
$sql = ""; // データ更新SQL生成用
$ret = ""; // データ更新結果格納用
@@ -257,12 +259,14 @@
$arrChk = array(); // 排他チェック用
// 更新データ生成
- $arrUpdData = array($arrData['bloc_name'], BLOC_DIR . $arrData['filename'] . '.tpl', $arrData['filename']);
+ $arrUpdData = array("bloc_name" => $arrData['bloc_name'],
+ "tpl_path" => BLOC_DIR . $arrData['filename'] . '.tpl',
+ "filename" => $arrData['filename']);
// データが存在しているかチェックを行う
if($arrData['bloc_id'] !== ''){
$arrChk = $this->lfgetBlocData("bloc_id = ? AND device_type_id = ?",
- array($arrData['bloc_id'], $arrData['device_type_id']));
+ array($arrData['bloc_id'], $device_type_id));
}
// bloc_id が空 若しくは データが存在していない場合にはINSERTを行う
@@ -270,11 +274,12 @@
// SQL生成
// FIXME device_type_id ごとの連番にする
$arrUpdData['bloc_id'] = $objQuery->nextVal('dtb_bloc_bloc_id');
+ $arrUpdData['device_type_id'] = $device_type_id;
$arrUpdData['create_date'] = "now()";
$ret = $objQuery->insert('dtb_bloc', $arrUpdData);
} else {
$ret = $objQuery->update('dtb_bloc', $arrUpdData, 'bloc_id = ? AND device_type_id = ?',
- array($arrData['bloc_id'], $arrData['device_type_id']));
+ array($arrData['bloc_id'], $device_type_id));
}
return $ret;
}
変更: branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_CSS.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_CSS.php 2010-12-15 00:50:43 UTC (rev 19724)
+++ branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_CSS.php 2010-12-15 09:06:23 UTC (rev 19725)
@@ -75,6 +75,7 @@
SC_Utils_Ex::sfIsSuccess($objSess);
$objFileManager = new SC_Helper_FileManager_Ex();
+ $this->objLayout = new SC_Helper_PageLayout_Ex();
// CSSファイル名を取得
if (isset($_POST['css_name'])) {
@@ -95,7 +96,15 @@
}
$this->old_css_name = $old_css_name;
- $css_dir = USER_TEMPLATE_PATH . TEMPLATE_NAME . "/css/";
+ // 端末種別IDを取得
+ if (isset($_REQUEST['device_type_id'])
+ && is_numeric($_REQUEST['device_type_id'])) {
+ $device_type_id = $_REQUEST['device_type_id'];
+ } else {
+ $device_type_id = DEVICE_TYPE_PC;
+ }
+
+ $css_dir = $this->objLayout->getTemplatePath($device_type_id, true) . "css/";
$css_path = $css_dir . $css_name . '.css';
// CSSファイルの読み込み
@@ -111,15 +120,15 @@
// データ更新処理
case 'confirm':
$this->lfExecuteConfirm($css_dir, $css_name, $old_css_name, $css_path);
- break;
+ break;
case 'delete':
$this->lfExecuteDelete($css_path);
- break;
+ break;
default:
- if(isset($_POST['mode'])) {
- GC_Utils::gfPrintLog("MODEエラー:".$_POST['mode']);
- }
- break;
+ if(isset($_POST['mode'])) {
+ GC_Utils::gfPrintLog("MODEエラー:".$_POST['mode']);
+ }
+ break;
}
// ファイルリストを取得
変更: branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Header.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Header.php 2010-12-15 00:50:43 UTC (rev 19724)
+++ branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Header.php 2010-12-15 09:06:23 UTC (rev 19725)
@@ -74,6 +74,16 @@
$objSess = new SC_Session();
SC_Utils_Ex::sfIsSuccess($objSess);
+ $this->objLayout = new SC_Helper_PageLayout_Ex();
+
+ // 端末種別IDを取得
+ if (isset($_REQUEST['device_type_id'])
+ && is_numeric($_REQUEST['device_type_id'])) {
+ $device_type_id = $_REQUEST['device_type_id'];
+ } else {
+ $device_type_id = DEVICE_TYPE_PC;
+ }
+
$division = isset($_POST['division']) ? $_POST['division'] : "";
$pre_DIR = USER_INC_PATH . 'preview/';
@@ -86,7 +96,7 @@
// 登録時はプレビュー用テンプレートをコピーする
if ($_POST['mode'] == 'confirm'){
- copy($pre_DIR.$division.".tpl", USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/" . $division . ".tpl");
+ copy($pre_DIR.$division.".tpl", $this->objLayout->getTemplatePath($device_type_id, true) . $division . ".tpl");
// 完了メッセージ(プレビュー時は表示しない)
$this->tpl_onload="alert('登録が完了しました。');";
@@ -111,13 +121,13 @@
// ユーザーパスにテンプレートが存在しなければ,
// 指定テンプレートから読み込む
- $header_tpl = USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/" . "header.tpl";
+ $header_tpl = $this->objLayout->getTemplatePath($device_type_id, true) . "header.tpl";
if (!is_file($header_tpl)) {
- $header_tpl = TEMPLATE_DIR . "header.tpl";
+ $header_tpl = $this->objLayout->getTemplatePath($device_type_id) . "header.tpl";
}
- $footer_tpl = USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/" . "footer.tpl";
+ $footer_tpl = $this->objLayout->getTemplatePath($device_type_id, true) . "footer.tpl";
if (!is_file($footer_tpl)) {
- $footer_tpl = TEMPLATE_DIR . "footer.tpl";
+ $footer_tpl = $this->objLayout->getTemplatePath($device_type_id) . "footer.tpl";
}
copy($header_tpl, $pre_DIR . "header.tpl");
変更: branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_MainEdit.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_MainEdit.php 2010-12-15 00:50:43 UTC (rev 19724)
+++ branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_MainEdit.php 2010-12-15 09:06:23 UTC (rev 19725)
@@ -162,7 +162,7 @@
// テンプレートファイルが存在していれば読み込む
$templatePath = $this->objLayout->getTemplatePath($device_type_id, true);
$tpl_file = $templatePath . $arrPageData[0]['filename'] . ".tpl";
- $this->p($tpl_file);
+
if (file_exists($tpl_file)){
$arrPageData[0]['tpl_data'] = file_get_contents($tpl_file);
// 存在してなければ, 指定されたテンプレートのファイルを読み込む
変更: branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Template.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Template.php 2010-12-15 00:50:43 UTC (rev 19724)
+++ branches/version-2_5-dev/data/class/pages/admin/design/LC_Page_Admin_Design_Template.php 2010-12-15 09:06:23 UTC (rev 19725)
@@ -38,22 +38,6 @@
// }}}
// {{{ functions
- /** テンプレートデータ種別 */
- var $arrSubnavi = array(
- 'title' => array(
- 1 => 'top',
- 2 => 'product',
- 3 => 'detail',
- 4 => 'mypage'
- ),
- 'name' =>array(
- 1 => 'TOPページ',
- 2 => '商品一覧ページ',
- 3 => '商品詳細ページ',
- 4 => 'MYページ'
- )
- );
-
/**
* Page を初期化する.
*
@@ -61,15 +45,15 @@
*/
function init() {
parent::init();
- $this->tpl_mainpage = 'design/template.tpl';
- $this->tpl_subnavi = 'design/subnavi.tpl';
- $this->tpl_subno = 'template';
- $this->tpl_mainno = "design";
- $this->tpl_subtitle = 'テンプレート設定';
- $this->arrErr = array();
- $this->arrForm = array();
- $this->tpl_select = TEMPLATE_NAME;
- ini_set("max_execution_time", 300);
+ $this->tpl_mainpage = 'design/template.tpl';
+ $this->tpl_subnavi = 'design/subnavi.tpl';
+ $this->tpl_subno = 'template';
+ $this->tpl_mainno = "design";
+ $this->tpl_subtitle = 'テンプレート設定';
+ $this->arrErr = array();
+ $this->arrForm = array();
+ $this->tpl_select = TEMPLATE_NAME;
+ ini_set("max_execution_time", 300);
}
/**
@@ -91,103 +75,103 @@
*/
function action() {
// 認証可否の判定
- $objSession = new SC_Session();
- SC_Utils::sfIsSuccess($objSession);
+ $objSession = new SC_Session();
+ SC_Utils::sfIsSuccess($objSession);
- // uniqidをテンプレートへ埋め込み
- $this->uniqid = $objSession->getUniqId();
+ // uniqidをテンプレートへ埋め込み
+ $this->uniqid = $objSession->getUniqId();
- $objView = new SC_AdminView();
+ $objView = new SC_AdminView();
- switch($this->lfGetMode()) {
+ switch($this->lfGetMode()) {
- // 登録ボタン押下時
- case 'register':
- // 画面遷移の正当性チェック
- if (!SC_Utils::sfIsValidTransition($objSession)) {
- sfDispError('');
- }
- // パラメータ検証
- $objForm = $this->lfInitRegister();
- if ($objForm->checkError()) {
- SC_Utils_Ex::sfDispError('');
- }
+ // 登録ボタン押下時
+ case 'register':
+ // 画面遷移の正当性チェック
+ if (!SC_Utils::sfIsValidTransition($objSession)) {
+ sfDispError('');
+ }
+ // パラメータ検証
+ $objForm = $this->lfInitRegister();
+ if ($objForm->checkError()) {
+ SC_Utils_Ex::sfDispError('');
+ }
- $template_code = $objForm->getValue('template_code');
+ $template_code = $objForm->getValue('template_code');
$this->tpl_select = $template_code;
- if($template_code == "") {
- $template_code = "default";
- }
+ if($template_code == "") {
+ $template_code = "default";
+ }
- // DBへ使用するテンプレートを登録
- $this->lfRegisterTemplate($template_code);
+ // DBへ使用するテンプレートを登録
+ $this->lfRegisterTemplate($template_code);
- // XXX コンパイルファイルのクリア処理を行う
- $objView->_smarty->clear_compiled_tpl();
+ // XXX コンパイルファイルのクリア処理を行う
+ $objView->_smarty->clear_compiled_tpl();
- // common.cssの内容を更新
- $this->lfChangeCommonCss($template_code);
-
- // テンプレートのコピー
- $this->lfCopyTemplate($template_code);
-
- // ブロック位置を更新
- $this->lfChangeBloc($template_code);
+ // common.cssの内容を更新
+ $this->lfChangeCommonCss($template_code);
+
+ // テンプレートのコピー
+ $this->lfCopyTemplate($template_code);
+
+ // ブロック位置を更新
+ $this->lfChangeBloc($template_code);
- // 完了メッセージ
- $this->tpl_onload="alert('登録が完了しました。');";
- break;
+ // 完了メッセージ
+ $this->tpl_onload="alert('登録が完了しました。');";
+ break;
- // 削除ボタン押下時
- case 'delete':
- // 画面遷移の正当性チェック
- if (!SC_Utils::sfIsValidTransition($objSession)) {
- SC_Utils::sfDispError('');
- }
- // パラメータ検証
- $objForm = $this->lfInitDelete();
- if ($objForm->checkError()) {
- SC_Utils::sfDispError('');
- }
-
- //現在使用中のテンプレートとデフォルトのテンプレートは削除できないようにする
- $template_code = $objForm->getValue('template_code_temp');
- if ($template_code == TEMPLATE_NAME || $template_code == DEFAULT_TEMPLATE_NAME) {
- $this->tpl_onload = "alert('選択中のテンプレートは削除出来ません');";
- break;
- }
- $this->lfDeleteTemplate($template_code);
- break;
+ // 削除ボタン押下時
+ case 'delete':
+ // 画面遷移の正当性チェック
+ if (!SC_Utils::sfIsValidTransition($objSession)) {
+ SC_Utils::sfDispError('');
+ }
+ // パラメータ検証
+ $objForm = $this->lfInitDelete();
+ if ($objForm->checkError()) {
+ SC_Utils::sfDispError('');
+ }
+
+ //現在使用中のテンプレートとデフォルトのテンプレートは削除できないようにする
+ $template_code = $objForm->getValue('template_code_temp');
+ if ($template_code == TEMPLATE_NAME || $template_code == DEFAULT_TEMPLATE_NAME) {
+ $this->tpl_onload = "alert('選択中のテンプレートは削除出来ません');";
+ break;
+ }
+ $this->lfDeleteTemplate($template_code);
+ break;
- // downloadボタン押下時
- case 'download':
- // 画面遷移の正当性チェック
- if (!SC_Utils::sfIsValidTransition($objSession)) {
- SC_Utils::sfDispError('');
- }
- // パラメータ検証
- $objForm = $this->lfInitDownload();
- $template_code = $objForm->getValue('template_code_temp');
- // ユーザデータの下のファイルも保存する。
- $from_dir = USER_TEMPLATE_PATH . $template_code . "/";
- $to_dir = SMARTY_TEMPLATES_DIR . $template_code . "/_packages/";
- SC_Utils::sfMakeDir($to_dir);
- SC_Utils::sfCopyDir($from_dir, $to_dir);
- SC_Helper_FileManager::downloadArchiveFiles(SMARTY_TEMPLATES_DIR . $template_code);
- break;
+ // downloadボタン押下時
+ case 'download':
+ // 画面遷移の正当性チェック
+ if (!SC_Utils::sfIsValidTransition($objSession)) {
+ SC_Utils::sfDispError('');
+ }
+ // パラメータ検証
+ $objForm = $this->lfInitDownload();
+ $template_code = $objForm->getValue('template_code_temp');
+ // ユーザデータの下のファイルも保存する。
+ $from_dir = USER_TEMPLATE_PATH . $template_code . "/";
+ $to_dir = SMARTY_TEMPLATES_DIR . $template_code . "/_packages/";
+ SC_Utils::sfMakeDir($to_dir);
+ SC_Utils::sfCopyDir($from_dir, $to_dir);
+ SC_Helper_FileManager::downloadArchiveFiles(SMARTY_TEMPLATES_DIR . $template_code);
+ break;
- // プレビューボタン押下時
- case 'preview':
- break;
+ // プレビューボタン押下時
+ case 'preview':
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
- // defaultパラメータのセット
- $this->templates = $this->lfGetAllTemplates();
- $this->now_template = TEMPLATE_NAME;
+ // defaultパラメータのセット
+ $this->templates = $this->lfGetAllTemplates();
+ $this->now_template = TEMPLATE_NAME;
$this->device_type_id = $device_type_id;
}
@@ -200,42 +184,42 @@
parent::destroy();
}
- function lfGetMode(){
- if (isset($_POST['mode'])) return $_POST['mode'];
- }
+ function lfGetMode(){
+ if (isset($_POST['mode'])) return $_POST['mode'];
+ }
- function lfInitRegister() {
- $objForm = new SC_FormParam();
- $objForm->addParam(
- 'template_code', 'template_code', STEXT_LEN, '',
- array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "ALNUM_CHECK")
- );
- $objForm->setParam($_POST);
+ function lfInitRegister() {
+ $objForm = new SC_FormParam();
+ $objForm->addParam(
+ 'template_code', 'template_code', STEXT_LEN, '',
+ array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "ALNUM_CHECK")
+ );
+ $objForm->setParam($_POST);
- return $objForm;
- }
+ return $objForm;
+ }
- function lfInitDelete() {
- $objForm = new SC_FormParam();
- $objForm->addParam(
- 'template_code_temp', 'template_code_temp', STEXT_LEN, '',
- array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "ALNUM_CHECK")
- );
- $objForm->setParam($_POST);
+ function lfInitDelete() {
+ $objForm = new SC_FormParam();
+ $objForm->addParam(
+ 'template_code_temp', 'template_code_temp', STEXT_LEN, '',
+ array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "ALNUM_CHECK")
+ );
+ $objForm->setParam($_POST);
- return $objForm;
- }
+ return $objForm;
+ }
- function lfInitDownload() {
- $objForm = new SC_FormParam();
- $objForm->addParam(
- 'template_code_temp', 'template_code_temp', STEXT_LEN, '',
- array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "ALNUM_CHECK")
- );
- $objForm->setParam($_POST);
+ function lfInitDownload() {
+ $objForm = new SC_FormParam();
+ $objForm->addParam(
+ 'template_code_temp', 'template_code_temp', STEXT_LEN, '',
+ array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK", "ALNUM_CHECK")
+ );
+ $objForm->setParam($_POST);
- return $objForm;
- }
+ return $objForm;
+ }
/**
* 使用するテンプレートをDBへ登録する
@@ -252,9 +236,9 @@
$masterData->createCache('mtb_constants', array(), true, array('id', 'remarks'));
}
- /**
- * common.cssの更新
- */
+ /**
+ * common.cssの更新
+ */
function lfChangeCommonCss($template_code) {
$css_path = USER_PATH . "css/common.css";
@@ -271,56 +255,56 @@
fwrite($fp, $css);
fclose($fp);
}
-
- /**
- * ブロック位置の更新
- */
- function lfChangeBloc($template_code) {
- $objQuery = new SC_Query();
- $filepath = USER_TEMPLATE_PATH. $template_code. "/sql/update_bloc.sql";
-
- // ブロック位置更新SQLファイル有
- if(file_exists($filepath)) {
- if($fp = fopen($filepath, "r")) {
- $sql = fread($fp, filesize($filepath));
- fclose($fp);
- }
- // 改行、タブを1スペースに変換
- $sql = preg_replace("/[\r\n\t]/", " " ,$sql);
- $sql_split = split(";", $sql);
- foreach($sql_split as $key => $val){
- if (trim($val) != "") {
- $objQuery->query($val);
- }
- }
- }
- }
+
+ /**
+ * ブロック位置の更新
+ */
+ function lfChangeBloc($template_code) {
+ $objQuery = new SC_Query();
+ $filepath = USER_TEMPLATE_PATH. $template_code. "/sql/update_bloc.sql";
+
+ // ブロック位置更新SQLファイル有
+ if(file_exists($filepath)) {
+ if($fp = fopen($filepath, "r")) {
+ $sql = fread($fp, filesize($filepath));
+ fclose($fp);
+ }
+ // 改行、タブを1スペースに変換
+ $sql = preg_replace("/[\r\n\t]/", " " ,$sql);
+ $sql_split = split(";", $sql);
+ foreach($sql_split as $key => $val){
+ if (trim($val) != "") {
+ $objQuery->query($val);
+ }
+ }
+ }
+ }
- /**
- * テンプレートパッケージの削除
- */
- function lfDeleteTemplate($template_code) {
- // DB更新
- $objQuery = new SC_Query();
- $objQuery->delete('dtb_templates', 'template_code = ?', array($template_code));
- // テンプレート削除
- $templates_dir = SMARTY_TEMPLATES_DIR. $template_code. "/";
- SC_Utils_Ex::sfDelFile($templates_dir);
- // コンパイル削除
- $templates_c_dir = DATA_PATH. "Smarty/templates_c/". $template_code. "/";
- SC_Utils_Ex::sfDelFile($templates_c_dir);
- // ユーザーデータ削除
- $user_dir = USER_TEMPLATE_PATH. $template_code. "/";
- SC_Utils_Ex::sfDelFile($user_dir);
- }
+ /**
+ * テンプレートパッケージの削除
+ */
+ function lfDeleteTemplate($template_code) {
+ // DB更新
+ $objQuery = new SC_Query();
+ $objQuery->delete('dtb_templates', 'template_code = ?', array($template_code));
+ // テンプレート削除
+ $templates_dir = SMARTY_TEMPLATES_DIR. $template_code. "/";
+ SC_Utils_Ex::sfDelFile($templates_dir);
+ // コンパイル削除
+ $templates_c_dir = DATA_PATH. "Smarty/templates_c/". $template_code. "/";
+ SC_Utils_Ex::sfDelFile($templates_c_dir);
+ // ユーザーデータ削除
+ $user_dir = USER_TEMPLATE_PATH. $template_code. "/";
+ SC_Utils_Ex::sfDelFile($user_dir);
+ }
- function lfGetAllTemplates() {
- $objQuery = new SC_Query();
- $arrRet = $objQuery->select('*', 'dtb_templates');
- if (empty($arrRet)) return array();
+ function lfGetAllTemplates() {
+ $objQuery = new SC_Query();
+ $arrRet = $objQuery->select('*', 'dtb_templates');
+ if (empty($arrRet)) return array();
- return $arrRet;
- }
+ return $arrRet;
+ }
/*
* 関数名:lfCreateTemplate()
@@ -330,9 +314,9 @@
* 戻り値:無し
*/
function lfCreateTemplate($dir, $file , $cart_flg) {
- umask(0);
+ umask(0);
$objFileManager = new SC_Helper_FileManager_Ex();
-
+
// 作成ファイルディレクトリ
$create_dir = $dir . $file;
$create_active_dir = $create_dir . "/" . CAMPAIGN_TEMPLATE_ACTIVE;
Svn-src-all メーリングリストの案内