From d7532b0340b323d1f867e5627bdeb60e69eb3675 Mon Sep 17 00:00:00 2001 From: digital-gnome <31593470+digital-gnome@users.noreply.github.com> Date: Fri, 15 Dec 2017 22:57:42 -0500 Subject: [PATCH] Add dateTime picker to filter --- web/skins/classic/includes/functions.php | 4 + .../jquery-ui-timepicker-addon.css | 30 + .../jquery-ui-timepicker-addon.js | 2291 +++++++++++++++++ web/skins/classic/js/jquery-ui.css | 1225 +++++++++ web/skins/classic/views/filter.php | 22 +- web/skins/classic/views/js/filter.js | 48 +- 6 files changed, 3590 insertions(+), 30 deletions(-) create mode 100644 web/skins/classic/js/dateTimePicker/jquery-ui-timepicker-addon.css create mode 100644 web/skins/classic/js/dateTimePicker/jquery-ui-timepicker-addon.js create mode 100644 web/skins/classic/js/jquery-ui.css diff --git a/web/skins/classic/includes/functions.php b/web/skins/classic/includes/functions.php index 8577c59c3..8ee357807 100644 --- a/web/skins/classic/includes/functions.php +++ b/web/skins/classic/includes/functions.php @@ -97,6 +97,10 @@ if ( file_exists( "skins/$skin/css/$css/graphics/favicon.ico" ) ) { + + + + - + - - - - + + + + + + + + '); let archiveSelect = $j('').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); for (let i = 0; i < archiveTypes.length; i++) { @@ -146,7 +146,7 @@ function parseRows (rows) { let archiveVal = inputTds.eq(4).children().val(); inputTds.eq(4).html(archiveSelect).children().val(archiveVal); - } else if (inputTds.eq(2).children().val().indexOf('Weekday') >= 0) { + } else if (inputTds.eq(2).children().val().indexOf('Weekday') >= 0) { //Weekday selection let weekdaySelect = $j('').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); for (let i = 0; i < weekdays.length; i++) { weekdaySelect.append(''); @@ -154,24 +154,24 @@ function parseRows (rows) { let weekdayVal = inputTds.eq(4).children().val(); inputTds.eq(4).html(weekdaySelect).children().val(weekdayVal); - } else if (inputTds.eq(2).children().val() == 'StateId') { + } else if (inputTds.eq(2).children().val() == 'StateId') { //Run state let stateSelect = $j('').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); for (let key in states) { stateSelect.append(''); } let stateVal = inputTds.eq(4).children().val(); - inputTds.eq(4).html(weekdaySelect).children().val(stateVal) + inputTds.eq(4).html(stateSelect).children().val(stateVal) - } else if (inputTds.eq(2).children().val() == 'ServerId') { + } else if (inputTds.eq(2).children().val() == 'ServerId') { //Select Server let serverSelect = $j('').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); for (let key in servers) { serverSelect.append(''); } let serverVal = inputTds.eq(4).children().val(); - inputTds.eq(4).html(weekdaySelect).children().val(serverVal) + inputTds.eq(4).html(serverSelect).children().val(serverVal) - } else if (inputTds.eq(2).children().val() == 'StorageId') { + } else if (inputTds.eq(2).children().val() == 'StorageId') { //Choose by storagearea let storageSelect = $j('').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); for (let i=0; i < storageareas.length; i++) { storageSelect.append(''); @@ -179,14 +179,14 @@ function parseRows (rows) { let storageVal = inputTds.eq(4).children().val(); inputTds.eq(4).html(storageSelect).children().val(storageVal) - } else if (inputTds.eq(2).children().val() == 'MonitorName') { + } else if (inputTds.eq(2).children().val() == 'MonitorName') { //Monitor names let monitorSelect = $j('').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]'); for (let key in monitors) { monitorSelect.append(''); } let monitorVal = inputTds.eq(4).children().val(); inputTds.eq(4).html(monitorSelect).children().val(monitorVal) - } else { + } else { //Reset to regular text field and operator for everything that isn't special let opSelect = $j('').attr('name', queryPrefix + rowNum + '][op]').attr('id', queryPrefix + rowNum + '][op]'); for (let key in opTypes) { opSelect.append(''); @@ -196,15 +196,23 @@ function parseRows (rows) { let textInput = $j('').attr('type', 'text').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]') let textVal = inputTds.eq(4).children().val(); inputTds.eq(4).html(textInput).children().val(textVal); - } - let attr = inputTds.find("[name$='attr\\]']") // Set attr list id and name - let term = attr.attr('name').split(/[[\]]{1,2}/); - term.length--; - term.shift(); - term[2] = rowNum; - inputTds.eq(2).children().attr('name', 'filter'+stringFilter(term)); - inputTds.eq(2).children().attr('id', 'filter'+stringFilter(term)); - } + } + if (inputTds.eq(2).children().val().endsWith('DateTime')) { //Start/End DateTime + inputTds.eq(4).children().datetimepicker({timeFormat: "HH:mm:ss", dateFormat: "yy-mm-dd"}); + } else if (inputTds.eq(2).children().val().endsWith('Date')) { //Start/End Date + inputTds.eq(4).children().datepicker({dateFormat: "yy-mm-dd"}); + } else if (inputTds.eq(2).children().val().endsWith('Time')) { //Start/End Time + inputTds.eq(4).children().timepicker({timeFormat: "HH:mm:ss"}); + } + + let attr = inputTds.find("[name$='attr\\]']") // Set attr list id and name + let term = attr.attr('name').split(/[[\]]{1,2}/); + term.length--; + term.shift(); + term[2] = rowNum; + inputTds.eq(2).children().attr('name', 'filter'+stringFilter(term)); + inputTds.eq(2).children().attr('id', 'filter'+stringFilter(term)); + }//End for each term/row history.replaceState(null, null, '?view=filter&' + $j('#contentForm').serialize()); }