[geeklog-cvs] geeklog: Fixed double all selection in topics in search and fixe...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Fri Dec 23 15:44:49 EST 2011
changeset 8461:75a544b48e66
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/75a544b48e66
user: Tom <websitemaster at cogeco.net>
date: Fri Dec 23 13:13:22 2011 -0500
description:
Fixed double all selection in topics in search and fixed searching of stories when all is selected.
diffstat:
public_html/layout/professional/search/searchform.thtml | 1 -
public_html/layout/professional_css/search/searchform.thtml | 1 -
system/classes/search.class.php | 23 ++++++++++--
3 files changed, 19 insertions(+), 6 deletions(-)
diffs (72 lines):
diff -r 9090774b8663 -r 75a544b48e66 public_html/layout/professional/search/searchform.thtml
--- a/public_html/layout/professional/search/searchform.thtml Fri Dec 23 13:10:43 2011 -0500
+++ b/public_html/layout/professional/search/searchform.thtml Fri Dec 23 13:13:22 2011 -0500
@@ -23,7 +23,6 @@
<td class="alignright">{lang_topic}:</td>
<td>
<select name="topic">
- <option selected="selected" value="0">{lang_all}</option>
{topic_option_list}
</select>
</td>
diff -r 9090774b8663 -r 75a544b48e66 public_html/layout/professional_css/search/searchform.thtml
--- a/public_html/layout/professional_css/search/searchform.thtml Fri Dec 23 13:10:43 2011 -0500
+++ b/public_html/layout/professional_css/search/searchform.thtml Fri Dec 23 13:13:22 2011 -0500
@@ -26,7 +26,6 @@
<dt><label for="advsearchform-topic">{lang_topic}</label></dt>
<dd>
<select name="topic" id="advsearchform-topic">
- <option selected="selected" value="0">{lang_all}</option>
{topic_option_list}
</select>
</dd>
diff -r 9090774b8663 -r 75a544b48e66 system/classes/search.class.php
--- a/system/classes/search.class.php Fri Dec 23 13:10:43 2011 -0500
+++ b/system/classes/search.class.php Fri Dec 23 13:13:22 2011 -0500
@@ -83,6 +83,11 @@
}
if (isset ($_GET['topic'])) {
$this->_topic = COM_applyFilter ($_GET['topic']);
+ } else {
+ $last_topic = SESS_getVariable('topic');
+ if ($last_topic != '') {
+ $this->_topic = $last_topic;
+ }
}
if (isset ($_GET['datestart'])) {
$this->_dateStart = COM_applyFilter ($_GET['datestart']);
@@ -330,12 +335,17 @@
$sql .= 'FROM '.$_TABLES['stories'].' AS s, '.$_TABLES['users'].' AS u, '.$_TABLES['topic_assignments'].' AS ta ';
$sql .= 'WHERE (draft_flag = 0) AND (date <= NOW()) AND (u.uid = s.uid) ';
$sql .= 'AND ta.type = \'article\' AND ta.id = sid ';
- $sql .= COM_getPermSQL('AND') . COM_getTopicSQL('AND') . COM_getLangSQL('sid', 'AND') . ' ';
+ $sql .= COM_getPermSQL('AND') . COM_getTopicSQL('AND', 0, 'ta') . COM_getLangSQL('sid', 'AND') . ' ';
if (!empty($this->_topic)) {
// Retrieve list of inherited topics
- $tid_list = TOPIC_getChildList($this->_topic);
- $sql .= "AND (ta.tid IN({$tid_list}) AND (ta.inherit = 1 OR (ta.inherit = 0 AND ta.tid = '".$this->_topic."'))) ";
+ if ($this->_topic == TOPIC_ALL_OPTION) {
+ // Stories do not have an all option so just return all stories that meet the requirements and permissions
+ //$sql .= "AND (ta.inherit = 1 OR (ta.inherit = 0 AND ta.tid = '".$this->_topic."')) ";
+ } else {
+ $tid_list = TOPIC_getChildList($this->_topic);
+ $sql .= "AND (ta.tid IN({$tid_list}) AND (ta.inherit = 1 OR (ta.inherit = 0 AND ta.tid = '".$this->_topic."'))) ";
+ }
}
if (!empty($this->_author)) {
$sql .= 'AND (s.uid = \''.$this->_author.'\') ';
@@ -372,7 +382,12 @@
$sql .= 'AND ta.type = \'article\' AND ta.id = s.sid '.COM_getTopicSQL('AND',0,'ta');
if (!empty($this->_topic)) {
- $sql .= "AND (ta.tid IN({$tid_list}) AND (ta.inherit = 1 OR (ta.inherit = 0 AND ta.tid = '".$this->_topic."'))) ";
+ if ($this->_topic == TOPIC_ALL_OPTION) {
+ // Stories do not have an all option so just return all story comments that meet the requirements and permissions
+ //$sql .= "AND (ta.inherit = 1 OR (ta.inherit = 0 AND ta.tid = '".$this->_topic."')) ";
+ } else {
+ $sql .= "AND (ta.tid IN({$tid_list}) AND (ta.inherit = 1 OR (ta.inherit = 0 AND ta.tid = '".$this->_topic."'))) ";
+ }
}
if (!empty($this->_author)) {
$sql .= 'AND (c.uid = \''.$this->_author.'\') ';
More information about the geeklog-cvs
mailing list