source: branches/comu-ver2/data/Smarty/templates/default/admin/order/product_select.tpl @ 17605

Revision 17605, 8.0 KB checked in by Seasoft, 16 years ago (diff)

/index.php にリンクやリダイレクトしている箇所の「index.php」を定数化。

  • 定数「DIR_INDEX_FILE」… DirectoryIndex? の実ファイル名。現状の EC-CUBE は、「index.php」。/html/define.php で定義するが、定義が無い場合 SC_Initial::defineDirectoryIndex() で「index.php」と定義。本来は、プログラム中で実ファイルとしての index.php を指すときとは、この定数を使うのが良い気がするが、今回はそこまでは書き換えていない。
  • 定数「USE_FILENAME_DIR_INDEX」… DIR_INDEX_FILE にアクセスするときにファイル名を使用するか。/html/define.php で定義。
  • 定数「DIR_INDEX_URL」… /index.php にリンクやリダイレクトしている箇所の「index.php」部分を示す。この定数は SC_Initial::defineDirectoryIndex() で自動生成する。

・$_SERVERPHP_SELF? や自身をあらわすファイル名を利用している箇所を文字列「?」に書き換え。これにより、/ が自己URLにリンクするときに /index.php となることを防ぐ。RFC3986 を参考にする。モバイル端末がこのRFCに準拠しているのか確信が無いので、モバイルではこの変更は見送った。
・従来 / にリンクしていた箇所に、定数「DIR_INDEX_URL」を付加。漏れがあると予測される。

  • Property svn:executable set to *
Line 
1<!--{*
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2008 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * 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 of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23*}-->
24<!--{include file="`$smarty.const.TEMPLATE_ADMIN_DIR`admin_popup_header.tpl"}-->
25
26<script type="text/javascript">
27<!--
28self.moveTo(20,20);self.focus();
29
30function func_submit(product_id, class_name1, class_name2){
31  var err_text = '';
32  var fm = window.opener.document.form1;
33  var fm1 = window.opener.document;
34  var class1 = "classcategory_id" + product_id + "_1";
35  var class2 = "classcategory_id" + product_id + "_2";
36
37  var class1_id = document.getElementById(class1).value;
38  var class2_id = document.getElementById(class2).value;
39
40  <!--{if $tpl_no != ''}-->
41  var opner_product_id = 'edit_product_id';
42  var opner_classcategory_id1 = 'edit_classcategory_id1';
43  var opner_classcategory_id2 = 'edit_classcategory_id2';
44  fm1.getElementById("no").value = <!--{$tpl_no}-->;
45  <!--{else}-->
46  var opner_product_id = 'add_product_id';
47  var opner_classcategory_id1 = 'add_classcategory_id1';
48  var opner_classcategory_id2 = 'add_classcategory_id2';
49  <!--{/if}-->
50
51  if (document.getElementById(class1).type == 'select-one' && class1_id == '') {
52    err_text = class_name1 + "を選択してください。\n";
53  }
54  if (document.getElementById(class2).type == 'select-one' && class2_id == '') {
55    err_text = err_text + class_name2 + "を選択してください。\n";
56  }
57  if (err_text != '') {
58    alert(err_text);
59    return false;
60  }
61
62  fm1.getElementById(opner_product_id).value = product_id;
63  if (class1_id != '') {
64    fm1.getElementById(opner_classcategory_id1).value = class1_id;
65  }
66  if (class2_id != '') {
67    fm1.getElementById(opner_classcategory_id2).value = class2_id;
68  }
69
70  fm.mode.value = 'select_product_detail';
71  fm.anchor_key.value = 'order_products';
72  fm.submit();
73  window.close();
74  return true;
75}
76//-->
77</script>
78
79<script type="text/javascript">//<![CDATA[
80// セレクトボックスに項目を割り当てる。
81function lnSetSelect(name1, name2, id, val) {
82        sele1 = document.form1[name1];
83        sele2 = document.form1[name2];
84        lists = eval('lists' + id);
85        vals = eval('vals' + id);
86
87        if(sele1 && sele2) {
88                index = sele1.selectedIndex;
89
90                // セレクトボックスのクリア
91                count = sele2.options.length;
92                for(i = count; i >= 0; i--) {
93                        sele2.options[i] = null;
94                }
95
96                // セレクトボックスに値を割り当てる
97                len = lists[index].length;
98                for(i = 0; i < len; i++) {
99                        sele2.options[i] = new Option(lists[index][i], vals[index][i]);
100                        if(val != "" && vals[index][i] == val) {
101                                sele2.options[i].selected = true;
102                        }
103                }
104        }
105}
106//]]>
107</script>
108
109<script type="text/javascript">//<![CDATA[
110    <!--{$tpl_javascript}-->
111//]]>
112</script>
113
114<!--▼検索フォーム-->
115<form name="form1" id="form1" method="post" action="?">
116<input name="mode" type="hidden" value="search" />
117<input name="anchor_key" type="hidden" value="" />
118<input name="search_pageno" type="hidden" value="" />
119<input name="no" type="hidden" value="<!--{$tpl_no}-->" />
120<table class="form">
121  <tr>
122    <th>カテゴリ</th>
123    <td>
124      <select name="search_category_id">
125        <option value="" selected="selected">選択してください</option>
126        <!--{html_options options=$arrCatList selected=$arrForm.search_category_id}-->
127      </select>
128    </td>
129  </tr>
130  <tr>
131    <th>商品名</th>
132    <td><input type="text" name="search_name" value="<!--{$arrForm.search_name}-->" size="35" class="box35" /></td>
133  </tr>
134  <tr>
135    <th>商品番号</th>
136    <td><input type="text" name="search_product_code" value="<!--{$arrForm.search_product_code}-->" size="35" class="box35" /></td>
137  </tr>
138</table>
139<div class="btn">
140  <button type="submit"><span>検索を開始</span></button>
141</div>
142
143<!--▼検索結果表示-->
144<!--{if $tpl_linemax}-->
145<p>
146  <!--{$tpl_linemax}-->件が該当しました。
147  <!--{$tpl_strnavi}-->
148</p>
149
150<!--▼検索後表示部分-->
151<table class="list">
152  <tr>
153    <th class="image">商品画像</th>
154    <th class="id">商品番号</th>
155    <th class="name">商品名</th>
156    <th class="action">決定</th>
157  </tr>
158  <!--{section name=cnt loop=$arrProducts}-->
159  <!--{assign var=id value=$arrProducts[cnt].product_id}-->
160  <!--▼商品<!--{$smarty.section.cnt.iteration}-->-->
161  <tr>
162    <td class="center">
163      <!--{if $arrProducts[cnt].main_list_image != ""}-->
164        <!--{assign var=image_path value="`$arrProducts[cnt].main_list_image`"}-->
165      <!--{else}-->
166        <!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}-->
167      <!--{/if}-->
168      <img src="<!--{$smarty.const.SITE_URL}-->resize_image.php?image=<!--{$image_path}-->&width=65&height=65" alt="<!--{$arrRecommend[$recommend_no].name|escape}-->" />
169    </td> 
170    <td>
171      <!--{assign var=codemin value=`$arrProducts[cnt].product_code_min`}-->
172      <!--{assign var=codemax value=`$arrProducts[cnt].product_code_max`}-->
173      <!--{* 商品コード *}-->
174      <!--{if $codemin != $codemax}-->
175        <!--{$codemin|escape}-->~<!--{$codemax|escape}-->
176      <!--{else}-->
177        <!--{$codemin|escape}-->
178      <!--{/if}-->
179    </td>
180    <td>
181      <!--{$arrProducts[cnt].name|escape}-->
182      <!--{assign var=class1 value=classcategory_id`$id`_1}-->
183      <!--{assign var=class2 value=classcategory_id`$id`_2}-->
184      <!--{if $tpl_classcat_find1[$id]}-->
185      <dt><!--{$tpl_class_name1[$id]|escape}-->:</dt>
186      <dd>
187        <select name="<!--{$class1}-->" id="<!--{$class1}-->" style="<!--{$arrErr[$class1]|sfGetErrorColor}-->" onchange="lnSetSelect('<!--{$class1}-->', '<!--{$class2}-->', '<!--{$id}-->','');">
188          <option value="">選択してください</option>
189          <!--{html_options options=$arrClassCat1[$id] selected=$arrForm[$class1]}-->
190        </select>
191        <!--{if $arrErr[$class1] != ""}-->
192        <br /><span class="attention">※ <!--{$tpl_class_name1[$id]}-->を入力して下さい。</span>
193        <!--{/if}-->
194      </dd>
195      <!--{else}-->
196      <input type="hidden" name="<!--{$class1}-->" id="<!--{$class1}-->" value="" />
197      <!--{/if}-->
198      <!--{if $tpl_classcat_find2[$id]}-->
199      <dt><!--{$tpl_class_name2[$id]|escape}-->:</dt>
200      <dd>
201        <select name="<!--{$class2}-->" id="<!--{$class2}-->" style="<!--{$arrErr[$class2]|sfGetErrorColor}-->">
202          <option value="">選択してください</option>
203        </select>
204        <!--{if $arrErr[$class2] != ""}-->
205        <br /><span class="attention">※ <!--{$tpl_class_name2[$id]}-->を入力して下さい。</span>
206        <!--{/if}-->
207      </dd>
208      <!--{else}-->
209      <input type="hidden" name="<!--{$class2}-->" id="<!--{$class2}-->" value="" />
210      <!--{/if}-->
211    </td>
212    <td class="center"><a href="" onClick="return func_submit('<!--{$arrProducts[cnt].product_id}-->', '<!--{$tpl_class_name1[$id]}-->', '<!--{$tpl_class_name2[$id]}-->')">決定</a></td>
213  </tr>
214  <!--▲商品<!--{$smarty.section.cnt.iteration}-->-->
215  <!--{sectionelse}-->
216  <tr>
217    <td colspan="4">商品が登録されていません</td>
218  </tr> 
219  <!--{/section}-->
220  </table>
221<!--{/if}-->
222<!--▲検索結果表示-->
223
224</form>
225
226<!--{include file="`$smarty.const.TEMPLATE_ADMIN_DIR`admin_popup_footer.tpl"}-->
Note: See TracBrowser for help on using the repository browser.