X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fgroupsearch.php;h=55f4cee625e37b5265ea40ef490945ceceb021da;hb=6512282241cbc06903f64a566295804017beb8e5;hp=9b0026db949c60cb7b77a5964792141e6c97e791;hpb=0ef33663ce0b3739e8e9eb3b9951dee5059c6b3b;p=quix0rs-gnu-social.git diff --git a/actions/groupsearch.php b/actions/groupsearch.php index 9b0026db94..55f4cee625 100644 --- a/actions/groupsearch.php +++ b/actions/groupsearch.php @@ -1,23 +1,18 @@ - * @author Robin Millette + * @package StatusNet + * @author Evan Prodromou + * @author Robin Millette * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ * - * 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 @@ -33,7 +28,7 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -44,11 +39,11 @@ if (!defined('LACONICA')) { * Group search action class. * * @category Action - * @package Laconica - * @author Evan Prodromou - * @author Robin Millette + * @package StatusNet + * @author Evan Prodromou + * @author Robin Millette * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 - * @link http://laconi.ca/ + * @link http://status.net/ */ class GroupsearchAction extends SearchAction { @@ -77,12 +72,29 @@ 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', 'guide'); + $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)); + } + + function showScripts() + { + parent::showScripts(); + $this->autofocus('q'); } } @@ -90,23 +102,18 @@ class GroupSearchResults extends GroupList { var $terms = null; var $pattern = null; - + function __construct($user_group, $terms, $action) { - parent::__construct($user_group, $terms, $action); - $this->terms = array_map('preg_quote', + parent::__construct($user_group, null, $action); + $this->terms = array_map('preg_quote', array_map('htmlspecialchars', $terms)); $this->pattern = '/('.implode('|',$terms).')/i'; } - + function highlight($text) { return preg_replace($this->pattern, '\\1', htmlspecialchars($text)); } - - function isReadOnly() - { - return true; - } }