summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpfspot.class.php49
-rw-r--r--phpfspot.js28
2 files changed, 35 insertions, 42 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php
index df984cb..797c604 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -344,8 +344,8 @@ class PHPFSPOT {
}
$this->tmpl->register_function("sort_select_list", array(&$this, "smarty_sort_select_list"), false);
- $this->tmpl->assign('search_from_date', $this->get_calendar('from'));
- $this->tmpl->assign('search_to_date', $this->get_calendar('to'));
+ $this->tmpl->assign('search_from_date', $this->get_date_text_field('from'));
+ $this->tmpl->assign('search_to_date', $this->get_date_text_field('to'));
$this->tmpl->assign('preset_selected_tags', $this->getSelectedTags());
$this->tmpl->assign('preset_available_tags', $this->getAvailableTags());
@@ -2009,11 +2009,11 @@ class PHPFSPOT {
public function startSearch()
{
/* date search */
- if(isset($_POST['from']) && $this->isValidDate($_POST['from'])) {
- $from = $_POST['from'];
+ if(isset($_POST['date_from']) && $this->isValidDate($_POST['date_from'])) {
+ $date_from = $_POST['date_from'];
}
- if(isset($_POST['to']) && $this->isValidDate($_POST['to'])) {
- $to = $_POST['to'];
+ if(isset($_POST['date_to']) && $this->isValidDate($_POST['date_to'])) {
+ $date_to = $_POST['date_to'];
}
/* tag-name search */
@@ -2049,13 +2049,13 @@ class PHPFSPOT {
$this->get_tags();
- if(isset($from) && !empty($from))
- $_SESSION['from_date'] = strtotime($from ." 00:00:00");
+ if(isset($date_from) && !empty($date_from))
+ $_SESSION['from_date'] = strtotime($date_from ." 00:00:00");
else
unset($_SESSION['from_date']);
- if(isset($to) && !empty($to))
- $_SESSION['to_date'] = strtotime($to ." 23:59:59");
+ if(isset($date_to) && !empty($date_to))
+ $_SESSION['to_date'] = strtotime($date_to ." 23:59:59");
else
unset($_SESSION['to_date']);
@@ -2365,32 +2365,31 @@ class PHPFSPOT {
} // _error()
/**
- * output calendard input fields
+ * get calendar input-text fields
+ *
+ * this function returns a text-field used for the data selection.
+ * Either it will be filled with the current date or, if available,
+ * filled with the date user entered previously.
+ *
* @param string $mode
* @return string
*/
- private function get_calendar($mode)
+ private function get_date_text_field($mode)
{
- $year = isset($_SESSION[$mode .'_date']) ? date("Y", $_SESSION[$mode .'_date']) : date("Y");
- $month = isset($_SESSION[$mode .'_date']) ? date("m", $_SESSION[$mode .'_date']) : date("m");
- $day = isset($_SESSION[$mode .'_date']) ? date("d", $_SESSION[$mode .'_date']) : date("d");
+ $date = isset($_SESSION[$mode .'_date']) ? date("Y", $_SESSION[$mode .'_date']) : date("Y");
+ $date.= "-";
+ $date.= isset($_SESSION[$mode .'_date']) ? date("m", $_SESSION[$mode .'_date']) : date("m");
+ $date.= "-";
+ $date.= isset($_SESSION[$mode .'_date']) ? date("d", $_SESSION[$mode .'_date']) : date("d");
- $output = "<input type=\"text\" size=\"3\" id=\"". $mode ."year\" value=\"". $year ."\"";
- if(!isset($_SESSION[$mode .'_date']))
- $output.= " disabled=\"disabled\"";
- $output.= " />\n";
- $output.= "<input type=\"text\" size=\"1\" id=\"". $mode ."month\" value=\"". $month ."\"";
- if(!isset($_SESSION[$mode .'_date']))
- $output.= " disabled=\"disabled\"";
- $output.= " />\n";
- $output.= "<input type=\"text\" size=\"1\" id=\"". $mode ."day\" value=\"". $day ."\"";
+ $output = "<input type=\"text\" size=\"15\" id=\"date_". $mode ."\" value=\"". $date ."\"";
if(!isset($_SESSION[$mode .'_date']))
$output.= " disabled=\"disabled\"";
$output.= " />\n";
return $output;
- } // get_calendar()
+ } // get_date_text_field()
/**
* output calendar matrix
diff --git a/phpfspot.js b/phpfspot.js
index 555e8ff..57345ab 100644
--- a/phpfspot.js
+++ b/phpfspot.js
@@ -265,15 +265,13 @@ function setCheckedValue(condition, value) {
*/
function startSearch()
{
- from_year = document.getElementById('fromyear').value;
- from_month = document.getElementById('frommonth').value;
- from_day = document.getElementById('fromday').value;
- from = from_year +"-"+ from_month +"-"+ from_day;
- to_year = document.getElementById('toyear').value;
- to_month = document.getElementById('tomonth').value;
- to_day = document.getElementById('today').value;
- to = to_year +"-"+ to_month +"-"+ to_day;
-
+ if(document.getElementById('date_from').value != undefined) {
+ date_from = document.getElementById('date_from').value;
+ }
+ if(document.getElementById('date_to').value != undefined) {
+ date_to = document.getElementById('date_to').value;
+ }
+
var objTemp = new Object();
objTemp['action'] = 'search';
@@ -287,8 +285,8 @@ function startSearch()
}
if(document.getElementsByName('consider_date')[0] != undefined &&
document.getElementsByName('consider_date')[0].checked == true) {
- objTemp['from'] = from;
- objTemp['to'] = to;
+ objTemp['date_from'] = date_from;
+ objTemp['date_to'] = date_to;
}
if(document.getElementsByName('consider_rate')[0] != undefined &&
document.getElementsByName('consider_rate')[0].checked == true) {
@@ -322,12 +320,8 @@ function datesearch()
mode = false;
}
- document.getElementById('fromyear').disabled = mode;
- document.getElementById('frommonth').disabled = mode;
- document.getElementById('fromday').disabled = mode;
- document.getElementById('toyear').disabled = mode;
- document.getElementById('tomonth').disabled = mode;
- document.getElementById('today').disabled = mode;
+ document.getElementById('date_from').disabled = mode;
+ document.getElementById('date_to').disabled = mode;
} // datesearch()