add site
This commit is contained in:
108
Site/Credentials/Credentials.aspx
Normal file
108
Site/Credentials/Credentials.aspx
Normal file
@ -0,0 +1,108 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/IronIntelMasterPage.master" AutoEventWireup="true" CodeFile="Credentials.aspx.cs" Inherits="Credentials_Credentials" %>
|
||||
|
||||
<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">
|
||||
var ConnectionsURL = "<%=ConnectionsURL%>";
|
||||
var isJDLink = <%=IsJDLink?"true":"false"%>;
|
||||
var isJDSub = <%=IsJDSub?"true":"false"%>;
|
||||
var isMyJD = <%=IsMyJD?"true":"false"%>;
|
||||
|
||||
$(function () {
|
||||
setFavoriteDisplay(true);
|
||||
|
||||
_network.query = function (method, param, callback, error) {
|
||||
_network.request("Credentials/Credentials.aspx", -1, method, param, callback, error);
|
||||
}
|
||||
_network.query('GetNavs', '', function (data) {
|
||||
if (data != null && data.length > 0) {
|
||||
var list = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var icon = $('<button></button>');
|
||||
var title = getNavInfoByID(data[i].ID, data[i].Title, icon);
|
||||
var li = $('<li class="nav_item"></li>').attr({
|
||||
'id': data[i].ID,
|
||||
'page': data[i].Url,
|
||||
'title': title
|
||||
});
|
||||
var a = $('<a></a>').attr('href', '#' + data[i].ID);
|
||||
var src = data[i].IconPath;
|
||||
if (!src) {
|
||||
src = 'img/none.png';
|
||||
}
|
||||
var divicon = $('<div></div>').append(icon);
|
||||
a.append(divicon);
|
||||
a.append($('<span></span>').text(title));
|
||||
li.append(a);
|
||||
list.push(li);
|
||||
}
|
||||
$('.ul_menu').append(list);
|
||||
}
|
||||
|
||||
if (data.length > 0) {
|
||||
if (isJDLink || isJDSub || isMyJD)
|
||||
default_page = '#' + data[1].ID;
|
||||
else
|
||||
default_page = '#' + data[0].ID;
|
||||
if (!old_hash) {
|
||||
old_hash = default_page;
|
||||
}
|
||||
|
||||
window.changePage(old_hash);
|
||||
} else {
|
||||
// 无权限时跳转至登录页面
|
||||
window.location.href = '<%=LoginPageUrl%>';
|
||||
}
|
||||
}, function (e) {
|
||||
console.log(e);
|
||||
});
|
||||
|
||||
window.changePage(old_hash);
|
||||
|
||||
if (ConnectionsURL)
|
||||
window.open(ConnectionsURL);
|
||||
});
|
||||
|
||||
function getNavInfoByID(id, title1, icon) {
|
||||
var title = title1;
|
||||
if (id === "nav_credential") {
|
||||
title = GetTextByKey("P_CREDENTIALS", title);
|
||||
$(icon).addClass("iconcredentail");
|
||||
}
|
||||
else if (id === "nav_jdlink") {
|
||||
title = GetTextByKey("P_JOHNDEERE", title);
|
||||
$(icon).addClass("iconjdlink");
|
||||
}
|
||||
else if (id === "nav_jdnotification") {
|
||||
title = GetTextByKey("P_JOHNDEERENOTIFICATIONS", title);
|
||||
$(icon).addClass("iconjdnotification");
|
||||
}
|
||||
else if (id === "nav_apicredential") {
|
||||
title = GetTextByKey("P_APICREDENTIALS", title);
|
||||
$(icon).addClass("iconcredentail");
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
function afterpagechanged(hash, name) {
|
||||
setFavorateStyle(hash, name);
|
||||
};
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="holder_content" runat="Server">
|
||||
<div id="set_left">
|
||||
<ul class="ul_menu">
|
||||
<li id="nav_arrow">
|
||||
<div class="icn collapse"></div>
|
||||
</li>
|
||||
</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>
|
||||
|
42
Site/Credentials/Credentials.aspx.cs
Normal file
42
Site/Credentials/Credentials.aspx.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using IronIntel.Contractor;
|
||||
using IronIntel.Contractor.Site;
|
||||
using IronIntel.Contractor.Site.Credentials;
|
||||
using IronIntel.Contractor.Site.Security;
|
||||
using IronIntel.Contractor.Users;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class Credentials_Credentials : CredentialsBasePage
|
||||
{
|
||||
protected string ConnectionsURL = "";
|
||||
protected bool IsJDLink = false;
|
||||
protected bool IsJDSub = false;
|
||||
protected bool IsMyJD = false;
|
||||
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;
|
||||
IsJDLink = Helper.IsTrue(Request.Params["isjdlink"] ?? "");
|
||||
IsJDSub = Helper.IsTrue(Request.Params["isjdsub"] ?? "");
|
||||
IsMyJD = Helper.IsTrue(Request.Params["ismyjd"] ?? "");
|
||||
ConnectionsURL = Request.Params["connections"];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
86
Site/Credentials/Credentials.master
Normal file
86
Site/Credentials/Credentials.master
Normal file
@ -0,0 +1,86 @@
|
||||
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Credentials.master.cs" Inherits="Credentials" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<title></title>
|
||||
<link type="text/css" href="<%=GetUrl("js/components/css/gridview.css") %>" rel="stylesheet" />
|
||||
<link type="text/css" href="<%=GetUrl("css/override.css") %>" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="<%=GetUrl("css/default.css")%>" type="text/css" />
|
||||
<link rel="stylesheet" href="<%=GetUrl("css/split_sub.css")%>" type="text/css" />
|
||||
<link rel="stylesheet" href="<%=GetUrl("css/editmultiselect.css")%>" type="text/css" />
|
||||
<style type="text/css">
|
||||
:root { <%=StyleVariables%> }
|
||||
.data-grid {
|
||||
height: 100%;
|
||||
font-size: 12px !important;
|
||||
font-family: "Segoe UI","Segoe UI Web (West European)","Segoe UI",-apple-system,BlinkMacSystemFont,"Roboto","Helvetica Neue",sans-serif !important;
|
||||
}
|
||||
</style>
|
||||
<script src="<%=GetUrl("js/jquery-3.6.0.min.js")%>" type="text/javascript"></script>
|
||||
<script src="<%=GetUrl("js/cookie.js")%>" type="text/javascript"></script>
|
||||
<script src="<%=GetUrl("js/utility.js")%>" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="<%=GetUrl("js/components/gridview.js") %>"></script>
|
||||
<script src="<%=GetUrl("js/editmultiselect.js")%>" type="text/javascript"></script>
|
||||
<script src="<%=GetUrl("js/language.js")%>" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var GridView = window.GridView || window['g5-gridview'];
|
||||
|
||||
_network.root = '<%=Page.ResolveUrl("~/")%>';
|
||||
var sitePath = "<%=this.ResolveUrl("~/fic/") %>";
|
||||
|
||||
if (typeof _utility !== 'object') {
|
||||
_utility = {};
|
||||
}
|
||||
|
||||
function getText(s, flag) {
|
||||
return (s == null)
|
||||
? (flag ? '<i>null</i>' : '')
|
||||
: htmlencode(s).replace(/ /g, ' ');
|
||||
}
|
||||
|
||||
function GetLanguageByCookie() {
|
||||
var lang = getCookie('<%=Common.LanguageCookieName%>');
|
||||
if (lang == null) {
|
||||
return "en-us";
|
||||
} else {
|
||||
return lang;
|
||||
}
|
||||
}
|
||||
|
||||
$(function () {
|
||||
_fleet.currentLang = GetLanguageByCookie();
|
||||
$("#content1").applyFleetLanguageText(true);
|
||||
// 加载完毕后通知上级页面
|
||||
if (typeof window.parent.onsubpageloaded == 'function') {
|
||||
window.parent.onsubpageloaded();
|
||||
}
|
||||
|
||||
if (typeof window.parent.ondocumentclick == 'function') {
|
||||
$(document.body).click(window.parent.ondocumentclick);
|
||||
}
|
||||
|
||||
function resizeContent() {
|
||||
if ($('.content_main').length > 0)
|
||||
$('.content_main').css('min-height', $(window).height() - $('.content_main').offset().top - 4);
|
||||
$('#mask_bg').height($(document).outerHeight(false)).width($(document).outerWidth(false));
|
||||
}
|
||||
|
||||
$(window).resize(function () {
|
||||
resizeContent();
|
||||
});
|
||||
resizeContent();
|
||||
});
|
||||
</script>
|
||||
<asp:ContentPlaceHolder ID="head" runat="server"></asp:ContentPlaceHolder>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content1">
|
||||
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
|
||||
</asp:ContentPlaceHolder>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
29
Site/Credentials/Credentials.master.cs
Normal file
29
Site/Credentials/Credentials.master.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using Foresight.Fleet.Services.Styles;
|
||||
using IronIntel.Contractor;
|
||||
using IronIntel.Contractor.iisitebase;
|
||||
using IronIntel.Contractor.Site;
|
||||
using IronIntel.Contractor.Users;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class Credentials : CommonBase
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
try
|
||||
{
|
||||
GetUIStyle();
|
||||
}
|
||||
catch
|
||||
{
|
||||
// TODO: errors when get the ui style.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
466
Site/Credentials/ManageAPICredential.aspx
Normal file
466
Site/Credentials/ManageAPICredential.aspx
Normal file
@ -0,0 +1,466 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Credentials/Credentials.master" AutoEventWireup="true" CodeFile="ManageAPICredential.aspx.cs" Inherits="ManageAPICredential" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
|
||||
<style type="text/css">
|
||||
.dialog .dialog-title .dialog-close {
|
||||
float: right;
|
||||
margin-right: 6px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dialog .dialog-title .dialog-close:before {
|
||||
content: '\e600';
|
||||
}
|
||||
|
||||
.dialog-content table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dialog-content table td {
|
||||
padding-top: 30px;
|
||||
}
|
||||
|
||||
.dialog-content table td.label {
|
||||
width: 130px;
|
||||
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;
|
||||
}
|
||||
|
||||
.icon {
|
||||
font-family: CalciteWebCoreIcons;
|
||||
cursor: default;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
var credentialType = "AEMP";
|
||||
var credentialList;
|
||||
|
||||
credentialquery = function (method, param, callback, error, nolog) {
|
||||
_network.request("Credentials/ManageAPICredential.aspx?tp=ashx", -1, method, param, callback, error, nolog);
|
||||
}
|
||||
|
||||
function OnDelete(cr) {
|
||||
var cre = cr;
|
||||
if (!cre) {
|
||||
return;
|
||||
}
|
||||
showConfirm(GetTextByKey("P_APICRE_DELETETHECREDENTIALTIPS", 'Do you want to delete the credential?'), GetTextByKey("P_APICRE_DELETECREDENTIAL", 'Delete Credential'), function () {
|
||||
credentialquery("DeleteApiCredential", cre.ID, function (data) {
|
||||
OnRefresh();
|
||||
}, function (err) {
|
||||
showAlert(GetTextByKey("P_APICRE_FAILEDDELETECREDENTIAL", 'Failed to delete this credential.'), GetTextByKey("P_APICRE_DELETECREDENTIAL", 'Delete Credential'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function OnAdd() {
|
||||
$('.tr_aicredential').hide();
|
||||
$('#tr_enabled').hide();
|
||||
creid = undefined;
|
||||
$('#dialog_apiname').val('').removeAttr("disabled");
|
||||
$('#dialog_username').val('');
|
||||
$('#dialog_password').val('');
|
||||
$('#dialog_apikey').val('');
|
||||
$('#dialog_apisecret').val('');
|
||||
$('#dialog_apitoken').val('');
|
||||
$('#dialog_apitokensecret').val('');
|
||||
$('#dialog_enabled').attr('checked', false);
|
||||
$('#dialog_credential .dialog-title span.title').text(GetTextByKey("P_APICRE_ADDMANUFACTURE", 'Add Credential'));
|
||||
$('#mask_bg').show();
|
||||
$('#dialog_credential')
|
||||
.attr('act', 'add')
|
||||
.css({
|
||||
'top': (document.documentElement.clientHeight - $('#dialog_credential').height()) / 3,
|
||||
'left': (document.documentElement.clientWidth - $('#dialog_credential').width()) / 2
|
||||
})
|
||||
.showDialogfixed();
|
||||
$('#dialog_urlkey').focus();
|
||||
}
|
||||
|
||||
var creid;
|
||||
function OnEdit() {
|
||||
var cre = grid_dt.source[grid_dt.selectedIndex].Values;
|
||||
if (!cre) {
|
||||
creid = undefined;
|
||||
return;
|
||||
}
|
||||
|
||||
$('#tr_enabled').show();
|
||||
creid = cre.ID;
|
||||
$('#dialog_apiname').val(cre.ApiDefinitionId).attr("disabled", "disabled");
|
||||
if (cre.HasUserName) {
|
||||
$('#tr_username').show();
|
||||
$('#dialog_username').val(cre.UserName);
|
||||
}
|
||||
else {
|
||||
$('#tr_username').hide();
|
||||
$('#dialog_username').val('');
|
||||
}
|
||||
|
||||
if (cre.HasPassword) {
|
||||
$('#tr_password').show();
|
||||
$('#dialog_password').val(cre.Password);
|
||||
}
|
||||
else {
|
||||
$('#tr_password').hide();
|
||||
$('#dialog_password').val('');
|
||||
}
|
||||
|
||||
if (cre.HasApiKey) {
|
||||
$('#tr_apikey').show();
|
||||
$('#dialog_apikey').val(cre.ApiKey);
|
||||
}
|
||||
else {
|
||||
$('#tr_apikey').hide();
|
||||
$('#dialog_apikey').val('');
|
||||
}
|
||||
|
||||
if (cre.HasApiSecret) {
|
||||
$('#tr_apisecret').show();
|
||||
$('#dialog_apisecret').val(cre.ApiSecret);
|
||||
}
|
||||
else {
|
||||
$('#tr_apisecret').hide();
|
||||
$('#dialog_apisecret').val('');
|
||||
}
|
||||
|
||||
if (cre.HasApiToken) {
|
||||
$('#tr_apitoken').show();
|
||||
$('#dialog_apitoken').val(cre.ApiToken);
|
||||
}
|
||||
else {
|
||||
$('#tr_apitoken').hide();
|
||||
$('#dialog_apitoken').val('');
|
||||
}
|
||||
|
||||
if (cre.HasApiTokenSecret) {
|
||||
$('#tr_apitokensecret').show();
|
||||
$('#dialog_apitokensecret').val(cre.ApiTokenSecret);
|
||||
}
|
||||
else {
|
||||
$('#tr_apitokensecret').hide();
|
||||
$('#dialog_apitokensecret').val('');
|
||||
}
|
||||
|
||||
$('#dialog_enabled').attr("checked", cre.IsEnabled);
|
||||
$('#dialog_credential .dialog-title span.title').text(GetTextByKey("P_APICRE_EDITMANUFACTURE", 'Edit Credential'));
|
||||
$('#mask_bg').show();
|
||||
$('#dialog_credential')
|
||||
.attr('act', 'edit')
|
||||
.css({
|
||||
'top': (document.documentElement.clientHeight - $('#dialog_credential').height()) / 3,
|
||||
'left': (document.documentElement.clientWidth - $('#dialog_credential').width()) / 2
|
||||
})
|
||||
.showDialog();
|
||||
$('#dialog_urlkey').focus();
|
||||
}
|
||||
|
||||
function OnDblClick(e) {
|
||||
OnEdit();
|
||||
}
|
||||
|
||||
function OnRefresh() {
|
||||
showloading(true);
|
||||
credentialquery("GetAPICredentialDefs", '', function (data) {
|
||||
showloading(false);
|
||||
credentialList = data;
|
||||
showCredentialList(credentialList);
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function getAPIDictionaries() {
|
||||
credentialquery("GetAPIDictionaries", '', function (data) {
|
||||
var types = [];
|
||||
types.push($('<option value="-1"></option>'));
|
||||
if (data && data.length > 0) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var type = data[i];
|
||||
types.push($('<option></option>').prop('selected', i == 0).val(type.Id).text(type.FriendlyName).data('dic', type));
|
||||
}
|
||||
} else {
|
||||
types[0].prop('selected', true);
|
||||
}
|
||||
|
||||
$('#dialog_apiname').empty().append(types);
|
||||
}, function (err) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function showCredentialList(data) {
|
||||
var rows = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var r = data[i];
|
||||
var fr = { Values: r };
|
||||
rows.push(fr);
|
||||
}
|
||||
|
||||
grid_dt.setData(rows);
|
||||
}
|
||||
|
||||
var grid_dt;
|
||||
function InitGridData() {
|
||||
$('#btnEdit').attr("disabled", "disabled");
|
||||
|
||||
grid_dt = new GridView('#credentiallist');
|
||||
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: 'ApiName', caption: GetTextByKey("P_APICRE_APINAME", "API Name"), valueIndex: 'ApiName', css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'UserName', caption: GetTextByKey("P_APICRE_USERNAME", "User Name"), valueIndex: 'UserName', css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'IsEnabled', caption: GetTextByKey("P_APICRE_ENABLED", "Enabled"), valueIndex: 'IsEnabled', css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'Edit', caption: "", css: { 'width': 30, 'text-align': 'center' } },
|
||||
{ name: 'Delete', caption: "", css: { 'width': 30, 'text-align': 'center' } }
|
||||
];
|
||||
var columns = [];
|
||||
// head
|
||||
for (var hd in list_columns) {
|
||||
var col = {};
|
||||
col.name = list_columns[hd].name;
|
||||
col.caption = list_columns[hd].caption;
|
||||
col.visible = true;
|
||||
col.sortable = true;
|
||||
col.width = list_columns[hd].css.width;
|
||||
col.align = list_columns[hd].css["text-align"]
|
||||
col.key = list_columns[hd].valueIndex;
|
||||
if (col.name === "Edit") {
|
||||
col.isurl = true;
|
||||
col.text = "\uf044";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
OnEdit();
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
}
|
||||
col.attrs = { 'title': GetTextByKey("P_APICRE_EDIT", 'Edit') };
|
||||
}
|
||||
else if (col.name === "Delete") {
|
||||
col.isurl = true;
|
||||
col.text = "\uf00d";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
OnDelete(this);
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
};
|
||||
col.attrs = { 'title': GetTextByKey("P_APICRE_DELETE", 'Delete') };
|
||||
}
|
||||
columns.push(col);
|
||||
}
|
||||
grid_dt.canMultiSelect = false;
|
||||
grid_dt.columns = columns;
|
||||
grid_dt.init();
|
||||
grid_dt.rowdblclick = OnEdit;
|
||||
|
||||
grid_dt.selectedrowchanged = function (rowindex) {
|
||||
var rowdata = grid_dt.source[rowindex];
|
||||
if (rowdata) {
|
||||
creid = rowdata.Values.ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function OnDialogOK() {
|
||||
var item = {
|
||||
'ApiDefinitionId': $('#dialog_apiname').val(),
|
||||
'ApiName': $("#dialog_apiname").find("option:selected").text(),
|
||||
'UserName': $('#dialog_username').val().replace(/(^\s*)|(\s*$)/g, ''),
|
||||
'Password': $('#dialog_password').val(),
|
||||
'ApiKey': $('#dialog_apikey').val().replace(/(^\s*)|(\s*$)/g, ''),
|
||||
'ApiSecret': $('#dialog_apisecret').val().replace(/(^\s*)|(\s*$)/g, ''),
|
||||
'ApiToken': $('#dialog_apitoken').val().replace(/(^\s*)|(\s*$)/g, ''),
|
||||
'ApiTokenSecret': $('#dialog_apitokensecret').val().replace(/(^\s*)|(\s*$)/g, ''),
|
||||
'IsEnabled': $('#dialog_enabled').attr("checked") == "checked"
|
||||
};
|
||||
var alerttitle;
|
||||
if (creid) {
|
||||
item.ID = creid;
|
||||
alerttitle = GetTextByKey("P_APICRE_EDITMANUFACTURE", "Edit Credential");
|
||||
} else {
|
||||
item.ID = "-1";
|
||||
item.IsEnabled = true;
|
||||
alerttitle = GetTextByKey("P_APICRE_ADDMANUFACTURE", "Add Credential");
|
||||
}
|
||||
if (!item.ApiName || item.ApiName.length == 0) {
|
||||
showAlert(GetTextByKey("P_APICRE_APINAMENOTBEEMPTY", 'API Name cannot be empty.'), alerttitle);
|
||||
$('#dialog_apiname').focus();
|
||||
return;
|
||||
}
|
||||
|
||||
showloading(true);
|
||||
var param = JSON.stringify(item);
|
||||
param = htmlencode(param);
|
||||
credentialquery("UpdateApiCredentialDefs", param, function (data) {
|
||||
showloading(false);
|
||||
if (data !== 'OK') {
|
||||
showAlert(data, GetTextByKey("P_APICRE_SAVEMANUFACTURE", 'Save Credential'));
|
||||
} else {
|
||||
$('#dialog_credential').hideDialog();
|
||||
OnRefresh();
|
||||
}
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
showAlert(GetTextByKey("P_APICRE_FAILEDTOSAVECREDENTIAL", 'Failed to save credential.'), GetTextByKey("P_APICRE_SAVEMANUFACTURE", 'Save Credential'));
|
||||
});
|
||||
}
|
||||
|
||||
function setInput(dic) {
|
||||
$('#tr_username').hide();
|
||||
$('#tr_password').hide();
|
||||
$('#tr_apikey').hide();
|
||||
$('#tr_apitoken').hide();
|
||||
$('#tr_apisecret').hide();
|
||||
$('#tr_apitokensecret').hide();
|
||||
$('#dialog_username').val('');
|
||||
$('#dialog_password').val('');
|
||||
$('#dialog_apikey').val('');
|
||||
$('#dialog_apisecret').val('');
|
||||
$('#dialog_apitoken').val('');
|
||||
$('#dialog_apitokensecret').val('');
|
||||
if (dic) {
|
||||
if (dic.ApiUsername) {
|
||||
$('#tr_username').show();
|
||||
}
|
||||
if (dic.ApiPassword) {
|
||||
$('#tr_password').show();
|
||||
}
|
||||
if (dic.ApiKey) {
|
||||
$('#tr_apikey').show();
|
||||
}
|
||||
if (dic.ApiSecret) {
|
||||
$('#tr_apisecret').show();
|
||||
}
|
||||
if (dic.ApiToken) {
|
||||
$('#tr_apitoken').show();
|
||||
}
|
||||
if (dic.ApiTokenSecret) {
|
||||
$('#tr_apitokensecret').show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(function () {
|
||||
setPageTitle(GetTextByKey("P_APICREDENTIALS", 'API Credentials'), true);
|
||||
InitGridData();
|
||||
getAPIDictionaries();
|
||||
|
||||
$("#dialog_apiname").change(function () {
|
||||
var dic = $("#dialog_apiname").find("option:selected").data("dic");
|
||||
setInput(dic);
|
||||
})
|
||||
$('#dialog_credential').dialog(function () {
|
||||
$('#mask_bg').hide();
|
||||
});
|
||||
OnRefresh();
|
||||
$(window).resize(function () {
|
||||
$("#credentiallist").css("height", $(window).height() - $("#credentiallist").offset().top - 4);
|
||||
grid_dt && grid_dt.resize();
|
||||
}).resize();
|
||||
});
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
|
||||
<div style="min-width: 400px;">
|
||||
<div class="page_title" data-lgid="P_APICREDENTIALS">API Credentials</div>
|
||||
<div class="function_title">
|
||||
<span class="sbutton iconadd" onclick="OnAdd();" data-lgid="P_APICRE_ADD">Add</span>
|
||||
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_APICRE_REFRESH">Refresh</span>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div id="credentiallist"></div>
|
||||
</div>
|
||||
|
||||
<div id="mask_bg">
|
||||
<div class="loading c-spin"></div>
|
||||
</div>
|
||||
<div class="dialog" id="dialog_credential" style="display: none; width: 500px;">
|
||||
<div class="dialog-title"><span class="title" data-lgid="P_APICRE_ADDMANUFACTURE">Add Credential</span><em class="dialog-close"></em></div>
|
||||
<div class="dialog-content" style="padding-left: 50px;">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="label" data-lgid="P_APICRE_APINAME_COLON">API Name:</td>
|
||||
<td>
|
||||
<select id="dialog_apiname" tabindex="1" style="width: 200px;">
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr id="tr_username" class="tr_aicredential" style="display: none;">
|
||||
<td class="label" data-lgid="P_APICRE_USERNAME_COLON">User Name:</td>
|
||||
<td>
|
||||
<input type="text" id="dialog_username" maxlength="50" tabindex="1" /></td>
|
||||
</tr>
|
||||
<tr id="tr_password" class="tr_aicredential" style="display: none;">
|
||||
<td class="label" data-lgid="P_APICRE_PASSWORD_COLON">Password:</td>
|
||||
<td>
|
||||
<input type="password" id="dialog_password" maxlength="50" tabindex="1" /></td>
|
||||
</tr>
|
||||
<tr id="tr_apikey" class="tr_aicredential" style="display: none;">
|
||||
<td class="label" data-lgid="P_APICRE_APIKEY_COLON">API Key:</td>
|
||||
<td>
|
||||
<input type="text" id="dialog_apikey" maxlength="200" tabindex="1" /></td>
|
||||
</tr>
|
||||
<tr id="tr_apisecret" class="tr_aicredential" style="display: none;">
|
||||
<td class="label" data-lgid="P_APICRE_APISECRET_COLON">API Secret:</td>
|
||||
<td>
|
||||
<input type="text" id="dialog_apisecret" maxlength="200" tabindex="1" /></td>
|
||||
</tr>
|
||||
<tr id="tr_apitoken" class="tr_aicredential" style="display: none;">
|
||||
<td class="label" data-lgid="P_APICRE_APITOKEN_COLON">API Token:</td>
|
||||
<td>
|
||||
<input type="text" id="dialog_apitoken" maxlength="200" tabindex="1" /></td>
|
||||
</tr>
|
||||
<tr id="tr_apitokensecret" class="tr_aicredential" style="display: none;">
|
||||
<td class="label" data-lgid="P_APICRE_APITOKENSECRET_COLON">API Token Secret:</td>
|
||||
<td>
|
||||
<input type="text" id="dialog_apitokensecret" maxlength="200" tabindex="1" /></td>
|
||||
</tr>
|
||||
<tr id="tr_enabled" style="display: none;">
|
||||
<td class="label" data-lgid="P_APICRE_ENABLED_COLON">Enabled:</td>
|
||||
<td>
|
||||
<input type="checkbox" id="dialog_enabled" style="width: 18px; margin: 0 auto;" tabindex="4" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="dialog-func">
|
||||
<input type="button" value="Cancel" data-lgid="P_APICRE_CANCEL" class="dialog-close" tabindex="6" />
|
||||
<input type="button" onclick="OnDialogOK();" value="OK" data-lgid="P_APICRE_OK" tabindex="5" />
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
||||
|
31
Site/Credentials/ManageAPICredential.aspx.cs
Normal file
31
Site/Credentials/ManageAPICredential.aspx.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using IronIntel.Contractor.Site;
|
||||
using IronIntel.Contractor.Site.Credentials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class ManageAPICredential : CredentialEntryBasePage
|
||||
{
|
||||
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)
|
||||
{
|
||||
Title = PageTitle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
357
Site/Credentials/ManageCredential.aspx
Normal file
357
Site/Credentials/ManageCredential.aspx
Normal file
@ -0,0 +1,357 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Credentials/Credentials.master" AutoEventWireup="true" CodeFile="ManageCredential.aspx.cs" Inherits="ManageCredential" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
|
||||
<style type="text/css">
|
||||
.dialog .dialog-title .dialog-close {
|
||||
float: right;
|
||||
margin-right: 6px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dialog .dialog-title .dialog-close:before {
|
||||
content: '\e600';
|
||||
}
|
||||
|
||||
.dialog-content table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dialog-content table td.label {
|
||||
width: 130px;
|
||||
text-align: right;
|
||||
padding-right: 10px;
|
||||
line-height: 24px;
|
||||
height: 24px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.dialog-content table td input,
|
||||
.dialog-content table td input[type="text"],
|
||||
.dialog-content table td textarea {
|
||||
border: 1px solid #a9a9a9;
|
||||
width: 320px;
|
||||
height: 18px;
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
.dialog-content table td input[type="checkbox"] {
|
||||
border: none;
|
||||
width: unset;
|
||||
}
|
||||
|
||||
.dialog-content table td textarea {
|
||||
height: 100px;
|
||||
max-width: 320px;
|
||||
}
|
||||
|
||||
.icon {
|
||||
font-family: CalciteWebCoreIcons;
|
||||
cursor: default;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
var credentialType = "AEMP";
|
||||
var credentialList;
|
||||
|
||||
credentialquery = function (method, param, callback, error, nolog) {
|
||||
_network.request("Credentials/ManageCredential.aspx?tp=ashx", -1, method, param, callback, error, nolog);
|
||||
}
|
||||
|
||||
function OnDelete(cr) {
|
||||
var cre = cr;
|
||||
if (!cre) {
|
||||
return;
|
||||
}
|
||||
showConfirm(GetTextByKey("P_CRE_DELETETHECREDENTIALTIPS", 'Do you want to delete the credential?'), GetTextByKey("P_CRE_DELETECREDENTIAL", 'Delete Credential'), function () {
|
||||
credentialquery("DeleteAEMPCredential", cre.ID, function (data) {
|
||||
OnRefresh();
|
||||
}, function (err) {
|
||||
showAlert(GetTextByKey("P_CRE_FAILEDDELETECREDENTIAL", 'Failed to delete this credential.'), GetTextByKey("P_CRE_DELETECREDENTIAL", 'Delete Credential'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function OnAdd() {
|
||||
creid = undefined;
|
||||
$('#dialog_manufacture').val('JOHNDEERE').removeAttr("disabled");
|
||||
$('#dialog_urlkey').val('');
|
||||
$('#dialog_username').val('');
|
||||
$('#dialog_password').val('');
|
||||
$('#dialog_enabled').attr('checked', 'checked');
|
||||
$('#dialog_orgid').val('');
|
||||
$('#dialog_notes').val('');
|
||||
$('#dialog_credential .dialog-title span.title').text(GetTextByKey("P_CRE_ADDMANUFACTURE", 'Add Credential'));
|
||||
$('#mask_bg').show();
|
||||
$('#dialog_credential')
|
||||
.attr('act', 'add')
|
||||
.css({
|
||||
'top': (document.documentElement.clientHeight - $('#dialog_credential').height()) / 3,
|
||||
'left': (document.documentElement.clientWidth - $('#dialog_credential').width()) / 2
|
||||
})
|
||||
.showDialogfixed();
|
||||
$('#dialog_urlkey').focus();
|
||||
}
|
||||
|
||||
var creid;
|
||||
function OnEdit() {
|
||||
var cre = grid_dt.source[grid_dt.selectedIndex].Values;
|
||||
if (!cre) {
|
||||
creid = undefined;
|
||||
return;
|
||||
}
|
||||
|
||||
creid = cre.ID;
|
||||
$('#dialog_manufacture').val(cre.ManufactureID).attr("disabled", "disabled");
|
||||
$('#dialog_urlkey').val(cre.UrlKey);
|
||||
$('#dialog_username').val(cre.UserName);
|
||||
$('#dialog_password').val(cre.Password);
|
||||
$('#dialog_enabled').attr("checked", cre.Enabled);
|
||||
$('#dialog_orgid').val(cre.OrgnizationID);
|
||||
$('#dialog_notes').val(cre.Notes);
|
||||
$('#dialog_credential .dialog-title span.title').text(GetTextByKey("P_CRE_EDITMANUFACTURE", 'Edit Credential'));
|
||||
$('#mask_bg').show();
|
||||
$('#dialog_credential')
|
||||
.attr('act', 'edit')
|
||||
.css({
|
||||
'top': (document.documentElement.clientHeight - $('#dialog_credential').height()) / 3,
|
||||
'left': (document.documentElement.clientWidth - $('#dialog_credential').width()) / 2
|
||||
})
|
||||
.showDialog();
|
||||
$('#dialog_urlkey').focus();
|
||||
}
|
||||
|
||||
function OnDblClick(e) {
|
||||
OnEdit();
|
||||
}
|
||||
|
||||
function OnRefresh() {
|
||||
showloading(true);
|
||||
credentialquery("GetAEMPCredentials", '', function (data) {
|
||||
showloading(false);
|
||||
credentialList = data;
|
||||
showCredentialList(credentialList);
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function showCredentialList(data) {
|
||||
var rows = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var r = data[i];
|
||||
var fr = { Values: r };
|
||||
rows.push(fr);
|
||||
}
|
||||
|
||||
grid_dt.setData(rows);
|
||||
}
|
||||
|
||||
var grid_dt;
|
||||
function InitGridData() {
|
||||
$('#btnEdit').attr("disabled", "disabled");
|
||||
|
||||
grid_dt = new GridView('#credentiallist');
|
||||
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: 'ManufactureID', caption: GetTextByKey("P_CRE_MANUFACTURE", "Manufacture"), valueIndex: 'ManufactureID', css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'UrlKey', caption: GetTextByKey("P_CRE_URLKEY", "Url Key"), valueIndex: 'UrlKey', css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'UserName', caption: GetTextByKey("P_CRE_USERNAME", "User Name"), valueIndex: 'UserName', css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'Enabled', caption: GetTextByKey("P_CRE_ENABLED", "Enabled"), valueIndex: 'Enabled', css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'Notes', caption: GetTextByKey("P_CRE_NOTES", "Notes"), valueIndex: 'Notes', css: { 'width': 200, 'text-align': 'left' } },
|
||||
{ name: 'Edit', caption: "", css: { 'width': 30, 'text-align': 'center' } },
|
||||
{ name: 'Delete', caption: "", css: { 'width': 30, 'text-align': 'center' } }
|
||||
];
|
||||
var columns = [];
|
||||
// head
|
||||
for (var hd in list_columns) {
|
||||
var col = {};
|
||||
col.name = list_columns[hd].name;
|
||||
col.caption = list_columns[hd].caption;
|
||||
col.visible = true;
|
||||
col.sortable = true;
|
||||
col.width = list_columns[hd].css.width;
|
||||
col.align = list_columns[hd].css["text-align"]
|
||||
col.key = list_columns[hd].valueIndex;
|
||||
if (col.name === "Edit") {
|
||||
col.isurl = true;
|
||||
col.text = "\uf044";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
OnEdit();
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
}
|
||||
col.attrs = { 'title': GetTextByKey("P_CRE_EDIT", 'Edit') };
|
||||
}
|
||||
else if (col.name === "Delete") {
|
||||
col.isurl = true;
|
||||
col.text = "\uf00d";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
OnDelete(this);
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
};
|
||||
col.attrs = { 'title': GetTextByKey("P_CRE_DELETE", 'Delete') };
|
||||
}
|
||||
columns.push(col);
|
||||
}
|
||||
grid_dt.canMultiSelect = false;
|
||||
grid_dt.columns = columns;
|
||||
grid_dt.init();
|
||||
grid_dt.rowdblclick = OnEdit;
|
||||
|
||||
grid_dt.selectedrowchanged = function (rowindex) {
|
||||
var rowdata = grid_dt.source[rowindex];
|
||||
if (rowdata) {
|
||||
creid = rowdata.Values.ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function OnDialogOK() {
|
||||
var item = {
|
||||
'ManufactureID': $('#dialog_manufacture').val(),
|
||||
'UrlKey': $('#dialog_urlkey').val().replace(/(^\s*)|(\s*$)/g, ''),
|
||||
'UserName': $('#dialog_username').val().replace(/(^\s*)|(\s*$)/g, ''),
|
||||
'Password': $('#dialog_password').val(),
|
||||
'Enabled': $('#dialog_enabled').attr("checked") == "checked",
|
||||
'OrgnizationID': $('#dialog_orgid').val(),
|
||||
'CredentialType': credentialType,
|
||||
'Notes': $('#dialog_notes').val()
|
||||
};
|
||||
var alerttitle;
|
||||
if (creid) {
|
||||
item.ID = creid;
|
||||
alerttitle = GetTextByKey("P_CRE_EDITMANUFACTURE", "Edit Credential");
|
||||
} else {
|
||||
item.ID = "";
|
||||
alerttitle = GetTextByKey("P_CRE_ADDMANUFACTURE", "Add Credential");
|
||||
}
|
||||
//if (!item.UrlKey || item.UrlKey.length == 0) {
|
||||
// showAlert('Url Key cannot be empty.', alerttitle);
|
||||
// $('#dialog_urlkey').focus();
|
||||
// return;
|
||||
//}
|
||||
if (!item.UserName || item.UserName.length == 0) {
|
||||
showAlert(GetTextByKey("P_CRE_USERNAMENOTBEEMPTY", 'User Name cannot be empty.'), alerttitle);
|
||||
$('#dialog_username').focus();
|
||||
return;
|
||||
}
|
||||
if (!item.Password || item.Password.length == 0) {
|
||||
showAlert(GetTextByKey("P_CRE_PASSWORDNOTBEEMPTY", 'Password cannot be empty.'), alerttitle);
|
||||
$('#dialog_username').focus();
|
||||
return;
|
||||
}
|
||||
|
||||
showloading(true);
|
||||
var param = JSON.stringify(item);
|
||||
param = htmlencode(param);
|
||||
credentialquery("UpdateAEMPCredential", param, function (data) {
|
||||
showloading(false);
|
||||
if (data !== 'OK') {
|
||||
showAlert(data, GetTextByKey("P_CRE_SAVEMANUFACTURE", 'Save Credential'));
|
||||
} else {
|
||||
$('#dialog_credential').hideDialog();
|
||||
OnRefresh();
|
||||
}
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
showAlert(GetTextByKey("P_CRE_FAILEDTOSAVECREDENTIAL", 'Failed to save credential.'), GetTextByKey("P_CRE_SAVEMANUFACTURE", 'Save Credential'));
|
||||
});
|
||||
}
|
||||
|
||||
$(function () {
|
||||
setPageTitle(GetTextByKey("P_CREDENTIALS", 'Credentials'), true);
|
||||
InitGridData();
|
||||
|
||||
$('#dialog_credential').dialog(function () {
|
||||
$('#mask_bg').hide();
|
||||
});
|
||||
OnRefresh();
|
||||
$(window).resize(function () {
|
||||
$("#credentiallist").css("height", $(window).height() - $("#credentiallist").offset().top - 4);
|
||||
grid_dt && grid_dt.resize();
|
||||
}).resize();
|
||||
});
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
|
||||
<div style="min-width: 400px;">
|
||||
<div class="page_title" data-lgid="P_CREDENTIALS">Credentials</div>
|
||||
<div class="function_title">
|
||||
<span class="sbutton iconadd" onclick="OnAdd();" data-lgid="P_CRE_ADD">Add</span>
|
||||
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_CRE_REFRESH">Refresh</span>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div id="credentiallist"></div>
|
||||
</div>
|
||||
|
||||
<div id="mask_bg">
|
||||
<div class="loading c-spin"></div>
|
||||
</div>
|
||||
<div class="dialog" id="dialog_credential" style="display: none; width: 530px;">
|
||||
<div class="dialog-title"><span class="title" data-lgid="P_CRE_ADDMANUFACTURE">Add Credential</span><em class="dialog-close"></em></div>
|
||||
<div class="dialog-content">
|
||||
<table style="line-height: 30px;">
|
||||
<tr>
|
||||
<td class="label" data-lgid="P_CRE_MANUFACTURE_COLON">Manufacture:</td>
|
||||
<td>
|
||||
<select id="dialog_manufacture" tabindex="1" style="width: 150px;">
|
||||
<option value="CAT" data-lgid="P_CRE_CAT">CAT</option>
|
||||
<option value="JOHNDEERE" data-lgid="P_CRE_JOHNDEERE">JOHN DEERE</option>
|
||||
<option value="Link-Belt" data-lgid="P_CRE_LINKBELT">Link-Belt</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label" data-lgid="P_CRE_URLKEY_COLON">Url Key:</td>
|
||||
<td>
|
||||
<input type="text" id="dialog_urlkey" maxlength="200" tabindex="1" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label" data-lgid="P_CRE_USERNAME_COLON">User Name:</td>
|
||||
<td>
|
||||
<input type="text" id="dialog_username" maxlength="50" tabindex="2" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label" data-lgid="P_CRE_PASSWORD_COLON">Password:</td>
|
||||
<td>
|
||||
<input type="password" id="dialog_password" maxlength="50" tabindex="3" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label" data-lgid="P_CRE_ENABLED_COLON">Enabled:</td>
|
||||
<td>
|
||||
<input type="checkbox" id="dialog_enabled" tabindex="4" />
|
||||
<input type="hidden" id="dialog_orgid" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label" data-lgid="P_CRE_NOTES_COLON">Notes:</td>
|
||||
<td>
|
||||
<textarea id="dialog_notes" maxlength="1000" tabindex="4"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="dialog-func">
|
||||
<input type="button" value="Cancel" data-lgid="P_CRE_CANCEL" class="dialog-close" tabindex="6" />
|
||||
<input type="button" onclick="OnDialogOK();" value="OK" data-lgid="P_CRE_OK" tabindex="5" />
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
||||
|
31
Site/Credentials/ManageCredential.aspx.cs
Normal file
31
Site/Credentials/ManageCredential.aspx.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using IronIntel.Contractor.Site;
|
||||
using IronIntel.Contractor.Site.Credentials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class ManageCredential : CredentialEntryBasePage
|
||||
{
|
||||
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)
|
||||
{
|
||||
Title = PageTitle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
709
Site/Credentials/ManageJDLink.aspx
Normal file
709
Site/Credentials/ManageJDLink.aspx
Normal file
@ -0,0 +1,709 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Credentials/Credentials.master" AutoEventWireup="true" CodeFile="ManageJDLink.aspx.cs" Inherits="ManageJDLink" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
|
||||
<style type="text/css">
|
||||
.dialog .dialog-title .dialog-close {
|
||||
float: right;
|
||||
margin-right: 6px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dialog .dialog-title .dialog-close:before {
|
||||
content: '\e600';
|
||||
}
|
||||
|
||||
.dialog-content table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dialog-content table td {
|
||||
padding-top: 30px;
|
||||
}
|
||||
|
||||
.dialog-content table td.label {
|
||||
width: 130px;
|
||||
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;
|
||||
}
|
||||
|
||||
.icon {
|
||||
font-family: CalciteWebCoreIcons;
|
||||
cursor: default;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
credentialquery = function (method, param, callback, error, nolog) {
|
||||
_network.request("Credentials/ManageJDLink.aspx?tp=ashx", -1, method, param, callback, error, nolog);
|
||||
}
|
||||
|
||||
//**************************************Begin JD Link***************************************************//
|
||||
function OnAdd() {
|
||||
showloading(true);
|
||||
credentialquery("CreateJDLinkAuthUrl", "", function (data) {
|
||||
showloading(false);
|
||||
if (data != "") {
|
||||
window.open(data);
|
||||
}
|
||||
else {
|
||||
showAlert(GetTextByKey("P_JDL_FAILEDTOCREATETHISJDLINK", "Failed to create this JD link."), GetTextByKey("P_JDL_CREATEJDLINK", 'Create JD Link'));
|
||||
}
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
});
|
||||
}
|
||||
|
||||
function OnRefresh() {
|
||||
showloading(true);
|
||||
credentialquery("GetJDLinkTokenItems", "", function (data) {
|
||||
showloading(false);
|
||||
if (typeof (data) === "string") {
|
||||
showAlert(data, GetTextByKey("P_JDL_ERROR", 'Error'));
|
||||
return;
|
||||
}
|
||||
showCredentialList(data);
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
});
|
||||
}
|
||||
|
||||
function showCredentialList(data) {
|
||||
var rows = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var r = data[i];
|
||||
for (var j in r) {
|
||||
if (j === "RequestTime")
|
||||
r[j] = { DisplayValue: r["RequestTimeStr"], Value: r[j] };
|
||||
}
|
||||
|
||||
var fr = { Values: r };
|
||||
rows.push(fr);
|
||||
}
|
||||
|
||||
grid_dt.setData(rows);
|
||||
}
|
||||
|
||||
var grid_dt;
|
||||
function InitGridData() {
|
||||
grid_dt = new GridView('#jdlinklist');
|
||||
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: 'AccountName', caption: GetTextByKey("P_JDL_ACCOUNTNAME", "Account Name"), valueIndex: 'AccountName', css: { 'width': 400, 'text-align': 'left' } },
|
||||
{ name: 'RequestTime', caption: GetTextByKey("P_JDL_REQUESTTIME", "Request Time"), valueIndex: 'RequestTime', css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'Organization', caption: "", css: { 'width': 110, 'text-align': 'center' } },
|
||||
{ name: 'ManageOrganization', caption: "", css: { 'width': 120, 'text-align': 'center' } },
|
||||
{ name: 'Delete', caption: "", css: { 'width': 30, 'text-align': 'center' } }
|
||||
];
|
||||
var columns = [];
|
||||
// head
|
||||
for (var hd in list_columns) {
|
||||
var col = {};
|
||||
col.name = list_columns[hd].name;
|
||||
col.caption = list_columns[hd].caption;
|
||||
col.visible = true;
|
||||
col.sortable = true;
|
||||
col.width = list_columns[hd].css.width;
|
||||
col.align = list_columns[hd].css["text-align"]
|
||||
col.key = list_columns[hd].valueIndex;
|
||||
if (col.name === "Delete") {
|
||||
col.isurl = true;
|
||||
col.text = "\uf00d";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
OnDelete(this);
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
};
|
||||
col.attrs = { 'title': getText("P_JDL_DELETE", 'Delete') };
|
||||
}
|
||||
else if (col.name === "Organization") {
|
||||
col.isurl = true;
|
||||
col.text = GetTextByKey("P_SET_XXX", "My Organizations");
|
||||
col.sortable = false;
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
openMyOrganizationsDialog(this, 0);
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
};
|
||||
col.attrs = { 'title': GetTextByKey("P_SET_XXX", "My Organizations") };
|
||||
}
|
||||
else if (col.name === "ManageOrganization") {
|
||||
col.isurl = true;
|
||||
col.text = GetTextByKey("P_SET_XXX", "Manage Organizations");
|
||||
col.sortable = false;
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
GetJDOrganizationUrl(this);
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
};
|
||||
col.attrs = { 'title': GetTextByKey("P_SET_XXX", "Manage Organizations") };
|
||||
}
|
||||
columns.push(col);
|
||||
}
|
||||
grid_dt.canMultiSelect = false;
|
||||
grid_dt.columns = columns;
|
||||
grid_dt.init();
|
||||
|
||||
grid_dt.selectedrowchanged = function (rowindex) {
|
||||
var rowdata = grid_dt.source[rowindex];
|
||||
if (rowdata) {
|
||||
creid = rowdata.Values.ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function OnDelete(cr) {
|
||||
var cre = cr;
|
||||
if (!cre) {
|
||||
return;
|
||||
}
|
||||
showConfirm(GetTextByKey("P_JDL_DOYOUWANTTODELETETHEJDLINK", 'Do you want to delete the JD link?'), GetTextByKey("P_JDL_DELETEJDLINK", 'Delete JD Link'), function () {
|
||||
credentialquery("DeleteToken", cre.TokenId, function (data) {
|
||||
OnRefresh();
|
||||
}, function (err) {
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//**************************************End JD Link***************************************************//
|
||||
|
||||
|
||||
|
||||
//**************************************Begin MyJohnDeere***************************************************//
|
||||
function OnAddMyJD() {
|
||||
showloading(true);
|
||||
credentialquery("CreateMyJDAPIAuthUrl", "", function (data) {
|
||||
showloading(false);
|
||||
if (data != "") {
|
||||
window.open(data);
|
||||
}
|
||||
else {
|
||||
showAlert(GetTextByKey("P_JDL_FAILEDTOCREATETHISMYJOHNDEERE", "Failed to create this MyJohnDeere."), GetTextByKey("P_JDL_CREATEMYJOHNDEERE", 'Create MyJohnDeere'));
|
||||
}
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
});
|
||||
}
|
||||
|
||||
function OnRefreshMyJD() {
|
||||
showloading(true);
|
||||
credentialquery("GetMyJDAPITokenItems", "", function (data) {
|
||||
showloading(false);
|
||||
if (typeof (data) === "string") {
|
||||
showAlert(data, GetTextByKey("P_JDL_ERROR", 'Error'));
|
||||
return;
|
||||
}
|
||||
showMyJDList(data);
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
});
|
||||
}
|
||||
|
||||
function showMyJDList(data) {
|
||||
var rows = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var r = data[i];
|
||||
for (var j in r) {
|
||||
if (j === "RequestTime")
|
||||
r[j] = { DisplayValue: r["RequestTimeStr"], Value: r[j] };
|
||||
}
|
||||
|
||||
var fr = { Values: r };
|
||||
rows.push(fr);
|
||||
}
|
||||
|
||||
grid_dtmyjd.setData(rows);
|
||||
}
|
||||
|
||||
var grid_dtmyjd;
|
||||
function InitGridMyJDData() {
|
||||
grid_dtmyjd = new GridView('#myjdlist');
|
||||
grid_dtmyjd.lang = {
|
||||
all: GetTextByKey("P_GRID_ALL", "(All)"),
|
||||
ok: GetTextByKey("P_GRID_OK", "OK"),
|
||||
reset: GetTextByKey("P_GRID_RESET", "Reset")
|
||||
};
|
||||
var list_columns = [
|
||||
{ name: 'AccountName', caption: GetTextByKey("P_JDL_ACCOUNTNAME", "Account Name"), valueIndex: 'AccountName', css: { 'width': 400, 'text-align': 'left' } },
|
||||
{ name: 'RequestTime', caption: GetTextByKey("P_JDL_REQUESTTIME", "Request Time"), valueIndex: 'RequestTime', css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'Organization', caption: "", css: { 'width': 110, 'text-align': 'center' } },
|
||||
{ name: 'ManageOrganization', caption: "", css: { 'width': 120, 'text-align': 'center' } },
|
||||
{ name: 'Delete', caption: "", css: { 'width': 30, 'text-align': 'center' } }
|
||||
];
|
||||
var columns = [];
|
||||
// head
|
||||
for (var hd in list_columns) {
|
||||
var col = {};
|
||||
col.name = list_columns[hd].name;
|
||||
col.caption = list_columns[hd].caption;
|
||||
col.visible = true;
|
||||
col.sortable = true;
|
||||
col.width = list_columns[hd].css.width;
|
||||
col.align = list_columns[hd].css["text-align"]
|
||||
col.key = list_columns[hd].valueIndex;
|
||||
if (col.name === "Delete") {
|
||||
col.isurl = true;
|
||||
col.text = "\uf00d";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
DeleteMyJDToken(this);
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
};
|
||||
col.attrs = { 'title': getText("P_JDL_DELETE", 'Delete') };
|
||||
}
|
||||
else if (col.name === "Organization") {
|
||||
col.isurl = true;
|
||||
col.text = GetTextByKey("P_SET_XXX", "My Organizations");
|
||||
col.sortable = false;
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
openMyOrganizationsDialog(this, 1);
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
};
|
||||
col.attrs = { 'title': GetTextByKey("P_SET_XXX", "My Organizations") };
|
||||
}
|
||||
else if (col.name === "ManageOrganization") {
|
||||
col.isurl = true;
|
||||
col.text = GetTextByKey("P_SET_XXX", "Manage Organizations");
|
||||
col.sortable = false;
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
GetJDOrganizationUrl(this);
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
};
|
||||
col.attrs = { 'title': GetTextByKey("P_SET_XXX", "Manage Organizations") };
|
||||
}
|
||||
columns.push(col);
|
||||
}
|
||||
grid_dtmyjd.canMultiSelect = false;
|
||||
grid_dtmyjd.columns = columns;
|
||||
grid_dtmyjd.init();
|
||||
|
||||
grid_dtmyjd.selectedrowchanged = function (rowindex) {
|
||||
var rowdata = grid_dtmyjd.source[rowindex];
|
||||
if (rowdata) {
|
||||
creid = rowdata.Values.ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function DeleteMyJDToken(cr) {
|
||||
var cre = cr;
|
||||
if (!cre) {
|
||||
return;
|
||||
}
|
||||
showConfirm(GetTextByKey("P_JDL_DOYOUWANTTODELETETHEMYJOHNDEERE", 'Do you want to delete the MyJohnDeere?'), GetTextByKey("P_JDL_DELETEMYJOHNDEERE", 'Delete MyJohnDeere'), function () {
|
||||
credentialquery("DeleteToken", cre.TokenId, function (data) {
|
||||
OnRefreshMyJD();
|
||||
}, function (err) {
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//**************************************End MyJohnDeere***************************************************//
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//**************************************Begin JD Notifications***************************************************//
|
||||
|
||||
function OnAddNotification() {
|
||||
$('#dialog_displayname').val('');
|
||||
$('#mask_bg').show();
|
||||
$('#dialog_credential')
|
||||
.attr('act', 'add')
|
||||
.css({
|
||||
'top': (document.documentElement.clientHeight - $('#dialog_credential').height()) / 3,
|
||||
'left': (document.documentElement.clientWidth - $('#dialog_credential').width()) / 2
|
||||
})
|
||||
.showDialogfixed();
|
||||
$('#dialog_displayname').focus();
|
||||
}
|
||||
|
||||
function CreateJDSubPubAuthUrl() {
|
||||
var displayname = $.trim($('#dialog_displayname').val());
|
||||
showloading(true);
|
||||
credentialquery("CreateJDSubPubAuthUrl", displayname, function (data) {
|
||||
showloading(false);
|
||||
if (data != "") {
|
||||
window.open(data);
|
||||
$('#dialog_credential').hideDialog();
|
||||
OnRefreshNotification();
|
||||
}
|
||||
else {
|
||||
showAlert(GetTextByKey("P_JDN_FAILEDTOCREATETHISSUBSCRIPTION", "Failed to create this subscription."), GetTextByKey("P_JDN_CREATEANEWSUBSCRIPTION", 'Create a new subscription'));
|
||||
}
|
||||
}, function (err) {
|
||||
$('#dialog_credential').hideDialog();
|
||||
showloading(false);
|
||||
});
|
||||
}
|
||||
|
||||
function OnRefreshNotification() {
|
||||
showloading(true);
|
||||
credentialquery("GetNotificationSubscriptions", '', function (data) {
|
||||
showloading(false);
|
||||
showNotificationList(data);
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
});
|
||||
}
|
||||
|
||||
function showNotificationList(data) {
|
||||
var rows = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var r = data[i];
|
||||
for (var j in r) {
|
||||
if (j === "CreateTime")
|
||||
r[j] = { DisplayValue: r["CreateTimeStr"], Value: r[j] };
|
||||
}
|
||||
|
||||
var fr = { Values: r };
|
||||
rows.push(fr);
|
||||
}
|
||||
|
||||
grid_dtnotification.setData(rows);
|
||||
}
|
||||
|
||||
var grid_dtnotification;
|
||||
function InitGridNotificationData() {
|
||||
grid_dtnotification = new GridView('#jdnotificationlist');
|
||||
grid_dtnotification.lang = {
|
||||
all: GetTextByKey("P_GRID_ALL", "(All)"),
|
||||
ok: GetTextByKey("P_GRID_OK", "OK"),
|
||||
reset: GetTextByKey("P_GRID_RESET", "Reset")
|
||||
};
|
||||
var list_columns = [
|
||||
{ name: 'DisplayName', caption: GetTextByKey("P_JDN_DISPLAYAME", "Display Name"), valueIndex: 'DisplayName', css: { 'width': 400, 'text-align': 'left' } },
|
||||
{ name: 'AccountName', caption: GetTextByKey("P_JDL_USERNAME", "User Name"), valueIndex: 'AccountName', css: { 'width': 400, 'text-align': 'left' } },
|
||||
{ name: 'CreateTime', caption: GetTextByKey("P_JDL_SUBSCRIPTIONNDATE", "Subscription Date"), valueIndex: 'CreateTime', css: { 'width': 150, 'text-align': 'left' } },
|
||||
//{ name: 'Organization', caption: "", css: { 'width': 110, 'text-align': 'center' } },
|
||||
{ name: 'Delete', caption: "", css: { 'width': 30, 'text-align': 'center' } }
|
||||
];
|
||||
var columns = [];
|
||||
// head
|
||||
for (var hd in list_columns) {
|
||||
var col = {};
|
||||
col.name = list_columns[hd].name;
|
||||
col.caption = list_columns[hd].caption;
|
||||
col.visible = true;
|
||||
col.sortable = true;
|
||||
col.width = list_columns[hd].css.width;
|
||||
col.align = list_columns[hd].css["text-align"]
|
||||
col.key = list_columns[hd].valueIndex;
|
||||
if (col.name === "Delete") {
|
||||
col.isurl = true;
|
||||
col.text = "\uf00d";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
OnDeleteNotification(this);
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
};
|
||||
col.attrs = { 'title': getText("P_JDL_DELETE", 'Delete') };
|
||||
}
|
||||
else if (col.name === "Organization") {
|
||||
col.isurl = true;
|
||||
col.text = GetTextByKey("P_SET_XXX", "My Organizations");
|
||||
col.sortable = false;
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
openMyOrganizationsDialog(this, 2);
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
};
|
||||
col.attrs = { 'title': GetTextByKey("P_SET_XXX", "My Organizations") };
|
||||
}
|
||||
columns.push(col);
|
||||
}
|
||||
grid_dtnotification.canMultiSelect = false;
|
||||
grid_dtnotification.columns = columns;
|
||||
grid_dtnotification.init();
|
||||
|
||||
grid_dtnotification.selectedrowchanged = function (rowindex) {
|
||||
var rowdata = grid_dtnotification.source[rowindex];
|
||||
if (rowdata) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function OnDeleteNotification(cr) {
|
||||
var cre = cr;
|
||||
if (!cre) {
|
||||
return;
|
||||
}
|
||||
showConfirm(GetTextByKey("P_JDL_DOYOUWANTTODELETETHESUBSCRIPTION", 'Do you want to delete the subscription?'), GetTextByKey("P_JDL_DELETESUBSCRIPTION", 'Delete Subscription'), function () {
|
||||
credentialquery("DeleteNotificationSubscription", cre.Id, function (data) {
|
||||
OnRefreshNotification();
|
||||
}, function (err) { });
|
||||
});
|
||||
}
|
||||
//**************************************End JD Notifications***************************************************//
|
||||
|
||||
|
||||
//**************************************Begin My Organizations***************************************************//
|
||||
|
||||
function openMyOrganizationsDialog(cr, type) {//0:jdlink;1:MyJohnDeere;2:Notification
|
||||
var cre = cr;
|
||||
if (!cre) {
|
||||
return;
|
||||
}
|
||||
|
||||
var tokenid = "";
|
||||
if (type == 0 || type == 1)
|
||||
tokenid = cre.TokenId;
|
||||
else
|
||||
tokenid = cre.Id;
|
||||
|
||||
GetOrganizations(tokenid);
|
||||
|
||||
$('#mask_myorganizationbg').show();
|
||||
$('#dialog_myorganization')
|
||||
.attr('act', 'add')
|
||||
.css({
|
||||
'top': (document.documentElement.clientHeight - $('#dialog_myorganization').height()) / 3,
|
||||
'left': (document.documentElement.clientWidth - $('#dialog_myorganization').width()) / 2
|
||||
})
|
||||
.showDialogfixed();
|
||||
}
|
||||
|
||||
function GetOrganizations(tokieid) {
|
||||
showloading(true);
|
||||
credentialquery("GetOrganizations", tokieid, function (data) {
|
||||
showloading(false);
|
||||
if (typeof (data) === "string") {
|
||||
showAlert(data, GetTextByKey("P_JDL_ERROR", 'Error'));
|
||||
return;
|
||||
}
|
||||
showMyOrgList(data);
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
});
|
||||
}
|
||||
|
||||
function GetJDOrganizationUrl(cr) {
|
||||
var cre = cr;
|
||||
if (!cre) {
|
||||
return;
|
||||
}
|
||||
|
||||
credentialquery("GetJDOrganizationUrl", cre.TokenId, function (data) {
|
||||
if (data != "")
|
||||
window.open(data);
|
||||
}, function (err) {
|
||||
});
|
||||
}
|
||||
|
||||
function showMyOrgList(data) {
|
||||
var rows = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var r = data[i];
|
||||
for (var j in r) {
|
||||
if (j === "Member")
|
||||
r[j] = { DisplayValue: r["Member"] ? "Yes" : "", Value: r[j] };
|
||||
}
|
||||
|
||||
var fr = { Values: r };
|
||||
rows.push(fr);
|
||||
}
|
||||
|
||||
grid_dtmyorgs.setData(rows);
|
||||
}
|
||||
|
||||
var grid_dtmyorgs;
|
||||
function InitGridMyOrgData() {
|
||||
grid_dtmyorgs = new GridView('#myorganization_list');
|
||||
grid_dtmyorgs.lang = {
|
||||
all: GetTextByKey("P_GRID_ALL", "(All)"),
|
||||
ok: GetTextByKey("P_GRID_OK", "OK"),
|
||||
reset: GetTextByKey("P_GRID_RESET", "Reset")
|
||||
};
|
||||
var list_columns = [
|
||||
{ name: 'Id', caption: GetTextByKey("P_JDN_XXX", "Id"), valueIndex: 'Id', css: { 'width': 100, 'text-align': 'left' } },
|
||||
{ name: 'Name', caption: GetTextByKey("P_JDL_XXX", "Name"), valueIndex: 'Name', css: { 'width': 300, 'text-align': 'left' } },
|
||||
{ name: 'OrgType', caption: GetTextByKey("P_JDL_XXX", "Type"), valueIndex: 'OrgType', css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'Member', caption: GetTextByKey("P_JDL_XXX", "Member"), valueIndex: 'Member', css: { 'width': 100, 'text-align': 'left' } }
|
||||
];
|
||||
var columns = [];
|
||||
// head
|
||||
for (var hd in list_columns) {
|
||||
var col = {};
|
||||
col.name = list_columns[hd].name;
|
||||
col.caption = list_columns[hd].caption;
|
||||
col.visible = true;
|
||||
col.sortable = true;
|
||||
col.width = list_columns[hd].css.width;
|
||||
col.align = list_columns[hd].css["text-align"]
|
||||
col.key = list_columns[hd].valueIndex;
|
||||
columns.push(col);
|
||||
}
|
||||
grid_dtmyorgs.canMultiSelect = false;
|
||||
grid_dtmyorgs.columns = columns;
|
||||
grid_dtmyorgs.init();
|
||||
|
||||
grid_dtmyorgs.selectedrowchanged = function (rowindex) {
|
||||
var rowdata = grid_dtmyorgs.source[rowindex];
|
||||
if (rowdata) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//**************************************End My Organizations***************************************************//
|
||||
|
||||
|
||||
$(function () {
|
||||
setPageTitle(GetTextByKey("P_JDLINK", 'JD Link'), true);
|
||||
InitGridData();
|
||||
InitGridMyJDData();
|
||||
InitGridNotificationData();
|
||||
InitGridMyOrgData();
|
||||
|
||||
OnRefresh();
|
||||
OnRefreshMyJD();
|
||||
OnRefreshNotification();
|
||||
|
||||
$('#dialog_credential').dialog(function () {
|
||||
$('#mask_bg').hide();
|
||||
});
|
||||
|
||||
$('#dialog_myorganization').dialog(function () {
|
||||
$('#mask_myorganizationbg').hide();
|
||||
});
|
||||
|
||||
$(window).resize(function () {
|
||||
$("#jdlinklist").css("height", 170);
|
||||
grid_dt && grid_dt.resize();
|
||||
|
||||
$("#myjdlist").css("height", 170);
|
||||
grid_dtmyjd && grid_dtmyjd.resize();
|
||||
|
||||
$("#jdnotificationlist").css("height", 170);
|
||||
grid_dtnotification && grid_dtnotification.resize();
|
||||
|
||||
$("#myorganization_list").css("height", 300);
|
||||
grid_dtmyorgs && grid_dtmyorgs.resize();
|
||||
}).resize();
|
||||
});
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
|
||||
<div style="min-width: 400px;">
|
||||
<div class="page_title" data-lgid="P_JDLINK">
|
||||
JD Link
|
||||
</div>
|
||||
<div class="function_title">
|
||||
<span class="sbutton iconadd" onclick="OnAdd();" data-lgid="P_JDL_ADD">Add</span>
|
||||
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_JDL_REFRESH">Refresh</span>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div id="jdlinklist"></div>
|
||||
</div>
|
||||
|
||||
<div style="min-width: 400px; margin-top: 10px;">
|
||||
<div class="page_title" data-lgid="P_JDL_MYJOHNDEERE">MyJohnDeere</div>
|
||||
<div class="function_title">
|
||||
<span class="sbutton iconadd" onclick="OnAddMyJD();" data-lgid="P_JDL_ADD">Add</span>
|
||||
<span class="sbutton iconrefresh" onclick="OnRefreshMyJD();" data-lgid="P_JDL_REFRESH">Refresh</span>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div id="myjdlist"></div>
|
||||
</div>
|
||||
|
||||
<div style="min-width: 400px; margin-top: 10px;">
|
||||
<div class="page_title" data-lgid="P_JDL_NOTIFICATIONSUBSCRIPTION">Notification Subscription</div>
|
||||
<div class="function_title">
|
||||
<span class="sbutton iconadd" onclick="OnAddNotification();" data-lgid="P_JDL_ADD">Add</span>
|
||||
<span class="sbutton iconrefresh" onclick="OnRefreshNotification();" data-lgid="P_JDL_REFRESH">Refresh</span>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div id="jdnotificationlist"></div>
|
||||
</div>
|
||||
|
||||
<div id="mask_bg">
|
||||
<div class="loading c-spin"></div>
|
||||
</div>
|
||||
<div class="dialog" id="dialog_credential" style="display: none; width: 600px;">
|
||||
<div class="dialog-title"><span class="title" data-lgid="P_JDN_CREATEANEWSUBSCRIPTION">Create a new subscription</span><em class="dialog-close"></em></div>
|
||||
<div class="dialog-content">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="label" data-lgid="P_JDN_DISPLAYAME_COLON">Display Name:</td>
|
||||
<td>
|
||||
<input id="dialog_displayname" maxlength="50" tabindex="2" style="width: 400px;" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="dialog-func" style="margin-top: 16px;">
|
||||
<input type="button" value="Cancel" data-lgid="P_JDN_CANCEL" class="dialog-close" tabindex="5" />
|
||||
<input type="button" style="width: unset;" onclick="CreateJDSubPubAuthUrl(); return false;" value="Create" data-lgid="P_JDN_CREATE" tabindex="3" />
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="mask_myorganizationbg" class="maskbg" style="display: none;">
|
||||
<div class="loading c-spin"></div>
|
||||
</div>
|
||||
<div class="dialog" id="dialog_myorganization" style="display: none; width: 800px;">
|
||||
<div class="dialog-title"><span class="title" data-lgid="P_JDN_XXX">My Organizations</span><em class="dialog-close"></em></div>
|
||||
<div class="dialog-content">
|
||||
<div id="myorganization_list"></div>
|
||||
</div>
|
||||
<div class="dialog-func" style="margin-top: 16px;">
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
||||
|
31
Site/Credentials/ManageJDLink.aspx.cs
Normal file
31
Site/Credentials/ManageJDLink.aspx.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using IronIntel.Contractor.Site;
|
||||
using IronIntel.Contractor.Site.Credentials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class ManageJDLink : CredentialEntryBasePage
|
||||
{
|
||||
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)
|
||||
{
|
||||
Title = PageTitle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
286
Site/Credentials/ManageJDNotifications.aspx
Normal file
286
Site/Credentials/ManageJDNotifications.aspx
Normal file
@ -0,0 +1,286 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Credentials/Credentials.master" AutoEventWireup="true" CodeFile="ManageJDNotifications.aspx.cs" Inherits="ManageJDNotifications" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
|
||||
<style type="text/css">
|
||||
.dialog .dialog-title .dialog-close {
|
||||
float: right;
|
||||
margin-right: 6px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dialog .dialog-title .dialog-close:before {
|
||||
content: '\e600';
|
||||
}
|
||||
|
||||
.dialog-content table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dialog-content table td {
|
||||
padding-top: 30px;
|
||||
}
|
||||
|
||||
.dialog-content table td.label {
|
||||
width: 130px;
|
||||
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;
|
||||
}
|
||||
|
||||
.icon {
|
||||
font-family: CalciteWebCoreIcons;
|
||||
cursor: default;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
var credentialList;
|
||||
var authdata = undefined;
|
||||
|
||||
credentialquery = function (method, param, callback, error, nolog) {
|
||||
_network.request("Credentials/ManageJDNotifications.aspx?tp=ashx", -1, method, param, callback, error, nolog);
|
||||
}
|
||||
|
||||
function OnAdd() {
|
||||
$('#requestCre').removeAttr("disabled");
|
||||
$('#dialog_Verifierd').attr("disabled", "disabled");
|
||||
$('#dialog_displayname').attr("disabled", "disabled");
|
||||
$('#saveCre').attr("disabled", "disabled");
|
||||
|
||||
$('#dialog_Verifierd').val('');
|
||||
$('#dialog_displayname').val('');
|
||||
$('#dialog_password').val('');
|
||||
$('#mask_bg').show();
|
||||
$('#dialog_credential')
|
||||
.attr('act', 'add')
|
||||
.css({
|
||||
'top': (document.documentElement.clientHeight - $('#dialog_credential').height()) / 3,
|
||||
'left': (document.documentElement.clientWidth - $('#dialog_credential').width()) / 2
|
||||
})
|
||||
.showDialogfixed();
|
||||
$('#dialog_displayname').focus();
|
||||
}
|
||||
|
||||
function OnRefresh() {
|
||||
showloading(true);
|
||||
credentialquery("GetJDNotificationCredentials", [], function (data) {
|
||||
showloading(false);
|
||||
credentialList = data;
|
||||
showCredentialList(credentialList);
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function showCredentialList(data) {
|
||||
var rows = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var r = data[i];
|
||||
for (var j in r) {
|
||||
if (j === "ExpireDate")
|
||||
r[j] = { DisplayValue: r["ExpireDateStr"], Value: r[j] };
|
||||
}
|
||||
|
||||
var fr = { Values: r };
|
||||
rows.push(fr);
|
||||
}
|
||||
|
||||
grid_dt.setData(rows);
|
||||
}
|
||||
|
||||
var grid_dt;
|
||||
function InitGridData() {
|
||||
grid_dt = new GridView('#jdlinklist');
|
||||
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: 'UserName', caption: GetTextByKey("P_JDN_USERNAME", "User Name"), valueIndex: 'UserName', css: { 'width': 400, 'text-align': 'left' } },
|
||||
{ name: 'DisplayName', caption: GetTextByKey("P_JDN_DISPLAYAME", "Display Name"), valueIndex: 'DisplayName', css: { 'width': 400, 'text-align': 'left' } },
|
||||
{ name: 'ExpireDate', caption: GetTextByKey("P_JDN_EXPIRATIONDATE", "Expiration Date"), valueIndex: 'ExpireDate', css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'Delete', caption: "", css: { 'width': 30, 'text-align': 'center' } }
|
||||
];
|
||||
var columns = [];
|
||||
// head
|
||||
for (var hd in list_columns) {
|
||||
var col = {};
|
||||
col.name = list_columns[hd].name;
|
||||
col.caption = list_columns[hd].caption;
|
||||
col.visible = true;
|
||||
col.sortable = true;
|
||||
col.width = list_columns[hd].css.width;
|
||||
col.align = list_columns[hd].css["text-align"]
|
||||
col.key = list_columns[hd].valueIndex;
|
||||
if (col.name === "Delete") {
|
||||
col.isurl = true;
|
||||
col.text = "\uf00d";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
OnDelete(this);
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
};
|
||||
col.attrs = { 'title': GetTextByKey("P_JDN_DELETE", 'Delete') };
|
||||
}
|
||||
columns.push(col);
|
||||
}
|
||||
grid_dt.canMultiSelect = false;
|
||||
grid_dt.columns = columns;
|
||||
grid_dt.init();
|
||||
|
||||
grid_dt.selectedrowchanged = function (rowindex) {
|
||||
var rowdata = grid_dt.source[rowindex];
|
||||
if (rowdata) {
|
||||
creid = rowdata.Values.ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function RequestCreClick() {
|
||||
$('#requestCre').attr("disabled", "disabled");
|
||||
|
||||
var alerttitle = GetTextByKey("P_JDN_AUTHORIZETHROUGHJOHNDEERE", "Authorize through John Deere");
|
||||
credentialquery("JDNotificationAuthorizeRequestToken", [], function (data) {
|
||||
if (typeof data === "string") {
|
||||
showAlert(data, alerttitle);
|
||||
$('#requestCre').removeAttr("disabled");
|
||||
return;
|
||||
}
|
||||
authdata = data;
|
||||
if (authdata.AuthorizeRequestTokenUri != "") {
|
||||
window.open(authdata.AuthorizeRequestTokenUri);
|
||||
$('#dialog_displayname').removeAttr("disabled").val("").focus();
|
||||
$('#dialog_Verifierd').removeAttr("disabled").val("");
|
||||
$('#saveCre').removeAttr("disabled");
|
||||
}
|
||||
else {
|
||||
$('#dialog_Verifierd').val("").attr("disabled", "disabled");
|
||||
$('#dialog_displayname').val("").attr("disabled", "disabled");
|
||||
showAlert(GetTextByKey("P_JDN_REQUESTFORVERIFIERFAILED", "Request for Verifier failed."), alerttitle);
|
||||
}
|
||||
}, function (err) {
|
||||
showAlert(GetTextByKey("P_JDN_FAILEDTOAUTHORIZETHROUGHJD", "Failed to authorize through John Deere this credential."), alerttitle);
|
||||
});
|
||||
}
|
||||
|
||||
function SaveCre() {
|
||||
var alerttitle = GetTextByKey("P_JDN_AUTHORIZE", "Authorize");
|
||||
var verifier = $.trim($('#dialog_Verifierd').val());
|
||||
if (verifier.length == 0) {
|
||||
showAlert(GetTextByKey("P_JDN_PLEASEINPUTVERIFIER", 'Please input Verifier.'), alerttitle);
|
||||
return false;
|
||||
}
|
||||
var displayname = $.trim($('#dialog_displayname').val());
|
||||
credentialquery("FinishJDNotificationOAuthRequest", JSON.stringify(authdata) + String.fromCharCode(170) + verifier + String.fromCharCode(170) + displayname, function (data) {
|
||||
if (data !== 'OK') {
|
||||
showAlert(data, alerttitle);
|
||||
} else {
|
||||
$('#dialog_credential').hideDialog();
|
||||
OnRefresh();
|
||||
}
|
||||
}, function (err) {
|
||||
showAlert(GetTextByKey("P_JDN_FAILEDTOAUTHORIZETHISCREDENTIAL", "Failed to authorize this credential."), alerttitle);
|
||||
});
|
||||
}
|
||||
|
||||
function OnDelete(cr) {
|
||||
var cre = cr;
|
||||
if (!cre) {
|
||||
return;
|
||||
}
|
||||
var alerttitle = GetTextByKey("P_JDN_DELETECREDENTIAL", "Delete Credential");
|
||||
showConfirm(GetTextByKey("P_JDN_DELETETHECREDENTIALTIPS", 'Do you want to delete the credential?'), alerttitle, function () {
|
||||
credentialquery("DeleteSubscription", cre.ID, function (data) {
|
||||
if (data !== 'OK') {
|
||||
showAlert(data, alerttitle);
|
||||
return;
|
||||
}
|
||||
OnRefresh();
|
||||
}, function (err) {
|
||||
showAlert(GetTextByKey("GetTextByKey", 'Failed to delete this credential.'), alerttitle);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$(function () {
|
||||
setPageTitle(GetTextByKey("P_JOHNDEERENOTIFICATIONS", 'JohnDeere Notifications'), true);
|
||||
InitGridData();
|
||||
|
||||
$('#dialog_credential').dialog(function () {
|
||||
$('#mask_bg').hide();
|
||||
});
|
||||
OnRefresh();
|
||||
$(window).resize(function () {
|
||||
$("#jdlinklist").css("height", $(window).height() - $("#jdlinklist").offset().top - 4);
|
||||
grid_dt && grid_dt.resize();
|
||||
}).resize();
|
||||
});
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
|
||||
<div style="min-width: 400px;">
|
||||
<div class="page_title" data-lgid="P_JOHNDEERENOTIFICATIONS">JohnDeere Notifications</div>
|
||||
<div class="function_title">
|
||||
<span class="sbutton iconadd" onclick="OnAdd();" data-lgid="P_JDN_ADD">Add</span>
|
||||
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_JDN_REFRESH">Refresh</span>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div id="jdlinklist"></div>
|
||||
</div>
|
||||
|
||||
<div id="mask_bg">
|
||||
<div class="loading c-spin"></div>
|
||||
</div>
|
||||
<div class="dialog" id="dialog_credential" style="display: none; width: 600px;">
|
||||
<div class="dialog-title"><span class="title" data-lgid="P_JDN_REQUESTCREDENTIAL">Request Credential</span><em class="dialog-close"></em></div>
|
||||
<div class="dialog-content">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="label" data-lgid="P_JDN_DISPLAYAME_COLON">Display Name:</td>
|
||||
<td>
|
||||
<input id="dialog_displayname" maxlength="50" tabindex="2" style="width: 400px;" disabled="disabled" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label" data-lgid="P_JDN_VERIFIER_COLON">Verifier:</td>
|
||||
<td>
|
||||
<input id="dialog_Verifierd" maxlength="50" tabindex="2" style="width: 400px;" disabled="disabled" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="dialog-func" style="margin-top: 16px;">
|
||||
<input type="button" value="Cancel" data-lgid="P_JDN_CANCEL" class="dialog-close" tabindex="5" />
|
||||
<input type="button" id="saveCre" style="width: unset;" onclick="SaveCre(); return false;" disabled="disabled" value="Authorize" data-lgid="P_JDN_AUTHORIZE" tabindex="4" />
|
||||
<input type="button" id="requestCre" style="width: unset;" onclick="RequestCreClick(); return false;" value="Authorize through John Deere" data-lgid="P_JDN_AUTHORIZETHROUGHJOHNDEERE" tabindex="3" />
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
||||
|
33
Site/Credentials/ManageJDNotifications.aspx.cs
Normal file
33
Site/Credentials/ManageJDNotifications.aspx.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using Foresight.Fleet.Services.User;
|
||||
using IronIntel.Contractor;
|
||||
using IronIntel.Contractor.Site;
|
||||
using IronIntel.Contractor.Site.Credentials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class ManageJDNotifications : CredentialEntryBasePage
|
||||
{
|
||||
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)
|
||||
{
|
||||
Title = PageTitle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
40
Site/Credentials/css/controls.css
Normal file
40
Site/Credentials/css/controls.css
Normal file
@ -0,0 +1,40 @@
|
||||
.tab_holder {
|
||||
|
||||
}
|
||||
.tab_header {
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
border-bottom: 1px solid #b0b0b0;
|
||||
/* 禁止选中 */
|
||||
-moz-user-select: none; /*火狐*/
|
||||
-webkit-user-select: none; /*webkit浏览器*/
|
||||
-ms-user-select: none; /*IE10*/
|
||||
-khtml-user-select: none; /*早期浏览器*/
|
||||
user-select: none;
|
||||
}
|
||||
.tab_header .tab_title {
|
||||
float: left;
|
||||
height: 29px;
|
||||
cursor: pointer;
|
||||
padding: 0 12px;
|
||||
border: 1px solid #fff;
|
||||
border-bottom: none;
|
||||
}
|
||||
.tab_header .tab_title:hover {
|
||||
/*background: #d7690E;*/
|
||||
color: rgb(173,84,12);
|
||||
}
|
||||
.tab_header .selected,
|
||||
.tab_header .selected:hover {
|
||||
/*background: #F78E1E;*/
|
||||
border: 1px solid #b0b0b0;
|
||||
border-bottom: 1px solid #fff;
|
||||
/*margin-top: -1px;*/
|
||||
color: rgb(173,84,12);
|
||||
}
|
||||
.tab_header .tab_title:first-child {
|
||||
border-left: none;
|
||||
}
|
||||
.tab_holder .tab_page {
|
||||
|
||||
}
|
BIN
Site/Credentials/img/apicredential.png
Normal file
BIN
Site/Credentials/img/apicredential.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 961 B |
BIN
Site/Credentials/img/credential.png
Normal file
BIN
Site/Credentials/img/credential.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 961 B |
BIN
Site/Credentials/img/jdlink.png
Normal file
BIN
Site/Credentials/img/jdlink.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1001 B |
BIN
Site/Credentials/img/jdnotifications.png
Normal file
BIN
Site/Credentials/img/jdnotifications.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
397
Site/Credentials/js/controls.js
vendored
Normal file
397
Site/Credentials/js/controls.js
vendored
Normal file
@ -0,0 +1,397 @@
|
||||
/// <reference path="../../js/jquery-3.6.0.min.js" />
|
||||
/// <reference path="../../js/utility.js" />
|
||||
|
||||
$.fn.tab = function (obj) {
|
||||
return this.each(function () {
|
||||
var _this = $(this);
|
||||
_this.data('tabparam', obj);
|
||||
|
||||
function switchPage(page) {
|
||||
_this.children('.tab_page').hide();
|
||||
_this.children('#' + page).show();
|
||||
}
|
||||
|
||||
var titles = _this.children('.tab_header').children('.tab_title');
|
||||
titles.click(function (e) {
|
||||
var n_this = $(this);
|
||||
// invoke function
|
||||
function next() {
|
||||
if (typeof obj.onnext === 'function') {
|
||||
obj.onnext();
|
||||
}
|
||||
titles.removeClass('selected');
|
||||
var dfor = n_this.addClass('selected').attr('data-for');
|
||||
switchPage(dfor);
|
||||
}
|
||||
if (typeof obj.onclick === 'function') {
|
||||
obj.onclick(n_this, next);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
var datafor = titles.removeClass('selected').first().addClass('selected').attr('data-for');
|
||||
switchPage(datafor);
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.selectable = function (param) {
|
||||
|
||||
param = param || {};
|
||||
|
||||
function multi_click(e) {
|
||||
var target = $(e.target);
|
||||
if (!target.is('tr')) {
|
||||
target = target.parents('tr').first();
|
||||
}
|
||||
if (param.multiple) {
|
||||
if (!target.length)
|
||||
return;
|
||||
// ctrl
|
||||
if (e.ctrlKey) {
|
||||
if (target.hasClass('selected')) {
|
||||
target.removeClass('selected');
|
||||
} else {
|
||||
target.addClass('selected');
|
||||
}
|
||||
} else if (e.shiftKey) {
|
||||
target.addClass('selected');
|
||||
var first = $(this).children('tr.selected:first');
|
||||
var last = $(this).children('tr.selected:last');
|
||||
while (first.attr('uid') != last.attr('uid')) {
|
||||
first = first.next();
|
||||
if (!first.length)
|
||||
break;
|
||||
first.addClass('selected');
|
||||
}
|
||||
} else {
|
||||
$(this).children('tr').removeClass('selected');
|
||||
target.addClass('selected');
|
||||
}
|
||||
} else {
|
||||
$(this).children('tr').removeClass('selected');
|
||||
if (!target.length)
|
||||
return;
|
||||
target.addClass('selected');
|
||||
}
|
||||
}
|
||||
|
||||
function dbl_click(e) {
|
||||
if (typeof param.dblclick !== 'function')
|
||||
return;
|
||||
|
||||
var target = $(e.target);
|
||||
if (!target.is('tr')) {
|
||||
target = target.parents('tr').first();
|
||||
}
|
||||
param.dblclick.apply(this, [target]);
|
||||
}
|
||||
|
||||
return this.each(function () {
|
||||
$(this).click(multi_click).dblclick(dbl_click);
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.tree = function (data, selectedValues, options) {
|
||||
|
||||
options = options || {};
|
||||
selectedValues = selectedValues || [];
|
||||
|
||||
if (!data) {
|
||||
return this;
|
||||
}
|
||||
|
||||
function changeExpand() {
|
||||
var flag = $(this).hasClass('collapse');
|
||||
if (flag) {
|
||||
$(this).removeClass('collapse').addClass('expand').parent('li').children('ul').show();
|
||||
} else {
|
||||
$(this).removeClass('expand').addClass('collapse').parent('li').children('ul').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function checkSelected(data) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var item = data[i];
|
||||
if (selectedValues.indexOf(item.ID) >= 0) {
|
||||
return true;
|
||||
}
|
||||
if (item.SubData && item.SubData.length > 0) {
|
||||
if (checkSelected(item.SubData)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function checkChanged() {
|
||||
var li = $(this).parents('li:first');
|
||||
var checked = $(this).prop('checked');
|
||||
|
||||
// 如果有子节点
|
||||
var ul = li.children('ul');
|
||||
var indeter = $(this).prop('indeter');
|
||||
$(this).removeProp('indeter');
|
||||
if (checked) {
|
||||
// check all
|
||||
ul.find('input').removeProp('indeter').prop({ 'indeterminate': false, 'checked': true });
|
||||
} else {
|
||||
if (!indeter && ul.length > 0) {
|
||||
$(this).prop({
|
||||
'indeterminate': true,
|
||||
'indeter': true,
|
||||
'checked': true
|
||||
});
|
||||
} else {
|
||||
// uncheck all
|
||||
ul.find('input').removeProp('indeter').prop({ 'indeterminate': false, 'checked': false });
|
||||
}
|
||||
}
|
||||
checkUpper.apply(this);
|
||||
}
|
||||
|
||||
function checkUpper() {
|
||||
// 向上寻找父节点
|
||||
var ul = $(this).parents('ul:first');
|
||||
var inp = ul.prev('em').prev('span').children('input');
|
||||
if (inp.length > 0) {
|
||||
var chks = ul.children('li').children('span').children('input');
|
||||
var count = chks.length;
|
||||
for (var i = 0; i < chks.length; i++) {
|
||||
if (chks[i].indeterminate) {
|
||||
count = 0.5;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!chks[i].checked) {
|
||||
count--;
|
||||
}
|
||||
}
|
||||
if (count == chks.length) {
|
||||
// checked all
|
||||
inp.removeProp('indeter').prop({ 'indeterminate': false, 'checked': true });
|
||||
} else if (count == 0) {
|
||||
// unchecked all
|
||||
inp.removeProp('indeter').prop({ 'indeterminate': false, 'checked': false });
|
||||
} else {
|
||||
inp.prop({
|
||||
'indeterminate': true,
|
||||
'indeter': true,
|
||||
'checked': true
|
||||
});
|
||||
}
|
||||
// 遍历
|
||||
checkUpper.apply(inp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function fillChildren(ul, item, selected) {
|
||||
var li = $('<li></li>');
|
||||
var uid = 'li_' + Math.random().toString().substring(2);
|
||||
var chk = $('<input type="checkbox"/>').attr('id', uid).val(item.ID).change(checkChanged);
|
||||
if (selected || selectedValues.indexOf(item.ID) >= 0) {
|
||||
chk.prop('checked', true);
|
||||
selected = true;
|
||||
}
|
||||
var span = $('<span></span>');
|
||||
span.append(chk, $('<label></label>').attr('for', uid).text(item.Description));
|
||||
li.append(span);
|
||||
ul.append(li);
|
||||
// 判断是否有子节点
|
||||
if (item.SubData && item.SubData.length > 0) {
|
||||
// 判断子节点选中状态
|
||||
var ulc;
|
||||
if (selected || checkSelected(item.SubData)) {
|
||||
li.append($('<em class="icn expand"></em>').click(changeExpand));
|
||||
ulc = $('<ul></ul>');
|
||||
} else {
|
||||
li.append($('<em class="icn collapse"></em>').click(changeExpand));
|
||||
ulc = $('<ul></ul>').css('display', 'none');
|
||||
}
|
||||
var cnt = 0
|
||||
for (var i = 0; i < item.SubData.length; i++) {
|
||||
if (fillChildren(ulc, item.SubData[i], selected)) {
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
li.append(ulc);
|
||||
// 补充父节点的不定状态
|
||||
if (!selected && cnt > 0) {
|
||||
chk.prop({
|
||||
'indeterminate': true,
|
||||
'indeter': true,
|
||||
'checked': true
|
||||
});
|
||||
}
|
||||
}
|
||||
return selected;
|
||||
}
|
||||
|
||||
return this.each(function () {
|
||||
for (var i = 0 ; i < data.length; i++) {
|
||||
fillChildren($(this), data[i]);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var TYPE_USER = 2;
|
||||
var TYPE_GROUP = 1;
|
||||
|
||||
$.fn.appendUserCtl = function (param) {
|
||||
param = param || {};
|
||||
|
||||
function dtquery(method, p, callback) {
|
||||
_network.request("Security/DataTablePermission.aspx", -1, method, p, callback, function (e) {
|
||||
console.log(e);
|
||||
showmaskbg(false);
|
||||
showAlert(e.statusText, 'Error');
|
||||
});
|
||||
}
|
||||
|
||||
function groupTitleClick(e) {
|
||||
if ($(this.lastChild).hasClass('collapse')) {
|
||||
$(this.lastChild).removeClass('collapse').addClass('expand');
|
||||
$(this).nextAll().show();
|
||||
} else {
|
||||
$(this.lastChild).removeClass('expand').addClass('collapse');
|
||||
$(this).nextAll().hide();
|
||||
}
|
||||
}
|
||||
|
||||
var usersul = $('<ul class="ul_menu"></ul>').attr('usertype', TYPE_USER);
|
||||
var usertitle = $('<li class="ul_header"></li>').append('<span>Users</span><em class="icn expand"></em>').click(groupTitleClick);
|
||||
usersul.append(usertitle);
|
||||
dtquery('GetUsers', '', function (data) {
|
||||
usertitle.nextAll().remove();
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var li = $('<li class="subitem"></li>')
|
||||
.attr({
|
||||
'id': data[i].IID,
|
||||
'title': data[i].ID
|
||||
})
|
||||
//.text(data[i].DisplayName)
|
||||
.append($('<span></span>').text(data[i].DisplayName), $('<i></i>').text('(' + data[i].ID + ')'))
|
||||
.data('usertype', data[i].UserType);
|
||||
li.click(param.selectUser);
|
||||
usersul.append(li);
|
||||
}
|
||||
|
||||
// default to load the first
|
||||
usertitle.next().click();
|
||||
});
|
||||
|
||||
var groupsul = $('<ul class="ul_menu"></ul>').attr('usertype', TYPE_GROUP);
|
||||
var grouptitle = $('<li class="ul_header"></li>').append('<span>User Groups</span><em class="icn expand"></em>').click(groupTitleClick);
|
||||
groupsul.append(grouptitle);
|
||||
dtquery('GetUserGroups', '', function (data) {
|
||||
grouptitle.nextAll().remove();
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var li = $('<li class="subitem"></li>').attr('id', data[i].ID).text(data[i].Name);
|
||||
li.click(param.selectUser);
|
||||
groupsul.append(li);
|
||||
}
|
||||
});
|
||||
|
||||
return this.append(usersul, groupsul);
|
||||
};
|
||||
$.fn.getUserIdType = function () {
|
||||
var li = this.find('li.selected');
|
||||
var id = li.attr('id');
|
||||
var usertype;
|
||||
if (li.parent().attr('usertype') == TYPE_GROUP) {
|
||||
usertype = TYPE_GROUP;
|
||||
} else {
|
||||
usertype = TYPE_USER;
|
||||
}
|
||||
return {
|
||||
'id': id,
|
||||
'type': usertype,
|
||||
'permission': li.data('usertype')
|
||||
};
|
||||
};
|
||||
|
||||
if (typeof Class !== 'function') {
|
||||
|
||||
// 基类实现 (空实现)
|
||||
Class = function () { };
|
||||
|
||||
/* Simple JavaScript Inheritance
|
||||
* By John Resig http://ejohn.org/
|
||||
* MIT Licensed.
|
||||
*/
|
||||
// Inspired by base2 and Prototype
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var initializing = false, fnTest = /xyz/.test(function () { xyz; }) ? /\b_super\b/ : /.*/;
|
||||
|
||||
// 创建一个继承当前调用类的子类
|
||||
Class.extend = function ext(prop) {
|
||||
var _super = this.prototype;
|
||||
|
||||
// 实例化,此时不执行构造方法 (x.prototype.constructor)
|
||||
initializing = true;
|
||||
var prototype = new this();
|
||||
initializing = false;
|
||||
|
||||
// 复制属性到新的prototype中
|
||||
for (var name in prop) {
|
||||
// 判断属性或重载方法
|
||||
prototype[name] = typeof prop[name] == "function" &&
|
||||
typeof _super[name] == "function" && fnTest.test(prop[name]) ?
|
||||
(function (name, fn) {
|
||||
return function () {
|
||||
var tmp = this._super;
|
||||
|
||||
this._super = _super[name];
|
||||
var ret = fn.apply(this, arguments);
|
||||
this._super = tmp;
|
||||
|
||||
return ret;
|
||||
};
|
||||
})(name, prop[name]) :
|
||||
prop[name];
|
||||
}
|
||||
|
||||
// 临时构造方法
|
||||
function Class() {
|
||||
if (!initializing && this.init)
|
||||
this.init.apply(this, arguments);
|
||||
}
|
||||
|
||||
Class.prototype = prototype;
|
||||
// 修正构造方法的指向
|
||||
Class.prototype.constructor = Class;
|
||||
// 添加扩展
|
||||
Class.extend = ext; // arguments.callee;
|
||||
|
||||
return Class;
|
||||
};
|
||||
}());
|
||||
}
|
||||
if (typeof _chartType === 'undefined') {
|
||||
_chartType = {
|
||||
Gauge: 'Gauge',
|
||||
Grid: 'Grid',
|
||||
Grid3D: 'Grid3D',
|
||||
List: 'List',
|
||||
Line2D: 'Line',
|
||||
Line3D: 'Line3D',
|
||||
Column2D: 'Column',
|
||||
Column3D: 'Column3D',
|
||||
Bar2D: 'Bar',
|
||||
Bar3D: 'Bar3D',
|
||||
ColumnLine: 'ColumnLine',
|
||||
Scatter: 'ScatterPlot',
|
||||
Pie: 'Pie',
|
||||
Doughnut: 'Doughnut',
|
||||
Scorecard: 'FreeChart',
|
||||
Rss: 'RSS',
|
||||
Video: 'Video',
|
||||
Stock: 'Stock',
|
||||
Alert: 'Alert',
|
||||
Favorites: 'Favorites',
|
||||
FRPT: 'FRPT'
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user