[geeklog-cvs] geeklog: Corrected some code logic, sort items were still being ...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Thu Nov 5 16:36:39 EST 2009


changeset 7441:142904168971
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/142904168971
user: Sami Barakat <sami at sbarakat.co.uk>
date: Thu Nov 05 21:33:05 2009 +0000
description:
Corrected some code logic, sort items were still being displayed when they had been disabled using ListFactory::setField()

diffstat:

 system/classes/listfactory.class.php |  50 +++++++++++++++----------
 1 files changed, 30 insertions(+), 20 deletions(-)

diffs (76 lines):

diff -r d2f5a93daea6 -r 142904168971 system/classes/listfactory.class.php
--- a/system/classes/listfactory.class.php	Thu Nov 05 19:05:28 2009 +0000
+++ b/system/classes/listfactory.class.php	Thu Nov 05 21:33:05 2009 +0000
@@ -665,42 +665,52 @@
                 $text = $sort_text . $field['title'];
                 $href = '';
                 $selected = '';
-                if ($show_sort && $field['sort'] != false)
+                
+                if ($this->_style == 'inline' && $show_sort && $field['sort'] != false)
                 {
                     $direction = $this->_def_sort_arr['direction'];
 
                     // Show the sort arrow
                     if ($this->_sort_arr['field'] === $field['name'])
                     {
+                        // Add drop down item for current sort order
+                        $list_templates->set_var('sort_text', $text.' ('.$this->_sort_arr['direction'].')');
+                        $list_templates->set_var('sort_href', '');
+                        $list_templates->set_var('sort_selected', ' selected="selected"');
+                        $list_templates->parse('page_sort', 'sort', true);
+
+                        // Set up the sort order for the opposite direction
                         $direction = $this->_sort_arr['direction'] == 'asc' ? 'desc' : 'asc';
+                        $text .= " ($direction)";
+                    }
+                    $href = $this->_page_url . "results={$this->_per_page}&" .
+                                "order={$field['name']}&direction=$direction";
 
-                        if ($this->_style == 'inline') {
-                            // Add drop down item for current sort order
-                            $list_templates->set_var('sort_text', $text.' ('.$this->_sort_arr['direction'].')');
-                            $list_templates->set_var('sort_href', '');
-                            $list_templates->set_var('sort_selected', ' selected="selected"');
-                            $list_templates->parse('page_sort', 'sort', true);
+                    // Write field
+                    $list_templates->set_var('sort_text', $text);
+                    $list_templates->set_var('sort_href', $href);
+                    $list_templates->set_var('sort_selected', '');
+                    $list_templates->parse('page_sort', 'sort', true);
+                }
+                else if ($this->_style == 'table')
+                {
+                    if ($show_sort && $field['sort'] != false)
+                    {
+                        $text = "<a href=\"$href\">$text</a>";
 
-                            // Set up the sort order for the opposite direction
-                            $text .= " ($direction)";
-                        } else {
+                        if ($this->_sort_arr['field'] === $field['name']) {
                             $selected = $sort_selected;
                         }
                     }
-
                     $href = $this->_page_url . "results={$this->_per_page}&" .
                                 "order={$field['name']}&direction=$direction";
 
-                    if ($this->_style == 'table') {
-                        $text = "<a href=\"$href\">$text</a>";
-                    }
+                    // Write field
+                    $list_templates->set_var('sort_text', $text);
+                    $list_templates->set_var('sort_href', $href);
+                    $list_templates->set_var('sort_selected', $selected);
+                    $list_templates->parse('page_sort', 'sort', true);
                 }
-
-                // Write field
-                $list_templates->set_var('sort_text', $text);
-                $list_templates->set_var('sort_href', $href);
-                $list_templates->set_var('sort_selected', $selected);
-                $list_templates->parse('page_sort', 'sort', true);
             }
         }
 



More information about the geeklog-cvs mailing list