]> git.mxchange.org Git - friendica.git/commitdiff
Merge remote-tracking branch 'upstream/develop' into 1511-vier-mobile2
authorMichael Vogel <icarus@dabo.de>
Tue, 3 Nov 2015 22:56:57 +0000 (23:56 +0100)
committerMichael Vogel <icarus@dabo.de>
Tue, 3 Nov 2015 22:56:57 +0000 (23:56 +0100)
13 files changed:
include/Contact.php
mod/allfriends.php
mod/common.php
view/templates/common_friends.tpl [deleted file]
view/templates/contact_template.tpl
view/theme/frost-mobile/templates/contact_template.tpl
view/theme/frost/templates/contact_template.tpl
view/theme/quattro/dark/style.css
view/theme/quattro/green/style.css
view/theme/quattro/lilac/style.css
view/theme/quattro/quattro.less
view/theme/quattro/templates/contact_template.tpl
view/theme/vier/templates/contact_template.tpl

index 3f74a19d5f44e66f22a9b9dfcdeaed6b6ebdf46f..db5480f5170d68f3a5742d5bf4b4abe6d938d598 100644 (file)
@@ -245,7 +245,7 @@ function get_contact_details_by_url($url, $uid = -1) {
                        $profile["keywords"] = $r[0]["keywords"];
                if (isset($r[0]["gender"]) AND $r[0]["gender"])
                        $profile["gender"] = $r[0]["gender"];
-               if (isset($r[0]["forum"]) AND isset($r[0]["prv"]))
+               if (isset($r[0]["forum"]) OR isset($r[0]["prv"]))
                        $profile["community"] = ($r[0]["forum"] OR $r[0]["prv"]);
                if (isset($r[0]["network"]) AND $r[0]["network"])
                        $profile["network"] = $r[0]["network"];
index 784dfb87711d6053386034d3482e2388dbc06e3e..8396efdd2d4eb185f2d7ef807edd2750c60ed64b 100644 (file)
@@ -1,6 +1,8 @@
 <?php
 
 require_once('include/socgraph.php');
+require_once('include/Contact.php');
+require_once('include/contact_selectors.php');
 
 function allfriends_content(&$a) {
 
@@ -12,10 +14,13 @@ function allfriends_content(&$a) {
 
        if($a->argc > 1)
                $cid = intval($a->argv[1]);
+
        if(! $cid)
                return;
 
-       $c = q("select name, url, photo from contact where id = %d and uid = %d limit 1",
+       $uid = $a->user[uid];
+
+       $c = q("SELECT `name`, `url`, `photo` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
                intval($cid),
                intval(local_user())
        );
@@ -33,10 +38,6 @@ function allfriends_content(&$a) {
        if(! count($c))
                return;
 
-       $o .= replace_macros(get_markup_template("section_title.tpl"),array(
-               '$title' => sprintf( t('Friends of %s'), htmlentities($c[0]['name']))
-       ));
-
 
        $r = all_friends(local_user(),$cid);
 
@@ -45,19 +46,53 @@ function allfriends_content(&$a) {
                return $o;
        }
 
-       $tpl = get_markup_template('common_friends.tpl');
+       $id = 0;
 
        foreach($r as $rr) {
 
-               $o .= replace_macros($tpl,array(
-                       '$url' => $rr['url'],
-                       '$name' => htmlentities($rr['name']),
-                       '$photo' => $rr['photo'],
-                       '$tags' => ''
-               ));
+               //get further details of the contact
+               $contact_details = get_contact_details_by_url($rr['url'], $uid);
+
+               $photo_menu = '';
+
+               // $rr[cid] is only available for common contacts. So if the contact is a common one, use contact_photo_menu to generate the photo_menu
+               // If the contact is not common to the user, Connect/Follow' will be added to the photo menu
+               if ($rr[cid]) {
+                       $rr[id] = $rr[cid];
+                       $photo_menu = contact_photo_menu ($rr);
+               }
+               else {
+                       $connlnk = $a->get_baseurl() . '/follow/?url=' . $rr['url'];
+                       $photo_menu = array(array(t("View Profile"), zrl($rr['url'])));
+                       $photo_menu[] = array(t("Connect/Follow"), $connlnk);
+               }
+
+               $entry = array(
+                       'url'           => $rr['url'],
+                       'itemurl'       => $rr['url'],
+                       'name'          => htmlentities($rr['name']),
+                       'thumb'         => proxy_url($rr['photo'], false, PROXY_SIZE_THUMB),
+                       'img_hover'     => htmlentities($rr['name']),
+                       'details'       => $contact_details['location'],
+                       'tags'          => $contact_details['keywords'],
+                       'about'         => $contact_details['about'],
+                       'account_type'  => (($contact_details['community']) ? t('Forum') : ''),
+                       'network'       => network_to_name($contact_details['network'], $contact_details['url']),
+                       'photo_menu'    => $photo_menu,
+                       'conntxt'       => t('Connect'),
+                       'connlnk'       => $connlnk,
+                       'id'            => ++$id,
+               );
+               $entries[] = $entry;
        }
 
-       $o .= cleardiv();
+       $tpl = get_markup_template('viewcontact_template.tpl');
+
+       $o .= replace_macros($tpl,array(
+               '$title' => sprintf( t('Friends of %s'), htmlentities($c[0]['name'])),
+               '$contacts' => $entries,
+       ));
+
 //     $o .= paginate($a);
        return $o;
 }
index 1e65137ac693c74dcc125b1e9af213a70bcb2ac3..560865b15402de32449ef30c428ee3781289d030 100644 (file)
@@ -1,6 +1,8 @@
 <?php
 
 require_once('include/socgraph.php');
+require_once('include/Contact.php');
+require_once('include/contact_selectors.php');
 
 function common_content(&$a) {
 
@@ -11,19 +13,25 @@ function common_content(&$a) {
        $cid = intval($a->argv[3]);
        $zcid = 0;
 
+       if (! local_user()) {
+               notice( t('Permission denied.') . EOL);
+               return;
+       }
+
        if($cmd !== 'loc' && $cmd != 'rem')
                return;
+
        if(! $uid)
                return;
 
        if($cmd === 'loc' && $cid) {
-               $c = q("select name, url, photo from contact where id = %d and uid = %d limit 1",
+               $c = q("SELECT `name`, `url`, `photo` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
                        intval($cid),
                        intval($uid)
                );
        }
        else {
-               $c = q("select name, url, photo from contact where self = 1 and uid = %d limit 1",
+               $c = q("SELECT `name`, `url`, `photo` FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
                        intval($uid)
                );
        }
@@ -41,21 +49,16 @@ function common_content(&$a) {
        if(! count($c))
                return;
 
-       $o .= replace_macros(get_markup_template("section_title.tpl"),array(
-               '$title' => t('Common Friends')
-       ));
-
-
        if(! $cid) {
                if(get_my_url()) {
-                       $r = q("select id from contact where nurl = '%s' and uid = %d limit 1",
+                       $r = q("SELECT `id` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d LIMIT 1",
                                dbesc(normalise_link(get_my_url())),
                                intval($profile_uid)
                        );
                        if(count($r))
                                $cid = $r[0]['id'];
                        else {
-                               $r = q("select id from gcontact where nurl = '%s' limit 1",
+                               $r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
                                        dbesc(normalise_link(get_my_url()))
                                );
                                if(count($r))
@@ -94,19 +97,43 @@ function common_content(&$a) {
                return $o;
        }
 
-       $tpl = get_markup_template('common_friends.tpl');
+       $id = 0;
 
        foreach($r as $rr) {
 
-               $o .= replace_macros($tpl,array(
-                       '$url' => $rr['url'],
-                       '$name' => htmlentities($rr['name']),
-                       '$photo' => $rr['photo'],
-                       '$tags' => ''
-               ));
+               //get further details of the contact
+               $contact_details = get_contact_details_by_url($rr['url'], $uid);
+
+               // $rr[id] is needed to use contact_photo_menu()
+               $rr[id] = $rr[cid];
+
+               $photo_menu = '';
+               $photo_menu = contact_photo_menu ($rr);
+
+               $entry = array(
+                       'url'           => $rr['url'],
+                       'itemurl'       => $rr['url'],
+                       'name'          => $rr['name'],
+                       'thumb'         => proxy_url($rr['photo'], false, PROXY_SIZE_THUMB),
+                       'img_hover'     => htmlentities($rr['name']),
+                       'details'       => $contact_details['location'],
+                       'tags'          => $contact_details['keywords'],
+                       'about'         => $contact_details['about'],
+                       'account_type'  => (($contact_details['community']) ? t('Forum') : ''),
+                       'network'       => network_to_name($contact_details['network'], $contact_details['url']),
+                       'photo_menu'    => $photo_menu,
+                       'id'            => ++$id,
+               );
+               $entries[] = $entry;
        }
 
-       $o .= cleardiv();
+       $tpl = get_markup_template('viewcontact_template.tpl');
+
+       $o .= replace_macros($tpl,array(
+               '$title' => t('Common Friends'),
+               '$contacts' => $entries,
+       ));
+
 //     $o .= paginate($a);
        return $o;
 }
diff --git a/view/templates/common_friends.tpl b/view/templates/common_friends.tpl
deleted file mode 100644 (file)
index 6502dd6..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-
-<div class="profile-match-wrapper">
-       <div class="profile-match-photo">
-               <a href="{{$url}}">
-                       <img src="{{$photo}}" alt="{{$name}}" width="80" height="80" title="{{$name}} [{{$url}}]" />
-               </a>
-       </div>
-       <div class="profile-match-break"></div>
-       <div class="profile-match-name">
-               <a href="{{$url}}" title="{{$name}}[{{$tags}}]">{{$name}}</a>
-       </div>
-       <div class="profile-match-end"></div>
-</div>
\ No newline at end of file
index 75f49653b0893cc1e055b8a33c66c2e09e2e405a..06918533ca0ee4bcfcbbb33b194142b6d7683cc0 100644 (file)
        </div>
 
        <div class="contact-entry-desc">
-               <div class="contact-entry-name" id="contact-entry-name-{{$contact.id}}" >{{$contact.name}}</div>
+               <div class="contact-entry-name" id="contact-entry-name-{{$contact.id}}" >
+                       {{$contact.name}}
+                       {{if $contact.account_type}} <span class="contact-entry-details" id="contact-entry-accounttype-{{$contact.id}}">({{$contact.account_type}})</span>{{/if}}
+               </div>
                {{if $contact.alt_text}}<div class="contact-entry-details" id="contact-entry-rel-{{$contact.id}}" >{{$contact.alt_text}}</div>{{/if}}
                {{if $contact.itemurl}}<div class="contact-entry-details" id="contact-entry-url-{{$contact.id}}" >{{$contact.itemurl}}</div>{{/if}}
-               {{if $contact.network}}<div class="contact-entry-details" id="contact-entry-network-{{$contact.id}}" >{{$contact.network}}</div>{{/if}}
+               {{if $contact.tags}}<div class="contact-entry-details" id="contact-entry-tags-{{$contact.id}}" >{{$contact.tags}}</div>{{/if}}
                {{if $contact.details}}<div class="contact-entry-details" id="contact-entry-details-{{$contact.id}}" >{{$contact.details}}</div>{{/if}}
+               {{if $contact.network}}<div class="contact-entry-details" id="contact-entry-network-{{$contact.id}}" >{{$contact.network}}</div>{{/if}}
+               
        </div>
 
        <div class="contact-entry-end" ></div>
index 198b24746f6173d91dce3921803112444ea082d9..3395c9dadfecde45c9838f2d098e81479741c608 100644 (file)
 
                        {{if $contact.photo_menu}}
 {{*<!--                        <span onclick="openClose('contact-photo-menu-{{$contact.id}}');" class="fakelink contact-photo-menu-button" id="contact-photo-menu-button-{{$contact.id}}">menu</span>-->*}}
-                <div class="contact-photo-menu" id="contact-photo-menu-{{$contact.id}}">
-                    <ul>
-                                               {{foreach $contact.photo_menu as $c}}
-                                               {{if $c.2}}
-                                               <li><a target="redir" href="{{$c.1}}">{{$c.0}}</a></li>
-                                               {{else}}
-                                               <li><a href="{{$c.1}}">{{$c.0}}</a></li>
-                                               {{/if}}
-                                               {{/foreach}}
-                    </ul>
-                </div>
+               <div class="contact-photo-menu" id="contact-photo-menu-{{$contact.id}}">
+                       <ul>
+                                                   {{foreach $contact.photo_menu as $c}}
+                                                   {{if $c.2}}
+                                                   <li><a target="redir" href="{{$c.1}}">{{$c.0}}</a></li>
+                                                   {{else}}
+                                                   <li><a href="{{$c.1}}">{{$c.0}}</a></li>
+                                                   {{/if}}
+                                                   {{/foreach}}
+                       </ul>
+               </div>
                        {{/if}}
                </div>
                        
        </div>
 
        <div class="contact-entry-desc">
-               <div class="contact-entry-name" id="contact-entry-name-{{$contact.id}}" >{{$contact.name}}</div>
+               <div class="contact-entry-name" id="contact-entry-name-{{$contact.id}}" >
+                       {{$contact.name}}
+                       {{if $contact.account_type}} <span class="contact-entry-details" id="contact-entry-accounttype-{{$contact.id}}">({{$contact.account_type}})</span>{{/if}}
+               </div>
                {{if $contact.alt_text}}<div class="contact-entry-details" id="contact-entry-rel-{{$contact.id}}" >{{$contact.alt_text}}</div>{{/if}}
                {{if $contact.itemurl}}<div class="contact-entry-details" id="contact-entry-url-{{$contact.id}}" >{{$contact.itemurl}}</div>{{/if}}
-               {{if $contact.network}}<div class="contact-entry-network" id="contact-entry-network-{{$contact.id}}" >{{$contact.network}}</div>{{/if}}
+               {{if $contact.tags}}<div class="contact-entry-details" id="contact-entry-tags-{{$contact.id}}" >{{$contact.tags}}</div>{{/if}}
                {{if $contact.details}}<div class="contact-entry-details" id="contact-entry-details-{{$contact.id}}" >{{$contact.details}}</div>{{/if}}
+               {{if $contact.network}}<div class="contact-entry-network" id="contact-entry-network-{{$contact.id}}" >{{$contact.network}}</div>{{/if}}
        </div>
 
        <div class="contact-entry-end" ></div>
index 777ed501790bec2d01b57f9edeb428ab404e3acc..fe491fd83a264cc3a3b5b3f232f34c8af52ad537 100644 (file)
        </div>
 
        <div class="contact-entry-desc">
-               <div class="contact-entry-name" id="contact-entry-name-{{$contact.id}}" >{{$contact.name}}</div>
+               <div class="contact-entry-name" id="contact-entry-name-{{$contact.id}}" >
+                       {{$contact.name}}
+                       {{if $contact.account_type}} <span class="contact-entry-details" id="contact-entry-accounttype-{{$contact.id}}">({{$contact.account_type}})</span>{{/if}}
+               </div>
                {{if $contact.alt_text}}<div class="contact-entry-details" id="contact-entry-rel-{{$contact.id}}" >{{$contact.alt_text}}</div>{{/if}}
                {{if $contact.itemurl}}<div class="contact-entry-details" id="contact-entry-url-{{$contact.id}}" >{{$contact.itemurl}}</div>{{/if}}
-               {{if $contact.network}}<div class="contact-entry-network" id="contact-entry-network-{{$contact.id}}" >{{$contact.network}}</div>{{/if}}
+               {{if $contact.tags}}<div class="contact-entry-details" id="contact-entry-tags-{{$contact.id}}" >{{$contact.tags}}</div>{{/if}}
                {{if $contact.details}}<div class="contact-entry-details" id="contact-entry-details-{{$contact.id}}" >{{$contact.details}}</div>{{/if}}
+               {{if $contact.network}}<div class="contact-entry-network" id="contact-entry-network-{{$contact.id}}" >{{$contact.network}}</div>{{/if}}
        </div>
 
        <div class="contact-entry-end" ></div>
index b0489af80838a3222d666f88db12324fb9d3e5b7..485ac393870f71ecc7ecf5f258f3e2589e8f3d0f 100644 (file)
@@ -1583,7 +1583,7 @@ span[id^="showmore-wrap"] {
 }
 .contact-name {
   font-weight: bold;
-  padding-top: 15px;
+  /* padding-top: 15px; */
 }
 .contact-details {
   color: #999999;
index 0c7050045d0d1d254b6c6726b6daf0eecfddbc1c..345043ffb46cf1370af8f8cae54cded162ecfb57 100644 (file)
@@ -1583,7 +1583,7 @@ span[id^="showmore-wrap"] {
 }
 .contact-name {
   font-weight: bold;
-  padding-top: 15px;
+  /* padding-top: 15px; */
 }
 .contact-details {
   color: #999999;
index c5f655427ad9e010382f137cf4a695f5750309aa..b2dec86c843c5eddd7f7177772b84a0a20212716 100644 (file)
@@ -1583,7 +1583,7 @@ span[id^="showmore-wrap"] {
 }
 .contact-name {
   font-weight: bold;
-  padding-top: 15px;
+  /* padding-top: 15px; */
 }
 .contact-details {
   color: #999999;
index cd604b656a42bbdc4772cf16c966b378e3c214ae..7aede8df08274b92f627d5117b047faf3e30b5bb 100644 (file)
@@ -908,7 +908,7 @@ span[id^="showmore-wrap"] {
                img { width: 175px; height: 175px; }
        }
 }
-.contact-name { font-weight: bold; padding-top: 15px; }
+.contact-name { font-weight: bold; /* padding-top: 15px; */}
 .contact-details {
        color: @Grey3; white-space: nowrap;
        overflow: hidden;
index 7060505e9fcce4edbbecaa30c0878f13c6f9d634..2d59a8a256a4008e7e658aede46b8cf9f192c65c 100644 (file)
                </div>
                        
        </div>
-       <div class="contact-name" id="contact-entry-name-{{$contact.id}}" >{{$contact.name}}</div>
+       <div class="contact-name" id="contact-entry-name-{{$contact.id}}" >
+               {{$contact.name}}
+               {{if $contact.account_type}} <span class="contact-entry-details" id="contact-entry-accounttype-{{$contact.id}}">({{$contact.account_type}})</span>{{/if}}
+       </div>
        {{if $contact.alt_text}}<div class="contact-details" id="contact-entry-rel-{{$contact.id}}" >{{$contact.alt_text}}</div>{{/if}}
        {{if $contact.itemurl}}<div class="contact-details" id="contact-entry-url-{{$contact.id}}" >{{$contact.itemurl}}</div>{{/if}}
-       {{if $contact.network}}<div class="contact-details" id="contact-entry-network-{{$contact.id}}" >{{$contact.network}}</div>{{/if}}
+       {{if $contact.tags}}<div class="contact-details" id="contact-entry-tags-{{$contact.id}}" >{{$contact.tags}}</div>{{/if}}
        {{if $contact.details}}<div class="contact-details" id="contact-entry-details-{{$contact.id}}" >{{$contact.details}}</div>{{/if}}
+       {{if $contact.network}}<div class="contact-details" id="contact-entry-network-{{$contact.id}}" >{{$contact.network}}</div>{{/if}}
 
        {{if $contact.connlnk}}
        <div class="contact-entry-connect"><a href="{{$contact.connlnk}}" title="{{$contact.conntxt}}">{{$contact.conntxt}}</a></div>
index 2993bb92cb038ba4005495adb00d56f0dce9e134..60e05610f65bf93fed7538aa238ae4da70f98be7 100644 (file)
        <div class="contact-entry-photo-end" ></div>
        
        <div class="contact-entry-desc">
-               <div class="contact-entry-name" id="contact-entry-name-{{$contact.id}}" >{{$contact.name}}</div>
+               <div class="contact-entry-name" id="contact-entry-name-{{$contact.id}}" >
+                       {{$contact.name}}
+                       {{if $contact.account_type}} <span class="contact-entry-details" id="contact-entry-accounttype-{{$contact.id}}">({{$contact.account_type}})</span>{{/if}}
+               </div>
                {{if $contact.alt_text}}<div class="contact-entry-details" id="contact-entry-rel-{{$contact.id}}" >{{$contact.alt_text}}</div>{{/if}}
                {{if $contact.itemurl}}<div class="contact-entry-details" id="contact-entry-url-{{$contact.id}}" >{{$contact.itemurl}}</div>{{/if}}
-               {{if $contact.network}}<div class="contact-entry-details" id="contact-entry-network-{{$contact.id}}" >{{$contact.network}}</div>{{/if}}
+               {{if $contact.tags}}<div class="contact-entry-details" id="contact-entry-tags-{{$contact.id}}" >{{$contact.tags}}</div>{{/if}}
                {{if $contact.details}}<div class="contact-entry-details" id="contact-entry-details-{{$contact.id}}" >{{$contact.details}}</div>{{/if}}
+               {{if $contact.network}}<div class="contact-entry-details" id="contact-entry-network-{{$contact.id}}" >{{$contact.network}}</div>{{/if}}
        </div>