]> git.mxchange.org Git - friendica.git/commitdiff
add contact_widgets and provide widgets on appropriate pages, fix the saved search...
authorFriendika <info@friendika.com>
Wed, 12 Oct 2011 02:27:58 +0000 (19:27 -0700)
committerFriendika <info@friendika.com>
Wed, 12 Oct 2011 02:27:58 +0000 (19:27 -0700)
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 [new file with mode: 0644]
mod/community.php
mod/contacts.php
mod/directory.php
mod/dirfind.php
mod/network.php
mod/search.php
view/directory_header.tpl
view/theme/testbubble/style.css

diff --git a/include/contact_widgets.php b/include/contact_widgets.php
new file mode 100644 (file)
index 0000000..efb833a
--- /dev/null
@@ -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
+       ));
+
+}
+
index cb255029f0d47e84d64ae9e825c731cdf1982362..34c992bada16ec361b485eac14d55b0568943199 100644 (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) {
index d24873b8fb21e01f269f6bd6df02a2970d3601aa..9bbcea07d3a98ab25fe62d1f63a91676de1329ff 100644 (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();
 
 }
 
index 93abcd5de845dd661fd9afef49649c438ed44644..5f00b4f5a4a9ced5703cf8f26cd22cdb9f82390d 100644 (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'),
index 2d8479043508a9b881bbde23b9f9967559164eff..801018276644f98adda868676f45fdfdac0e7228 100644 (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) {
 
index 9b7c4e6112778dffae3435133b6f26ab5290af26..5aa39bf638c2d63b6a56e944c2142a59dae08522 100644 (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;
 
index 034794e179db10d2137967a270fdf3778647ad28..2a8bf1484ec3e62495ee7a1bc4969635d4e48800 100644 (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']));
index ba90b94f82932b81abcb4d0c24bb509dadefeaa0..1f03540f2c95019a8e7685b51f86528c00d30888 100644 (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>
index dd9d2429991f32513bb8e39afa424bc7aaf1fb21..74f0dfb41ce7a92a83a3661d82d82a9e2f2680f6 100644 (file)
@@ -2614,6 +2614,10 @@ tr {
        width: 150px;   
 }
 
+.directory-end {
+       clear: both;
+}
+
 /* ========= */
 /* = Admin = */
 /* ========= */