This commit is contained in:
2023-04-28 12:22:26 +08:00
parent 88e0a25ecd
commit c9723008af
1047 changed files with 443540 additions and 1 deletions

View File

@ -0,0 +1,384 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/SystemSettings/SysSettingMasterPage.master" AutoEventWireup="true" CodeFile="AssetAertFilter.aspx.cs" Inherits="AssetAertFilter" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<link type="text/css" href="<%=GetFileUrlWithVersion("../fic/fic/css/Grid.css")%>" rel="stylesheet" />
<link href="<%=GetFileUrlWithVersion("../fic/css/datepicker.min.css")%>" rel="stylesheet" />
<link href="<%=Common.GenerateUrl("../fic/fic/css/form.css") %>" rel="stylesheet" />
<link href="<%=Common.GenerateUrl("../fic/fic/css/tabcontrol.css") %>" rel="stylesheet" />
<link href="<%=Common.GenerateUrl("../fic/fic/css/theme.css") %>" rel="stylesheet" />
<link href="<%=Common.GenerateUrl("../fic/fic/css/schedule.css") %>" rel="stylesheet" />
<link href="<%=Common.GenerateUrl("../fic/fic/css/workspace.css") %>" rel="stylesheet" />
<link href="<%=Common.GenerateUrl("../fic/fic/css/pivot.css") %>" rel="stylesheet" />
<link type="text/css" href="<%=Common.GenerateUrl("../fic/fic/js/components/css/datagrid.css") %>" rel="stylesheet" />
<link type="text/css" href="<%=Common.GenerateUrl("../css/override.css") %>" rel="stylesheet" />
<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: 24px;
height: 24px;
vertical-align: middle !important;
}
.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;
}
.edit-content table td input[type="radio"] {
border: none;
width: unset;
height: unset;
}
.edit-content table td textarea {
height: 100px;
resize: none;
/*max-width: 200px;*/
}
.div_filter {
margin-top: -3px;
}
.div_filter .dropdown {
width: 322px;
margin: 2px 0 0 0px;
}
.div_panel {
min-width: 200px;
}
.a {
text-decoration: none;
color: #2140fb;
}
.subtitle {
margin: 20px 40px 10px 0px;
font-size: 16px;
color: gray;
}
.subtitle span {
margin-left: 10px;
}
.subtitle hr {
background-color: #d8d8d8;
border: none;
height: 1px;
margin: 0;
}
.machinetd {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.tab-header {
float: left;
padding: 2px 6px;
cursor: pointer;
border: 1px solid #fff;
border-bottom: none;
}
.tab-header:hover {
background: #eee;
}
.tab-header.selected {
border-color: #d8d8d8;
cursor: default;
}
.tab-header.selected:hover {
background: #fff;
}
.ctl_button {
font-family: 'CalciteWebCoreIcons';
display: block;
margin: 6px auto;
width: 60px;
height: 22px;
line-height: 21px;
padding: 0;
}
.gridchartheader td {
font-weight: normal;
}
.div_module {
font-weight: 700;
}
.table_module {
line-height: 30px;
margin-left: 20px;
margin-bottom: 15px;
}
.td_module {
width: 200px;
font-weight: bold;
}
.label { /*cover tab.css*/
display: table-cell;
}
.login_lable {
height: 24px;
line-height: 24px;
}
.sbutton {
font-weight: 200;
}
</style>
<script type="text/javascript" src="<%=GetFileUrlWithVersion("../fic/js/lib/vue.min.js")%>"></script>
<script src="<%=GetFileUrlWithVersion("../js/controls.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../fic/js/utility.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../fic/fic/js/controls/gridctrl.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../fic/fic/js/controls/editGridCtrl.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../fic/fic/js/controls/dialog.js")%>" type="text/javascript"></script>
<script type="text/javascript" src="<%=GetFileUrlWithVersion("../fic/fic/js/components/datagrid.js")%>"></script>
<%--<script src="<%=GetFileUrlWithVersion("../fic/fic/js/controls/controls.js") %>"></script>--%>
<script src="<%=GetFileUrlWithVersion("../fic/fic/js/pivot.js")%>"></script>
<script src="<%=GetFileUrlWithVersion("../fic/fic/js/chart.js") %>"></script>
<script src="<%=GetFileUrlWithVersion("../fic/fic/js/workspace.js") %>"></script>
<script src="<%=GetFileUrlWithVersion("../fic/fic/js/controls/form.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../js/utility.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../js/language.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../js/modulelang.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../js/assetselector.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("js/userfilter.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../fic/fic/js/Management/func.js") %>"></script>
<script type="text/javascript">
var uid = '<%=IID%>';
function useroptionsrequest(method, param, callback, error) {
_network.request("SystemSettings/AssetAertFilter.aspx", -1, method, param, callback, error || function (e) {
console.log(e);
showmaskbg(false, true);
showAlert(GetTextByKey('P_SET_QUERY', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_SET_QUERY', 'Query'));
});
}
function OnRefresh() {
allFilterAssetTypes = undefined;
allFilterJobsites = undefined;
allFilterAssetGroups = undefined;
userfiltertemplateloaded = true;
getUserFilterData();
}
function OnSave() {
var filtertemplates = [];
$("#sel_filtertemplate option").each(function () {
var temp = { 'Id': $(this).val(), 'Name': $(this).text() };
var filterdata = $(this).data('filterdata');
if (filterdata) {
if (filterdata.Assets)
temp.Assets = filterdata.Assets;
if (filterdata.AssetGroups)
temp.AssetGroups = filterdata.AssetGroups;
if (filterdata.AssetTypes)
temp.AssetTypes = filterdata.AssetTypes;
if (filterdata.Jobsites)
temp.Jobsites = filterdata.Jobsites;
}
if (temp.Id < 0 || (temp.Id > 0 && filterdata))
filtertemplates.push(temp);
})
var param = JSON.stringify({
'FilterTemplates': filtertemplates,
'DeleteFilterTemplates': deletefiltertemplates
});
showloading(true);
param = htmlencode(param);
useroptionsrequest("SaveAssetAlertFilter", param, function (data) {
showloading(false);
if (data !== 'OK') {
showAlert(data, GetTextByKey("P_XXXX", 'Save Asset Alert Filter'));
} else {
getUserFilterData();
showAlert(GetTextByKey("P_SET_SAVSUCCESSFULLY", "Saved Successfully."), GetTextByKey("P_XXXX", 'Save Asset Alert Filter'));
}
}, function (err) {
showloading(false);
});
}
var userfiltertemplateloaded = false;
$(function () {
OnRefresh();
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div style="padding: 0px; margin: 0px;">
<div class="function_title">
<span class="sbutton iconsave" onclick="OnSave();" data-lgid="P_SET_SAVE">Save</span>
</div>
<div class="clear"></div>
<div class="content_main content_div">
<div class="edit-content">
<div id="div_container">
<div style="margin: 9px 6px 20px">
<span class="title" data-lgid="P_XXXX">Filter Templates:</span>
<select id="sel_filtertemplate" style="width: 300px;"></select>
<span class="sbutton iconadd" onclick="onOpenFilterTemplate(0);" data-lgid="P_UM_ADD"></span>
<span class="sbutton iconedit" onclick="onOpenFilterTemplate(1);" data-lgid="P_UM_EDIT"></span>
<span class="sbutton iconcopy" onclick="onOpenFilterTemplate(2);" data-lgid="P_IPT_COPY"></span>
<span class="sbutton icondelete" onclick="onDeleteFilterTemplate();" data-lgid="P_UM_DELETE"></span>
</div>
<div style="display: inline-block;">
<div class="machine_filter" style="margin: 9px 6px 5px">
<span class="title" data-lgid="P_UM_ASSETASS">Asset(s)</span>
<span class="sbutton iconadd" onclick="OnFilterAssetAdd()" data-lgid="P_UM_ADD">Add</span>
<span class="sbutton icondelete" onclick="OnFilterMachineDelete()" data-lgid="P_UM_DELETE">Delete</span>
</div>
<div id="selectedfilterassetlist" style="height: 200px; width: 760px;"></div>
</div>
<div>
<div class="machine_filter" style="margin: 9px 6px 5px">
<span class="title" data-lgid="P_UM_ASSETGROUPS">Asset Group(s)</span>
<span class="sbutton iconadd" onclick="OnFilterAssetGroupAdd()" data-lgid="P_UM_ADD">Add</span>
<span class="sbutton icondelete" onclick="OnFilterAssetGroupDelete()" data-lgid="P_UM_DELETE">Delete</span>
</div>
<div id="selectedfilterassetgrouplist" style="height: 200px; width: 760px;"></div>
</div>
<div>
<div class="machine_filter" style="margin: 9px 6px 5px">
<span class="title" data-lgid="P_UM_JOBSITES">Jobsite(s)</span>
<span class="sbutton iconadd" onclick="OnFilterJobsiteAdd()" data-lgid="P_UM_ADD">Add</span>
<span class="sbutton icondelete" onclick="OnFilterJobsiteDelete()" data-lgid="P_UM_DELETE">Delete</span>
</div>
<div id="selectedfilterjobsitelist" style="height: 200px; width: 760px;"></div>
</div>
<div>
<div class="machine_filter" style="margin: 9px 6px 5px">
<span class="title" data-lgid="P_UM_ASSETTYPES">Asset Type(s)</span>
<span class="sbutton iconadd" onclick="OnFilterAssetTypeAdd()" data-lgid="P_UM_ADD">Add</span>
<span class="sbutton icondelete" onclick="OnFilterAssetTypeDelete()" data-lgid="P_UM_DELETE">Delete</span>
</div>
<div id="selectedfilterassettypelist" style="height: 200px; width: 760px;"></div>
</div>
<div class="mask_loading dialog" style="display: none;"></div>
</div>
</div>
</div>
</div>
<div class="dialog" id="dialog_filterassetgroup" style="display: none; width: 650px;">
<div class="dialog-title"><span class="title" data-lgid="P_UM_SELECTASSETGROUPS">Select Asset Groups</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<div style="position: relative; width: 470px; margin-top: 4px; float: left">
<input type="text" placeholder="Search" id="txt_filterassetgroup_key" autocomplete="off" style="width: 100%; padding-right: 28px; height: 25px; line-height: 25px; box-sizing: border-box; text-indent: 4px;" />
<div style="position: absolute; top: 0px; right: 0px; height: 25px; width: 28px; text-align: center; line-height: 25px; font-size: 1.2em; font-family: FontAwesome; font-weight: 900; color: rgb(123, 28, 33); cursor: pointer;" onclick="GetFilerAssetGroupList()">&#xf002;</div>
</div>
<div style="clear: both;"></div>
<div id="availablefilterassetgrouplist" style="height: 400px; width: 630px; margin: 10px 0 4px;"></div>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_UM_CANCEL" class="dialog-close" tabindex="18" style="height: 26px;" />
<input type="button" onclick="OnSetFilterSelectAssetGroups();" value="OK" data-lgid="P_UM_OK" tabindex="17" />
<div class="clear"></div>
</div>
<div class="maskbg" style="display: none;"></div>
</div>
<div class="dialog" id="dialog_filterjobsite" style="display: none; width: 650px;">
<div class="dialog-title"><span class="title" data-lgid="P_UM_SELECTJOBSITES">Select Jobsites</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<div style="position: relative; width: 470px; margin-top: 4px; float: left">
<input type="text" placeholder="Search" id="txt_filterjobsite_key" autocomplete="off" style="width: 100%; padding-right: 28px; height: 25px; line-height: 25px; box-sizing: border-box; text-indent: 4px;" />
<div style="position: absolute; top: 0px; right: 0px; height: 25px; width: 28px; text-align: center; line-height: 25px; font-size: 1.2em; font-family: FontAwesome; font-weight: 900; color: rgb(123, 28, 33); cursor: pointer;" onclick="GetFilterJobsiteList()">&#xf002;</div>
</div>
<div style="clear: both;"></div>
<div id="filteravailablejobsitelist" style="height: 400px; width: 630px; margin: 10px 0 4px;"></div>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_UM_CANCEL" class="dialog-close" tabindex="18" style="height: 26px;" />
<input type="button" onclick="OnSetFilterSelectJobSites();" value="OK" data-lgid="P_UM_OK" tabindex="17" />
</div>
<div class="maskbg" style="display: none;"></div>
</div>
<div class="dialog" id="dialog_filterassettype" style="display: none; width: 650px;">
<div class="dialog-title"><span class="title" data-lgid="P_UM_SELECTASSETTYPES">Select Asset Types</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<div style="position: relative; width: 470px; margin-top: 4px; float: left">
<input type="text" placeholder="Search" id="txt_filterassettype_key" autocomplete="off" style="width: 100%; padding-right: 28px; height: 25px; line-height: 25px; box-sizing: border-box; text-indent: 4px;" />
<div style="position: absolute; top: 0px; right: 0px; height: 25px; width: 28px; text-align: center; line-height: 25px; font-size: 1.2em; font-family: FontAwesome; font-weight: 900; color: rgb(123, 28, 33); cursor: pointer;" onclick="GetFilterAssetTypeList()">&#xf002;</div>
</div>
<div style="clear: both;"></div>
<div id="filteravailableassettypelist" style="height: 400px; width: 630px; margin: 10px 0 4px;"></div>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_UM_CANCEL" class="dialog-close" tabindex="18" style="height: 26px;" />
<input type="button" onclick="OnSetFilterSelectAssetTypes();" value="OK" data-lgid="P_UM_OK" tabindex="17" />
</div>
<div class="maskbg" style="display: none;"></div>
</div>
<div class="dialog" id="dialog_filtertemplate" style="display: none; width: 500px;">
<div class="dialog-title"><span class="title" data-lgid="P_XXX">Add Filter Template</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table style="line-height: 30px; table-layout: fixed;">
<tr>
<td class="label" style="width: 160px;" data-lgid="P_XXX">Template Name:</td>
<td style="width: 330px;">
<input type="text" id="dialog_filtertemplatename" tabindex="1" maxlength="200" autocomplete="off" /></td>
</tr>
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_UM_CANCEL" class="dialog-close" tabindex="18" style="height: 26px;" />
<input type="button" onclick="OnSetFilterTemplate();" value="OK" data-lgid="P_UM_OK" tabindex="17" />
</div>
<div class="maskbg" style="display: none;"></div>
</div>
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
</asp:Content>

View File

@ -0,0 +1,32 @@
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.SystemSettings;
public partial class AssetAertFilter : SystemSettingsBasePage
{
public string IID = "";
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 = GetCurrentUser().IID;
}
}
}
}

View File

@ -0,0 +1,386 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/SystemSettings/SysSettingMasterPage.master" AutoEventWireup="true" CodeFile="ManageDepartments.aspx.cs" Inherits="ManageDepartments" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<style type="text/css">
::-ms-clear, ::-ms-reveal {
display: none;
}
.selectinput {
width: 150px;
margin-right: 10px;
}
.dialog-content table {
border-collapse: collapse;
width: 100%;
}
.dialog-content table td.label {
width: 120px;
text-align: right;
padding-right: 10px;
line-height: 30px;
height: 24px;
vertical-align: top;
}
.dialog-content table td input,
.dialog-content table td textarea {
border: 1px solid #a9a9a9;
width: 200px;
height: 18px;
padding: 1px;
}
.dialog-content table td input[type="checkbox"] {
border: none;
}
.dialog-content table td textarea {
height: 100px;
/*max-width: 200px;*/
}
#dialogdatatb td {
padding-top: 30px;
}
.a {
text-decoration: none;
color: #2140fb;
}
</style>
<script type="text/javascript" src="<%=GetFileUrlWithVersion("../js/vue.min.js")%>"></script>
<script>Vue.config.productionTip = false; Vue.config.silent = true;</script>
<script type="text/javascript" src="<%=GetFileUrlWithVersion("../js/components/datagrid.js")%>"></script>
<script type="text/javascript">
var DataGrid = window.DataGrid || window['g5-datagrid'];
function departmentrequest(method, param, callback, error) {
_network.request("SystemSettings/ManageDepartments.aspx", -1, method, param, callback, error || function (e) {
showmaskbg(false, true);
showAlert(GetTextByKey('P_SET_QUERY', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_SET_QUERY', 'Query'));
});
}
function OnAdd(pid) {
departmentID = undefined;
pID = pid;
$('#dialog_code').val('');
$('#dialog_name').val('');
$('#dialog_notes').val('');
$('#dialog_department .dialog-title span.title').text(GetTextByKey("P_SET_ADDDEPARTMENT", "Add Department"));
showmaskbg(true);
$('#dialog_department')
.css({
'top': (document.documentElement.clientHeight - $('#dialog_department').height()) / 3,
'left': (document.documentElement.clientWidth - $('#dialog_department').width()) / 2
}).showDialogfixed();
$('#dialog_name').focus();
}
var departmentID;
var pID;
function OnEdit() {
var index = vue.$refs.grid.selectedIndex;
if (index < 0) {
showAlert(GetTextByKey("P_SET_PLEASESELECTDEPARTMENT", "Please select Department."), GetTextByKey("P_SET_EDITLOCATIONS", "Edit Department")); return;
}
var department = vue.$refs.grid.source[index];
if (!department) {
departmentID = undefined;
pID = undefined;
return;
}
departmentID = department.Id;
pID = department.PId;
$('#dialog_code').val(department.Code);
$('#dialog_name').val(department.Name);
$('#dialog_notes').val(department.Notes);
$('#dialog_department .dialog-title span.title').text(GetTextByKey("P_SET_EDITDEPARTMENT", "Edit Department"));
showmaskbg(true);
$('#dialog_department')
.css({
'top': (document.documentElement.clientHeight - $('#dialog_department').height()) / 3,
'left': (document.documentElement.clientWidth - $('#dialog_department').width()) / 2
}).showDialogfixed();
$('#dialog_name').focus();
}
function OnDblClick(e) {
OnEdit();
}
function OnDelete() {
var index = vue.$refs.grid.selectedIndex;
if (index < 0) {
return;
}
var dep = vue.$refs.grid.source[index];
if (!dep) {
return;
}
showConfirm(GetTextByKey("P_SET_DOYOUWANTTODELETETHEDEPARTMENT", 'Do you want to delete the department?'), GetTextByKey("P_SET_DELETEDEPARTMENT", "Delete Department"), function () {
departmentrequest("DeleteDepartment", dep.Id, function (data) {
if (typeof (data) === "string")
showAlert(data, GetTextByKey("P_SET_DELETEDEPARTMENT", "Delete Department"));
else
OnRefresh();
}, function (err) {
showAlert(GetTextByKey("P_SET_FAILEDTODELETETHISDEPARTMENT", 'Failed to delete this Department.'), GetTextByKey("P_SET_DELETEDEPARTMENT", "Delete Department"));
});
});
}
function OnRefresh() {
showloading(true);
departmentrequest("GetDepartments", "", function (data) {
showloading(false);
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_SET_ERROR", 'Error'));
return;
}
if (data)
showDepartments(data);
}, function (err) {
showloading(false);
});
}
function showDepartments(data) {
for (var i = 0; i < data.length; i++) {
var r = data[i];
}
vue.source = data;
}
var vue;
//加载表格
function initGrid() {
showmaskbg(true);
vue = new Vue({
el: "#departmentlist",
components: {
'data-grid': DataGrid
},
data: {
columns: CreateStyleColumn(),
source: [],
totalRow: null
},
methods: {
rowdblclick: function () {
OnEdit();
}
}
});
showmaskbg(false);
}
//创建列表的行
function CreateStyleColumn() {
var list_columns = [
{ name: 'Name', caption: GetTextByKey("P_SET_DEPARTMENTNAME", "Department Name"), valueIndex: 'Name', type: 0, css: { 'width': 200, 'text-align': 'left' } },
{ name: 'Code', caption: GetTextByKey("P_SET_CODE", "Code"), valueIndex: 'Code', type: 0, css: { 'width': 200, 'text-align': 'left' } },
{ name: 'Notes', caption: GetTextByKey("P_SET_NOTES", "Notes"), valueIndex: 'Notes', type: 0, css: { 'width': 280, 'text-align': 'left' } },
{ name: 'AddSub', caption: "", valueIndex: 'Add', type: 5, css: { 'width': 30, 'text-align': 'center' } },
{ name: 'Edit', caption: "", valueIndex: 'Edit', type: 5, css: { 'width': 30, 'text-align': 'center' } },
{ name: 'Delete', caption: "", valueIndex: 'Delete', type: 5, 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.type = list_columns[hd].type;
col.enabled = true;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
col.sortable = false;
if (col.name === "Name") {
col.styleFilter = function (e) {
if (e.PId > 0)
return { 'padding-left': '24px' };
else
return { 'font-weight': 'bold' };
}
}
else if (col.name === "AddSub") {
col.onclick = function (e) {
var index = vue.$refs.grid.selectedIndex;
if (index < 0) return;
var dep = vue.$refs.grid.source[index];
OnAdd(dep.Id);
};
col.filter = function (e) {
if (e.PId > 0)
return "";
else
return "\uf067";
}
col.styleFilter = function (e) {
if (e.PId > 0)
return { 'dispaly': 'none' };
else
return {
'font-family': 'FontAwesome',
'cursor': 'pointer',
'color': 'rgb(123, 28, 33)'
};
}
col.attrs = { 'title': GetTextByKey("P_SET_ADD", 'Add') };
}
else if (col.name === "Edit") {
col.filter = function () {
return '\uf044';
};
col.onclick = function (e) {
OnEdit();
};
col.styleFilter = function (e) {
return {
'font-family': 'FontAwesome',
'cursor': 'pointer',
'color': 'rgb(123, 28, 33)'
};
}
col.attrs = { 'title': GetTextByKey("P_SET_EDIT", 'Edit') };
}
else if (col.name === "Delete") {
col.filter = function () {
return '\uf00d';
};
col.onclick = function (e) {
OnDelete();
};
col.styleFilter = function (e) {
return {
'font-family': 'FontAwesome',
'cursor': 'pointer',
'color': 'rgb(123, 28, 33)'
};
}
col.attrs = { 'title': GetTextByKey("P_SET_DELETE", 'Delete') };
}
columns.push(col);
}
return columns;
}
function OnDialogOK() {
var item = {
'Code': $.trim($('#dialog_code').val()),
'Name': $.trim($('#dialog_name').val()),
'Notes': $.trim($('#dialog_notes').val())
};
var alerttitle;
if (departmentID) {
item.Id = departmentID;
item.PId = pID;
alerttitle = GetTextByKey("P_SET_EDITDEPARTMENT", "Edit Department");
} else {
item.Id = -1;
item.PId = pID;
alerttitle = GetTextByKey("P_SET_ADDDEPARTMENT", "Add Department");
}
if (!item.Code || item.Code.length == 0) {
showAlert(GetTextByKey("P_SET_CODECANNOTBEEMPTY", 'Code cannot be empty.'), alerttitle);
$('#dialog_code').focus();
return;
}
if (!item.Name || item.Name.length == 0) {
showAlert(GetTextByKey("P_SET_DEPARTMENTNAMECANNOTBEEMPTY", 'Department name cannot be empty.'), alerttitle);
$('#dialog_name').focus();
return;
}
departmentrequest("SaveDepartment", htmlencode(JSON.stringify(item)), function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_SET_ERROR", 'Error'));
return;
}
showmaskbg(false);
$('#dialog_department').hideDialog();
OnRefresh();
}, function (err) {
showmaskbg(false);
});
}
$(function () {
setPageTitle(GetTextByKey("P_SET_MANAGEDEPARTMENTS", 'Manage Departments'), true);
initGrid();
OnRefresh();
$('#dialog_department').dialog(function () {
showmaskbg(false);
});
$(window).resize(function () {
$("#departmentlist").css("height", $(window).height() - $("#departmentlist").offset().top - 4);
}).resize();
});
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="recordcontent" style="padding: 0px; margin: 0px;">
<div class="page_title" data-lgid="P_SET_MANAGEDEPARTMENTS">Manage Departments</div>
<div class="function_title">
<span class="sbutton iconadd" onclick="OnAdd();" data-lgid="P_SET_ADD">Add</span>
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_SET_REFRESH">Refresh</span>
</div>
<div class="clear"></div>
<div id="departmentlist">
<data-grid ref="grid" v-bind:columns="columns" v-bind:source="source" v-bind:allow-editing="true" v-on:rowdblclick="rowdblclick"
v-bind:allow-auto-new-row="false" v-bind:total-row="totalRow" body-class="autoHeightBody">
</data-grid>
</div>
<%--<div id="departmentlist"></div>--%>
</div>
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
<div class="dialog" id="dialog_department" style="display: none; width: 500px;">
<div class="dialog-title"><span class="title" data-lgid="P_SET_ADDLOCATIONS">Add Department</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table>
<tr>
<td class="label" data-lgid="P_SET_DEPARTMENTNAME_COLON">Department Name:</td>
<td>
<input type="text" id="dialog_name" maxlength="200" tabindex="1" style="width: 320px;" autocomplete="off" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_CODE_COLON">Code:</td>
<td>
<input type="text" id="dialog_code" maxlength="20" tabindex="1" style="width: 320px;" autocomplete="off" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_NOTES_COLON">Notes:</td>
<td>
<textarea id="dialog_notes" class="inputbox" maxlength="1000" tabindex="1" style="width: 320px;"></textarea></td>
</tr>
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_SET_CANCEL" class="dialog-close" tabindex="8" />
<input type="button" onclick="OnDialogOK();" value="OK" data-lgid="P_SET_OK" tabindex="7" />
<div class="clear"></div>
</div>
</div>
</asp:Content>

View File

@ -0,0 +1,51 @@
using IronIntel.Contractor.Site;
using IronIntel.Contractor.Site.SystemSettings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class ManageDepartments : CustomerProviderBasePage
{
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 ThrowIfNotAllowed
{
get
{
return true;
}
}
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;
}
}

View File

@ -0,0 +1,798 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/SystemSettings/SysSettingMasterPage.master" AutoEventWireup="true" CodeFile="ManageLocations.aspx.cs" Inherits="ManageLocations" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<style type="text/css">
::-ms-clear, ::-ms-reveal {
display: none;
}
.selectinput {
width: 150px;
margin-right: 10px;
}
.dialog-content table {
border-collapse: collapse;
width: 100%;
}
.dialog-content table td.label {
width: 120px;
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: 200px;
height: 18px;
padding: 1px;
}
.dialog-content table td input[type="checkbox"] {
border: none;
}
.dialog-content table td textarea {
height: 100px;
/*max-width: 200px;*/
}
#dialogdatatb td {
padding-top: 30px;
}
.a {
text-decoration: none;
color: #2140fb;
}
#basemapTitle {
position: absolute;
z-index: 2;
bottom: 0px;
width: 90%;
color: #4c4c4c;
margin: 0;
font-size: 10px;
line-height: 12px;
display: block;
padding: 2px 5%;
background: #fff;
background: rgba(255, 255, 255, 0.80);
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
-o-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
text-align: center;
}
#basemapImg {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
background-repeat: no-repeat;
background-position: center center;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
}
#basemapgalleryDiv {
position: absolute;
right: 20px;
top: 40px;
z-index: 199;
background-color: #EFEFEF;
height: 75px;
width: 75px;
border: solid 1px #57585A;
border-radius: 5px;
padding: 1px;
}
#basemapGallery {
position: absolute;
right: 15px;
top: 35px;
width: 370px;
height: 120px;
overflow: auto;
display: none;
z-index: 200;
background-color: #EFEFEF;
}
</style>
<script>
//必须放在地图js之前
var dojoConfig = {
paths: {
extras1: location.pathname.replace(/\/[^/]+$/, "") + "/../js/mapview"
},
cacheBust: true
};
</script>
<script type="text/javascript" src="<%=GetFileUrlWithVersion("../js/vue.min.js")%>"></script>
<script>Vue.config.productionTip = false; Vue.config.silent = true;</script>
<script type="text/javascript" src="<%=GetFileUrlWithVersion("../js/components/datagrid.js")%>"></script>
<link rel="stylesheet" href="https://js.arcgis.com/3.40/esri/css/esri.css" />
<script src="https://js.arcgis.com/3.40"></script>
<script src="<%=GetFileUrlWithVersion("../js/editableselect.js")%>"></script>
<script type="text/javascript" src="<%=GetFileUrlWithVersion("../js/mapcontrol.js")%>"></script>
<script type="text/javascript">
var IsDealer = <%=IsDealer ?"true":"false"%>;
var IsAdmin =<%=IsAdmin ?"true":"false"%>;
var DataGrid = window.DataGrid || window['g5-datagrid'];
function locationrequest(method, param, callback, error) {
_network.request("SystemSettings/ManageLocations.aspx", -1, method, param, callback, error || function (e) {
console.log(e);
showmaskbg(false, true);
showAlert(GetTextByKey('P_SET_QUERY', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_SET_QUERY', 'Query'));
});
}
function OnAdd(pid) {
locationdata = undefined;
locationID = undefined;
pID = pid;
$('#dialog_name').val('');
$('#dialog_code').val('');
$('#dialog_longitude').val('');
$('#dialog_latitude').val('');
$('#dialog_address').val('');
$('#dialog_address2').val('');
$('#dialog_city').val('');
editableSelectState.val('');
$('#dialog_zip').val('');
$('#dialog_notes').val('');
$('#imgfilogo').attr('src', '');
$('#trimg').hide();
$('#dialog_location .dialog-title span.title').text(GetTextByKey("P_SET_ADDLOCATIONS", "Add Location"));
showmaskbg(true);
$('#dialog_location')
.attr('act', 'add')
.css({
'top': (document.documentElement.clientHeight - $('#dialog_location').height()) / 3,
'left': (document.documentElement.clientWidth - $('#dialog_location').width()) / 2
})
.showDialogfixed();
$('#dialog_name').focus();
}
var locationID;
var pID;
var locationdata;
function OnEdit() {
locationdata = undefined;
var index = vue.$refs.grid.selectedIndex;
if (index < 0) {
showAlert(GetTextByKey("P_SET_PLEASESELECTLOCATION", "Please select Location."), GetTextByKey("P_SET_EDITLOCATIONS", "Edit Location")); return;
}
var location = vue.$refs.grid.source[index];
if (!location) {
locationID = undefined;
pID = undefined;
return;
}
locationID = location.ID;
pID = location.PId;
$('#dialog_name').val(location.Name);
$('#dialog_code').val(location.Code);
$('#dialog_longitude').val(location.Longitude);
$('#dialog_latitude').val(location.Latitude);
$('#dialog_address').val(location.Address);
$('#dialog_address2').val(location.Address2);
$('#dialog_city').val(location.City);
editableSelectState.text(location.State);
$('#dialog_zip').val(location.Zip);
$('#dialog_notes').val(location.Notes);
$('#imgfilogo').attr('src', '../titlelogo.ashx?tp=location&cmpid=' + location.ID + "&sn=" + Math.random() + "'");
$('#trimg').show();
$('#dialog_location .dialog-title span.title').text(GetTextByKey("P_SET_EDITLOCATIONS", "Edit Location"));
showmaskbg(true);
$('#dialog_location')
.attr('act', 'edit')
.css({
'top': (document.documentElement.clientHeight - $('#dialog_location').height()) / 3,
'left': (document.documentElement.clientWidth - $('#dialog_location').width()) / 2
})
.showDialogfixed();
$('#dialog_name').focus();
}
function OnDblClick(e) {
OnEdit();
}
function OnDelete() {
var index = vue.$refs.grid.selectedIndex;
if (index < 0) {
return;
}
var loc = vue.$refs.grid.source[index];
if (!loc) {
return;
}
showConfirm(GetTextByKey("P_SET_DOYOUWANTTODELETETHELOCATION", 'Do you want to delete the location?'), GetTextByKey("P_SET_DELETELOCATIONS", "Delete Location"), function () {
locationrequest("DeleteCustomerLocation", loc.ID, function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_SET_DELETELOCATIONS", "Delete Location"));
}
else
OnRefresh();
}, function (err) {
showAlert(GetTextByKey("P_SET_FAILEDTODELETETHISLOCATION", 'Failed to delete this Location.'), GetTextByKey("P_SET_DELETELOCATIONS", "Delete Location"));
});
});
}
function OnRefresh() {
showloading(true);
var searchtxt = "";
searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
locationrequest("GetCustomerLocations", searchtxt, function (data) {
showloading(false);
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_SET_ERROR", 'Error'));
return;
}
showLocations(data);
}, function (err) {
console.log(err);
showloading(false);
});
}
function showLocations(data) {
for (var i = 0; i < data.length; i++) {
var r = data[i];
r.LogoUrl = "../titlelogo.ashx?tp=location&cmpid=" + r.ID + "&sn=" + Math.random();
r.Edit = "\uf044";
r.Delete = "\uf00d";
}
vue.source = data;
}
var vue;
//加载表格
function initGrid() {
showmaskbg(true);
vue = new Vue({
el: "#locationlist",
components: {
'data-grid': DataGrid
},
data: {
columns: CreateStyleColumn(),
source: [],
totalRow: null
},
methods: {
rowdblclick: function () {
OnEdit();
}
}
});
showmaskbg(false);
}
//创建列表的行
function CreateStyleColumn() {
var list_columns = [
{ name: 'Name', caption: GetTextByKey("P_SET_LOCATIONSNAME", "Location Name"), valueIndex: 'Name', type: 0, css: { 'width': 200, 'text-align': 'left' } },
{ name: 'Code', caption: GetTextByKey("P_SET_CODE", "Code"), valueIndex: 'Code', type: 0, css: { 'width': 200, 'text-align': 'left' } },
//{ name: 'Latitude', caption: GetTextByKey("P_SET_LATITUDE", "Latitude"), valueIndex: 'Latitude', type: 0, css: { 'width': 150, 'text-align': 'left' } },
//{ name: 'Longitude', caption: GetTextByKey("P_SET_LONGITUDE", "Longitude"), valueIndex: 'Longitude', type: 0, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'Address', caption: GetTextByKey("P_SET_ADDRESS1", "Address 1"), valueIndex: 'Address', type: 0, css: { 'width': 200, 'text-align': 'left' } },
{ name: 'Address2', caption: GetTextByKey("P_SET_ADDRESS2", "Address 2"), valueIndex: 'Address2', type: 0, css: { 'width': 200, 'text-align': 'left' } },
{ name: 'City', caption: GetTextByKey("P_SET_CITY", "City"), valueIndex: 'City', type: 0, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'State', caption: GetTextByKey("P_SET_STATE", "State"), valueIndex: 'State', type: 0, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'Zip', caption: GetTextByKey("P_SET_ZIP", "Zip"), valueIndex: 'Zip', type: 0, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'LogoUrl', caption: GetTextByKey("P_SET_LOGO", "Logo"), valueIndex: "LogoUrl", type: 7, css: { 'width': 80, 'text-align': 'left' } },
{ name: 'Notes', caption: GetTextByKey("P_SET_NOTES", "Notes"), valueIndex: 'Notes', type: 0, css: { 'width': 280, 'text-align': 'left' } },
{ name: 'AddSub', caption: "", valueIndex: 'Add', type: 5, css: { 'width': 30, 'text-align': 'center' } },
{ name: 'Location', caption: "", valueIndex: 'Location', type: 5, css: { 'width': 30, 'text-align': 'center' } },
{ name: 'Edit', caption: "", valueIndex: 'Edit', type: 5, css: { 'width': 30, 'text-align': 'center' } },
{ name: 'Delete', caption: "", valueIndex: 'Delete', type: 5, 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.type = list_columns[hd].type;
col.enabled = 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 === "Name") {
col.styleFilter = function (e) {
if (e.PId > 0)
return { 'padding-left': '24px' };
else
return { 'font-weight': 'bold' };
}
}
else if (col.name === "AddSub") {
col.onclick = function (e) {
var index = vue.$refs.grid.selectedIndex;
if (index < 0) return;
var dep = vue.$refs.grid.source[index];
OnAdd(dep.ID);
};
col.filter = function (e) {
if (e.PId > 0)
return "";
else
return "\uf067";
}
col.styleFilter = function (e) {
if (e.PId > 0)
return { 'dispaly': 'none' };
else
return {
'font-family': 'FontAwesome',
'cursor': 'pointer',
'color': 'rgb(123, 28, 33)'
};
}
col.attrs = { 'title': GetTextByKey("P_SET_ADD", 'Add') };
}
else if (col.name === "LogoUrl") {
col.styleFilter = function (item) {
return { width: '60px' };
}
}
else if (col.name === "Edit") {
col.onclick = function (e) {
OnEdit();
};
col.styleFilter = function (e) {
return {
'font-family': 'FontAwesome',
'cursor': 'pointer',
'color': 'rgb(123, 28, 33)'
};
}
col.attrs = { 'title': GetTextByKey("P_SET_EDIT", 'Edit') };
}
else if (col.name === "Delete") {
col.onclick = function (e) {
OnDelete();
};
col.styleFilter = function (e) {
return {
'font-family': 'FontAwesome',
'cursor': 'pointer',
'color': 'rgb(123, 28, 33)'
};
}
col.attrs = { 'title': GetTextByKey("P_SET_DELETE", 'Delete') };
}
else if (col.name === "Location") {
col.onclick = function (e, item) {
locationdata = item;
SelectLocation();
};
col.filter = function (e) {
return "\uf3c5";
}
col.styleFilter = function (e) {
return {
'font-family': 'FontAwesome',
'cursor': 'pointer',
'color': 'rgb(123, 28, 33)'
};
}
col.attrs = { 'title': GetTextByKey("P_SET_SELECTLOCATION", 'Select Location') };
}
columns.push(col);
}
return columns;
}
function OnDialogOK() {
var item = {
'Name': $.trim($('#dialog_name').val()),
'Code': $.trim($('#dialog_code').val()),
'Latitude': $.trim($('#dialog_latitude').val()),
'Longitude': $.trim($('#dialog_longitude').val()),
'Address': $.trim($('#dialog_address').val()),
'Address2': $.trim($('#dialog_address2').val()),
'City': $.trim($('#dialog_city').val()),
'State': $.trim(editableSelectState.text()),
'Zip': $.trim($('#dialog_zip').val()),
'Notes': $.trim($('#dialog_notes').val())
};
var alerttitle;
if (locationID) {
item.ID = locationID;
item.PId = pID;
alerttitle = GetTextByKey("P_SET_EDITLOCATIONS", "Edit Location");
} else {
item.ID = -1;
item.PId = pID;
alerttitle = GetTextByKey("P_SET_ADDLOCATIONS", "Add Location");
}
if (!item.Name || item.Name.length == 0) {
showAlert(GetTextByKey("P_SET_LOCATIONNAMECANNOTBEEMPTY", 'Location name cannot be empty.'), alerttitle);
$('#dialog_name').focus();
return;
}
if (item.Name.length > 100) {
showAlert(GetTextByKey("P_SET_LOCATIONNAMEISTOOLONG", 'Location name is too long (> 100 characters).'), alerttitle);
$('#dialog_name').focus();
return;
}
if (item.Latitude === "" || isNaN(item.Latitude) || item.Latitude > 90 || item.Latitude < -90)
item.Latitude = 0;
if (item.Longitude === "" || isNaN(item.Longitude) || item.Longitude > 180 || item.Longitude < -180)
item.Longitude = 0;
if (item.Notes.length > 2000) {
showAlert(GetTextByKey("P_SET_NOTESISTOOLONG", 'Notes is too long (> 2000 characters).'), alerttitle);
$('#dialog_notes').focus();
return;
}
showloading(true);
var formData = new FormData();
formData.append("fiLogoFile", fiLogoFile);
formData.append("MethodName", "SaveCustomerLocation");
formData.append("ClientData", htmldecode(JSON.stringify(item)));
$.ajax({
url: 'ManageLocations.aspx',
type: 'POST',
dataType: 'json',
processData: false,
contentType: false,
data: formData,
async: true,
success: function (result) {
showloading(false);
if (result == "OK") {
$('#dialog_location').hideDialog();
fiLogoFile = undefined;
OnRefresh();
}
else {
showAlert(result, GetTextByKey("P_SET_SAVELOCATIONS", 'Save Location'));
}
},
error: function (err) {
showloading(false);
showAlert(err.statusText, GetTextByKey("P_SET_SAVELOCATIONS", 'Save Location'));
}
});
}
var editableSelectState;
$(function () {
setPageTitle(GetTextByKey("P_SET_MANAGELOCATIONS", 'Manage Locations'), true);
initGrid();
$('#btnBrowseLogo').click(browseLogo);
editableSelectState = new $editableselect($("#dialog_state"), 50);
editableSelectState.tabIndex(1);
OnRefresh();
getStates();
$('#dialog_location').dialog(function () {
showmaskbg(false);
});
$('#dialog_selectlocation').dialog(function () {
if (!$("#dialog_location").is(":visible"))
showmaskbg(false);
});
$('#searchinputtxt').keydown(searchEnter);
$(window).resize(function () {
$("#locationlist").css("height", $(window).height() - $("#locationlist").offset().top - 4);
}).resize();
});
var statedata = [];
function getStates() {
statedata.push("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ",
"NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY");
editableSelectState.datasource = statedata;
editableSelectState.valuepath = ""
editableSelectState.displaypath = "";
}
var fiLogoFile = undefined;
function browseLogo() {
var file = $('<input type="file" style="display: none;" accept="image/png,image/jpeg" />')
file.change(function () {
if (!/image\/\w+/.test(this.files[0].type)) {
showAlert(GetTextByKey("P_SET_LOCATIONLOGOISINVALID", 'The file type for the location logo is invalid. The file must be JPG or PNG.'), GetTextByKey("P_SET_SAVELOCATIONS", 'Save Location'));
return;
}
fiLogoFile = this.files[0];
$("#imgfilogo").attr('src', window.URL.createObjectURL(fiLogoFile));
$('#trimg').show();
}).click();
}
function searchEnter(e) {
if (e.keyCode == 13 || e.keyCode == 9) {
OnRefresh();
}
}
var mapctrl;
function SelectLocation() {
var d = $('#dialog_selectlocation');
if (!mapctrl)
mapctrl = new $mapcontrol(setmaplocation, onlocselectchanged);
else
setmaplocation();
$('#dialog_selectlocation .dialog-title span.title').text(GetTextByKey("P_SET_SELECTLOCATION", "Select Location"));
showmaskbg(true);
d.css({
'top': (document.documentElement.clientHeight - d.height()) / 3,
'left': (document.documentElement.clientWidth - d.width()) / 2
}).showDialogfixed();
}
function onlocselectchanged(lat, long) {
$("#lbllatitude").text(lat);
$("#lbllongtude").text(long);
}
function setmaplocation() {
$("#lbllatitude").text("");
$("#lbllongtude").text("");
mapctrl.setLocation(0, 0);
var latitude = 0;
var longitude = 0;
if (locationdata) {
latitude = locationdata.Latitude;
longitude = locationdata.Longitude;
}
else {
latitude = $("#dialog_latitude").val();
longitude = $("#dialog_longitude").val();
}
if (latitude === "" || isNaN(latitude) || latitude > 90 || latitude < -90)
return;
if (longitude === "" || isNaN(longitude) || longitude > 180 || longitude < -180)
return;
$("#lbllatitude").text(latitude);
$("#lbllongtude").text(longitude);
mapctrl.setLocation(latitude, longitude);
}
function OnSelectLocationOK() {
$('#dialog_selectlocation').hideDialog();
var loc = mapctrl.getLocation();
if (locationdata) {
locationdata.Latitude = loc[0];
locationdata.Longitude = loc[1];
saveLocation(locationdata);
}
else {
$("#dialog_latitude").val(loc[0]);
$("#dialog_longitude").val(loc[1]);
GetAddress();
}
}
function saveLocation(loc) {
var item = {
'ID': loc.ID,
'PId': loc.PId,
'Name': loc.Name,
'Code': loc.Code,
'Latitude': loc.Latitude,
'Longitude': loc.Longitude,
'Address': loc.Address,
'Notes': loc.Notes
};
var p = htmldecode(JSON.stringify(item));
locationrequest("SaveCustomerLocation", p, function (data) {
if (data === 'OK')
OnRefresh();
}, function (err) {
});
}
var LocatorC = undefined;
var PointC = undefined;
var locator;
function getAddress(lat, long) {
if (!locator) {
require([
"esri/tasks/locator",
"esri/geometry/Point"
], function (Locator, Point) {
LocatorC = Locator;
PointC = Point;
//var locator = new Locator("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Locators/ESRI_Geocode_USA/GeocodeServer");
var locator = new LocatorC("https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer");
locator.on("location-to-address-complete", function (evt) {
if (evt.address.address) {
if (evt.address.address.Address && evt.address.address.Address != "")
$('#dialog_address').val(evt.address.address.Address);
else
$('#dialog_address').val(evt.address.address.Match_addr);
$('#dialog_city').val(evt.address.address.City);
editableSelectState.text(evt.address.address.RegionAbbr);
$('#dialog_zip').val(evt.address.address.Postal);
}
});
var point = new PointC(long, lat);
locator.locationToAddress(point, 100);
});
}
else {
var point = new PointC(long, lat);
locator.locationToAddress(point, 100);
}
}
function GetAddress() {
//var address = $('#dialog_address').val();
//if (!address) {
var longitude = $("#dialog_longitude").val();
var latitude = $("#dialog_latitude").val();
if (longitude === "" || isNaN(longitude) || longitude > 180 || longitude < -180)
return;
if (latitude === "" || isNaN(latitude) || latitude > 90 || latitude < -90)
return;
getAddress(latitude, longitude);
//}
}
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="recordcontent" style="padding: 0px; margin: 0px;">
<div class="page_title" data-lgid="P_SET_MANAGELOCATIONS">Manage Locations</div>
<div class="function_title">
<span class="sbutton iconadd" onclick="OnAdd();" data-lgid="P_SET_ADD">Add</span>
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_SET_REFRESH">Refresh</span>
</div>
<div class="clear"></div>
<div id="locationlist">
<data-grid ref="grid" v-bind:columns="columns" v-bind:source="source" v-bind:allow-editing="true" v-on:rowdblclick="rowdblclick"
v-bind:allow-auto-new-row="false" v-bind:total-row="totalRow" body-class="autoHeightBody">
</data-grid>
</div>
<%--<div id="locationlist"></div>--%>
</div>
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
<div class="dialog" id="dialog_location" style="display: none; width: 500px;">
<div class="dialog-title"><span class="title" data-lgid="P_SET_ADDLOCATIONS">Add Location</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table>
<tr>
<td class="label" data-lgid="P_SET_LOCATIONSNAME_COLON">Location Name:</td>
<td colspan="2">
<input type="text" id="dialog_name" maxlength="100" tabindex="1" style="width: 320px;" autocomplete="off" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_CODE_COLON">Code:</td>
<td colspan="2">
<input type="text" id="dialog_code" maxlength="20" tabindex="1" style="width: 320px;" autocomplete="off" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_LATITUDE_COLON">Latitude:</td>
<td>
<input type="text" id="dialog_latitude" disabled="disabled" maxlength="100" tabindex="1" style="width: 320px;" onblur="GetAddress()" autocomplete="off" /></td>
<td rowspan="2">
<span class="sbutton iconlocation" onclick="SelectLocation()" data-title-lgid="P_SET_SELECTLOCATION"></span></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_LONGITUDE_COLON">Longitude:</td>
<td>
<input type="text" id="dialog_longitude" disabled="disabled" maxlength="100" tabindex="1" style="width: 320px;" onblur="GetAddress()" autocomplete="off" />
</td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_ADDRESS1_COLON">Address 1:</td>
<td colspan="2">
<input type="text" id="dialog_address" maxlength="1000" tabindex="1" style="width: 320px;" autocomplete="off" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_ADDRESS2_COLON">Address 2:</td>
<td colspan="2">
<input type="text" id="dialog_address2" maxlength="1000" tabindex="1" style="width: 320px;" autocomplete="off" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_CITY_COLON">City:</td>
<td colspan="2">
<input type="text" id="dialog_city" maxlength="50" tabindex="1" style="width: 320px;" autocomplete="off" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_STATE_COLON">State:</td>
<td colspan="2">
<div id="dialog_state" style="width: 322px; height: 22px;"></div>
</td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_ZIP_COLON">Zip:</td>
<td colspan="2">
<input type="text" id="dialog_zip" maxlength="50" tabindex="1" style="width: 320px;" autocomplete="off" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_LOGO_COLON">Logo:</td>
<td colspan="2">
<input id="btnBrowseLogo" type="button" value="Browse..." data-lgid="P_SET_BROWSE" tabindex="1" style="width: 120px; height: 22px;" />
</td>
</tr>
<tr id="trimg">
<td class="label"></td>
<td colspan="2">
<img id="imgfilogo" src="" style="width: 60px; height: 60px; margin: 5px;" />
</td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_NOTES_COLON">Notes:</td>
<td colspan="2">
<textarea id="dialog_notes" class="inputbox" maxlength="1000" tabindex="6" style="width: 320px;"></textarea></td>
</tr>
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_SET_CANCEL" class="dialog-close" tabindex="8" />
<input type="button" onclick="OnDialogOK();" value="OK" data-lgid="P_SET_OK" tabindex="7" />
<div class="clear"></div>
</div>
</div>
<div class="dialog" id="dialog_selectlocation" style="display: none;">
<div class="dialog-title"><span class="title" data-lgid="P_SET_SELECTLOCATION">Select Location</span><em class="dialog-close"></em></div>
<div style="width: 900px; height: 600px;">
<div id="mapdiv" style="width: 100%; height: 100%;">
</div>
<div id="basemapgalleryDiv">
<div id="basemapImg"></div>
<div id="basemapTitle"></div>
</div>
<div id="basemapGallery"></div>
</div>
<div class="dialog-func">
<span data-lgid="P_SET_LATITUDE_COLON">Latitude:</span>
<span id="lbllatitude"></span>
<span data-lgid="P_SET_LONGITUDE_COLON" style="margin-left: 10px;">Longitude:</span>
<span id="lbllongtude"></span>
<input type="button" value="Cancel" data-lgid="P_SET_CANCEL" class="dialog-close" tabindex="8" />
<input type="button" onclick="OnSelectLocationOK();" value="OK" data-lgid="P_SET_OK" tabindex="7" />
<div class="clear"></div>
</div>
</div>
</asp:Content>

View File

@ -0,0 +1,68 @@
using IronIntel.Contractor.Site;
using IronIntel.Contractor.Site.SystemSettings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class ManageLocations : CustomerProviderBasePage
{
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;
}
}
}
protected override bool ThrowIfNotAllowed
{
get
{
return true;
}
}
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;
}
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;
}
}
}

View File

@ -0,0 +1,426 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/SystemSettings/SysSettingMasterPage.master" AutoEventWireup="true" CodeFile="ManageRegions.aspx.cs" Inherits="ManageRegions" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<style type="text/css">
::-ms-clear, ::-ms-reveal {
display: none;
}
.selectinput {
width: 150px;
margin-right: 10px;
}
.dialog-content table {
border-collapse: collapse;
width: 100%;
}
.dialog-content table td.label {
width: 120px;
text-align: right;
padding-right: 10px;
line-height: 30px;
height: 24px;
vertical-align: top;
}
.dialog-content table td input,
.dialog-content table td textarea {
border: 1px solid #a9a9a9;
width: 200px;
height: 18px;
padding: 1px;
}
.dialog-content table td input[type="checkbox"] {
border: none;
}
.dialog-content table td textarea {
height: 100px;
/*max-width: 200px;*/
}
#dialogdatatb td {
padding-top: 30px;
}
.a {
text-decoration: none;
color: #2140fb;
}
</style>
<link href="<%=GetFileUrlWithVersion("../css/jquery.datetimepicker.css")%>" rel="stylesheet" />
<script src="<%=GetFileUrlWithVersion("../js/jquery.datetimepicker.full.js")%>"></script>
<script src="../Maintenance/js/inputdatactr.js"></script>
<script type="text/javascript">
function regionrequest(method, param, callback, error) {
_network.request("SystemSettings/ManageRegions.aspx", -1, method, param, callback, error || function (e) {
showmaskbg(false, true);
showAlert(GetTextByKey('P_SET_QUERY', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_SET_QUERY', 'Query'));
});
}
function OnAdd() {
regionid = undefined;
$('#dialog_name').val('');
$('#dialog_startdate').val('');
$('#dialog_projectenddate').val('');
$('#dialog_enddate').val('');
$('#dialog_notes').val('');
$('#dialog_region .dialog-title span.title').text(GetTextByKey("P_SET_ADDREGION", "Add Region"));
showmaskbg(true);
$('#dialog_region')
.css({
'top': (document.documentElement.clientHeight - $('#dialog_region').height()) / 3,
'left': (document.documentElement.clientWidth - $('#dialog_region').width()) / 2
}).showDialogfixed();
$('#dialog_name').focus();
}
var regionid;
function OnEdit() {
var index = grid_dt.selectedIndex;
if (index < 0) {
showAlert(GetTextByKey("P_SET_PLEASESELECTREGION", "Please select Region."), GetTextByKey("P_SET_EDITREGION", "Edit Region")); return;
}
var region = grid_dt.source[index].Values;
if (!region) {
regionid = undefined;
return;
}
regionid = region.Id;
$('#dialog_name').val(region.Name);
$('#dialog_startdate').val(region.StartDate.DisplayValue);
$('#dialog_projectenddate').val(region.ProjectedEndDate.DisplayValue);
$('#dialog_enddate').val(region.EndDate.DisplayValue);
$('#dialog_notes').val(region.Notes);
$('#dialog_region .dialog-title span.title').text(GetTextByKey("P_SET_EDITREGION", "Edit Region"));
showmaskbg(true);
$('#dialog_region')
.css({
'top': (document.documentElement.clientHeight - $('#dialog_region').height()) / 3,
'left': (document.documentElement.clientWidth - $('#dialog_region').width()) / 2
}).showDialogfixed();
$('#dialog_name').focus();
}
function OnDblClick(e) {
OnEdit();
}
function OnDelete(region) {
if (!region) {
return;
}
var alerttitle = GetTextByKey("P_SET_DELETEREGION", "Delete Region");
showConfirm(GetTextByKey("P_SET_DOYOUWANTTODELETETHEREGION", 'Do you want to delete the region?'), alerttitle, function () {
regionrequest("DeleteRegion", region.Id, function (data) {
if (typeof (data) === "string") {
showAlert(data, alerttitle);
}
else
OnRefresh();
}, function (err) {
showAlert(GetTextByKey("P_SET_FAILEDTODELETETHISREGION", 'Failed to delete this Region.'), alerttitle);
});
});
}
function OnRefresh() {
showloading(true);
regionrequest("GetRegions", "", function (data) {
showloading(false);
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_SET_ERROR", 'Error'));
return;
}
if (data)
showRegions(data);
}, function (err) {
showloading(false);
});
}
function showRegions(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
for (var j in r) {
if (j === "StartDate") {
r[j] = { DisplayValue: r["StartDateStr"], Value: r[j] };
}
else if (j === "ProjectedEndDate") {
r[j] = { DisplayValue: r["ProjectedEndDateStr"], Value: r[j] };
}
else if (j === "EndDate") {
r[j] = { DisplayValue: r["EndDateStr"], Value: r[j] };
}
else if (j === "IsActive") {
r[j] = { DisplayValue: r["IsActive"] ? "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('#regionlist');
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_SET_REGIONNAME", "Region Name"), valueIndex: 'Name', css: { 'width': 200, 'text-align': 'left' } },
{ name: 'StartDate', caption: GetTextByKey("P_SET_STARTDATE", "Start Date"), valueIndex: 'StartDate', css: { 'width': 120, 'text-align': 'left' } },
{ name: 'ProjectedEndDate', caption: GetTextByKey("P_SET_PROJECTEDENDDATE", "Projected End Date"), valueIndex: 'ProjectedEndDate', css: { 'width': 130, 'text-align': 'left' } },
{ name: 'EndDate', caption: GetTextByKey("P_SET_ENDDATE", "End Date"), valueIndex: 'EndDate', css: { 'width': 120, 'text-align': 'left' } },
//{ name: 'IsActive', caption: GetTextByKey("P_SET_ACTIVE", "Active"), valueIndex: 'IsActive', css: { 'width': 80, 'text-align': 'left' } },
{ name: 'Notes', caption: GetTextByKey("P_SET_NOTES", "Notes"), valueIndex: 'Notes', css: { 'width': 280, '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;
col.allowFilter = list_columns[hd].allowFilter;
col.type = list_columns[hd].type;
if (col.name === "Edit") {
col.isurl = true;
col.text = "\uf044";
col.sortable = false;
col.events = {
onclick: function () {
OnEdit();
}
};
col.classFilter = function (e) {
return "icon-col";
}
col.attrs = { 'title': GetTextByKey("P_SET_EDIT", 'Edit') };
}
else if (col.name === "Delete") {
col.isurl = true;
col.text = "\uf00d";
col.sortable = false;
col.events = {
onclick: function () {
OnDelete(this);
}
};
col.classFilter = function (e) {
return "icon-col";
};
col.attrs = { 'title': GetTextByKey("P_SET_DELETE", 'Delete') };
}
columns.push(col);
}
grid_dt.canMultiSelect = false;
grid_dt.columns = columns;
grid_dt.init();
grid_dt.rowdblclick = OnEdit;
}
function OnDialogOK() {
var item = {
'Name': $.trim($('#dialog_name').val()),
'StartDate': $.trim($('#dialog_startdate').val()),
'ProjectedEndDate': $.trim($('#dialog_projectenddate').val()),
'EndDate': $.trim($('#dialog_enddate').val()),
'Notes': $.trim($('#dialog_notes').val())
};
var alerttitle;
if (regionid) {
item.Id = regionid;
alerttitle = GetTextByKey("P_SET_EDITREGION", "Edit Region");
} else {
item.Id = -1;
alerttitle = GetTextByKey("P_SET_ADDREGION", "Add Region");
}
if (!item.Name || item.Name.length == 0) {
showAlert(GetTextByKey("P_SET_REGIONNAMECANNOTBEEMPTY", 'Region name cannot be empty.'), alerttitle);
$('#dialog_name').focus();
return;
}
if (item.StartDate.length > 0 && !checkDate(item.StartDate)) {
showAlert(GetTextByKey("P_SET_STARTDATEFORMATERROR", "Start Date format error."), alerttitle);
return;
}
if (item.ProjectedEndDate.length > 0 && !checkDate(item.ProjectedEndDate)) {
showAlert(GetTextByKey("P_SET_PROJECTEDENDDATEFORMATERROR", "Projected End Date format error."), alerttitle);
return;
}
if (item.EndDate.length > 0 && !checkDate(item.EndDate)) {
showAlert(GetTextByKey("P_SET_ENDDATEFORMATERROR", "End Date format error."), alerttitle);
return;
}
if (item.StartDate.length > 0) {
var sdate = item.StartDate;
var stdt = new Date(sdate.replace("-", "/"));
if (item.ProjectedEndDate.length > 0) {
var edate = item.ProjectedEndDate;
var etdt = new Date(edate.replace("-", "/"));
if (stdt > etdt) {
showAlert(GetTextByKey("P_SET_PROJECTEDENDDATEFORMATERROR1", "Projected End Date must be later than Start Date."), alerttitle);
return;
}
}
if (item.EndDate.length > 0) {
var edate = item.EndDate;
var etdt = new Date(edate.replace("-", "/"));
if (stdt > etdt) {
showAlert(GetTextByKey("P_SET_ENDDATEFORMATERROR1", "End Date must be later than Start Date."), alerttitle);
return;
}
}
}
regionrequest("SaveRegion", htmlencode(JSON.stringify(item)), function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_SET_ERROR", 'Error'));
return;
}
showmaskbg(false);
$('#dialog_region').hideDialog();
OnRefresh();
}, function (err) {
showmaskbg(false);
});
}
$(function () {
setPageTitle(GetTextByKey("P_SET_MANAGEREGIONS", 'Manage Regions'), true);
InitGridData();
OnRefresh();
$('#dialog_startdate').datetimepicker({
timepicker: false,
format: 'm/d/Y',
enterLikeTab: false,
scrollInput: false,
onSelectDate: function (v, inp) {
var date = new DateFormatter().formatDate(v, 'm/d/Y 00:00:00');
inp.parent().data('val', [date]);
}
});
$('#dialog_projectenddate').datetimepicker({
timepicker: false,
format: 'm/d/Y',
enterLikeTab: false,
scrollInput: false,
onSelectDate: function (v, inp) {
var date = new DateFormatter().formatDate(v, 'm/d/Y 00:00:00');
inp.parent().data('val', [date]);
}
});
$('#dialog_enddate').datetimepicker({
timepicker: false,
format: 'm/d/Y',
enterLikeTab: false,
scrollInput: false,
onSelectDate: function (v, inp) {
var date = new DateFormatter().formatDate(v, 'm/d/Y 00:00:00');
inp.parent().data('val', [date]);
}
});
$('#dialog_region').dialog(function () {
showmaskbg(false);
});
$(window).resize(function () {
$("#regionlist").css("height", $(window).height() - $("#regionlist").offset().top - 4);
}).resize();
});
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="recordcontent" style="padding: 0px; margin: 0px;">
<div class="page_title" data-lgid="P_SET_MANAGEREGIONS">Manage Regions</div>
<div class="function_title">
<span class="sbutton iconadd" onclick="OnAdd();" data-lgid="P_SET_ADD">Add</span>
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_SET_REFRESH">Refresh</span>
</div>
<div class="clear"></div>
<div id="regionlist">
<data-grid ref="grid" v-bind:columns="columns" v-bind:source="source" v-bind:allow-editing="true" v-on:rowdblclick="rowdblclick"
v-bind:allow-auto-new-row="false" v-bind:total-row="totalRow" body-class="autoHeightBody">
</data-grid>
</div>
</div>
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
<div class="dialog" id="dialog_region" style="display: none; width: 500px;">
<div class="dialog-title"><span class="title" data-lgid="P_SET_ADDREGION">Add Region</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table>
<tr>
<td class="label" data-lgid="P_SET_REGIONNAME_COLON">Region Name:</td>
<td>
<input type="text" id="dialog_name" maxlength="200" tabindex="1" style="width: 320px;" autocomplete="off" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_STARTDATE_COLON">Start Date:</td>
<td>
<input type="text" id="dialog_startdate" maxlength="20" tabindex="1" style="width: 320px;" autocomplete="off" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_PROJECTEDENDDATE_COLON">Project End Date:</td>
<td>
<input type="text" id="dialog_projectenddate" maxlength="20" tabindex="1" style="width: 320px;" autocomplete="off" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_ENDDATE_COLON">End Date:</td>
<td>
<input type="text" id="dialog_enddate" maxlength="20" tabindex="1" style="width: 320px;" autocomplete="off" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_NOTES_COLON">Notes:</td>
<td>
<textarea id="dialog_notes" class="inputbox" maxlength="1000" tabindex="1" style="width: 320px;"></textarea></td>
</tr>
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_SET_CANCEL" class="dialog-close" tabindex="8" />
<input type="button" onclick="OnDialogOK();" value="OK" data-lgid="P_SET_OK" tabindex="7" />
<div class="clear"></div>
</div>
</div>
</asp:Content>

View File

@ -0,0 +1,51 @@
using IronIntel.Contractor.Site;
using IronIntel.Contractor.Site.SystemSettings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class ManageRegions : CustomerProviderBasePage
{
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 ThrowIfNotAllowed
{
get
{
return true;
}
}
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;
}
}

View File

@ -0,0 +1,441 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/SystemSettings/SysSettingMasterPage.master" AutoEventWireup="true" CodeFile="SettingColors.aspx.cs" Inherits="SystemSettings_SettingColors" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<style type="text/css">
.colorinput {
float: left;
height: 20px;
width: 60px;
}
p {
background-color: #f78e1e;
float: right;
width: 30px;
height: 24px;
margin: 0px;
margin-left: 15px;
}
.solutionlisttable {
border: 1px solid #b0b0b0;
border-collapse: collapse;
}
.solutionlisttable th {
border: 1px solid #b0b0b0;
line-height: 25px;
background-color: #ddd;
}
.solutionlisttable tr td {
border: 1px solid #b0b0b0;
line-height: 25px;
word-break: break-all;
}
.solutionlisttable tr:hover {
background-color: #efebeb;
}
.selected {
background-color: #efebeb;
}
.usingscheme {
text-align: center;
}
#leftcontentdiv {
border: 1px solid #ddd;
border-radius: 3px 4px;
width: 250px;
overflow: auto;
border-top: none;
}
</style>
<link href="<%=GetFileUrlWithVersion("Css/colorpick.css")%>" rel="stylesheet" />
<script type="text/javascript" src="<%=GetFileUrlWithVersion("Js/colorpick.js")%>"></script>
<script type="text/javascript">
/*RGB颜色转换为16进制*/
function regrgb(rgb) {
rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
function hex(x) {
return ("0" + parseInt(x).toString(16)).slice(-2);
}
rgb = "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
return rgb;
}
function iscolorStr(str) {
//var reg = /^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/;
var reg = /^#([0-9a-fA-F]{6})$/;
if (reg.test(str))
return true;
return false;
}
function onblur_setcolor(c_dom, change_dom) {
//var colorvalue = c_dom.val();
//if (iscolorStr(colorvalue))
// change_dom.css('background-color', colorvalue);
//else {
// showAlert("The color format is wrong. Please enter the correct color.", "System Message");
// c_dom.val("");
//}
}
$(function () {
setPageTitle(GetTextByKey("P_SET_STYLESETTING", 'Style Setting'), true);
$('#leftcontentdiv').css('height', $(window).height() - $('#h3title').height() - $('#top_bt').height() - 67);
$('#rightheaderDiv').css('width', $(window).width() - $('#leftcontentdiv').width() - 140);
$('#dialog_colorscheme').prop('iframe', true).dialog(function () {
showmaskbg(false);
});
$('#charttitlecolor').colorpick({
color: regrgb($('#charttitlecolor').css('background-color')),
onShow: function (hsb, hex, rgb, el) {
$(this).colorpickSetColor(regrgb($('#charttitlecolor').css('background-color')));
},
onSubmit: function (hsb, hex, rgb, el) {
$("#r").attr("value", rgb.r);
$("#g").attr("value", rgb.g);
$("#b").attr("value", rgb.b);
$('#charttitlecolor').css('background-color', '#' + hex);
$('#charttitle_input').val('#' + hex);
$(el).colorpickHide();
},
onCancelSubmit: function (cal) {
$(cal).hide();
}
});
$('#charttitle_input').blur(function () {
onblur_setcolor($(this), $('#charttitlecolor'));
});
$('#chartbordercolor').colorpick({
color: regrgb($('#chartbordercolor').css('background-color')),
onShow: function (hsb, hex, rgb, el) {
$(this).colorpickSetColor(regrgb($('#chartbordercolor').css('background-color')));
},
onSubmit: function (hsb, hex, rgb, el) {
$("#r").attr("value", rgb.r);
$("#g").attr("value", rgb.g);
$("#b").attr("value", rgb.b);
$('#chartbordercolor').css('background-color', '#' + hex);
$('#chartborder_input').val('#' + hex);
$(el).colorpickHide();
},
onCancelSubmit: function (cal) {
$(cal).hide();
}
});
$('#chartborder_input').blur(function () {
onblur_setcolor($(this), $('#chartbordercolor'));
});
$('#menubackgroundcolor').colorpick({
color: regrgb($('#menubackgroundcolor').css('background-color')),
onShow: function (hsb, hex, rgb, el) {
$(this).colorpickSetColor(regrgb($('#menubackgroundcolor').css('background-color')));
},
onSubmit: function (hsb, hex, rgb, el) {
$("#r").attr("value", rgb.r);
$("#g").attr("value", rgb.g);
$("#b").attr("value", rgb.b);
$('#menubackgroundcolor').css('background-color', '#' + hex);
$('#menubackground_input').val('#' + hex);
$(el).colorpickHide();
},
onCancelSubmit: function (cal) {
$(cal).hide();
}
});
$('#menubackground_input').blur(function () {
onblur_setcolor($(this), $('#menubackgroundcolor'));
});
$('#titlebarcolor').colorpick({
color: regrgb($('#titlebarcolor').css('background-color')),
onShow: function (hsb, hex, rgb, el) {
$(this).colorpickSetColor(regrgb($('#titlebarcolor').css('background-color')));
},
onSubmit: function (hsb, hex, rgb, el) {
$("#r").attr("value", rgb.r);
$("#g").attr("value", rgb.g);
$("#b").attr("value", rgb.b);
$('#titlebarcolor').css('background-color', '#' + hex);
$('#titlebar_input').val('#' + hex);
$(el).colorpickHide();
},
onCancelSubmit: function (cal) {
$(cal).hide();
}
});
$('#titlebar_input').blur(function () {
onblur_setcolor($(this), $('#titlebarcolor'));
});
GetCompanyUIStyles();
});
function GetCompanyUIStyles() {
$('#s_tboy').empty();
$.ajax({
type: "POST",
async: false,
datatype: "json",
url: "SettingColors.aspx",
data: {
MethodName: "GetCompanyUIStyles"
},
success: function (result) {
var schemes = eval(result);
if (schemes && schemes.length > 0) {
if (schemes[0].UIStyleName != undefined) {
var selectedID = $('#styleID').text() == "" ? -1 : parseInt($('#styleID').text());
var selectedIndex = 0;
for (var i = 0; i < schemes.length; i++) {
var tr = $('<tr></tr>').data('jsondata', schemes[i]).click(function (e) {
trclick(this);
});
if (selectedID == schemes[i].UIStyleID)
selectedIndex = i;
tr.append($('<td></td>').text(schemes[i].UIStyleName));
var tddefault = $('<td style="text-align:center;">No</td>');
if (schemes[i].IsDefault) {
tddefault.text('Yes');
}
tr.append(tddefault);
$('#s_tboy').append(tr);
}
$('#s_tboy tr')[selectedIndex].click();
}
else {
SetColor(null);
}
}
showmaskbg(false);
},
error: function (msg) {
showmaskbg(false);
showAlert(msg.statusText, GetTextByKey("P_SET_ERROR", 'Error'));
}
});
}
function SetColor(data) {
if (data) {
$('#charttitlecolor').css('background-color', data.ChartTitleBackgroundColor);
$('#chartbordercolor').css('background-color', data.ChartBorderColor);
$('#menubackgroundcolor').css('background-color', data.MenuBackgroundColor);
$('#titlebarcolor').css('background-color', data.TitleBarColor);
$('#charttitle_input').val(data.ChartTitleBackgroundColor);
$('#chartborder_input').val(data.ChartBorderColor);
$('#menubackground_input').val(data.MenuBackgroundColor);
$('#titlebar_input').val(data.TitleBarColor);
$('#styleID').text(data.UIStyleID);
$('#stylename_input').val(data.UIStyleName);
if (data.IsDefault) {
$('#isdefault').attr('checked', 'checked');
}
else
$('#isdefault').removeAttr('checked');
}
else {
$('#charttitlecolor').css('background-color', '#F78E1E');
$('#chartbordercolor').css('background-color', '#F78E1E');
$('#menubackgroundcolor').css('background-color', '#0078D7');
$('#titlebarcolor').css('background-color', '#F78E1E');
$('#charttitle_input').val('#F78E1E');
$('#chartborder_input').val('#F78E1E');
$('#menubackground_input').val('#0078D7');
$('#titlebar_input').val('#F78E1E');
$('#isdefault').removeAttr('checked');
$('#styleID').text("");
$('#stylename_input').val("").focus();
}
}
function DeleteUIStyle() {
showConfirm(GetTextByKey("P_SET_DOYOUWANTTODELETETHISSTYLE",'Do you want to delete this style?'), GetTextByKey("P_SET_DELETE", 'Delete'), function (e) {
$.ajax({
type: "POST",
async: false,
datatype: "json",
url: "SettingColors.aspx",
data: {
ClientData: parseInt($('#styleID').text()),
MethodName: "DeleteCompanyUIStyle"
},
success: function (msg) {
GetCompanyUIStyles();
showmaskbg(false);
},
error: function (msg) {
showAlert(msg.statusText, GetTextByKey("P_SET_ERROR", 'Error'));
showmaskbg(false);
}
});
}, function () { showmaskbg(false); });
}
function SaveCompanyUIStyle() {
var alerttitle = GetTextByKey("P_SET_SYSTEMMESSAGE", "System Message");
if ($.trim($('#stylename_input').val()) == "") {
showAlert(GetTextByKey("P_SET_STYLENAMECANTBEEMPTY", "Style name can't be empty."), alerttitle);
return;
}
var styledata = {
ChartTitleBackgroundColor: $('#charttitle_input').val(),
ChartBorderColor: $('#chartborder_input').val(),
MenuBackgroundColor: $('#menubackground_input').val(),
TitleBarColor: $('#titlebar_input').val(),
IsDefault: $('#isdefault').is(':checked'),
UIStyleID: $('#styleID').text() == "" ? -1 : parseInt($('#styleID').text()),
UIStyleName: encodeURIComponent($.trim($('#stylename_input').val()))
};
if (!iscolorStr(styledata.ChartTitleBackgroundColor)) {
showAlert(GetTextByKey("P_SET_CHARTTITLEBGCOLORFORMATISINVALID", "Chart Title Background Color format is invalid. Please enter a valid color code."), alerttitle);
return;
}
if (!iscolorStr(styledata.ChartBorderColor)) {
showAlert(GetTextByKey("P_SET_CHARTBORDERCOLORFORMATISINVALID", "Chart Border Color format is invalid. Please enter a valid code."), alerttitle);
return;
}
if (!iscolorStr(styledata.MenuBackgroundColor)) {
showAlert(GetTextByKey("P_SET_MENUBGCOLORFORMATISINVALID", "Menu Background Color format is invalid. Please enter a valid code."), alerttitle);
return;
}
if (!iscolorStr(styledata.TitleBarColor)) {
showAlert(GetTextByKey("P_SET_TITLEBARCOLORFORMATISINVALID", "Title Bar Color format is invalid. Please enter a valid code."), alerttitle);
return;
}
showmaskbg(true);
$.ajax({
type: "POST",
async: false,
datatype: "json",
url: "SettingColors.aspx",
data: {
ClientData: JSON.stringify(styledata),
MethodName: "SetCompanyUIStyle"
},
success: function (msg) {
if (eval(msg) == "OK") {
showAlert(GetTextByKey("P_SET_SAVSUCCESSFULLY", "Saved Successfully"), GetTextByKey("P_SET_SAVESTYLE", 'Save Style'));
GetCompanyUIStyles();
}
else
showAlert(eval(msg), GetTextByKey("P_SET_SAVESTYLE", 'Save Style'));
showmaskbg(false);
},
error: function (msg) {
showAlert(msg.statusText, GetTextByKey("P_SET_ERROR", 'Error'));
showmaskbg(false);
}
});
}
function trclick(obj) {
$('#s_tboy tr').each(function () {
$(this).removeClass('selected');
});
$(obj).addClass('selected');
SetColor($(obj).data('jsondata'));
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div style="padding: 0px; margin: 0px;">
<div class="page_title" data-lgid="P_SET_STYLESETTING">Style Setting</div>
<div class="function_title">
<span class="sbutton iconadd" onclick="SetColor(null);" data-lgid="P_SET_ADD">Add</span>
<span class="sbutton icondelete" onclick="DeleteUIStyle();" data-lgid="P_SET_DELETE">Delete</span>
<span class="sbutton iconsave" onclick="SaveCompanyUIStyle();" data-lgid="P_SET_SAVE">Save</span>
<span class="sbutton iconrefresh" onclick="GetCompanyUIStyles();" data-lgid="P_SET_REFRESH">Refresh</span>
</div>
<div class="content_main content_div" style="padding-top: 10px;">
<table>
<tr>
<td style="vertical-align: top;">
<div id="leftcontentdiv">
<table class="solutionlisttable">
<thead>
<tr>
<th style="width: 200px;" data-lgid="P_SET_STYLENAME">Style Name</th>
<th class="usingscheme" style="width: 90px;" data-lgid="P_SET_ISDEFAULT">Is Default</th>
</tr>
</thead>
<tbody id="s_tboy"></tbody>
</table>
</div>
</td>
<td style="vertical-align: top; padding-left: 20px;">
<div id="rightheaderDiv" style="border-bottom: 1px solid #b0b0b0; margin-bottom: 20px; line-height: 30px;">
<table>
<tr>
<td style="text-align: right; padding-right: 5px; width: 160px;" data-lgid="P_SET_STYLENAME_COLON">Style Name :</td>
<td>
<input id="stylename_input" style="width: 400px; height: 20px;" maxlength="200" /><label id="styleID" style="display: none;"></label></td>
</tr>
<tr>
<td style="text-align: right; padding-right: 5px;" data-lgid="P_SET_ISDEFAULT_COLON">Is Default:</td>
<td>
<input id="isdefault" type="checkbox" style="margin-left: 0;" /></td>
</tr>
</table>
</div>
<table style="min-width: 200px; border: none; line-height: 50px;">
<tr>
<td style="text-align: right; padding-right: 5px; width: 160px;" data-lgid="P_SET_CHARTTITLECOLOR_COLON">Chart Title Color :</td>
<td>
<p id="charttitlecolor"></p>
<input id="charttitle_input" class="colorinput" maxlength="7" />
</td>
</tr>
<tr>
<td style="text-align: right; padding-right: 5px;" data-lgid="P_SET_CHARTBORDERCOLOR_COLON">Chart Border Color :</td>
<td>
<p id="chartbordercolor"></p>
<input id="chartborder_input" class="colorinput" maxlength="7" />
</td>
</tr>
<tr>
<td style="text-align: right; padding-right: 5px;" data-lgid="P_SET_MENUBACKGROUNDCOLOR_COLON">Menu Background Color :</td>
<td>
<p id="menubackgroundcolor"></p>
<input id="menubackground_input" class="colorinput" maxlength="7" />
</td>
</tr>
<tr>
<td style="text-align: right; padding-right: 5px;" data-lgid="P_SET_TITLEBARCOLOR_COLON">Title Bar Color :</td>
<td>
<p id="titlebarcolor"></p>
<input id="titlebar_input" class="colorinput" maxlength="7" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
</asp:Content>

View File

@ -0,0 +1,42 @@
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.SystemSettings;
public partial class SystemSettings_SettingColors : SystemSettingsBasePage
{
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;
}
}

View File

@ -0,0 +1,79 @@
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="SysSettingMasterPage.master.cs" Inherits="SystemSettings_SysSettingMasterPage" %>
<!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" />
<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 src="<%=GetUrl("js/language.js")%>" type="text/javascript"></script>
<script type="text/javascript" src="<%=GetUrl("js/components/gridview.js") %>"></script>
<script type="text/javascript">
var GridView = window.GridView || window['g5-gridview'];
_network.root = '<%=Page.ResolveUrl("~/")%>';
var sitePath = "<%=this.ResolveUrl("~/fic/") %>";
function getText(s, flag) {
return (s == null)
? (flag ? '<i>null</i>' : '')
: htmlencode(s, $('#div_text_holder')).replace(/ /g, '&nbsp;');
}
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 - 24);
}
window.onresize = 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>
<div id="div_text_holder"></div>
</body>
</html>

View File

@ -0,0 +1,30 @@
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 SystemSettings_SysSettingMasterPage : CommonBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
try
{
GetUIStyle();
}
catch
{
// TODO: errors when get the ui style.
}
}
}
}

View File

@ -0,0 +1,253 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/SystemSettings/SysSettingMasterPage.master" AutoEventWireup="true" CodeFile="SystemOptions.aspx.cs" Inherits="SystemOptions" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<style type="text/css">
.label {
min-width: 100px;
font-weight: bold;
padding-right: 10px;
text-align: right;
}
</style>
<script type="text/javascript">
function systemoptionsrequest(method, param, callback, error) {
_network.request("SystemSettings/SystemOptions.aspx", -1, method, param, callback, error || function (e) {
console.log(e);
showmaskbg(false, true);
showAlert(GetTextByKey('P_SET_QUERY', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_SET_QUERY', 'Query'));
});
}
function OnRefresh() {
showloading(true);
systemoptionsrequest("GetTimeZones", "", function (data) {
showloading(false);
showTimeZones(data);
}, function (err) {
showloading(false);
});
}
function showTimeZones(data) {
var sel = $("#selTimeZone");
sel.empty();
if (data && data.length > 0) {
for (var i = 0; i < data.length; i++) {
sel.append($("<option></option>").val(data[i].Key).text("(" + data[i].Value + ")" + data[i].Key).attr("offset", data[i].Tag1));
}
}
sel.val("UTC");
GetSystemOptions();
}
function GetSystemOptions() {
showloading(true);
systemoptionsrequest("GetSystemOptions", "", function (data) {
showloading(false);
if (data) {
$("#selTimeZone").val(data.TimeZone === "" ? "UTC" : data.TimeZone);
$('#accuracyfilter').val(data.AccuracyFilter);
$('#txtOdoUnit').val(data.UnitOfOdometer);
$('#sel_acknowledgealert').val(data.AcknowledgingAlerts);
$('#selAreaUnit').val(data.AreaUnits);
$('#selVolumeUnit').val(data.VolumeUnits);
$('#selWeightUnit').val(data.WeightUnits);
$('#sel_loginverifytype').val(data.LoginVerifyType);
$('#ipt_mfaremembermedays').val(data.MFARememberMeDays);
if (data.Connectors && data.Connectors.length > 0) {
var con = data.Connectors[0];
$('#ipt_connectorserver').val(con.Key);
$('#ipt_connectortoken').val(con.Value);
}
}
}, function (err) {
showloading(false);
});
}
var IsPositiveInteger = /^[0-9]\d*$/;
function OnSave() {
var offset = $('#selTimeZone').find("option:selected").attr("offset");
var connector = { 'Key': $('#ipt_connectorserver').val(), 'Value': $('#ipt_connectortoken').val() };
var item = {
'TimeZone': $('#selTimeZone').val(),
'Offset': offset,
'AccuracyFilter': $('#accuracyfilter').val(),
'UnitOfOdometer': $('#txtOdoUnit').val(),
'AcknowledgingAlerts': $('#sel_acknowledgealert').val(),
'AreaUnits': $('#selAreaUnit').val(),
'VolumeUnits': $('#selVolumeUnit').val(),
'WeightUnits': $('#selWeightUnit').val(),
'LoginVerifyType': $('#sel_loginverifytype').val(),
'MFARememberMeDays': $('#ipt_mfaremembermedays').val(),
'Connectors': [connector]
};
var alerttitle = GetTextByKey("P_SET_SAVESYSTEMOPTIONS", 'Save System Options');
if (item.AccuracyFilter !== "") {
if (isNaN(item.AccuracyFilter)) {
showAlert(GetTextByKey("P_SET_ACCURACYFILTERFORMATERROR", 'Accuracy Filter format error.'), alerttitle);
return;
}
else {
if (item.AccuracyFilter <= 0) {
showAlert(GetTextByKey("P_SET_ACCURACYFILTERMUSTBBEGREATERTHAN0", 'Accuracy Filter must be greater than 0.'), alerttitle);
return;
}
}
}
else
item.AccuracyFilter = 0;
if (item.MFARememberMeDays !== "") {
if (!IsPositiveInteger.test(item.MFARememberMeDays)) {
showAlert(GetTextByKey("P_SET_XXX", 'MFA Remember Me Days format error.'), alerttitle);
return;
}
}
else
item.MFARememberMeDays = 0;
showloading(true);
var param = JSON.stringify(item);
systemoptionsrequest("SaveSystemOptions", param, function (data) {
if (data !== 'OK') {
showAlert(data, alerttitle);
} else {
showAlert(GetTextByKey("P_SET_SAVSUCCESSFULLY", "Saved Successfully."), alerttitle);
}
showloading(false);
}, function (err) {
showloading(false);
});
}
$(function () {
setPageTitle(GetTextByKey("P_SET_SYSTEMOPTIONS", 'System Options'), true);
OnRefresh();
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div style="padding: 0px; margin: 0px;">
<div class="page_title" data-lgid="P_SET_SYSTEMOPTIONS">System Options</div>
<div class="function_title">
<span class="sbutton iconsave" onclick="OnSave();" data-lgid="P_SET_SAVE">Save</span>
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_SET_REFRESH">Refresh</span>
</div>
<div class="clear"></div>
<div class="content_main content_div" style="padding-top: 20px;">
<table style="line-height: 30px; width: 100%;">
<tr>
<td class="label" style="width: 300px;" data-lgid="P_SET_TIMEZON_COLON">Time Zone:</td>
<td>
<select id="selTimeZone" style="width: 304px;"></select></td>
<td></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_ACCURACYFILTER_COLON">Accuracy Filter:</td>
<td>
<input id="accuracyfilter" style="width: 100px;" maxlength="10" /><span style="color: gray;" data-lgid="P_SET_ACCURACYFILTERTIPS">
FI Tracker ignore location when accuracy greater than…</span>
</td>
<td></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_UNITOFODOMETER_COLON">Unit Of Odometer:</td>
<td>
<select id="txtOdoUnit" style="width: 304px;">
<option value="Mile" data-lgid="P_SET_MILE">Mile</option>
<option value="Kilometre" data-lgid="P_SET_KILOMETER">Kilometer</option>
</select></td>
<td></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_AREAUNITS_COLON">Unit Of Area:</td>
<td>
<select id="selAreaUnit" style="width: 304px;">
<option value="0" data-lgid="P_SET_SQUAREMETER">Square Meter</option>
<option value="1" data-lgid="P_SET_SQUAREKILOMETRE">Square Kilometre</option>
<option value="2" data-lgid="P_SET_HECTARE">Hectare</option>
<option value="3" data-lgid="P_SET_ACRE">Acre</option>
<option value="4" data-lgid="P_SET_SQUAREMILE">Square Mile</option>
</select></td>
<td></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_VOLUMEUNITS_COLON">Unit Of Volume:</td>
<td>
<select id="selVolumeUnit" style="width: 304px;">
<option value="0" data-lgid="P_SET_LITRE">Litre</option>
<option value="1" data-lgid="P_SET_GALLONUS">Gallon(U.S.)</option>
<option value="2" data-lgid="P_SET_GALLONENGLISH">Gallon (U.K.)</option>
</select></td>
<td></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_WEIGHTUNITS_COLON">Unit Of Weight:</td>
<td>
<select id="selWeightUnit" style="width: 304px;">
<option value="0" data-lgid="P_SET_KILOGRAM">Kilogram</option>
<option value="1" data-lgid="P_SET_TONNE">Tonne</option>
<option value="2" data-lgid="P_SET_POUND">Pound</option>
<option value="3" data-lgid="P_SET_SHORTTON">Ton (U.S.)</option>
</select></td>
<td></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_REQUIRECOMMENTWHENACKNOWLEDGINGALERTS_COLON">Require comment when acknowledging alerts:</td>
<td>
<select id="sel_acknowledgealert" style="width: 304px;">
<option value="No" data-lgid="P_SET_NO">No</option>
<option value="Yes" data-lgid="P_SET_YES">Yes</option>
</select></td>
<td></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_MULTIFACTOR_COLON">Multi-Factor Authentication Org. Preference:</td>
<td>
<select id="sel_loginverifytype" style="width: 304px;">
<option value=""></option>
<option value="Email">Email</option>
<%--<option value="SMS">SMS</option>--%>
</select></td>
<td></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_XXX">MFA Remember Me Days:</td>
<td>
<input id="ipt_mfaremembermedays" style="width: 100px;" maxlength="10" /></td>
<td></td>
</tr>
<tr>
<td colspan="3">
<div style="font-size: 18px; color: grey; margin: 20px 0px 0px 10px" data-lgid="P_SET_CONNECTOR">Connector</div>
<hr />
</td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_SERVER_COLON">Server:</td>
<td>
<input id="ipt_connectorserver" style="width: 300px;" maxlength="200" /></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_TOKEN_COLON">Token:</td>
<td>
<input id="ipt_connectortoken" style="width: 300px;" maxlength="200" /></td>
<td></td>
</tr>
</table>
</div>
</div>
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
</asp:Content>

View File

@ -0,0 +1,30 @@
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.SystemSettings;
public partial class SystemOptions : SystemSettingsBasePage
{
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;
}
}
}
}

View File

@ -0,0 +1,173 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/SystemSettings/SysSettingMasterPage.master" AutoEventWireup="true" CodeFile="SystemParams.aspx.cs" Inherits="SystemParams" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<style type="text/css">
.label {
min-width: 100px;
font-weight: bold;
padding-right: 10px;
text-align: right;
}
.table_params {
width: 100%;
color: #666;
border-collapse: collapse;
table-layout: fixed;
}
.table_params thead tr {
background: #f9f9f9;
/*font-weight: bold;*/
}
.table_params tbody tr {
border-bottom: 1px solid #e6e6e6;
}
.table_params tbody tr:hover {
background: #f9f9f9;
}
</style>
<script type="text/javascript">
function systemparamsrequest(method, param, callback, error) {
_network.request("SystemSettings/SystemParams.aspx", -1, method, param, callback, error || function (e) {
console.log(e);
showmaskbg(false, true);
showAlert(GetTextByKey('P_SET_QUERY', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_SET_QUERY', 'Query'));
});
}
function OnRefresh() {
showloading(true);
systemparamsrequest("GetSystemParams", "", function (data) {
showloading(false);
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_SET_ERROR", 'Error'));
return;
}
showSystemParams(data);
}, function (err) {
showloading(false);
});
}
function showSystemParams(data) {
var tb = $("#tbody_systemparams");
tb.empty();
if (data && data.length > 0) {
for (var i = 0; i < data.length; i++) {
var param = data[i];
var tr = $('<tr></tr>').data('param', param).dblclick(function () {
openSystemParam(this);
});
tb.append(tr);
var td = $('<td style="padding-left:10px;"></td>').text(param.Key);
tr.append(td);
td = $('<td></td>').text(param.Value);
tr.append(td);
td = $('<td></td>');
tr.append(td);
var span = $('<span class="sbutton iconedit" title="' + GetTextByKey('P_SET_XXX', 'Edit') + '"></span>').data('param', param).click(function () {
openSystemParam(this);
});
td.append(span);
}
}
}
var paramname;
function openSystemParam(e) {
var param = $(e).data('param')
if (!param) {
return;
}
paramname = param.Key;
$('#dialog_paramvalue').val(param.Value);
$('#dialog_systemparam .dialog-title span.title').text(paramname);
showmaskbg(true);
$('#dialog_systemparam')
.css({
'top': (document.documentElement.clientHeight - $('#dialog_systemparam').height()) / 3,
'left': (document.documentElement.clientWidth - $('#dialog_systemparam').width()) / 2
}).showDialogfixed();
$('#dialog_paramvalue').focus();
}
function onSetSystemParams() {
var value = $('#dialog_paramvalue').val();
var item = [paramname, value];
var param = JSON.stringify(item);
param = htmlencode(param);
var alerttitle = GetTextByKey('P_SET_XXX', 'System Param')
systemparamsrequest("SetSystemParams", param, function (data) {
if (data !== 'OK') {
showAlert(data, alerttitle);
return;
}
showmaskbg(false);
$('#dialog_systemparam').hideDialog();
OnRefresh();
}, function (err) {
showmaskbg(false);
});
}
$(function () {
setPageTitle(GetTextByKey("P_SET_XXX", 'System Params'), true);
$('#dialog_systemparam').dialog(function () {
showmaskbg(false);
});
OnRefresh();
$(window).resize(function () {
$("#paramslist").css("height", $(window).height() - $("#paramslist").offset().top - 4);
}).resize();
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div style="padding: 0px; margin: 0px;">
<div class="page_title" data-lgid="P_SET_XXX">System Params</div>
<div class="function_title">
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_SET_REFRESH">Refresh</span>
</div>
<div class="clear"></div>
<div id="paramslist" class="content_main content_div">
<table class="table_params" style="line-height: 30px; width: 100%;">
<thead>
<tr style="text-align: left;">
<th style="width: 200px; padding-left: 10px;">Name</th>
<th style="width: 600px;">Value</th>
<th style="width: 50px;"></th>
</tr>
</thead>
<tbody id="tbody_systemparams"></tbody>
</table>
</div>
</div>
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
<div class="dialog" id="dialog_systemparam" style="display: none; width: 500px;">
<div class="dialog-title"><span class="title"></span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table>
<tr>
<td>
<textarea id="dialog_paramvalue" class="inputbox" tabindex="1" style="width: 475px; height: 200px;"></textarea></td>
</tr>
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_SET_CANCEL" class="dialog-close" tabindex="8" />
<input type="button" onclick="onSetSystemParams();" value="OK" data-lgid="P_SET_OK" tabindex="7" />
<div class="clear"></div>
</div>
</div>
</asp:Content>

View File

@ -0,0 +1,37 @@
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.SystemSettings;
public partial class SystemParams : CustomerProviderBasePage
{
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()
{
if (!IsDev)
return false;
return base.AllowCurrentLoginSessionEnter();
}
}

View File

@ -0,0 +1,68 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/IronIntelMasterPage.master" AutoEventWireup="true" CodeFile="SystemSettings.aspx.cs" Inherits="SystemSettings" %>
<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 () {
window.changePage(old_hash);
});
</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_useroptions" page="UserOptions.aspx" title="User Options" data-title-lgid="P_SET_USEROPTIONS"><a href="#nav_useroptions">
<div>
<img style="width: 20px; height: 20px;" src="img/useroptions.png" />
</div>
<span data-lgid="P_SET_USEROPTIONS">User Options</span></a></li>
<li class="nav_item" id="nav_settingcolors" style="<%=StyleSettingDisplay%>" page="SettingColors.aspx" title="Style Setting" data-title-lgid="P_SET_STYLESETTING"><a href="#nav_settingcolors">
<div>
<img style="width: 20px; height: 20px;" src="img/style.png" />
</div>
<span data-lgid="P_SET_STYLESETTING">Style Setting</span></a></li>
<li class="nav_item" id="nav_locations" style="<%=StyleSettingDisplay%>" page="ManageLocations.aspx" title="Manage Locations" data-title-lgid="P_SET_MANAGELOCATIONS"><a href="#nav_locations">
<div>
<img style="width: 20px; height: 20px;" src="img/location.png" />
</div>
<span data-lgid="P_SET_MANAGELOCATIONS">Manage Locations</span></a></li>
<li class="nav_item" id="nav_departments" style="<%=StyleSettingDisplay%>" page="ManageDepartments.aspx" title="Manage Departments" data-title-lgid="P_SET_MANAGEDEPARTMENTS"><a href="#nav_departments">
<div>
<button class="icondepartment"></button>
</div>
<span data-lgid="P_SET_MANAGEDEPARTMENTS">Manage Departments</span></a></li>
<li class="nav_item" id="nav_regions" style="<%=StyleSettingDisplay%>" page="ManageRegions.aspx" title="Manage Regions" data-title-lgid="P_SET_MANAGEREGIONS"><a href="#nav_regions">
<div>
<img style="width: 20px; height: 20px;" src="img/location.png" />
</div>
<span data-lgid="P_SET_MANAGEREGIONS">Manage Regions</span></a></li>
<li class="nav_item" id="nav_systemoptions" style="<%=StyleSettingDisplay%>" page="SystemOptions.aspx" title="System Options" data-title-lgid="P_SET_SYSTEMOPTIONS"><a href="#nav_systemoptions">
<div>
<img style="width: 20px; height: 20px;" src="img/systemoptions.png" />
</div>
<span data-lgid="P_SET_SYSTEMOPTIONS">System Options</span></a></li>
<%if (IsDev)
{ %>
<li class="nav_item" id="nav_sysparams" style="<%=ParamSettingDisplay%>" page="SystemParams.aspx" title="System Params" data-title-lgid="P_SET_XXX"><a href="#nav_sysparams">
<div>
<img style="width: 20px; height: 20px;" src="img/systemoptions.png" />
</div>
<span data-lgid="P_SET_XXX">System Params</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>

View File

@ -0,0 +1,51 @@
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.SystemSettings;
public partial class SystemSettings : SystemSettingsBasePage
{
protected string StyleSettingDisplay = "display:none;";
protected string ParamSettingDisplay = "display:none;";
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;
}
IronIntel.Contractor.Users.UserInfo user = GetCurrentUser();
if (user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin
|| user.UserType == IronIntel.Contractor.Users.UserTypes.Admin)
{
StyleSettingDisplay = "";
}
if (user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin)
{
ParamSettingDisplay = "";
}
}
}
public bool IsSupperAdmin
{
get
{
var user = GetCurrentUser();
return user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin;
}
}
}

View File

@ -0,0 +1,637 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/SystemSettings/SysSettingMasterPage.master" AutoEventWireup="true" CodeFile="UserOptions.aspx.cs" Inherits="UserOptions" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<link type="text/css" href="<%=GetFileUrlWithVersion("../fic/fic/css/Grid.css")%>" rel="stylesheet" />
<link href="<%=GetFileUrlWithVersion("../fic/css/datepicker.min.css")%>" rel="stylesheet" />
<link href="<%=Common.GenerateUrl("../fic/fic/css/form.css") %>" rel="stylesheet" />
<link href="<%=Common.GenerateUrl("../fic/fic/css/tabcontrol.css") %>" rel="stylesheet" />
<link href="<%=Common.GenerateUrl("../fic/fic/css/theme.css") %>" rel="stylesheet" />
<link href="<%=Common.GenerateUrl("../fic/fic/css/schedule.css") %>" rel="stylesheet" />
<link href="<%=Common.GenerateUrl("../fic/fic/css/workspace.css") %>" rel="stylesheet" />
<link href="<%=Common.GenerateUrl("../fic/fic/css/pivot.css") %>" rel="stylesheet" />
<link type="text/css" href="<%=Common.GenerateUrl("../fic/fic/js/components/css/datagrid.css") %>" rel="stylesheet" />
<link type="text/css" href="<%=Common.GenerateUrl("../css/override.css") %>" rel="stylesheet" />
<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: 24px;
height: 24px;
vertical-align: middle !important;
}
.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;
}
.edit-content table td input[type="radio"] {
border: none;
width: unset;
height: unset;
}
.edit-content table td textarea {
height: 100px;
resize: none;
/*max-width: 200px;*/
}
.div_filter {
margin-top: -3px;
}
.div_filter .dropdown {
width: 322px;
margin: 2px 0 0 0px;
}
.div_panel {
min-width: 200px;
}
.a {
text-decoration: none;
color: #2140fb;
}
.subtitle {
margin: 20px 40px 10px 0px;
font-size: 16px;
color: gray;
}
.subtitle span {
margin-left: 10px;
}
.subtitle hr {
background-color: #d8d8d8;
border: none;
height: 1px;
margin: 0;
}
.machinetd {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.tab-header {
float: left;
padding: 2px 6px;
cursor: pointer;
border: 1px solid #fff;
border-bottom: none;
}
.tab-header:hover {
background: #eee;
}
.tab-header.selected {
border-color: #d8d8d8;
cursor: default;
}
.tab-header.selected:hover {
background: #fff;
}
.ctl_button {
font-family: 'CalciteWebCoreIcons';
display: block;
margin: 6px auto;
width: 60px;
height: 22px;
line-height: 21px;
padding: 0;
}
.gridchartheader td {
font-weight: normal;
}
.div_module {
font-weight: 700;
}
.table_module {
line-height: 30px;
margin-left: 20px;
margin-bottom: 15px;
}
.td_module {
width: 200px;
font-weight: bold;
}
.label { /*cover tab.css*/
display: table-cell;
}
.login_lable {
height: 24px;
line-height: 24px;
}
.sbutton {
font-weight: 200;
}
</style>
<script type="text/javascript" src="<%=GetFileUrlWithVersion("../fic/js/lib/vue.min.js")%>"></script>
<script src="<%=GetFileUrlWithVersion("../js/controls.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../fic/js/utility.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../fic/fic/js/controls/gridctrl.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../fic/fic/js/controls/editGridCtrl.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../fic/fic/js/controls/dialog.js")%>" type="text/javascript"></script>
<script type="text/javascript" src="<%=GetFileUrlWithVersion("../fic/fic/js/components/datagrid.js")%>"></script>
<%--<script src="<%=GetFileUrlWithVersion("../fic/fic/js/controls/controls.js") %>"></script>--%>
<script src="<%=GetFileUrlWithVersion("../fic/fic/js/pivot.js")%>"></script>
<script src="<%=GetFileUrlWithVersion("../fic/fic/js/chart.js") %>"></script>
<script src="<%=GetFileUrlWithVersion("../fic/fic/js/workspace.js") %>"></script>
<script src="<%=GetFileUrlWithVersion("../fic/fic/js/controls/form.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../js/utility.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../js/language.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../js/modulelang.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../js/assetselector.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("js/userfilter.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../fic/fic/js/Management/func.js") %>"></script>
<script type="text/javascript" src="<%=GetFileUrlWithVersion("../fic/fic/js/controls/wizardctrl.js") %>"></script>
<script type="text/javascript" src="<%=GetFileUrlWithVersion("../fic/fic/js/Management/UserAlertFilter.js")%>"></script>
<script type="text/javascript" src="<%=GetFileUrlWithVersion("../fic/fic/js/chartManage/chartTypeWizard.js") %>"></script>
<script type="text/javascript" src="<%=GetFileUrlWithVersion("../fic/fic/js/Management/filtersSelector.js") %>"></script>
<script>
$(function () {
_utility.currentLang = _fleet.currentLang;
});
$addDomainUserForm = function () { }
</script>
<script src="<%=GetFileUrlWithVersion("../fic/js/datepicker.min.js")%>"></script>
<script src="<%=GetFileUrlWithVersion("../fic/fic/js/Management/UserManagement.js")%>" type="text/javascript"></script>
<script type="text/javascript">
var userOptions = null;
var uid = '<%=IID%>';
var IsSupperAdmin =<%=IsSupperAdmin ?"true":"false"%>;
function requestFIC(service, method, param, callback, error) {
$.ajax({
url: _network.root + 'fic/fic/FICSvc.ashx?fmt=json&SN=' + Math.random(),
type: 'POST',
dataType: 'json',
cache: false,
data: encodeURIComponent(JSON.stringify({
LanguageID: _utility.currentLang,
UtcOffset: new Date().getTimezoneOffset(),
Flag: 0,
AppName: '',
ServiceType: service,
MethodName: method,
Parameters: param
})),
async: true,
success: callback,
error: error || function (e) {
console.log(e);
showmaskbg(false, true);
showAlert(GetTextByKey('P_UM_PAGEERROR', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_UM_QUERY', 'Query'));
}
});
}
_network.query = function (method, param, callback, error) {
requestFIC('FI.FIC.IFICQuery', method, param, callback, error);
};
_network.management = function (method, param, callback, error, nolog, isSync) {
requestFIC('FI.FIC.IFICManagement', method, param, callback, error, nolog, isSync);
};
function useroptionsrequest(method, param, callback, error) {
_network.request("SystemSettings/UserOptions.aspx", -1, method, param, callback, error || function (e) {
console.log(e);
showmaskbg(false, true);
showAlert(GetTextByKey('P_SET_QUERY', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_SET_QUERY', 'Query'));
});
}
function OnRefresh() {
GetOptionSetting();
allFilterAssetTypes = undefined;
allFilterJobsites = undefined;
allFilterAssetGroups = undefined;
userfiltertemplateloaded = true;
getUserFilterData();
}
function GetOptionSetting() {
showloading(true);
getStyleData();
getLanguages();
getTimeZones();
}
function getStyleData() {
useroptionsrequest("GetCompanyUIStyles", "", function (data) {
showloading(false);
showStyles(data);
getUserOptions();
}, function (err) {
showloading(false);
});
}
function showStyles(styles) {
var sel = $("#selStyle");
var style = sel.val();
sel.empty();
var op = $("<option></option>").val("").text("");
sel.append(op);
if (styles) {
for (var i = 0; i < styles.length; i++) {
var s = styles[i];
var op = $("<option></option>").val(s.UIStyleID).text(s.UIStyleName);
sel.append(op);
}
if (style && style != "") {
sel.val(style);
}
}
}
function getLanguages() {
useroptionsrequest("GetLanguages", "", function (data) {
showLanguages(data);
}, function (err) {
});
}
function showLanguages(lans) {
var sel = $("#sellanguages");
var language = sel.val();
sel.empty();
var op = $("<option></option>").val("").text("");
sel.append(op);
if (lans) {
for (var i = 0; i < lans.length; i++) {
var s = lans[i];
var op = $("<option></option>").val(s.Key).text(s.Value);
sel.append(op);
}
if (language && language != "") {
sel.val(language);
}
}
}
function getTimeZones() {
useroptionsrequest("GetTimeZones", "", function (data) {
showTimeZones(data);
getUserOptions();
}, function (err) {
});
}
function showTimeZones(data) {
var sel = $("#dialog_timezone");
var timezone = sel.val();
sel.empty();
var op = $("<option></option>").val("").text("");
sel.append(op);
if (data && data.length > 0) {
for (var i = 0; i < data.length; i++) {
sel.append($("<option></option>").val(data[i].Key).text("(" + data[i].Value + ")" + data[i].Key).attr("offset", data[i].Tag1));
}
if (timezone && timezone != "") {
sel.val(timezone);
}
}
}
function getUserOptions() {
useroptionsrequest("GetUserOptions", "", function (data) {
userOptions = data;
showUserOptions();
}, function (err) {
});
}
function showUserOptions() {
if (userOptions.SystemStyleID) {
$("#selStyle").val(userOptions.SystemStyleID);
}
if (userOptions.PreferredLanguage) {
$("#sellanguages").val(userOptions.PreferredLanguage);
}
if (IsSupperAdmin) {
$("#dialog_timezone").val('');
}
else {
if (userOptions.TimeZone) {
$("#dialog_timezone").val(userOptions.TimeZone);
}
}
}
function OnSave() {
userOptions.SystemStyleID = $("#selStyle").val();
userOptions.PreferredLanguage = $("#sellanguages").val();
userOptions.TimeZone = IsSupperAdmin ? '' : $("#dialog_timezone").val();
//subscribe
var subscribe = null;
var userfilter = null;
if (scriber) {
subscribe = scriber.getObject();
userfilter = scriber.getUserFilter();
if (typeof subscribe === 'string') {
showAlert(subscribe, GetTextByKey("P_UM_ERROR", 'Error'));
return;
}
}
//FIC Alert Filter Templates
var filtertemplates = [];
if (userfiltertemplateloaded) {
$("#sel_filtertemplate option").each(function () {
var temp = { 'Id': $(this).val(), 'Name': $(this).text() };
var filterdata = $(this).data('filterdata');
if (filterdata) {
if (filterdata.Assets)
temp.Assets = filterdata.Assets;
if (filterdata.AssetGroups)
temp.AssetGroups = filterdata.AssetGroups;
if (filterdata.AssetTypes)
temp.AssetTypes = filterdata.AssetTypes;
if (filterdata.Jobsites)
temp.Jobsites = filterdata.Jobsites;
}
if (temp.Id < 0 || (temp.Id > 0 && filterdata))
filtertemplates.push(temp);
})
}
var param = JSON.stringify({
'UserParam': userOptions,
'Subscribe': subscribe,
'UserAlertFilter': userfilter,
'FilterTemplates': filtertemplates,
'DeleteFilterTemplates': deletefiltertemplates
});
showloading(true);
param = htmlencode(param);
useroptionsrequest("SaveUserOptions", param, function (data) {
if (data !== 'OK') {
showAlert(data, GetTextByKey("P_SET_SAVEUSEROPTIONS", 'Save User Options'));
} else {
if (userfiltertemplateloaded) {
getUserFilterData();
}
showAlert(GetTextByKey("P_SET_SAVSUCCESSFULLY", "Saved Successfully."), GetTextByKey("P_SET_SAVEUSEROPTIONS", 'Save User Options'));
}
showloading(false);
}, function (err) {
showloading(false);
});
}
function onuserfilterclick() {
if (!userfiltertemplateloaded) {
userfiltertemplateloaded = true;
getUserFilterData();
}
else {
setTimeout(function () {
grid_dtfilterassets && grid_dtfilterassets.resize();
grid_dtfiltersag && grid_dtfiltersag.resize();
grid_dtfilterjs && grid_dtfilterjs.resize();
grid_dtfilterat && grid_dtfilterat.resize();
});
}
}
function reshowgrid() {
setTimeout(function () {
$('#SubMSG_leftTD').children().data('grid').onresize();
$('#SubMSG_rightTD').children().data('grid').onresize();
//$("#contactlist").css("height", $(window).height() - $("#contactlist").offset().top - 10);
gridSchedule && gridSchedule.resize();
});
}
var scriber;
var userfiltertemplateloaded = false;
$(function () {
setPageTitle(GetTextByKey("P_SET_USEROPTIONS", 'User Options'), true);
// prepare subscribe message
var subscribe = new $subscribeMSGpanel();
subscribe.append($('#subscribe_message').empty(), uid, -1, null, true, 450);
//$('#subscribe_message').applyLanguageText(true);
scriber = subscribe;
if (IsSupperAdmin)
$('#tr_timezone').hide();
else
$('#tr_timezone').show();
GetOptionSetting();
$("#div_container").tab();
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div style="padding: 0px; margin: 0px;">
<div class="page_title" data-lgid="P_SET_USEROPTIONS">User Options</div>
<div class="function_title">
<span class="sbutton iconsave" onclick="OnSave();" data-lgid="P_SET_SAVE">Save</span>
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_SET_REFRESH">Refresh</span>
</div>
<div class="clear"></div>
<div class="content_main content_div">
<div class="edit-content">
<div id="div_container">
<ul id="ul_container" class="tab_header" style="padding-top: 5px;">
<li id="tab_header_info" data-href="tab_info" class="selected" data-lgid="P_XXXX">User Information</li>
<li id="tab_header_subscribe" data-href="tab_subscribe" onclick="reshowgrid()" data-lgid="P_UM_SUBSCRIBEMESSAGE">Subscribe Message</li>
<li id="tab_header_filter" data-href="tab_filter" class="cononly" onclick="onuserfilterclick()" data-lgid="P_XXXX">Asset Alert Filter Templates</li>
</ul>
<div id="tab_info" data-page="tab_info">
<table style="line-height: 30px; table-layout: fixed;">
<tr>
<td class="label" style="width: 160px;" data-lgid="P_SET_STYLE_COLON">Style:</td>
<td style="width: 300px;">
<select id="selStyle" style="width: 200px; height: 20px;"></select></td>
<td></td>
</tr>
<tr>
<td class="label" data-lgid="P_SET_LANGUAGES_COLON">Languages:</td>
<td>
<select id="sellanguages" style="width: 200px; height: 20px;"></select></td>
<td></td>
</tr>
<tr id="tr_timezone" style="display: none;">
<td class="label" data-lgid="P_SET_XXX">Time Zone:</td>
<td>
<select id="dialog_timezone" style="width: 200px; height: 20px;"></select></td>
<td></td>
</tr>
</table>
</div>
<div id="tab_subscribe" data-page="tab_subscribe" style="display: none">
<div id="subscribe_message" style="position: relative; padding-left: 50px; min-width: 1045px;"></div>
</div>
<div id="tab_filter" data-page="tab_filter" style="display: none;">
<div style="margin: 9px 6px 20px">
<span class="title" data-lgid="P_XXXX">Filter Templates:</span>
<select id="sel_filtertemplate" style="width: 300px;"></select>
<span class="sbutton iconadd" onclick="onOpenFilterTemplate(0);" data-lgid="P_UM_ADD"></span>
<span class="sbutton iconedit" onclick="onOpenFilterTemplate(1);" data-lgid="P_UM_EDIT"></span>
<span class="sbutton iconcopy" onclick="onOpenFilterTemplate(2);" data-lgid="P_IPT_COPY"></span>
<span class="sbutton icondelete" onclick="onDeleteFilterTemplate();" data-lgid="P_UM_DELETE"></span>
</div>
<div style="display: inline-block;">
<div class="machine_filter" style="margin: 9px 6px 5px">
<span class="title" data-lgid="P_UM_ASSETASS">Asset(s)</span>
<span class="sbutton iconadd" onclick="OnFilterAssetAdd()" data-lgid="P_UM_ADD">Add</span>
<span class="sbutton icondelete" onclick="OnFilterMachineDelete()" data-lgid="P_UM_DELETE">Delete</span>
</div>
<div id="selectedfilterassetlist" style="height: 200px; width: 760px;"></div>
</div>
<div>
<div class="machine_filter" style="margin: 9px 6px 5px">
<span class="title" data-lgid="P_UM_ASSETGROUPS">Asset Group(s)</span>
<span class="sbutton iconadd" onclick="OnFilterAssetGroupAdd()" data-lgid="P_UM_ADD">Add</span>
<span class="sbutton icondelete" onclick="OnFilterAssetGroupDelete()" data-lgid="P_UM_DELETE">Delete</span>
</div>
<div id="selectedfilterassetgrouplist" style="height: 200px; width: 760px;"></div>
</div>
<div>
<div class="machine_filter" style="margin: 9px 6px 5px">
<span class="title" data-lgid="P_UM_JOBSITES">Jobsite(s)</span>
<span class="sbutton iconadd" onclick="OnFilterJobsiteAdd()" data-lgid="P_UM_ADD">Add</span>
<span class="sbutton icondelete" onclick="OnFilterJobsiteDelete()" data-lgid="P_UM_DELETE">Delete</span>
</div>
<div id="selectedfilterjobsitelist" style="height: 200px; width: 760px;"></div>
</div>
<div>
<div class="machine_filter" style="margin: 9px 6px 5px">
<span class="title" data-lgid="P_UM_ASSETTYPES">Asset Type(s)</span>
<span class="sbutton iconadd" onclick="OnFilterAssetTypeAdd()" data-lgid="P_UM_ADD">Add</span>
<span class="sbutton icondelete" onclick="OnFilterAssetTypeDelete()" data-lgid="P_UM_DELETE">Delete</span>
</div>
<div id="selectedfilterassettypelist" style="height: 200px; width: 760px;"></div>
</div>
</div>
<div class="mask_loading dialog" style="display: none;"></div>
</div>
</div>
</div>
</div>
<div class="dialog" id="dialog_filterassetgroup" style="display: none; width: 650px;">
<div class="dialog-title"><span class="title" data-lgid="P_UM_SELECTASSETGROUPS">Select Asset Groups</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<div style="position: relative; width: 470px; margin-top: 4px; float: left">
<input type="text" placeholder="Search" id="txt_filterassetgroup_key" autocomplete="off" style="width: 100%; padding-right: 28px; height: 25px; line-height: 25px; box-sizing: border-box; text-indent: 4px;" />
<div style="position: absolute; top: 0px; right: 0px; height: 25px; width: 28px; text-align: center; line-height: 25px; font-size: 1.2em; font-family: FontAwesome; font-weight: 900; color: rgb(123, 28, 33); cursor: pointer;" onclick="GetFilerAssetGroupList()">&#xf002;</div>
</div>
<div style="clear: both;"></div>
<div id="availablefilterassetgrouplist" style="height: 400px; width: 630px; margin: 10px 0 4px;"></div>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_UM_CANCEL" class="dialog-close" tabindex="18" style="height: 26px;" />
<input type="button" onclick="OnSetFilterSelectAssetGroups();" value="OK" data-lgid="P_UM_OK" tabindex="17" />
<div class="clear"></div>
</div>
<div class="maskbg" style="display: none;"></div>
</div>
<div class="dialog" id="dialog_filterjobsite" style="display: none; width: 650px;">
<div class="dialog-title"><span class="title" data-lgid="P_UM_SELECTJOBSITES">Select Jobsites</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<div style="position: relative; width: 470px; margin-top: 4px; float: left">
<input type="text" placeholder="Search" id="txt_filterjobsite_key" autocomplete="off" style="width: 100%; padding-right: 28px; height: 25px; line-height: 25px; box-sizing: border-box; text-indent: 4px;" />
<div style="position: absolute; top: 0px; right: 0px; height: 25px; width: 28px; text-align: center; line-height: 25px; font-size: 1.2em; font-family: FontAwesome; font-weight: 900; color: rgb(123, 28, 33); cursor: pointer;" onclick="GetFilterJobsiteList()">&#xf002;</div>
</div>
<div style="clear: both;"></div>
<div id="filteravailablejobsitelist" style="height: 400px; width: 630px; margin: 10px 0 4px;"></div>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_UM_CANCEL" class="dialog-close" tabindex="18" style="height: 26px;" />
<input type="button" onclick="OnSetFilterSelectJobSites();" value="OK" data-lgid="P_UM_OK" tabindex="17" />
</div>
<div class="maskbg" style="display: none;"></div>
</div>
<div class="dialog" id="dialog_filterassettype" style="display: none; width: 650px;">
<div class="dialog-title"><span class="title" data-lgid="P_UM_SELECTASSETTYPES">Select Asset Types</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<div style="position: relative; width: 470px; margin-top: 4px; float: left">
<input type="text" placeholder="Search" id="txt_filterassettype_key" autocomplete="off" style="width: 100%; padding-right: 28px; height: 25px; line-height: 25px; box-sizing: border-box; text-indent: 4px;" />
<div style="position: absolute; top: 0px; right: 0px; height: 25px; width: 28px; text-align: center; line-height: 25px; font-size: 1.2em; font-family: FontAwesome; font-weight: 900; color: rgb(123, 28, 33); cursor: pointer;" onclick="GetFilterAssetTypeList()">&#xf002;</div>
</div>
<div style="clear: both;"></div>
<div id="filteravailableassettypelist" style="height: 400px; width: 630px; margin: 10px 0 4px;"></div>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_UM_CANCEL" class="dialog-close" tabindex="18" style="height: 26px;" />
<input type="button" onclick="OnSetFilterSelectAssetTypes();" value="OK" data-lgid="P_UM_OK" tabindex="17" />
</div>
<div class="maskbg" style="display: none;"></div>
</div>
<div class="dialog" id="dialog_filtertemplate" style="display: none; width: 500px;">
<div class="dialog-title"><span class="title" data-lgid="P_XXX">Add Filter Template</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table style="line-height: 30px; table-layout: fixed;">
<tr>
<td class="label" style="width: 160px;" data-lgid="P_XXX">Template Name:</td>
<td style="width: 330px;">
<input type="text" id="dialog_filtertemplatename" tabindex="1" maxlength="200" autocomplete="off" /></td>
</tr>
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_UM_CANCEL" class="dialog-close" tabindex="18" style="height: 26px;" />
<input type="button" onclick="OnSetFilterTemplate();" value="OK" data-lgid="P_UM_OK" tabindex="17" />
</div>
<div class="maskbg" style="display: none;"></div>
</div>
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
</asp:Content>

View File

@ -0,0 +1,43 @@
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.SystemSettings;
public partial class UserOptions : SystemSettingsBasePage
{
public string IID = "";
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 = GetCurrentUser().IID;
}
}
}
public bool IsSupperAdmin
{
get
{
var user = GetCurrentUser();
if (user.UserType == IronIntel.Contractor.Users.UserTypes.SupperAdmin)
return true;
else
return false;
}
}
}

View File

@ -0,0 +1,459 @@
/*
colorpick Color Picker / colorpick.com
*/
/*Main container*/
.colorpick {
position: absolute;
width: 346px;
height: 170px;
overflow: hidden;
display: none;
font-family: Arial, Helvetica, sans-serif;
background:#ebebeb;
border: 1px solid #bbb;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
/*Prevents selecting text when dragging the selectors*/
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
/*Color selection box with gradients*/
.colorpick_color {
position: absolute;
left: 7px;
top: 7px;
width: 156px;
height: 156px;
overflow: hidden;
outline: 1px solid #aaa;
cursor: crosshair;
}
.colorpick_color_overlay1 {
position: absolute;
left:0;
top:0;
width: 156px;
height: 156px;
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff')"; /* IE8 */
background: -moz-linear-gradient(left, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(255,255,255,0))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* IE10+ */
background: linear-gradient(to right, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff'); /* IE6 & IE7 */
}
.colorpick_color_overlay2 {
position: absolute;
left:0;
top:0;
width: 156px;
height: 156px;
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000')"; /* IE8 */
background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0)), color-stop(100%,rgba(0,0,0,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', endColorstr='#000000',GradientType=0 ); /* IE6-9 */
}
/*Circular color selector*/
.colorpick_selector_outer {
background:none;
position: absolute;
width: 11px;
height: 11px;
margin: -6px 0 0 -6px;
border: 1px solid black;
border-radius: 50%;
}
.colorpick_selector_inner{
position: absolute;
width: 9px;
height: 9px;
border: 1px solid white;
border-radius: 50%;
}
/*Vertical hue bar*/
.colorpick_hue {
position: absolute;
top: 6px;
left: 175px;
width: 19px;
height: 156px;
border: 1px solid #aaa;
cursor: n-resize;
}
/*Hue bar sliding indicator*/
.colorpick_hue_arrs {
position: absolute;
left: -8px;
width: 35px;
height: 7px;
margin: -7px 0 0 0;
}
.colorpick_hue_larr {
position:absolute;
width: 0;
height: 0;
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
border-left: 7px solid #858585;
}
.colorpick_hue_rarr {
position:absolute;
right:0;
width: 0;
height: 0;
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
border-right: 7px solid #858585;
}
/*New color box*/
.colorpick_new_color {
position: absolute;
left: 207px;
top: 6px;
width: 60px;
height: 27px;
background: #f00;
border: 1px solid #8f8f8f;
}
/*Current color box*/
.colorpick_current_color {
position: absolute;
left: 277px;
top: 6px;
width: 60px;
height: 27px;
background: #f00;
border: 1px solid #8f8f8f;
}
/*Input field containers*/
.colorpick_field, .colorpick_hex_field {
position: absolute;
height: 20px;
width: 60px;
overflow:hidden;
background:#f3f3f3;
color:#b8b8b8;
font-size:12px;
border:1px solid #bdbdbd;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.colorpick_rgb_r {
top: 40px;
left: 207px;
}
.colorpick_rgb_g {
top: 67px;
left: 207px;
}
.colorpick_rgb_b {
top: 94px;
left: 207px;
}
.colorpick_hsb_h {
top: 40px;
left: 277px;
}
.colorpick_hsb_s {
top: 67px;
left: 277px;
}
.colorpick_hsb_b {
top: 94px;
left: 277px;
}
.colorpick_hex_field {
width: 68px;
left: 207px;
top: 121px;
}
/*Text field container on focus*/
.colorpick_focus {
border-color: #999;
}
/*Field label container*/
.colorpick_field_letter {
position: absolute;
width: 12px;
height: 20px;
line-height: 20px;
padding-left: 4px;
background: #efefef;
border-right: 1px solid #bdbdbd;
font-weight: bold;
color:#777;
}
/*Text inputs*/
.colorpick_field input, .colorpick_hex_field input {
position: absolute;
right: 11px;
margin: 0;
padding: 0;
height: 20px;
line-height: 20px;
background: transparent;
border: none;
font-size: 12px;
font-family: Arial, Helvetica, sans-serif;
color: #555;
text-align: right;
outline: none;
}
.colorpick_hex_field input {
right: 4px;
}
/*Field up/down arrows*/
.colorpick_field_arrs {
position: absolute;
top: 0;
right: 0;
width: 9px;
height: 21px;
cursor: n-resize;
}
.colorpick_field_uarr {
position: absolute;
top: 5px;
width: 0;
height: 0;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-bottom: 4px solid #959595;
}
.colorpick_field_darr {
position: absolute;
bottom:5px;
width: 0;
height: 0;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-top: 4px solid #959595;
}
/*Submit/Select button*/
.colorpick_submit {
position: absolute;
left: 217px;
top: 145px;
width: 50px;
height: 22px;
line-height:22px;
background: #efefef;
text-align: center;
color: #555;
font-size: 12px;
font-weight:bold;
border: 1px solid #bdbdbd;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.colorpick_submit:hover {
background:#f3f3f3;
border-color:#999;
cursor: pointer;
}
.colorpick_cancel {
position: absolute;
left: 280px;
top: 145px;
width: 50px;
height: 22px;
line-height: 22px;
background: #efefef;
text-align: center;
color: #555;
font-size: 12px;
font-weight: bold;
border: 1px solid #bdbdbd;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
float: right;
}
.colorpick_cancel:hover {
background:#f3f3f3;
border-color:#999;
cursor: pointer;
}
/*full layout with no submit button*/
.colorpick_full_ns .colorpick_submit, .colorpick_full_ns .colorpick_current_color{
display:none;
}
.colorpick_full_ns .colorpick_new_color {
width: 130px;
height: 25130px;
height: 25px;
}
.colorpick_full_ns .colorpick_rgb_r, .colorpick_full_ns .colorpick_hsb_{
.colorpick_hsb_h
/*full layout with no submit button*/
.colorpick_full_ns .colorpick_submit, .colorpick_full_ns .colorpick_current_color{
display:none;
}
.colorpick_full_ns .colorpick_new_color {
width: 130px;
height: 25px;
}
.colorpick_full_ns .colorpick_rgb_r, .colorpick_full_ns .colorpick_hsb_h {
top: 42px;
}
.colorpick_full_ns .colorpick_rgb_g, .colorpick_full_ns .colorpick_hsb_s {
top: 73px;
}
.colorpick_full_ns .colorpick_rgb_b, .colorpick_full_ns .colorpick_hsb_b {
top: 104px;
}
.colorpick_full_ns .colorpick_hex_field {
top: 135px;
}
/*rgbhex layout*/
.colorpick_rgbhex .colorpick_hsb_h, .colorpick_rgbhex .colorpick_hsb_s, .colorpick_rgbhex .colorpick_hsb_b {
display:none;
}
.colorpick_rgbhex {
width:282px;
}
.colorpick_rgbhex .colorpick_field, .colorpick_rgbhex .colorpick_submit {
width:68px;
}
.colorpick_rgbhex .colorpick_new_color {
width:34px;
border-right:none;
}
.colorpick_rgbhex .colorpick_current_color {
width:34px;
left:240px;
border-left:none;
}
/*rgbhex layout, no submit button*/
.colorpick_rgbhex_ns .colorpick_submit, .colorpick_rgbhex_ns .colorpick_current_color{
display:none;
}
.colorpick_rgbhex_ns .colorpick_new_color{
width:68px;
border: 1px solid #8f8f8f;
}
.colorpick_rgbhex_ns .colorpick_rgb_r {
top: 42px;
}
.colorpick_rgbhex_ns .colorpick_rgb_g {
top: 73px;
}
.colorpick_rgbhex_ns .colorpick_rgb_b {
top: 104px;
}
.colorpick_rgbhex_ns .colorpick_hex_field {
top: 135px;
}
/*hex layout*/
.colorpick_hex .colorpick_hsb_h, .colorpick_hex .colorpick_hsb_s, .colorpick_hex .colorpick_hsb_b, .colorpick_hex .colorpick_rgb_r, .colorpick_hex .colorpick_rgb_g, .colorpick_hex .colorpick_rgb_b {
display:none;
}
.colorpick_hex {
width:206px;
height:201px;
}
.colorpick_hex .colorpick_hex_field {
width:72px;
height:25px;
top:168px;
left:80px;
}
.colorpick_hex .colorpick_hex_field div, .colorpick_hex .colorpick_hex_field input {
height: 25px;
line-height: 25px;
}
.colorpick_hex .colorpick_new_color {
left:9px;
top:168px;
width:30px;
border-right:none;
}
.colorpick_hex .colorpick_current_color {
left:39px;
top:168px;
width:30px;
border-left:none;
}
.colorpick_hex .colorpick_submit {
left:164px;
top: 168px;
width:30px;
height:25px;
line-height: 25px;
}
/*hex layout, no submit button*/
.colorpick_hex_ns .colorpick_submit, .colorpick_hex_ns .colorpick_current_color {
display:none;
}
.colorpick_hex_ns .colorpick_hex_field {
width:80px;
}
.colorpick_hex_ns .colorpick_new_color{
width:60px;
border: 1px solid #8f8f8f;
}
/*Dark color scheme*/
.colorpick_dark {
background: #161616;
border-color: #2a2a2a;
}
.colorpick_dark .colorpick_color {
outline-color: #333;
}
.colorpick_dark .colorpick_hue {
border-color: #555;
}
.colorpick_dark .colorpick_field, .colorpick_dark .colorpick_hex_field {
background: #101010;
border-color: #2d2d2d;
}
.colorpick_dark .colorpick_field_letter {
background: #131313;
border-color: #2d2d2d;
color: #696969;
}
.colorpick_dark .colorpick_field input, .colorpick_dark .colorpick_hex_field input {
color: #7a7a7a;
}
.colorpick_dark .colorpick_field_uarr {
border-bottom-color:#696969;
}
.colorpick_dark .colorpick_field_darr {
border-top-color:#696969;
}
.colorpick_dark .colorpick_focus {
border-color:#444;
}
.colorpick_dark .colorpick_submit {
background: #131313;
border-color:#2d2d2d;
color:#7a7a7a;
}
.colorpick_dark .colorpick_submit:hover {
background-color:#101010;
border-color:#444;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 972 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 972 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,536 @@
/*
colorpick Color Picker
Copyright 2013 Jose Vargas. Licensed under GPL license. Based on Stefan Petre's Color Picker www.eyecon.ro, dual licensed under the MIT and GPL licenses
For usage and examples: colorpick.com/plugin
*/
(function ($) {
var colorpick = function ()
{
var
tpl = '<div class="colorpick"><div class="colorpick_color"><div class="colorpick_color_overlay1"><div class="colorpick_color_overlay2"><div class="colorpick_selector_outer"><div class="colorpick_selector_inner"></div></div></div></div></div><div class="colorpick_hue"><div class="colorpick_hue_arrs"><div class="colorpick_hue_larr"></div><div class="colorpick_hue_rarr"></div></div></div><div class="colorpick_new_color"></div><div class="colorpick_current_color"></div><div class="colorpick_hex_field"><div class="colorpick_field_letter">#</div><input type="text" maxlength="6" size="6" /></div><div class="colorpick_rgb_r colorpick_field"><div class="colorpick_field_letter">R</div><input type="text" maxlength="3" size="3" /><div class="colorpick_field_arrs"><div class="colorpick_field_uarr"></div><div class="colorpick_field_darr"></div></div></div><div class="colorpick_rgb_g colorpick_field"><div class="colorpick_field_letter">G</div><input type="text" maxlength="3" size="3" /><div class="colorpick_field_arrs"><div class="colorpick_field_uarr"></div><div class="colorpick_field_darr"></div></div></div><div class="colorpick_rgb_b colorpick_field"><div class="colorpick_field_letter">B</div><input type="text" maxlength="3" size="3" /><div class="colorpick_field_arrs"><div class="colorpick_field_uarr"></div><div class="colorpick_field_darr"></div></div></div><div class="colorpick_hsb_h colorpick_field"><div class="colorpick_field_letter">H</div><input type="text" maxlength="3" size="3" /><div class="colorpick_field_arrs"><div class="colorpick_field_uarr"></div><div class="colorpick_field_darr"></div></div></div><div class="colorpick_hsb_s colorpick_field"><div class="colorpick_field_letter">S</div><input type="text" maxlength="3" size="3" /><div class="colorpick_field_arrs"><div class="colorpick_field_uarr"></div><div class="colorpick_field_darr"></div></div></div><div class="colorpick_hsb_b colorpick_field"><div class="colorpick_field_letter">B</div><input type="text" maxlength="3" size="3" /><div class="colorpick_field_arrs"><div class="colorpick_field_uarr"></div><div class="colorpick_field_darr"></div></div></div><div class="colorpick_submit"></div><div class="colorpick_cancel"></div></div>',
defaults = {
showEvent: 'click',
onShow: function () {},
onBeforeShow: function(){},
onHide: function () {},
onChange: function () {},
onSubmit: function () { },
onCancelSubmit:function(){ },
colorScheme: 'light',
color: 'e67c19',
livePreview: true,
flat: false,
layout: 'full',
submit: 1,
submitText: 'OK',
submitCancelText: 'Cancel',
height: 156,
sourcesDom:""
},
//Fill the inputs of the plugin
fillRGBFields = function (hsb, cal) {
var rgb = hsbToRgb(hsb);
$(cal).data('colorpick').fields
.eq(1).val(rgb.r).end()
.eq(2).val(rgb.g).end()
.eq(3).val(rgb.b).end();
},
fillHSBFields = function (hsb, cal) {
$(cal).data('colorpick').fields
.eq(4).val(Math.round(hsb.h)).end()
.eq(5).val(Math.round(hsb.s)).end()
.eq(6).val(Math.round(hsb.b)).end();
},
fillHexFields = function (hsb, cal) {
$(cal).data('colorpick').fields.eq(0).val(hsbToHex(hsb));
},
//Set the round selector position
setSelector = function (hsb, cal) {
$(cal).data('colorpick').selector.css('backgroundColor', '#' + hsbToHex({h: hsb.h, s: 100, b: 100}));
$(cal).data('colorpick').selectorIndic.css({
left: parseInt($(cal).data('colorpick').height * hsb.s/100, 10),
top: parseInt($(cal).data('colorpick').height * (100-hsb.b)/100, 10)
});
},
//Set the hue selector position
setHue = function (hsb, cal) {
$(cal).data('colorpick').hue.css('top', parseInt($(cal).data('colorpick').height - $(cal).data('colorpick').height * hsb.h/360, 10));
},
//Set current and new colors
setCurrentColor = function (hsb, cal) {
$(cal).data('colorpick').currentColor.css('backgroundColor', '#' + hsbToHex(hsb));
},
setNewColor = function (hsb, cal) {
$(cal).data('colorpick').newColor.css('backgroundColor', '#' + hsbToHex(hsb));
},
//Called when the new color is changed
change = function (ev) {
var cal = $(this).parent().parent(), col;
if (this.parentNode.className.indexOf('_hex') > 0) {
cal.data('colorpick').color = col = hexToHsb(fixHex(this.value));
fillRGBFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
} else if (this.parentNode.className.indexOf('_hsb') > 0) {
cal.data('colorpick').color = col = fixHSB({
h: parseInt(cal.data('colorpick').fields.eq(4).val(), 10),
s: parseInt(cal.data('colorpick').fields.eq(5).val(), 10),
b: parseInt(cal.data('colorpick').fields.eq(6).val(), 10)
});
fillRGBFields(col, cal.get(0));
fillHexFields(col, cal.get(0));
} else {
cal.data('colorpick').color = col = rgbToHsb(fixRGB({
r: parseInt(cal.data('colorpick').fields.eq(1).val(), 10),
g: parseInt(cal.data('colorpick').fields.eq(2).val(), 10),
b: parseInt(cal.data('colorpick').fields.eq(3).val(), 10)
}));
fillHexFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
}
setSelector(col, cal.get(0));
setHue(col, cal.get(0));
setNewColor(col, cal.get(0));
cal.data('colorpick').onChange.apply(cal.parent(), [col, hsbToHex(col), hsbToRgb(col), cal.data('colorpick').el, 0]);
},
//Change style on blur and on focus of inputs
blur = function (ev) {
$(this).parent().removeClass('colorpick_focus');
},
focus = function () {
$(this).parent().parent().data('colorpick').fields.parent().removeClass('colorpick_focus');
$(this).parent().addClass('colorpick_focus');
},
//Increment/decrement arrows functions
downIncrement = function (ev) {
ev.preventDefault ? ev.preventDefault() : ev.returnValue = false;
var field = $(this).parent().find('input').focus();
var current = {
el: $(this).parent().addClass('colorpick_slider'),
max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255),
y: ev.pageY,
field: field,
val: parseInt(field.val(), 10),
preview: $(this).parent().parent().data('colorpick').livePreview
};
$(document).mouseup(current, upIncrement);
$(document).mousemove(current, moveIncrement);
},
moveIncrement = function (ev) {
ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val - ev.pageY + ev.data.y, 10))));
if (ev.data.preview) {
change.apply(ev.data.field.get(0), [true]);
}
return false;
},
upIncrement = function (ev) {
change.apply(ev.data.field.get(0), [true]);
ev.data.el.removeClass('colorpick_slider').find('input').focus();
$(document).off('mouseup', upIncrement);
$(document).off('mousemove', moveIncrement);
return false;
},
//Hue slider functions
downHue = function (ev) {
ev.preventDefault ? ev.preventDefault() : ev.returnValue = false;
var current = {
cal: $(this).parent(),
y: $(this).offset().top
};
$(document).on('mouseup touchend',current,upHue);
$(document).on('mousemove touchmove',current,moveHue);
var pageY = ((ev.type == 'touchstart') ? ev.originalEvent.changedTouches[0].pageY : ev.pageY );
change.apply(
current.cal.data('colorpick')
.fields.eq(4).val(parseInt(360*(current.cal.data('colorpick').height - (pageY - current.y))/current.cal.data('colorpick').height, 10))
.get(0),
[current.cal.data('colorpick').livePreview]
);
return false;
},
moveHue = function (ev) {
var pageY = ((ev.type == 'touchmove') ? ev.originalEvent.changedTouches[0].pageY : ev.pageY );
change.apply(
ev.data.cal.data('colorpick')
.fields.eq(4).val(parseInt(360*(ev.data.cal.data('colorpick').height - Math.max(0,Math.min(ev.data.cal.data('colorpick').height,(pageY - ev.data.y))))/ev.data.cal.data('colorpick').height, 10))
.get(0),
[ev.data.preview]
);
return false;
},
upHue = function (ev) {
fillRGBFields(ev.data.cal.data('colorpick').color, ev.data.cal.get(0));
fillHexFields(ev.data.cal.data('colorpick').color, ev.data.cal.get(0));
$(document).off('mouseup touchend',upHue);
$(document).off('mousemove touchmove',moveHue);
return false;
},
//Color selector functions
downSelector = function (ev) {
ev.preventDefault ? ev.preventDefault() : ev.returnValue = false;
var current = {
cal: $(this).parent(),
pos: $(this).offset()
};
current.preview = current.cal.data('colorpick').livePreview;
$(document).on('mouseup touchend',current,upSelector);
$(document).on('mousemove touchmove',current,moveSelector);
var payeX,pageY;
if(ev.type == 'touchstart') {
pageX = ev.originalEvent.changedTouches[0].pageX,
pageY = ev.originalEvent.changedTouches[0].pageY;
} else {
pageX = ev.pageX;
pageY = ev.pageY;
}
change.apply(
current.cal.data('colorpick').fields
.eq(6).val(parseInt(100*(current.cal.data('colorpick').height - (pageY - current.pos.top))/current.cal.data('colorpick').height, 10)).end()
.eq(5).val(parseInt(100*(pageX - current.pos.left)/current.cal.data('colorpick').height, 10))
.get(0),
[current.preview]
);
return false;
},
moveSelector = function (ev) {
var payeX,pageY;
if(ev.type == 'touchmove') {
pageX = ev.originalEvent.changedTouches[0].pageX,
pageY = ev.originalEvent.changedTouches[0].pageY;
} else {
pageX = ev.pageX;
pageY = ev.pageY;
}
change.apply(
ev.data.cal.data('colorpick').fields
.eq(6).val(parseInt(100*(ev.data.cal.data('colorpick').height - Math.max(0,Math.min(ev.data.cal.data('colorpick').height,(pageY - ev.data.pos.top))))/ev.data.cal.data('colorpick').height, 10)).end()
.eq(5).val(parseInt(100*(Math.max(0,Math.min(ev.data.cal.data('colorpick').height,(pageX - ev.data.pos.left))))/ev.data.cal.data('colorpick').height, 10))
.get(0),
[ev.data.preview]
);
return false;
},
upSelector = function (ev) {
fillRGBFields(ev.data.cal.data('colorpick').color, ev.data.cal.get(0));
fillHexFields(ev.data.cal.data('colorpick').color, ev.data.cal.get(0));
$(document).off('mouseup touchend',upSelector);
$(document).off('mousemove touchmove',moveSelector);
return false;
},
//Submit button
clickSubmit = function (ev) {
var cal = $(this).parent();
var col = cal.data('colorpick').color;
cal.data('colorpick').origColor = col;
setCurrentColor(col, cal.get(0));
cal.data('colorpick').onSubmit(col, hsbToHex(col), hsbToRgb(col), cal.data('colorpick').el);
},
//cancel button
clickCancelSubmit = function (ev)
{
var cal = $(this).parent();
cal.data('colorpick').onCancelSubmit(cal);
//cal.hide();
}
//Show/hide the color picker
show = function (ev) {
// Prevent the trigger of any direct parent
ev.stopPropagation();
sourcesDom = $(this);
var cal = $('#' + $(this).data('colorpickId'));
cal.data('colorpick').onBeforeShow.apply(this, [cal.get(0)]);
var pos = $(this).offset();
var top = pos.top + this.offsetHeight;
var left = pos.left;
var viewPort = getViewport();
var calW = cal.width();
if (left + calW > viewPort.l + viewPort.w) {
left -= calW;
}
cal.css({left: left + 'px', top: top + 'px'});
if (cal.data('colorpick').onShow.apply(this, [cal.get(0)]) != false) {
cal.show();
}
//reset the color when user clicks dom
$('div.colorpick_current_color').click();
//Hide when user clicks outside
$('html').mousedown({ cal: cal }, hide);
cal.mousedown(function(ev){ev.stopPropagation();})
},
hide = function (ev) {
if (ev.data.cal.data('colorpick').onHide.apply(this, [ev.data.cal.get(0)]) != false) {
ev.data.cal.hide();
}
$('html').off('mousedown', hide);
},
getViewport = function () {
var m = document.compatMode == 'CSS1Compat';
return {
l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft),
w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth)
};
},
//Fix the values if the user enters a negative or high value
fixHSB = function (hsb) {
return {
h: Math.min(360, Math.max(0, hsb.h)),
s: Math.min(100, Math.max(0, hsb.s)),
b: Math.min(100, Math.max(0, hsb.b))
};
},
fixRGB = function (rgb) {
return {
r: Math.min(255, Math.max(0, rgb.r)),
g: Math.min(255, Math.max(0, rgb.g)),
b: Math.min(255, Math.max(0, rgb.b))
};
},
fixHex = function (hex) {
var len = 6 - hex.length;
if (len > 0) {
var o = [];
for (var i=0; i<len; i++) {
o.push('0');
}
o.push(hex);
hex = o.join('');
}
return hex;
},
restoreOriginal = function () {
var cal = $(this).parent();
var col = cal.data('colorpick').origColor;
cal.data('colorpick').color = col;
fillRGBFields(col, cal.get(0));
fillHexFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
setSelector(col, cal.get(0));
setHue(col, cal.get(0));
setNewColor(col, cal.get(0));
};
return {
init: function (opt) {
opt = $.extend({}, defaults, opt||{});
//Set color
if (typeof opt.color == 'string') {
opt.color = hexToHsb(opt.color);
} else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) {
opt.color = rgbToHsb(opt.color);
} else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) {
opt.color = fixHSB(opt.color);
} else {
return this;
}
//For each selected DOM element
return this.each(function () {
//If the element does not have an ID
if (!$(this).data('colorpickId')) {
var options = $.extend({}, opt);
options.origColor = opt.color;
//Generate and assign a random ID
var id = 'collorpicker_' + parseInt(Math.random() * 1000);
$(this).data('colorpickId', id);
//Set the tpl's ID and get the HTML
var cal = $(tpl).attr('id', id);
//Add class according to layout
cal.addClass('colorpick_'+options.layout+(options.submit?'':' colorpick_'+options.layout+'_ns'));
//Add class if the color scheme is not default
if(options.colorScheme != 'light') {
cal.addClass('colorpick_'+options.colorScheme);
}
//Setup submit button
cal.find('div.colorpick_submit').html(options.submitText).click(clickSubmit);
//Setup Cancel submit button
cal.find('div.colorpick_cancel').html(options.submitCancelText).click(clickCancelSubmit);
//Setup input fields
options.fields = cal.find('input').change(change).blur(blur).focus(focus);
cal.find('div.colorpick_field_arrs').mousedown(downIncrement).end().find('div.colorpick_current_color').click(restoreOriginal);
//Setup hue selector
options.selector = cal.find('div.colorpick_color').on('mousedown touchstart',downSelector);
options.selectorIndic = options.selector.find('div.colorpick_selector_outer');
//Store parts of the plugin
options.el = this;
options.hue = cal.find('div.colorpick_hue_arrs');
huebar = options.hue.parent();
//Paint the hue bar
var UA = navigator.userAgent.toLowerCase();
var isIE = navigator.appName === 'Microsoft Internet Explorer';
var IEver = isIE ? parseFloat( UA.match( /msie ([0-9]{1,}[\.0-9]{0,})/ )[1] ) : 0;
var ngIE = ( isIE && IEver < 10 );
var stops = ['#ff0000','#ff0080','#ff00ff','#8000ff','#0000ff','#0080ff','#00ffff','#00ff80','#00ff00','#80ff00','#ffff00','#ff8000','#ff0000'];
if(ngIE) {
var i, div;
for(i=0; i<=11; i++) {
div = $('<div></div>').attr('style','height:8.333333%; filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='+stops[i]+', endColorstr='+stops[i+1]+'); -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='+stops[i]+', endColorstr='+stops[i+1]+')";');
huebar.append(div);
}
} else {
stopList = stops.join(',');
huebar.attr('style','background:-webkit-linear-gradient(top,'+stopList+'); background: -o-linear-gradient(top,'+stopList+'); background: -ms-linear-gradient(top,'+stopList+'); background:-moz-linear-gradient(top,'+stopList+'); -webkit-linear-gradient(top,'+stopList+'); background:linear-gradient(to bottom,'+stopList+'); ');
}
cal.find('div.colorpick_hue').on('mousedown touchstart',downHue);
options.newColor = cal.find('div.colorpick_new_color');
options.currentColor = cal.find('div.colorpick_current_color');
//Store options and fill with default color
cal.data('colorpick', options);
fillRGBFields(options.color, cal.get(0));
fillHSBFields(options.color, cal.get(0));
fillHexFields(options.color, cal.get(0));
setHue(options.color, cal.get(0));
setSelector(options.color, cal.get(0));
setCurrentColor(options.color, cal.get(0));
setNewColor(options.color, cal.get(0));
//Append to body if flat=false, else show in place
if (options.flat) {
cal.appendTo(this).show();
cal.css({
position: 'relative',
display: 'block'
});
} else {
cal.appendTo(document.body);
$(this).on(options.showEvent, show);
cal.css({
position:'absolute'
});
}
}
});
},
//Shows the picker
showPicker: function() {
return this.each( function () {
if ($(this).data('colorpickId')) {
show.apply(this);
}
});
},
//Hides the picker
hidePicker: function() {
return this.each( function () {
if ($(this).data('colorpickId')) {
$('#' + $(this).data('colorpickId')).hide();
}
});
},
//Sets a color as new and current (default)
setColor: function(col, setCurrent) {
setCurrent = (typeof setCurrent === "undefined") ? 1 : setCurrent;
if (typeof col == 'string') {
col = hexToHsb(col);
} else if (col.r != undefined && col.g != undefined && col.b != undefined) {
col = rgbToHsb(col);
} else if (col.h != undefined && col.s != undefined && col.b != undefined) {
col = fixHSB(col);
} else {
return this;
}
return this.each(function(){
if ($(this).data('colorpickId')) {
var cal = $('#' + $(this).data('colorpickId'));
cal.data('colorpick').color = col;
cal.data('colorpick').origColor = col;
fillRGBFields(col, cal.get(0));
fillHSBFields(col, cal.get(0));
fillHexFields(col, cal.get(0));
setHue(col, cal.get(0));
setSelector(col, cal.get(0));
setNewColor(col, cal.get(0));
cal.data('colorpick').onChange.apply(cal.parent(), [col, hsbToHex(col), hsbToRgb(col), cal.data('colorpick').el, 1]);
if(setCurrent) {
setCurrentColor(col, cal.get(0));
}
}
});
}
};
}();
//Color space convertions
var hexToRgb = function (hex) {
var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
};
var hexToHsb = function (hex) {
return rgbToHsb(hexToRgb(hex));
};
var rgbToHsb = function (rgb) {
var hsb = {h: 0, s: 0, b: 0};
var min = Math.min(rgb.r, rgb.g, rgb.b);
var max = Math.max(rgb.r, rgb.g, rgb.b);
var delta = max - min;
hsb.b = max;
hsb.s = max != 0 ? 255 * delta / max : 0;
if (hsb.s != 0) {
if (rgb.r == max) hsb.h = (rgb.g - rgb.b) / delta;
else if (rgb.g == max) hsb.h = 2 + (rgb.b - rgb.r) / delta;
else hsb.h = 4 + (rgb.r - rgb.g) / delta;
} else hsb.h = -1;
hsb.h *= 60;
if (hsb.h < 0) hsb.h += 360;
hsb.s *= 100/255;
hsb.b *= 100/255;
return hsb;
};
var hsbToRgb = function (hsb) {
var rgb = {};
var h = hsb.h;
var s = hsb.s*255/100;
var v = hsb.b*255/100;
if(s == 0) {
rgb.r = rgb.g = rgb.b = v;
} else {
var t1 = v;
var t2 = (255-s)*v/255;
var t3 = (t1-t2)*(h%60)/60;
if(h==360) h = 0;
if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3}
else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3}
else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3}
else {rgb.r=0; rgb.g=0; rgb.b=0}
}
return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)};
};
var rgbToHex = function (rgb) {
var hex = [
rgb.r.toString(16),
rgb.g.toString(16),
rgb.b.toString(16)
];
$.each(hex, function (nr, val) {
if (val.length == 1) {
hex[nr] = '0' + val;
}
});
return hex.join('');
};
var hsbToHex = function (hsb) {
return rgbToHex(hsbToRgb(hsb));
};
$.fn.extend({
colorpick: colorpick.init,
colorpickHide: colorpick.hidePicker,
colorpickShow: colorpick.showPicker,
colorpickSetColor: colorpick.setColor
});
$.extend({
colorpick:{
rgbToHex: rgbToHex,
rgbToHsb: rgbToHsb,
hsbToHex: hsbToHex,
hsbToRgb: hsbToRgb,
hexToHsb: hexToHsb,
hexToRgb: hexToRgb
}
});
})(jQuery);

File diff suppressed because it is too large Load Diff