ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,9 @@
//
// Amasty Admin Actions Log
// ____________________________________________
@import "module/_amtags";
@import "module/_history";
@import "module/_system";
@import "module/_table";
@import "module/_actions-log";
@@ -0,0 +1,66 @@
//
// Amasty Actions Log Page
// ____________________________________________
//
// Variables
// _____________________________________________
@amaudit-edit-icon__background: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMC4wOSAwTDguNzI3IDEuMzczbDEuOTEgMS45MkwxMiAxLjkyMSAxMC4wOSAwek0xLjM2IDguNzg0bDEuOTEgMS45MiA2LjU0OC02LjU4Ny0xLjkwOS0xLjkyLTYuNTUgNi41ODd6TTAgMTJsMi4zMTMtLjYxTC42MDkgOS42NzMgMCAxMnoiIGZpbGw9IiNBRjhBNzMiLz48L3N2Zz4=') no-repeat center;
@amaudit-new-icon__background: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMS45ODkgNC41NTVhLjIzNi4yMzYgMCAwMC0uMjIyLS4xNjhINy41MzJMNi4yMjIuMTY4QS4yMzUuMjM1IDAgMDA2IDBjLS4xIDAtLjE5LjA2OS0uMjIxLjE2OEw0LjQ2IDQuMzg3SC4yMzNhLjIzMy4yMzMgMCAwMC0uMjIyLjE2OGMtLjAzLjEuMDAzLjIxLjA4NC4yNzNsMy40MjIgMi42MS0xLjMxOSA0LjI0M2MtLjAzLjEuMDAzLjIxLjA4NS4yNzIuMDguMDYyLjE5Mi4wNjIuMjczIDBMNiA5LjMzNGwzLjQzNiAyLjYxOWEuMjIyLjIyMiAwIDAwLjI3MyAwIC4yNS4yNSAwIDAwLjA4Ni0uMjcyTDguNDc2IDcuNDM5bDMuNDI5LTIuNjFhLjI1My4yNTMgMCAwMC4wODQtLjI3NHoiIGZpbGw9IiNDRTk0RjMiLz48L3N2Zz4=') no-repeat center;
@amaudit-cache-icon__background: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTMuODUyIDUuMDk3YS41ODQuNTg0IDAgMDEtLjE5NC0uNzdsLjM5NS0uNzI3YS41MjcuNTI3IDAgMDEuNjU3LS4yNWwyLjI4OC45NWMuMjAzLjA5LjQzNS0uMDE5LjUyLS4yMzRMOC42ODIgMS4xMkExLjc3NiAxLjc3NiAwIDAxOS43MTIuMDk2Yy40NjgtLjE2NS45OC0uMTIgMS40MTcuMTQ5LjQzNy4yNjcuNzMuNzE0LjgyOSAxLjIyNi4xLjUxMi0uMDE2IDEuMDQyLS4zMjEgMS40NTdMOS44MTIgNS40N2EuNDQyLjQ0MiAwIDAwLjA3LjU5NGwxLjkyIDEuNjI2Yy4yMDQuMTc2LjI2LjQ3Ny4xMjMuNzI4bC0uMzk1LjcyN2EuNTE3LjUxNyAwIDAxLS43MjcuMjA2bC02Ljk1LTQuMjU0em02Ljc3LTMuODkzYS42NzguNjc4IDAgMDAtLjk1MS4yN2MtLjE5MS4zNTEtLjA3Ni44MDYuMjU1IDEuMDA4LjMzLjIwMy43Ni4wODEuOTUtLjI3YS43MzguNzM4IDAgMDAtLjI1NC0xLjAwOHpNLjQ5MyA4LjYwNEMxLjY0IDcuOTcxIDIuNjMgNi45MDYgMy4zNDkgNS45OTJsNi45NzQgNC4yNjljLS40MyAxLjEwNy0xLjM5NiAyLjczNy0yLjM1MyAzLjY1NWEuMzEuMzEgMCAwMS0uMzgxLjAzNGwtMS4wMTctLjYyMmEuNDMzLjQzMyAwIDAxLS4xOS0uNDMzbC4yNjktMS4zOWMuMDE3LS4wOS0uMDktLjE1NS0uMTU0LS4wOTRsLTEgLjk0MWEuMzgxLjM4MSAwIDAxLS40NS4wNDNsLTEuMjI5LS43NTJhLjQzMy40MzMgMCAwMS0uMTktLjQzNGwuMTkzLTEuMDE4Yy4wMTctLjA5LS4wOS0uMTU1LS4xNTQtLjA5NWwtLjcyNC42OTNhLjM4MS4zODEgMCAwMS0uNDQ5LjA0M0wuMTkgOS40MjJjLS4yNi0uMTYtLjI1LS41NTUuMDE1LS42OTNsLjI4OS0uMTI1eiIgZmlsbD0iI0U3Q0E3RiIvPjwvc3ZnPg==') no-repeat center;
@amaudit-delete-icon__background: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAiIGhlaWdodD0iMTAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0wIDEuNjU3TDMuMzQzIDUgMCA4LjM0NCAxLjY1NiAxMCA1IDYuNjU2IDguMzQzIDEwIDEwIDguMzQ0IDYuNjU2IDUgMTAgMS42NTcgOC4zNDMgMCA1IDMuMzQ0IDEuNjU2IDAgMCAxLjY1NyIgZmlsbD0iI0YxQjZCOSIvPjwvc3ZnPg==') no-repeat center;
@amaudit-export-icon__background: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMC4zODcgNy44Mzh2Mi42MDFIMS42MTNWNy44MzhIMFYxMmgxMlY3LjgzOGgtMS42MTN6TTYgOC4zMjVsNC4yMzUtNC4xNjNINy41ODhWMEg0LjQxMnY0LjE2M0gxLjc2NUw2IDguMzI2eiIgZmlsbD0iIzdCRTA5OCIvPjwvc3ZnPg==') no-repeat center;
@amaudit-restore-icon__background: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik02LjAwNCAwYTUuOTc0IDUuOTc0IDAgMDAtNC4yNCAxLjc2MkwxIDEgMCA1LjI1IDQgNCAyLjgzNyAyLjgzNUE0LjQ0IDQuNDQgMCAwMTYuMDA0IDEuNSA0LjUwNSA0LjUwNSAwIDAxMTAuNTA3IDZjMCAyLjQ4Mi0yLjAyIDQuNS00LjUwMyA0LjVhNC40OTYgNC40OTYgMCAwMS00LjI0LTNILjIwM2E1Ljk5IDUuOTkgMCAwMDUuOCA0LjVBNS45OTQgNS45OTQgMCAwMDEyIDZjMC0zLjMxNS0yLjY4LTYtNS45OTYtNnpNNi41IDNhLjUuNSAwIDAxLjUuNXYzLjA0NGEuNzYuNzYgMCAwMS0uNDAyLjY3TDMuOTI0IDguNjRhLjQ5Ny40OTcgMCAxMS0uNDYzLS44OEw2IDYuNDM4VjMuNWEuNS41IDAgMDEuNS0uNXoiIGZpbGw9IiM3NzlCRkEiLz48L3N2Zz4=') no-repeat center;
//
// Common
// ----------------------------------------------
& when (@media-common = true) {
.amaudit-actionslog-index .data-grid-cell-content {
&.-type {
position: relative;
padding-left: 20px;
}
&.-type:before {
position: absolute;
top: 50%;
left: 0;
width: 12px;
height: 12px;
content: '';
transform: translateY(-50%);
}
&.-edit:before {
background: @amaudit-edit-icon__background;
}
&.-new:before {
background: @amaudit-new-icon__background;
}
&.-cache:before {
background: @amaudit-cache-icon__background;
}
&.-delete:before {
background: @amaudit-delete-icon__background;
}
&.-export:before {
background: @amaudit-export-icon__background;
}
&.-restore:before {
background: @amaudit-restore-icon__background;
}
}
.amaudit-log-modal .amaudit-table-container.-primary {
max-width: 100%;
}
}
@@ -0,0 +1,241 @@
//
// Amasty Tags Component
// ____________________________________________
//
// Variables
// _____________________________________________
@am-link-color: #222;
@am-border: #aaa;
@am-background: #dadada;
@am-color: #212121;
@am-border-color: #6d95e0;
@am-state-border: #999;
@am-hover-background: #bbcef1;
//
// Common
// ----------------------------------------------
& when (@media-common = true) {
ul.tagit {
& {
background: inherit;
border: 1px solid #C6C6C6;
margin-right: inherit;
overflow: auto;
padding: 1px 5px;
}
li {
display: block;
float: left;
margin: 2px 5px 2px 0;
}
li.tagit-choice {
& {
border-radius: 6px;
background-color: #DEE7F8 !important;
background: none;
border: 1px solid #CAD8F3;
font-weight: normal;
line-height: inherit;
position: relative;
}
a.tagit-label {
cursor: pointer;
text-decoration: none;
}
.tagit-close {
cursor: pointer;
line-height: 17px;
margin-top: -8px;
position: absolute;
right: .4em;
top: 50%;
}
.tagit-close .text-icon {
color: #777;
display: inline;
font-family: arial, sans-serif;
font-size: 16px;
line-height: 16px;
}
input {
display: block;
float: left;
margin: 2px 5px 2px 0;
}
.tagit-label {
&:not(a) {
color: #555;
}
}
a.tagit-close {
text-decoration: none;
}
a.tagit-close .text-icon {
&:hover {
.lib-css(color, @am-link-color);
}
}
.ui-icon {
display: none;
}
&:hover {
.lib-css(background-color, @am-hover-background);
.lib-css(border-color, @am-border-color);
}
a.tagLabel {
&:hover {
.lib-css(color, @am-link-color);
}
}
}
li.tagit-choice-read-only {
padding: .2em .5em;
}
li.tagit-choice-editable {
padding: .2em 18px .2em .5em;
}
li.tagit-new {
padding: .25em 4px .25em 0;
width: 250px;
}
input[type="text"] {
box-shadow: none;
box-sizing: border-box;
background-color: inherit;
background: none;
border: none;
color: #333;
margin: 0;
outline: none;
padding: 0;
width: inherit;
}
li.tagit-choice.remove {
.lib-css(background-color, @am-hover-background);
.lib-css(border-color, @am-border-color);
}
}
input.tagit-hidden-field {
display: none;
}
.ui-widget {
font-size: 1.1em;
}
.tagit-autocomplete.ui-autocomplete {
cursor: default;
position: absolute;
width: 1px;
}
.tagit-autocomplete.ui-menu {
& {
display: block;
float: left;
list-style: none;
margin: 0;
padding: 2px;
}
.ui-menu {
margin-top: -3px;
}
.ui-menu-item {
clear: left;
float: left;
margin: 0;
padding: 0;
width: 100%;
zoom: 1;
}
.ui-menu-item a {
display: block;
line-height: 1.5;
padding: .2em .4em;
text-decoration: none;
zoom: 1;
}
}
.tagit-autocomplete {
.ui-menu {
.ui-menu-item a.ui-state-hover {
font-weight: normal;
margin: -1px;
}
.ui-menu-item a.ui-state-active {
font-weight: normal;
margin: -1px;
}
}
.ui-corner-all {
border-radius: 4px;
}
.ui-state-hover {
.lib-css(background, @am-background);
.lib-css(border, 1px solid @am-state-border);
.lib-css(color, @am-color);
font-weight: normal;
}
.ui-state-focus {
.lib-css(background, @am-background);
.lib-css(border, 1px solid @am-state-border);
.lib-css(color, @am-color);
font-weight: normal;
}
.ui-state-active {
.lib-css(border, 1px solid @am-border);
}
.ui-widget-content {
.lib-css(border, 1px solid @am-border);
}
}
.tagit-autocomplete.ui-widget-content {
background: #fff 50% 50% repeat-x;
.lib-css(border, 1px solid @am-border);
.lib-css(color, @am-link-color);
}
.tagit-autocomplete.ui-corner-all {
border-radius: 4px;
}
.tagit {
.ui-helper-hidden-accessible {
clip: rect(1px, 1px, 1px, 1px);
position: absolute !important;
}
}
}
@@ -0,0 +1,13 @@
//
// Amasty Admin Actions Log History Styles
// ____________________________________________
//
// Common
// --------------------------------------------
& when (@media-common = true) {
.amaudit-visithistory-index .action-menu-item {
cursor: pointer;
}
}
@@ -0,0 +1,27 @@
//
// Amasty Admin Actions Log Configuration Styles
// ____________________________________________
//
// Common
// --------------------------------------------
& when (@media-common = true) {
.amactionslog-input + .ui-widget {
.tagit-new {
margin: 0;
padding: 0;
}
.ui-autocomplete-input {
padding: .5rem;
height: 29px;
font-size: 14px;
line-height: 19px;
}
.tagit-choice-editable {
padding: .1em 1.8em .1em .5em;
}
}
}
@@ -0,0 +1,156 @@
//
// Amasty Admin Actions Log Table Styles
// ____________________________________________
@amaudit-modal-padding__height: 271px;
//
// Common
// --------------------------------------------
& when (@media-common = true) {
.amaudit-table-container {
&.-primary {
max-width: 70%;
}
.amaudit-title {
white-space: break-spaces;
word-break: break-all;
}
.amaudit-pre {
white-space: break-spaces;
font-family: inherit;
word-break: break-all;
}
ins {
background: #dfdddd;
color: #008000;
text-decoration: none;
}
del {
background: #fddddd;
color: #ff0000;
text-decoration: none;
}
.amaudit-thead {
display: table;
width: 100%;
table-layout: fixed;
}
.amaudit-tbody {
display: block;
overflow-y: auto;
height: ~'calc(100vh - @{amaudit-modal-padding__height})';
table-layout: fixed;
}
.amaudit-tbody::-webkit-scrollbar {
width: 4px;
}
.amaudit-tbody::-webkit-scrollbar-track {
width: 4px;
background: #fff;
}
.amaudit-tbody::-webkit-scrollbar-thumb {
border-radius: 4px;
background: rgba(51, 51, 51, .3);
}
.amaudit-thead .amaudit-tr {
border-radius: 3px;
box-shadow: 0 2px 2px ~'rgb(0 63 113 / 10%)';
}
.amaudit-tbody .amaudit-tr {
display: table;
width: 100%;
}
.amaudit-th {
padding: 10px;
border-bottom: none;
text-align: left;
font-weight: 600;
font-size: 1.4rem;
}
.amaudit-td {
padding: 1.5rem 0 1.5rem 1.5rem;
border-bottom: 1px solid #ececec;
}
&.-log .amaudit-td {
padding: 1.5rem 0 1.5rem 1rem;
}
.amaudit-th:first-child,
.amaudit-td:first-child {
padding-left: 10px;
}
.amaudit-th.-wide,
.amaudit-td.-wide {
width: 35%;
}
.amaudit-td.-solid {
width: 100%;
font-size: 17px;
font-weight: 500;
text-align: center;
}
.amaudit-td.-url {
word-break: break-all;
}
.amaudit-th.-index,
.amaudit-td.-index {
width: 32px;
}
.amaudit-th.-duration,
.amaudit-td.-duration {
width: 170px;
}
}
.amaudit-secondary-table {
& {
align-self: baseline;
max-width: ~'calc(30% - 30px)';
margin-right: 30px;
}
.admin__table-secondary {
border-radius: 3px;
}
.amaudit-td {
font-weight: 600;
}
.amaudit-th {
color: #5a5552;
}
.amaudit-tr.-dark {
background: #f6f6f6;
}
}
.amaudit-tables-container .admin__fieldset,
.amaudit-tables-container {
display: flex;
justify-content: space-between;
}
}
@@ -0,0 +1,38 @@
define([
'jquery',
'mage/backend/notification'
], function ($, notification) {
'use strict';
return {
pageSelector: '.page-main-actions',
containerSelector: '[data-role="messages"]',
css: {
success: 'message-success success',
container: 'messages'
},
add: function (text, isError, selector) {
var wrapper;
notification().clear();
notification().add({
error: isError,
message: text,
insertMethod: function (message) {
wrapper = $(message);
if (!isError) {
wrapper.addClass(this.css.container).children().addClass(this.css.success);
}
$(selector || this.pageSelector).after(wrapper);
}.bind(this)
});
},
clear: function () {
notification().clear();
}
};
});
@@ -0,0 +1,76 @@
define([
'jquery',
'Magento_Ui/js/modal/modal-component',
'mage/translate'
], function ($, Component, $t) {
'use strict';
return Component.extend({
defaults: {
historyUrl: '',
data: {},
text: {
minutes: $t('minutes'),
hours: $t('hours'),
seconds: $t('seconds')
}
},
/**
* @inheritDoc
* @returns {Object}
*/
initObservable: function () {
return this._super()
.observe([
'data'
]);
},
/**
* Get Log History
*
* @param {string} actionName
* @param {string} id
*/
getHistory: function (actionName, id) {
$.ajax({
showLoader: true,
url: this.historyUrl,
data: { id: id },
type: 'GET',
dataType: 'json'
}).done(function (response) {
this.data(response);
this.openModal();
}.bind(this));
},
/**
* Get Duration
*
* @param {string} timestamp
* @returns {string}
*/
getDuration: function (timestamp) {
var hours = Math.floor(timestamp / 60 / 60),
minutes = Math.floor(timestamp / 60) - (hours * 60),
seconds = timestamp % 60,
duration = [];
if (hours) {
duration.push(hours + ' ' + this.text.hours);
}
if (minutes) {
duration.push(minutes + ' ' + this.text.minutes);
}
if (seconds) {
duration.push(seconds + ' ' + this.text.seconds);
}
return duration.join(' ');
}
});
});
@@ -0,0 +1,69 @@
/**
* Log Actions Preview Logic
*/
define([
'jquery',
'Magento_Ui/js/modal/modal-component',
'Amasty_AdminActionsLog/js/action/notification'
], function ($, Component, notification) {
'use strict';
return Component.extend({
defaults: {
actionsLogUrl: '',
messageSelector: '.amaudit-log-modal .page-main-actions',
messages: {},
data: {}
},
/**
* @inheritDoc
* @returns {Object}
*/
initObservable: function () {
return this._super()
.observe([
'data',
'messages'
]);
},
/**
* Get Preview Data
*
* @param {string} actionName
* @param {string} id
* @returns {void}
*/
getPreviewData: function (actionName, id) {
$.ajax({
showLoader: true,
url: this.actionsLogUrl,
data: { element_id: id },
type: 'GET',
dataType: 'json'
}).done(function (response) {
if (response.isError) {
this.messages(response);
notification.add(response.message, response.isError, this.messageSelector);
} else {
notification.clear();
this.data(this.parseData(response.data));
}
this.openModal();
}.bind(this));
},
/**
* Parse Preview Data
*
* @param {Object} data
* @returns {array}
*/
parseData: function (data) {
return Object.keys(data).map(function (key) {
return data[key];
});
}
});
});
@@ -0,0 +1,40 @@
/**
* Log Actions Preview Logic
*/
define([
'jquery',
'uiElement',
'Amasty_AdminActionsLog/js/action/notification'
], function ($, Element, notification) {
'use strict';
return Element.extend({
defaults: {
data: {},
messages: {},
type: ''
},
/**
* @inheritDoc
* @returns {Object}
*/
initObservable: function () {
return this._super()
.observe([
'data',
'messages'
]);
},
initialize: function () {
this._super();
if (this.messages().isError) {
notification.add(this.messages().message, this.messages().isError);
}
return this;
}
});
});
@@ -0,0 +1,579 @@
/* phpcs:ignoreFile */
define([
'jquery',
'uiRegistry',
'Magento_Ui/js/lib/validation/validator'
], function ($, registry, validator) {
$.widget('ui.tagit', {
options: {
allowDuplicates : false,
caseSensitive : true,
fieldName : 'tags',
placeholderText : null, // Sets `placeholder` attr on input field.
readOnly : false, // Disables editing.
removeConfirmation: false, // Require confirmation to remove tags.
tagLimit : null, // Max number of tags allowed (null for unlimited).
// Used for autocomplete, unless you override `autocomplete.source`.
availableTags : [],
// Use to override or add any options to the autocomplete widget.
//
// By default, autocomplete.source will map to availableTags,
// unless overridden.
autocomplete: {},
// Shows autocomplete before the user even types anything.
showAutocompleteOnFocus: false,
// When enabled, quotes are unneccesary for inputting multi-word tags.
allowSpaces: true,
// The below options are for using a single field instead of several
// for our form values.
//
// When enabled, will use a single hidden field for the form,
// rather than one per tag. It will delimit tags in the field
// with singleFieldDelimiter.
//
// The easiest way to use singleField is to just instantiate tag-it
// on an INPUT element, in which case singleField is automatically
// set to true, and singleFieldNode is set to that element. This
// way, you don't need to fiddle with these options.
singleField: false,
// This is just used when preloading data from the field, and for
// populating the field with delimited tags as the user adds them.
singleFieldDelimiter: ',',
// Set this to an input DOM node to use an existing form field.
// Any text in it will be erased on init. But it will be
// populated with the text of tags as they are created,
// delimited by singleFieldDelimiter.
//
// If this is not set, we create an input node for it,
// with the name given in settings.fieldName.
singleFieldNode: null,
// Whether to animate tag removals or not.
animate: true,
// Optionally set a tabindex attribute on the input that gets
// created for tag-it.
tabIndex: null,
// Event callbacks.
beforeTagAdded : null,
afterTagAdded : null,
beforeTagRemoved : null,
afterTagRemoved : null,
onTagClicked : null,
onTagLimitExceeded : null,
// DEPRECATED:
//
// /!\ These event callbacks are deprecated and WILL BE REMOVED at some
// point in the future. They're here for backwards-compatibility.
// Use the above before/after event callbacks instead.
onTagAdded : null,
onTagRemoved: null,
// `autocomplete.source` is the replacement for tagSource.
tagSource: null
// Do not use the above deprecated options.
},
_create: function() {
// for handling static scoping inside callbacks
var that = this;
// There are 2 kinds of DOM nodes this widget can be instantiated on:
// 1. UL, OL, or some element containing either of these.
// 2. INPUT, in which case 'singleField' is overridden to true,
// a UL is created and the INPUT is hidden.
if (this.element.is('input')) {
this.tagList = $('<ul></ul>').insertAfter(this.element);
this.options.singleField = true;
this.options.singleFieldNode = this.element;
this.element.addClass('tagit-hidden-field');
} else {
this.tagList = this.element.find('ul, ol').andSelf().last();
}
this.tagInput = $('<input type="text" />').addClass('ui-widget-content');
if (this.options.readOnly) this.tagInput.attr('disabled', 'disabled');
if (this.options.tabIndex) {
this.tagInput.attr('tabindex', this.options.tabIndex);
}
if (this.options.placeholderText) {
this.tagInput.attr('placeholder', this.options.placeholderText);
}
if (!this.options.autocomplete.source) {
this.options.autocomplete.source = function(search, showChoices) {
var filter = search.term.toLowerCase();
var choices = $.grep(this.options.availableTags, function(element) {
// Only match autocomplete options that begin with the search term.
// (Case insensitive.)
return (element.toLowerCase().indexOf(filter) === 0);
});
if (!this.options.allowDuplicates) {
choices = this._subtractArray(choices, this.assignedTags());
}
showChoices(choices);
};
}
if (this.options.showAutocompleteOnFocus) {
this.tagInput.focus(function(event, ui) {
that._showAutocomplete();
});
if (typeof this.options.autocomplete.minLength === 'undefined') {
this.options.autocomplete.minLength = 0;
}
}
// Bind autocomplete.source callback functions to this context.
if ($.isFunction(this.options.autocomplete.source)) {
this.options.autocomplete.source = $.proxy(this.options.autocomplete.source, this);
}
// DEPRECATED.
if ($.isFunction(this.options.tagSource)) {
this.options.tagSource = $.proxy(this.options.tagSource, this);
}
this.tagList
.addClass('tagit')
.addClass('ui-widget ui-widget-content ui-corner-all')
// Create the input field.
.append($('<li class="tagit-new"></li>').append(this.tagInput))
.click(function(e) {
var target = $(e.target);
if (target.hasClass('tagit-label')) {
var tag = target.closest('.tagit-choice');
if (!tag.hasClass('removed')) {
that._trigger('onTagClicked', e, {tag: tag, tagLabel: that.tagLabel(tag)});
}
} else {
// Sets the focus() to the input field, if the user
// clicks anywhere inside the UL. This is needed
// because the input field needs to be of a small size.
that.tagInput.focus();
}
});
// Single field support.
var addedExistingFromSingleFieldNode = false;
if (this.options.singleField) {
if (this.options.singleFieldNode) {
// Add existing tags from the input field.
var node = $(this.options.singleFieldNode);
var tags = node.val().split(this.options.singleFieldDelimiter);
node.val('');
$.each(tags, function(index, tag) {
that.createTag(tag, null, true);
addedExistingFromSingleFieldNode = true;
});
} else {
// Create our single field input after our list.
this.options.singleFieldNode = $('<input type="hidden" style="display:none;" value="" name="' + this.options.fieldName + '" />');
this.tagList.after(this.options.singleFieldNode);
}
}
// Add existing tags from the list, if any.
if (!addedExistingFromSingleFieldNode) {
this.tagList.children('li').each(function() {
if (!$(this).hasClass('tagit-new')) {
that.createTag($(this).text(), $(this).attr('class'), true);
$(this).remove();
}
});
}
// Events.
this.tagInput
.keydown(function(event) {
// Backspace is not detected within a keypress, so it must use keydown.
if (event.which == $.ui.keyCode.BACKSPACE && that.tagInput.val() === '') {
var tag = that._lastTag();
if (!that.options.removeConfirmation || tag.hasClass('remove')) {
// When backspace is pressed, the last tag is deleted.
that.removeTag(tag);
} else if (that.options.removeConfirmation) {
tag.addClass('remove ui-state-highlight');
}
} else if (that.options.removeConfirmation) {
that._lastTag().removeClass('remove ui-state-highlight');
}
// Comma/Space/Enter are all valid delimiters for new tags,
// except when there is an open quote or if setting allowSpaces = true.
// Tab will also create a tag, unless the tag input is empty,
// in which case it isn't caught.
if (
(event.which === $.ui.keyCode.COMMA && event.shiftKey === false) ||
event.which === $.ui.keyCode.ENTER ||
(
event.which == $.ui.keyCode.TAB &&
that.tagInput.val() !== ''
) ||
(
event.which == $.ui.keyCode.SPACE &&
that.options.allowSpaces !== true &&
(
$.trim(that.tagInput.val()).replace( /^s*/, '' ).charAt(0) != '"' ||
(
$.trim(that.tagInput.val()).charAt(0) == '"' &&
$.trim(that.tagInput.val()).charAt($.trim(that.tagInput.val()).length - 1) == '"' &&
$.trim(that.tagInput.val()).length - 1 !== 0
)
)
)
) {
// Enter submits the form if there's no text in the input.
if (!(event.which === $.ui.keyCode.ENTER && that.tagInput.val() === '')) {
event.preventDefault();
}
// Autocomplete will create its own tag from a selection and close automatically.
if (!(that.options.autocomplete.autoFocus && that.tagInput.data('autocomplete-open'))) {
that.tagInput.autocomplete('close');
that.createTag(that._cleanedInput());
}
}
}).blur(function(e){
// Create a tag when the element loses focus.
// If autocomplete is enabled and suggestion was clicked, don't add it.
if (!that.tagInput.data('autocomplete-open')) {
that.createTag(that._cleanedInput());
}
});
// Autocomplete.
if (this.options.availableTags || this.options.tagSource || this.options.autocomplete.source) {
var autocompleteOptions = {
select: function(event, ui) {
that.createTag(ui.item.value);
// Preventing the tag input to be updated with the chosen value.
return false;
}
};
$.extend(autocompleteOptions, this.options.autocomplete);
// tagSource is deprecated, but takes precedence here since autocomplete.source is set by default,
// while tagSource is left null by default.
autocompleteOptions.source = this.options.tagSource || autocompleteOptions.source;
this.tagInput.autocomplete(autocompleteOptions).bind('autocompleteopen.tagit', function(event, ui) {
that.tagInput.data('autocomplete-open', true);
}).bind('autocompleteclose.tagit', function(event, ui) {
that.tagInput.data('autocomplete-open', false);
});
this.tagInput.autocomplete('widget').addClass('tagit-autocomplete');
}
},
destroy: function() {
$.Widget.prototype.destroy.call(this);
this.element.unbind('.tagit');
this.tagList.unbind('.tagit');
this.tagInput.removeData('autocomplete-open');
this.tagList.removeClass([
'tagit',
'ui-widget',
'ui-widget-content',
'ui-corner-all',
'tagit-hidden-field'
].join(' '));
if (this.element.is('input')) {
this.element.removeClass('tagit-hidden-field');
this.tagList.remove();
} else {
this.element.children('li').each(function() {
if ($(this).hasClass('tagit-new')) {
$(this).remove();
} else {
$(this).removeClass([
'tagit-choice',
'ui-widget-content',
'ui-state-default',
'ui-state-highlight',
'ui-corner-all',
'remove',
'tagit-choice-editable',
'tagit-choice-read-only'
].join(' '));
$(this).text($(this).children('.tagit-label').text());
}
});
if (this.singleFieldNode) {
this.singleFieldNode.remove();
}
}
return this;
},
_cleanedInput: function() {
// Returns the contents of the tag input, cleaned and ready to be passed to createTag
return $.trim(this.tagInput.val().replace(/^"(.*)"$/, '$1'));
},
_lastTag: function() {
return this.tagList.find('.tagit-choice:last:not(.removed)');
},
_tags: function() {
return this.tagList.find('.tagit-choice:not(.removed)');
},
assignedTags: function() {
// Returns an array of tag string values
var that = this;
var tags = [];
if (this.options.singleField) {
tags = $(this.options.singleFieldNode).val().split(this.options.singleFieldDelimiter);
if (tags[0] === '') {
tags = [];
}
} else {
this._tags().each(function() {
tags.push(that.tagLabel(this));
});
}
return tags;
},
_updateSingleTagsField: function(tags) {
// Takes a list of tag string values, updates this.options.singleFieldNode.val to the tags delimited by this.options.singleFieldDelimiter
$(this.options.singleFieldNode).val(tags.join(this.options.singleFieldDelimiter)).trigger('change');
},
_subtractArray: function(a1, a2) {
var result = [];
for (var i = 0; i < a1.length; i++) {
if ($.inArray(a1[i], a2) == -1) {
result.push(a1[i]);
}
}
return result;
},
tagLabel: function(tag) {
// Returns the tag's string label.
if (this.options.singleField) {
return $(tag).find('.tagit-label:first').text();
} else {
return $(tag).find('input:first').val();
}
},
_showAutocomplete: function() {
this.tagInput.autocomplete('search', '');
},
_findTagByLabel: function(name) {
var that = this;
var tag = null;
this._tags().each(function(i) {
if (that._formatStr(name) == that._formatStr(that.tagLabel(this))) {
tag = $(this);
return false;
}
});
return tag;
},
_isNew: function(name) {
return !this._findTagByLabel(name);
},
_formatStr: function(str) {
if (this.options.caseSensitive) {
return str;
}
return $.trim(str.toLowerCase());
},
_effectExists: function(name) {
return Boolean($.effects && ($.effects[name] || ($.effects.effect && $.effects.effect[name])));
},
isValidEmail: function (email) {
return validator('validate-email', email);
},
createTag: function(value, additionalClass, duringInitialization) {
var that = this;
value = $.trim(value);
if(this.options.preprocessTag) {
value = this.options.preprocessTag(value);
}
if (!this.isValidEmail(value).passed) {
return false;
}
if (value === '') {
return false;
}
if (!this.options.allowDuplicates && !this._isNew(value)) {
var existingTag = this._findTagByLabel(value);
if (this._trigger('onTagExists', null, {
existingTag: existingTag,
duringInitialization: duringInitialization
}) !== false) {
if (this._effectExists('highlight')) {
existingTag.effect('highlight');
}
}
return false;
}
if (this.options.tagLimit && this._tags().length >= this.options.tagLimit) {
this._trigger('onTagLimitExceeded', null, {duringInitialization: duringInitialization});
return false;
}
var label = $(this.options.onTagClicked ? '<a class="tagit-label"></a>' : '<span class="tagit-label"></span>').text(value);
// Create tag.
var tag = $('<li></li>')
.addClass('tagit-choice ui-widget-content ui-state-default ui-corner-all')
.addClass(additionalClass)
.append(label);
if (this.options.readOnly){
tag.addClass('tagit-choice-read-only');
} else {
tag.addClass('tagit-choice-editable');
// Button for removing the tag.
var removeTagIcon = $('<span></span>')
.addClass('ui-icon ui-icon-close');
var removeTag = $('<a><span class="text-icon">\xd7</span></a>') // \xd7 is an X
.addClass('tagit-close')
.append(removeTagIcon)
.click(function(e) {
// Removes a tag when the little 'x' is clicked.
that.removeTag(tag);
});
tag.append(removeTag);
}
// Unless options.singleField is set, each tag has a hidden input field inline.
if (!this.options.singleField) {
var escapedValue = label.html();
tag.append('<input type="hidden" value="' + escapedValue + '" name="' + this.options.fieldName + '" class="tagit-hidden-field" />');
}
if (this._trigger('beforeTagAdded', null, {
tag: tag,
tagLabel: this.tagLabel(tag),
duringInitialization: duringInitialization
}) === false) {
return;
}
if (this.options.singleField) {
var tags = this.assignedTags();
tags.push(value);
this._updateSingleTagsField(tags);
}
// DEPRECATED.
this._trigger('onTagAdded', null, tag);
this.tagInput.val('');
// Insert tag.
this.tagInput.parent().before(tag);
this._trigger('afterTagAdded', null, {
tag: tag,
tagLabel: this.tagLabel(tag),
duringInitialization: duringInitialization
});
if (this.options.showAutocompleteOnFocus && !duringInitialization) {
setTimeout(function () { that._showAutocomplete(); }, 0);
}
},
removeTag: function(tag, animate) {
animate = typeof animate === 'undefined' ? this.options.animate : animate;
tag = $(tag);
// DEPRECATED.
this._trigger('onTagRemoved', null, tag);
if (this._trigger('beforeTagRemoved', null, {tag: tag, tagLabel: this.tagLabel(tag)}) === false) {
return;
}
if (this.options.singleField) {
var tags = this.assignedTags();
var removedTagLabel = this.tagLabel(tag);
tags = $.grep(tags, function(el){
return el != removedTagLabel;
});
this._updateSingleTagsField(tags);
}
if (animate) {
tag.addClass('removed'); // Excludes this tag from _tags.
var hide_args = this._effectExists('blind') ? ['blind', {direction: 'horizontal'}, 'fast'] : ['fast'];
var thisTag = this;
hide_args.push(function() {
tag.remove();
thisTag._trigger('afterTagRemoved', null, {tag: tag, tagLabel: thisTag.tagLabel(tag)});
});
tag.fadeOut('fast').hide.apply(tag, hide_args).dequeue();
} else {
tag.remove();
this._trigger('afterTagRemoved', null, {tag: tag, tagLabel: this.tagLabel(tag)});
}
},
removeTagByLabel: function(tagLabel, animate) {
var toRemove = this._findTagByLabel(tagLabel);
if (!toRemove) {
throw "No such tag exists with the name '" + tagLabel + "'";
}
this.removeTag(toRemove, animate);
},
removeAll: function() {
// Removes all tags.
var that = this;
this._tags().each(function(index, tag) {
that.removeTag(tag, false);
});
}
});
});
@@ -0,0 +1,44 @@
define([
'Magento_Ui/js/grid/toolbar',
'underscore',
'jquery'
], function (toolbar, _, $) {
'use strict';
return toolbar.extend({
defaults: {
pageMainActionsSelector: '.page-main-actions:not(.modal-slide .page-main-actions)'
},
/**
* Shows sticky toolbar.
*
* @returns {Object} Chainable.
*/
show: function () {
if ($(this.pageMainActionsSelector).length === 0) {
this.$sticky.style.top = 0;
}
return this._super();
},
/**
* Checks if sticky toolbar covers original elements.
*
* @returns {Boolean}
*/
isCovered: function () {
var pageMainActionsIndent = 77,
stickyTop;
if ($(this.pageMainActionsSelector).length > 0) {
pageMainActionsIndent = 0;
}
stickyTop = this._stickyTableTop - pageMainActionsIndent + this._wScrollTop;
return stickyTop > this._tableTop;
}
});
});
@@ -0,0 +1,53 @@
<div class="admin__field-complex amaudit-tables-container" css="$data.additionalClasses" attr="'data-index': index">
<table class="admin__table-secondary amaudit-secondary-table">
<tbody>
<tr class="amaudit-tr -dark">
<th class="amaudit-th" data-bind="i18n: 'Username:'"></th>
<td class="amaudit-td" data-bind="text: $parent.data().username"></td>
</tr>
<tr>
<th class="amaudit-th" data-bind="i18n: 'Full Name:'"></th>
<td class="amaudit-td" data-bind="text: $parent.data().full_name"></td>
</tr>
<tr class="amaudit-tr -dark">
<th class="amaudit-th" data-bind="i18n: 'Session Start:'"></th>
<td class="amaudit-td" data-bind="text: $parent.data().session_start"></td>
</tr>
<tr>
<th class="amaudit-th" data-bind="i18n: 'Session End:'"></th>
<td class="amaudit-td" data-bind="text: $parent.data().session_end"></td>
</tr>
<tr class="amaudit-tr -dark">
<th class="amaudit-th" data-bind="i18n: 'IP Address:'"></th>
<td class="amaudit-td" data-bind="text: $parent.data().ip"></td>
</tr>
<tr>
<th class="amaudit-th" data-bind="i18n: 'Location:'"></th>
<td class="amaudit-td" data-bind="text: $parent.data().location"></td>
</tr>
</tbody>
</table>
<table class="admin__table-primary dashboard-data amaudit-table-container -primary">
<thead class="amaudit-thead">
<tr class="amaudit-tr">
<th class="amaudit-th -index">#</th>
<th class="amaudit-th" data-bind="i18n: 'Page Name'"></th>
<th class="amaudit-th -wide" data-bind="i18n: 'Page URL'"></th>
<th class="amaudit-th -duration" data-bind="i18n: 'Stay Duration'"></th>
</tr>
</thead>
<tbody class="amaudit-tbody">
<!-- ko foreach: $parent.data().visit_history_details -->
<tr>
<td class="amaudit-td -index" data-bind="text: $index() + 1"></td>
<td class="amaudit-td" data-bind="text: $data.page_name"></td>
<td class="amaudit-td -wide -url">
<a data-bind="attr: {href: $data.page_url, title: $data.page_url}, text: $data.page_url"></a>
</td>
<td class="amaudit-td -duration"
data-bind="text: $parents[1].getDuration($data.stay_duration)"></td>
</tr>
<!--/ko-->
</tbody>
</table>
</div>
@@ -0,0 +1,27 @@
<table class="admin__table-primary dashboard-data amaudit-table-container -log -primary">
<thead class="amaudit-thead">
<tr class="amaudit-tr">
<th class="amaudit-th" data-bind="i18n: 'Name'"></th>
<th class="amaudit-th -wide" data-bind="i18n: 'Old Value'"></th>
<th class="amaudit-th -wide" data-bind="i18n: 'New Value'"></th>
</tr>
</thead>
<!-- ko ifnot: $data.messages().isError -->
<tbody class="amaudit-tbody">
<!-- ko if: $data.data().length -->
<!-- ko foreach: $data.data -->
<tr class="amaudit-tr">
<td class="amaudit-td amaudit-title" data-bind="text: $data.name"></td>
<td class="amaudit-td -wide"><pre class="amaudit-pre" data-bind="html: $data.old_value"></pre></td>
<td class="amaudit-td -wide"><pre class="amaudit-pre" data-bind="html: $data.new_value"></pre></td>
</tr>
<!--/ko-->
<!--/ko-->
<!-- ko if: $data.type === 'delete' -->
<tr class="amaudit-tr">
<td class="amaudit-td -solid" colspan="3" data-bind="i18n: 'The item has been deleted.'"></td>
</tr>
<!-- /ko -->
</tbody>
<!-- /ko -->
</table>
@@ -0,0 +1,32 @@
<table class="admin__table-secondary amaudit-secondary-table">
<tbody>
<tr class="amaudit-tr -dark">
<th class="amaudit-th" data-bind="i18n: 'Date:'"></th>
<td class="amaudit-td" data-bind="text: $data.data.date"></td>
</tr>
<tr>
<th class="amaudit-th" data-bind="i18n: 'Username:'"></th>
<td class="amaudit-td" data-bind="text: $data.data.username"></td>
</tr>
<tr class="amaudit-tr -dark">
<th class="amaudit-th" data-bind="i18n: 'Full Name:'"></th>
<td class="amaudit-td" data-bind="text: $data.data.full_name"></td>
</tr>
<tr>
<th class="amaudit-th" data-bind="i18n: 'IP Address:'"></th>
<td class="amaudit-td" data-bind="text: $data.data.ip"></td>
</tr>
<tr class="amaudit-tr -dark">
<th class="amaudit-th" data-bind="i18n: 'Email:'"></th>
<td class="amaudit-td" data-bind="text: $data.data.email"></td>
</tr>
<tr>
<th class="amaudit-th" data-bind="i18n: 'Action Type:'"></th>
<td class="amaudit-td" data-bind="text: $data.data.type"></td>
</tr>
<tr class="amaudit-tr -dark">
<th class="amaudit-th" data-bind="i18n: 'Object:'"></th>
<td class="amaudit-td" data-bind="text: $data.data.item"></td>
</tr>
</tbody>
</table>
@@ -0,0 +1,8 @@
<div class="data-grid-cell-content">
<span data-bind="i18n: $row().item"></span>
<!-- ko if: $row().view_url -->
<a data-bind="attr: { href: $row().view_url }">
<span data-bind="i18n: '[View]'"></span>
</a>
<!-- /ko -->
</div>
@@ -0,0 +1,7 @@
<div class="data-grid-cell-content" data-bind="
css: {
'grid-severity-critical': $row()[$data.index] == 0,
'grid-severity-notice': $row()[$data.index] == 1,
'grid-severity-minor': $row()[$data.index] == 2
},
text: $col.getLabel($row())"/>
@@ -0,0 +1,2 @@
<div class="data-grid-cell-content -type"
data-bind="text: $col.getLabel($row()), css: '-' + $row().type"></div>