Added search block;

This commit is contained in:
Marc Alexander
2010-10-31 15:19:06 +00:00
parent f85ea2624f
commit c1dbe87441
4 changed files with 206 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
<?php
/**
* @package Portal - Search
* @version $Id$
* @copyright (c) 2009, 2010 Board3 Portal Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
/**
* DO NOT CHANGE
*/
if (!defined('IN_PHPBB'))
{
exit;
}
if (empty($lang) || !is_array($lang))
{
$lang = array();
}
// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
$lang = array_merge($lang, array(
'PORTAL_SEARCH' => 'Search',
'PORTAL_SEARCH_GO' => 'Go',
'PORTAL_SEARCH_SITE' => 'Forums',
'PORTAL_SEARCH_POSTS' => 'Posts',
'PORTAL_SEARCH_AUTHOR' => 'Author',
'PORTAL_SEARCH_ENGINE' => 'Search engines',
'PORTAL_SEARCH_ADV' => 'Advanced search',
));
?>

View File

@@ -0,0 +1,86 @@
<?php
/**
* @package Portal - Search
* @version $Id$
* @copyright (c) 2009, 2010 Board3 Portal Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* @package Search
*/
class portal_search_module
{
/**
* Allowed columns: Just sum up your options (Exp: left + right = 10)
* top 1
* left 2
* center 4
* right 8
* bottom 16
*/
var $columns = 10;
/**
* Default modulename
*/
var $name = 'PORTAL_SEARCH';
/**
* Default module-image:
* file must be in "{T_THEME_PATH}/images/portal/"
*/
var $image_src = 'portal_search.png';
/**
* module-language file
* file must be in "language/{$user->lang}/mods/portal/"
*/
var $language = 'portal_search_module';
/**
* custom acp template
* file must be in "adm/style/portal/"
*/
var $custom_acp_tpl = '';
function get_template_side($module_id)
{
global $template, $phpbb_root_path, $phpEx;
$template->assign_var('S_SEARCH_ACTION', append_sid("{$phpbb_root_path}search.$phpEx"));
return 'search_side.html';
}
function get_template_acp($module_id)
{
return array(
'title' => 'PORTAL_SEARCH',
'vars' => array(),
);
}
/**
* API functions
*/
function install($module_id)
{
return true;
}
function uninstall($module_id)
{
return true;
}
}
?>

View File

@@ -0,0 +1,77 @@
<!--version $Id$ //-->
<script type="text/javascript">
<!--
function qsearch_onSubmit()
{
qs_enginename = document.getElementById('qsearch_select').value;
qs_keywords = document.getElementById('searchfield').value;
switch( qs_enginename )
{
case 'site':
break;
case 'author':
window.open('search.php?author=' + qs_keywords, '_self', '');
return false;
case 'wikipedia':
window.open('http://en.wikipedia.org/wiki/Spezial:Search?search=' + qs_keywords, '_wikipedia', '');
return false;
case 'google':
window.open('http://www.google.com/search?q=' + qs_keywords, '_google', '');
return false;
case 'yahoo':
window.open('http://search.yahoo.com/search?p=' + qs_keywords, '_yahoo', '');
return false;
case 'bing':
window.open('http://www.bing.com/search?q=' + qs_keywords, '_bing', '');
return false;
case 'altavista':
window.open('http://www.altavista.com/web/results?itag=ody&q=' + qs_keywords + '&kgs=0&kls=0', '_altavista', '');
return false;
case 'lycos':
window.open('http://search.lycos.com/?query=' + qs_keywords, '_lycos', '');
return false;
case 'odp':
window.open('http://search.dmoz.org/cgi-bin/search?search=' + qs_keywords, '_odp', '');
return false;
default:
if( (i = qsearch_findEngine(qs_enginename)) >= 0 )
{
window.open(qsearch_engines[i].url + qs_keywords, '_blank', '');
return false;
}
break;
}
return true;
}
//-->
</script>
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{$IMAGE_SRC}" width="16" height="16" alt="" />&nbsp;<!-- ENDIF -->{L_PORTAL_SEARCH}{$LR_BLOCK_H_R}
<form id="qsearch_form" method="post" action="{U_SEARCH}" onsubmit="return qsearch_onSubmit();">
<p>
<input type="text" tabindex="6" name="keywords" id="searchfield" size="22" maxlength="40" title="{L_SEARCH_KEYWORDS}" class="inputbox search" value="<!-- IF SEARCH_WORDS-->{SEARCH_WORDS}<!-- ELSE -->{L_SEARCH_MINI}<!-- ENDIF -->" onclick="if(this.value=='{LA_SEARCH_MINI}')this.value='';" onblur="if(this.value=='')this.value='{LA_SEARCH_MINI}';" />
</p>
<p>
<select id="qsearch_select" tabindex="7">
<optgroup label="{L_PORTAL_SEARCH_SITE}">
<option value="site">{L_PORTAL_SEARCH_POSTS}</option>
<option value="author">{L_PORTAL_SEARCH_AUTHOR}</option>
</optgroup>
<optgroup label="{L_PORTAL_SEARCH_ENGINE}">
<option value="wikipedia">Wikipedia</option>
<option value="google">Google</option>
<option value="yahoo">Yahoo</option>
<option value="bing">Bing</option>
<option value="altavista">Altavista</option>
<option value="lycos">Lycos</option>
<option value="odp">Open directory</option>
</optgroup>
</select>
<input type="hidden" name="search_fields" value="all" />
<input type="hidden" name="show_results" value="topics" />
<input type="submit" value="{L_PORTAL_SEARCH_GO}" class="button2" tabindex="8" />
</p>
</form>
<p><a href="{U_SEARCH}">{L_PORTAL_SEARCH_ADV}</a></p>
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}

Binary file not shown.

After

Width:  |  Height:  |  Size: 813 B