fleet-contractor/Site/Security/UserGroup.aspx
2023-05-30 17:34:56 +08:00

882 lines
37 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ Page Title="" Language="C#" MasterPageFile="~/Security/Security.master" AutoEventWireup="true" CodeFile="UserGroup.aspx.cs" Inherits="Security_UserGroup" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<link href="<%=Common.GenerateUrl("../fic/fic/css/tabcontrol.css") %>" rel="stylesheet" />
<style type="text/css">
.main_group {
table-layout: fixed;
}
.main_group td {
overflow: hidden;
text-overflow: ellipsis;
}
.group_table {
width: 100%;
border-collapse: collapse;
}
.group_table tr {
height: 24px;
line-height: 24px;
}
.group_table td {
padding: 0;
vertical-align: top;
}
td.label {
width: 160px;
}
.ctl_button {
font-family: 'CalciteWebCoreIcons';
display: block;
margin: 6px auto;
width: 60px;
height: 22px;
line-height: 21px;
padding: 0;
}
.group_table .main_table thead tr {
display: block;
}
.group_table .main_table tbody {
height: 280px;
display: block;
overflow-y: auto;
}
.group_table .main_table th {
width: 165px;
padding: 0;
}
.group_table .main_table td {
width: 170px;
}
.group_table .main_table td div {
width: 170px;
overflow: hidden;
text-overflow: ellipsis;
}
.div_module {
font-weight: 700;
}
.table_module {
line-height: 30px;
margin-left: 20px;
margin-bottom: 15px;
width: 860px !important;
table-layout: fixed;
}
.td_module {
width: 220px;
font-weight: bold;
}
.label { /*cover tab.css*/
display: table-cell;
}
</style>
<%--<script src="<%=GetFileUrlWithVersion("js/controls.js")%>" type="text/javascript"></script>--%>
<script src="<%=GetFileUrlWithVersion("../js/controls.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../js/modulelang.js")%>" type="text/javascript"></script>
<script type="text/javascript">
var groups;
var featuresloaded = false;
_network.groupquery = function (method, param, callback, error) {
_network.request("Security/UserGroup.aspx", -1, method, param, callback, error);
}
function userrequest(method, param, callback, error) {
_network.request("Security/AddUser.aspx", -1, method, param, callback, error || function (e) {
console.log(e);
showmaskbg(false, true);
showAlert(GetTextByKey('P_UG_PAGEERROR', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_UG_QUERY', 'Query'));
});
}
var uiid;
function OnAdd() {
$('#tab_header_info').click();
$('#tab_header_security').hide();
uiid = undefined;
$('#dialog_group_name').val('');
$('#dialog_group_description').val('');
$('#dialog_user_group .dialog-title span.title').text(GetTextByKey("P_UG_ADDGROUP", 'Add Group'));
showmaskbg(true);
$('#dialog_user_group')
.attr('act', 'add')
.css({
'top': (document.documentElement.clientHeight - $('#dialog_user_group').height()) / 3,
'left': (document.documentElement.clientWidth - $('#dialog_user_group').width()) / 2
})
.showDialog();
$('#dialog_group_name').focus();
$('#dialog_user_group .maskbg').css('display', '');
getGroupInfo();
}
function OnEdit() {
var u = grid_dt.source[grid_dt.selectedIndex].Values;
if (!u) {
uiid = undefined;
return;
}
$('#tab_header_info').click();
$('#tab_header_security').show();
uiid = u.ID;
showmaskbg(true);
$('#dialog_user_group')
.attr('act', !uiid ? 'edit' : 'add')
.css({
'top': ($('#content').height() - $('#dialog_user_group').height()) / 3,
'left': ($('#content').width() - $('#dialog_user_group').width()) / 2
})
.showDialog();
$('#dialog_group_name').focus();
$('#dialog_user_group .maskbg').css('display', '');
getGroupInfo();
}
function OnDblClick(e) {
OnEdit();
}
function OnDelete(u) {
if (!u) {
return;
}
showConfirm(GetTextByKey("P_UG_DOYOUWANTTODELETE", 'Do you want to delete {0} ?').replace('{0}', u.Name), GetTextByKey("P_UG_DELETEGROUP", 'Delete group'), function () {
_network.groupquery('DeleteGroup', u.ID, function (data) {
if (data && data.length > 0) {
if (data === "There are one or more users in this user group,so it cannot be deleted.")
data = GetTextByKey("P_UG_USERSINTHISUSERGROUP", "There are one or more users in this user group,so it cannot be deleted.");
showAlert(data, GetTextByKey("P_UG_FAILEDTODELETETHISGROUP", 'Failed to delete this group'));
} else {
OnRefresh();
}
}, function (err) {
showAlert(GetTextByKey("P_UG_FAILEDTODELETETHISGROUP", 'Failed to delete this group.'), GetTextByKey("P_UG_DELETEGROUP", 'Delete group'));
});
});
}
function OnRefresh() {
showloading(true);
_network.groupquery('GetGroups', '', function (data) {
showloading(false);
groups = data;
showGroupList(data);
}, function (err) {
showloading(false);
});
}
function showGroupList(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
var fr = { Values: r };
rows.push(fr);
}
grid_dt.setData(rows);
}
var grid_dt;
function InitGridData() {
grid_dt = new GridView('#grouplist');
grid_dt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'Name', caption: GetTextByKey("P_UG_USERGROUPNAME", "User Group Name"), valueIndex: 'Name', css: { 'width': 500, 'text-align': 'left' } },
{ name: 'Notes', caption: GetTextByKey("P_UG_DESCRIPTION", "Description"), valueIndex: 'Notes', css: { 'width': 500, 'text-align': 'left' } },
{ name: 'Edit', caption: "", css: { 'width': 30, 'text-align': 'center' } },
{ name: 'Delete', caption: "", css: { 'width': 30, 'text-align': 'center' } }
];
var columns = [];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = true;
col.sortable = true;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
if (col.name === "Edit") {
col.isurl = true;
col.text = "\uf044";
col.events = {
onclick: function () {
OnEdit();
}
};
col.classFilter = function (e) {
return "icon-col";
}
col.attrs = { 'title': GetTextByKey("P_UG_EDIT", 'Edit') };
}
else if (col.name === "Delete") {
col.isurl = true;
col.text = "\uf00d";
col.events = {
onclick: function () {
OnDelete(this);
}
};
col.classFilter = function (e) {
return "icon-col";
};
col.attrs = { 'title': GetTextByKey("P_UG_DELETE", 'Delete') };
}
columns.push(col);
}
grid_dt.canMultiSelect = false;
grid_dt.columns = columns;
grid_dt.init();
grid_dt.rowdblclick = OnEdit;
grid_dt.selectedrowchanged = function (rowindex) {
var rowdata = grid_dt.source[rowindex];
if (rowdata) {
uiid = rowdata.Values.ID;
}
}
}
/************************** User********************************/
/*************************************************************************/
var allMachines;
function getGroupInfo() {
_network.groupquery('GetGroupInfo', uiid, function (data) {
var grp = data.GroupInfo;
allMachines = data.Users;
showSelectedMachine(!grp.Users ? [] : grp.Users);
getMatchAvailableMachines();
$('#dialog_group_name').val(grp.Name);
$('#dialog_group_description').val(grp.Notes);
$('#dialog_user_group .dialog-title span.title').text(GetTextByKey("P_UG_EDITGROUP", 'Edit Group'));
$('#dialog_user_group .maskbg').css('display', 'none');
$('#dialog_group_name').focus();
}, function (err) {
showAlert(GetTextByKey("P_UG_FAILEDTOLOADUSERS", 'Failed to load users.'), GetTextByKey("P_UG_LOADUSERS", 'Load users'));
});
}
function getMatchAvailableMachines() {
var selected = [];
for (var i = 0; i < grid_dtsm.source.length; i++) {
var m = grid_dtsm.source[i].Values;
selected.push(m.IID);
}
_availableMachines = [];
for (var i = 0; i < allMachines.length; i++) {
var m = allMachines[i];
if ($.inArray(m.IID, selected) < 0) {
_availableMachines.push(m);
}
}
showAvailableMachine(_availableMachines);
}
function showAvailableMachine(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
var fr = { Values: r };
rows.push(fr);
}
grid_dtam.setData(rows);
}
function showSelectedMachine(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
var fr = { Values: r };
rows.push(fr);
}
grid_dtsm.setData(rows);
}
var grid_dtam;
function InitGridAvailableMachines() {
grid_dtam = new GridView('#availablemachinelist');
grid_dtam.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'ID', caption: GetTextByKey("P_UG_USERID", "User ID"), valueIndex: 'ID', css: { 'width': 170, 'text-align': 'left' } },
{ name: 'DisplayName', caption: GetTextByKey("P_UG_USERNAME", "User Name"), valueIndex: 'DisplayName', css: { 'width': 160, 'text-align': 'left' } }
];
var columns = [];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = true;
col.sortable = true;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
columns.push(col);
}
grid_dtam.canMultiSelect = true;
grid_dtam.columns = columns;
grid_dtam.init();
grid_dtam.rowdblclick = function (rowindex) {
var rowdata = grid_dtam.source[rowindex];
if (rowdata) {
grid_dtam.source.splice(rowindex, 1);
grid_dtam.setData(grid_dtam.source);
grid_dtsm.source.push(rowdata);
grid_dtsm.setData(grid_dtsm.source);
}
};
grid_dtam.selectedrowchanged = function (rowindex) {
var rowdata = grid_dtam.source[rowindex];
if (rowdata) {
}
}
}
var grid_dtsm;
function InitGridSelectedMachines() {
grid_dtsm = new GridView('#selectedmachinelist');
var list_columns = [
{ name: 'ID', caption: GetTextByKey("P_UG_USERID", "User ID"), valueIndex: 'ID', css: { 'width': 170, 'text-align': 'left' } },
{ name: 'DisplayName', caption: GetTextByKey("P_UG_USERNAME", "User Name"), valueIndex: 'DisplayName', css: { 'width': 160, 'text-align': 'left' } }
];
var columns = [];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = true;
col.sortable = true;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
columns.push(col);
}
grid_dtsm.canMultiSelect = true;
grid_dtsm.columns = columns;
grid_dtsm.init();
grid_dtsm.rowdblclick = function (rowindex) {
var rowdata = grid_dtsm.source[rowindex];
if (rowdata) {
grid_dtsm.source.splice(rowindex, 1);
grid_dtsm.setData(grid_dtsm.source);
grid_dtam.source.push(rowdata);
grid_dtam.setData(grid_dtam.source);
}
};
grid_dtsm.selectedrowchanged = function (rowindex) {
var rowdata = grid_dtsm.source[rowindex];
if (rowdata) {
}
}
}
function OnEditorAdd() {
var indexs = grid_dtam.selectedIndexes;
if (indexs.length <= 0)
return;
var rowstemp = [];
for (var i = 0; i < indexs.length; i++) {
var rowindex = indexs[i];
var rowdata = grid_dtam.source[rowindex];
rowstemp.push(rowdata);
}
var index = grid_dtsm.source.length;
for (var i = 0; i < rowstemp.length; i++) {
var rowdata = rowstemp[i];
grid_dtam.source.splice(grid_dtam.source.indexOf(rowdata), 1);
grid_dtsm.source.splice(index, 0, rowdata);
index++;
}
grid_dtam.setData(grid_dtam.source);
grid_dtsm.setData(grid_dtsm.source);
}
function OnEditorAddAll() {
for (var i = 0; i < grid_dtam.source.length; i++) {
var rowindex = grid_dtam.source[i];
var rowdata = grid_dtam.source[i];
grid_dtsm.source.push(rowdata);
}
grid_dtsm.setData(grid_dtsm.source);
grid_dtam.source = [];
grid_dtam.setData(grid_dtam.source);
}
function OnEditorRemove() {
var indexs = grid_dtsm.selectedIndexes;
if (indexs.length <= 0)
return;
var rowstemp = [];
for (var i = 0; i < indexs.length; i++) {
var rowindex = indexs[i];
var rowdata = grid_dtsm.source[rowindex];
rowstemp.push(rowdata);
}
var index = grid_dtam.source.length;
for (var i = 0; i < rowstemp.length; i++) {
var rowdata = rowstemp[i];
grid_dtsm.source.splice(grid_dtsm.source.indexOf(rowdata), 1);
grid_dtam.source.splice(index, 0, rowdata);
index++;
}
grid_dtsm.setData(grid_dtsm.source);
grid_dtam.setData(grid_dtam.source);
}
function OnEditorRemoveAll() {
for (var i = 0; i < grid_dtsm.source.length; i++) {
var rowindex = grid_dtsm.source[i];
var rowdata = grid_dtsm.source[i];
grid_dtam.source.push(rowdata);
}
grid_dtam.setData(grid_dtam.source);
grid_dtsm.source = [];
grid_dtsm.setData(grid_dtsm.source);
}
/**************************End User********************************/
/*****************************************************************************/
function OnDialogOK() {
var item = {
'Name': $('#dialog_group_name').val(),
'Notes': $('#dialog_group_description').val()
};
if (uiid) {
item.ID = uiid;
}
var alerttitle = GetTextByKey("P_UG_SAVEGROUP", 'Save group');
if (!item.Name || item.Name.trim().length == 0) {
showAlert(GetTextByKey("P_UG_GROUPNAMECANNOTBEEMPTYORWHITESPACE", 'Group Name cannot be empty or whitespace.'), alerttitle);
$('#dialog_group_name').focus();
return;
}
if (item.Name.length > 100) {
showAlert(GetTextByKey("P_UG_GROUPNAMEISTOOLONG", 'Group Name is too long (> 100 characters).'), alerttitle);
$('#dialog_group_name').focus();
return;
}
if (item.Notes.length > 200) {
showAlert(GetTextByKey("P_UG_NOTESISTOOLONG", 'Notes is too long (> 200 characters).'), alerttitle);
$('#dialog_group_description').focus();
return;
}
item.Users = [];
for (var i = 0; i < grid_dtsm.source.length; i++) {
var m = grid_dtsm.source[i].Values;
var iid = m.IID;
item.Users.push({
'IID': iid
});
}
var features = [];
if (uiid && featuresloaded) {
var ipts = $('#security_message').find('input[type=radio]:checked');
for (var i = 0; i < ipts.length; i++) {
var ipt = ipts[i];
var id = $(ipt).data('featureid');
var pm = $(ipt).val();
if (!pm)
continue;
var permissions = [];
permissions.push(pm)
var ftitem = { 'Key': id, 'Value': permissions };
features.push(ftitem);
}
}
$('#dialog_user_group .maskbg').css('display', '');
var param = JSON.stringify({
'GroupInfo': item,
'Features': features
});
param = htmlencode(param);
_network.groupquery('SaveGroup', param, function (data) {
//alert('Save user info successfully.');
if (data && data.length > 0) {
showAlert(data, alerttitle);
$('#dialog_user_group .maskbg').css('display', 'none');
} else {
$('#dialog_user_group').hideDialog();
OnRefresh();
}
}, function (err) {
showAlert(GetTextByKey("P_UG_FAILEDTOSAVEGROUP", 'Failed to save group.'), alerttitle);
$('#dialog_user_group .maskbg').css('display', 'none');
});
}
/************************** Security********************************/
/*************************************************************************/
var featuresloaded = false;
function onsecurityclick() {
if (!featuresloaded) {
featuresloaded = true;;
}
$(".featureradio").prop("checked", false);
GetFeaturesDefinedOnUser()
}
function GetFeaturesDefinedOnUser() {
userrequest('GetFeaturesDefinedOnUser', uiid, function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_UG_ERROR", 'Error'));
return;
}
getFeaturesDefinedLang(data);
createFeatureModule(data);
}, function (err) {
console.log(err);
});
}
function getFeaturesDefinedLang(data) {
for (var i = 0; i < data.length; i++) {
var m = data[i].Module;
var f = data[i].Features;
setMoudulesLang(m);
setFeaturesLang(f);
}
}
function setFeaturesLang(features) {
for (var i = 0; i < features.length; i++) {
var f = features[i].Item1;
if (f.Id === 1)
f.CurrentName = GetTextByKey("P_FEATURE_MAPVIEW", f.Name);
else if (f.Id === 100)
f.CurrentName = GetTextByKey("P_FEATURE_JOBSITES", f.Name);
else if (f.Id === 110)
f.CurrentName = GetTextByKey("P_FEATURE_AUTOCREATIONCONFIG", f.Name);
else if (f.Id === 120)
f.CurrentName = GetTextByKey("P_FEATURE_JOBSITEREQUIREMENTS", f.Name);
else if (f.Id === 130)
f.CurrentName = GetTextByKey("P_FEATURE_DISPATCHREQUESTS", f.Name);
else if (f.Id === 140)
f.CurrentName = GetTextByKey("P_FEATURE_SCHEDULER", f.Name);
else if (f.Id === 200)
f.CurrentName = GetTextByKey("P_FEATURE_ALERTSMANAGEMENT", f.Name);
else if (f.Id === 210)
f.CurrentName = GetTextByKey("P_FEATURE_WORKORDER", f.Name);
else if (f.Id === 220)
f.CurrentName = GetTextByKey("P_FEATURE_PREVENTATIVEMAINTENANCEPLAN", f.Name);
else if (f.Id === 230)
f.CurrentName = GetTextByKey("P_FEATURE_FUELRECORDS", f.Name);
else if (f.Id === 235)
f.CurrentName = GetTextByKey("P_FEATURE_CUSTOMERRECORD", f.Name);
else if (f.Id === 237)
f.CurrentName = GetTextByKey("P_FEATURE_WORKORDERCONFIGURATION", f.Name);
else if (f.Id === 239)
f.CurrentName = GetTextByKey("P_FEATURE_REOPENWORKORDERS", f.Name);
else if (f.Id === 245)
f.CurrentName = GetTextByKey("P_FEATURE_COMMUNICATEWITHCUSTOMER", f.Name);
else if (f.Id === 248)
f.CurrentName = GetTextByKey("P_FEATURE_WORKORDERSURVEYS", f.Name);
else if (f.Id === 249)
f.CurrentName = GetTextByKey("P_FEATURE_WORKORDERGENERATOR", f.Name);
else if (f.Id === 250)
f.CurrentName = GetTextByKey("P_FEATURE_XXXXXX", f.Name);
else if (f.Id === 252)
f.CurrentName = GetTextByKey("P_FEATURE_XXXXXX", f.Name);
else if (f.Id === 300)
f.CurrentName = GetTextByKey("P_FEATURE_FILTERQ", f.Name);
else if (f.Id === 400)
f.CurrentName = GetTextByKey("P_FEATURE_CREDENTIALS", f.Name);
else if (f.Id === 401)
f.CurrentName = GetTextByKey("P_FEATURE_JDLINK", f.Name);
else if (f.Id === 402)
f.CurrentName = GetTextByKey("P_FEATURE_JOHNDEERENOTIFICATIONS", f.Name);
else if (f.Id === 500)
f.CurrentName = GetTextByKey("P_FEATURE_USERS", f.Name);
else if (f.Id === 510)
f.CurrentName = GetTextByKey("P_FEATURE_CURFEWCONFIGURATION", f.Name);
else if (f.Id === 600)
f.CurrentName = GetTextByKey("P_FEATURE_MANAGEASSETS", f.Name);
else if (f.Id === 601)
f.CurrentName = GetTextByKey("P_FEATURE_ASSETPAIRING", f.Name);
else if (f.Id === 602)
f.CurrentName = GetTextByKey("P_FEATURE_ASSETATTRIBUTEADJUSTMENTS", f.Name);
else if (f.Id === 603)
f.CurrentName = GetTextByKey("P_FEATURE_ASSETGROUPS", f.Name);
else if (f.Id === 700)
f.CurrentName = GetTextByKey("P_FEATURE_FICMANAGEMENT", f.Name);
else if (f.Id === 800)
f.CurrentName = GetTextByKey("P_FEATURE_M3", f.Name);
else if (f.Id === 900)
f.CurrentName = GetTextByKey("P_FEATURE_OVERUNDERTRUCKINGALERTS", f.Name);
else if (f.Id === 1000)
f.CurrentName = GetTextByKey("P_FEATURE_MANAGEHARSHDRIVING", f.Name);
else if (f.Id === 1000)
f.CurrentName = GetTextByKey("P_FEATURE_MANAGEHARSHDRIVING", f.Name);
else if (f.Id === 1100)
f.CurrentName = GetTextByKey("P_FEATURE_MANAGETEMPLATES", f.Name);
else if (f.Id === 1101)
f.CurrentName = GetTextByKey("P_FEATURE_INSPECTIONREPORTS", f.Name);
else if (f.Id === 1110)
f.CurrentName = GetTextByKey("P_FEATURE_REASSIGNWORKORDERS", f.Name);
else if (f.Id === 1200)
f.CurrentName = GetTextByKey("P_FEATURE_MANAGETEMPLATES", f.Name);
else if (f.Id === 1201)
f.CurrentName = GetTextByKey("P_FEATURE_INSPECTIONREPORTS", f.Name);
else
f.CurrentName = f.Name;
}
}
function createFeatureModule(data) {
$('#security_message').empty();
if (!data)
return;
for (var i = 0; i < data.length; i++) {
var ft = data[i];
var div = $('<div class="div_module"></div>').text(ft.Module.CurrentName);
$('#security_message').append(div);
createFeatures(ft.Features);
}
WOFeaturesChange();
}
function createFeatures(features) {
var nonetext = GetTextByKey("P_UM_NONE", "None");
var readonlytext = GetTextByKey("P_UM_READONLY", "Read Only");
var fullcontroltext = GetTextByKey("P_UM_FULLCONTROL", "Full Control");
var requestonlytext = GetTextByKey("P_UM_REQUESTONLY", "Request Only");
var mywotext = GetTextByKey("P_UM_XXX", "My Work Orders");
var locdeptext = GetTextByKey("P_UM_XXX", "My Location Or Department");
var tb = $('<table class="table_module" ></table>');
$('#security_message').append(tb);
for (var i = 0; i < features.length; i++) {
var feature = features[i].Item1;
var tr = $('<tr></tr>');
tb.append(tr);
var td = $('<td class="td_module"></td>').text(feature.CurrentName);
if ([239, 252, 253, 254, 255, 256, 257].indexOf(feature.Id) >= 0)
td.css('padding-left', 30);
tr.append(td);
for (var j = 0; j < feature.AvailablePermissions.length; j++) {
var pm = feature.AvailablePermissions[j];
td = $('<td style="text-align:right;"></td>');
td.css('width', (j == 1 || j == 2) ? 170 : 130);
tr.append(td);
var name = "";
if (pm === 0)
name = nonetext;
else if (pm === 1)
name = readonlytext;
else if (pm === 2)
name = mywotext;
else if (pm === 10)
name = requestonlytext;
else if (pm === 11) {
name = locdeptext;
td.css('width', 170);
}
else if (pm === 99999)
name = fullcontroltext;
var lab = $('<label></label>').text(name);
td.append(lab);
var ipt = $('<input type="radio" class="featureradio" />').attr('name', 'feature_' + feature.Id).val(pm).data('featureid', feature.Id);
ipt.change(function () {
WOFeaturesChange();
});
td.append(ipt);
}
for (var k = feature.AvailablePermissions.length; k < 4; k++) {//目前最多4列不足4列的补齐4列
td = $('<td></td>');
td.css('width', (k == 1 || k == 2) ? 170 : 130);
tr.append(td);
}
$("input:radio[name='feature_" + feature.Id + "'][value='" + features[i].Item2[0] + "']").prop("checked", true);
td = $('<td></td>');
tr.append(td);
}
}
function WOFeaturesChange() {
var wopermission = $("input:radio[name='feature_210']:checked").val();
wopermission = parseInt(wopermission);
if (wopermission === 0) {
$("input:radio[name='feature_253']").prop("disabled", true);
$("input:radio[name='feature_254']").prop("disabled", true);
$("input:radio[name='feature_252']").prop("disabled", true);
$("input:radio[name='feature_255']").prop("disabled", true);
$("input:radio[name='feature_256']").prop("disabled", true);
$("input:radio[name='feature_239']").prop("disabled", true);
}
else if (wopermission === 1) {
$("input:radio[name='feature_253']").prop("disabled", false);
$("input:radio[name='feature_254']").prop("disabled", false);
$("input:radio[name='feature_252']").prop("disabled", true);
$("input:radio[name='feature_255']").prop("disabled", true);
$("input:radio[name='feature_256']").prop("disabled", true);
$("input:radio[name='feature_239']").prop("disabled", true);
}
else if (wopermission === 99999) {
$("input:radio[name='feature_253']").prop("disabled", false);
$("input:radio[name='feature_254']").prop("disabled", false);
$("input:radio[name='feature_252']").prop("disabled", false);
$("input:radio[name='feature_255']").prop("disabled", false);
$("input:radio[name='feature_256']").prop("disabled", false);
$("input:radio[name='feature_239']").prop("disabled", false);
}
}
/**************************End Security********************************/
/*****************************************************************************/
$(function () {
setPageTitle(GetTextByKey("P_USERSGROUPS", 'User Groups'), true);
InitGridData();
InitGridAvailableMachines();
InitGridSelectedMachines();
$("#div_container").tab();
$('#dialog_user_group').prop('iframe', true).dialog(function () {
showmaskbg(false);
});
OnRefresh();
$(window).resize(function () {
$("#grouplist").css("height", $(window).height() - $("#grouplist").offset().top - 4);
grid_dt && grid_dt.resize();
}).resize();
})
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div style="min-width: 400px;">
<div class="page_title" data-lgid="P_USERSGROUPS">User Groups</div>
<div class="function_title">
<span class="sbutton iconadd" onclick="OnAdd();" data-lgid="P_UG_ADD">Add</span>
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_UG_REFRESH">Refresh</span>
</div>
<div class="clear"></div>
<div id="grouplist"></div>
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
<div class="dialog" id="dialog_user_group" style="display: none; width: 950px;">
<div class="dialog-title"><span class="title" data-lgid="P_UG_ADDUSERGROUP">Add User Group</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<div id="div_container">
<ul id="ul_container" class="tab_header" style="padding-top: 5px;">
<li id="tab_header_info" data-href="tab_groupinfo" class="selected" data-lgid="P_UG_GROUPINFORMATION">Group Information</li>
<li id="tab_header_security" data-href="tab_security" onclick="onsecurityclick()" data-lgid="P_UG_SECURITY">Security</li>
</ul>
<div id="tab_groupinfo" data-page="tab_groupinfo">
<div class="dialog-subheader" data-lgid="P_UG_USERGROUPPROPERTIES">User Group Properties</div>
<table class="group_table">
<tr style="height: 27px;">
<td class="label" data-lgid="P_UG_USERGROUPNAME_COLON">User Group Name:</td>
<td>
<input type="text" id="dialog_group_name" style="padding: 2px; width:320px;" tabindex="1" maxlength="100" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_UG_DESCRIPTION_COLON">Description:</td>
<td>
<textarea id="dialog_group_description" style="padding: 2px; height: 60px; width:320px;" tabindex="2" maxlength="200"></textarea></td>
</tr>
</table>
<div class="dialog-subheader" data-lgid="P_UG_GROUPMEMBERS">Group Members</div>
<table class="group_table" style="min-height: 300px;">
<thead>
<tr>
<td data-lgid="P_UG_AVAILABLEUSERS">Available Users</td>
<td></td>
<td data-lgid="P_UG_ASSIGNEDGROUPMEMBERS">Assigned Group Members</td>
</tr>
</thead>
<tbody>
<tr>
<td style="width: 400px;">
<div id="availablemachinelist" style="height: 300px;"></div>
</td>
<td style="text-align: center; vertical-align: middle; width: 80px;">
<input class="ctl_button" type="button" value="&#xe62b;" tabindex="3" onclick="OnEditorAdd();" />
<input class="ctl_button" type="button" value="&#xe632;" tabindex="4" onclick="OnEditorAddAll();" />
<input class="ctl_button" type="button" value="&#xe62a;" tabindex="5" onclick="OnEditorRemove();" />
<input class="ctl_button" type="button" value="&#xe631;" tabindex="6" onclick="OnEditorRemoveAll();" />
</td>
<td style="width: 400px;">
<div id="selectedmachinelist" style="height: 300px;"></div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="tab_security" data-page="tab_security" style="display: none">
<div id="security_message" style="padding-left: 20px; height: 440px; overflow: auto;">
</div>
</div>
<div class="mask_loading dialog" style="display: none;"></div>
</div>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_UG_CANCEL" class="dialog-close" tabindex="8" />
<input type="button" onclick="OnDialogOK();" value="OK" data-lgid="P_UG_OK" tabindex="7" />
<div class="clear"></div>
</div>
<div class="maskbg" style="display: none;"></div>
</div>
</div>
</asp:Content>