use fetch over $.getJSON
This commit is contained in:
@@ -397,6 +397,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(taskStatus.SessionId));
|
||||
}
|
||||
[DiscoAuthorizeAll(Claims.Config.DeviceFlag.Configure, Claims.Device.Actions.AddFlags, Claims.Device.Actions.RemoveFlags, Claims.Device.ShowFlagAssignments)]
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
public virtual ActionResult AssignedDevices(int id)
|
||||
{
|
||||
if (id < 0)
|
||||
|
||||
@@ -9,14 +9,16 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
{
|
||||
public partial class ExpressionsController : AuthorizedDatabaseController
|
||||
{
|
||||
[HttpPost, DiscoAuthorize(Claims.DiscoAdminAccount)]
|
||||
[DiscoAuthorize(Claims.DiscoAdminAccount)]
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
public virtual ActionResult ValidateExpression(string Expression)
|
||||
{
|
||||
var part = new EvaluateExpressionPart(Expression);
|
||||
return Json(Models.Expressions.ValidateExpressionModel.FromEvaluateExpressionPart(part));
|
||||
}
|
||||
|
||||
[HttpPost, DiscoAuthorize(Claims.Config.Show), ValidateAntiForgeryToken]
|
||||
[DiscoAuthorize(Claims.Config.Show)]
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
public virtual ActionResult TypeDescriptor(string type, bool staticMembersOnly = false)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(type))
|
||||
|
||||
@@ -308,6 +308,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
}
|
||||
|
||||
[DiscoAuthorizeAny(Claims.Config.System.ConfigureActiveDirectory, Claims.Config.DeviceProfile.Configure)]
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
public virtual ActionResult DomainOrganisationalUnits()
|
||||
{
|
||||
var domainOUs = ActiveDirectory.RetrieveADOrganisationalUnitStructure()
|
||||
|
||||
@@ -402,6 +402,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(taskStatus.SessionId));
|
||||
}
|
||||
[DiscoAuthorizeAll(Claims.Config.UserFlag.Configure, Claims.User.Actions.AddFlags, Claims.User.Actions.RemoveFlags, Claims.User.ShowFlagAssignments)]
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
public virtual ActionResult AssignedUsers(int id)
|
||||
{
|
||||
if (id < 0)
|
||||
|
||||
@@ -771,7 +771,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="Config_DeviceFlags_BulkAssign_AssignDialog" class="dialog" title="Bulk Assign Devices">
|
||||
<div id="Config_DeviceFlags_BulkAssign_AssignDialog" class="dialog" title="Bulk Assign Devices" data-assignedurl="@Url.Action(MVC.API.DeviceFlag.AssignedDevices(Model.DeviceFlag.Id))">
|
||||
<div class="brief">
|
||||
<div>
|
||||
Enter multiple <strong>Device Serial Numbers</strong> separated by <code><new line></code>, commas (<code>,</code>) or semicolons (<code>;</code>).
|
||||
@@ -846,18 +846,24 @@
|
||||
$form.attr('action', $form.attr('data-overrideaction'));
|
||||
|
||||
assignDialog.addClass('loading');
|
||||
$.getJSON('@Url.Action(MVC.API.DeviceFlag.AssignedDevices(Model.DeviceFlag.Id))', function (response, result) {
|
||||
const body = new FormData();
|
||||
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||
fetch(assignDialog.attr('data-assignedurl'), {
|
||||
method: 'POST',
|
||||
body: body
|
||||
}).then(r => {
|
||||
assignDialog.removeClass('loading');
|
||||
|
||||
if (result != 'success') {
|
||||
alert('Unable to load current assignments:\n' + response);
|
||||
if (!r.ok) {
|
||||
alert('Unable to load current assignments:\n' + r.statusText);
|
||||
assignDialog.dialog('close');
|
||||
} else {
|
||||
if (!!response) {
|
||||
assignDeviceSerialNumbers.val(response.join('\n'));
|
||||
} else {
|
||||
assignDeviceSerialNumbers.val('');
|
||||
}
|
||||
r.json().then(j => {
|
||||
if (!j) {
|
||||
assignDeviceSerialNumbers.val('');
|
||||
} else {
|
||||
assignDeviceSerialNumbers.val(j.join('\n'));
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2357,6 +2357,17 @@ WriteLiteral(" class=\"dialog\"");
|
||||
|
||||
WriteLiteral(" title=\"Bulk Assign Devices\"");
|
||||
|
||||
WriteLiteral(" data-assignedurl=\"");
|
||||
|
||||
|
||||
#line 774 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceFlag.AssignedDevices(Model.DeviceFlag.Id)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"brief\"");
|
||||
@@ -2467,48 +2478,31 @@ WriteLiteral(" <script>\r\n $(function () {\r\n
|
||||
"ers.closest(\'form\');\r\n if (mode == \"Override\") {\r\n " +
|
||||
" $form.attr(\'action\', $form.attr(\'data-overrideaction\'));\r\n\r" +
|
||||
"\n assignDialog.addClass(\'loading\');\r\n " +
|
||||
" $.getJSON(\'");
|
||||
" const body = new FormData();\r\n body.appen" +
|
||||
"d(\'__RequestVerificationToken\', document.body.dataset.antiforgery);\r\n " +
|
||||
" fetch(assignDialog.attr(\'data-assignedurl\'), {\r\n " +
|
||||
" method: \'POST\',\r\n body: body\r\n " +
|
||||
" }).then(r => {\r\n assign" +
|
||||
"Dialog.removeClass(\'loading\');\r\n if (!r.ok) {\r\n " +
|
||||
" alert(\'Unable to load current assignments:\\n\' " +
|
||||
"+ r.statusText);\r\n assignDialog.dialog(\'close" +
|
||||
"\');\r\n } else {\r\n " +
|
||||
" r.json().then(j => {\r\n if (!j) {\r\n " +
|
||||
" assignDeviceSerialNumbers.val(\'\');\r\n " +
|
||||
" } else {\r\n " +
|
||||
" assignDeviceSerialNumbers.val(j.join(\'\\n\'));\r\n " +
|
||||
" }\r\n })\r\n " +
|
||||
" }\r\n });\r\n }\r\n " +
|
||||
" else // Assume Add\r\n {\r\n " +
|
||||
" $form.attr(\'action\', $form.attr(\'data-addaction\'));\r\n " +
|
||||
" }\r\n\r\n assignDialog.dialog(\'open\');\r\n " +
|
||||
" }\r\n\r\n $(\'#Config_DeviceFlags_BulkAssign_Button\').cli" +
|
||||
"ck(function () {\r\n showModeDialog();\r\n " +
|
||||
" return false;\r\n });\r\n });\r\n </" +
|
||||
"script>\r\n");
|
||||
|
||||
|
||||
#line 849 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
Write(Url.Action(MVC.API.DeviceFlag.AssignedDevices(Model.DeviceFlag.Id)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"', function (response, result) {
|
||||
assignDialog.removeClass('loading');
|
||||
|
||||
if (result != 'success') {
|
||||
alert('Unable to load current assignments:\n' + response);
|
||||
assignDialog.dialog('close');
|
||||
} else {
|
||||
if (!!response) {
|
||||
assignDeviceSerialNumbers.val(response.join('\n'));
|
||||
} else {
|
||||
assignDeviceSerialNumbers.val('');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else // Assume Add
|
||||
{
|
||||
$form.attr('action', $form.attr('data-addaction'));
|
||||
}
|
||||
|
||||
assignDialog.dialog('open');
|
||||
}
|
||||
|
||||
$('#Config_DeviceFlags_BulkAssign_Button').click(function () {
|
||||
showModeDialog();
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
");
|
||||
|
||||
|
||||
#line 878 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
#line 884 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -2517,7 +2511,7 @@ WriteLiteral(@"', function (response, result) {
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 879 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
#line 885 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
if (canDelete)
|
||||
{
|
||||
|
||||
@@ -2545,13 +2539,13 @@ WriteLiteral(" title=\"Delete this Device Flag?\"");
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 883 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
#line 889 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 883 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
#line 889 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
using (Html.BeginForm(MVC.API.DeviceFlag.Delete(Model.DeviceFlag.Id, true)))
|
||||
{
|
||||
|
||||
@@ -2559,14 +2553,14 @@ WriteLiteral(">\r\n");
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 885 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
#line 891 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
Write(Html.AntiForgeryToken());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 885 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
#line 891 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
|
||||
}
|
||||
|
||||
@@ -2581,13 +2575,13 @@ WriteLiteral("></i>\r\n This item will be permanently deleted
|
||||
"covered.<br />\r\n <br />\r\n");
|
||||
|
||||
|
||||
#line 891 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
#line 897 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 891 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
#line 897 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
if (Model.CurrentAssignmentCount > 0)
|
||||
{
|
||||
|
||||
@@ -2597,7 +2591,7 @@ WriteLiteral("></i>\r\n This item will be permanently deleted
|
||||
WriteLiteral(" <strong>");
|
||||
|
||||
|
||||
#line 893 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
#line 899 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
Write(Model.CurrentAssignmentCount);
|
||||
|
||||
|
||||
@@ -2606,7 +2600,7 @@ WriteLiteral(" <strong>");
|
||||
WriteLiteral(" device");
|
||||
|
||||
|
||||
#line 893 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
#line 899 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
Write(Model.CurrentAssignmentCount != 1 ? "s are" : " is");
|
||||
|
||||
|
||||
@@ -2619,7 +2613,7 @@ WriteLiteral(" <br />\r\n");
|
||||
WriteLiteral(" <br />\r\n");
|
||||
|
||||
|
||||
#line 896 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
#line 902 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -2660,7 +2654,7 @@ WriteLiteral(@">
|
||||
");
|
||||
|
||||
|
||||
#line 926 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
#line 932 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -2669,7 +2663,7 @@ WriteLiteral(@">
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 927 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
#line 933 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
if (canShowDevices)
|
||||
{
|
||||
|
||||
@@ -2677,14 +2671,14 @@ WriteLiteral(" ");
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 929 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
#line 935 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
Write(Html.ActionLinkButton(string.Format("Show {0} device{1}", Model.CurrentAssignmentCount, (Model.CurrentAssignmentCount == 1 ? null : "s")), MVC.Search.Query(Model.DeviceFlag.Id.ToString(), "DeviceFlag"), "Config_DeviceFlags_Actions_ShowDevices_Button"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 929 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
#line 935 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
|
||||
}
|
||||
|
||||
@@ -2694,7 +2688,7 @@ WriteLiteral(" ");
|
||||
WriteLiteral(" </div>\r\n");
|
||||
|
||||
|
||||
#line 932 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
#line 938 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -561,8 +561,8 @@
|
||||
@Model.FriendlyOrganisationalUnitName
|
||||
</span>
|
||||
</div>
|
||||
<a id="changeOrganisationalUnit" href="#" class="button small">Change</a>@AjaxHelpers.AjaxLoader()
|
||||
<div id="dialogOrganisationalUnit" title="Organisational Unit" class="dialog">
|
||||
<button id="changeOrganisationalUnit" type="button" class="button small">Change</button>@AjaxHelpers.AjaxLoader()
|
||||
<div id="dialogOrganisationalUnit" title="Organisational Unit" class="dialog" data-url="@(Url.Action(MVC.API.System.DomainOrganisationalUnits()))">
|
||||
<div id="dialogOrganisationalUnit_Loading">
|
||||
@AjaxHelpers.AjaxLoader() Loading Organisational Units
|
||||
</div>
|
||||
@@ -580,9 +580,9 @@
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var ouValue = $('#DeviceProfile_OrganisationalUnit').attr('data-value');
|
||||
var $ouTree = null;
|
||||
var ouTree = null;
|
||||
var $dialog = null;
|
||||
let $ouTree = null;
|
||||
let ouTree = null;
|
||||
let $dialog = null;
|
||||
var $enforceCheckbox;
|
||||
var ouSet = function (ou) {
|
||||
const $form = $dialog.find('form');
|
||||
@@ -606,12 +606,13 @@
|
||||
|
||||
var li = ouNode.li;
|
||||
var liOffset = li.offsetParent;
|
||||
if (li.offsetTop + li.offsetHeight > liOffset.offsetHeight)
|
||||
if (liOffset && li.offsetTop + li.offsetHeight > liOffset.offsetHeight) {
|
||||
$(liOffset).animate({ 'scrollTop': li.offsetTop - liOffset.offsetHeight + li.offsetHeight + 4 }, 'fast');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var ouChange = function () {
|
||||
var ouChange = async function () {
|
||||
if (!$dialog) {
|
||||
$dialog = $('#dialogOrganisationalUnit').dialog({
|
||||
autoOpen: false,
|
||||
@@ -630,63 +631,61 @@
|
||||
|
||||
$enforceCheckbox = $('#enforceOrganisationalUnit');
|
||||
|
||||
$.getJSON('@(Url.Action(MVC.API.System.DomainOrganisationalUnits()))', null, function (data) {
|
||||
$loading.hide();
|
||||
const body = new FormData();
|
||||
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||
const response = await fetch($dialog.attr('data-url'), {
|
||||
method: 'POST',
|
||||
body: body
|
||||
});
|
||||
const data = await response.json();
|
||||
$loading.hide();
|
||||
|
||||
// Make 'Domains' unselectable
|
||||
$.each(data, function (i, node) {
|
||||
node.unselectable = true;
|
||||
});
|
||||
// Make 'Domains' unselectable
|
||||
$.each(data, function (i, node) {
|
||||
node.unselectable = true;
|
||||
});
|
||||
|
||||
ouTree = $ouTree.fancytree({
|
||||
source: data,
|
||||
checkbox: false,
|
||||
selectMode: 1,
|
||||
keyboard: false,
|
||||
fx: null
|
||||
}).fancytree('getTree');
|
||||
ouTree = $ouTree.fancytree({
|
||||
source: data,
|
||||
checkbox: false,
|
||||
selectMode: 1,
|
||||
keyboard: false,
|
||||
fx: null
|
||||
}).fancytree('getTree');
|
||||
|
||||
ouTree.$container.css('position', 'relative');
|
||||
ouTree.$container.css('position', 'relative');
|
||||
|
||||
// Set Buttons
|
||||
$dialog.dialog('option', 'buttons', {
|
||||
'Use Default Computers Container': function () {
|
||||
// Set Buttons
|
||||
$dialog.dialog('option', 'buttons', {
|
||||
'Use Default Computers Container': function () {
|
||||
var $this = $(this);
|
||||
$this.css('overflow', 'hidden');
|
||||
$this.dialog("disable");
|
||||
$this.dialog("option", "buttons", null);
|
||||
ouSet('');
|
||||
},
|
||||
'Save': function () {
|
||||
var node = ouTree.getActiveNode();
|
||||
if (node && node.key.substr(0, 3).toLowerCase() == 'ou=') {
|
||||
var $this = $(this);
|
||||
$this.css('overflow', 'hidden');
|
||||
$this.dialog("disable");
|
||||
$this.dialog("option", "buttons", null);
|
||||
ouSet('');
|
||||
},
|
||||
'Save': function () {
|
||||
var node = ouTree.getActiveNode();
|
||||
if (node && node.key.substr(0, 3).toLowerCase() == 'ou=') {
|
||||
var $this = $(this);
|
||||
$this.css('overflow', 'hidden');
|
||||
$this.dialog("disable");
|
||||
$this.dialog("option", "buttons", null);
|
||||
ouSet(node.key);
|
||||
} else {
|
||||
alert('Select an Organisational Unit to Save')
|
||||
}
|
||||
ouSet(node.key);
|
||||
} else {
|
||||
alert('Select an Organisational Unit to Save')
|
||||
}
|
||||
});
|
||||
|
||||
// Expand
|
||||
expandAndFocusNode(ouValue);
|
||||
|
||||
ouTree.options.fx = { height: "toggle", duration: 200 };
|
||||
}
|
||||
});
|
||||
|
||||
// Expand
|
||||
expandAndFocusNode(ouValue);
|
||||
|
||||
ouTree.options.fx = { height: "toggle", duration: 200 };
|
||||
}
|
||||
$dialog.dialog('open');
|
||||
|
||||
$enforceCheckbox.prop('checked', $('#DeviceProfile_EnforceOrganisationalUnit').prop('checked'));
|
||||
|
||||
if (ouTree) {
|
||||
// Expand
|
||||
expandAndFocusNode(ouValue);
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
$('#changeOrganisationalUnit').click(ouChange);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -545,9 +545,9 @@
|
||||
{
|
||||
<div>
|
||||
<hr />
|
||||
<a id="Config_System_AD_SearchScope_Update" href="#" class="button small">Update</a>
|
||||
<button id="Config_System_AD_SearchScope_Update" type="button" class="button small">Update</button>
|
||||
</div>
|
||||
<div id="Config_System_AD_SearchScope_Dialog" class="dialog" title="Search Scope">
|
||||
<div id="Config_System_AD_SearchScope_Dialog" class="dialog" title="Search Scope" data-url="@(Url.Action(MVC.API.System.DomainOrganisationalUnits()))">
|
||||
<div id="Config_System_AD_SearchScope_Dialog_Loading">
|
||||
@AjaxHelpers.AjaxLoader() Loading Organisational Units
|
||||
</div>
|
||||
@@ -589,7 +589,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
function update() {
|
||||
async function update() {
|
||||
|
||||
if (!$dialog) {
|
||||
$dialog = $('#Config_System_AD_SearchScope_Dialog').dialog({
|
||||
@@ -608,51 +608,55 @@
|
||||
$dialog.css('overflow', 'visible');
|
||||
$tree.css('height', '100%');
|
||||
|
||||
$.getJSON('@(Url.Action(MVC.API.System.DomainOrganisationalUnits()))', null, function (data) {
|
||||
$loading.hide();
|
||||
const body = new FormData();
|
||||
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||
const response = await fetch($dialog.attr('data-url'), {
|
||||
method: 'POST',
|
||||
body: body
|
||||
});
|
||||
const data = await response.json();
|
||||
$loading.hide();
|
||||
|
||||
tree = $tree.fancytree({
|
||||
source: data,
|
||||
checkbox: true,
|
||||
selectMode: 2,
|
||||
keyboard: false,
|
||||
fx: null
|
||||
}).fancytree('getTree');
|
||||
tree = $tree.fancytree({
|
||||
source: data,
|
||||
checkbox: true,
|
||||
selectMode: 2,
|
||||
keyboard: false,
|
||||
fx: null
|
||||
}).fancytree('getTree');
|
||||
|
||||
tree.$container.css('position', 'relative');
|
||||
tree.$container.css('position', 'relative');
|
||||
|
||||
// Set Buttons
|
||||
$dialog.dialog('option', 'buttons', {
|
||||
'Search Entire Directory': function () {
|
||||
var $this = $(this);
|
||||
$this.css('overflow', 'hidden');
|
||||
$this.dialog("disable");
|
||||
$this.dialog("option", "buttons", null);
|
||||
// Set Buttons
|
||||
$dialog.dialog('option', 'buttons', {
|
||||
'Search Entire Directory': function () {
|
||||
var $this = $(this);
|
||||
$this.css('overflow', 'hidden');
|
||||
$this.dialog("disable");
|
||||
$this.dialog("option", "buttons", null);
|
||||
|
||||
var $form = $dialog.find('form');
|
||||
$form.submit();
|
||||
},
|
||||
'Save': function () {
|
||||
var $this = $(this);
|
||||
$this.css('overflow', 'hidden');
|
||||
$this.dialog("disable");
|
||||
$this.dialog("option", "buttons", null);
|
||||
var $form = $dialog.find('form');
|
||||
$form.submit();
|
||||
},
|
||||
'Save': function () {
|
||||
var $this = $(this);
|
||||
$this.css('overflow', 'hidden');
|
||||
$this.dialog("disable");
|
||||
$this.dialog("option", "buttons", null);
|
||||
|
||||
var nodes = tree.getSelectedNodes();
|
||||
var $form = $dialog.find('form');
|
||||
$.each(nodes, function (i, node) {
|
||||
$('<input>').attr({ 'type': 'hidden', 'name': 'Containers', 'value': node.key }).appendTo($form);
|
||||
});
|
||||
$form.submit();
|
||||
}
|
||||
});
|
||||
|
||||
// Select & Expand
|
||||
selectDistinguishedNames();
|
||||
|
||||
tree.options.fx = { height: "toggle", duration: 200 };
|
||||
var nodes = tree.getSelectedNodes();
|
||||
var $form = $dialog.find('form');
|
||||
$.each(nodes, function (i, node) {
|
||||
$('<input>').attr({ 'type': 'hidden', 'name': 'Containers', 'value': node.key }).appendTo($form);
|
||||
});
|
||||
$form.submit();
|
||||
}
|
||||
});
|
||||
|
||||
// Select & Expand
|
||||
selectDistinguishedNames();
|
||||
|
||||
tree.options.fx = { height: "toggle", duration: 200 };
|
||||
}
|
||||
|
||||
selectDistinguishedNames();
|
||||
|
||||
@@ -1963,15 +1963,15 @@ WriteLiteral(" ");
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <div>\r\n <hr />\r\n " +
|
||||
" <a");
|
||||
" <button");
|
||||
|
||||
WriteLiteral(" id=\"Config_System_AD_SearchScope_Update\"");
|
||||
|
||||
WriteLiteral(" href=\"#\"");
|
||||
WriteLiteral(" type=\"button\"");
|
||||
|
||||
WriteLiteral(" class=\"button small\"");
|
||||
|
||||
WriteLiteral(">Update</a>\r\n </div>\r\n");
|
||||
WriteLiteral(">Update</button>\r\n </div>\r\n");
|
||||
|
||||
WriteLiteral(" <div");
|
||||
|
||||
@@ -1981,6 +1981,17 @@ WriteLiteral(" class=\"dialog\"");
|
||||
|
||||
WriteLiteral(" title=\"Search Scope\"");
|
||||
|
||||
WriteLiteral(" data-url=\"");
|
||||
|
||||
|
||||
#line 550 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Url.Action(MVC.API.System.DomainOrganisationalUnits()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" id=\"Config_System_AD_SearchScope_Dialog_Loading\"");
|
||||
@@ -2057,69 +2068,64 @@ WriteLiteral(" <script>\r\n $(function
|
||||
"lse if (node.isSelected()) {\r\n node.s" +
|
||||
"etSelected(false);\r\n }\r\n " +
|
||||
" });\r\n }\r\n " +
|
||||
" }\r\n\r\n function update() {\r\n\r\n " +
|
||||
" if (!$dialog) {\r\n $dialog = $(" +
|
||||
"\'#Config_System_AD_SearchScope_Dialog\').dialog({\r\n " +
|
||||
" autoOpen: false,\r\n buttons: nul" +
|
||||
"l,\r\n draggable: false,\r\n " +
|
||||
" modal: true,\r\n res" +
|
||||
"izable: false,\r\n width: 500,\r\n " +
|
||||
" height: 500\r\n })" +
|
||||
";\r\n $loading = $(\'#Config_System_AD_SearchSco" +
|
||||
"pe_Dialog_Loading\');\r\n $loading.find(\'i.ajaxL" +
|
||||
"oading\').show();\r\n\r\n $tree = $(\'#Config_Syste" +
|
||||
"m_AD_SearchScope_Tree\');\r\n $dialog.css(\'overf" +
|
||||
"low\', \'visible\');\r\n $tree.css(\'height\', \'100%" +
|
||||
"\');\r\n\r\n $.getJSON(\'");
|
||||
|
||||
|
||||
#line 611 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Url.Action(MVC.API.System.DomainOrganisationalUnits()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\', null, function (data) {\r\n $loading.hide" +
|
||||
"();\r\n\r\n tree = $tree.fancytree({\r\n " +
|
||||
" source: data,\r\n " +
|
||||
" checkbox: true,\r\n sel" +
|
||||
"ectMode: 2,\r\n keyboard: false,\r\n " +
|
||||
" fx: null\r\n " +
|
||||
" }).fancytree(\'getTree\');\r\n\r\n tre" +
|
||||
"e.$container.css(\'position\', \'relative\');\r\n\r\n " +
|
||||
" // Set Buttons\r\n $dialog.dialog(\'opt" +
|
||||
"ion\', \'buttons\', {\r\n \'Search Entire D" +
|
||||
"irectory\': function () {\r\n var $t" +
|
||||
"his = $(this);\r\n $this.css(\'overf" +
|
||||
"low\', \'hidden\');\r\n $this.dialog(\"" +
|
||||
"disable\");\r\n $this.dialog(\"option" +
|
||||
"\", \"buttons\", null);\r\n\r\n var $for" +
|
||||
"m = $dialog.find(\'form\');\r\n $form" +
|
||||
".submit();\r\n },\r\n " +
|
||||
" \'Save\': function () {\r\n " +
|
||||
" }\r\n\r\n async function update() {\r\n\r\n " +
|
||||
" if (!$dialog) {\r\n $dialo" +
|
||||
"g = $(\'#Config_System_AD_SearchScope_Dialog\').dialog({\r\n " +
|
||||
" autoOpen: false,\r\n button" +
|
||||
"s: null,\r\n draggable: false,\r\n " +
|
||||
" modal: true,\r\n " +
|
||||
" resizable: false,\r\n width: 500,\r\n " +
|
||||
" height: 500\r\n " +
|
||||
" });\r\n $loading = $(\'#Config_System_AD_Sea" +
|
||||
"rchScope_Dialog_Loading\');\r\n $loading.find(\'i" +
|
||||
".ajaxLoading\').show();\r\n\r\n $tree = $(\'#Config" +
|
||||
"_System_AD_SearchScope_Tree\');\r\n $dialog.css(" +
|
||||
"\'overflow\', \'visible\');\r\n $tree.css(\'height\'," +
|
||||
" \'100%\');\r\n\r\n const body = new FormData();\r\n " +
|
||||
" body.append(\'__RequestVerificationToken\', doc" +
|
||||
"ument.body.dataset.antiforgery);\r\n const resp" +
|
||||
"onse = await fetch($dialog.attr(\'data-url\'), {\r\n " +
|
||||
" method: \'POST\',\r\n body: body\r\n " +
|
||||
" });\r\n const " +
|
||||
"data = await response.json();\r\n $loading.hide" +
|
||||
"();\r\n\r\n tree = $tree.fancytree({\r\n " +
|
||||
" source: data,\r\n " +
|
||||
" checkbox: true,\r\n selectMode: 2,\r\n " +
|
||||
" keyboard: false,\r\n " +
|
||||
" fx: null\r\n }).fancytree(\'getTr" +
|
||||
"ee\');\r\n\r\n tree.$container.css(\'position\', \'re" +
|
||||
"lative\');\r\n\r\n // Set Buttons\r\n " +
|
||||
" $dialog.dialog(\'option\', \'buttons\', {\r\n " +
|
||||
" \'Search Entire Directory\': function () {\r\n " +
|
||||
" var $this = $(this);\r\n " +
|
||||
" $this.css(\'overflow\', \'hidden\');\r\n " +
|
||||
" $this.dialog(\"disable\");\r\n " +
|
||||
"$this.dialog(\"option\", \"buttons\", null);\r\n\r\n " +
|
||||
" var $form = $dialog.find(\'form\');\r\n " +
|
||||
" $form.submit();\r\n },\r\n " +
|
||||
" \'Save\': function () {\r\n " +
|
||||
" var $this = $(this);\r\n " +
|
||||
" $this.css(\'overflow\', \'hidden\');\r\n " +
|
||||
" $this.dialog(\"disable\");\r\n " +
|
||||
" $this.dialog(\"option\", \"buttons\", null);\r\n\r\n " +
|
||||
" var nodes = tree.getSelectedNodes();\r\n " +
|
||||
" var $form = $dialog.find(\'form\');\r\n " +
|
||||
" $.each(nodes, function (i, node) {\r\n " +
|
||||
" $(\'<input>\').attr({ \'type\': \'hidden\', \'name\': \'Con" +
|
||||
"tainers\', \'value\': node.key }).appendTo($form);\r\n " +
|
||||
" });\r\n $form.subm" +
|
||||
"it();\r\n }\r\n " +
|
||||
" });\r\n\r\n // Select & Expand\r" +
|
||||
"\n selectDistinguishedNames();\r\n\r\n " +
|
||||
" tree.options.fx = { height: \"toggle\", duration: " +
|
||||
"200 };\r\n });\r\n\r\n " +
|
||||
" }\r\n\r\n selectDistinguishedNames();\r\n\r\n " +
|
||||
" $dialog.dialog(\'open\');\r\n\r\n " +
|
||||
" return false;\r\n }\r\n\r\n $(" +
|
||||
"\'#Config_System_AD_SearchScope_Update\').click(update);\r\n " +
|
||||
"});\r\n </script>\r\n");
|
||||
" $this.css(\'overflow\', \'hidden\');\r\n $" +
|
||||
"this.dialog(\"disable\");\r\n $this.dialo" +
|
||||
"g(\"option\", \"buttons\", null);\r\n\r\n var" +
|
||||
" nodes = tree.getSelectedNodes();\r\n v" +
|
||||
"ar $form = $dialog.find(\'form\');\r\n $." +
|
||||
"each(nodes, function (i, node) {\r\n " +
|
||||
" $(\'<input>\').attr({ \'type\': \'hidden\', \'name\': \'Containers\', \'value\': node.key " +
|
||||
"}).appendTo($form);\r\n });\r\n " +
|
||||
" $form.submit();\r\n " +
|
||||
" }\r\n });\r\n\r\n " +
|
||||
" // Select & Expand\r\n selectDisti" +
|
||||
"nguishedNames();\r\n\r\n tree.options.fx = { heig" +
|
||||
"ht: \"toggle\", duration: 200 };\r\n }\r\n\r\n " +
|
||||
" selectDistinguishedNames();\r\n\r\n " +
|
||||
" $dialog.dialog(\'open\');\r\n\r\n return false;\r\n " +
|
||||
" }\r\n\r\n $(\'#Config_System_AD_" +
|
||||
"SearchScope_Update\').click(update);\r\n });\r\n " +
|
||||
" </script>\r\n");
|
||||
|
||||
|
||||
#line 668 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 672 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -2128,7 +2134,7 @@ WriteLiteral("\', null, function (data) {\r\n
|
||||
WriteLiteral(" </td>\r\n\r\n\r\n\r\n </tr>\r\n </table>\r\n</div>\r\n");
|
||||
|
||||
|
||||
#line 676 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 680 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
if (canConfigProxy)
|
||||
{
|
||||
using (Html.BeginForm(MVC.API.System.UpdateProxySettings()))
|
||||
@@ -2138,14 +2144,14 @@ WriteLiteral(" </td>\r\n\r\n\r\n\r\n </tr>\r\n </table>\r\n
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 680 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 684 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.AntiForgeryToken());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 680 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 684 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
|
||||
|
||||
|
||||
@@ -2168,7 +2174,7 @@ WriteLiteral(">\r\n Address:\r\n </th>
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 689 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 693 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.EditorFor(m => m.ProxyAddress));
|
||||
|
||||
|
||||
@@ -2179,7 +2185,7 @@ WriteLiteral("<br />\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 690 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 694 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.ValidationMessageFor(m => m.ProxyAddress));
|
||||
|
||||
|
||||
@@ -2196,7 +2202,7 @@ WriteLiteral(">\r\n Port:\r\n </th>\r\
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 698 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 702 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.EditorFor(m => m.ProxyPort));
|
||||
|
||||
|
||||
@@ -2207,7 +2213,7 @@ WriteLiteral("<br />\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 699 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 703 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.ValidationMessageFor(m => m.ProxyPort));
|
||||
|
||||
|
||||
@@ -2224,7 +2230,7 @@ WriteLiteral(">\r\n Username:\r\n </th
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 707 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 711 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.EditorFor(m => m.ProxyUsername));
|
||||
|
||||
|
||||
@@ -2235,7 +2241,7 @@ WriteLiteral("<br />\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 708 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 712 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.ValidationMessageFor(m => m.ProxyUsername));
|
||||
|
||||
|
||||
@@ -2252,7 +2258,7 @@ WriteLiteral(">\r\n Password:\r\n </th
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 716 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 720 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.EditorFor(m => m.ProxyPassword));
|
||||
|
||||
|
||||
@@ -2263,7 +2269,7 @@ WriteLiteral("<br />\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 717 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 721 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.ValidationMessageFor(m => m.ProxyPassword));
|
||||
|
||||
|
||||
@@ -2286,7 +2292,7 @@ WriteLiteral(" class=\"button small\"");
|
||||
WriteLiteral(">Save Proxy Settings</button>");
|
||||
|
||||
|
||||
#line 725 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 729 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(AjaxHelpers.AjaxLoader());
|
||||
|
||||
|
||||
@@ -2314,7 +2320,7 @@ WriteLiteral("\r\n <script>\r\n
|
||||
"/table>\r\n </div>\r\n");
|
||||
|
||||
|
||||
#line 755 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 759 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2339,7 +2345,7 @@ WriteLiteral(">\r\n Address:\r\n </th>\r\n
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 767 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 771 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.DisplayFor(m => m.ProxyAddress));
|
||||
|
||||
|
||||
@@ -2355,7 +2361,7 @@ WriteLiteral(">\r\n Port:\r\n </th>\r\n
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 775 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 779 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.DisplayFor(m => m.ProxyPort));
|
||||
|
||||
|
||||
@@ -2371,7 +2377,7 @@ WriteLiteral(">\r\n Username:\r\n </th>\r\n
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 783 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 787 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.DisplayFor(m => m.ProxyUsername));
|
||||
|
||||
|
||||
@@ -2387,14 +2393,14 @@ WriteLiteral(">\r\n Password:\r\n </th>\r\n
|
||||
"table>\r\n </div>\r\n");
|
||||
|
||||
|
||||
#line 796 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 800 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 797 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 801 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
if (canConfigEmail)
|
||||
{
|
||||
|
||||
@@ -2418,7 +2424,7 @@ WriteLiteral(">\r\n SMTP Server:\r\n </th>\r\n
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 807 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 811 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.EditorFor(m => m.EmailSmtpServer));
|
||||
|
||||
|
||||
@@ -2429,7 +2435,7 @@ WriteLiteral("<br />\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 808 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 812 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.ValidationMessageFor(m => m.EmailSmtpServer));
|
||||
|
||||
|
||||
@@ -2445,7 +2451,7 @@ WriteLiteral(">\r\n Port:\r\n </th>\r\n
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 816 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 820 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.EditorFor(m => m.EmailSmtpPort));
|
||||
|
||||
|
||||
@@ -2456,7 +2462,7 @@ WriteLiteral("<br />\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 817 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 821 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.ValidationMessageFor(m => m.EmailSmtpPort));
|
||||
|
||||
|
||||
@@ -2473,7 +2479,7 @@ WriteLiteral(">\r\n Default From Address:\r\n
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 825 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 829 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.EditorFor(m => m.EmailFromAddress));
|
||||
|
||||
|
||||
@@ -2484,7 +2490,7 @@ WriteLiteral("<br />\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 826 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 830 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.ValidationMessageFor(m => m.EmailFromAddress));
|
||||
|
||||
|
||||
@@ -2501,7 +2507,7 @@ WriteLiteral(">\r\n Reply To Address:\r\n </th
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 834 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 838 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.EditorFor(m => m.EmailReplyToAddress));
|
||||
|
||||
|
||||
@@ -2512,7 +2518,7 @@ WriteLiteral("<br />\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 835 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 839 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.ValidationMessageFor(m => m.EmailReplyToAddress));
|
||||
|
||||
|
||||
@@ -2528,7 +2534,7 @@ WriteLiteral(">\r\n \r\n </th>\r\n
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 843 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 847 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.CheckBoxFor(m => m.EmailEnableSsl));
|
||||
|
||||
|
||||
@@ -2537,7 +2543,7 @@ WriteLiteral(" ");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 843 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 847 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.LabelFor(m => m.EmailEnableSsl));
|
||||
|
||||
|
||||
@@ -2553,7 +2559,7 @@ WriteLiteral(">\r\n Username:\r\n </th>\r\n
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 851 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 855 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.EditorFor(m => m.EmailUsername));
|
||||
|
||||
|
||||
@@ -2564,7 +2570,7 @@ WriteLiteral("<br />\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 852 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 856 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.ValidationMessageFor(m => m.EmailUsername));
|
||||
|
||||
|
||||
@@ -2580,7 +2586,7 @@ WriteLiteral(">\r\n Password:\r\n </th>\r\n
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 860 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 864 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.EditorFor(m => m.EmailPassword));
|
||||
|
||||
|
||||
@@ -2591,7 +2597,7 @@ WriteLiteral("<br />\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 861 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 865 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.ValidationMessageFor(m => m.EmailPassword));
|
||||
|
||||
|
||||
@@ -2614,7 +2620,7 @@ WriteLiteral(" class=\"button small\"");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 869 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 873 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Model.EmailIsConfigured ? null : "disabled");
|
||||
|
||||
|
||||
@@ -2631,7 +2637,7 @@ WriteLiteral(" class=\"button small\"");
|
||||
WriteLiteral(">Save Email Settings</button>");
|
||||
|
||||
|
||||
#line 870 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 874 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(AjaxHelpers.AjaxLoader());
|
||||
|
||||
|
||||
@@ -2652,13 +2658,13 @@ WriteLiteral(" class=\"fa fa-envelope information\"");
|
||||
WriteLiteral("></i> Recipient Email Address:</h4>\r\n <br />\r\n");
|
||||
|
||||
|
||||
#line 874 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 878 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 874 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 878 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
using (Html.BeginForm(MVC.API.System.SendTestEmail()))
|
||||
{
|
||||
|
||||
@@ -2666,14 +2672,14 @@ WriteLiteral("></i> Recipient Email Address:</h4>\r\n
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 876 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 880 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.AntiForgeryToken());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 876 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 880 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
|
||||
|
||||
|
||||
@@ -2697,20 +2703,20 @@ WriteLiteral(" name=\"Recipient\"");
|
||||
|
||||
WriteLiteral(" type=\"text\"");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 40398), Tuple.Create("\"", 40431)
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 40671), Tuple.Create("\"", 40704)
|
||||
|
||||
#line 878 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 40406), Tuple.Create<System.Object, System.Int32>(CurrentUser.EmailAddress
|
||||
#line 882 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 40679), Tuple.Create<System.Object, System.Int32>(CurrentUser.EmailAddress
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 40406), false)
|
||||
, 40679), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" />\r\n");
|
||||
|
||||
|
||||
#line 879 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 883 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -2727,7 +2733,7 @@ WriteLiteral(@" </div>
|
||||
var url = '");
|
||||
|
||||
|
||||
#line 888 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 892 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Url.Action(MVC.API.System.UpdateEmailSettings()));
|
||||
|
||||
|
||||
@@ -2789,7 +2795,7 @@ WriteLiteral("\';\r\n var data = {\r\n
|
||||
"d>\r\n </tr>\r\n </table>\r\n </div>\r\n");
|
||||
|
||||
|
||||
#line 960 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 964 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2814,7 +2820,7 @@ WriteLiteral(">\r\n SMTP Server:\r\n </th>\r\n
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 971 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 975 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.DisplayFor(m => m.EmailSmtpServer));
|
||||
|
||||
|
||||
@@ -2830,7 +2836,7 @@ WriteLiteral(">\r\n Port:\r\n </th>\r\n
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 979 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 983 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.DisplayFor(m => m.EmailSmtpPort));
|
||||
|
||||
|
||||
@@ -2847,7 +2853,7 @@ WriteLiteral(">\r\n Default From Address:\r\n
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 987 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 991 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.DisplayFor(m => m.EmailFromAddress));
|
||||
|
||||
|
||||
@@ -2864,7 +2870,7 @@ WriteLiteral(">\r\n Reply To Address:\r\n </th
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 995 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 999 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.DisplayFor(m => m.EmailReplyToAddress));
|
||||
|
||||
|
||||
@@ -2881,7 +2887,7 @@ WriteLiteral(">\r\n Enable SSL:\r\n </th>\r\n
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 1003 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 1007 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.CheckBoxFor(m => m.EmailEnableSsl, new { disabled = "disabled" }));
|
||||
|
||||
|
||||
@@ -2890,7 +2896,7 @@ WriteLiteral(" ");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 1003 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 1007 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.LabelFor(m => m.EmailEnableSsl));
|
||||
|
||||
|
||||
@@ -2906,7 +2912,7 @@ WriteLiteral(">\r\n Username:\r\n </th>\r\n
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 1011 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 1015 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.DisplayFor(m => m.EmailUsername));
|
||||
|
||||
|
||||
@@ -2922,7 +2928,7 @@ WriteLiteral(">\r\n Password:\r\n </th>\r\n
|
||||
"table>\r\n </div>\r\n");
|
||||
|
||||
|
||||
#line 1024 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 1028 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -2935,13 +2941,13 @@ WriteLiteral(" class=\"actionBar\"");
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 1026 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 1030 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 1026 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 1030 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
using (Html.BeginForm(MVC.API.System.UpdateLastNetworkLogonDates()))
|
||||
{
|
||||
|
||||
@@ -2949,14 +2955,14 @@ WriteLiteral(">\r\n");
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 1028 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 1032 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.AntiForgeryToken());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 1028 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 1032 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
;
|
||||
|
||||
|
||||
@@ -2971,7 +2977,7 @@ WriteLiteral(" class=\"button\"");
|
||||
WriteLiteral(">Update Device Last Network Logons</button>\r\n");
|
||||
|
||||
|
||||
#line 1030 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 1034 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -771,7 +771,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="Config_UserFlags_BulkAssign_AssignDialog" class="dialog" title="Bulk Assign Users">
|
||||
<div id="Config_UserFlags_BulkAssign_AssignDialog" class="dialog" title="Bulk Assign Users" data-assignedurl="@Url.Action(MVC.API.UserFlag.AssignedUsers(Model.UserFlag.Id))">
|
||||
<div class="brief">
|
||||
<div>
|
||||
Enter multiple <strong>User Ids</strong> separated by <code><new line></code>, commas (<code>,</code>) or semicolons (<code>;</code>).
|
||||
@@ -856,18 +856,24 @@
|
||||
$form.attr('action', $form.attr('data-overrideaction'));
|
||||
|
||||
assignDialog.addClass('loading');
|
||||
$.getJSON('@Url.Action(MVC.API.UserFlag.AssignedUsers(Model.UserFlag.Id))', function (response, result) {
|
||||
const body = new FormData();
|
||||
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||
fetch(assignDialog.attr('data-assignedurl'), {
|
||||
method: 'POST',
|
||||
body: body
|
||||
}).then(r => {
|
||||
assignDialog.removeClass('loading');
|
||||
|
||||
if (result != 'success') {
|
||||
alert('Unable to load current assignments:\n' + response);
|
||||
if (!r.ok) {
|
||||
alert('Unable to load current assignments:\n' + r.statusText);
|
||||
assignDialog.dialog('close');
|
||||
} else {
|
||||
if (!!response) {
|
||||
assignUserIds.val(response.join('\n'));
|
||||
} else {
|
||||
assignUserIds.val('');
|
||||
}
|
||||
r.json().then(j => {
|
||||
if (!j) {
|
||||
assignUserIds.val('');
|
||||
} else {
|
||||
assignUserIds.val(j.join('\n'));
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2356,6 +2356,17 @@ WriteLiteral(" class=\"dialog\"");
|
||||
|
||||
WriteLiteral(" title=\"Bulk Assign Users\"");
|
||||
|
||||
WriteLiteral(" data-assignedurl=\"");
|
||||
|
||||
|
||||
#line 774 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
Write(Url.Action(MVC.API.UserFlag.AssignedUsers(Model.UserFlag.Id)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"brief\"");
|
||||
@@ -2510,48 +2521,31 @@ WriteLiteral(" <script>\r\n $(function () {\r\n
|
||||
"nst $form = assignUserIds.closest(\'form\');\r\n if (mode == " +
|
||||
"\"Override\") {\r\n $form.attr(\'action\', $form.attr(\'data" +
|
||||
"-overrideaction\'));\r\n\r\n assignDialog.addClass(\'loadin" +
|
||||
"g\');\r\n $.getJSON(\'");
|
||||
"g\');\r\n const body = new FormData();\r\n " +
|
||||
" body.append(\'__RequestVerificationToken\', document.body.dataset.anti" +
|
||||
"forgery);\r\n fetch(assignDialog.attr(\'data-assignedurl" +
|
||||
"\'), {\r\n method: \'POST\',\r\n " +
|
||||
" body: body\r\n }).then(r => {\r\n " +
|
||||
" assignDialog.removeClass(\'loading\');\r\n " +
|
||||
" if (!r.ok) {\r\n alert(\'Unable to load cu" +
|
||||
"rrent assignments:\\n\' + r.statusText);\r\n assi" +
|
||||
"gnDialog.dialog(\'close\');\r\n } else {\r\n " +
|
||||
" r.json().then(j => {\r\n " +
|
||||
" if (!j) {\r\n assignUserIds.val(" +
|
||||
"\'\');\r\n } else {\r\n " +
|
||||
" assignUserIds.val(j.join(\'\\n\'));\r\n " +
|
||||
" }\r\n })\r\n " +
|
||||
" }\r\n });\r\n }\r\n " +
|
||||
" else // Assume Add\r\n {\r\n " +
|
||||
" $form.attr(\'action\', $form.attr(\'data-addaction\'));\r\n " +
|
||||
" }\r\n\r\n assignDialog.dialog(\'open\');\r\n " +
|
||||
" }\r\n\r\n $(\'#Config_UserFlags_BulkAssign_Button\').click(f" +
|
||||
"unction () {\r\n showModeDialog();\r\n " +
|
||||
" return false;\r\n });\r\n });\r\n </scri" +
|
||||
"pt>\r\n");
|
||||
|
||||
|
||||
#line 859 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
Write(Url.Action(MVC.API.UserFlag.AssignedUsers(Model.UserFlag.Id)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"', function (response, result) {
|
||||
assignDialog.removeClass('loading');
|
||||
|
||||
if (result != 'success') {
|
||||
alert('Unable to load current assignments:\n' + response);
|
||||
assignDialog.dialog('close');
|
||||
} else {
|
||||
if (!!response) {
|
||||
assignUserIds.val(response.join('\n'));
|
||||
} else {
|
||||
assignUserIds.val('');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else // Assume Add
|
||||
{
|
||||
$form.attr('action', $form.attr('data-addaction'));
|
||||
}
|
||||
|
||||
assignDialog.dialog('open');
|
||||
}
|
||||
|
||||
$('#Config_UserFlags_BulkAssign_Button').click(function () {
|
||||
showModeDialog();
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
");
|
||||
|
||||
|
||||
#line 888 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
#line 894 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -2560,7 +2554,7 @@ WriteLiteral(@"', function (response, result) {
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 889 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
#line 895 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
if (canDelete)
|
||||
{
|
||||
|
||||
@@ -2588,13 +2582,13 @@ WriteLiteral(" class=\"dialog\"");
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 893 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
#line 899 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 893 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
#line 899 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
using (Html.BeginForm(MVC.API.UserFlag.Delete(Model.UserFlag.Id, true)))
|
||||
{
|
||||
|
||||
@@ -2602,14 +2596,14 @@ WriteLiteral(">\r\n");
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 895 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
#line 901 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
Write(Html.AntiForgeryToken());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 895 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
#line 901 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
|
||||
}
|
||||
|
||||
@@ -2624,13 +2618,13 @@ WriteLiteral("></i>\r\n This item will be permanently deleted
|
||||
"covered.<br />\r\n <br />\r\n");
|
||||
|
||||
|
||||
#line 901 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
#line 907 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 901 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
#line 907 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
if (Model.CurrentAssignmentCount > 0)
|
||||
{
|
||||
|
||||
@@ -2640,7 +2634,7 @@ WriteLiteral("></i>\r\n This item will be permanently deleted
|
||||
WriteLiteral(" <strong>");
|
||||
|
||||
|
||||
#line 903 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
#line 909 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
Write(Model.CurrentAssignmentCount);
|
||||
|
||||
|
||||
@@ -2649,7 +2643,7 @@ WriteLiteral(" <strong>");
|
||||
WriteLiteral(" user");
|
||||
|
||||
|
||||
#line 903 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
#line 909 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
Write(Model.CurrentAssignmentCount != 1 ? "s are" : " is");
|
||||
|
||||
|
||||
@@ -2662,7 +2656,7 @@ WriteLiteral(" <br />\r\n");
|
||||
WriteLiteral(" <br />\r\n");
|
||||
|
||||
|
||||
#line 906 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
#line 912 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -2703,7 +2697,7 @@ WriteLiteral(@">
|
||||
");
|
||||
|
||||
|
||||
#line 936 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
#line 942 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -2712,7 +2706,7 @@ WriteLiteral(@">
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 937 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
#line 943 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
if (canShowUsers)
|
||||
{
|
||||
|
||||
@@ -2720,14 +2714,14 @@ WriteLiteral(" ");
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 939 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
#line 945 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
Write(Html.ActionLinkButton(string.Format("Show {0} user{1}", Model.CurrentAssignmentCount, (Model.CurrentAssignmentCount == 1 ? null : "s")), MVC.Search.Query(Model.UserFlag.Id.ToString(), "UserFlag"), "Config_UserFlags_Actions_ShowUsers_Button"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 939 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
#line 945 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
|
||||
}
|
||||
|
||||
@@ -2737,7 +2731,7 @@ WriteLiteral(" ");
|
||||
WriteLiteral(" </div>\r\n");
|
||||
|
||||
|
||||
#line 942 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
#line 948 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<title>Disco ICT - Held Devices</title>
|
||||
@Html.BundleRenderDeferred()
|
||||
</head>
|
||||
<body class="theme-@(Model.DefaultTheme) status-connecting">
|
||||
<body class="theme-@(Model.DefaultTheme) status-connecting" data-antiforgery="@AntiForgeryExtensions.GetToken(Context)" data-hubname="@(Disco.Services.Jobs.Noticeboards.HeldDevices.Name)" data-dataurl="@(Url.Action(MVC.Public.HeldDevices.HeldDevices()))">
|
||||
<div id="page">
|
||||
<header id="header">
|
||||
<div id="heading">Held Devices</div>
|
||||
@@ -26,7 +26,8 @@
|
||||
</header>
|
||||
<section id="mainSection">
|
||||
<div id="inProcess" class="list">
|
||||
<h3>In Process (<span data-bind="text: inProcess().length"></span>)
|
||||
<h3>
|
||||
In Process (<span data-bind="text: inProcess().length"></span>)
|
||||
</h3>
|
||||
<div class="content">
|
||||
<!-- ko if: inProcess().length == 0 -->
|
||||
@@ -36,7 +37,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="readyForReturn" class="list">
|
||||
<h3>Ready for Return (<span data-bind="text: readyForReturn().length"></span>)
|
||||
<h3>
|
||||
Ready for Return (<span data-bind="text: readyForReturn().length"></span>)
|
||||
</h3>
|
||||
<div class="content">
|
||||
<!-- ko if: readyForReturn().length == 0 -->
|
||||
@@ -46,7 +48,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="waitingForUserAction" class="list">
|
||||
<h3>Waiting for User Action (<span data-bind="text: waitingForUserAction().length"></span>)
|
||||
<h3>
|
||||
Waiting for User Action (<span data-bind="text: waitingForUserAction().length"></span>)
|
||||
</h3>
|
||||
<div class="content">
|
||||
<!-- ko if: waitingForUserAction().length == 0 -->
|
||||
@@ -130,48 +133,54 @@
|
||||
hub.client.updateHeldDevice = updateHeldDevice;
|
||||
hub.client.setTheme = setTheme;
|
||||
|
||||
$.connection.hub.qs = { Noticeboard: '@(Disco.Services.Jobs.Noticeboards.HeldDevices.Name)' };
|
||||
$.connection.hub.qs = { Noticeboard: document.body.dataset.hubname };
|
||||
$.connection.hub.error(function (error) {
|
||||
console.log('Server connection error: ' + error);
|
||||
});
|
||||
$.connection.hub.disconnected(connectionError);
|
||||
|
||||
// Start Connection
|
||||
$.connection.hub.start().fail(connectionError).done(loadData);
|
||||
$.connection.hub.start().fail(connectionError).done(function () { loadData(); });
|
||||
}
|
||||
|
||||
// Called after SignalR is connected
|
||||
function loadData() {
|
||||
$.getJSON('@(Url.Action(MVC.Public.HeldDevices.HeldDevices()))', null, function (data) {
|
||||
async function loadData() {
|
||||
|
||||
var inProcess = [];
|
||||
var readyForReturn = [];
|
||||
var waitingForUserAction = [];
|
||||
|
||||
data.filter(function (heldDeviceItem) {
|
||||
return includeItem(heldDeviceItem)
|
||||
}).forEach(function (heldDeviceItem) {
|
||||
if (isWaitingForUserAction(heldDeviceItem))
|
||||
waitingForUserAction.push(heldDeviceItem);
|
||||
else if (isReadyForReturn(heldDeviceItem))
|
||||
readyForReturn.push(heldDeviceItem);
|
||||
else if (isInProcess(heldDeviceItem))
|
||||
inProcess.push(heldDeviceItem);
|
||||
});
|
||||
|
||||
inProcess.sort(sortFunction);
|
||||
readyForReturn.sort(sortFunction);
|
||||
waitingForUserAction.sort(sortFunction);
|
||||
|
||||
viewModel = new noticeboardViewModel(inProcess, readyForReturn, waitingForUserAction);
|
||||
|
||||
ko.applyBindings(viewModel);
|
||||
viewModel.initialized = true;
|
||||
|
||||
$('body').removeClass('status-connecting');
|
||||
|
||||
window.setTimeout(scheduleRotation, rotateSpeed);
|
||||
const body = new FormData();
|
||||
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||
const response = await fetch(document.body.dataset.dataurl, {
|
||||
method: 'POST',
|
||||
body: body
|
||||
});
|
||||
const data = await response.json();
|
||||
|
||||
var inProcess = [];
|
||||
var readyForReturn = [];
|
||||
var waitingForUserAction = [];
|
||||
|
||||
data.filter(function (heldDeviceItem) {
|
||||
return includeItem(heldDeviceItem)
|
||||
}).forEach(function (heldDeviceItem) {
|
||||
if (isWaitingForUserAction(heldDeviceItem))
|
||||
waitingForUserAction.push(heldDeviceItem);
|
||||
else if (isReadyForReturn(heldDeviceItem))
|
||||
readyForReturn.push(heldDeviceItem);
|
||||
else if (isInProcess(heldDeviceItem))
|
||||
inProcess.push(heldDeviceItem);
|
||||
});
|
||||
|
||||
inProcess.sort(sortFunction);
|
||||
readyForReturn.sort(sortFunction);
|
||||
waitingForUserAction.sort(sortFunction);
|
||||
|
||||
viewModel = new noticeboardViewModel(inProcess, readyForReturn, waitingForUserAction);
|
||||
|
||||
ko.applyBindings(viewModel);
|
||||
viewModel.initialized = true;
|
||||
|
||||
$('body').removeClass('status-connecting');
|
||||
|
||||
window.setTimeout(scheduleRotation, rotateSpeed);
|
||||
}
|
||||
|
||||
// Called by SignalR
|
||||
@@ -458,4 +467,4 @@
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -89,6 +89,39 @@ WriteAttribute("class", Tuple.Create(" class=\"", 562), Tuple.Create("\"", 615)
|
||||
, Tuple.Create(Tuple.Create(" ", 597), Tuple.Create("status-connecting", 598), true)
|
||||
);
|
||||
|
||||
WriteLiteral(" data-antiforgery=\"");
|
||||
|
||||
|
||||
#line 17 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml"
|
||||
Write(AntiForgeryExtensions.GetToken(Context));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(" data-hubname=\"");
|
||||
|
||||
|
||||
#line 17 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml"
|
||||
Write(Disco.Services.Jobs.Noticeboards.HeldDevices.Name);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(" data-dataurl=\"");
|
||||
|
||||
|
||||
#line 17 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml"
|
||||
Write(Url.Action(MVC.Public.HeldDevices.HeldDevices()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" id=\"page\"");
|
||||
@@ -135,7 +168,7 @@ WriteLiteral(" id=\"inProcess\"");
|
||||
|
||||
WriteLiteral(" class=\"list\"");
|
||||
|
||||
WriteLiteral(">\r\n <h3>In Process (<span");
|
||||
WriteLiteral(">\r\n <h3>\r\n In Process (<span");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: inProcess().length\"");
|
||||
|
||||
@@ -159,7 +192,7 @@ WriteLiteral(" id=\"readyForReturn\"");
|
||||
|
||||
WriteLiteral(" class=\"list\"");
|
||||
|
||||
WriteLiteral(">\r\n <h3>Ready for Return (<span");
|
||||
WriteLiteral(">\r\n <h3>\r\n Ready for Return (<span");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: readyForReturn().length\"");
|
||||
|
||||
@@ -183,7 +216,7 @@ WriteLiteral(" id=\"waitingForUserAction\"");
|
||||
|
||||
WriteLiteral(" class=\"list\"");
|
||||
|
||||
WriteLiteral(">\r\n <h3>Waiting for User Action (<span");
|
||||
WriteLiteral(">\r\n <h3>\r\n Waiting for User Action (<span");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: waitingForUserAction().length\"");
|
||||
|
||||
@@ -246,208 +279,188 @@ WriteLiteral(">\r\n <li data-bind=\"css: { alert: IsAlert }\">\r\n
|
||||
"ueryString();\r\n\r\n // Connect to Hub\r\n hub = $.conn" +
|
||||
"ection.noticeboardUpdates;\r\n\r\n // Map Functions\r\n " +
|
||||
"hub.client.updateHeldDevice = updateHeldDevice;\r\n hub.client.setT" +
|
||||
"heme = setTheme;\r\n\r\n $.connection.hub.qs = { Noticeboard: \'");
|
||||
|
||||
|
||||
#line 133 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml"
|
||||
Write(Disco.Services.Jobs.Noticeboards.HeldDevices.Name);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"' };
|
||||
$.connection.hub.error(function (error) {
|
||||
console.log('Server connection error: ' + error);
|
||||
});
|
||||
$.connection.hub.disconnected(connectionError);
|
||||
|
||||
// Start Connection
|
||||
$.connection.hub.start().fail(connectionError).done(loadData);
|
||||
}
|
||||
|
||||
// Called after SignalR is connected
|
||||
function loadData() {
|
||||
$.getJSON('");
|
||||
|
||||
|
||||
#line 145 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml"
|
||||
Write(Url.Action(MVC.Public.HeldDevices.HeldDevices()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\', null, function (data) {\r\n\r\n var inProcess = [];\r\n " +
|
||||
" var readyForReturn = [];\r\n var waitingForUserAction" +
|
||||
" = [];\r\n\r\n data.filter(function (heldDeviceItem) {\r\n " +
|
||||
" return includeItem(heldDeviceItem)\r\n }).forEac" +
|
||||
"h(function (heldDeviceItem) {\r\n if (isWaitingForUserActio" +
|
||||
"n(heldDeviceItem))\r\n waitingForUserAction.push(heldDe" +
|
||||
"viceItem);\r\n else if (isReadyForReturn(heldDeviceItem))\r\n" +
|
||||
" readyForReturn.push(heldDeviceItem);\r\n " +
|
||||
" else if (isInProcess(heldDeviceItem))\r\n inP" +
|
||||
"rocess.push(heldDeviceItem);\r\n });\r\n\r\n inP" +
|
||||
"rocess.sort(sortFunction);\r\n readyForReturn.sort(sortFunction" +
|
||||
");\r\n waitingForUserAction.sort(sortFunction);\r\n\r\n " +
|
||||
" viewModel = new noticeboardViewModel(inProcess, readyForReturn, waitingF" +
|
||||
"orUserAction);\r\n\r\n ko.applyBindings(viewModel);\r\n " +
|
||||
" viewModel.initialized = true;\r\n\r\n $(\'body\').removeCla" +
|
||||
"ss(\'status-connecting\');\r\n\r\n window.setTimeout(scheduleRotati" +
|
||||
"on, rotateSpeed);\r\n });\r\n }\r\n\r\n // Called b" +
|
||||
"y SignalR\r\n function updateHeldDevice(updates) {\r\n if " +
|
||||
"(viewModel) {\r\n\r\n $.each(updates, function (deviceSerialNumbe" +
|
||||
"r, heldDeviceItem) {\r\n // Remove Existing\r\n " +
|
||||
" removeItem(deviceSerialNumber);\r\n\r\n // Add Item" +
|
||||
"\r\n addItem(heldDeviceItem);\r\n });\r\n " +
|
||||
" }\r\n }\r\n\r\n function removeItem(deviceSerialNum" +
|
||||
"ber) {\r\n removeItemFromArray(viewModel.inProcess, deviceSerialNum" +
|
||||
"ber);\r\n removeItemFromArray(viewModel.readyForReturn, deviceSeria" +
|
||||
"lNumber);\r\n removeItemFromArray(viewModel.waitingForUserAction, d" +
|
||||
"eviceSerialNumber);\r\n }\r\n\r\n function addItem(heldDeviceIte" +
|
||||
"m) {\r\n if (heldDeviceItem !== null &&\r\n heldDe" +
|
||||
"viceItem !== undefined &&\r\n includeItem(heldDeviceItem)) {\r\n\r" +
|
||||
"\n var array;\r\n\r\n if (isWaitingForUserActio" +
|
||||
"n(heldDeviceItem))\r\n array = viewModel.waitingForUserActi" +
|
||||
"on;\r\n else if (isReadyForReturn(heldDeviceItem))\r\n " +
|
||||
" array = viewModel.readyForReturn;\r\n else if (isI" +
|
||||
"nProcess(heldDeviceItem))\r\n array = viewModel.inProcess;\r" +
|
||||
"\n\r\n if (array().length === 0) {\r\n arra" +
|
||||
"y.push(heldDeviceItem);\r\n } else {\r\n v" +
|
||||
"ar index = findSortedInsertIndex(array, heldDeviceItem);\r\n " +
|
||||
" if (index === -1)\r\n array.push(heldDeviceItem);\r\n " +
|
||||
" else\r\n array.splice(index, 0, h" +
|
||||
"eldDeviceItem);\r\n }\r\n }\r\n }\r\n\r\n " +
|
||||
" function rotateArrays() {\r\n rotateArray(viewModel.inProce" +
|
||||
"ss, $inProcessList);\r\n rotateArray(viewModel.readyForReturn, $rea" +
|
||||
"dyForReturnList);\r\n rotateArray(viewModel.waitingForUserAction, $" +
|
||||
"waitingForUserActionList);\r\n }\r\n\r\n function scheduleRotati" +
|
||||
"on() {\r\n rotateArrays();\r\n\r\n window.setTimeout(sch" +
|
||||
"eduleRotation, rotateSpeed);\r\n }\r\n\r\n function includeItem(" +
|
||||
"heldDeviceItem) {\r\n if (itemFilters == null || itemFilters.length" +
|
||||
" == 0)\r\n return true;\r\n\r\n return itemFilters.r" +
|
||||
"educe(function (previousValue, currentValue, index, array) {\r\n " +
|
||||
" if (previousValue === false)\r\n return false;\r\n " +
|
||||
" return currentValue(heldDeviceItem);\r\n }, true);\r\n " +
|
||||
" }\r\n\r\n function setTheme(theme) {\r\n if (!!fixed" +
|
||||
"Theme)\r\n return;\r\n\r\n var $body = $(document.bo" +
|
||||
"dy);\r\n\r\n // Existing classes\r\n var c = $body.attr(" +
|
||||
"\'class\').split(\' \');\r\n // Remove existing theme\r\n " +
|
||||
"c = $.grep(c, function (i) { return (i.indexOf(\'theme-\') !== 0) });\r\n\r\n " +
|
||||
" c.push(\'theme-\' + theme);\r\n\r\n $body.attr(\'class\', c.join(\'" +
|
||||
" \'));\r\n }\r\n\r\n function monitorMouseMove() {\r\n " +
|
||||
" var token = null,\r\n $body = $(document.body);\r\n\r\n " +
|
||||
" $body.mousemove(function () {\r\n if (!!token)\r\n " +
|
||||
" window.clearTimeout(token);\r\n else if ($body." +
|
||||
"css(\'cursor\') == \'none\')\r\n $body.css(\'cursor\', \'auto\');\r\n" +
|
||||
"\r\n token = window.setTimeout(function () {\r\n " +
|
||||
" $body.css(\'cursor\', \'none\');\r\n token = null;\r\n " +
|
||||
" }, 3500);\r\n });\r\n\r\n }\r\n\r\n f" +
|
||||
"unction applyQueryString() {\r\n var queryStringParameters = getQue" +
|
||||
"ryStringParameters();\r\n\r\n if (queryStringParameters !== null) {\r\n" +
|
||||
" var filters = [];\r\n\r\n $.each(queryStringP" +
|
||||
"arameters, function (key, value) {\r\n switch (key.toLowerC" +
|
||||
"ase()) {\r\n case \'components\':\r\n " +
|
||||
" const showComponents = value.split(\",\");\r\n " +
|
||||
" if (showComponents.length > 0) {\r\n const " +
|
||||
"components = [\'inProcess\', \'readyForReturn\', \'waitingForUserAction\'];\r\n " +
|
||||
" components.forEach(function (component) {\r\n " +
|
||||
" if (!showComponents.includes(component)) {\r\n " +
|
||||
" $(\'body\').addClass(\'hide-\' + component);\r\n" +
|
||||
" }\r\n }" +
|
||||
"heme = setTheme;\r\n\r\n $.connection.hub.qs = { Noticeboard: documen" +
|
||||
"t.body.dataset.hubname };\r\n $.connection.hub.error(function (erro" +
|
||||
"r) {\r\n console.log(\'Server connection error: \' + error);\r\n " +
|
||||
" });\r\n $.connection.hub.disconnected(connectionError)" +
|
||||
";\r\n\r\n // Start Connection\r\n $.connection.hub.start" +
|
||||
"().fail(connectionError).done(function () { loadData(); });\r\n }\r\n\r\n " +
|
||||
" // Called after SignalR is connected\r\n async function loadD" +
|
||||
"ata() {\r\n\r\n const body = new FormData();\r\n body.ap" +
|
||||
"pend(\'__RequestVerificationToken\', document.body.dataset.antiforgery);\r\n " +
|
||||
" const response = await fetch(document.body.dataset.dataurl, {\r\n " +
|
||||
" method: \'POST\',\r\n body: body\r\n });\r" +
|
||||
"\n const data = await response.json();\r\n\r\n var inPr" +
|
||||
"ocess = [];\r\n var readyForReturn = [];\r\n var waiti" +
|
||||
"ngForUserAction = [];\r\n\r\n data.filter(function (heldDeviceItem) {" +
|
||||
"\r\n return includeItem(heldDeviceItem)\r\n }).for" +
|
||||
"Each(function (heldDeviceItem) {\r\n if (isWaitingForUserAction" +
|
||||
"(heldDeviceItem))\r\n waitingForUserAction.push(heldDeviceI" +
|
||||
"tem);\r\n else if (isReadyForReturn(heldDeviceItem))\r\n " +
|
||||
" readyForReturn.push(heldDeviceItem);\r\n else if" +
|
||||
" (isInProcess(heldDeviceItem))\r\n inProcess.push(heldDevic" +
|
||||
"eItem);\r\n });\r\n\r\n inProcess.sort(sortFunction);\r\n " +
|
||||
" readyForReturn.sort(sortFunction);\r\n waitingForUse" +
|
||||
"rAction.sort(sortFunction);\r\n\r\n viewModel = new noticeboardViewMo" +
|
||||
"del(inProcess, readyForReturn, waitingForUserAction);\r\n\r\n ko.appl" +
|
||||
"yBindings(viewModel);\r\n viewModel.initialized = true;\r\n\r\n " +
|
||||
" $(\'body\').removeClass(\'status-connecting\');\r\n\r\n window.se" +
|
||||
"tTimeout(scheduleRotation, rotateSpeed);\r\n }\r\n\r\n // Called" +
|
||||
" by SignalR\r\n function updateHeldDevice(updates) {\r\n i" +
|
||||
"f (viewModel) {\r\n\r\n $.each(updates, function (deviceSerialNum" +
|
||||
"ber, heldDeviceItem) {\r\n // Remove Existing\r\n " +
|
||||
" removeItem(deviceSerialNumber);\r\n\r\n // Add It" +
|
||||
"em\r\n addItem(heldDeviceItem);\r\n });\r\n " +
|
||||
" }\r\n }\r\n\r\n function removeItem(deviceSerialN" +
|
||||
"umber) {\r\n removeItemFromArray(viewModel.inProcess, deviceSerialN" +
|
||||
"umber);\r\n removeItemFromArray(viewModel.readyForReturn, deviceSer" +
|
||||
"ialNumber);\r\n removeItemFromArray(viewModel.waitingForUserAction," +
|
||||
" deviceSerialNumber);\r\n }\r\n\r\n function addItem(heldDeviceI" +
|
||||
"tem) {\r\n if (heldDeviceItem !== null &&\r\n held" +
|
||||
"DeviceItem !== undefined &&\r\n includeItem(heldDeviceItem)) {\r" +
|
||||
"\n\r\n var array;\r\n\r\n if (isWaitingForUserAct" +
|
||||
"ion(heldDeviceItem))\r\n array = viewModel.waitingForUserAc" +
|
||||
"tion;\r\n else if (isReadyForReturn(heldDeviceItem))\r\n " +
|
||||
" array = viewModel.readyForReturn;\r\n else if (i" +
|
||||
"sInProcess(heldDeviceItem))\r\n array = viewModel.inProcess" +
|
||||
";\r\n\r\n if (array().length === 0) {\r\n ar" +
|
||||
"ray.push(heldDeviceItem);\r\n } else {\r\n " +
|
||||
" var index = findSortedInsertIndex(array, heldDeviceItem);\r\n " +
|
||||
" if (index === -1)\r\n array.push(heldDeviceItem);\r\n" +
|
||||
" else\r\n array.splice(index, 0," +
|
||||
" heldDeviceItem);\r\n }\r\n }\r\n }\r\n\r\n " +
|
||||
" function rotateArrays() {\r\n rotateArray(viewModel.inPro" +
|
||||
"cess, $inProcessList);\r\n rotateArray(viewModel.readyForReturn, $r" +
|
||||
"eadyForReturnList);\r\n rotateArray(viewModel.waitingForUserAction," +
|
||||
" $waitingForUserActionList);\r\n }\r\n\r\n function scheduleRota" +
|
||||
"tion() {\r\n rotateArrays();\r\n\r\n window.setTimeout(s" +
|
||||
"cheduleRotation, rotateSpeed);\r\n }\r\n\r\n function includeIte" +
|
||||
"m(heldDeviceItem) {\r\n if (itemFilters == null || itemFilters.leng" +
|
||||
"th == 0)\r\n return true;\r\n\r\n return itemFilters" +
|
||||
".reduce(function (previousValue, currentValue, index, array) {\r\n " +
|
||||
" if (previousValue === false)\r\n return false;\r\n " +
|
||||
" return currentValue(heldDeviceItem);\r\n }, true);\r\n " +
|
||||
" }\r\n\r\n function setTheme(theme) {\r\n if (!!fix" +
|
||||
"edTheme)\r\n return;\r\n\r\n var $body = $(document." +
|
||||
"body);\r\n\r\n // Existing classes\r\n var c = $body.att" +
|
||||
"r(\'class\').split(\' \');\r\n // Remove existing theme\r\n " +
|
||||
" c = $.grep(c, function (i) { return (i.indexOf(\'theme-\') !== 0) });\r\n\r\n " +
|
||||
" c.push(\'theme-\' + theme);\r\n\r\n $body.attr(\'class\', c.join" +
|
||||
"(\' \'));\r\n }\r\n\r\n function monitorMouseMove() {\r\n " +
|
||||
" var token = null,\r\n $body = $(document.body);\r\n\r\n " +
|
||||
" $body.mousemove(function () {\r\n if (!!token)\r\n " +
|
||||
" window.clearTimeout(token);\r\n else if ($bod" +
|
||||
"y.css(\'cursor\') == \'none\')\r\n $body.css(\'cursor\', \'auto\');" +
|
||||
"\r\n\r\n token = window.setTimeout(function () {\r\n " +
|
||||
" $body.css(\'cursor\', \'none\');\r\n token = null;\r\n " +
|
||||
" }, 3500);\r\n });\r\n\r\n }\r\n\r\n " +
|
||||
" function applyQueryString() {\r\n var queryStringParameters = getQ" +
|
||||
"ueryStringParameters();\r\n\r\n if (queryStringParameters !== null) {" +
|
||||
"\r\n var filters = [];\r\n\r\n $.each(queryStrin" +
|
||||
"gParameters, function (key, value) {\r\n switch (key.toLowe" +
|
||||
"rCase()) {\r\n case \'components\':\r\n " +
|
||||
" const showComponents = value.split(\",\");\r\n " +
|
||||
" if (showComponents.length > 0) {\r\n cons" +
|
||||
"t components = [\'inProcess\', \'readyForReturn\', \'waitingForUserAction\'];\r\n " +
|
||||
" components.forEach(function (component) {\r\n " +
|
||||
" if (!showComponents.includes(component)) {\r\n " +
|
||||
" $(\'body\').addClass(\'hide-\' + component);" +
|
||||
"\r\n }\r\n " +
|
||||
" });\r\n }\r\n break;\r" +
|
||||
"\n case \'theme\': // THEME\r\n " +
|
||||
" setTheme(value);\r\n fixedTheme = value;\r\n " +
|
||||
" break;\r\n case \'deviceaddr" +
|
||||
"essinclude\': // FILTER: Device Address Include\r\n " +
|
||||
"var deviceAddresses = value.split(\",\").map(function (v) { return v.toLowerCase()" +
|
||||
"; });\r\n if (deviceAddresses.length > 0) {\r\n " +
|
||||
" filters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // false if DeviceAddressShortName is null\r\n " +
|
||||
" if (!heldDeviceItem.DeviceAddressShortName)\r" +
|
||||
"\n return false;\r\n\r\n " +
|
||||
" // true if DeviceAddressShortName is included\r\n " +
|
||||
" return $.inArray(heldDeviceItem.DeviceAddressShortN" +
|
||||
"ame.toLowerCase(), deviceAddresses) >= 0;\r\n }" +
|
||||
");\r\n }\r\n break;\r\n " +
|
||||
" case \'theme\': // THEME\r\n " +
|
||||
" setTheme(value);\r\n fixedTheme = value;\r\n " +
|
||||
" break;\r\n case \'deviceaddres" +
|
||||
"sinclude\': // FILTER: Device Address Include\r\n va" +
|
||||
"r deviceAddresses = value.split(\",\").map(function (v) { return v.toLowerCase(); " +
|
||||
"});\r\n if (deviceAddresses.length > 0) {\r\n " +
|
||||
" filters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // false if DeviceAddressShortName is null\r\n " +
|
||||
" if (!heldDeviceItem.DeviceAddressShortName)\r\n " +
|
||||
" return false;\r\n\r\n " +
|
||||
" // true if DeviceAddressShortName is included\r\n " +
|
||||
" return $.inArray(heldDeviceItem.DeviceAddressShortNam" +
|
||||
"e.toLowerCase(), deviceAddresses) >= 0;\r\n });" +
|
||||
"\r\n }\r\n break;\r\n " +
|
||||
" case \'deviceaddressexclude\': // FILTER: Device Address " +
|
||||
"Exclude\r\n var deviceAddresses = value.split(\",\")." +
|
||||
"map(function (v) { return v.toLowerCase(); });\r\n " +
|
||||
"if (deviceAddresses.length > 0) {\r\n filters.p" +
|
||||
"ush(function (heldDeviceItem) {\r\n // true" +
|
||||
" if DeviceAddressShortName is null\r\n if (" +
|
||||
"!heldDeviceItem.DeviceAddressShortName)\r\n " +
|
||||
" return true;\r\n\r\n // true if DeviceAd" +
|
||||
"dressShortName is excluded\r\n return $.inA" +
|
||||
"rray(heldDeviceItem.DeviceAddressShortName.toLowerCase(), deviceAddresses) < 0;\r" +
|
||||
"\n });\r\n }\r\n " +
|
||||
" break;\r\n case \'devicepro" +
|
||||
"fileinclude\': // FILTER: Device Profile Include\r\n " +
|
||||
" var deviceProfiles = value.split(\",\").map(function (v) { return parseInt(v); })" +
|
||||
";\r\n if (deviceProfiles.length > 0) {\r\n " +
|
||||
" filters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // true if DeviceProfileId is included\r\n " +
|
||||
" return $.inArray(heldDeviceItem.DeviceProfileId, devi" +
|
||||
"ceProfiles) >= 0;\r\n });\r\n " +
|
||||
" }\r\n break;\r\n " +
|
||||
" case \'deviceprofileexclude\': // FILTER: Device Profile Exclude\r\n " +
|
||||
" var deviceProfiles = value.split(\",\").map(function (v) { retu" +
|
||||
"rn parseInt(v); });\r\n if (deviceProfiles.length >" +
|
||||
" 0) {\r\n filters.push(function (heldDeviceItem" +
|
||||
") {\r\n // true if DeviceProfileId is exclu" +
|
||||
"ded\r\n return $.inArray(heldDeviceItem.Dev" +
|
||||
"iceProfileId, deviceProfiles) < 0;\r\n });\r\n " +
|
||||
" }\r\n break;\r\n " +
|
||||
" }\r\n });\r\n\r\n if (filters.le" +
|
||||
"ngth > 0)\r\n itemFilters = filters;\r\n e" +
|
||||
"lse\r\n itemFilters = null;\r\n }\r\n " +
|
||||
" }\r\n\r\n function connectionError() {\r\n try {\r\n " +
|
||||
" $(\'body\').addClass(\'status-error\');\r\n } catch (e) {\r\n " +
|
||||
" // Ignore\r\n }\r\n\r\n window.setTim" +
|
||||
"eout(function () {\r\n window.location.reload(true);\r\n " +
|
||||
" }, 10000);\r\n }\r\n\r\n // Helpers\r\n function" +
|
||||
" rotateArray(koArray, element) {\r\n var items = koArray();\r\n\r\n " +
|
||||
" if (items.length <= 1)\r\n return 0;\r\n\r\n " +
|
||||
" if (element.height() < (element.parent().height() - 30)) {\r\n\r\n " +
|
||||
" if (findUnsortedArrayTopIndex(items) !== 0)\r\n koAr" +
|
||||
"ray.sort(sortFunction);\r\n\r\n // Don\'t rotate if small & sorted" +
|
||||
" correctly\r\n return;\r\n }\r\n\r\n //" +
|
||||
" Move Last Item to Top\r\n var item = koArray.pop();\r\n " +
|
||||
" koArray.unshift(item);\r\n }\r\n function removeItemFromArr" +
|
||||
"ay(koArray, deviceSerialNumber) {\r\n var items = koArray();\r\n " +
|
||||
" for (var i = 0; i < items.length; i++) {\r\n if (ite" +
|
||||
"ms[i].DeviceSerialNumber == deviceSerialNumber) {\r\n koArr" +
|
||||
"ay.splice(i, 1);\r\n items = koArray();\r\n " +
|
||||
" i--;\r\n }\r\n }\r\n }\r\n " +
|
||||
" function findUnsortedArrayTopIndex(items) {\r\n // Only one Item\r\n" +
|
||||
" if (items.length <= 1)\r\n return 0;\r\n\r\n " +
|
||||
" for (var i = 1; i < items.length; i++) {\r\n var s = s" +
|
||||
"ortFunction(items[i - 1], items[i]);\r\n if (s > 0)\r\n " +
|
||||
" return i;\r\n }\r\n\r\n return 0;\r\n " +
|
||||
" }\r\n function findSortedInsertIndex(koArray, heldDeviceItem) {\r\n " +
|
||||
" var items = koArray();\r\n var startIndex = findUnso" +
|
||||
"rtedArrayTopIndex(items);\r\n for (var i = startIndex; i < items.le" +
|
||||
"ngth; i++) {\r\n var s = sortFunction(heldDeviceItem, items[i])" +
|
||||
";\r\n if (s <= 0)\r\n return i;\r\n " +
|
||||
" }\r\n if (startIndex !== 0) {\r\n for (var " +
|
||||
"i = 0; i < startIndex; i++) {\r\n var s = sortFunction(held" +
|
||||
"DeviceItem, items[i]);\r\n if (s <= 0)\r\n " +
|
||||
" return i;\r\n }\r\n return startIndex" +
|
||||
";\r\n } else {\r\n return -1;\r\n }\r\n" +
|
||||
" }\r\n function sortFunction(l, r) {\r\n return" +
|
||||
" l.DeviceDescription.toLowerCase() == r.DeviceDescription.toLowerCase() ? 0 : (l" +
|
||||
".DeviceDescription.toLowerCase() < r.DeviceDescription.toLowerCase() ? -1 : 1)\r\n" +
|
||||
" }\r\n function isInProcess(i) {\r\n return !i." +
|
||||
"ReadyForReturn && !i.WaitingForUserAction;\r\n }\r\n function " +
|
||||
"isReadyForReturn(i) {\r\n return i.ReadyForReturn && !i.WaitingForU" +
|
||||
"serAction;\r\n }\r\n function isWaitingForUserAction(i) {\r\n " +
|
||||
" return i.WaitingForUserAction;\r\n }\r\n function" +
|
||||
" getQueryStringParameters() {\r\n\r\n if (window.location.search.leng" +
|
||||
"th === 0)\r\n return null;\r\n\r\n var params = {};\r" +
|
||||
"\n window.location.search.substr(1).split(\"&\").forEach(function (p" +
|
||||
"air) {\r\n if (pair === \"\") return;\r\n var pa" +
|
||||
"rts = pair.split(\"=\");\r\n params[parts[0]] = parts[1] && decod" +
|
||||
"eURIComponent(parts[1].replace(/\\+/g, \" \"));\r\n });\r\n " +
|
||||
" return params;\r\n }\r\n\r\n init();\r\n });\r\n </scri" +
|
||||
"pt>\r\n</body>\r\n</html>");
|
||||
" case \'deviceaddressexclude\': // FILTER: Device Addres" +
|
||||
"s Exclude\r\n var deviceAddresses = value.split(\",\"" +
|
||||
").map(function (v) { return v.toLowerCase(); });\r\n " +
|
||||
" if (deviceAddresses.length > 0) {\r\n filters" +
|
||||
".push(function (heldDeviceItem) {\r\n // tr" +
|
||||
"ue if DeviceAddressShortName is null\r\n if" +
|
||||
" (!heldDeviceItem.DeviceAddressShortName)\r\n " +
|
||||
" return true;\r\n\r\n // true if Device" +
|
||||
"AddressShortName is excluded\r\n return $.i" +
|
||||
"nArray(heldDeviceItem.DeviceAddressShortName.toLowerCase(), deviceAddresses) < 0" +
|
||||
";\r\n });\r\n }\r\n " +
|
||||
" break;\r\n case \'devicep" +
|
||||
"rofileinclude\': // FILTER: Device Profile Include\r\n " +
|
||||
" var deviceProfiles = value.split(\",\").map(function (v) { return parseInt(v); " +
|
||||
"});\r\n if (deviceProfiles.length > 0) {\r\n " +
|
||||
" filters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // true if DeviceProfileId is included\r\n " +
|
||||
" return $.inArray(heldDeviceItem.DeviceProfileId, de" +
|
||||
"viceProfiles) >= 0;\r\n });\r\n " +
|
||||
" }\r\n break;\r\n " +
|
||||
" case \'deviceprofileexclude\': // FILTER: Device Profile Exclude\r\n " +
|
||||
" var deviceProfiles = value.split(\",\").map(function (v) { re" +
|
||||
"turn parseInt(v); });\r\n if (deviceProfiles.length" +
|
||||
" > 0) {\r\n filters.push(function (heldDeviceIt" +
|
||||
"em) {\r\n // true if DeviceProfileId is exc" +
|
||||
"luded\r\n return $.inArray(heldDeviceItem.D" +
|
||||
"eviceProfileId, deviceProfiles) < 0;\r\n });\r\n " +
|
||||
" }\r\n break;\r\n " +
|
||||
" }\r\n });\r\n\r\n if (filters." +
|
||||
"length > 0)\r\n itemFilters = filters;\r\n " +
|
||||
" else\r\n itemFilters = null;\r\n }\r\n " +
|
||||
" }\r\n\r\n function connectionError() {\r\n try {\r\n " +
|
||||
" $(\'body\').addClass(\'status-error\');\r\n } catch (e) {\r" +
|
||||
"\n // Ignore\r\n }\r\n\r\n window.setT" +
|
||||
"imeout(function () {\r\n window.location.reload(true);\r\n " +
|
||||
" }, 10000);\r\n }\r\n\r\n // Helpers\r\n functi" +
|
||||
"on rotateArray(koArray, element) {\r\n var items = koArray();\r\n\r\n " +
|
||||
" if (items.length <= 1)\r\n return 0;\r\n\r\n " +
|
||||
" if (element.height() < (element.parent().height() - 30)) {\r\n\r\n " +
|
||||
" if (findUnsortedArrayTopIndex(items) !== 0)\r\n ko" +
|
||||
"Array.sort(sortFunction);\r\n\r\n // Don\'t rotate if small & sort" +
|
||||
"ed correctly\r\n return;\r\n }\r\n\r\n " +
|
||||
"// Move Last Item to Top\r\n var item = koArray.pop();\r\n " +
|
||||
" koArray.unshift(item);\r\n }\r\n function removeItemFromA" +
|
||||
"rray(koArray, deviceSerialNumber) {\r\n var items = koArray();\r\n " +
|
||||
" for (var i = 0; i < items.length; i++) {\r\n if (i" +
|
||||
"tems[i].DeviceSerialNumber == deviceSerialNumber) {\r\n koA" +
|
||||
"rray.splice(i, 1);\r\n items = koArray();\r\n " +
|
||||
" i--;\r\n }\r\n }\r\n }\r\n " +
|
||||
" function findUnsortedArrayTopIndex(items) {\r\n // Only one Item" +
|
||||
"\r\n if (items.length <= 1)\r\n return 0;\r\n\r\n " +
|
||||
" for (var i = 1; i < items.length; i++) {\r\n var s =" +
|
||||
" sortFunction(items[i - 1], items[i]);\r\n if (s > 0)\r\n " +
|
||||
" return i;\r\n }\r\n\r\n return 0;\r\n " +
|
||||
" }\r\n function findSortedInsertIndex(koArray, heldDeviceItem) {\r" +
|
||||
"\n var items = koArray();\r\n var startIndex = findUn" +
|
||||
"sortedArrayTopIndex(items);\r\n for (var i = startIndex; i < items." +
|
||||
"length; i++) {\r\n var s = sortFunction(heldDeviceItem, items[i" +
|
||||
"]);\r\n if (s <= 0)\r\n return i;\r\n " +
|
||||
" }\r\n if (startIndex !== 0) {\r\n for (va" +
|
||||
"r i = 0; i < startIndex; i++) {\r\n var s = sortFunction(he" +
|
||||
"ldDeviceItem, items[i]);\r\n if (s <= 0)\r\n " +
|
||||
" return i;\r\n }\r\n return startInd" +
|
||||
"ex;\r\n } else {\r\n return -1;\r\n }" +
|
||||
"\r\n }\r\n function sortFunction(l, r) {\r\n retu" +
|
||||
"rn l.DeviceDescription.toLowerCase() == r.DeviceDescription.toLowerCase() ? 0 : " +
|
||||
"(l.DeviceDescription.toLowerCase() < r.DeviceDescription.toLowerCase() ? -1 : 1)" +
|
||||
"\r\n }\r\n function isInProcess(i) {\r\n return !" +
|
||||
"i.ReadyForReturn && !i.WaitingForUserAction;\r\n }\r\n functio" +
|
||||
"n isReadyForReturn(i) {\r\n return i.ReadyForReturn && !i.WaitingFo" +
|
||||
"rUserAction;\r\n }\r\n function isWaitingForUserAction(i) {\r\n " +
|
||||
" return i.WaitingForUserAction;\r\n }\r\n functi" +
|
||||
"on getQueryStringParameters() {\r\n\r\n if (window.location.search.le" +
|
||||
"ngth === 0)\r\n return null;\r\n\r\n var params = {}" +
|
||||
";\r\n window.location.search.substr(1).split(\"&\").forEach(function " +
|
||||
"(pair) {\r\n if (pair === \"\") return;\r\n var " +
|
||||
"parts = pair.split(\"=\");\r\n params[parts[0]] = parts[1] && dec" +
|
||||
"odeURIComponent(parts[1].replace(/\\+/g, \" \"));\r\n });\r\n " +
|
||||
" return params;\r\n }\r\n\r\n init();\r\n });\r\n </sc" +
|
||||
"ript>\r\n</body>\r\n</html>\r\n");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<title>Disco ICT - Held Devices for Users</title>
|
||||
@Html.BundleRenderDeferred()
|
||||
</head>
|
||||
<body class="theme-@(Model.DefaultTheme) status-connecting">
|
||||
<body class="theme-@(Model.DefaultTheme) status-connecting" data-antiforgery="@AntiForgeryExtensions.GetToken(Context)" data-hubname="@(Disco.Services.Jobs.Noticeboards.HeldDevicesForUsers.Name)" data-dataurl="@(Url.Action(MVC.Public.UserHeldDevices.UserHeldDevices()))">
|
||||
<div id="page">
|
||||
<header id="header">
|
||||
<div id="heading">Held Devices for Users</div>
|
||||
@@ -26,7 +26,8 @@
|
||||
</header>
|
||||
<section id="mainSection">
|
||||
<div id="inProcess" class="list">
|
||||
<h3>In Process (<span data-bind="text: inProcess().length"></span>)
|
||||
<h3>
|
||||
In Process (<span data-bind="text: inProcess().length"></span>)
|
||||
</h3>
|
||||
<div class="content">
|
||||
<!-- ko if: inProcess().length == 0 -->
|
||||
@@ -36,7 +37,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="readyForReturn" class="list">
|
||||
<h3>Ready for Return (<span data-bind="text: readyForReturn().length"></span>)
|
||||
<h3>
|
||||
Ready for Return (<span data-bind="text: readyForReturn().length"></span>)
|
||||
</h3>
|
||||
<div class="content">
|
||||
<!-- ko if: readyForReturn().length == 0 -->
|
||||
@@ -46,7 +48,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="waitingForUserAction" class="list">
|
||||
<h3>Waiting for User Action (<span data-bind="text: waitingForUserAction().length"></span>)
|
||||
<h3>
|
||||
Waiting for User Action (<span data-bind="text: waitingForUserAction().length"></span>)
|
||||
</h3>
|
||||
<div class="content">
|
||||
<!-- ko if: waitingForUserAction().length == 0 -->
|
||||
@@ -130,48 +133,54 @@
|
||||
hub.client.updateHeldDeviceForUser = updateHeldDevice;
|
||||
hub.client.setTheme = setTheme;
|
||||
|
||||
$.connection.hub.qs = { Noticeboard: '@(Disco.Services.Jobs.Noticeboards.HeldDevicesForUsers.Name)' };
|
||||
$.connection.hub.qs = { Noticeboard: document.body.dataset.hubname };
|
||||
$.connection.hub.error(function (error) {
|
||||
console.log('Server connection error: ' + error);
|
||||
});
|
||||
$.connection.hub.disconnected(connectionError);
|
||||
|
||||
// Start Connection
|
||||
$.connection.hub.start().fail(connectionError).done(loadData);
|
||||
$.connection.hub.start().fail(connectionError).done(function () { loadData(); });
|
||||
}
|
||||
|
||||
// Called after SignalR is connected
|
||||
function loadData() {
|
||||
$.getJSON('@(Url.Action(MVC.Public.UserHeldDevices.UserHeldDevices()))', null, function (data) {
|
||||
async function loadData() {
|
||||
|
||||
var inProcess = [];
|
||||
var readyForReturn = [];
|
||||
var waitingForUserAction = [];
|
||||
|
||||
data.filter(function (heldDeviceItem) {
|
||||
return includeItem(heldDeviceItem)
|
||||
}).forEach(function (heldDeviceItem) {
|
||||
if (isWaitingForUserAction(heldDeviceItem))
|
||||
waitingForUserAction.push(heldDeviceItem);
|
||||
else if (isReadyForReturn(heldDeviceItem))
|
||||
readyForReturn.push(heldDeviceItem);
|
||||
else if (isInProcess(heldDeviceItem))
|
||||
inProcess.push(heldDeviceItem);
|
||||
});
|
||||
|
||||
inProcess.sort(sortFunction);
|
||||
readyForReturn.sort(sortFunction);
|
||||
waitingForUserAction.sort(sortFunction);
|
||||
|
||||
viewModel = new noticeboardViewModel(inProcess, readyForReturn, waitingForUserAction);
|
||||
|
||||
ko.applyBindings(viewModel);
|
||||
viewModel.initialized = true;
|
||||
|
||||
$('body').removeClass('status-connecting');
|
||||
|
||||
window.setTimeout(scheduleRotation, rotateSpeed);
|
||||
const body = new FormData();
|
||||
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||
const response = await fetch(document.body.dataset.dataurl, {
|
||||
method: 'POST',
|
||||
body: body
|
||||
});
|
||||
const data = await response.json();
|
||||
|
||||
var inProcess = [];
|
||||
var readyForReturn = [];
|
||||
var waitingForUserAction = [];
|
||||
|
||||
data.filter(function (heldDeviceItem) {
|
||||
return includeItem(heldDeviceItem)
|
||||
}).forEach(function (heldDeviceItem) {
|
||||
if (isWaitingForUserAction(heldDeviceItem))
|
||||
waitingForUserAction.push(heldDeviceItem);
|
||||
else if (isReadyForReturn(heldDeviceItem))
|
||||
readyForReturn.push(heldDeviceItem);
|
||||
else if (isInProcess(heldDeviceItem))
|
||||
inProcess.push(heldDeviceItem);
|
||||
});
|
||||
|
||||
inProcess.sort(sortFunction);
|
||||
readyForReturn.sort(sortFunction);
|
||||
waitingForUserAction.sort(sortFunction);
|
||||
|
||||
viewModel = new noticeboardViewModel(inProcess, readyForReturn, waitingForUserAction);
|
||||
|
||||
ko.applyBindings(viewModel);
|
||||
viewModel.initialized = true;
|
||||
|
||||
$('body').removeClass('status-connecting');
|
||||
|
||||
window.setTimeout(scheduleRotation, rotateSpeed);
|
||||
}
|
||||
|
||||
// Called by SignalR
|
||||
|
||||
@@ -89,6 +89,39 @@ WriteAttribute("class", Tuple.Create(" class=\"", 572), Tuple.Create("\"", 625)
|
||||
, Tuple.Create(Tuple.Create(" ", 607), Tuple.Create("status-connecting", 608), true)
|
||||
);
|
||||
|
||||
WriteLiteral(" data-antiforgery=\"");
|
||||
|
||||
|
||||
#line 17 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml"
|
||||
Write(AntiForgeryExtensions.GetToken(Context));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(" data-hubname=\"");
|
||||
|
||||
|
||||
#line 17 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml"
|
||||
Write(Disco.Services.Jobs.Noticeboards.HeldDevicesForUsers.Name);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(" data-dataurl=\"");
|
||||
|
||||
|
||||
#line 17 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml"
|
||||
Write(Url.Action(MVC.Public.UserHeldDevices.UserHeldDevices()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" id=\"page\"");
|
||||
@@ -135,7 +168,7 @@ WriteLiteral(" id=\"inProcess\"");
|
||||
|
||||
WriteLiteral(" class=\"list\"");
|
||||
|
||||
WriteLiteral(">\r\n <h3>In Process (<span");
|
||||
WriteLiteral(">\r\n <h3>\r\n In Process (<span");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: inProcess().length\"");
|
||||
|
||||
@@ -159,7 +192,7 @@ WriteLiteral(" id=\"readyForReturn\"");
|
||||
|
||||
WriteLiteral(" class=\"list\"");
|
||||
|
||||
WriteLiteral(">\r\n <h3>Ready for Return (<span");
|
||||
WriteLiteral(">\r\n <h3>\r\n Ready for Return (<span");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: readyForReturn().length\"");
|
||||
|
||||
@@ -183,7 +216,7 @@ WriteLiteral(" id=\"waitingForUserAction\"");
|
||||
|
||||
WriteLiteral(" class=\"list\"");
|
||||
|
||||
WriteLiteral(">\r\n <h3>Waiting for User Action (<span");
|
||||
WriteLiteral(">\r\n <h3>\r\n Waiting for User Action (<span");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: waitingForUserAction().length\"");
|
||||
|
||||
@@ -247,206 +280,186 @@ WriteLiteral(">\r\n <li data-bind=\"css: { alert: IsAlert }\">\r\n
|
||||
" hub = $.connection.noticeboardUpdates;\r\n\r\n // Map Func" +
|
||||
"tions\r\n hub.client.updateHeldDeviceForUser = updateHeldDevice;\r\n " +
|
||||
" hub.client.setTheme = setTheme;\r\n\r\n $.connection.h" +
|
||||
"ub.qs = { Noticeboard: \'");
|
||||
|
||||
|
||||
#line 133 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml"
|
||||
Write(Disco.Services.Jobs.Noticeboards.HeldDevicesForUsers.Name);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"' };
|
||||
$.connection.hub.error(function (error) {
|
||||
console.log('Server connection error: ' + error);
|
||||
});
|
||||
$.connection.hub.disconnected(connectionError);
|
||||
|
||||
// Start Connection
|
||||
$.connection.hub.start().fail(connectionError).done(loadData);
|
||||
}
|
||||
|
||||
// Called after SignalR is connected
|
||||
function loadData() {
|
||||
$.getJSON('");
|
||||
|
||||
|
||||
#line 145 "..\..\Areas\Public\Views\UserHeldDevices\Noticeboard.cshtml"
|
||||
Write(Url.Action(MVC.Public.UserHeldDevices.UserHeldDevices()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\', null, function (data) {\r\n\r\n var inProcess = [];\r\n " +
|
||||
" var readyForReturn = [];\r\n var waitingForUserAction" +
|
||||
" = [];\r\n\r\n data.filter(function (heldDeviceItem) {\r\n " +
|
||||
" return includeItem(heldDeviceItem)\r\n }).forEac" +
|
||||
"h(function (heldDeviceItem) {\r\n if (isWaitingForUserActio" +
|
||||
"n(heldDeviceItem))\r\n waitingForUserAction.push(heldDe" +
|
||||
"viceItem);\r\n else if (isReadyForReturn(heldDeviceItem))\r\n" +
|
||||
" readyForReturn.push(heldDeviceItem);\r\n " +
|
||||
" else if (isInProcess(heldDeviceItem))\r\n inP" +
|
||||
"rocess.push(heldDeviceItem);\r\n });\r\n\r\n inP" +
|
||||
"rocess.sort(sortFunction);\r\n readyForReturn.sort(sortFunction" +
|
||||
");\r\n waitingForUserAction.sort(sortFunction);\r\n\r\n " +
|
||||
" viewModel = new noticeboardViewModel(inProcess, readyForReturn, waitingF" +
|
||||
"orUserAction);\r\n\r\n ko.applyBindings(viewModel);\r\n " +
|
||||
" viewModel.initialized = true;\r\n\r\n $(\'body\').removeCla" +
|
||||
"ss(\'status-connecting\');\r\n\r\n window.setTimeout(scheduleRotati" +
|
||||
"on, rotateSpeed);\r\n });\r\n }\r\n\r\n // Called b" +
|
||||
"y SignalR\r\n function updateHeldDevice(updates) {\r\n if " +
|
||||
"(viewModel) {\r\n\r\n $.each(updates, function (UserId, heldDevic" +
|
||||
"eItem) {\r\n // Remove Existing\r\n re" +
|
||||
"moveItem(UserId);\r\n\r\n // Add Item\r\n " +
|
||||
" addItem(heldDeviceItem);\r\n });\r\n }\r\n " +
|
||||
" }\r\n\r\n function removeItem(UserId) {\r\n removeItemFr" +
|
||||
"omArray(viewModel.inProcess, UserId);\r\n removeItemFromArray(viewM" +
|
||||
"odel.readyForReturn, UserId);\r\n removeItemFromArray(viewModel.wai" +
|
||||
"tingForUserAction, UserId);\r\n }\r\n\r\n function addItem(heldD" +
|
||||
"eviceItem) {\r\n if (heldDeviceItem !== null &&\r\n " +
|
||||
" heldDeviceItem !== undefined &&\r\n includeItem(heldDeviceIte" +
|
||||
"m)) {\r\n\r\n var array;\r\n\r\n if (isWaitingForU" +
|
||||
"serAction(heldDeviceItem))\r\n array = viewModel.waitingFor" +
|
||||
"UserAction;\r\n else if (isReadyForReturn(heldDeviceItem))\r\n " +
|
||||
" array = viewModel.readyForReturn;\r\n else" +
|
||||
" if (isInProcess(heldDeviceItem))\r\n array = viewModel.inP" +
|
||||
"rocess;\r\n\r\n if (array().length === 0) {\r\n " +
|
||||
" array.push(heldDeviceItem);\r\n } else {\r\n " +
|
||||
" var index = findSortedInsertIndex(array, heldDeviceItem);\r\n " +
|
||||
" if (index === -1)\r\n array.push(heldDeviceIt" +
|
||||
"em);\r\n else\r\n array.splice(ind" +
|
||||
"ex, 0, heldDeviceItem);\r\n }\r\n }\r\n }" +
|
||||
"\r\n\r\n function rotateArrays() {\r\n rotateArray(viewModel" +
|
||||
".inProcess, $inProcessList);\r\n rotateArray(viewModel.readyForRetu" +
|
||||
"rn, $readyForReturnList);\r\n rotateArray(viewModel.waitingForUserA" +
|
||||
"ction, $waitingForUserActionList);\r\n }\r\n\r\n function schedu" +
|
||||
"leRotation() {\r\n rotateArrays();\r\n\r\n window.setTim" +
|
||||
"eout(scheduleRotation, rotateSpeed);\r\n }\r\n\r\n function incl" +
|
||||
"udeItem(heldDeviceItem) {\r\n if (itemFilters == null || itemFilter" +
|
||||
"s.length == 0)\r\n return true;\r\n\r\n return itemF" +
|
||||
"ilters.reduce(function (previousValue, currentValue, index, array) {\r\n " +
|
||||
" if (previousValue === false)\r\n return false;\r\n " +
|
||||
" return currentValue(heldDeviceItem);\r\n }, true" +
|
||||
");\r\n }\r\n\r\n function setTheme(theme) {\r\n if " +
|
||||
"(!!fixedTheme)\r\n return;\r\n\r\n var $body = $(doc" +
|
||||
"ument.body);\r\n\r\n // Existing classes\r\n var c = $bo" +
|
||||
"dy.attr(\'class\').split(\' \');\r\n // Remove existing theme\r\n " +
|
||||
" c = $.grep(c, function (i) { return (i.indexOf(\'theme-\') !== 0) });\r\n\r\n " +
|
||||
" c.push(\'theme-\' + theme);\r\n\r\n $body.attr(\'class\', " +
|
||||
"c.join(\' \'));\r\n }\r\n\r\n function monitorMouseMove() {\r\n " +
|
||||
" var token = null,\r\n $body = $(document.body);\r\n\r\n " +
|
||||
" $body.mousemove(function () {\r\n if (!!token)\r\n" +
|
||||
" window.clearTimeout(token);\r\n else if" +
|
||||
" ($body.css(\'cursor\') == \'none\')\r\n $body.css(\'cursor\', \'a" +
|
||||
"uto\');\r\n\r\n token = window.setTimeout(function () {\r\n " +
|
||||
" $body.css(\'cursor\', \'none\');\r\n token = nul" +
|
||||
"l;\r\n }, 3500);\r\n });\r\n\r\n }\r\n\r\n " +
|
||||
" function applyQueryString() {\r\n var queryStringParameters " +
|
||||
"= getQueryStringParameters();\r\n\r\n if (queryStringParameters !== n" +
|
||||
"ull) {\r\n var filters = [];\r\n\r\n $.each(quer" +
|
||||
"yStringParameters, function (key, value) {\r\n switch (key." +
|
||||
"toLowerCase()) {\r\n case \'components\':\r\n " +
|
||||
" const showComponents = value.split(\",\");\r\n " +
|
||||
" if (showComponents.length > 0) {\r\n " +
|
||||
" const components = [\'inProcess\', \'readyForReturn\', \'waitingForUserAction\'];\r\n " +
|
||||
" components.forEach(function (component) {\r\n " +
|
||||
" if (!showComponents.includes(component)) {" +
|
||||
"\r\n $(\'body\').addClass(\'hide-\' + compo" +
|
||||
"nent);\r\n }\r\n " +
|
||||
" });\r\n }\r\n b" +
|
||||
"reak;\r\n case \'theme\': // THEME\r\n " +
|
||||
" setTheme(value);\r\n fixedTheme = value;" +
|
||||
"\r\n break;\r\n case \'devi" +
|
||||
"ceaddressinclude\': // FILTER: Device Address Include\r\n " +
|
||||
" var deviceAddresses = value.split(\",\").map(function (v) { return v.toLower" +
|
||||
"Case(); });\r\n if (deviceAddresses.length > 0) {\r\n" +
|
||||
" filters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // false if DeviceAddressShortName is null" +
|
||||
"\r\n if (!heldDeviceItem.DeviceAddressShort" +
|
||||
"Name)\r\n return false;\r\n\r\n " +
|
||||
" // true if DeviceAddressShortName is included\r\n " +
|
||||
" return $.inArray(heldDeviceItem.DeviceAddress" +
|
||||
"ShortName.toLowerCase(), deviceAddresses) >= 0;\r\n " +
|
||||
" });\r\n }\r\n bre" +
|
||||
"ak;\r\n case \'deviceaddressexclude\': // FILTER: Device " +
|
||||
"Address Exclude\r\n var deviceAddresses = value.spl" +
|
||||
"it(\",\").map(function (v) { return v.toLowerCase(); });\r\n " +
|
||||
" if (deviceAddresses.length > 0) {\r\n f" +
|
||||
"ilters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // true if DeviceAddressShortName is null\r\n " +
|
||||
" if (!heldDeviceItem.DeviceAddressShortName)\r\n " +
|
||||
" return true;\r\n\r\n // true if " +
|
||||
"DeviceAddressShortName is excluded\r\n retu" +
|
||||
"rn $.inArray(heldDeviceItem.DeviceAddressShortName.toLowerCase(), deviceAddresse" +
|
||||
"s) < 0;\r\n });\r\n " +
|
||||
" }\r\n break;\r\n case \'d" +
|
||||
"eviceprofileinclude\': // FILTER: Device Profile Include\r\n " +
|
||||
" var deviceProfiles = value.split(\",\").map(function (v) { return parseIn" +
|
||||
"t(v); });\r\n if (deviceProfiles.length > 0) {\r\n " +
|
||||
" filters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // true if DeviceProfileId is included\r\n " +
|
||||
" return $.inArray(heldDeviceItem.DeviceProfile" +
|
||||
"Id, deviceProfiles) >= 0;\r\n });\r\n " +
|
||||
" }\r\n break;\r\n " +
|
||||
" case \'deviceprofileexclude\': // FILTER: Device Profile Exclude\r\n " +
|
||||
" var deviceProfiles = value.split(\",\").map(function (v" +
|
||||
") { return parseInt(v); });\r\n if (deviceProfiles." +
|
||||
"length > 0) {\r\n filters.push(function (heldDe" +
|
||||
"viceItem) {\r\n // true if DeviceProfileId " +
|
||||
"is excluded\r\n return $.inArray(heldDevice" +
|
||||
"Item.DeviceProfileId, deviceProfiles) < 0;\r\n " +
|
||||
"});\r\n }\r\n break;\r\n" +
|
||||
" }\r\n });\r\n\r\n if (fi" +
|
||||
"lters.length > 0)\r\n itemFilters = filters;\r\n " +
|
||||
" else\r\n itemFilters = null;\r\n }\r\n " +
|
||||
" }\r\n\r\n function connectionError() {\r\n try {\r\n " +
|
||||
" $(\'body\').addClass(\'status-error\');\r\n } catch " +
|
||||
"(e) {\r\n // Ignore\r\n }\r\n\r\n windo" +
|
||||
"w.setTimeout(function () {\r\n window.location.reload(true);\r\n " +
|
||||
" }, 10000);\r\n }\r\n\r\n // Helpers\r\n " +
|
||||
"function rotateArray(koArray, element) {\r\n var items = koArray();" +
|
||||
"\r\n\r\n if (items.length <= 1)\r\n return 0;\r\n\r\n " +
|
||||
" if (element.height() < (element.parent().height() - 30)) {\r\n\r\n " +
|
||||
" if (findUnsortedArrayTopIndex(items) !== 0)\r\n " +
|
||||
" koArray.sort(sortFunction);\r\n\r\n // Don\'t rotate if small " +
|
||||
"& sorted correctly\r\n return;\r\n }\r\n\r\n " +
|
||||
" // Move Last Item to Top\r\n var item = koArray.pop();\r\n " +
|
||||
" koArray.unshift(item);\r\n }\r\n function removeIte" +
|
||||
"mFromArray(koArray, UserId) {\r\n var items = koArray();\r\n " +
|
||||
" for (var i = 0; i < items.length; i++) {\r\n if (items[i" +
|
||||
"].UserId == UserId) {\r\n koArray.splice(i, 1);\r\n " +
|
||||
" items = koArray();\r\n i--;\r\n " +
|
||||
" }\r\n }\r\n }\r\n function findUnsortedArrayT" +
|
||||
"opIndex(items) {\r\n // Only one Item\r\n if (items.le" +
|
||||
"ngth <= 1)\r\n return 0;\r\n\r\n for (var i = 1; i <" +
|
||||
" items.length; i++) {\r\n var s = sortFunction(items[i - 1], it" +
|
||||
"ems[i]);\r\n if (s > 0)\r\n return i;\r\n " +
|
||||
" }\r\n\r\n return 0;\r\n }\r\n function" +
|
||||
" findSortedInsertIndex(koArray, heldDeviceItem) {\r\n var items = k" +
|
||||
"oArray();\r\n var startIndex = findUnsortedArrayTopIndex(items);\r\n " +
|
||||
" for (var i = startIndex; i < items.length; i++) {\r\n " +
|
||||
" var s = sortFunction(heldDeviceItem, items[i]);\r\n if (s" +
|
||||
" <= 0)\r\n return i;\r\n }\r\n if" +
|
||||
" (startIndex !== 0) {\r\n for (var i = 0; i < startIndex; i++) " +
|
||||
"{\r\n var s = sortFunction(heldDeviceItem, items[i]);\r\n " +
|
||||
" if (s <= 0)\r\n return i;\r\n " +
|
||||
" }\r\n return startIndex;\r\n } else {\r" +
|
||||
"\n return -1;\r\n }\r\n }\r\n f" +
|
||||
"unction sortFunction(l, r) {\r\n return l.UserIdFriendly.toLowerCas" +
|
||||
"e() == r.UserIdFriendly.toLowerCase() ? 0 : (l.UserIdFriendly.toLowerCase() < r." +
|
||||
"UserIdFriendly.toLowerCase() ? -1 : 1)\r\n }\r\n function isIn" +
|
||||
"Process(i) {\r\n return !i.ReadyForReturn && !i.WaitingForUserActio" +
|
||||
"n;\r\n }\r\n function isReadyForReturn(i) {\r\n r" +
|
||||
"eturn i.ReadyForReturn && !i.WaitingForUserAction;\r\n }\r\n f" +
|
||||
"unction isWaitingForUserAction(i) {\r\n return i.WaitingForUserActi" +
|
||||
"on;\r\n }\r\n function getQueryStringParameters() {\r\n\r\n " +
|
||||
" if (window.location.search.length === 0)\r\n return nu" +
|
||||
"ll;\r\n\r\n var params = {};\r\n window.location.search." +
|
||||
"substr(1).split(\"&\").forEach(function (pair) {\r\n if (pair ===" +
|
||||
" \"\") return;\r\n var parts = pair.split(\"=\");\r\n " +
|
||||
" params[parts[0]] = parts[1] && decodeURIComponent(parts[1].replace(/\\+/g, \" " +
|
||||
"\"));\r\n });\r\n return params;\r\n }\r\n\r\n " +
|
||||
" init();\r\n });\r\n </script>\r\n</body>\r\n</html>\r\n");
|
||||
"ub.qs = { Noticeboard: document.body.dataset.hubname };\r\n $.conne" +
|
||||
"ction.hub.error(function (error) {\r\n console.log(\'Server conn" +
|
||||
"ection error: \' + error);\r\n });\r\n $.connection.hub" +
|
||||
".disconnected(connectionError);\r\n\r\n // Start Connection\r\n " +
|
||||
" $.connection.hub.start().fail(connectionError).done(function () { loadDa" +
|
||||
"ta(); });\r\n }\r\n\r\n // Called after SignalR is connected\r\n " +
|
||||
" async function loadData() {\r\n\r\n const body = new FormDa" +
|
||||
"ta();\r\n body.append(\'__RequestVerificationToken\', document.body.d" +
|
||||
"ataset.antiforgery);\r\n const response = await fetch(document.body" +
|
||||
".dataset.dataurl, {\r\n method: \'POST\',\r\n bo" +
|
||||
"dy: body\r\n });\r\n const data = await response.json(" +
|
||||
");\r\n\r\n var inProcess = [];\r\n var readyForReturn = " +
|
||||
"[];\r\n var waitingForUserAction = [];\r\n\r\n data.filt" +
|
||||
"er(function (heldDeviceItem) {\r\n return includeItem(heldDevic" +
|
||||
"eItem)\r\n }).forEach(function (heldDeviceItem) {\r\n " +
|
||||
" if (isWaitingForUserAction(heldDeviceItem))\r\n waiting" +
|
||||
"ForUserAction.push(heldDeviceItem);\r\n else if (isReadyForRetu" +
|
||||
"rn(heldDeviceItem))\r\n readyForReturn.push(heldDeviceItem)" +
|
||||
";\r\n else if (isInProcess(heldDeviceItem))\r\n " +
|
||||
" inProcess.push(heldDeviceItem);\r\n });\r\n\r\n in" +
|
||||
"Process.sort(sortFunction);\r\n readyForReturn.sort(sortFunction);\r" +
|
||||
"\n waitingForUserAction.sort(sortFunction);\r\n\r\n vie" +
|
||||
"wModel = new noticeboardViewModel(inProcess, readyForReturn, waitingForUserActio" +
|
||||
"n);\r\n\r\n ko.applyBindings(viewModel);\r\n viewModel.i" +
|
||||
"nitialized = true;\r\n\r\n $(\'body\').removeClass(\'status-connecting\')" +
|
||||
";\r\n\r\n window.setTimeout(scheduleRotation, rotateSpeed);\r\n " +
|
||||
" }\r\n\r\n // Called by SignalR\r\n function updateHeldDevice" +
|
||||
"(updates) {\r\n if (viewModel) {\r\n\r\n $.each(upda" +
|
||||
"tes, function (UserId, heldDeviceItem) {\r\n // Remove Exis" +
|
||||
"ting\r\n removeItem(UserId);\r\n\r\n // " +
|
||||
"Add Item\r\n addItem(heldDeviceItem);\r\n " +
|
||||
"});\r\n }\r\n }\r\n\r\n function removeItem(UserId)" +
|
||||
" {\r\n removeItemFromArray(viewModel.inProcess, UserId);\r\n " +
|
||||
" removeItemFromArray(viewModel.readyForReturn, UserId);\r\n r" +
|
||||
"emoveItemFromArray(viewModel.waitingForUserAction, UserId);\r\n }\r\n\r\n " +
|
||||
" function addItem(heldDeviceItem) {\r\n if (heldDeviceItem" +
|
||||
" !== null &&\r\n heldDeviceItem !== undefined &&\r\n " +
|
||||
" includeItem(heldDeviceItem)) {\r\n\r\n var array;\r\n\r\n " +
|
||||
" if (isWaitingForUserAction(heldDeviceItem))\r\n " +
|
||||
" array = viewModel.waitingForUserAction;\r\n else if (isRead" +
|
||||
"yForReturn(heldDeviceItem))\r\n array = viewModel.readyForR" +
|
||||
"eturn;\r\n else if (isInProcess(heldDeviceItem))\r\n " +
|
||||
" array = viewModel.inProcess;\r\n\r\n if (array().lengt" +
|
||||
"h === 0) {\r\n array.push(heldDeviceItem);\r\n " +
|
||||
" } else {\r\n var index = findSortedInsertIndex(array, " +
|
||||
"heldDeviceItem);\r\n if (index === -1)\r\n " +
|
||||
" array.push(heldDeviceItem);\r\n else\r\n " +
|
||||
" array.splice(index, 0, heldDeviceItem);\r\n }\r\n" +
|
||||
" }\r\n }\r\n\r\n function rotateArrays() {\r\n " +
|
||||
" rotateArray(viewModel.inProcess, $inProcessList);\r\n ro" +
|
||||
"tateArray(viewModel.readyForReturn, $readyForReturnList);\r\n rotat" +
|
||||
"eArray(viewModel.waitingForUserAction, $waitingForUserActionList);\r\n " +
|
||||
"}\r\n\r\n function scheduleRotation() {\r\n rotateArrays();\r" +
|
||||
"\n\r\n window.setTimeout(scheduleRotation, rotateSpeed);\r\n " +
|
||||
" }\r\n\r\n function includeItem(heldDeviceItem) {\r\n if (i" +
|
||||
"temFilters == null || itemFilters.length == 0)\r\n return true;" +
|
||||
"\r\n\r\n return itemFilters.reduce(function (previousValue, currentVa" +
|
||||
"lue, index, array) {\r\n if (previousValue === false)\r\n " +
|
||||
" return false;\r\n return currentValue(heldDevic" +
|
||||
"eItem);\r\n }, true);\r\n }\r\n\r\n function setThe" +
|
||||
"me(theme) {\r\n if (!!fixedTheme)\r\n return;\r\n\r\n " +
|
||||
" var $body = $(document.body);\r\n\r\n // Existing clas" +
|
||||
"ses\r\n var c = $body.attr(\'class\').split(\' \');\r\n //" +
|
||||
" Remove existing theme\r\n c = $.grep(c, function (i) { return (i.i" +
|
||||
"ndexOf(\'theme-\') !== 0) });\r\n\r\n c.push(\'theme-\' + theme);\r\n\r\n " +
|
||||
" $body.attr(\'class\', c.join(\' \'));\r\n }\r\n\r\n func" +
|
||||
"tion monitorMouseMove() {\r\n var token = null,\r\n " +
|
||||
" $body = $(document.body);\r\n\r\n $body.mousemove(function () {\r\n " +
|
||||
" if (!!token)\r\n window.clearTimeout(toke" +
|
||||
"n);\r\n else if ($body.css(\'cursor\') == \'none\')\r\n " +
|
||||
" $body.css(\'cursor\', \'auto\');\r\n\r\n token = window.set" +
|
||||
"Timeout(function () {\r\n $body.css(\'cursor\', \'none\');\r\n " +
|
||||
" token = null;\r\n }, 3500);\r\n " +
|
||||
" });\r\n\r\n }\r\n\r\n function applyQueryString() {\r\n " +
|
||||
" var queryStringParameters = getQueryStringParameters();\r\n\r\n " +
|
||||
" if (queryStringParameters !== null) {\r\n var filters = [];\r\n\r" +
|
||||
"\n $.each(queryStringParameters, function (key, value) {\r\n " +
|
||||
" switch (key.toLowerCase()) {\r\n ca" +
|
||||
"se \'components\':\r\n const showComponents = value.s" +
|
||||
"plit(\",\");\r\n if (showComponents.length > 0) {\r\n " +
|
||||
" const components = [\'inProcess\', \'readyForRetu" +
|
||||
"rn\', \'waitingForUserAction\'];\r\n components.fo" +
|
||||
"rEach(function (component) {\r\n if (!showC" +
|
||||
"omponents.includes(component)) {\r\n $(" +
|
||||
"\'body\').addClass(\'hide-\' + component);\r\n " +
|
||||
"}\r\n });\r\n }\r\n " +
|
||||
" break;\r\n case \'theme\':" +
|
||||
" // THEME\r\n setTheme(value);\r\n " +
|
||||
" fixedTheme = value;\r\n break;\r\n " +
|
||||
" case \'deviceaddressinclude\': // FILTER: Device Address Inc" +
|
||||
"lude\r\n var deviceAddresses = value.split(\",\").map" +
|
||||
"(function (v) { return v.toLowerCase(); });\r\n if " +
|
||||
"(deviceAddresses.length > 0) {\r\n filters.push" +
|
||||
"(function (heldDeviceItem) {\r\n // false i" +
|
||||
"f DeviceAddressShortName is null\r\n if (!h" +
|
||||
"eldDeviceItem.DeviceAddressShortName)\r\n " +
|
||||
" return false;\r\n\r\n // true if DeviceAdd" +
|
||||
"ressShortName is included\r\n return $.inAr" +
|
||||
"ray(heldDeviceItem.DeviceAddressShortName.toLowerCase(), deviceAddresses) >= 0;\r" +
|
||||
"\n });\r\n }\r\n " +
|
||||
" break;\r\n case \'deviceadd" +
|
||||
"ressexclude\': // FILTER: Device Address Exclude\r\n " +
|
||||
" var deviceAddresses = value.split(\",\").map(function (v) { return v.toLowerCase(" +
|
||||
"); });\r\n if (deviceAddresses.length > 0) {\r\n " +
|
||||
" filters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // true if DeviceAddressShortName is null\r\n " +
|
||||
" if (!heldDeviceItem.DeviceAddressShortName)\r" +
|
||||
"\n return true;\r\n\r\n " +
|
||||
" // true if DeviceAddressShortName is excluded\r\n " +
|
||||
" return $.inArray(heldDeviceItem.DeviceAddressShortNa" +
|
||||
"me.toLowerCase(), deviceAddresses) < 0;\r\n });" +
|
||||
"\r\n }\r\n break;\r\n " +
|
||||
" case \'deviceprofileinclude\': // FILTER: Device Profile " +
|
||||
"Include\r\n var deviceProfiles = value.split(\",\").m" +
|
||||
"ap(function (v) { return parseInt(v); });\r\n if (d" +
|
||||
"eviceProfiles.length > 0) {\r\n filters.push(fu" +
|
||||
"nction (heldDeviceItem) {\r\n // true if De" +
|
||||
"viceProfileId is included\r\n return $.inAr" +
|
||||
"ray(heldDeviceItem.DeviceProfileId, deviceProfiles) >= 0;\r\n " +
|
||||
" });\r\n }\r\n " +
|
||||
" break;\r\n case \'deviceprofileexclude\': // FILTE" +
|
||||
"R: Device Profile Exclude\r\n var deviceProfiles = " +
|
||||
"value.split(\",\").map(function (v) { return parseInt(v); });\r\n " +
|
||||
" if (deviceProfiles.length > 0) {\r\n " +
|
||||
" filters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // true if DeviceProfileId is excluded\r\n " +
|
||||
" return $.inArray(heldDeviceItem.DeviceProfileId, deviceProfiles) < 0;\r\n " +
|
||||
" });\r\n }\r\n " +
|
||||
" break;\r\n }\r\n }" +
|
||||
");\r\n\r\n if (filters.length > 0)\r\n itemF" +
|
||||
"ilters = filters;\r\n else\r\n itemFilters" +
|
||||
" = null;\r\n }\r\n }\r\n\r\n function connectionErr" +
|
||||
"or() {\r\n try {\r\n $(\'body\').addClass(\'status-er" +
|
||||
"ror\');\r\n } catch (e) {\r\n // Ignore\r\n " +
|
||||
" }\r\n\r\n window.setTimeout(function () {\r\n " +
|
||||
"window.location.reload(true);\r\n }, 10000);\r\n }\r\n\r\n " +
|
||||
" // Helpers\r\n function rotateArray(koArray, element) {\r\n " +
|
||||
" var items = koArray();\r\n\r\n if (items.length <= 1)\r\n " +
|
||||
" return 0;\r\n\r\n if (element.height() < (element.par" +
|
||||
"ent().height() - 30)) {\r\n\r\n if (findUnsortedArrayTopIndex(ite" +
|
||||
"ms) !== 0)\r\n koArray.sort(sortFunction);\r\n\r\n " +
|
||||
" // Don\'t rotate if small & sorted correctly\r\n return;\r" +
|
||||
"\n }\r\n\r\n // Move Last Item to Top\r\n " +
|
||||
"var item = koArray.pop();\r\n koArray.unshift(item);\r\n }" +
|
||||
"\r\n function removeItemFromArray(koArray, UserId) {\r\n v" +
|
||||
"ar items = koArray();\r\n for (var i = 0; i < items.length; i++) {\r" +
|
||||
"\n if (items[i].UserId == UserId) {\r\n k" +
|
||||
"oArray.splice(i, 1);\r\n items = koArray();\r\n " +
|
||||
" i--;\r\n }\r\n }\r\n }\r\n " +
|
||||
" function findUnsortedArrayTopIndex(items) {\r\n // Only one It" +
|
||||
"em\r\n if (items.length <= 1)\r\n return 0;\r\n\r\n " +
|
||||
" for (var i = 1; i < items.length; i++) {\r\n var s" +
|
||||
" = sortFunction(items[i - 1], items[i]);\r\n if (s > 0)\r\n " +
|
||||
" return i;\r\n }\r\n\r\n return 0;\r\n " +
|
||||
" }\r\n function findSortedInsertIndex(koArray, heldDeviceItem) " +
|
||||
"{\r\n var items = koArray();\r\n var startIndex = find" +
|
||||
"UnsortedArrayTopIndex(items);\r\n for (var i = startIndex; i < item" +
|
||||
"s.length; i++) {\r\n var s = sortFunction(heldDeviceItem, items" +
|
||||
"[i]);\r\n if (s <= 0)\r\n return i;\r\n " +
|
||||
" }\r\n if (startIndex !== 0) {\r\n for (" +
|
||||
"var i = 0; i < startIndex; i++) {\r\n var s = sortFunction(" +
|
||||
"heldDeviceItem, items[i]);\r\n if (s <= 0)\r\n " +
|
||||
" return i;\r\n }\r\n return startI" +
|
||||
"ndex;\r\n } else {\r\n return -1;\r\n " +
|
||||
" }\r\n }\r\n function sortFunction(l, r) {\r\n re" +
|
||||
"turn l.UserIdFriendly.toLowerCase() == r.UserIdFriendly.toLowerCase() ? 0 : (l.U" +
|
||||
"serIdFriendly.toLowerCase() < r.UserIdFriendly.toLowerCase() ? -1 : 1)\r\n " +
|
||||
" }\r\n function isInProcess(i) {\r\n return !i.ReadyFor" +
|
||||
"Return && !i.WaitingForUserAction;\r\n }\r\n function isReadyF" +
|
||||
"orReturn(i) {\r\n return i.ReadyForReturn && !i.WaitingForUserActio" +
|
||||
"n;\r\n }\r\n function isWaitingForUserAction(i) {\r\n " +
|
||||
" return i.WaitingForUserAction;\r\n }\r\n function getQuer" +
|
||||
"yStringParameters() {\r\n\r\n if (window.location.search.length === 0" +
|
||||
")\r\n return null;\r\n\r\n var params = {};\r\n " +
|
||||
" window.location.search.substr(1).split(\"&\").forEach(function (pair) {\r\n" +
|
||||
" if (pair === \"\") return;\r\n var parts = pa" +
|
||||
"ir.split(\"=\");\r\n params[parts[0]] = parts[1] && decodeURIComp" +
|
||||
"onent(parts[1].replace(/\\+/g, \" \"));\r\n });\r\n retur" +
|
||||
"n params;\r\n }\r\n\r\n init();\r\n });\r\n </script>\r\n</b" +
|
||||
"ody>\r\n</html>\r\n");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user