]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
added filler text to notice and group search, suggesting other search options.
authorRobin Millette <millette@controlyourself.ca>
Tue, 7 Apr 2009 03:26:33 +0000 (03:26 +0000)
committerRobin Millette <millette@controlyourself.ca>
Tue, 7 Apr 2009 03:26:33 +0000 (03:26 +0000)
actions/groupsearch.php
actions/noticesearch.php

index 109a53ce112704a0ff6f92795fb703e1e1c53b06..31c4ffd948e1c317ad0c2817eac9369baed7724d 100644 (file)
@@ -72,12 +72,23 @@ class GroupsearchAction extends SearchAction
             $terms = preg_split('/[\s,]+/', $q);
             $results = new GroupSearchResults($user_group, $terms, $this);
             $results->show();
+            $user_group->free();
+            $this->pagination($page > 1, $cnt > GROUPS_PER_PAGE,
+                          $page, 'groupsearch', array('q' => $q));
         } else {
-            $this->element('p', 'error', _('No results'));
+            $this->element('p', 'error', _('No results.'));
+            $this->searchSuggestions($q);
+            if (common_logged_in()) {
+                $message = _('If you can\'t find the group you\'re looking for, you can [create it](%%action.newgroup%%) yourself.');
+            }
+            else {
+                $message = _('Why not [register an account](%%action.register%%) and [create the group](%%action.newgroup%%) yourself!');
+            }
+            $this->elementStart('div', 'blankfiller');
+            $this->raw(common_markup_to_html($message));
+            $this->elementEnd('div');
+            $user_group->free();
         }
-        $user_group->free();
-        $this->pagination($page > 1, $cnt > GROUPS_PER_PAGE,
-                          $page, 'groupsearch', array('q' => $q));
     }
 }
 
@@ -98,10 +109,5 @@ class GroupSearchResults extends GroupList
     {
         return preg_replace($this->pattern, '<strong>\\1</strong>', htmlspecialchars($text));
     }
-
-    function isReadOnly()
-    {
-        return true;
-    }
 }
 
index 9058cf53c302d83ab6af1fc66c9602b8b032f2e6..a4308450b4044653a767a9615ead6132e97a25ac 100644 (file)
@@ -114,22 +114,27 @@ class NoticesearchAction extends SearchAction
             $cnt = $notice->find();
         }
         if ($cnt === 0) {
-            $this->element('p', 'error', _('No results'));
+            $this->element('p', 'error', _('No results.'));
+
+            $this->searchSuggestions($q);
+            if (common_logged_in()) {
+                $message = sprintf(_('Be the first to [post on this topic](%%%%action.newnotice%%%%?status_textarea=%s)!'), urlencode($q));
+            }
+            else {
+                $message = sprintf(_('Why not [register an account](%%%%action.register%%%%) and be the first to  [post on this topic](%%%%action.newnotice%%%%?status_textarea=%s)!'), urlencode($q));
+            }
+
+            $this->elementStart('div', 'blankfiller');
+            $this->raw(common_markup_to_html($message));
+            $this->elementEnd('div');
             return;
         }
         $terms = preg_split('/[\s,]+/', $q);
         $nl = new SearchNoticeList($notice, $this, $terms);
-
         $cnt = $nl->show();
-
         $this->pagination($page > 1, $cnt > NOTICES_PER_PAGE,
                           $page, 'noticesearch', array('q' => $q));
     }
-
-    function isReadOnly()
-    {
-        return true;
-    }
 }
 
 class SearchNoticeList extends NoticeList {