projects
/
phpfspot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bb3bcfb
)
sort-order is now set via AJAX, not while submit a search-query
author
Andreas Unterkircher
<unki@netshadow.at>
Tue, 1 Jan 2008 11:06:46 +0000
(12:06 +0100)
committer
Andreas Unterkircher
<unki@netshadow.at>
Tue, 1 Jan 2008 11:06:46 +0000
(12:06 +0100)
phpfspot.class.php
patch
|
blob
|
history
phpfspot.js
patch
|
blob
|
history
rpc.php
patch
|
blob
|
history
themes/default/stylesheet.css
patch
|
blob
|
history
themes/default/templates/search.tpl
patch
|
blob
|
history
diff --git
a/phpfspot.class.php
b/phpfspot.class.php
index 40b65516241fc8141f6c85ecb2aa342b5588994b..eaa788a10b97a9b2e1a2b032f55040340f3e31e7 100644
(file)
--- a/
phpfspot.class.php
+++ b/
phpfspot.class.php
@@
-49,6
+49,13
@@
class PHPFSPOT {
$this->cfg->product = "phpfspot";
$this->cfg->version = "1.2";
$this->cfg->product = "phpfspot";
$this->cfg->version = "1.2";
+ $this->sort_orders= array(
+ 'date_asc' => 'Date ↑',
+ 'date_desc' => 'Date ↓',
+ 'name_asc' => 'Name ↑',
+ 'name_desc' => 'Name ↓'
+ );
+
/* Check necessary requirements */
if(!$this->checkRequirements()) {
exit(1);
/* Check necessary requirements */
if(!$this->checkRequirements()) {
exit(1);
@@
-1420,12
+1427,11
@@
class PHPFSPOT {
* getPhotoSelection() will then only return the matching
* photos.
*/
* getPhotoSelection() will then only return the matching
* photos.
*/
- public function startSearch($searchfor, $
sort_order, $
from = 0, $to = 0)
+ public function startSearch($searchfor, $from = 0, $to = 0)
{
$this->get_tags();
$_SESSION['searchfor'] = $searchfor;
{
$this->get_tags();
$_SESSION['searchfor'] = $searchfor;
- $_SESSION['sort_order'] = $sort_order;
if($from != 0)
$_SESSION['from_date'] = strtotime($from);
else
if($from != 0)
$_SESSION['from_date'] = strtotime($from);
else
@@
-1446,6
+1452,23
@@
class PHPFSPOT {
} // startSearch()
} // startSearch()
+ /**
+ * updates sort order in session variable
+ *
+ * this function is invoked by RPC and will sort the requested
+ * sort order in the session variable.
+ */
+ public function updateSortOrder($order)
+ {
+ if(isset($this->sort_orders[$order])) {
+ $_SESSION['sort_order'] = $order;
+ return "ok";
+ }
+
+ return "unkown error";
+
+ } // updateSortOrder()
+
/**
* rotate image
*
/**
* rotate image
*
@@
-1931,23
+1954,15
@@
class PHPFSPOT {
*/
public function smarty_sort_select_list($params, &$smarty)
{
*/
public function smarty_sort_select_list($params, &$smarty)
{
- $output = "
<select name=\"sort_order\">
";
+ $output = "";
- $sorter = array(
- 'date_asc' => 'Date ↑',
- 'date_desc' => 'Date ↓',
- 'name_asc' => 'Name ↑',
- 'name_desc' => 'Name ↓'
- );
-
- foreach($sorter as $key => $value) {
+ foreach($this->sort_orders as $key => $value) {
$output.= "<option value=\"". $key ."\"";
if($key == $_SESSION['sort_order']) {
$output.= " selected=\"selected\"";
}
$output.= ">". $value ."</option>";
}
$output.= "<option value=\"". $key ."\"";
if($key == $_SESSION['sort_order']) {
$output.= " selected=\"selected\"";
}
$output.= ">". $value ."</option>";
}
- $output.= "</select>";
return $output;
return $output;
diff --git
a/phpfspot.js
b/phpfspot.js
index 6671eb2cb1914a49a4da406cf0bd446055358038..b196a68f846dbe3222b3309ac46f4066735daedb 100644
(file)
--- a/
phpfspot.js
+++ b/
phpfspot.js
@@
-113,9
+113,6
@@
function startSearch()
request = request + '&from='+ from +'&to='+ to;
}
request = request + '&from='+ from +'&to='+ to;
}
- var sort_order = document.getElementsByName('sort_order')[0];
- request = request + '&sort_order='+ sort_order.options[sort_order.selectedIndex].value;
-
HTML_AJAX.grab(encodeURI(request));
refreshAvailableTags();
HTML_AJAX.grab(encodeURI(request));
refreshAvailableTags();
@@
-402,6
+399,23
@@
function initSlider()
}
}
+function update_sort_order(obj)
+{
+ var objTemp = new Object();
+ objTemp['value'] = obj.options[obj.selectedIndex].value;
+
+ var retr = HTML_AJAX.post('rpc.php?action=update_sort_order', objTemp);
+
+ if(retr == "ok") {
+ showPhotoIndex();
+ }
+ else {
+ window.alert(retr);
+ }
+
+} // update_sort_order()
+
+
var startup = 1;
var calendar_shown = 0;
var calendar_mode = '';
var startup = 1;
var calendar_shown = 0;
var calendar_mode = '';
diff --git
a/rpc.php
b/rpc.php
index 0bd04fe9d036e1bef630467205bc07849685dd04..1f016336b4102a7f10ebad60d0acc6632665f5fa 100644
(file)
--- a/
rpc.php
+++ b/
rpc.php
@@
-101,13
+101,19
@@
class PHPFSPOT_RPC {
break;
case 'search':
break;
case 'search':
-
$fspot->startSearch($_GET['for'], $_GET['sort_orde
r'], $_GET['from'], $_GET['to']);
+
$fspot->startSearch($_GET['fo
r'], $_GET['from'], $_GET['to']);
if((isset($_GET['from']) && $fspot->isValidDate($_GET['from'])) &&
(isset($_GET['to']) && $fspot->isValidDate($_GET['to']))) {
}
else {
if((isset($_GET['from']) && $fspot->isValidDate($_GET['from'])) &&
(isset($_GET['to']) && $fspot->isValidDate($_GET['to']))) {
}
else {
- $fspot->startSearch($_GET['for'], $_GET['sort_order']);
+ $fspot->startSearch($_GET['for']);
+ }
+ break;
+
+ case 'update_sort_order':
+ if(isset($_POST['value']) && is_string($_POST['value'])) {
+ print $fspot->updateSortOrder($_POST['value']);
}
break;
}
break;
diff --git
a/themes/default/stylesheet.css
b/themes/default/stylesheet.css
index eae8f4aa4db409f4e2f4eb2c19267e3fbef01ddb..e12e57d8f0038aeb0f54012ad1c0e12b6f9efaa6 100644
(file)
--- a/
themes/default/stylesheet.css
+++ b/
themes/default/stylesheet.css
@@
-210,3
+210,16
@@
table.calendar tr td {
border: dashed 1px #888888;
\r
vertical-align: middle;
\r
}
\r
border: dashed 1px #888888;
\r
vertical-align: middle;
\r
}
\r
+
\r
+input.submit {
\r
+ background-color: #ffffff;
\r
+ border: 0px;
\r
+}
\r
+
\r
+input, select, textarea {
\r
+ background-color: #eeeeee;
\r
+ color: #333333;
\r
+ border: 1px solid #888888;
\r
+ border-collapse: collapse;
\r
+}
\r
+
\r
diff --git
a/themes/default/templates/search.tpl
b/themes/default/templates/search.tpl
index e12a0992ab7d43382c896576c6d27a04267a9a0c..cd2a93b23ac92734e0eace1ea525c701f13c1931 100644
(file)
--- a/
themes/default/templates/search.tpl
+++ b/
themes/default/templates/search.tpl
@@
-14,12
+14,12
@@
<input type="text" name="searchfor" value="{$searchfor}" size="15" />
</td>
<td>
<input type="text" name="searchfor" value="{$searchfor}" size="15" />
</td>
<td>
- <input type="image"
src="resources/doit.png" alt="Tag-S
earch" onclick="click(this);" />
+ <input type="image"
class="submit" src="resources/doit.png" alt="start search" title="start s
earch" onclick="click(this);" />
</td>
</tr>
<tr>
<td>Date:</td>
</td>
</tr>
<tr>
<td>Date:</td>
- <td>
+ <td
style="white-space: nowrap;"
>
{ if ! $date_search_enabled }
<input type="checkbox" name="consider_date" value="Y" onclick="datesearch();">
{ else }
{ if ! $date_search_enabled }
<input type="checkbox" name="consider_date" value="Y" onclick="datesearch();">
{ else }
@@
-38,18
+38,20
@@
{$to_date} <a href="javascript:showCalendar('to');" onclick="click(this);"><img src="resources/date.png" id="topic" /></a>
</td>
<td>
{$to_date} <a href="javascript:showCalendar('to');" onclick="click(this);"><img src="resources/date.png" id="topic" /></a>
</td>
<td>
- <input type="image"
src="resources/doit.png" alt="Tag-S
earch" onclick="click(this);" />
+ <input type="image"
class="submit" src="resources/doit.png" alt="start search" title="start s
earch" onclick="click(this);" />
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
- Sort-Order:
+ Sort-Order:
</td>
<td>
</td>
<td>
- { sort_select_list }
+ <select name="sort_order" onchange="update_sort_order(this);">
+ { sort_select_list }
+ </select>
</td>
<td>
</td>
<td>
- <input type="image" src="resources/doit.png" alt="Tag-Search" onclick="click(this);" />
+
</td>
</tr>
</form>
</td>
</tr>
</form>