diff --git a/include/functions_common.php b/include/functions_common.php index 12a9235..e05d9af 100644 --- a/include/functions_common.php +++ b/include/functions_common.php @@ -49,6 +49,7 @@ $content['BUILDNUMBER'] = "0.1.101"; $content['TITLE'] = "PhpLogCon - Release " . $content['BUILDNUMBER']; // Title of the Page $content['BASEPATH'] = $gl_root_path; $content['EXTRA_METATAGS'] = ""; +$content['EXTRA_JAVASCRIPT'] = ""; // --- function InitBasicPhpLogCon() diff --git a/index.php b/index.php index 09f6772..3713753 100644 --- a/index.php +++ b/index.php @@ -48,11 +48,96 @@ $content['uid_last'] = UID_UNKNOWN; // Init Sorting variables $content['sorting'] = ""; +$content['searchstr'] = ""; //if ( isset($content['myserver']) ) // $content['TITLE'] = "PhpLogCon :: Home :: Server '" . $content['myserver']['Name'] . "'"; // Title of the Page //else $content['TITLE'] = "PhpLogCon :: Home"; + +// Read and process filters from search dialog! +if ( isset($_POST['search']) && $_POST['search'] == $content['LN_SEARCH_PERFORMADVANCED']) +{ + if ( isset($_POST['filter_datemode']) ) + { + $filters['filter_datemode'] = intval($_POST['filter_datemode']); + if ( $filters['filter_datemode'] == DATEMODE_RANGE ) + { + // Read range values + if ( isset($_POST['filter_daterange_from_year']) ) + $filters['filter_daterange_from_year'] = intval($_POST['filter_daterange_from_year']); + if ( isset($_POST['filter_daterange_from_month']) ) + $filters['filter_daterange_from_month'] = intval($_POST['filter_daterange_from_month']); + if ( isset($_POST['filter_daterange_from_day']) ) + $filters['filter_daterange_from_day'] = intval($_POST['filter_daterange_from_day']); + if ( isset($_POST['filter_daterange_to_year']) ) + $filters['filter_daterange_to_year'] = intval($_POST['filter_daterange_to_year']); + if ( isset($_POST['filter_daterange_to_month']) ) + $filters['filter_daterange_to_month'] = intval($_POST['filter_daterange_to_month']); + if ( isset($_POST['filter_daterange_to_day']) ) + $filters['filter_daterange_to_day'] = intval($_POST['filter_daterange_to_day']); + + // Append to searchstring + $content['searchstr'] .= "datefrom:" . $filters['filter_daterange_from_year'] . "-" . + $filters['filter_daterange_from_month'] . "-" . + $filters['filter_daterange_from_day'] . "T00:00:00 "; + $content['searchstr'] .= "dateto:" . $filters['filter_daterange_to_year'] . "-" . + $filters['filter_daterange_to_month'] . "-" . + $filters['filter_daterange_to_day'] . "T00:00:00 "; + + } + else if ( $filters['filter_datemode'] == DATEMODE_LASTX ) + { + if ( isset($_POST['filter_daterange_last_x']) ) + { + $filters['filter_daterange_last_x'] = intval($_POST['filter_daterange_last_x']); + $content['searchstr'] .= "datefrom:" . $filters['filter_daterange_last_x'] . " "; + } + } + } + + if ( isset($_POST['filter_facility']) && count($_POST['filter_facility']) < 18 ) // If we have more than 18 elements, this means all facilities are enabled + { + $tmpStr = ""; + foreach ($_POST['filter_facility'] as $tmpfacility) + { + if ( strlen($tmpStr) > 0 ) + $tmpStr .= ","; + $tmpStr .= $tmpfacility; + } + $content['searchstr'] .= "facility:" . $tmpStr . " "; + } + + if ( isset($_POST['filter_severity']) && count($_POST['filter_facility']) < 7 ) // If we have more than 7 elements, this means all facilities are enabled) + { + $tmpStr = ""; + foreach ($_POST['filter_severity'] as $tmpfacility) + { + if ( strlen($tmpStr) > 0 ) + $tmpStr .= ","; + $tmpStr .= $tmpfacility; + } + $content['searchstr'] .= "severity:" . $tmpStr . " "; + } + + // Spaces need to be converted! + if ( isset($_POST['filter_syslogtag']) && strlen($_POST['filter_syslogtag']) > 0 ) + { + $content['searchstr'] .= "syslogtag:" . $_POST['filter_syslogtag'] . " "; + } + + // Spaces need to be converted! + if ( isset($_POST['filter_source']) && strlen($_POST['filter_source']) > 0 ) + { + $content['searchstr'] .= "source:" . $_POST['filter_source'] . " "; + } + + // Message is just appended + if ( isset($_POST['filter_message']) && strlen($_POST['filter_message']) > 0 ) + $content['searchstr'] .= $_POST['filter_message']; + +} + // --- // --- BEGIN Custom Code diff --git a/js/common.js b/js/common.js index 2e85864..ccb4a36 100644 --- a/js/common.js +++ b/js/common.js @@ -1,8 +1,6 @@ /* Helper Javascript Constants */ -const DATEMODE_ALL = 1, DATEMODE_RANGE = 2, DATEMODE_LASTX = 3; -const DATE_LASTX_HOUR = 1, DATE_LASTX_12HOURS = 2, DATE_LASTX_24HOURS = 3, DATE_LASTX_7DAYS = 4,DATE_LASTX_31DAYS = 5; /* Helper Javascript functions @@ -92,49 +90,3 @@ function hidevisibility(ElementNameToggle, ElementNameButton) toggle.style.visibility = "hidden"; toggle.style.display = "none"; } - -/* -* Helper function to show and hide areas of the filterview -*/ -function toggleDatefiltervisibility(FormName) -{ - var myform = document.getElementById(FormName); - if (myform.elements['filter_datemode'].value == DATEMODE_ALL) - { - hidevisibility('HiddenDateFromOptions'); - hidevisibility('HiddenDateLastXOptions'); - } - else if (myform.elements['filter_datemode'].value == DATEMODE_RANGE) - { - togglevisibility('HiddenDateFromOptions'); - hidevisibility('HiddenDateLastXOptions'); - } - else if (myform.elements['filter_datemode'].value == DATEMODE_LASTX) - { - togglevisibility('HiddenDateLastXOptions'); - hidevisibility('HiddenDateFromOptions'); - } - -} - -/* -* Helper function to add a date filter into the search field -*/ -function addDatefilterToSearch(DateName, SearchFormName) -{ - var myDateform = document.getElementById(DateName); - var mySearchform = document.getElementById(SearchFormName); - if (myDateform.elements['filter_datemode'].value == DATEMODE_RANGE) - { - mySearchform.elements['filter'].value += "date:from:" + myDateform.elements['filter_daterange_from_year'].value + "-" - + myDateform.elements['filter_daterange_from_month'].value + "-" - + myDateform.elements['filter_daterange_from_day'].value + ":to:" - + myDateform.elements['filter_daterange_to_year'].value + "-" - + myDateform.elements['filter_daterange_to_month'].value + "-" - + myDateform.elements['filter_daterange_to_day'].value + " "; - } - else if (myDateform.elements['filter_datemode'].value == DATEMODE_LASTX) - { - mySearchform.elements['filter'].value += "date:lastx:" + myDateform.elements['filter_daterange_last_x'].value + " "; - } -} \ No newline at end of file diff --git a/lang/en/main.php b/lang/en/main.php index ca8044c..6924ec2 100644 --- a/lang/en/main.php +++ b/lang/en/main.php @@ -6,7 +6,7 @@ $content['LN_MAINTITLE'] = "Main PhpLogCon"; $content['LN_MAIN_SELECTSTYLE'] = "Select a Style"; $content['LN_GEN_LANGUAGE'] = "Select language"; $content['LN_GEN_SELECTSOURCE'] = "Select Source"; -$content['LN_GEN_MOREPAGES'] = "More then one Page available"; +$content['LN_GEN_MOREPAGES'] = "More than one Page available"; $content['LN_GEN_FIRSTPAGE'] = "First Page"; $content['LN_GEN_LASTPAGE'] = "Last Page"; $content['LN_GEN_NEXTPAGE'] = "Next Page"; @@ -24,11 +24,14 @@ $content['LN_GRID_INFOUNIT'] = "InfoUnit"; $content['LN_GRID_HOST'] = "Source"; $content['LN_GRID_MSG'] = "Message"; +$content['LN_SEARCH_USETHISBLA'] = "Use the form below and your advanced search will appear here"; $content['LN_SEARCH_FILTER'] = "Search (filter):"; $content['LN_SEARCH_ADVANCED'] = "Advanced Search"; $content['LN_SEARCH_FEELSAD'] = "I'm feeling sad ..."; $content['LN_SEARCH'] = "Search"; $content['LN_SEARCH_RESET'] = "Reset search"; +$content['LN_SEARCH_PERFORMADVANCED'] = "Perform Advanced Search"; + // Filter Options $content['LN_FILTER_DATE'] = "Datetime Range"; diff --git a/search.php b/search.php index f12cf8c..f6e29c9 100644 --- a/search.php +++ b/search.php @@ -32,6 +32,10 @@ IncludeLanguageFile( $gl_root_path . '/lang/' . $LANG . '/main.php' ); InitFilterHelpers(); // *** *** // +// --- Extra Javascript? +$content['EXTRA_JAVASCRIPT'] = ""; +// --- + // --- CONTENT Vars // --- diff --git a/templates/include_header.html b/templates/include_header.html index ac803a8..2160975 100644 --- a/templates/include_header.html +++ b/templates/include_header.html @@ -7,6 +7,7 @@ + {EXTRA_JAVASCRIPT} diff --git a/templates/index.html b/templates/index.html index fa8f986..0ec503e 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,14 +1,14 @@ - +
 {LN_SEARCH_FILTER} - +
diff --git a/templates/search.html b/templates/search.html index 8cde23e..41faf38 100644 --- a/templates/search.html +++ b/templates/search.html @@ -1,17 +1,16 @@ - +
+
- -
-  {LN_SEARCH_FILTER} - -
+
+
{LN_SEARCH_USETHISBLA}
+
- +
@@ -118,7 +117,7 @@
{LN_FILTER_FACILITY} - @@ -126,7 +125,7 @@ {LN_FILTER_SEVERITY} - @@ -146,7 +145,7 @@
- +
@@ -158,13 +157,13 @@
{LN_FILTER_SYSLOGTAG} - +
{LN_FILTER_SOURCE} - +
@@ -173,7 +172,7 @@
- + diff --git a/themes/dark/main.css b/themes/dark/main.css index 1b67f53..3ec40eb 100644 --- a/themes/dark/main.css +++ b/themes/dark/main.css @@ -392,3 +392,14 @@ select, input, button, textarea border: 1px solid; border-color: #233B51 #124A7C #124A7C #233B51; } + +.SearchFormTextbox +{ + height: 20px; + margin: 2px; + background-color: #0B253C; + color:#FFFFFF; + font:10px Verdana,Arial,Helvetica,sans-serif; + border: 1px solid; + border-color: #233B51 #124A7C #124A7C #233B51; +} \ No newline at end of file diff --git a/themes/default/main.css b/themes/default/main.css index dd1a81f..facb6b7 100644 --- a/themes/default/main.css +++ b/themes/default/main.css @@ -394,3 +394,14 @@ select, input, button, textarea, .SelectSavedFilter border: 1px solid; border-color: #233B51 #124A7C #124A7C #233B51; } + +.SearchFormTextbox +{ + height: 20px; + margin: 2px; + background-color: #E8E7E2; + color:#000000; + font:10px Verdana,Arial,Helvetica,sans-serif; + border: 1px solid; + border-color: #233B51 #124A7C #124A7C #233B51; +} \ No newline at end of file