source: branches/version-2_13-dev/html/user_data/packages/admin/js/eccube.admin.legacy.js @ 23241

Revision 23241, 9.2 KB checked in by pineray, 11 years ago (diff)

#2365 eccube.admin.legacy.js をリファクタリング

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
23// 親ウィンドウをポストさせる。
24function fnSubmitParent() {
25    // 親ウィンドウの存在確認
26    if(eccube.isOpener()) {
27        window.opener.document.form1.submit();
28    } else {
29        window.close();
30    }
31}
32
33//指定されたidの削除を行うページを実行する。
34function fnDeleteMember(id, pageno) {
35    eccube.deleteMember(id, pageno);
36}
37
38// ラジオボタンチェック状態を保存
39var lstsave = "";
40
41// ラジオボタンのチェック状態を取得する。
42function fnGetRadioChecked() {
43    eccube.getRadioChecked();
44}
45
46// 管理者メンバーページの切替
47function fnMemberPage(pageno) {
48    eccube.moveMemberPage(pageno);
49}
50
51// ページナビで使用する
52function fnNaviSearchPage(pageno, mode) {
53    eccube.moveNaviPage(pageno, mode);
54}
55
56// ページナビで使用する(mode = search専用)
57function fnNaviSearchOnlyPage(pageno) {
58    eccube.moveSearchPage(pageno);
59}
60
61// ページナビで使用する(form2)
62function fnNaviSearchPage2(pageno) {
63    eccube.moveSecondSearchPage(pageno);
64}
65
66// 値を代入して指定ページにsubmit
67function fnSetvalAndSubmit( fname, key, val ) {
68    var values = {};
69    values[key] = val;
70    eccube.submitForm(values, fname);
71}
72
73// 項目に入った値をクリアする。
74function fnClearText(name) {
75    eccube.clearValue(name);
76}
77
78// カテゴリの追加
79function fnAddCat(cat_id) {
80    if(window.confirm('カテゴリを登録しても宜しいでしょうか')){
81        eccube.setValue("mode", "edit");
82        eccube.setValue("cat_id", cat_id);
83    }
84}
85
86// カテゴリの編集
87function fnEditCat(parent_id, cat_id) {
88    var values = {
89        mode: "pre_edit",
90        parent_id: parent_id,
91        edit_cat_id: cat_id
92    };
93    eccube.submitForm(values);
94}
95
96// 選択カテゴリのチェック
97function fnCheckCat(obj) {
98    val = obj[obj.selectedIndex].value;
99    if (val == ""){
100        alert ("親カテゴリは選択できません");
101        obj.selectedIndex = 0;
102    }
103}
104
105// 確認ページから登録ページへ戻る
106function fnReturnPage() {
107    eccube.setModeAndSubmit("return");
108}
109
110// 規格分類登録へ移動
111function fnClassCatPage(class_id) {
112    eccube.moveClassCatPage(class_id);
113}
114
115function fnListCheck(list) {
116    len = list.length;
117    for(cnt = 0; cnt < len; cnt++) {
118        document.form1[list[cnt]].checked = true;
119    }
120}
121
122function fnAllCheck(input, selector) {
123    eccube.checkAllBox(input, selector);
124}
125
126//指定されたidの削除を行うページを実行する。
127function fnDelete(url) {
128    eccube.moveDeleteUrl(url);
129}
130
131//配送料金を自動入力
132function fnSetDelivFee(max) {
133    eccube.setDelivFee(max);
134}
135
136// 在庫数制限判定
137function fnCheckStockLimit(icolor) {
138    eccube.checkStockLimit(icolor);
139}
140
141// Form指定のSubmit
142function fnFormSubmit(form) {
143    eccube.submitForm({}, form);
144}
145
146// 確認メッセージ
147function fnConfirm() {
148    return eccube.doConfirm();
149}
150
151//削除確認メッセージ
152function fnDeleteConfirm() {
153    if(window.confirm('削除しても宜しいでしょうか')){
154        return true;
155    }
156    return false;
157}
158
159//メルマガ形式変更確認メッセージ
160function fnmerumagaupdateConfirm() {
161    if(window.confirm("既に登録されているメールアドレスです。\nメルマガの種類が変更されます。宜しいですか?")){
162        return true;
163    }
164    return false;
165}
166
167// フォームに代入してからサブミットする。
168function fnInsertValAndSubmit( fm, ele, val, msg ){
169    eccube.insertValueAndSubmit(fm, ele, val, msg);
170}
171
172// 自分以外の要素を有効・無効にする
173function fnSetDisabled ( f_name, e_name, flag ) {
174    fm = document[f_name];
175
176    // 必須項目のチェック
177    for(cnt = 0; cnt < fm.elements.length; cnt++) {
178        if( fm[cnt].name != e_name && fm[cnt].name != 'subm' && fm[cnt].name != 'mode') {
179            fm[cnt].disabled = flag;
180            if ( flag == true ){
181                fm[cnt].style.backgroundColor = "#cccccc";
182            } else {
183                fm[cnt].style.backgroundColor = "#ffffff";
184            }
185        }
186    }
187}
188
189//リストボックス内の項目を移動する
190function fnMoveCat(sel1, sel2, mode_name) {
191    var fm = document.form1;
192    for(i = 0; i < fm[sel1].length; i++) {
193        if(fm[sel1].options[i].selected) {
194            if(fm[sel2].value != "") {
195                fm[sel2].value += "-" + fm[sel1].options[i].value;
196            } else {
197                fm[sel2].value = fm[sel1].options[i].value;
198            }
199        }
200    }
201    fm["mode"].value = mode_name;
202    fm.submit();
203}
204
205//リストボックス内の項目を削除する
206function fnDelListContents(sel1, sel2, mode_name) {
207    fm = document.form1;
208    for(j = 0; j < fm[sel1].length; j++) {
209        if(fm[sel1].options[i].selected) {
210            fm[sel2].value = fm[sel2].value.replace(fm[sel1].options[i].value, "");
211        }
212    }
213
214    fm["mode"].value = mode_name;
215    fm.submit();
216}
217
218// タグの表示非表示切り替え
219function fnDispChange(disp_id, inner_id, disp_flg){
220    disp_state = document.getElementById(disp_id).style.display;
221
222    if (disp_state == "") {
223        document.form1[disp_flg].value="none";
224        document.getElementById(disp_id).style.display="none";
225        document.getElementById(inner_id).innerHTML = '<FONT Color="#FFFF99"> << 表示 </FONT>';
226    }else{
227        document.form1[disp_flg].value="";
228        document.getElementById(disp_id).style.display="";
229        document.getElementById(inner_id).innerHTML = ' <FONT Color="#FFFF99"> >> 非表示 </FONT>';
230    }
231}
232
233//制限数判定
234function fnCheckLimit(elem1, elem2, icolor) {
235    eccube.checkLimit(elem1, elem2, icolor);
236}
237
238/**
239 * ファイル管理
240 */
241var tree = "";                      // 生成HTML格納
242var count = 0;                      // ループカウンタ
243var arrTreeStatus = [];             // ツリー状態保持
244var old_select_id = '';             // 前回選択していたファイル
245var selectFileHidden = "";          // 選択したファイルのhidden名
246var treeStatusHidden = "";          // ツリー状態保存用のhidden名
247var modeHidden = "";                // modeセットhidden名
248
249// ツリー表示
250function fnTreeView(view_id, arrTree, openFolder, selectHidden, treeHidden, mode) {
251    eccube.fileManager.viewFileTree(view_id, arrTree, openFolder, selectHidden, treeHidden, mode);
252}
253
254// Tree状態をhiddenにセット
255function setTreeStatus(name) {
256    eccube.fileManager.setTreeStatus(name);
257}
258
259// Tree状態を削除する(閉じる状態へ)
260function fnDelTreeStatus(path) {
261    eccube.fileManager.deleteTreeStatus(path);
262}
263// ツリー描画
264function fnDrow(id, tree) {
265    // ブラウザ取得
266    MyBR = fnGetMyBrowser();
267    // ブラウザ事に処理を切り分け
268    switch(myBR) {
269        // IE4の時の表示
270        case 'I4':
271            document.all(id).innerHTML = tree;
272            break;
273        // NN4の時の表示
274        case 'N4':
275            document.layers[id].document.open();
276            document.layers[id].document.write("<div>");
277            document.layers[id].document.write(tree);
278            document.layers[id].document.write("</div>");
279            document.layers[id].document.close();
280            break;
281        default:
282            document.getElementById(id).innerHTML=tree;
283            break;
284    }
285}
286
287// 階層ツリーメニュー表示・非表示処理
288function fnTreeMenu(tName, imgName, path) {
289    eccube.fileManager.toggleTreeMenu(tName, imgName, path);
290}
291
292// ファイルリストダブルクリック処理
293function fnDbClick(arrTree, path, is_dir, now_dir, is_parent) {
294    eccube.fileManager.doubleClick(arrTree, path, is_dir, now_dir, is_parent);
295}
296
297// フォルダオープン処理
298function fnFolderOpen(path) {
299    eccube.fileManager.openFolder(path);
300}
301
302// 閲覧ブラウザ取得
303function fnGetMyBrowser() {
304    myOP = window.opera;            // OP
305    myN6 = document.getElementById; // N6
306    myIE = document.all;            // IE
307    myN4 = document.layers;         // N4
308    if      (myOP) myBR="O6";       // OP6以上
309    else if (myIE) myBR="I4";       // IE4以上
310    else if (myN6) myBR="N6";       // NS6以上
311    else if (myN4) myBR="N4";       // NN4
312    else           myBR="";         // その他
313
314    return myBR;
315}
316
317// imgタグの画像変更
318function fnChgImg(fileName,imgName){
319    $("#" + imgName).attr("src", fileName);
320}
321
322// ファイル選択
323function fnSelectFile(id, val) {
324    eccube.fileManager.selectFile(id);
325}
Note: See TracBrowser for help on using the repository browser.