Commit f2e1d0ae authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add search users box to main site pages

parent 774fc3d5
......@@ -28,10 +28,12 @@ define('INTERNAL', 1);
define('PUBLIC', 1);
require('init.php');
require_once('pieforms/pieform.php');
$smarty = smarty();
$smarty->assign('page_content', get_site_page_content('about'));
$smarty->assign('site_menu', site_menu());
$smarty->assign('searchform', pieform(searchform()));
$smarty->display('sitepage.tpl');
?>
......@@ -28,7 +28,7 @@ define('INTERNAL', 1);
define('PUBLIC', 1);
require('init.php');
require_once('form.php');
require_once('pieforms/pieform.php');
if ($SESSION->is_logged_in()) {
$name = display_name($USER);
......@@ -39,7 +39,7 @@ else {
$email = '';
}
$contactform = form(array(
$contactform = pieform(array(
'name' => 'contactus',
'method' => 'post',
'action' => '',
......@@ -118,6 +118,7 @@ function contactus_submit($values) {
$smarty = smarty();
$smarty->assign('page_content', $contactform);
$smarty->assign('site_menu', site_menu());
$smarty->assign('searchform', pieform(searchform()));
$smarty->display('sitepage.tpl');
?>
......@@ -29,12 +29,11 @@ define('PUBLIC', 1);
define('MENUITEM', 'home');
require('init.php');
require_once('pieforms/pieform.php');
// Check for whether the user is logged in, before processing the page. After
// this, we can guarantee whether the user is logged in or not for this page.
if (!$SESSION->is_logged_in()) {
//require_once('form.php');
require_once('pieforms/pieform.php');
$loginform = get_login_form_js(pieform(array(
'name' => 'login',
'renderer' => 'div',
......@@ -86,6 +85,9 @@ $smarty = smarty();
if (!$SESSION->is_logged_in()) {
$smarty->assign('login_form', $loginform);
}
else {
$smarty->assign('searchform', pieform(searchform()));
}
$smarty->assign('page_content', get_site_page_content($pagename));
$smarty->assign('site_menu', site_menu());
$smarty->display('index.tpl');
......
......@@ -1297,4 +1297,23 @@ function pieform_configure() {
);
}
function searchform() {
return array(
'name' => 'searchform',
'method' => 'get',
'action' => '',
'elements' => array(
'query' => array(
'type' => 'text',
'defaultvalue' => '',
),
)
);
}
function searchform_submit($values) {
$query = empty($values['query']) ? '' : '?query=' . rawurlencode($values['query']);
redirect(get_config('wwwroot') . 'user/search.php' . $query);
}
?>
......@@ -28,10 +28,12 @@ define('INTERNAL', 1);
define('PUBLIC', 1);
require('init.php');
require_once('pieforms/pieform.php');
$smarty = smarty();
$smarty->assign('page_content', get_site_page_content('privacy'));
$smarty->assign('site_menu', site_menu());
$smarty->assign('searchform', pieform(searchform()));
$smarty->display('sitepage.tpl');
?>
......@@ -28,10 +28,12 @@ define('INTERNAL', 1);
define('PUBLIC', 1);
require('init.php');
require_once('pieforms/pieform.php');
$smarty = smarty();
$smarty->assign('page_content', get_site_page_content('termsandconditions'));
$smarty->assign('site_menu', site_menu());
$smarty->assign('searchform', pieform(searchform()));
$smarty->display('sitepage.tpl');
?>
<div class="sidebar">
{str tag="mainmenu"}
<ul id="sitemenu">
{foreach from=$site_menu item=item}
<li><a href="{$item.link|escape}">{$item.name}</a></li>
......
......@@ -5,6 +5,8 @@
<noscript><p>{str tag="javascriptnotenabled"}</p></noscript>
</div>
{$login_form}
{else}
{include file="searchbox.tpl"}
{/if}
{include file="adminmenu.tpl"}
......
<div class="sidebar">
{str tag="searchusers"}
{$searchform}
</div>
{include file="header.tpl"}
{include file="searchbox.tpl"}
{include file="adminmenu.tpl"}
<div class="content">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment