From a2f35834811b7dc66de253b6b8663c5b4d8fca21 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 12 Aug 2021 13:44:49 -0400 Subject: [PATCH] turn Save, SaveAs and Execute into submit buttons. Put Id into the form action so that it shows up in the url bar. Disable putting the form contents into the url bar in parse_rows. --- web/skins/classic/views/filter.php | 11 ++++----- web/skins/classic/views/js/filter.js | 37 ++++++---------------------- 2 files changed, 13 insertions(+), 35 deletions(-) diff --git a/web/skins/classic/views/filter.php b/web/skins/classic/views/filter.php index e6caedcb5..efb3eed15 100644 --- a/web/skins/classic/views/filter.php +++ b/web/skins/classic/views/filter.php @@ -195,7 +195,7 @@ echo $navbar = getNavBarHTML();

-
+
1 ) { echo htmlSelect('Id', $filterNames, $filter->Id(), array('data-on-change-this'=>'selectFilter')); @@ -210,8 +210,7 @@ if ( (null !== $filter->Concurrent()) and $filter->Concurrent() ) ?>
-
- + @@ -507,12 +506,12 @@ if ( ZM_OPT_EMAIL ) { - + - - + + Id() ) { ?> diff --git a/web/skins/classic/views/js/filter.js b/web/skins/classic/views/js/filter.js index 2c3a4d59b..f59c6de1d 100644 --- a/web/skins/classic/views/js/filter.js +++ b/web/skins/classic/views/js/filter.js @@ -97,13 +97,13 @@ function updateButtons(element) { } else if ( form.elements['filter[UpdateDiskSpace]'].checked ) { canExecute = true; } - form.elements['executeButton'].disabled = !canExecute; + document.getElementById('executeButton').disabled = !canExecute; if ( form.elements['filter[Name]'].value ) { - form.elements['Save'].disabled = false; - form.elements['SaveAs'].disabled = false; + document.getElementById('Save').disabled = false; + document.getElementById('SaveAs').disabled = false; } else { - form.elements['Save'].disabled = true; - form.elements['SaveAs'].disabled = true; + document.getElementById('Save').disabled = true; + document.getElementById('SaveAs').disabled = true; } } @@ -151,11 +151,6 @@ function resetFilter( element ) { function submitToEvents(element) { var form = element.form; - //form.action = '?view=events'; - //form.submit(); - //console.log(form); - //console.log($j(form).serialize()); - //history.replaceState(null, null, '?view=filter&' + $j(form).serialize()); window.location.assign('?view=events&'+$j(form).serialize()); } @@ -171,23 +166,6 @@ function submitToExport(element) { window.location.assign('?view=export&'+$j(form).serialize()); } -function executeFilter( element ) { - var form = element.form; - form.action = thisUrl + '?view=filter'; - form.elements['action'].value = 'execute'; - form.submit(); - //history.replaceState(null, null, '?view=filter&' + $j(form).serialize()); -} - -function saveFilter( element ) { - var form = element.form; - form.target = window.name; - form.elements['action'].value = element.value; - form.action = thisUrl + '?view=filter'; - //form.submit(); - // Submit is done by the button type="submit" -} - function deleteFilter( element ) { var form = element.form; if ( confirm( deleteSavedFilterString+" '"+form.elements['filter[Name]'].value+"'?" ) ) { @@ -350,7 +328,8 @@ function parseRows(rows) { inputTds.eq(2).children().eq(0).attr('name', 'filter'+stringFilter(term)); inputTds.eq(2).children().eq(0).attr('id', 'filter'+stringFilter(term)); } //End for each term/row - history.replaceState(null, null, '?view=filter&' + $j('#contentForm').serialize()); + // ICON This populates the url bar with contents of the form. I'm not sure why + // history.replaceState(null, null, '?view=filter&' + $j('#contentForm').serialize()); } // parseRows function stringFilter(term) { @@ -415,4 +394,4 @@ function initPage() { parseRows($j('#fieldsTable tbody').children()); } -$j(document).ready(initPage ); +$j(document).ready(initPage);