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

Revision 17605, 9.2 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:eol-style set to LF
  • Property svn:mime-type set to text/html; charset=UTF-8
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<script type="text/javascript">
25<!--
26
27function func_regist(url) {
28  res = confirm('この内容で<!--{if $edit_mode eq "on"}-->編集<!--{else}-->登録<!--{/if}-->しても宜しいですか?');
29  if(res == true) {
30    document.form1.mode.value = 'regist';
31    document.form1.submit();
32    return false;
33  }
34  return false;
35}
36
37function func_edit(news_id) {
38  document.form1.mode.value = "search";
39  document.form1.news_id.value = news_id;
40  document.form1.submit();
41}
42
43function func_del(news_id) {
44  res = confirm('この新着情報を削除しても宜しいですか?');
45  if(res == true) {
46    document.form1.mode.value = "delete";
47    document.form1.news_id.value = news_id;
48    document.form1.submit();
49  }
50  return false;
51}
52
53function func_rankMove(term,news_id) {
54  document.form1.mode.value = "move";
55  document.form1.news_id.value = news_id;
56  document.form1.term.value = term;
57  document.form1.submit();
58}
59
60function moving(news_id,rank, max_rank) {
61
62  var val;
63  var ml;
64  var len;
65
66  ml = document.move;
67  len = document.move.elements.length;
68  j = 0;
69  for( var i = 0 ; i < len ; i++) {
70      if ( ml.elements[i].name == 'position' && ml.elements[i].value != "" ) {
71      val = ml.elements[i].value;
72      j ++;
73      }
74  }
75
76  if ( j > 1) {
77    alert( '移動順位は1つだけ入力してください。' );
78    return false;
79  } else if( ! val ) {
80    alert( '移動順位を入力してください。' );
81    return false;
82  } else if( val.length > 4){
83    alert( '移動順位は4桁以内で入力してください。' );
84    return false;
85  } else if( val.match(/[0-9]+/g) != val){
86    alert( '移動順位は数字で入力してください。' );
87    return false;
88  } else if( val == rank ){
89    alert( '移動させる番号が重複しています。' );
90    return false;
91  } else if( val == 0 ){
92    alert( '移動順位は0以上で入力してください。' );
93    return false;
94  } else if( val > max_rank ){
95    alert( '入力された順位は、登録数の最大値を超えています。' );
96    return false;
97  } else {
98    ml.moveposition.value = val;
99    ml.rank.value = rank;
100    ml.news_id.value = news_id;
101    ml.submit();
102    return false;
103  }
104}
105
106//-->
107</script>
108
109
110<div id="admin-contents" class="contents-main">
111<form name="form1" id="form1" method="post" action="?">
112<input type="hidden" name="mode" value="" />
113<input type="hidden" name="news_id" value="<!--{$news_id|escape}-->" />
114<input type="hidden" name="term" value="" />
115  <h2>新規登録</h2>
116  <!--{* ▼登録テーブルここから *}-->
117  <table>
118    <tr>
119      <th>日付<span class="attention"> *</span></th>
120      <td>
121        <!--{if $arrErr.year || $arrErr.month || $arrErr.day}--><span class="attention"><!--{$arrErr.year}--><!--{$arrErr.month}--><!--{$arrErr.day}--></span><!--{/if}-->
122        <select name="year" <!--{if $arrErr.year}-->style="background-color:<!--{$smarty.const.ERR_COLOR|escape}-->"<!--{/if}-->>
123          <option value="" selected>----</option>
124          <!--{html_options options=$arrYear selected=$selected_year}-->
125        </select>年
126        <select name="month" <!--{if $arrErr.month}-->style="background-color:<!--{$smarty.const.ERR_COLOR|escape}-->"<!--{/if}-->>
127          <option value="" selected>--</option>
128          <!--{html_options options=$arrMonth selected=$selected_month}-->
129        </select>月
130        <select name="day" <!--{if $arrErr.day}-->style="background-color:<!--{$smarty.const.ERR_COLOR|escape}-->"<!--{/if}-->>
131          <option value="" selected>--</option>
132          <!--{html_options options=$arrDay selected=$selected_day}-->
133        </select>日
134      </td>
135    </tr>
136    <tr>
137      <th>タイトル<span class="attention"> *</span></th>
138      <td>
139        <!--{if $arrErr.news_title}--><span class="attention"><!--{$arrErr.news_title}--></span><!--{/if}-->
140        <textarea name="news_title" cols="60" rows="8" class="area60" maxlength="<!--{$smarty.const.MTEXT_LEN}-->" <!--{if $arrErr.news_title}-->style="background-color:<!--{$smarty.const.ERR_COLOR|escape}-->"<!--{/if}-->><!--{$news_title|escape}--></textarea><br />
141        <span class="attention"> (上限<!--{$smarty.const.MTEXT_LEN}-->文字)</span>
142      </td>
143    </tr>
144    <tr>
145      <th>URL</th>
146      <td>
147        <span class="attention"><!--{$arrErr.news_url}--></span>
148        <input type="text" name="news_url" size="60" class="box60"  value="<!--{$news_url|escape}-->" <!--{if $arrErr.news_url}-->style="background-color:<!--{$smarty.const.ERR_COLOR|escape}-->"<!--{/if}--> maxlength="<!--{$smarty.const.URL_LEN}-->" />
149        <span class="attention"> (上限<!--{$smarty.const.URL_LEN}-->文字)</span>
150      </td>
151    </tr>
152    <tr>
153      <th>リンク</th>
154      <td><input type="checkbox" name="link_method" value="2" <!--{if $link_method eq 2}--> checked <!--{/if}--> >別ウィンドウで開く</td>
155    </tr>
156    <tr>
157      <th>本文作成</th>
158      <td>
159        <!--{if $arrErr.news_comment}--><span class="attention"><!--{$arrErr.news_comment}--></span><!--{/if}-->
160        <textarea name="news_comment" cols="60" rows="8" wrap="soft" class="area60" maxlength="<!--{$smarty.const.LTEXT_LEN}-->" style="background-color:<!--{if $arrErr.news_comment}--><!--{$smarty.const.ERR_COLOR|escape}--><!--{/if}-->"><!--{$news_comment|escape}--></textarea><br />
161        <span class="attention"> (上限3000文字)</span>
162      </td>
163    </tr>
164  </table>
165  <!--{* ▲登録テーブルここまで *}-->
166
167  <div class="btn"><button type="submit" onclick="return func_regist();"><span>この内容で登録する</span></button></div>
168</form>
169
170  <h2>登録済み新着情報</h2>
171  <!--{if $arrErr.moveposition}-->
172  <p><span class="attention"><!--{$arrErr.moveposition}--></span></p>
173  <!--{/if}-->
174  <!--{* ▼一覧表示エリアここから *}-->
175  <form name="move" id="move" method="post" action="?">
176  <input type="hidden" name="mode" value="moveRankSet" />
177  <input type="hidden" name="term" value="setposition" />
178  <input type="hidden" name="news_id" value="" />
179  <input type="hidden" name="moveposition" value="" />
180  <input type="hidden" name="rank" value="" />
181  <table class="list">
182    <tr>
183      <th>順位</th>
184      <th>日付</th>
185      <th>タイトル</th>
186      <th>編集</th>
187      <th>削除</th>
188      <th>移動</th>
189    </tr>
190    <!--{section name=data loop=$list_data}-->
191    <tr style="background:<!--{if $list_data[data].news_id eq $news_id}--><!--{$smarty.const.SELECT_RGB}--><!--{else}-->#ffffff<!--{/if}-->;" class="center">
192      <!--{assign var=db_rank value="`$list_data[data].rank`"}-->
193      <!--{assign var=rank value="`$line_max-$db_rank+1`"}-->
194      <td><!--{$rank}--></td>
195      <td><!--{$list_data[data].cast_news_date|date_format:"%Y/%m/%d"}--></td>
196      <td class="left">
197        <!--{if $list_data[data].link_method eq 1 && $list_data[data].news_url != ""}--><a href="<!--{$list_data[data].news_url}-->" ><!--{$list_data[data].news_title|escape|nl2br}--></a>
198        <!--{elseif $list_data[data].link_method eq 1 && $list_data[data].news_url == ""}--><!--{$list_data[data].news_title|escape|nl2br}-->
199        <!--{elseif $list_data[data].link_method eq 2 && $list_data[data].news_url != ""}--><a href="<!--{$list_data[data].news_url}-->" target="_blank" ><!--{$list_data[data].news_title|escape|nl2br}--></a>
200        <!--{else}--><!--{$list_data[data].news_title|escape|nl2br}-->
201        <!--{/if}-->
202      </td>
203      <td><a href="#" onclick="return func_edit('<!--{$list_data[data].news_id|escape}-->');">編集</a></td>
204      <td><a href="#" onclick="return func_del('<!--{$list_data[data].news_id|escape}-->');">削除</a></td>
205      <td>
206      <!--{if count($list_data) != 1}-->
207      <input type="text" name="pos-<!--{$list_data[data].news_id}-->" size="3" class="box3" />番目へ<a href="?" onclick="fnFormModeSubmit('move', 'moveRankSet','news_id', '<!--{$list_data[data].news_id}-->'); return false;">移動</a><br />
208      <!--{/if}-->
209      <!--{if $list_data[data].rank ne $max_rank}--><a href="#" onclick="return func_rankMove('up', '<!--{$list_data[data].news_id|escape}-->', '<!--{$max_rank|escape}-->');">上へ</a><!--{/if}--> <!--{if $list_data[data].rank ne 1}--><a href="#" onclick="return func_rankMove('down', '<!--{$list_data[data].news_id|escape}-->', '<!--{$max_rank|escape}-->');">下へ</a><!--{/if}-->
210      </td>
211    </tr>
212    <!--{sectionelse}-->
213    <tr class="center">
214      <td colspan="6">現在データはありません。</td>
215    </tr>
216    <!--{/section}-->
217  </table>
218  </form>
219  <!--{* ▲一覧表示エリアここまで *}-->
220
221</div>
Note: See TracBrowser for help on using the repository browser.