/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
*
* http://www.lockon.co.jp/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
var IMG_FOLDER_CLOSE = "../../user_data/packages/default/img/admin/contents/folder_close.gif"; // フォルダクローズ時画像
var IMG_FOLDER_OPEN = "../../user_data/packages/default/img/admin/contents/folder_open.gif"; // フォルダオープン時画像
var IMG_PLUS = "../../user_data/packages/default/img/admin/contents/plus.gif"; // プラスライン
var IMG_MINUS = "../../user_data/packages/default/img/admin/contents/minus.gif"; // マイナスライン
var IMG_NORMAL = "../../user_data/packages/default/img/admin/contents/space.gif"; // スペース
var tree = ""; // 生成HTML格納
var count = 0; // ループカウンタ
var arrTreeStatus = new Array(); // ツリー状態保持
var old_select_id = ''; // 前回選択していたファイル
var selectFileHidden = ""; // 選択したファイルのhidden名
var treeStatusHidden = ""; // ツリー状態保存用のhidden名
var modeHidden = ""; // modeセットhidden名
// ツリー表示
function fnTreeView(view_id, arrTree, openFolder, selectHidden, treeHidden, mode) {
selectFileHidden = selectHidden;
treeStatusHidden = treeHidden;
modeHidden = mode;
for(i = 0; i < arrTree.length; i++) {
id = arrTree[i][0];
level = arrTree[i][3];
if(i == 0) {
old_id = "0";
old_level = 0;
} else {
old_id = arrTree[i-1][0];
old_level = arrTree[i-1][3];
}
// 階層上へ戻る
if(level <= (old_level - 1)) {
tmp_level = old_level - level;
for(up_roop = 0; up_roop <= tmp_level; up_roop++) {
tree += '';
}
}
// 同一階層で次のフォルダへ
if(id != old_id && level == old_level) tree += '';
// 階層の分だけスペースを入れる
for(space_cnt = 0; space_cnt < arrTree[i][3]; space_cnt++) {
tree += " ";
}
// 階層画像の表示・非表示処理
if(arrTree[i][4]) {
if(arrTree[i][1] == '_parent') {
rank_img = IMG_MINUS;
} else {
rank_img = IMG_NORMAL;
}
// 開き状態を保持
arrTreeStatus.push(arrTree[i][2]);
display = 'block';
} else {
if(arrTree[i][1] == '_parent') {
rank_img = IMG_PLUS;
} else {
rank_img = IMG_NORMAL;
}
display = 'none';
}
arrFileSplit = arrTree[i][2].split("/");
file_name = arrFileSplit[arrFileSplit.length-1];
// フォルダの画像を選択
if(arrTree[i][2] == openFolder) {
folder_img = IMG_FOLDER_OPEN;
file_name = "" + file_name + "";
} else {
folder_img = IMG_FOLDER_CLOSE;
}
// 階層画像に子供がいたらオンクリック処理をつける
if(rank_img != IMG_NORMAL) {
tree += '';
} else {
tree += '';
}
tree += ' '+ file_name +'
';
tree += '