add contact_widgets and provide widgets on appropriate pages, fix the saved search widget

fix directory page on testbubble, don't use system theme for community, directory, and search if the viewer is logged in.
This commit is contained in:
Friendika 2011-10-11 19:27:58 -07:00
parent 557a7d0cec
commit 2206d894b3
9 changed files with 90 additions and 44 deletions

View file

@ -0,0 +1,40 @@
<?php
function follow_widget() {
return replace_macros(get_markup_template('follow.tpl'),array(
'$connect' => t('Add New Contact'),
'$desc' => t('Enter address or web location'),
'$hint' => t('Example: bob@example.com, http://example.com/barbara'),
'$follow' => t('Connect')
));
}
function findpeople_widget() {
$a = get_app();
$inv = (($a->config['register_policy'] != REGISTER_CLOSED) ? t('Invite Friends') : '');
if(get_config('system','invitation_only')) {
$x = get_pconfig(local_user(),'system','invites_remaining');
if($x || is_site_admin()) {
$a->page['aside'] .= '<div class="side-link" id="side-invite-remain">'
. sprintf( tt('%d invitation available','%d invitations available',$x), $x)
. '</div>' . $inv;
}
}
return replace_macros(get_markup_template('peoplefind.tpl'),array(
'$findpeople' => t('Find People'),
'$desc' => t('Enter name or interest'),
'$label' => t('Connect/Follow'),
'$hint' => t('Examples: Robert Morgenstein, Fishing'),
'$findthem' => t('Find'),
'$similar' => t('Similar Interests'),
'$inv' => $inv
));
}

View file

@ -1,5 +1,12 @@
<?php
function community_init(&$a) {
if(! local_user())
unset($_SESSION['theme']);
}
function community_content(&$a, $update = 0) {
@ -19,9 +26,6 @@ function community_content(&$a, $update = 0) {
require_once('include/security.php');
require_once('include/conversation.php');
if(x($_SESSION,'theme'))
unset($_SESSION['theme']);
$o .= '<h3>' . t('Community') . '</h3>';
if(! $update) {

View file

@ -19,44 +19,16 @@ function contacts_init(&$a) {
}
require_once('include/group.php');
require_once('include/contact_widgets.php');
if(! x($a->page,'aside'))
$a->page['aside'] = '';
$a->page['aside'] .= replace_macros(get_markup_template('follow.tpl'),array(
'$connect' => t('Add New Contact'),
'$desc' => t('Enter address or web location'),
'$hint' => t('Example: bob@example.com, http://example.com/barbara'),
'$follow' => t('Connect')
));
$a->page['aside'] .= follow_widget();
$a->page['aside'] .= group_side('contacts','group',false,0,$contact_id);
if(get_config('system','invitation_only')) {
$x = get_pconfig(local_user(),'system','invites_remaining');
if($x || is_site_admin()) {
$a->page['aside'] .= '<div class="side-link" id="side-invite-remain">'
. sprintf( tt('%d invitation available','%d invitations available',$x), $x)
. '</div>' . $inv;
}
}
$tpl = get_markup_template('peoplefind.tpl');
$inv = (($a->config['register_policy'] != REGISTER_CLOSED) ? t('Invite Friends') : '');
$a->page['aside'] .= replace_macros($tpl,array(
'$findpeople' => t('Find People'),
'$desc' => t('Enter name or interest'),
'$label' => t('Connect/Follow'),
'$hint' => t('Examples: Robert Morgenstein, Fishing'),
'$findthem' => t('Find'),
'$similar' => t('Similar Interests'),
'$inv' => $inv
));
$a->page['aside'] .= findpeople_widget();
}

View file

@ -2,6 +2,17 @@
function directory_init(&$a) {
$a->set_pager_itemspage(60);
if(local_user()) {
require_once('include/contact_widgets.php');
$a->page['aside'] .= findpeople_widget();
}
else
unset($_SESSION['theme']);
}
@ -23,8 +34,6 @@ function directory_content(&$a) {
$o = '';
nav_set_selected('directory');
if(x($_SESSION,'theme'))
unset($_SESSION['theme']);
if(x($a->data,'search'))
$search = notags(trim($a->data['search']));
@ -45,12 +54,13 @@ function directory_content(&$a) {
if($everything)
$admin = '<ul><li><div id="directory-admin-link"><a href="' . $a->get_baseurl() . '/directory' . '">' . t('Normal site view') . '</a></div></li></ul>';
else
$admin = '<ul><li><div id="directory-admin-link"><a href="' . $a->get_baseurl() . '/directory/all' . '">' . t('View all site entries') . '</a></div></li></ul>';
$admin = '<ul><li><div id="directory-admin-link"><a href="' . $a->get_baseurl() . '/directory/all' . '">' . t('Admin - View all site entries') . '</a></div></li></ul>';
}
$o .= replace_macros($tpl, array(
'$search' => $search,
'$globaldir' => $globaldir,
'$desc' => t('Find on this site'),
'$admin' => $admin,
'$finding' => (strlen($search) ? '<h4>' . t('Finding: ') . "'" . $search . "'" . '</h4>' : ""),
'$sitedir' => t('Site Directory'),

View file

@ -1,5 +1,18 @@
<?php
function dirfind_init(&$a) {
require_once('include/contact_widgets.php');
if(! x($a->page,'aside'))
$a->page['aside'] = '';
$a->page['aside'] .= follow_widget();
$a->page['aside'] .= findpeople_widget();
}
function dirfind_content(&$a) {

View file

@ -78,11 +78,13 @@ function saved_searches($search) {
if(count($r)) {
$o .= '<ul id="saved-search-ul">' . "\r\n";
foreach($r as $rr) {
$o .= '<li class="saved-search-li clear"><a href="network/?f=&remove=1&search=' . $rr['term'] . '" class="icon drophide savedsearchdrop" title="' . t('Remove term') . '" onclick="return confirmDelete();" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a> <a href="network/?f&search=' . urlencode($rr['term']) . '" class="savedsearchterm" >' . $rr['term'] . '</a></li>' . "\r\n";
$o .= '<li class="saved-search-li clear"><a href="network/?f=&remove=1&search=' . $rr['term'] . '" class="icon drophide savedsearchdrop" title="' . t('Remove term') . '" onclick="return confirmDelete();" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a> <a href="network/?f=&search=' . urlencode($rr['term']) . '" class="savedsearchterm" >' . $rr['term'] . '</a></li>' . "\r\n";
}
$o .= '</ul>';
}
$o .= '<div class="clear"></div>';
$o .= '</div>' . "\r\n";
return $o;

View file

@ -15,7 +15,7 @@ function search_saved_searches() {
foreach($r as $rr) {
$o .= '<li class="saved-search-li clear"><a href="search/?f=&remove=1&search=' . $rr['term'] . '" class="icon drophide savedsearchdrop" title="' . t('Remove term') . '" onclick="return confirmDelete();" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a> <a href="search/?f=&search=' . $rr['term'] . '" class="savedsearchterm" >' . $rr['term'] . '</a></li>' . "\r\n";
}
$o .= '</ul></div>' . "\r\n";
$o .= '</ul><div class="clear"></div></div>' . "\r\n";
}
return $o;
@ -50,6 +50,9 @@ function search_init(&$a) {
$a->page['aside'] .= search_saved_searches();
}
else
unset($_SESSION['theme']);
}
@ -75,12 +78,9 @@ function search_content(&$a) {
require_once('include/security.php');
require_once('include/conversation.php');
if(x($_SESSION,'theme'))
unset($_SESSION['theme']);
$o = '<div id="live-search"></div>' . "\r\n";
$o .= '<h3>' . t('Search') . '</h3>';
$o .= '<h3>' . t('Search This Site') . '</h3>';
if(x($a->data,'search'))
$search = notags(trim($a->data['search']));

View file

@ -7,6 +7,7 @@ $finding
<div id="directory-search-wrapper">
<form id="directory-search-form" action="directory" method="get" >
<span class="dirsearch-desc">$desc</span>
<input type="text" name="search" id="directory-search" class="search-input" onfocus="this.select();" value="$search" />
<input type="submit" name="submit" id="directory-search-submit" value="$submit" class="button" />
</form>

View file

@ -2614,6 +2614,10 @@ tr {
width: 150px;
}
.directory-end {
clear: both;
}
/* ========= */
/* = Admin = */
/* ========= */