From 2206d894b3fec7064b91e0420bcc2b16e9e7009b Mon Sep 17 00:00:00 2001 From: Friendika Date: Tue, 11 Oct 2011 19:27:58 -0700 Subject: 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. --- include/contact_widgets.php | 40 ++++++++++++++++++++++++++++++++++++++++ mod/community.php | 10 +++++++--- mod/contacts.php | 36 ++++-------------------------------- mod/directory.php | 16 +++++++++++++--- mod/dirfind.php | 13 +++++++++++++ mod/network.php | 4 +++- mod/search.php | 10 +++++----- view/directory_header.tpl | 1 + view/theme/testbubble/style.css | 4 ++++ 9 files changed, 90 insertions(+), 44 deletions(-) create mode 100644 include/contact_widgets.php diff --git a/include/contact_widgets.php b/include/contact_widgets.php new file mode 100644 index 000000000..efb833aaf --- /dev/null +++ b/include/contact_widgets.php @@ -0,0 +1,40 @@ + 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'] .= '' . $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 + )); + +} + diff --git a/mod/community.php b/mod/community.php index cb255029f..34c992bad 100644 --- a/mod/community.php +++ b/mod/community.php @@ -1,5 +1,12 @@ ' . t('Community') . ''; if(! $update) { diff --git a/mod/contacts.php b/mod/contacts.php index d24873b8f..9bbcea07d 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -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'] .= '' . $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(); } diff --git a/mod/directory.php b/mod/directory.php index 93abcd5de..5f00b4f5a 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -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 = ''; else - $admin = ''; + $admin = ''; } $o .= replace_macros($tpl, array( '$search' => $search, '$globaldir' => $globaldir, + '$desc' => t('Find on this site'), '$admin' => $admin, '$finding' => (strlen($search) ? '

' . t('Finding: ') . "'" . $search . "'" . '

' : ""), '$sitedir' => t('Site Directory'), diff --git a/mod/dirfind.php b/mod/dirfind.php index 2d8479043..801018276 100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -1,5 +1,18 @@ page,'aside')) + $a->page['aside'] = ''; + + $a->page['aside'] .= follow_widget(); + + $a->page['aside'] .= findpeople_widget(); +} + + function dirfind_content(&$a) { diff --git a/mod/network.php b/mod/network.php index 9b7c4e611..5aa39bf63 100644 --- a/mod/network.php +++ b/mod/network.php @@ -78,11 +78,13 @@ function saved_searches($search) { if(count($r)) { $o .= ''; } + $o .= '
'; + $o .= '' . "\r\n"; return $o; diff --git a/mod/search.php b/mod/search.php index 034794e17..2a8bf1484 100644 --- a/mod/search.php +++ b/mod/search.php @@ -15,7 +15,7 @@ function search_saved_searches() { foreach($r as $rr) { $o .= '
  • ' . $rr['term'] . '
  • ' . "\r\n"; } - $o .= '' . "\r\n"; + $o .= '
    ' . "\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 = '' . "\r\n"; - $o .= '

    ' . t('Search') . '

    '; + $o .= '

    ' . t('Search This Site') . '

    '; if(x($a->data,'search')) $search = notags(trim($a->data['search'])); diff --git a/view/directory_header.tpl b/view/directory_header.tpl index ba90b94f8..1f03540f2 100644 --- a/view/directory_header.tpl +++ b/view/directory_header.tpl @@ -7,6 +7,7 @@ $finding
    +$desc
    diff --git a/view/theme/testbubble/style.css b/view/theme/testbubble/style.css index dd9d24299..74f0dfb41 100644 --- a/view/theme/testbubble/style.css +++ b/view/theme/testbubble/style.css @@ -2614,6 +2614,10 @@ tr { width: 150px; } +.directory-end { + clear: both; +} + /* ========= */ /* = Admin = */ /* ========= */ -- cgit v1.2.3