var _my_channal = null;
var get_channel_list_callback = null;
channal_list();
function group_list_init() {
if (typeof gGroupId == "undefined") {
my_group_list();
group_add_dlg_init("group_add_div");
$("#button_new_group").show();
} else {
group_list(gGroupId, gList);
team_add_dlg_init("sub_group_add_div");
$("#member_list_shell").css("visibility", "visible");
member_list(gGroupId);
//初始化用户选择对话框
user_select_dlg_init("user_select_div");
}
}
function channal_list() {
$.post("../channal/get.php", {}, function (data) {
try {
_my_channal = JSON.parse(data);
if (get_channel_list_callback) {
get_channel_list_callback();
}
} catch (e) {
console.error(e);
}
});
}
function channal_getById(id) {
for (const iterator of _my_channal) {
if (iterator.id == id) {
return iterator;
}
}
return false;
}
function my_group_list() {
$.get("../group/list.php", {}, function (data, status) {
if (status == "success") {
try {
let html = "";
let result = JSON.parse(data);
let key = 1;
if (result.length > 0) {
for (const iterator of result) {
html += '
';
html += "
" + key++ + "
";
html += "
" + iterator.group_name + "
";
html += "
";
switch (parseInt(iterator.power)) {
case 0:
html += gLocal.gui.owner;
break;
case 1:
html += gLocal.gui.manager;
break;
case 2:
html += gLocal.gui.member;
break;
default:
break;
}
html += "
";
if (iterator.creator == getCookie("userid")) {
html +=
"";
}
html += "
";
html += "
";
}
} else {
html += "尚未设置小组";
}
html += "
";
}
//共享文件列表
key = 1;
html += "
";
html += "
" + gLocal.gui.collaborate + "
";
if (result.file && result.file.length > 0) {
for (const iterator of result.file) {
html += '
';
html += "
" + key++ + "
";
html += "
" + iterator.title + "
";
html += "
";
switch (iterator.power) {
case 10:
html += gLocal.gui.read_only;
break;
case 20:
break;
case 30:
html += gLocal.gui.write;
break;
default:
break;
}
html += "