source: branches/version-2_12-dev/html/js/site.js @ 22306

Revision 22306, 10.4 KB checked in by undertree, 11 years ago (diff)

#2009 (管理画面での受注キャンセル時に在庫数を戻す)

・オーダーの削除をSC_Helper_Purchase::cancelOrder()に置き換え
・関係する表示の注記を削除

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
Line 
1/*
2 * This file is part of EC-CUBE
3 *
4 * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved.
5 *
6 * http://www.lockon.co.jp/
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21 */
22// 親ウィンドウの存在確認.
23function fnIsopener() {
24    var ua = navigator.userAgent;
25    if( !!window.opener ) {
26        if( ua.indexOf('MSIE 4')!=-1 && ua.indexOf('Win')!=-1 ) {
27            return !window.opener.closed;
28        } else {
29            return typeof window.opener.document == 'object';
30        }
31    } else {
32        return false;
33    }
34}
35
36// 郵便番号入力呼び出し.
37function fnCallAddress(php_url, tagname1, tagname2, input1, input2) {
38    zip1 = document.form1[tagname1].value;
39    zip2 = document.form1[tagname2].value;
40
41    if(zip1.length == 3 && zip2.length == 4) {
42        $.get(
43            php_url,
44            {zip1: zip1, zip2: zip2, input1: input1, input2: input2},
45            function(data) {
46                arrdata = data.split("|");
47                if (arrdata.length > 1) {
48                    fnPutAddress(input1, input2, arrdata[0], arrdata[1], arrdata[2]);
49                } else {
50                    alert(data);
51                }
52            }
53        );
54    } else {
55        alert("郵便番号を正しく入力して下さい。");
56    }
57}
58
59// 郵便番号から検索した住所を渡す.
60function fnPutAddress(input1, input2, state, city, town) {
61    if(state != "") {
62        // 項目に値を入力する.
63        document.form1[input1].selectedIndex = state;
64        document.form1[input2].value = city + town;
65    }
66}
67
68function fnOpenNoMenu(URL) {
69    window.open(URL,"nomenu","scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no");
70}
71
72function fnOpenWindow(URL,name,width,height) {
73    window.open(URL,name,"width="+width+",height="+height+",scrollbars=yes,resizable=no,toolbar=no,location=no,directories=no,status=no");
74}
75
76function fnSetFocus(name) {
77    if(document.form1[name]) {
78        document.form1[name].focus();
79    }
80}
81
82// セレクトボックスに項目を割り当てる.
83function fnSetSelect(name1, name2, val) {
84    sele1 = document.form1[name1];
85    sele2 = document.form1[name2];
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// Enterキー入力をキャンセルする。(IEに対応)
108function fnCancelEnter()
109{
110    if (gCssUA.indexOf("WIN") != -1 && gCssUA.indexOf("MSIE") != -1) {
111        if (window.event.keyCode == 13)
112        {
113            return false;
114        }
115    }
116    return true;
117}
118
119// モードとキーを指定してSUBMITを行う。
120function fnModeSubmit(mode, keyname, keyid) {
121    switch(mode) {
122    case 'delete_category':
123        if(!window.confirm('選択したカテゴリとカテゴリ内のすべてのカテゴリを削除します')){
124            return;
125        }
126        break;
127    case 'delete':
128        if(!window.confirm('一度削除したデータは、元に戻せません。\n削除しても宜しいですか?')){
129            return;
130        }
131        break;
132    case 'confirm':
133        if(!window.confirm('登録しても宜しいですか')){
134            return;
135        }
136        break;
137    case 'delete_all':
138        if(!window.confirm('検索結果をすべて削除しても宜しいですか')){
139            return;
140        }
141        break;
142    default:
143        break;
144    }
145    document.form1['mode'].value = mode;
146    if(keyname != "" && keyid != "") {
147        document.form1[keyname].value = keyid;
148    }
149    document.form1.submit();
150}
151
152function fnFormModeSubmit(form, mode, keyname, keyid) {
153    switch(mode) {
154    case 'delete':
155        if(!window.confirm('一度削除したデータは、元に戻せません。\n削除しても宜しいですか?')){
156            return;
157        }
158        break;
159    case 'confirm':
160        if(!window.confirm('登録しても宜しいですか')){
161            return;
162        }
163        break;
164    case 'regist':
165        if(!window.confirm('登録しても宜しいですか')){
166            return;
167        }
168        break;
169    default:
170        break;
171    }
172    document.forms[form]['mode'].value = mode;
173    if(keyname != "" && keyid != "") {
174        document.forms[form][keyname].value = keyid;
175    }
176    document.forms[form].submit();
177}
178
179function fnSetFormSubmit(form, key, val) {
180    document.forms[form][key].value = val;
181    document.forms[form].submit();
182    return false;
183}
184
185function fnSetVal(key, val) {
186    fnSetFormVal('form1', key, val);
187}
188
189function fnSetFormVal(form, key, val) {
190    document.forms[form][key].value = val;
191}
192
193function fnChangeAction(url) {
194    document.form1.action = url;
195}
196
197// ページナビで使用する。
198function fnNaviPage(pageno) {
199    document.form1['pageno'].value = pageno;
200    document.form1.submit();
201}
202
203function fnSearchPageNavi(pageno) {
204    document.form1['pageno'].value = pageno;
205    document.form1['mode'].value = 'search';
206    document.form1.submit();
207    }
208
209function fnSubmit(){
210    document.form1.submit();
211}
212
213// ポイント入力制限。
214function fnCheckInputPoint() {
215    if(document.form1['point_check']) {
216        list = new Array(
217                        'use_point'
218                        );
219
220        if(!document.form1['point_check'][0].checked) {
221            color = "#dddddd";
222            flag = true;
223        } else {
224            color = "";
225            flag = false;
226        }
227
228        len = list.length
229        for(i = 0; i < len; i++) {
230            if(document.form1[list[i]]) {
231                var current_color = document.form1[list[i]].style.backgroundColor;
232                if (color != "#dddddd" && (current_color == "#ffe8e8" || current_color == "rgb(255, 232, 232)"))
233                {
234                    continue;
235                }
236                document.form1[list[i]].disabled = flag;
237                document.form1[list[i]].style.backgroundColor = color;
238            }
239        }
240    }
241}
242
243// 別のお届け先入力制限。
244function fnCheckInputDeliv() {
245    if(!document.form1) {
246        return;
247    }
248    if(document.form1['deliv_check']) {
249        list = new Array(
250                        'shipping_name01',
251                        'shipping_name02',
252                        'shipping_kana01',
253                        'shipping_kana02',
254                        'shipping_pref',
255                        'shipping_zip01',
256                        'shipping_zip02',
257                        'shipping_addr01',
258                        'shipping_addr02',
259                        'shipping_tel01',
260                        'shipping_tel02',
261                        'shipping_tel03'
262                        );
263
264        if(!document.form1['deliv_check'].checked) {
265            fnChangeDisabled(list, '#dddddd');
266        } else {
267            fnChangeDisabled(list, '');
268        }
269    }
270}
271
272// 最初に設定されていた色を保存しておく。
273var g_savecolor = new Array();
274
275function fnChangeDisabled(list, color) {
276    len = list.length;
277
278    for(i = 0; i < len; i++) {
279        if(document.form1[list[i]]) {
280            if(color == "") {
281                // 有効にする。
282                document.form1[list[i]].disabled = false;
283                document.form1[list[i]].style.backgroundColor = g_savecolor[list[i]];
284            } else {
285                // 無効にする。
286                document.form1[list[i]].disabled = true;
287                g_savecolor[list[i]] = document.form1[list[i]].style.backgroundColor;
288                document.form1[list[i]].style.backgroundColor = color;//"#f0f0f0";
289            }
290        }
291    }
292}
293
294
295// ログイン時の入力チェック
296function fnCheckLogin(formname) {
297    var lstitem = new Array();
298
299    lstitem[0] = 'login_email';
300    lstitem[1] = 'login_pass';
301
302    var max = lstitem.length;
303    var errflg = false;
304    var cnt = 0;
305
306    // 必須項目のチェック
307    for(cnt = 0; cnt < max; cnt++) {
308        if(document.forms[formname][lstitem[cnt]].value == "") {
309            errflg = true;
310            break;
311        }
312    }
313
314    // 必須項目が入力されていない場合
315    if(errflg == true) {
316        alert('メールアドレス/パスワードを入力して下さい。');
317        return false;
318    } else {
319        return true;
320    }
321}
322
323// 時間の計測.
324function fnPassTime(){
325    end_time = new Date();
326    time = end_time.getTime() - start_time.getTime();
327    alert((time/1000));
328}
329start_time = new Date();
330
331//親ウィンドウのページを変更する.
332function fnUpdateParent(url) {
333    // 親ウィンドウの存在確認
334    if(fnIsopener()) {
335        window.opener.location.href = url;
336    } else {
337        window.close();
338    }
339}
340
341//特定のキーをSUBMITする.
342function fnKeySubmit(keyname, keyid) {
343    if(keyname != "" && keyid != "") {
344        document.form1[keyname].value = keyid;
345    }
346    document.form1.submit();
347}
348
349//文字数をカウントする。
350//引数1:フォーム名称
351//引数2:文字数カウント対象
352//引数3:カウント結果格納対象
353function fnCharCount(form,sch,cnt) {
354    document.forms[form][cnt].value= document.forms[form][sch].value.length;
355}
356
357
358// テキストエリアのサイズを変更する.
359function ChangeSize(buttonSelector, textAreaSelector, max, min) {
360
361    if ($(textAreaSelector).attr('rows') <= min) {
362        $(textAreaSelector).attr('rows', max);
363        $(buttonSelector).text('縮小');
364    } else {
365        $(textAreaSelector).attr('rows', min);
366        $(buttonSelector).text('拡大');
367    }
368}
Note: See TracBrowser for help on using the repository browser.