add site
370
Site/Security/AddCurfew.aspx
Normal file
@ -0,0 +1,370 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Security/Security.master" AutoEventWireup="true" CodeFile="AddCurfew.aspx.cs" Inherits="AddCurfew" %>
|
||||
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
|
||||
<style type="text/css">
|
||||
::-ms-clear, ::-ms-reveal {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.edit-content table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.edit-content table td.label {
|
||||
width: 200px;
|
||||
text-align: right;
|
||||
padding-right: 10px;
|
||||
line-height: unset;
|
||||
height: unset;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.edit-content table td input,
|
||||
.edit-content table td textarea {
|
||||
border: 1px solid #a9a9a9;
|
||||
width: 320px;
|
||||
height: 18px;
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
.edit-content table td input[type="checkbox"] {
|
||||
border: none;
|
||||
height: 13px;
|
||||
}
|
||||
|
||||
.edit-content table td textarea {
|
||||
height: 100px;
|
||||
resize: none;
|
||||
/*max-width: 200px;*/
|
||||
}
|
||||
|
||||
.a {
|
||||
text-decoration: none;
|
||||
color: #2140fb;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
margin: 20px 40px 5px 0px;
|
||||
font-size: 16px;
|
||||
color: gray;
|
||||
}
|
||||
|
||||
.subtitle span {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.subtitle hr {
|
||||
background-color: #d8d8d8;
|
||||
border: none;
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
|
||||
.machinetd {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.timespan {
|
||||
margin-left: 26px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="<%=GetFileUrlWithVersion("js/controls.js")%>" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
var IsDealer = <%=IsDealer ?"true":"false"%>;
|
||||
var contractorid;
|
||||
|
||||
curfewquery = function (method, param, callback, error, nolog) {
|
||||
_network.request("Security/AddCurfew.aspx", -1, method, param, callback, error || function (e) {
|
||||
showAlert('Failed to load data: ' + e.statusText, GetTextByKey("P_CM_SCHEDULEASSETS", 'Schedule Assets'));
|
||||
});
|
||||
}
|
||||
|
||||
function setDays(days) {
|
||||
$("#tdDays input").prop("checked", false);
|
||||
if (days.indexOf(daysArray[0]) >= 0)
|
||||
$("#chkSu").prop("checked", true);
|
||||
if (days.indexOf(daysArray[1]) >= 0)
|
||||
$("#chkMo").prop("checked", true);
|
||||
if (days.indexOf(daysArray[2]) >= 0)
|
||||
$("#chkTu").prop("checked", true);
|
||||
if (days.indexOf(daysArray[3]) >= 0)
|
||||
$("#chkWe").prop("checked", true);
|
||||
if (days.indexOf(daysArray[4]) >= 0)
|
||||
$("#chkTh").prop("checked", true);
|
||||
if (days.indexOf(daysArray[5]) >= 0)
|
||||
$("#chkFr").prop("checked", true);
|
||||
if (days.indexOf(daysArray[6]) >= 0)
|
||||
$("#chkSa").prop("checked", true);
|
||||
}
|
||||
|
||||
var daysArray = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
||||
function getDays() {
|
||||
var days = "";
|
||||
if ($("#chkSu").prop("checked"))
|
||||
days += daysArray[0] + ",";
|
||||
if ($("#chkMo").prop("checked"))
|
||||
days += daysArray[1] + ",";
|
||||
if ($("#chkTu").prop("checked"))
|
||||
days += daysArray[2] + ",";
|
||||
if ($("#chkWe").prop("checked"))
|
||||
days += daysArray[3] + ",";
|
||||
if ($("#chkTh").prop("checked"))
|
||||
days += daysArray[4] + ",";
|
||||
if ($("#chkFr").prop("checked"))
|
||||
days += daysArray[5] + ",";
|
||||
if ($("#chkSa").prop("checked"))
|
||||
days += daysArray[6] + ",";
|
||||
|
||||
if (days.length > 0)
|
||||
days = days.substr(0, days.length - 1);
|
||||
return days;
|
||||
}
|
||||
|
||||
function initControl(index) {
|
||||
var c = $('#starttimehour_' + index);
|
||||
for (var i = 0; i < 24; i++) {
|
||||
if (i < 10)
|
||||
c.append($("<option></option>").val("0" + i).text("0" + i))
|
||||
else
|
||||
c.append($("<option></option>").val(i).text(i))
|
||||
}
|
||||
c = $('#starttimeminute_' + index);
|
||||
for (var i = 0; i < 60; i++) {
|
||||
if (i < 10)
|
||||
c.append($("<option></option>").val("0" + i).text("0" + i))
|
||||
else
|
||||
c.append($("<option></option>").val(i).text(i))
|
||||
}
|
||||
c = $('#endtimehour_' + index);
|
||||
for (var i = 0; i < 24; i++) {
|
||||
if (i < 10)
|
||||
c.append($("<option></option>").val("0" + i).text("0" + i))
|
||||
else
|
||||
c.append($("<option></option>").val(i).text(i))
|
||||
}
|
||||
c = $('#endtimeminute_' + index);
|
||||
for (var i = 0; i < 60; i++) {
|
||||
if (i < 10)
|
||||
c.append($("<option></option>").val("0" + i).text("0" + i))
|
||||
else
|
||||
c.append($("<option></option>").val(i).text(i))
|
||||
}
|
||||
|
||||
}
|
||||
var timeindex = 0;
|
||||
function AddTimePeriod(type, time) {
|
||||
timeindex++;
|
||||
var tr_add = $('#tr_addtimepreiod');
|
||||
var tr = $('<tr id="trtime_' + timeindex + '" class="trtimeperiod"></tr>');
|
||||
var td1 = $('<td class="label">' + GetTextByKey("P_CM_STARTTIME_COLON", "Start Time:") + '</td>"');
|
||||
var td2 = $('<td></td>');
|
||||
var s_sel = $('<select id="starttimehour_' + timeindex + '" style="width: 48px;"></select><span style="font-weight: bold;"> : </span><select id="starttimeminute_' + timeindex + '" style="width: 48px;"></select>')
|
||||
var e_sel = $('<span class="timespan">' + GetTextByKey("P_CM_ENDTIME_COLON", "End Time:") + '</span><select id="endtimehour_' + timeindex + '" style="width: 48px;"></select><span style="font-weight: bold;"> : </span><select id="endtimeminute_' + timeindex + '" style="width: 48px;"></select>');
|
||||
var s_del = $('<span class="sbutton icondelete" onclick="DeleteTimePeriod(' + timeindex + ');"></span>');
|
||||
td2.append(s_sel).append(e_sel).append(s_del);
|
||||
tr.append(td1).append(td2);
|
||||
tr_add.before(tr);
|
||||
initControl(timeindex);
|
||||
if (type == 1) {
|
||||
$('#starttimehour_' + timeindex).val(time.BeginHours);
|
||||
$('#starttimeminute_' + timeindex).val(time.BeginMinutes);
|
||||
$('#endtimehour_' + timeindex).val(time.EndHours);
|
||||
$('#endtimeminute_' + timeindex).val(time.EndMinutes);
|
||||
}
|
||||
}
|
||||
|
||||
function DeleteTimePeriod(index) {
|
||||
var trs = $('.trtimeperiod');
|
||||
if (trs && trs.length == 1) {
|
||||
showAlert(GetTextByKey("P_CM_PERIODCANNOTBEEMPTY", "Period cannot be empty."), GetTextByKey("P_CM_DELETEPERIOD", 'Delete Period'));
|
||||
return;
|
||||
}
|
||||
$('#trtime_' + index).remove();
|
||||
}
|
||||
|
||||
function OnAdd() {
|
||||
$('#dialog_title').val('');
|
||||
$("#tdDays input").prop("checked", false);
|
||||
$('#dialog_starttimehour').val('00');
|
||||
$('#dialog_starttimeminute').val('00');
|
||||
$('#dialog_endtimehour').val('00');
|
||||
$('#dialog_endtimeminute').val('00');
|
||||
$('#dialog_urlkey').focus();
|
||||
$('.trtimeperiod').remove();
|
||||
AddTimePeriod(2);
|
||||
}
|
||||
|
||||
var curfewid;
|
||||
function getCurfewInfo() {
|
||||
curfewquery("GetCurfewInfo", contractorid + String.fromCharCode(170) + curfewid, function (data) {
|
||||
if (typeof (data) === "string") {
|
||||
showAlert(data, GetTextByKey("P_CM_ERROR", 'Error'));
|
||||
return;
|
||||
}
|
||||
var curfew = data;
|
||||
$('#dialog_title').val(curfew.Title);
|
||||
setDays(curfew.Day);
|
||||
|
||||
var times = curfew.TimePeriods;
|
||||
if (times) {
|
||||
$('.trtimeperiod').remove();
|
||||
for (var i = 0; i < times.length; i++) {
|
||||
AddTimePeriod(1, times[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}, function (err) {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function OnEdit() {
|
||||
getCurfewInfo();
|
||||
}
|
||||
|
||||
function OnSave(exit) {
|
||||
var item = {
|
||||
'Title': $('#dialog_title').val().trim(),
|
||||
'Day': getDays()
|
||||
};
|
||||
|
||||
var alerttitle;
|
||||
if (curfewid) {
|
||||
item.Id = curfewid;
|
||||
alerttitle = GetTextByKey("P_CM_EDITCURFEWCONFIGURATION", "Edit Curfew Configuration");
|
||||
} else {
|
||||
item.Id = "";
|
||||
alerttitle = GetTextByKey("P_CM_ADDCURFEWCONFIGURATION", "Add Curfew Configuration");
|
||||
}
|
||||
if (!item.Title || item.Title.length == 0) {
|
||||
showAlert(GetTextByKey("P_CM_TITLECANNOTBEEMPTY", 'Title cannot be empty.'), alerttitle);
|
||||
return;
|
||||
}
|
||||
if (!item.Day || item.Day.length == 0) {
|
||||
showAlert(GetTextByKey("P_CM_PLEASESELECTATLEASTONEDAY", 'Please select at least one day.'), alerttitle);
|
||||
return;
|
||||
}
|
||||
|
||||
var times = [];
|
||||
var trs = $('.trtimeperiod');
|
||||
if (trs.length == 0) {
|
||||
showAlert(GetTextByKey("P_CM_PERIODCANNOTBEEMPTY", "Period cannot be empty."), alerttitle);
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < trs.length; i++) {
|
||||
var sels = $(trs[i]).find('select');
|
||||
var time = {
|
||||
'BeginHours': $(sels[0]).val(),
|
||||
'BeginMinutes': $(sels[1]).val(),
|
||||
'EndHours': $(sels[2]).val(),
|
||||
'EndMinutes': $(sels[3]).val()
|
||||
};
|
||||
times.push(time);
|
||||
}
|
||||
|
||||
item.TimePeriods = times;
|
||||
|
||||
showloading(true);
|
||||
var param = JSON.stringify(item);
|
||||
param = htmlencode(param);
|
||||
curfewquery("SaveCurfew", contractorid + String.fromCharCode(170) + param, function (data) {
|
||||
showloading(false);
|
||||
if (typeof (data) === "string") {
|
||||
var msg = data;
|
||||
if (data === "The curfew title must be unique.")
|
||||
msg = GetTextByKey("P_CM_THECURFEWTITLEMUSTBEUNIQUE", 'The curfew title must be unique.');
|
||||
else if (data === "Period cannot be empty.")
|
||||
msg = GetTextByKey("P_CM_PERIODCANNOTBEEMPTY", 'Period cannot be empty.');
|
||||
else if (data === "End Time must be later than Start Time.")
|
||||
msg = GetTextByKey("P_CM_ENDTIMEMUSTBELATERTHANSTARTTIME", 'End Time must be later than Start Time.');
|
||||
|
||||
showAlert(msg, GetTextByKey("P_CM_SAVECURFEWCONFIGURATION", 'Save Curfew Configuration'));
|
||||
} else {
|
||||
curfewid = data[0];
|
||||
if (exit == 0)
|
||||
showAlert(GetTextByKey("P_CM_SAVSUCCESSFULLY", "Saved successfully."), GetTextByKey("P_CM_SAVECURFEWCONFIGURATION", 'Save Curfew Configuration'));
|
||||
if (exit == 1)
|
||||
OnExit(exit);
|
||||
}
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
showAlert(GetTextByKey("P_CM_FAILEDTOSAVECURFEWCONFIGURATION", 'Failed to save curfew configuration.'), GetTextByKey("P_CM_SAVECURFEWCONFIGURATION", 'Save Curfew Configuration'));
|
||||
});
|
||||
}
|
||||
|
||||
function OnExit(type) {
|
||||
window.parent.CloseDialog(type);
|
||||
}
|
||||
|
||||
function init(cid, id) {
|
||||
curfewid = id;
|
||||
contractorid = cid;
|
||||
OnAdd();
|
||||
|
||||
if (curfewid !== undefined && curfewid !== '') {
|
||||
OnEdit();
|
||||
}
|
||||
}
|
||||
|
||||
$(function () {
|
||||
init();
|
||||
|
||||
function resizeContent() {
|
||||
$('#divcontent').css('height', $(window).height() - $('#divcontent').offset().top - 4);
|
||||
}
|
||||
|
||||
window.onresize = resizeContent;
|
||||
resizeContent();
|
||||
});
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
|
||||
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
|
||||
<div>
|
||||
<div class="function_title">
|
||||
<span class="sbutton iconsave" onclick="OnSave(0);" data-lgid="P_CM_SAVE">Save</span>
|
||||
<span class="sbutton iconsave" onclick="OnSave(1);" data-lgid="P_CM_SAVE1">Save and Exit</span>
|
||||
<span class="sbutton iconexit" onclick="OnExit(0);" data-lgid="P_CM_SAVE2">Exit Without Saving</span>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="content_main" id="divcontent" style="overflow: auto;">
|
||||
<div class="edit-content">
|
||||
<div class="subtitle">
|
||||
<span data-lgid="P_CM_CURFEWINFORMATION">Curfew Information</span>
|
||||
<hr />
|
||||
</div>
|
||||
<table style="line-height: 40px;">
|
||||
<tr>
|
||||
<td class="label" data-lgid="P_CM_TITLE_COLON">Title:</td>
|
||||
<td>
|
||||
<input id="dialog_title" tabindex="2" maxlength="200" style="width: 280px;" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label" data-lgid="P_CM_DAYS_COLON">Day(s):</td>
|
||||
<td id="tdDays">
|
||||
<input type="checkbox" id="chkSu" tabindex="3" style="width: auto; margin-left: 0px; margin-right: 2px;" class="middlechk" /><label for="chkSu" data-lgid="P_CM_SUNDAY">Sunday</label>
|
||||
<input type="checkbox" id="chkMo" tabindex="4" style="width: auto; margin-left: 26px; margin-right: 2px;" class="middlechk" /><label for="chkMo" data-lgid="P_CM_MONDAY">Monday</label>
|
||||
<input type="checkbox" id="chkTu" tabindex="5" style="width: auto; margin-left: 26px; margin-right: 2px;" class="middlechk" /><label for="chkTu" data-lgid="P_CM_TUESDAY">Tuesday</label>
|
||||
<input type="checkbox" id="chkWe" tabindex="6" style="width: auto; margin-left: 26px; margin-right: 2px;" class="middlechk" /><label for="chkWe" data-lgid="P_CM_WEDNESDAY">Wednesday</label>
|
||||
<input type="checkbox" id="chkTh" tabindex="7" style="width: auto; margin-left: 26px; margin-right: 2px;" class="middlechk" /><label for="chkTh" data-lgid="P_CM_THURSDAY">Thursday</label>
|
||||
<input type="checkbox" id="chkFr" tabindex="8" style="width: auto; margin-left: 26px; margin-right: 2px;" class="middlechk" /><label for="chkFr" data-lgid="P_CM_FRIDAY">Friday</label>
|
||||
<input type="checkbox" id="chkSa" tabindex="9" style="width: auto; margin-left: 26px; margin-right: 2px;" class="middlechk" /><label for="chkSa" data-lgid="P_CM_SATURDAY">Saturday</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="tr_addtimepreiod">
|
||||
<td class="label"></td>
|
||||
<td><span class="sbutton iconadd" onclick="AddTimePeriod();" style="background-color: #f0f0f0;" data-lgid="P_CM_ADDPERIOD">Add Period</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</asp:Content>
|
47
Site/Security/AddCurfew.aspx.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using IronIntel.Contractor.Site;
|
||||
using IronIntel.Contractor.Site.Security;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class AddCurfew : CurfewBasePage
|
||||
{
|
||||
public bool IsDealer = IronIntel.Contractor.SystemParams.IsDealer;
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!CheckLoginSession())
|
||||
{
|
||||
RedirectToLoginPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
string methodName = Request.Form["MethodName"];
|
||||
if (!string.IsNullOrEmpty(methodName))
|
||||
{
|
||||
ProcessRequest(methodName);
|
||||
}
|
||||
else if (!IsPostBack)
|
||||
{
|
||||
this.Title = PageTitle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsAdmin
|
||||
{
|
||||
get
|
||||
{
|
||||
var user = GetCurrentUser();
|
||||
if (user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin || user.UserType == IronIntel.Contractor.Users.UserTypes.Admin)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
2636
Site/Security/AddUser.aspx
Normal file
55
Site/Security/AddUser.aspx.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using Foresight.Fleet.Services.User;
|
||||
using IronIntel.Contractor;
|
||||
using IronIntel.Contractor.Site;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class AddUser : UserManageBasePage
|
||||
{
|
||||
protected string IID;
|
||||
public bool IsDealer = IronIntel.Contractor.SystemParams.IsDealer;
|
||||
public bool EmailSubscribe = false;
|
||||
public bool AllowSMSMessagesLisence = false;
|
||||
public bool AllowSMSMessagesFeature = false;
|
||||
protected string SystemLoginVerifyType = "";
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!CheckLoginSession())
|
||||
{
|
||||
RedirectToLoginPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
string methodName = Request.Form["MethodName"];
|
||||
if (!string.IsNullOrEmpty(methodName))
|
||||
{
|
||||
ProcessRequest(methodName);
|
||||
}
|
||||
else if (!IsPostBack)
|
||||
{
|
||||
this.Title = PageTitle;
|
||||
IID = GetCurrentLoginSession().User.UID;
|
||||
EmailSubscribe = SystemParams.HasLicense("EmailSubscribe");
|
||||
|
||||
AllowSMSMessagesLisence = SystemParams.HasLicense("WorkOrder");
|
||||
AllowSMSMessagesFeature = CheckRight(SystemParams.CompanyID, Feature.WORK_ORDER);
|
||||
}
|
||||
var LoginVerifyType = SystemParams.GetStringParam("LoginVerifyType");
|
||||
SystemLoginVerifyType = string.IsNullOrEmpty(LoginVerifyType) ? "(None)" : "(" + LoginVerifyType + ")";
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSupperAdmin
|
||||
{
|
||||
get
|
||||
{
|
||||
var user = GetCurrentUser();
|
||||
return user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin;
|
||||
}
|
||||
}
|
||||
}
|
1266
Site/Security/CurfewManage.aspx
Normal file
46
Site/Security/CurfewManage.aspx.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using IronIntel.Contractor.Site.Security;
|
||||
using System;
|
||||
|
||||
public partial class Security_CurfewManage : CurfewBasePage
|
||||
{
|
||||
public bool IsDealer = IronIntel.Contractor.SystemParams.IsDealer;
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!CheckLoginSession())
|
||||
{
|
||||
// TODO: sub page
|
||||
//RedirectToLoginPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
string methodName = Request.Form["MethodName"];
|
||||
if (!string.IsNullOrEmpty(methodName))
|
||||
{
|
||||
ProcessRequest(methodName);
|
||||
}
|
||||
else if (!IsPostBack)
|
||||
{
|
||||
// todo nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsAdmin
|
||||
{
|
||||
get
|
||||
{
|
||||
var user = GetCurrentUser();
|
||||
if (user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin || user.UserType == IronIntel.Contractor.Users.UserTypes.Admin)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected override bool AllowCurrentLoginSessionEnter()
|
||||
{
|
||||
var user = GetCurrentUser();
|
||||
return user.UserType >= IronIntel.Contractor.Users.UserTypes.Admin;
|
||||
}
|
||||
}
|
467
Site/Security/CurfewMovementTolerance.aspx
Normal file
@ -0,0 +1,467 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Security/Security.master" AutoEventWireup="true" CodeFile="CurfewMovementTolerance.aspx.cs" Inherits="CurfewMovementTolerance" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
|
||||
<style type="text/css">
|
||||
.selectinput {
|
||||
width: 150px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.no_wrap th {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.max160 {
|
||||
max-width: 160px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.dialog-content table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
line-height: 32px;
|
||||
}
|
||||
|
||||
.dialog-content table td.label {
|
||||
width: 124px;
|
||||
text-align: right;
|
||||
padding-right: 10px;
|
||||
line-height: 24px;
|
||||
height: 24px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.dialog-content table td input,
|
||||
.dialog-content table td textarea {
|
||||
border: 1px solid #a9a9a9;
|
||||
width: 250px;
|
||||
height: 18px;
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
.dialog-content table td select {
|
||||
width: 254px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.dialog-content table td input[type="checkbox"] {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.dialog-content table td textarea {
|
||||
height: 100px;
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
#dialog_user_randompass {
|
||||
width: auto;
|
||||
height: 16px;
|
||||
margin: 3px 4px 0 4px;
|
||||
}
|
||||
|
||||
.ctl_button {
|
||||
font-family: 'CalciteWebCoreIcons';
|
||||
display: block;
|
||||
margin: 6px auto;
|
||||
width: 60px;
|
||||
height: 22px;
|
||||
line-height: 21px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#dialog_machinegroup {
|
||||
z-index: 500;
|
||||
width: 870px;
|
||||
top: 60px;
|
||||
left: 150px;
|
||||
}
|
||||
|
||||
.inputbox {
|
||||
width: 500px;
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
.group_table .main_table {
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.group_table .main_table td {
|
||||
width: 165px;
|
||||
white-space: nowrap;
|
||||
word-break: keep-all;
|
||||
}
|
||||
|
||||
.group_table .main_table td div {
|
||||
width: 165px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
word-break: keep-all;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
|
||||
.table_holder {
|
||||
border-collapse: collapse;
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
.table_holder thead th {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.table_holder tbody tr {
|
||||
line-height: 28px;
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
.table_holder td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.table_holder .td_controller {
|
||||
vertical-align: middle;
|
||||
padding: 40px 8px;
|
||||
}
|
||||
|
||||
.table_holder .scroller {
|
||||
height: 400px;
|
||||
overflow-y: auto;
|
||||
width: 410px;
|
||||
}
|
||||
|
||||
.ctl_button {
|
||||
font-family: 'CalciteWebCoreIcons';
|
||||
display: block;
|
||||
margin: 6px auto;
|
||||
width: 60px;
|
||||
height: 22px;
|
||||
line-height: 21px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.machine_filter {
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
}
|
||||
|
||||
.machine_filter select {
|
||||
height: 23px;
|
||||
min-width: 100px;
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
.machine_filter span {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.ybutton {
|
||||
width: auto;
|
||||
line-height: normal;
|
||||
margin-left: 6px;
|
||||
border: none;
|
||||
background: rgb(249, 189, 117);
|
||||
padding: 5px 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ybutton:hover {
|
||||
background: #d7690E;
|
||||
}
|
||||
|
||||
.machines {
|
||||
/*table-layout: fixed;*/
|
||||
word-break: keep-all;
|
||||
}
|
||||
|
||||
.machines td {
|
||||
padding-right: 5px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.middlechk {
|
||||
width: auto;
|
||||
height: 13px;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 1px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
<script src="<%=GetFileUrlWithVersion("../js/vue.min.js")%>" type="text/javascript"></script>
|
||||
<script>Vue.config.productionTip = false; Vue.config.silent = true;</script>
|
||||
<script src="<%=GetFileUrlWithVersion("../js/components/datagrid.js")%>" type="text/javascript"></script>
|
||||
<script>
|
||||
|
||||
var jobsitetoleranceCtrl;
|
||||
|
||||
curfewquery = function (method, param, callback, error, nolog) {
|
||||
_network.request("Security/CurfewMovementTolerance.aspx", -1, method, param, callback, error || function (e) {
|
||||
showAlert(GetTextByKey("P_CMT_FAILEDTOLOADDATA", 'Failed to load data: ') + e.statusText, GetTextByKey("P_CMT_SCHEDULEASSETS", 'Schedule Assets'));
|
||||
});
|
||||
}
|
||||
|
||||
function getText(s, flag) {
|
||||
return (s == null)
|
||||
? (flag ? '<i>null</i>' : '')
|
||||
: htmlencode(s, $('#span_text_holder')).replace(/ /g, ' ');
|
||||
}
|
||||
|
||||
function trim_str(s) {
|
||||
if (s == null)
|
||||
return "";
|
||||
else
|
||||
return s.replace(/(^\s*)|(\s*$)/g, "");
|
||||
}
|
||||
|
||||
|
||||
var _tolerancedata;
|
||||
|
||||
if (typeof jobsitetoleranceCtrl !== 'function') {
|
||||
$jobsitetoleranceCtrl = function jobsitetoleranceCtrl() {
|
||||
this.tmpobj = {
|
||||
typeformat: undefined,
|
||||
paramsTable: null,
|
||||
table: null,
|
||||
pivotFields: null,
|
||||
pluginDT: null,
|
||||
pluginColumns: null,
|
||||
chart: null,
|
||||
tableList: null
|
||||
};
|
||||
this.wizardCtrl = null;
|
||||
this.vue = null;
|
||||
};
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
setPageTitle(GetTextByKey("P_CURFEWMOVEMENTTOLERANCE", 'Curfew Movement Tolerance'), true);
|
||||
|
||||
var dataGrid = window.DataGrid || window['g5-datagrid'];
|
||||
|
||||
$jobsitetoleranceCtrl.prototype.getData = function (/*dataObj, tmpdata*/) {
|
||||
return this.vue.source;
|
||||
};
|
||||
|
||||
$jobsitetoleranceCtrl.prototype.setData = function (jobsitedata) {
|
||||
if (jobsitedata) {
|
||||
for (var i = 0; i < jobsitedata.length; i++) {
|
||||
var a = jobsitedata[i];
|
||||
//a.Selected = false;
|
||||
if (a.Highlight == undefined)
|
||||
a.Highlight = false;
|
||||
}
|
||||
}
|
||||
this.vue.source = jobsitedata ? jobsitedata : [];
|
||||
};
|
||||
|
||||
$jobsitetoleranceCtrl.prototype.reload = function () {
|
||||
this.vue.$refs.grid.reload()
|
||||
};
|
||||
|
||||
$jobsitetoleranceCtrl.prototype.Init = function (parent, isassigned) {
|
||||
var ethis = this;
|
||||
var defaultPivot = function () {
|
||||
//this.InnerID = $.newGuid();
|
||||
};
|
||||
//加载子页面模版
|
||||
parent.load('../template/JobsiteToleranceCtrl.html?v=7&sn' + Math.random(), function () {
|
||||
ethis.vue = new Vue({
|
||||
el: parent.find('.JobsiteToleranceCtrl')[0],
|
||||
components: {
|
||||
'data-grid': dataGrid
|
||||
},
|
||||
data: {
|
||||
//tableResult: tableResult,
|
||||
wnd: window.parent,
|
||||
editable: true,
|
||||
columns: [],
|
||||
pivotLinkage: false,
|
||||
source: [],
|
||||
showLinkPivot: false,
|
||||
defaultConstructor: defaultPivot,
|
||||
defaultItemProps: {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
btUpTitle: function () {
|
||||
return "Move selected line up";
|
||||
},
|
||||
btDownTitle: function () {
|
||||
return "Move selected line down";
|
||||
},
|
||||
btDelTitle: function () {
|
||||
return 'Delete selected lines';
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
source: function (val) {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
cellvaluechanged: function (item, key) {
|
||||
},
|
||||
rowdblclick: function (e) {
|
||||
}
|
||||
}
|
||||
});
|
||||
ethis.vue.columns = createGridColumn(ethis, isassigned);
|
||||
if (_tolerancedata && jobsitetoleranceCtrl) {
|
||||
jobsitetoleranceCtrl.setData(_tolerancedata.JobSites);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
function createGridColumn(ethis, isassigned) {
|
||||
var editable = false;
|
||||
var columns = [
|
||||
{
|
||||
key: 'JobSiteName',
|
||||
caption: GetTextByKey("P_CMT_JOBSITES", 'Jobsite'),
|
||||
type: dataGrid.COLUMN_TYPE.lable,
|
||||
width: 800,
|
||||
orderable: false,
|
||||
resizable: false,
|
||||
enabled: editable
|
||||
},
|
||||
{
|
||||
key: 'Tolerance',
|
||||
caption: GetTextByKey("P_CMT_TOLERANCE", 'Tolerance'),
|
||||
type: dataGrid.COLUMN_TYPE.input,
|
||||
width: 150,
|
||||
orderable: false,
|
||||
resizable: false,
|
||||
visible: true,
|
||||
attrs: { 'maxlength': 8 }
|
||||
}
|
||||
];
|
||||
|
||||
return columns;
|
||||
}
|
||||
}());
|
||||
}
|
||||
|
||||
function OnRefresh() {
|
||||
showloading(true);
|
||||
|
||||
curfewquery("GetCurfewMovementTolerance", '', function (data) {
|
||||
showloading(false);
|
||||
if (typeof (data) === "string") {
|
||||
showAlert(data, GetTextByKey("P_CMT_ERROR", 'Error'));
|
||||
return;
|
||||
}
|
||||
_tolerancedata = data;
|
||||
$('#dialog_defaulttolerance').val(_tolerancedata.DefaultTolerance);
|
||||
if (jobsitetoleranceCtrl && jobsitetoleranceCtrl.vue) {
|
||||
jobsitetoleranceCtrl.setData(_tolerancedata.JobSites);
|
||||
}
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
function OnSave() {
|
||||
var defaulttolerance = $.trim($('#dialog_defaulttolerance').val());
|
||||
var alerttitle = GetTextByKey("P_CMT_SAVESAVECURFEWMOVEMENTTOLERANCE", "Save Curfew Movement Tolerance");
|
||||
|
||||
if (defaulttolerance !== "" && isNaN(defaulttolerance)) {
|
||||
showAlert(GetTextByKey("P_CMT_DEFAULTTOLERANCEFORMATERROR", 'Default Tolerance format error.'), alerttitle);
|
||||
return;
|
||||
}
|
||||
var jobsite = [];
|
||||
if (_tolerancedata.JobSites && _tolerancedata.JobSites.length > 0) {
|
||||
for (var i = 0; i < _tolerancedata.JobSites.length; i++) {
|
||||
var js = _tolerancedata.JobSites[i];
|
||||
if (js.Tolerance !== "" && isNaN(js.Tolerance)) {
|
||||
showAlert(GetTextByKey("P_CMT_JOBSITETOLERANCEFORMATERROR", 'Jobsite Tolerance format error.'), alerttitle);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
var jsitem = {
|
||||
'JobSiteId': js.JobSiteId,
|
||||
'Tolerance': js.Tolerance
|
||||
};
|
||||
if (jsitem.Tolerance === "")
|
||||
jsitem.Tolerance = 0;
|
||||
jobsite.push(jsitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var item = {
|
||||
'DefaultTolerance': defaulttolerance,
|
||||
'JobSites': jobsite
|
||||
};
|
||||
if (item.DefaultTolerance === "")
|
||||
item.DefaultTolerance = 0;
|
||||
|
||||
var param = JSON.stringify(item);
|
||||
param = htmlencode(param);
|
||||
curfewquery('UpdateCurfewMovementTolerance', param, function (data) {
|
||||
if (data !== 'OK') {
|
||||
showAlert(data, alerttitle);
|
||||
} else {
|
||||
showAlert(GetTextByKey("P_CMT_SAVSUCCESSFULLY", 'Saved Successfully.'), alerttitle);
|
||||
//OnRefresh();
|
||||
}
|
||||
}, function (err) {
|
||||
showAlert(GetTextByKey("P_CMT_FAILEDTOSAVECURFEWMOVEMENTTOLERANCE", 'Failed to save curfew movement tolerance.'), alerttitle);
|
||||
});
|
||||
}
|
||||
|
||||
$(function () {
|
||||
jobsitetoleranceCtrl = new $jobsitetoleranceCtrl();
|
||||
jobsitetoleranceCtrl.Init($("#tolerancelist"), false);
|
||||
|
||||
OnRefresh();
|
||||
|
||||
$(window).resize(function () {
|
||||
$("#tolerancelist").css("height", $(window).height() - $("#tolerancelist").offset().top - 10);
|
||||
}).resize();
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
|
||||
<div style="min-width: 400px;">
|
||||
<div class="page_title" data-lgid="P_CURFEWMOVEMENTTOLERANCE">Curfew Movement Tolerance</div>
|
||||
<div class="function_title">
|
||||
<span class="sbutton iconsave" onclick="OnSave();" data-lgid="P_CMT_SAVE">Save</span>
|
||||
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_CMT_REFRESH">Refresh</span>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div>
|
||||
<table style="margin-top: 3px; margin-bottom: 3px;">
|
||||
<tr>
|
||||
<td class="label" data-lgid="P_CMT_DEFAULTTOILERANCE">Default Tolerance:</td>
|
||||
<td>
|
||||
<input type="text" id="dialog_defaulttolerance" maxlength="8" autocomplete="off" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="tolerancelist"></div>
|
||||
<div id="mask_bg" style="display: none;">
|
||||
<div class="loading c-spin"></div>
|
||||
</div>
|
||||
</div>
|
||||
</asp:Content>
|
46
Site/Security/CurfewMovementTolerance.aspx.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using IronIntel.Contractor.Site.Security;
|
||||
using System;
|
||||
|
||||
public partial class CurfewMovementTolerance : CurfewBasePage
|
||||
{
|
||||
public bool IsDealer = IronIntel.Contractor.SystemParams.IsDealer;
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!CheckLoginSession())
|
||||
{
|
||||
// TODO: sub page
|
||||
//RedirectToLoginPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
string methodName = Request.Form["MethodName"];
|
||||
if (!string.IsNullOrEmpty(methodName))
|
||||
{
|
||||
ProcessRequest(methodName);
|
||||
}
|
||||
else if (!IsPostBack)
|
||||
{
|
||||
// todo nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsAdmin
|
||||
{
|
||||
get
|
||||
{
|
||||
var user = GetCurrentUser();
|
||||
if (user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin || user.UserType == IronIntel.Contractor.Users.UserTypes.Admin)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected override bool AllowCurrentLoginSessionEnter()
|
||||
{
|
||||
var user = GetCurrentUser();
|
||||
return user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin;
|
||||
}
|
||||
}
|
127
Site/Security/Security.aspx
Normal file
@ -0,0 +1,127 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/IronIntelMasterPage.master" AutoEventWireup="true" CodeFile="Security.aspx.cs" Inherits="Security_Security" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="holder_head" runat="Server">
|
||||
<link href="<%=GetFileUrlWithVersion("../css/split.css")%>" rel="stylesheet" type="text/css" />
|
||||
<script src="<%=GetFileUrlWithVersion("../js/split.js")%>"></script>
|
||||
<%--<script src="<%=GetFileUrlWithVersion("../fic/js/utility.js")%>" type="text/javascript"></script>--%>
|
||||
<script type="text/javascript">
|
||||
|
||||
$(function () {
|
||||
setFavoriteDisplay(true);
|
||||
|
||||
_network.securityquery = function (method, param, callback, error) {
|
||||
_network.request("Security/Security.aspx", -1, method, param, callback, error);
|
||||
}
|
||||
|
||||
_network.securityquery('GetNavs', '', function (data) {
|
||||
if (data != null && data.length > 0) {
|
||||
var list = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var icon = $(' <button></button>');
|
||||
var title = getNavInfoByID(data[i].ID, data[i].Title, icon);
|
||||
//if (data[i].ID == "nav_curfew") continue;//临时屏蔽Curfew Configuration
|
||||
var li = $('<li class="nav_item"></li>').attr({
|
||||
'id': data[i].ID,
|
||||
'page': data[i].Url,
|
||||
'title': title
|
||||
});
|
||||
var a = $('<a></a>').attr('href', '#' + data[i].ID);
|
||||
var src = data[i].IconPath;
|
||||
if (!src) {
|
||||
src = 'img/none.png';
|
||||
}
|
||||
var divicon = $('<div></div>').append(icon);
|
||||
a.append(divicon);
|
||||
a.append($('<span></span>').text(title));
|
||||
li.append(a);
|
||||
|
||||
if (data[i].ID === "nav_dts") {
|
||||
li.click(function () {
|
||||
setPageTitle(GetTextByKey("P_DATATABLEPERMISSION", 'Data Table Access Rights Definitions'), true);
|
||||
})
|
||||
}
|
||||
else if (data[i].ID === "nav_filters") {
|
||||
li.click(function () {
|
||||
setPageTitle(GetTextByKey("P_DASHBOARDFILTERS", 'Filter Definitions'), true);
|
||||
})
|
||||
}
|
||||
|
||||
list.push(li);
|
||||
}
|
||||
$('.ul_menu').append(list);
|
||||
}
|
||||
|
||||
if (data.length > 0) {
|
||||
default_page = '#' + data[0].ID;
|
||||
if (!old_hash) {
|
||||
old_hash = default_page;
|
||||
}
|
||||
|
||||
window.changePage(old_hash);
|
||||
} else {
|
||||
// 无权限时跳转至登录页面
|
||||
window.location.href = '<%=LoginPageUrl%>';
|
||||
}
|
||||
}, function (e) {
|
||||
console.log(e);
|
||||
});
|
||||
});
|
||||
|
||||
function getNavInfoByID(id, title1, icon) {
|
||||
var title = title1;
|
||||
if (id === "nav_users") {
|
||||
title = GetTextByKey("P_USERS", title);
|
||||
$(icon).addClass("iconusers");
|
||||
}
|
||||
else if (id === "nav_user_group") {
|
||||
title = GetTextByKey("P_USERSGROUP", title);
|
||||
$(icon).addClass("iconusergroup");
|
||||
}
|
||||
else if (id === "nav_dts") {
|
||||
title = GetTextByKey("P_DATATABLEPERMISSION", title);
|
||||
$(icon).addClass("icondatatablepermission");
|
||||
}
|
||||
else if (id === "nav_filters") {
|
||||
title = GetTextByKey("P_DASHBOARDFILTERS", title);
|
||||
$(icon).addClass("icondashboardfilters");
|
||||
}
|
||||
else if (id === "nav_curfew") {
|
||||
title = GetTextByKey("P_CURFEWCONFIGURATION", title);
|
||||
$(icon).addClass("iconcurfew");
|
||||
}
|
||||
else if (id === "nav_curfewmt") {
|
||||
title = GetTextByKey("P_CURFEWMOVEMENTTOLERANCE", title);
|
||||
$(icon).addClass("iconcurfewmt");
|
||||
}
|
||||
else if (id === "nav_usertocontractor") {
|
||||
title = GetTextByKey("P_USERTOCONTRACTOR", title);
|
||||
$(icon).addClass("iconusertocontractor");
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
function afterpagechanged(hash, name) {
|
||||
setFavorateStyle(hash, name);
|
||||
if (hash === "#nav_dts" || hash === "#nav_filters") {//调用FIC的页面,特殊处理
|
||||
$('#set_right .loading_holder').fadeOut('fast');
|
||||
$('#set_right iframe').fadeIn();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="holder_content" runat="Server">
|
||||
<div id="set_left">
|
||||
<ul class="ul_menu">
|
||||
<li id="nav_arrow">
|
||||
<div class="icn collapse"></div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="hostmask maskbg" style="display: none;"></div>
|
||||
</div>
|
||||
<div id="set_right">
|
||||
<div class="loading_holder">
|
||||
<div class="loading_icon icn icn-spin"></div>
|
||||
</div>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
51
Site/Security/Security.aspx.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using IronIntel.Contractor;
|
||||
using IronIntel.Contractor.Site.Security;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class Security_Security : SecurityBasePage
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!CheckLoginSession())
|
||||
{
|
||||
RedirectToLoginPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
string methodName = Request.Form["MethodName"];
|
||||
if (!string.IsNullOrEmpty(methodName))
|
||||
{
|
||||
ProcessRequest(methodName);
|
||||
}
|
||||
else if (!IsPostBack)
|
||||
{
|
||||
this.Title = PageTitle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool AllowCurrentLoginSessionEnter()
|
||||
{
|
||||
var f = base.AllowCurrentLoginSessionEnter();
|
||||
if (!f)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var user = GetCurrentUser();
|
||||
return user != null && user.UserType >= IronIntel.Contractor.Users.UserTypes.Admin;
|
||||
}
|
||||
|
||||
protected override int FeatureID
|
||||
{
|
||||
get
|
||||
{
|
||||
return Foresight.Fleet.Services.User.Feature.USERS;
|
||||
}
|
||||
}
|
||||
}
|
101
Site/Security/Security.master
Normal file
@ -0,0 +1,101 @@
|
||||
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Security.master.cs" Inherits="Security_MasterPage" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<title></title>
|
||||
<link type="text/css" href="<%=GetUrl("js/components/css/gridview.css") %>" rel="stylesheet" />
|
||||
<link type="text/css" href="<%=GetUrl("css/override.css") %>" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="<%=GetUrl("css/default.css")%>" type="text/css" />
|
||||
<link rel="stylesheet" href="<%=GetUrl("css/split_sub.css")%>" type="text/css" />
|
||||
<link rel="stylesheet" href="<%=GetUrl("css/editmultiselect.css")%>" type="text/css" />
|
||||
<style type="text/css">
|
||||
:root { <%=StyleVariables%> }
|
||||
.data-grid {
|
||||
height: 100%;
|
||||
font-size: 12px !important;
|
||||
font-family: "Segoe UI","Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,"Roboto","Helvetica Neue",sans-serif !important;
|
||||
}
|
||||
|
||||
#search {
|
||||
background-color: rgb(235, 235, 235);
|
||||
border: none;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#search:hover {
|
||||
background: rgb(225, 225, 225);
|
||||
}
|
||||
</style>
|
||||
<script src="<%=GetUrl("js/jquery-3.6.0.min.js")%>" type="text/javascript"></script>
|
||||
<script src="<%=GetUrl("js/cookie.js")%>" type="text/javascript"></script>
|
||||
<script src="<%=GetUrl("js/utility.js")%>" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="<%=GetUrl("js/components/gridview.js") %>"></script>
|
||||
<script src="<%=GetUrl("js/editmultiselect.js")%>" type="text/javascript"></script>
|
||||
<script src="<%=GetUrl("js/language.js")%>" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var GridView = window.GridView || window['g5-gridview'];
|
||||
var canExport = <%= CanExportFile %>;
|
||||
_network.root = '<%=Page.ResolveUrl("~/")%>';
|
||||
var sitePath = "<%=this.ResolveUrl("~/fic/") %>";
|
||||
window.consts = { path: _network.root };
|
||||
|
||||
function getText(s, flag) {
|
||||
return (s == null)
|
||||
? (flag ? '<i>null</i>' : '')
|
||||
: htmlencode(s).replace(/ /g, ' ');
|
||||
}
|
||||
|
||||
function GetLanguageByCookie() {
|
||||
var lang = getCookie('<%=Common.LanguageCookieName%>');
|
||||
if (lang == null) {
|
||||
return "en-us";
|
||||
} else {
|
||||
return lang;
|
||||
}
|
||||
}
|
||||
|
||||
$(function () {
|
||||
_fleet.currentLang = GetLanguageByCookie();
|
||||
$("#content1").applyFleetLanguageText(true);
|
||||
|
||||
// 加载完毕后通知上级页面
|
||||
if (typeof window.parent.onsubpageloaded == 'function') {
|
||||
window.parent.onsubpageloaded();
|
||||
}
|
||||
|
||||
if (typeof window.parent.ondocumentclick == 'function') {
|
||||
$(document.body).click(window.parent.ondocumentclick);
|
||||
}
|
||||
|
||||
function resizeContent() {
|
||||
if ($('.content_main').length > 0)
|
||||
$('.content_main').css('min-height', $(window).height() - $('.content_main').offset().top - 4);
|
||||
$('#mask_bg').height($(document).outerHeight(false)).width($(document).outerWidth(false));
|
||||
}
|
||||
|
||||
$(window).resize(function () {
|
||||
resizeContent();
|
||||
});
|
||||
resizeContent();
|
||||
|
||||
$(document.body).click(function (e) {
|
||||
if (typeof hidePanels === 'function')
|
||||
hidePanels();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<asp:ContentPlaceHolder ID="head" runat="server"></asp:ContentPlaceHolder>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content1">
|
||||
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
|
||||
</asp:ContentPlaceHolder>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
28
Site/Security/Security.master.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using FI.FIC;
|
||||
using Foresight.Fleet.Services.Styles;
|
||||
using IronIntel.Contractor;
|
||||
using IronIntel.Contractor.iisitebase;
|
||||
using IronIntel.Contractor.Site;
|
||||
using IronIntel.Contractor.Users;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class Security_MasterPage : CommonBase
|
||||
{
|
||||
protected override bool ExportModule
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
GetUIStyle();
|
||||
}
|
||||
}
|
||||
}
|
844
Site/Security/UserGroup.aspx
Normal file
@ -0,0 +1,844 @@
|
||||
<%@ 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;
|
||||
}
|
||||
|
||||
#dialog_user_group {
|
||||
z-index: 500;
|
||||
top: 60px;
|
||||
left: 150px;
|
||||
}
|
||||
|
||||
.inputbox {
|
||||
width: 500px;
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
#dialog_group_description {
|
||||
padding: 2px;
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.td_module {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.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);
|
||||
}
|
||||
}
|
||||
|
||||
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 tb = $('<table class="table_module" style="width:640px;"></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);
|
||||
tr.append(td);
|
||||
|
||||
for (var j = 0; j < feature.AvailablePermissions.length; j++) {
|
||||
var pm = feature.AvailablePermissions[j];
|
||||
td = $('<td style="width: 100px;"></td>');
|
||||
tr.append(td);
|
||||
var name = "";
|
||||
if (pm === 0)
|
||||
name = nonetext;
|
||||
else if (pm === 1)
|
||||
name = readonlytext;
|
||||
else if (pm === 10)
|
||||
name = requestonlytext;
|
||||
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);
|
||||
td.append(ipt);
|
||||
}
|
||||
$("input:radio[name='feature_" + feature.Id + "'][value='" + features[i].Item2[0] + "']").prop("checked", true);
|
||||
td = $('<td></td>');
|
||||
tr.append(td);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**************************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; z-index: 500; width: 840px;">
|
||||
<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" class="inputbox" id="dialog_group_name" tabindex="1" maxlength="100" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label" data-lgid="P_UG_DESCRIPTION_COLON">Description:</td>
|
||||
<td>
|
||||
<textarea class="inputbox" id="dialog_group_description" 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="" tabindex="3" onclick="OnEditorAdd();" />
|
||||
<input class="ctl_button" type="button" value="" tabindex="4" onclick="OnEditorAddAll();" />
|
||||
<input class="ctl_button" type="button" value="" tabindex="5" onclick="OnEditorRemove();" />
|
||||
<input class="ctl_button" type="button" value="" 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: 50px; 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>
|
||||
|
31
Site/Security/UserGroup.aspx.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using IronIntel.Contractor.Site.Security;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class Security_UserGroup : UserGroupBasePage
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!CheckLoginSession())
|
||||
{
|
||||
// TODO: sub page
|
||||
//RedirectToLoginPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
string methodName = Request.Form["MethodName"];
|
||||
if (!string.IsNullOrEmpty(methodName))
|
||||
{
|
||||
ProcessRequest(methodName);
|
||||
}
|
||||
else if (!IsPostBack)
|
||||
{
|
||||
// todo nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
2037
Site/Security/UserManage.aspx
Normal file
52
Site/Security/UserManage.aspx.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using IronIntel.Contractor;
|
||||
using IronIntel.Contractor.Site;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class Security_UserManage : UserManageBasePage
|
||||
{
|
||||
protected string IID;
|
||||
public bool IsDealer = IronIntel.Contractor.SystemParams.IsDealer;
|
||||
public bool CustomerRecordLisence = false;
|
||||
public bool WorkOrderLisence = false;
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!CheckLoginSession())
|
||||
{
|
||||
// TODO: sub page
|
||||
//RedirectToLoginPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
string methodName = Request.Form["MethodName"];
|
||||
if (!string.IsNullOrEmpty(methodName))
|
||||
{
|
||||
ProcessRequest(methodName);
|
||||
}
|
||||
else if (!IsPostBack)
|
||||
{
|
||||
// todo nothing
|
||||
IID = GetCurrentLoginSession().User.UID;
|
||||
CustomerRecordLisence = SystemParams.HasLicense("CustomerRecord");
|
||||
WorkOrderLisence = SystemParams.HasLicense("WorkOrder");
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool IsAdmin
|
||||
{
|
||||
get
|
||||
{
|
||||
var user = GetCurrentUser();
|
||||
if (user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin || user.UserType == IronIntel.Contractor.Users.UserTypes.Admin)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
347
Site/Security/UserToContractorPage.aspx
Normal file
@ -0,0 +1,347 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Security/Security.master" AutoEventWireup="true" CodeFile="UserToContractorPage.aspx.cs" Inherits="Security_UserToContractorPage" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
|
||||
<link rel="stylesheet" href="<%=GetFileUrlWithVersion("css/controls.css")%>" type="text/css" />
|
||||
<style type="text/css">
|
||||
#content_left {
|
||||
float: left;
|
||||
width: 200px;
|
||||
border-top: 1px solid #b0b0b0;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.ul_menu {
|
||||
}
|
||||
|
||||
.ul_header {
|
||||
background: rgb(244,244,244);
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
|
||||
li.subitem {
|
||||
text-indent: 10px;
|
||||
}
|
||||
|
||||
#content_right {
|
||||
margin-left: 200px;
|
||||
border-left: 1px solid #b0b0b0;
|
||||
height: 100%;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.main_table {
|
||||
table-layout: fixed;
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.main_table td {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
</style>
|
||||
<script src="<%=GetFileUrlWithVersion("js/controls.js")%>" type="text/javascript"></script>
|
||||
<script src="<%=GetFileUrlWithVersion("../fic/fic/override.js")%>" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
var lasttimeclickdata = [];//上一次点击的Contractor的原始状态
|
||||
var lasttimeclicklabelID = "";//上一次点击的用户或组的ID
|
||||
function dtquery(method, param, callback) {
|
||||
_network.request("Security/UserToContractorPage.aspx", -1, method, param, callback, function (e) {
|
||||
console.log(e);
|
||||
showmaskbg(false);
|
||||
showAlert(e.statusText, GetTextByKey("P_UTC_ERROR", 'Error'));
|
||||
});
|
||||
}
|
||||
$(function () {
|
||||
setPageTitle(GetTextByKey("P_UTC_PERMISSIONMANAGEMENT", 'Permission Management'), true);
|
||||
$('#leftusertitle').click(groupTitleClick);
|
||||
$('#leftusergrouptitle').click(groupTitleClick);
|
||||
$('#thcheckall').click(CheckAll);
|
||||
$('#selectallcheck').click(CheckAll);
|
||||
GetUsers();
|
||||
GetGroups();
|
||||
});
|
||||
|
||||
function groupTitleClick(e) {
|
||||
if ($(this.lastChild).hasClass('collapse')) {
|
||||
$(this.lastChild).removeClass('collapse').addClass('expand');
|
||||
$(this).nextAll().show();
|
||||
} else {
|
||||
$(this.lastChild).removeClass('expand').addClass('collapse');
|
||||
$(this).nextAll().hide();
|
||||
}
|
||||
}
|
||||
function GetUsers() {
|
||||
dtquery('GetUsers', '', function (data) {
|
||||
$('#leftusertitle').nextAll().remove();
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var li = $('<li class="subitem"></li>').attr('id', data[i].IID).text(data[i].DisplayName).attr('title', data[i].ID).append($('<i></i>').text('(' + data[i].ID + ')'));
|
||||
li.click(function () { UserAndGroupClick(this, 1) });
|
||||
$('#usersul').append(li);
|
||||
}
|
||||
// default to load the first
|
||||
$('#leftusertitle').next().click();
|
||||
});
|
||||
}
|
||||
function GetGroups() {
|
||||
dtquery('GetGroups', '', function (data) {
|
||||
$('#leftusergrouptitle').nextAll().remove();
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var li = $('<li class="subitem"></li>').attr('id', data[i].ID).text(data[i].Name);
|
||||
li.click(function () { UserAndGroupClick(this, 2) });
|
||||
$('#groupsul').append(li);
|
||||
}
|
||||
});
|
||||
}
|
||||
function UserAndGroupClick(obj, flag) {
|
||||
$('#selectallcheck').attr('checked', false);
|
||||
var nochange = true;//默认不改变
|
||||
if (obj.id != lasttimeclicklabelID && lasttimeclickdata.length > 0) {
|
||||
$('#user_tbody tr').each(function () {
|
||||
var checkinput = this.children[0].firstElementChild;
|
||||
for (var j = 0; j < lasttimeclickdata.length; j++) {
|
||||
if (checkinput.id == lasttimeclickdata[j].ID && checkinput.checked != lasttimeclickdata[j].IsChecked) {
|
||||
nochange = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
if (!nochange) {
|
||||
if (window.parent && typeof window.parent.onmaskbg == 'function') {
|
||||
window.parent.showconfirm(GetTextByKey("P_UTC_SOMESETTINGSHAVECHANGED", "Some settings have changed.Would you like to save the changes?"), GetTextByKey("P_UTC_SAVEPERMISSION", "Save Permission"), function () {
|
||||
dosave();
|
||||
clearSelectFlag(obj);
|
||||
GetContractors(obj.id, flag);
|
||||
}, function () {
|
||||
clearSelectFlag(obj);
|
||||
GetContractors(obj.id, flag);
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
clearSelectFlag(obj);
|
||||
GetContractors(obj.id, flag);
|
||||
}
|
||||
}
|
||||
function GetContractors(i, flag) {
|
||||
lasttimeclicklabelID = i;
|
||||
$('#user_tbody').empty();
|
||||
$.ajax(
|
||||
{
|
||||
type: "POST",
|
||||
async: false,
|
||||
datatype: "json",
|
||||
url: "UserToContractorPage.aspx",
|
||||
data: {
|
||||
uiid: i,
|
||||
Flag: flag,
|
||||
MethodName: "GetContractors"
|
||||
},
|
||||
success: function (data) {
|
||||
if (data != "") {
|
||||
var contractordata = eval("(" + data + ")");
|
||||
lasttimeclickdata = [];
|
||||
for (var i = 0; i < contractordata.length; i++) {
|
||||
var newselectcontractor = {
|
||||
ID: contractordata[i].ID,
|
||||
IsChecked: contractordata[i].IsChecked
|
||||
}
|
||||
lasttimeclickdata.push(newselectcontractor);
|
||||
var tr = $('<tr></tr>');
|
||||
var tdcheck = $('<td></td>').click(checkInputClick);
|
||||
var checkinput = $('<input type="checkbox" />').attr('id', contractordata[i].ID);
|
||||
if (contractordata[i].AuthorizedIngroup && contractordata[i].IsChecked) {
|
||||
checkinput.attr('disabled', 'disabled');
|
||||
tdcheck.unbind("click");
|
||||
}
|
||||
if (contractordata[i].IsChecked) {
|
||||
checkinput.attr('checked', 'checked');
|
||||
}
|
||||
checkinput.click(checkInputClick);
|
||||
tdcheck.append(checkinput);
|
||||
var tdid = $('<td></td>').text(contractordata[i].ID);
|
||||
var tdname = $('<td></td>').text(contractordata[i].Name);
|
||||
tr.append(tdcheck, tdid, tdname);
|
||||
$('#user_tbody').append(tr);
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (msg) {
|
||||
showAlert(msg.statusText, GetTextByKey("P_UTC_ERROR", 'Error'));
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
function clearSelectFlag(obj) {
|
||||
$($('#usersul')[0].children).each(function () { $(this).removeClass("selected"); });
|
||||
$($('#groupsul')[0].children).each(function () { $(this).removeClass("selected"); });
|
||||
$(obj).addClass("selected");
|
||||
}
|
||||
function Save() {
|
||||
if (!$('li.selected')[0]) {
|
||||
showAlert(GetTextByKey('P_UTC_PLEASESELECTAUSERORGROUP', "Please select a user or group."), GetTextByKey('P_UTC_SAVEUSERTOCONTRACTOR', 'Save user to contractor'));
|
||||
return false;
|
||||
}
|
||||
if (window.parent && typeof window.parent.onmaskbg == 'function') {
|
||||
window.parent.showconfirm(GetTextByKey('P_UTC_DOYOUWANTTOSAVEPERMISSIONSFORTHIS', "Do you want to save Permissions for this?"), GetTextByKey("P_UTC_SAVEPERMISSION", "Save Permission"), function () { dosave(); OnRefresh(); }, function () { return false; });
|
||||
}
|
||||
}
|
||||
function dosave() {
|
||||
var current = $('li.selected')[0].id;
|
||||
var contractorArray = [];
|
||||
$($('#user_tbody')[0].children).each(
|
||||
function () {
|
||||
var checkinputctr = this.cells['0'].children[0];
|
||||
if (checkinputctr.checked)
|
||||
contractorArray.push(encodeURIComponent(checkinputctr.id));
|
||||
}
|
||||
);
|
||||
$.ajax(
|
||||
{
|
||||
type: "POST",
|
||||
async: false,
|
||||
datatype: "json",
|
||||
url: "UserToContractorPage.aspx",
|
||||
data: {
|
||||
id: current,
|
||||
contractors: JSON.stringify(contractorArray),
|
||||
MethodName: "SaveContractor"
|
||||
},
|
||||
success: function (msg) {
|
||||
showAlert(msg, GetTextByKey('P_UTC_SAVEUSERTOCONTRACTOR', 'Save user to contractor'));
|
||||
},
|
||||
error: function (msg) {
|
||||
showAlert(msg.statusText, GetTextByKey('P_UTC_ERROR', 'Error'));
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
function OnRefresh() {
|
||||
$('#selectallcheck').attr('checked', false);
|
||||
if ($('li.selected')[0]) {
|
||||
var current = $('li.selected')[0].id;
|
||||
if ($('li.selected')[0].parentElement.id == "usersul") {
|
||||
GetContractors(current, 1);
|
||||
}
|
||||
else {
|
||||
GetContractors(current, 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
function CheckAll(e) {
|
||||
var obj = e.currentTarget;
|
||||
if (e.target.tagName == "TH") {
|
||||
if ($('#user_tbody')[0].children.length > 0) {
|
||||
if (obj.children[0].checked) {
|
||||
$($('#user_tbody')[0].children).each(
|
||||
function () {
|
||||
var checkinputctr = this.cells['0'].children[0];
|
||||
if (!checkinputctr.disabled)
|
||||
checkinputctr.checked = false;
|
||||
});
|
||||
obj.children[0].checked = false;
|
||||
}
|
||||
else {
|
||||
$($('#user_tbody')[0].children).each(
|
||||
function () {
|
||||
var checkinputctr = this.cells['0'].children[0];
|
||||
checkinputctr.checked = true;
|
||||
});
|
||||
obj.children[0].checked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (obj.checked != undefined) {
|
||||
if (obj.checked) {
|
||||
$($('#user_tbody')[0].children).each(
|
||||
function () {
|
||||
var checkinputctr = this.cells['0'].children[0];
|
||||
checkinputctr.checked = true;
|
||||
});
|
||||
obj.checked = true;
|
||||
}
|
||||
else {
|
||||
$($('#user_tbody')[0].children).each(
|
||||
function () {
|
||||
var checkinputctr = this.cells['0'].children[0];
|
||||
if (!checkinputctr.disabled)
|
||||
checkinputctr.checked = false;
|
||||
});
|
||||
obj.checked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
e.stopPropagation(); //禁止冒泡
|
||||
}
|
||||
function checkInputClick(e) {
|
||||
var obj = e.currentTarget;
|
||||
if (e.target.tagName == "TD") {
|
||||
if ($('#user_tbody')[0].children.length > 0) {
|
||||
if (obj.children[0].checked) {
|
||||
obj.children[0].checked = false;
|
||||
$('#selectallcheck')[0].checked = false;
|
||||
}
|
||||
else {
|
||||
obj.children[0].checked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (e.target.tagName == "INPUT" && obj.checked != undefined) {
|
||||
if (obj.checked) {
|
||||
obj.checked = true;
|
||||
}
|
||||
else {
|
||||
obj.checked = false;
|
||||
$('#selectallcheck')[0].checked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
e.stopPropagation(); //禁止冒泡
|
||||
}
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
|
||||
<div style="min-width: 400px;">
|
||||
<div class="page_title" data-lgid="P_UTC_PERMISSIONMANAGEMENT">Permission Management</div>
|
||||
<div class="function_title">
|
||||
<span class="sbutton iconsave" onclick="Save();" data-lgid="P_UTC_SAVE">Save</span>
|
||||
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_UTC_REFRESH">Refresh</span>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="content_main">
|
||||
<div id="content_left">
|
||||
<ul id="usersul" class="ul_menu">
|
||||
<li id="leftusertitle" class="ul_header"><span data-lgid="P_UTC_USERS">Users</span><em class="icn expand"></em></li>
|
||||
</ul>
|
||||
<ul id="groupsul" class="ul_menu">
|
||||
<li id="leftusergrouptitle" class="ul_header"><span data-lgid="P_UTC_USERGROUPS">User Groups</span><em class="icn expand"></em></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="content_right">
|
||||
<div id="permission_tab" class="tab_holder">
|
||||
<div id="group_table" class="tab_page">
|
||||
<table class="main_table">
|
||||
<thead id="datafirsttr">
|
||||
<tr>
|
||||
<th style="width: 20px;" id="thcheckall">
|
||||
<input type="checkbox" id="selectallcheck" /></th>
|
||||
<th style="width: 100px;" data-lgid="P_UTC_ID">ID</th>
|
||||
<th style="" data-lgid="P_UTC_NAME">Name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="user_tbody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
|
||||
</asp:Content>
|
||||
|
25
Site/Security/UserToContractorPage.aspx.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using IronIntel.Contractor.Site.Security;
|
||||
|
||||
public partial class Security_UserToContractorPage : UserToContractorPage
|
||||
{
|
||||
protected string IID;
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
string methodName = Request.Form["MethodName"];
|
||||
if (!string.IsNullOrEmpty(methodName))
|
||||
{
|
||||
ProcessRequest(methodName);
|
||||
}
|
||||
else if (!IsPostBack)
|
||||
{
|
||||
//IID = GetCurrentLoginSession().User.UID;
|
||||
}
|
||||
Title = PageTitle;
|
||||
}
|
||||
}
|
40
Site/Security/css/controls.css
Normal file
@ -0,0 +1,40 @@
|
||||
.tab_holder {
|
||||
|
||||
}
|
||||
.tab_header {
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
border-bottom: 1px solid #b0b0b0;
|
||||
/* 禁止选中 */
|
||||
-moz-user-select: none; /*火狐*/
|
||||
-webkit-user-select: none; /*webkit浏览器*/
|
||||
-ms-user-select: none; /*IE10*/
|
||||
-khtml-user-select: none; /*早期浏览器*/
|
||||
user-select: none;
|
||||
}
|
||||
.tab_header .tab_title {
|
||||
float: left;
|
||||
height: 29px;
|
||||
cursor: pointer;
|
||||
padding: 0 12px;
|
||||
border: 1px solid #fff;
|
||||
border-bottom: none;
|
||||
}
|
||||
.tab_header .tab_title:hover {
|
||||
/*background: #d7690E;*/
|
||||
color: rgb(173,84,12);
|
||||
}
|
||||
.tab_header .selected,
|
||||
.tab_header .selected:hover {
|
||||
/*background: #F78E1E;*/
|
||||
border: 1px solid #b0b0b0;
|
||||
border-bottom: 1px solid #fff;
|
||||
/*margin-top: -1px;*/
|
||||
color: rgb(173,84,12);
|
||||
}
|
||||
.tab_header .tab_title:first-child {
|
||||
border-left: none;
|
||||
}
|
||||
.tab_holder .tab_page {
|
||||
|
||||
}
|
BIN
Site/Security/img/contractor.png
Normal file
After Width: | Height: | Size: 899 B |
BIN
Site/Security/img/curfew.png
Normal file
After Width: | Height: | Size: 743 B |
BIN
Site/Security/img/curfewmovementtolerance.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
Site/Security/img/dtgroup.png
Normal file
After Width: | Height: | Size: 377 B |
BIN
Site/Security/img/dtpermission.png
Normal file
After Width: | Height: | Size: 234 B |
BIN
Site/Security/img/filters.png
Normal file
After Width: | Height: | Size: 262 B |
BIN
Site/Security/img/none.png
Normal file
After Width: | Height: | Size: 347 B |
BIN
Site/Security/img/usergroup.png
Normal file
After Width: | Height: | Size: 276 B |
BIN
Site/Security/img/users.png
Normal file
After Width: | Height: | Size: 277 B |
1083
Site/Security/js/adduser.js
Normal file
397
Site/Security/js/controls.js
vendored
Normal file
@ -0,0 +1,397 @@
|
||||
/// <reference path="../../js/jquery-3.6.0.min.js" />
|
||||
/// <reference path="../../js/utility.js" />
|
||||
|
||||
$.fn.tab = function (obj) {
|
||||
return this.each(function () {
|
||||
var _this = $(this);
|
||||
_this.data('tabparam', obj);
|
||||
|
||||
function switchPage(page) {
|
||||
_this.children('.tab_page').hide();
|
||||
_this.children('#' + page).show();
|
||||
}
|
||||
|
||||
var titles = _this.children('.tab_header').children('.tab_title');
|
||||
titles.click(function (e) {
|
||||
var n_this = $(this);
|
||||
// invoke function
|
||||
function next() {
|
||||
if (typeof obj.onnext === 'function') {
|
||||
obj.onnext();
|
||||
}
|
||||
titles.removeClass('selected');
|
||||
var dfor = n_this.addClass('selected').attr('data-for');
|
||||
switchPage(dfor);
|
||||
}
|
||||
if (typeof obj.onclick === 'function') {
|
||||
obj.onclick(n_this, next);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
var datafor = titles.removeClass('selected').first().addClass('selected').attr('data-for');
|
||||
switchPage(datafor);
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.selectable = function (param) {
|
||||
|
||||
param = param || {};
|
||||
|
||||
function multi_click(e) {
|
||||
var target = $(e.target);
|
||||
if (!target.is('tr')) {
|
||||
target = target.parents('tr').first();
|
||||
}
|
||||
if (param.multiple) {
|
||||
if (!target.length)
|
||||
return;
|
||||
// ctrl
|
||||
if (e.ctrlKey) {
|
||||
if (target.hasClass('selected')) {
|
||||
target.removeClass('selected');
|
||||
} else {
|
||||
target.addClass('selected');
|
||||
}
|
||||
} else if (e.shiftKey) {
|
||||
target.addClass('selected');
|
||||
var first = $(this).children('tr.selected:first');
|
||||
var last = $(this).children('tr.selected:last');
|
||||
while (first.attr('uid') != last.attr('uid')) {
|
||||
first = first.next();
|
||||
if (!first.length)
|
||||
break;
|
||||
first.addClass('selected');
|
||||
}
|
||||
} else {
|
||||
$(this).children('tr').removeClass('selected');
|
||||
target.addClass('selected');
|
||||
}
|
||||
} else {
|
||||
$(this).children('tr').removeClass('selected');
|
||||
if (!target.length)
|
||||
return;
|
||||
target.addClass('selected');
|
||||
}
|
||||
}
|
||||
|
||||
function dbl_click(e) {
|
||||
if (typeof param.dblclick !== 'function')
|
||||
return;
|
||||
|
||||
var target = $(e.target);
|
||||
if (!target.is('tr')) {
|
||||
target = target.parents('tr').first();
|
||||
}
|
||||
param.dblclick.apply(this, [target]);
|
||||
}
|
||||
|
||||
return this.each(function () {
|
||||
$(this).click(multi_click).dblclick(dbl_click);
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.tree = function (data, selectedValues, options) {
|
||||
|
||||
options = options || {};
|
||||
selectedValues = selectedValues || [];
|
||||
|
||||
if (!data) {
|
||||
return this;
|
||||
}
|
||||
|
||||
function changeExpand() {
|
||||
var flag = $(this).hasClass('collapse');
|
||||
if (flag) {
|
||||
$(this).removeClass('collapse').addClass('expand').parent('li').children('ul').show();
|
||||
} else {
|
||||
$(this).removeClass('expand').addClass('collapse').parent('li').children('ul').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function checkSelected(data) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var item = data[i];
|
||||
if (selectedValues.indexOf(item.ID) >= 0) {
|
||||
return true;
|
||||
}
|
||||
if (item.SubData && item.SubData.length > 0) {
|
||||
if (checkSelected(item.SubData)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function checkChanged() {
|
||||
var li = $(this).parents('li:first');
|
||||
var checked = $(this).prop('checked');
|
||||
|
||||
// 如果有子节点
|
||||
var ul = li.children('ul');
|
||||
var indeter = $(this).prop('indeter');
|
||||
$(this).removeProp('indeter');
|
||||
if (checked) {
|
||||
// check all
|
||||
ul.find('input').removeProp('indeter').prop({ 'indeterminate': false, 'checked': true });
|
||||
} else {
|
||||
if (!indeter && ul.length > 0) {
|
||||
$(this).prop({
|
||||
'indeterminate': true,
|
||||
'indeter': true,
|
||||
'checked': true
|
||||
});
|
||||
} else {
|
||||
// uncheck all
|
||||
ul.find('input').removeProp('indeter').prop({ 'indeterminate': false, 'checked': false });
|
||||
}
|
||||
}
|
||||
checkUpper.apply(this);
|
||||
}
|
||||
|
||||
function checkUpper() {
|
||||
// 向上寻找父节点
|
||||
var ul = $(this).parents('ul:first');
|
||||
var inp = ul.prev('em').prev('span').children('input');
|
||||
if (inp.length > 0) {
|
||||
var chks = ul.children('li').children('span').children('input');
|
||||
var count = chks.length;
|
||||
for (var i = 0; i < chks.length; i++) {
|
||||
if (chks[i].indeterminate) {
|
||||
count = 0.5;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!chks[i].checked) {
|
||||
count--;
|
||||
}
|
||||
}
|
||||
if (count == chks.length) {
|
||||
// checked all
|
||||
inp.removeProp('indeter').prop({ 'indeterminate': false, 'checked': true });
|
||||
} else if (count == 0) {
|
||||
// unchecked all
|
||||
inp.removeProp('indeter').prop({ 'indeterminate': false, 'checked': false });
|
||||
} else {
|
||||
inp.prop({
|
||||
'indeterminate': true,
|
||||
'indeter': true,
|
||||
'checked': true
|
||||
});
|
||||
}
|
||||
// 遍历
|
||||
checkUpper.apply(inp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function fillChildren(ul, item, selected) {
|
||||
var li = $('<li></li>');
|
||||
var uid = 'li_' + Math.random().toString().substring(2);
|
||||
var chk = $('<input type="checkbox"/>').attr('id', uid).val(item.ID).change(checkChanged);
|
||||
if (selected || selectedValues.indexOf(item.ID) >= 0) {
|
||||
chk.prop('checked', true);
|
||||
selected = true;
|
||||
}
|
||||
var span = $('<span></span>');
|
||||
span.append(chk, $('<label></label>').attr('for', uid).text(item.Description));
|
||||
li.append(span);
|
||||
ul.append(li);
|
||||
// 判断是否有子节点
|
||||
if (item.SubData && item.SubData.length > 0) {
|
||||
// 判断子节点选中状态
|
||||
var ulc;
|
||||
if (selected || checkSelected(item.SubData)) {
|
||||
li.append($('<em class="icn expand"></em>').click(changeExpand));
|
||||
ulc = $('<ul></ul>');
|
||||
} else {
|
||||
li.append($('<em class="icn collapse"></em>').click(changeExpand));
|
||||
ulc = $('<ul></ul>').css('display', 'none');
|
||||
}
|
||||
var cnt = 0
|
||||
for (var i = 0; i < item.SubData.length; i++) {
|
||||
if (fillChildren(ulc, item.SubData[i], selected)) {
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
li.append(ulc);
|
||||
// 补充父节点的不定状态
|
||||
if (!selected && cnt > 0) {
|
||||
chk.prop({
|
||||
'indeterminate': true,
|
||||
'indeter': true,
|
||||
'checked': true
|
||||
});
|
||||
}
|
||||
}
|
||||
return selected;
|
||||
}
|
||||
|
||||
return this.each(function () {
|
||||
for (var i = 0 ; i < data.length; i++) {
|
||||
fillChildren($(this), data[i]);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var TYPE_USER = 2;
|
||||
var TYPE_GROUP = 1;
|
||||
|
||||
$.fn.appendUserCtl = function (param) {
|
||||
param = param || {};
|
||||
|
||||
function dtquery(method, p, callback) {
|
||||
_network.request("Security/DataTablePermission.aspx", -1, method, p, callback, function (e) {
|
||||
console.log(e);
|
||||
showmaskbg(false);
|
||||
showAlert(e.statusText, 'Error');
|
||||
});
|
||||
}
|
||||
|
||||
function groupTitleClick(e) {
|
||||
if ($(this.lastChild).hasClass('collapse')) {
|
||||
$(this.lastChild).removeClass('collapse').addClass('expand');
|
||||
$(this).nextAll().show();
|
||||
} else {
|
||||
$(this.lastChild).removeClass('expand').addClass('collapse');
|
||||
$(this).nextAll().hide();
|
||||
}
|
||||
}
|
||||
|
||||
var usersul = $('<ul class="ul_menu"></ul>').attr('usertype', TYPE_USER);
|
||||
var usertitle = $('<li class="ul_header"></li>').append('<span>Users</span><em class="icn expand"></em>').click(groupTitleClick);
|
||||
usersul.append(usertitle);
|
||||
dtquery('GetUsers', '', function (data) {
|
||||
usertitle.nextAll().remove();
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var li = $('<li class="subitem"></li>')
|
||||
.attr({
|
||||
'id': data[i].IID,
|
||||
'title': data[i].ID
|
||||
})
|
||||
//.text(data[i].DisplayName)
|
||||
.append($('<span></span>').text(data[i].DisplayName), $('<i></i>').text('(' + data[i].ID + ')'))
|
||||
.data('usertype', data[i].UserType);
|
||||
li.click(param.selectUser);
|
||||
usersul.append(li);
|
||||
}
|
||||
|
||||
// default to load the first
|
||||
usertitle.next().click();
|
||||
});
|
||||
|
||||
var groupsul = $('<ul class="ul_menu"></ul>').attr('usertype', TYPE_GROUP);
|
||||
var grouptitle = $('<li class="ul_header"></li>').append('<span>User Groups</span><em class="icn expand"></em>').click(groupTitleClick);
|
||||
groupsul.append(grouptitle);
|
||||
dtquery('GetUserGroups', '', function (data) {
|
||||
grouptitle.nextAll().remove();
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var li = $('<li class="subitem"></li>').attr('id', data[i].ID).text(data[i].Name);
|
||||
li.click(param.selectUser);
|
||||
groupsul.append(li);
|
||||
}
|
||||
});
|
||||
|
||||
return this.append(usersul, groupsul);
|
||||
};
|
||||
$.fn.getUserIdType = function () {
|
||||
var li = this.find('li.selected');
|
||||
var id = li.attr('id');
|
||||
var usertype;
|
||||
if (li.parent().attr('usertype') == TYPE_GROUP) {
|
||||
usertype = TYPE_GROUP;
|
||||
} else {
|
||||
usertype = TYPE_USER;
|
||||
}
|
||||
return {
|
||||
'id': id,
|
||||
'type': usertype,
|
||||
'permission': li.data('usertype')
|
||||
};
|
||||
};
|
||||
|
||||
if (typeof Class !== 'function') {
|
||||
|
||||
// 基类实现 (空实现)
|
||||
Class = function () { };
|
||||
|
||||
/* Simple JavaScript Inheritance
|
||||
* By John Resig http://ejohn.org/
|
||||
* MIT Licensed.
|
||||
*/
|
||||
// Inspired by base2 and Prototype
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var initializing = false, fnTest = /xyz/.test(function () { xyz; }) ? /\b_super\b/ : /.*/;
|
||||
|
||||
// 创建一个继承当前调用类的子类
|
||||
Class.extend = function ext(prop) {
|
||||
var _super = this.prototype;
|
||||
|
||||
// 实例化,此时不执行构造方法 (x.prototype.constructor)
|
||||
initializing = true;
|
||||
var prototype = new this();
|
||||
initializing = false;
|
||||
|
||||
// 复制属性到新的prototype中
|
||||
for (var name in prop) {
|
||||
// 判断属性或重载方法
|
||||
prototype[name] = typeof prop[name] == "function" &&
|
||||
typeof _super[name] == "function" && fnTest.test(prop[name]) ?
|
||||
(function (name, fn) {
|
||||
return function () {
|
||||
var tmp = this._super;
|
||||
|
||||
this._super = _super[name];
|
||||
var ret = fn.apply(this, arguments);
|
||||
this._super = tmp;
|
||||
|
||||
return ret;
|
||||
};
|
||||
})(name, prop[name]) :
|
||||
prop[name];
|
||||
}
|
||||
|
||||
// 临时构造方法
|
||||
function Class() {
|
||||
if (!initializing && this.init)
|
||||
this.init.apply(this, arguments);
|
||||
}
|
||||
|
||||
Class.prototype = prototype;
|
||||
// 修正构造方法的指向
|
||||
Class.prototype.constructor = Class;
|
||||
// 添加扩展
|
||||
Class.extend = ext; // arguments.callee;
|
||||
|
||||
return Class;
|
||||
};
|
||||
}());
|
||||
}
|
||||
if (typeof _chartType === 'undefined') {
|
||||
_chartType = {
|
||||
Gauge: 'Gauge',
|
||||
Grid: 'Grid',
|
||||
Grid3D: 'Grid3D',
|
||||
List: 'List',
|
||||
Line2D: 'Line',
|
||||
Line3D: 'Line3D',
|
||||
Column2D: 'Column',
|
||||
Column3D: 'Column3D',
|
||||
Bar2D: 'Bar',
|
||||
Bar3D: 'Bar3D',
|
||||
ColumnLine: 'ColumnLine',
|
||||
Scatter: 'ScatterPlot',
|
||||
Pie: 'Pie',
|
||||
Doughnut: 'Doughnut',
|
||||
Scorecard: 'FreeChart',
|
||||
Rss: 'RSS',
|
||||
Video: 'Video',
|
||||
Stock: 'Stock',
|
||||
Alert: 'Alert',
|
||||
Favorites: 'Favorites',
|
||||
FRPT: 'FRPT'
|
||||
};
|
||||
}
|