add site
This commit is contained in:
334
Site/OTRConfig/ManageHarshDriving.aspx
Normal file
334
Site/OTRConfig/ManageHarshDriving.aspx
Normal file
@ -0,0 +1,334 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/OTRConfig/OTRConfig.master" AutoEventWireup="true" CodeFile="ManageHarshDriving.aspx.cs" Inherits="ManageHarshDriving" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
|
||||
<link href="../css/jquery.datetimepicker.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;
|
||||
width: 800px;
|
||||
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;
|
||||
}
|
||||
</style>
|
||||
<script src="../js/jquery.datetimepicker.full.js"></script>
|
||||
<script src="<%=GetFileUrlWithVersion("js/controls.js")%>" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
otrconfigquery = function (method, param, callback, error) {
|
||||
_network.request("OTRConfig/ManageHarshDriving.aspx", -1, method, param, callback, error);
|
||||
}
|
||||
|
||||
function showList(data) {
|
||||
var rows = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var r = data[i];
|
||||
for (var j in r) {
|
||||
if (j === "AsofTimeLocal")
|
||||
r[j] = { DisplayValue: r["AsofTimeLocalStr"], Value: r[j] };
|
||||
else if (j === "Excluded") {
|
||||
r["SetText"] = r.Excluded ? GetTextByKey("P_MHD_EXCLUDE", "Exclude") : GetTextByKey("P_MHD_EXCLUDE", "Exclude");
|
||||
r[j] = { DisplayValue: r.Excluded ? "Yes" : "No", Value: r[j] };
|
||||
}
|
||||
}
|
||||
var fr = { Values: r };
|
||||
rows.push(fr);
|
||||
}
|
||||
|
||||
grid_dt.setData(rows);
|
||||
}
|
||||
|
||||
var grid_dt;
|
||||
function InitGridData() {
|
||||
grid_dt = new GridView('#harshdrivinglist');
|
||||
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: 'Set', valueIndex: 'SetText', css: { 'width': 60, 'text-align': 'left' } },
|
||||
{ name: 'Excluded', caption: GetTextByKey("P_MHD_EXCLUDED", "Excluded"), valueIndex: 'Excluded', allowFilter: true, css: { 'width': 80, 'text-align': 'left' } },
|
||||
{ name: 'DisplayName', caption: GetTextByKey("P_MHD_ASSETNAME", "Asset Name"), valueIndex: 'DisplayName', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'MakeName', caption: GetTextByKey("P_MHD_MAKE", "Make"), valueIndex: 'MakeName', allowFilter: true, css: { 'width': 100, 'text-align': 'left' } },
|
||||
{ name: 'ModelName', caption: GetTextByKey("P_MHD_MODEL", "Model"), valueIndex: 'ModelName', allowFilter: true, css: { 'width': 100, 'text-align': 'left' } },
|
||||
{ name: 'EventDesc', caption: GetTextByKey("P_MHD_EVENTTYPE", "Event Type"), valueIndex: 'EventDesc', allowFilter: true, css: { 'width': 90, 'text-align': 'left' } },
|
||||
{ name: 'AsofTimeLocal', caption: GetTextByKey("P_MHD_EVENTTIME", "Event Time"), valueIndex: 'AsofTimeLocal', css: { 'width': 110, 'text-align': 'left' } },
|
||||
{ name: 'Street', caption: GetTextByKey("P_MHD_STREET", "Street"), valueIndex: 'Street', css: { 'width': 100, 'text-align': 'left' } },
|
||||
{ name: 'City', caption: GetTextByKey("P_MHD_CITY", "City"), valueIndex: 'City', css: { 'width': 100, 'text-align': 'left' } },
|
||||
{ name: 'State', caption: GetTextByKey("P_MHD_STATE", "State"), valueIndex: 'State', css: { 'width': 90, 'text-align': 'left' } },
|
||||
{ name: 'PostalCode', caption: GetTextByKey("P_MHD_POSTALCODE", "Postal Code"), valueIndex: 'PostalCode', css: { 'width': 60, 'text-align': 'left' } },
|
||||
//{ name: 'Country', caption: GetTextByKey("P_MHD_EXCLUDED", "Country"), valueIndex: 'Country', css: { 'width': 100, 'text-align': 'left' } },
|
||||
{ name: 'StartingSpeed', caption: GetTextByKey("P_MHD_STARTINGSPEED", "Starting Speed"), valueIndex: 'StartingSpeed', css: { 'width': 60, 'text-align': 'right' } },
|
||||
{ name: 'SpeedUnits', caption: GetTextByKey("P_MHD_SPEEDUNITS", "Speed Units"), valueIndex: 'SpeedUnits', css: { 'width': 60, 'text-align': 'right' } },
|
||||
{ name: 'Duration', caption: GetTextByKey("P_MHD_DURATION", "Duration"), valueIndex: 'Duration', css: { 'width': 65, 'text-align': 'right' } },
|
||||
{ name: 'DurationUnits', caption: GetTextByKey("P_MHD_DURATIONUNITS", "Duration Units"), valueIndex: 'DurationUnits', css: { 'width': 65, 'text-align': 'right' } },
|
||||
{ name: 'Magnitude', caption: GetTextByKey("P_MHD_MAGNITUDE", "Magnitude"), valueIndex: 'Magnitude', css: { 'width': 75, 'text-align': 'right' } },
|
||||
{ name: 'MagnitudeUnits', caption: GetTextByKey("P_MHD_MAGNITUDEUNITS", "Magnitude Units"), valueIndex: 'MagnitudeUnits', css: { 'width': 80, 'text-align': 'right' } }
|
||||
];
|
||||
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;
|
||||
col.allowFilter = list_columns[hd].allowFilter;
|
||||
if (col.name === "Set") {
|
||||
col.isurl = true;
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
OnExcluded();
|
||||
}
|
||||
};
|
||||
}
|
||||
columns.push(col);
|
||||
}
|
||||
grid_dt.canMultiSelect = false;
|
||||
grid_dt.columns = columns;
|
||||
grid_dt.init();
|
||||
grid_dt.rowdblclick = OnExcluded;
|
||||
|
||||
grid_dt.selectedrowchanged = function (rowindex) {
|
||||
var rowdata = grid_dt.source[rowindex];
|
||||
if (rowdata) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function OnRefresh() {
|
||||
showloading(true);
|
||||
var startdate = htmlencode($('#startdatetxt').val());
|
||||
var enddate = htmlencode($('#enddatetxt').val());
|
||||
var searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
|
||||
otrconfigquery('GetHarshDrivingEvents', startdate + String.fromCharCode(170) + enddate + String.fromCharCode(170) + searchtxt, function (data) {
|
||||
showloading(false);
|
||||
if (typeof (data) === "string") {
|
||||
showAlert(data, GetTextByKey("P_MHD_ERROR", 'Error'));
|
||||
return;
|
||||
}
|
||||
showList(data);
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
});
|
||||
}
|
||||
|
||||
var rowdata;
|
||||
function OnExcluded() {
|
||||
$('#dialog_notes').val('');
|
||||
var data = grid_dt.source[grid_dt.selectedIndex].Values;
|
||||
if (!data) {
|
||||
rowdata = undefined;
|
||||
return;
|
||||
}
|
||||
rowdata = data;
|
||||
var text = "Exclude";
|
||||
if (rowdata.Excluded.Value)
|
||||
text = "Include";
|
||||
|
||||
$('#dialog_excluded .dialog-title span.title').text(text);
|
||||
showmaskbg(true);
|
||||
$('#dialog_excluded')
|
||||
.attr('act', 'edit')
|
||||
.css({
|
||||
'top': (document.documentElement.clientHeight - $('#dialog_excluded').height()) / 3,
|
||||
'left': (document.documentElement.clientWidth - $('#dialog_excluded').width()) / 2
|
||||
})
|
||||
.showDialog();
|
||||
}
|
||||
|
||||
function OnDialogOK() {
|
||||
if (!rowdata)
|
||||
return;
|
||||
|
||||
var text = GetTextByKey("P_MHD_EXCLUDE", "Exclude");
|
||||
if (rowdata.Excluded.Value)
|
||||
text = GetTextByKey("P_MHD_INCLUDE", "Include");
|
||||
var item = {
|
||||
'LogID': rowdata.LogID,
|
||||
'AssetID': rowdata.AssetID,
|
||||
'Excluded': rowdata.Excluded.Value,
|
||||
'Notes': $('#dialog_notes').val()
|
||||
};
|
||||
var param = JSON.stringify(item);
|
||||
param = htmlencode(param);
|
||||
showloading(true);
|
||||
otrconfigquery("ExcludedHarshDrivingEvents", param, function (data) {
|
||||
showloading(false);
|
||||
if (data !== 'OK') {
|
||||
showAlert(data, alerttitle);
|
||||
} else {
|
||||
$('#dialog_excluded').hideDialog();
|
||||
OnRefresh();
|
||||
}
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
showAlert(GetTextByKey("P_MHD_FAILEDTOEXCLUDEDHARSHDRIVING", 'Failed to excluded harsh driving.'), text + GetTextByKey("P_MHD_HARSHDRIVING", " Harsh Driving"));
|
||||
});
|
||||
}
|
||||
|
||||
$(function () {
|
||||
setPageTitle(GetTextByKey("P_MANAGEHARSHDRIVING", "Manage Harsh Driving"), true);
|
||||
InitGridData();
|
||||
|
||||
OnRefresh();
|
||||
$('#dialog_excluded').dialog(function () {
|
||||
showmaskbg(false);
|
||||
});
|
||||
|
||||
$('#startdatetxt').datetimepicker({
|
||||
timepicker: false,
|
||||
format: 'm/d/Y',
|
||||
enterLikeTab: false,
|
||||
onSelectDate: function (v, inp) {
|
||||
var date = new DateFormatter().formatDate(v, 'm/d/Y 00:00:00');
|
||||
inp.parent().data('val', [date]);
|
||||
}
|
||||
});
|
||||
|
||||
$('#enddatetxt').datetimepicker({
|
||||
timepicker: false,
|
||||
format: 'm/d/Y',
|
||||
enterLikeTab: false,
|
||||
onSelectDate: function (v, inp) {
|
||||
var date = new DateFormatter().formatDate(v, 'm/d/Y 00:00:00');
|
||||
inp.parent().data('val', [date]);
|
||||
}
|
||||
});
|
||||
|
||||
$('#searchinputtxt').keydown(searchEnter);
|
||||
$(window).resize(function () {
|
||||
$("#harshdrivinglist").css("height", $(window).height() - $("#harshdrivinglist").offset().top - 4);
|
||||
grid_dt && grid_dt.resize();
|
||||
}).resize();
|
||||
|
||||
})
|
||||
|
||||
function searchEnter(e) {
|
||||
if (e.keyCode == 13 || e.keyCode == 9) {
|
||||
OnRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
|
||||
<div style="min-width: 400px;">
|
||||
<div class="page_title" data-lgid="P_MANAGEHARSHDRIVING">Manage Harsh Driving</div>
|
||||
<div class="search_bar">
|
||||
<input type="password" autocomplete="new-password" style="display: none" />
|
||||
<span style="padding-left: 5px;" data-lgid="P_MHD_STATDATE_COLON">Start Date: </span>
|
||||
<span>
|
||||
<input id="startdatetxt" type="text" style="width: 100px;" value="<%=BeginDate %>" /></span>
|
||||
<span style="padding-left: 5px;" data-lgid="P_MHD_ENDDATE_COLON">End Date: </span>
|
||||
<span>
|
||||
<input id="enddatetxt" type="text" style="width: 100px;" value="<%=EndDate %>" /></span>
|
||||
<input id="searchinputtxt" type="text" style="width: 200px; margin-left: 5px;" autocomplete="off" />
|
||||
<input class="search" type="button" onclick="OnRefresh();" value="Search" data-lgid="P_MHD_SEARCH" style="margin-left: 5px;" />
|
||||
</div>
|
||||
<div class="function_title">
|
||||
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_MHD_REFRESH">Refresh</span>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div id="harshdrivinglist"></div>
|
||||
</div>
|
||||
|
||||
<div id="mask_bg" style="display: none;">
|
||||
<div class="loading c-spin"></div>
|
||||
</div>
|
||||
|
||||
<div class="dialog" id="dialog_excluded" style="display: none; width: 400px;">
|
||||
<div class="dialog-title"><span class="title" data-lgid="P_MHD_EXCLUDED">Excluded</span><em class="dialog-close"></em></div>
|
||||
<div class="dialog-content">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width: 50px; vertical-align: top;" data-lgid="P_MHD_NOTES_COLON">Notes:</td>
|
||||
<td>
|
||||
<textarea id="dialog_notes" maxlength="1000" tabindex="1" style="width: 300px; height: 100px; margin-top: 3px;"></textarea></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="dialog-func">
|
||||
<input type="button" value="Cancel" class="dialog-close" data-lgid="P_MHD_CANCEL" tabindex="3" />
|
||||
<input type="button" onclick="OnDialogOK();" value="OK" data-lgid="P_MHD_OK" tabindex="2" />
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
57
Site/OTRConfig/ManageHarshDriving.aspx.cs
Normal file
57
Site/OTRConfig/ManageHarshDriving.aspx.cs
Normal file
@ -0,0 +1,57 @@
|
||||
using IronIntel.Contractor;
|
||||
using IronIntel.Contractor.Site.OTRConfig;
|
||||
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 ManageHarshDriving : OTRConfigBasePage
|
||||
{
|
||||
public string BeginDate = "";
|
||||
public string EndDate = "";
|
||||
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)
|
||||
{
|
||||
// todo nothing
|
||||
}
|
||||
}
|
||||
DateTime userlocaldate = SystemParams.ConvertToUserTimeFromUtc(GetCurrentLoginSession().User, DateTime.UtcNow);
|
||||
BeginDate = userlocaldate.AddDays(-6).ToShortDateString();
|
||||
EndDate = userlocaldate.ToShortDateString();
|
||||
}
|
||||
protected override bool AllowCurrentLoginSessionEnter()
|
||||
{
|
||||
var f = base.AllowCurrentLoginSessionEnter();
|
||||
if (!f)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool license = SystemParams.HasLicense("OTRConfig");
|
||||
bool permission = CheckRight(SystemParams.CompanyID, Foresight.Fleet.Services.User.Feature.HARSH_DRIVING);
|
||||
|
||||
return license && permission;
|
||||
}
|
||||
protected override bool ThrowIfNotAllowed
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
304
Site/OTRConfig/ManageSpeeding.aspx
Normal file
304
Site/OTRConfig/ManageSpeeding.aspx
Normal file
@ -0,0 +1,304 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/OTRConfig/OTRConfig.master" AutoEventWireup="true" CodeFile="ManageSpeeding.aspx.cs" Inherits="ManageSpeeding" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
|
||||
<link href="../css/jquery.datetimepicker.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;
|
||||
width: 800px;
|
||||
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;
|
||||
}
|
||||
</style>
|
||||
<script src="../js/jquery.datetimepicker.full.js"></script>
|
||||
<script src="<%=GetFileUrlWithVersion("js/controls.js")%>" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
var groups;
|
||||
otrconfigquery = function (method, param, callback, error) {
|
||||
_network.request("OTRConfig/ManageSpeeding.aspx", -1, method, param, callback, error);
|
||||
}
|
||||
|
||||
function showList(data) {
|
||||
var rows = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var r = data[i];
|
||||
for (var j in r) {
|
||||
if (j === "EventTime")
|
||||
r[j] = { DisplayValue: r["EventTimeStr"], Value: r[j] };
|
||||
}
|
||||
var fr = { Values: r };
|
||||
rows.push(fr);
|
||||
}
|
||||
|
||||
grid_dt.setData(rows);
|
||||
}
|
||||
|
||||
var grid_dt;
|
||||
function InitGridData() {
|
||||
grid_dt = new GridView('#speedinglist');
|
||||
var list_columns = [
|
||||
{ name: 'AssetName', caption: "Asset Name", valueIndex: 'AssetName', css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'Make', caption: "Make", valueIndex: 'Make', css: { 'width': 100, 'text-align': 'left' } },
|
||||
{ name: 'Model', caption: "Model", valueIndex: 'Model', css: { 'width': 100, 'text-align': 'left' } },
|
||||
{ name: 'EventTime', caption: "Event Time", valueIndex: 'EventTime', css: { 'width': 110, 'text-align': 'left' } },
|
||||
{ name: 'Street', caption: "Street", valueIndex: 'Street', css: { 'width': 100, 'text-align': 'left' } },
|
||||
{ name: 'City', caption: "City", valueIndex: 'Street', css: { 'width': 100, 'text-align': 'left' } },
|
||||
{ name: 'State', caption: "State", valueIndex: 'State', css: { 'width': 100, 'text-align': 'left' } },
|
||||
{ name: 'PostalCode', caption: "Postal Code", valueIndex: 'PostalCode', css: { 'width': 100, 'text-align': 'left' } },
|
||||
{ name: 'Country', caption: "Country", valueIndex: 'Country', css: { 'width': 100, 'text-align': 'left' } },
|
||||
{ name: 'TopSpeed', caption: "Top Speed", valueIndex: 'TopSpeed', css: { 'width': 100, 'text-align': 'right' } },
|
||||
{ name: 'PostedSpeedLimit', caption: "Posted Speed Limit", valueIndex: 'PostedSpeedLimit', css: { 'width': 100, 'text-align': 'right' } },
|
||||
{ name: 'SpeedingOverage', caption: "Speeding Overage", valueIndex: 'SpeedingOverage', css: { 'width': 100, 'text-align': 'right' } },
|
||||
{ name: 'Excluded', css: { 'width': 100, '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;
|
||||
if (col.name === "Excluded") {
|
||||
col.isurl = true;
|
||||
col.text = "Excluded";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
OnExcluded();
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
};
|
||||
col.attrs = { 'title': 'Excluded' };
|
||||
}
|
||||
columns.push(col);
|
||||
}
|
||||
grid_dt.canMultiSelect = false;
|
||||
grid_dt.columns = columns;
|
||||
grid_dt.init();
|
||||
grid_dt.rowdblclick = OnExcluded;
|
||||
|
||||
grid_dt.selectedrowchanged = function (rowindex) {
|
||||
var rowdata = grid_dt.source[rowindex];
|
||||
if (rowdata) {
|
||||
uiid = rowdata.Values.ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
function OnRefresh() {
|
||||
showloading(true);
|
||||
var startdate = htmlencode($('#startdatetxt').val());
|
||||
var enddate = htmlencode($('#enddatetxt').val());
|
||||
otrconfigquery('GetSpeedingEvents', startdate + String.fromCharCode(170) + enddate, function (data) {
|
||||
showloading(false);
|
||||
if (typeof (data) === "string") {
|
||||
showAlert(data, 'Error');
|
||||
return;
|
||||
}
|
||||
showList(data);
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
});
|
||||
}
|
||||
|
||||
var rowdata;
|
||||
function OnExcluded() {
|
||||
$('#dialog_notes').val('');
|
||||
var data = grid_dt.source[grid_dt.selectedIndex].Values;
|
||||
if (!data) {
|
||||
rowdata = undefined;
|
||||
return;
|
||||
}
|
||||
rowdata = data;
|
||||
|
||||
$('#dialog_excluded .dialog-title span.title').text('Excluded');
|
||||
showmaskbg(true);
|
||||
$('#dialog_excluded')
|
||||
.attr('act', 'edit')
|
||||
.css({
|
||||
'top': (document.documentElement.clientHeight - $('#dialog_excluded').height()) / 3,
|
||||
'left': (document.documentElement.clientWidth - $('#dialog_excluded').width()) / 2
|
||||
})
|
||||
.showDialog();
|
||||
}
|
||||
|
||||
function OnDialogOK() {
|
||||
if (!rowdata)
|
||||
return;
|
||||
var notes = $('#dialog_notes').val();
|
||||
|
||||
var alerttitle = "Excluded Speeding";
|
||||
showloading(true);
|
||||
otrconfigquery("ExcludedSpeedingEvents", rowdata.AssetID + String.fromCharCode(170) + rowdata.LogID + String.fromCharCode(170) + notes, function (data) {
|
||||
showloading(false);
|
||||
if (data !== 'OK') {
|
||||
showAlert(data, alerttitle);
|
||||
} else {
|
||||
showAlert('Excluded speeding successfully.', alerttitle);
|
||||
$('#dialog_excluded').hideDialog();
|
||||
OnRefresh();
|
||||
}
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
showAlert('Failed to speeding driving.', alerttitle);
|
||||
});
|
||||
}
|
||||
|
||||
$(function () {
|
||||
setPageTitle(GetTextByKey("P_XXXXXX", "Manage Speedings"), true);
|
||||
InitGridData();
|
||||
|
||||
OnRefresh();
|
||||
|
||||
$('#dialog_excluded').dialog(function () {
|
||||
showmaskbg(false);
|
||||
});
|
||||
|
||||
$('#startdatetxt').datetimepicker({
|
||||
timepicker: false,
|
||||
format: 'm/d/Y',
|
||||
enterLikeTab: false,
|
||||
onSelectDate: function (v, inp) {
|
||||
var date = new DateFormatter().formatDate(v, 'm/d/Y 00:00:00');
|
||||
inp.parent().data('val', [date]);
|
||||
}
|
||||
});
|
||||
|
||||
$('#enddatetxt').datetimepicker({
|
||||
timepicker: false,
|
||||
format: 'm/d/Y',
|
||||
enterLikeTab: false,
|
||||
onSelectDate: function (v, inp) {
|
||||
var date = new DateFormatter().formatDate(v, 'm/d/Y 00:00:00');
|
||||
inp.parent().data('val', [date]);
|
||||
}
|
||||
});
|
||||
|
||||
$(window).resize(function () {
|
||||
$("#speedinglist").css("height", $(window).height() - $("#speedinglist").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_XXXXXX">Manage Speedings</div>
|
||||
<div class="search_bar">
|
||||
<input type="password" autocomplete="new-password" style="display: none" />
|
||||
<span style="padding-left: 5px;">Begin Date: </span>
|
||||
<span>
|
||||
<input id="startdatetxt" type="text" style="width: 100px;" value="<%=BeginDate %>" /></span>
|
||||
<span style="padding-left: 5px;">End Date: </span>
|
||||
<span>
|
||||
<input id="enddatetxt" type="text" style="width: 100px;" value="<%=EndDate %>" /></span>
|
||||
<input class="search" type="button" onclick="OnRefresh();" value="Search" style="margin-left: 5px;" />
|
||||
</div>
|
||||
<div class="function_title">
|
||||
<span class="sbutton iconrefresh" onclick="OnRefresh();">Refresh</span>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div id="speedinglist"></div>
|
||||
</div>
|
||||
|
||||
<div id="mask_bg" style="display: none;">
|
||||
<div class="loading c-spin"></div>
|
||||
</div>
|
||||
|
||||
<div class="dialog" id="dialog_excluded" style="display: none; width: 400px;">
|
||||
<div class="dialog-title"><span class="title">Excluded</span><em class="dialog-close"></em></div>
|
||||
<div class="dialog-content">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width: 50px; vertical-align: top;">Notes:</td>
|
||||
<td>
|
||||
<textarea id="dialog_notes" maxlength="1000" tabindex="1" style="width: 300px; height: 100px; margin-top: 3px;"></textarea></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="dialog-func">
|
||||
<input type="button" value="Cancel" class="dialog-close" tabindex="3" />
|
||||
<input type="button" onclick="OnDialogOK();" value="OK" tabindex="2" />
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
38
Site/OTRConfig/ManageSpeeding.aspx.cs
Normal file
38
Site/OTRConfig/ManageSpeeding.aspx.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using IronIntel.Contractor;
|
||||
using IronIntel.Contractor.Site.OTRConfig;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class ManageSpeeding : OTRConfigBasePage
|
||||
{
|
||||
public string BeginDate = "";
|
||||
public string EndDate = "";
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
DateTime userlocaldate = SystemParams.ConvertToUserTimeFromUtc(GetCurrentLoginSession().User, DateTime.UtcNow);
|
||||
BeginDate = userlocaldate.AddDays(-6).ToShortDateString();
|
||||
EndDate = userlocaldate.ToShortDateString();
|
||||
}
|
||||
}
|
42
Site/OTRConfig/OTRConfig.aspx
Normal file
42
Site/OTRConfig/OTRConfig.aspx
Normal file
@ -0,0 +1,42 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/IronIntelMasterPage.master" AutoEventWireup="true" CodeFile="OTRConfig.aspx.cs" Inherits="OTRConfig_OTRConfig" %>
|
||||
|
||||
<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 type="text/javascript">
|
||||
$(function () {
|
||||
setFavoriteDisplay(true);
|
||||
window.changePage(old_hash);
|
||||
});
|
||||
|
||||
function afterpagechanged(hash, name) {
|
||||
setFavorateStyle(hash, name);
|
||||
};
|
||||
</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>
|
||||
<%-- <li class="nav_item" id="nav_managspeeding" page="ManageSpeeding.aspx" title="Manage Speeding"><a href="#nav_managspeeding">
|
||||
<div>
|
||||
<img src="img/speeding.png" />
|
||||
</div>
|
||||
<span>Manage Speeding</span></a></li>--%>
|
||||
<li class="nav_item" id="nav_manageharshdriving" page="ManageHarshDriving.aspx" data-title-lgid="P_MANAGEHARSHDRIVING"><a href="#nav_manageharshdriving">
|
||||
<div>
|
||||
<button class="iconotrconfig "></button>
|
||||
</div>
|
||||
<span data-lgid="P_MANAGEHARSHDRIVING">Manage Harsh Driving</span></a></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>
|
||||
|
40
Site/OTRConfig/OTRConfig.aspx.cs
Normal file
40
Site/OTRConfig/OTRConfig.aspx.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using IronIntel.Contractor;
|
||||
using IronIntel.Contractor.Site.Security;
|
||||
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 OTRConfig_OTRConfig : 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 int FeatureID
|
||||
{
|
||||
get
|
||||
{
|
||||
return Foresight.Fleet.Services.User.Feature.HARSH_DRIVING;
|
||||
}
|
||||
}
|
||||
}
|
82
Site/OTRConfig/OTRConfig.master
Normal file
82
Site/OTRConfig/OTRConfig.master
Normal file
@ -0,0 +1,82 @@
|
||||
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="OTRConfig.master.cs" Inherits="OTRConfig" %>
|
||||
|
||||
<!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;
|
||||
}
|
||||
</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'];
|
||||
|
||||
_network.root = '<%=Page.ResolveUrl("~/")%>';
|
||||
var sitePath = "<%=this.ResolveUrl("~/fic/") %>";
|
||||
|
||||
if (typeof _utility !== 'object') {
|
||||
_utility = {};
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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();
|
||||
});
|
||||
</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>
|
29
Site/OTRConfig/OTRConfig.master.cs
Normal file
29
Site/OTRConfig/OTRConfig.master.cs
Normal file
@ -0,0 +1,29 @@
|
||||
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 OTRConfig : CommonBase
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
try
|
||||
{
|
||||
GetUIStyle();
|
||||
}
|
||||
catch
|
||||
{
|
||||
// TODO: errors when get the ui style.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
40
Site/OTRConfig/css/controls.css
Normal file
40
Site/OTRConfig/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/OTRConfig/img/harshdriving.png
Normal file
BIN
Site/OTRConfig/img/harshdriving.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
Site/OTRConfig/img/speeding.png
Normal file
BIN
Site/OTRConfig/img/speeding.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
397
Site/OTRConfig/js/controls.js
vendored
Normal file
397
Site/OTRConfig/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'
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user