]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/searchaction.php
a distributed -> the distributed
[quix0rs-gnu-social.git] / lib / searchaction.php
index 71ab3a6ef5f1ad100b0c68b7ebfd12eea0c261b4..4da2c012d1e33c277850f17ca94b90dc00e8f0d1 100644 (file)
@@ -5,14 +5,14 @@
  * PHP version 5
  *
  * @category Action
- * @package  Laconica
+ * @package  StatusNet
  * @author   Evan Prodromou <evan@controlyourself.ca>
  * @author   Robin Millette <millette@controlyourself.ca>
  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
  * @link     http://laconi.ca/
  *
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2008, 2009, StatusNet, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
@@ -38,7 +38,7 @@ require_once INSTALLDIR.'/lib/searchgroupnav.php';
  * Base search action class.
  *
  * @category Action
- * @package  Laconica
+ * @package  StatusNet
  * @author   Evan Prodromou <evan@controlyourself.ca>
  * @author   Robin Millette <millette@controlyourself.ca>
  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
@@ -51,7 +51,7 @@ class SearchAction extends Action
      *
      * @return boolean true
      */
-    function isReadOnly()
+    function isReadOnly($args)
     {
         return true;
     }
@@ -73,16 +73,17 @@ class SearchAction extends Action
 
     function showLocalNav()
     {
-        $nav = new SearchGroupNav($this);
+        $nav = new SearchGroupNav($this, $this->trimmed('q'));
         $nav->show();
     }
 
     function showTop($arr=null)
     {
+        $error = null;
         if ($arr) {
             $error = $arr[1];
         }
-        if ($error) {
+        if (!empty($error)) {
             $this->element('p', 'error', $error);
         } else {
             $instr = $this->getInstructions();
@@ -98,11 +99,6 @@ class SearchAction extends Action
         return null;
     }
 
-    function show_header($arr)
-    {
-        return;
-    }
-
     function showNoticeForm() {
         // remote post notice form
     }
@@ -114,26 +110,54 @@ class SearchAction extends Action
 
     function showForm($error=null)
     {
-        global $config;
-
         $q = $this->trimmed('q');
         $page = $this->trimmed('page', 1);
         $this->elementStart('form', array('method' => 'get',
-                                           'id' => 'login',
+                                           'id' => 'form_search',
+                                           'class' => 'form_settings',
                                            'action' => common_local_url($this->trimmed('action'))));
-        $this->elementStart('p');
-        if (!isset($config['site']['fancy']) || !$config['site']['fancy']) {
+        $this->elementStart('fieldset');
+        $this->element('legend', null, _('Search site'));
+        $this->elementStart('ul', 'form_data');
+        $this->elementStart('li');
+        if (!common_config('site', 'fancy')) {
             $this->hidden('action', $this->trimmed('action'));
         }
-        $this->input('q', '', $q);
-        $this->text(' ');
+        $this->input('q', 'Keyword(s)', $q);
         $this->submit('search', 'Search');
-
-        $this->elementEnd('p');
+        $this->elementEnd('li');
+        $this->elementEnd('ul');
+        $this->elementEnd('fieldset');
         $this->elementEnd('form');
         if ($q) {
             $this->showResults($q, $page);
         }
     }
+
+    function searchSuggestions($q) {
+        $qe = urlencode($q);
+        $message = sprintf(_(<<<E_O_T
+* Make sure all words are spelled correctly.
+* Try different keywords.
+* Try more general keywords.
+* Try fewer keywords.
+
+You can also try your search on other engines:
+
+* [Twingly](http://www.twingly.com/search?q=%s&content=microblog&site=identi.ca)
+* [Tweet scan](http://www.tweetscan.com/indexi.php?s=%s)
+* [Google](http://www.google.com/search?q=site%%3A%%%%site.server%%%%+%s)
+* [Yahoo](http://search.yahoo.com/search?p=site%%3A%%%%site.server%%%%+%s)
+* [Collecta](http://collecta.com/#q=%s)
+
+E_O_T
+), $qe, $qe, $qe, $qe, $qe);
+        $this->elementStart('dl', array('id' => 'help_search', 'class' => 'help'));
+        $this->element('dt', null, _('Search help'));
+        $this->elementStart('dd', 'instructions');
+        $this->raw(common_markup_to_html($message));
+        $this->elementEnd('dd');
+        $this->elementEnd('div');
+    }
 }