aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRedMatrix <info@friendica.com>2014-11-09 16:08:22 +1100
committerRedMatrix <info@friendica.com>2014-11-09 16:08:22 +1100
commit3730abb13a2839ed68f73f2c94960d2e9f654305 (patch)
treebe9c37712e272d080ebcdf1b209c3c7ef85d59fa
parent7a8842f4431a875d939722693b73baa99ccf53bc (diff)
parent28f3d7be5a104bc1f1e1eff2e22fd19b4ab3a2d1 (diff)
downloadvolse-hubzilla-3730abb13a2839ed68f73f2c94960d2e9f654305.tar.gz
volse-hubzilla-3730abb13a2839ed68f73f2c94960d2e9f654305.tar.bz2
volse-hubzilla-3730abb13a2839ed68f73f2c94960d2e9f654305.zip
Merge pull request #681 from pafcu/master
New layout for directory
-rw-r--r--mod/directory.php56
-rw-r--r--mod/dirprofile.php184
-rw-r--r--view/css/mod_directory.css31
-rwxr-xr-xview/tpl/direntry.tpl23
-rwxr-xr-xview/tpl/direntry_large.tpl43
5 files changed, 96 insertions, 241 deletions
diff --git a/mod/directory.php b/mod/directory.php
index 3d7632ec0..1571efcf5 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -122,6 +122,10 @@ function directory_content(&$a) {
$pdesc = (($rr['description']) ? $rr['description'] . '<br />' : '');
$connect_link = ((local_user()) ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : '');
+ // Checking status is disabled ATM until someone checks the performance impact more carefully
+ //$online = remote_online_status($rr['address']);
+ $online = '';
+
if(in_array($rr['hash'],$contacts))
$connect_link = '';
@@ -142,8 +146,6 @@ function directory_content(&$a) {
if(($years = age($rr['birthday'],'UTC','')) != 0)
$details .= '<br />' . t('Age: ') . $years ;
}
- if(strlen($rr['gender']))
- $details .= '<br />' . t('Gender: ') . $rr['gender'];
$page_type = '';
@@ -155,13 +157,48 @@ function directory_content(&$a) {
|| (x($profile,'country') == 1))
$location = t('Location:');
- $gender = ((x($profile,'gender') == 1) ? t('Gender:') : False);
+ $gender = ((x($profile,'gender') == 1) ? t('Gender: ') . $profile['gender']: False);
- $marital = ((x($profile,'marital') == 1) ? t('Status:') : False);
+ $marital = ((x($profile,'marital') == 1) ? t('Status: ') . $profile['marital']: False);
- $homepage = ((x($profile,'homepage') == 1) ? t('Homepage:') : False);
-
- $about = ((x($profile,'about') == 1) ? t('About:') : False);
+ $homepage = ((x($profile,'homepage') == 1) ? t('Homepage: ') : False);
+ $homepageurl = ((x($profile,'homepage') == 1) ? $profile['homepage'] : '');
+
+ $hometown = ((x($profile,'hometown') == 1) ? t('Hometown: ') . $profile['hometown'] : False);
+
+ $about = ((x($profile,'about') == 1) ? t('About: ') . $profile['about'] : False);
+
+ $keywords = ((x($profile,'keywords')) ? $profile['keywords'] : '');
+
+logger('keywords: '.$keywords);
+ if($keywords) {
+ $keywords = str_replace(',',' ', $keywords);
+ $keywords = str_replace(' ',' ', $keywords);
+ $karr = explode(' ', $keywords);
+ $out = '';
+ if($karr) {
+ if(local_user()) {
+ $r = q("select keywords from profile where uid = %d and is_default = 1 limit 1",
+ intval(local_user())
+ );
+ if($r) {
+ $keywords = str_replace(',',' ', $r[0]['keywords']);
+ $keywords = str_replace(' ',' ', $keywords);
+ $marr = explode(' ', $keywords);
+ }
+ }
+ foreach($karr as $k) {
+ if(strlen($out))
+ $out .= ', ';
+ if($marr && in_arrayi($k,$marr))
+ $out .= '<strong>' . $k . '</strong>';
+ else
+ $out .= $k;
+ }
+ }
+
+ }
+logger('out: '.$out);
$entry = array(
@@ -179,9 +216,14 @@ function directory_content(&$a) {
'pdesc' => $pdesc,
'marital' => $marital,
'homepage' => $homepage,
+ 'homepageurl' => $homepageurl,
+ 'hometown' => $hometown,
'about' => $about,
'conn_label' => t('Connect'),
'connect' => $connect_link,
+ 'online' => $online,
+ 'kw' => (($out) ? t('Keywords: ') : ''),
+ 'keywords' => $out,
);
$arr = array('contact' => $rr, 'entry' => $entry);
diff --git a/mod/dirprofile.php b/mod/dirprofile.php
deleted file mode 100644
index e9b12ada7..000000000
--- a/mod/dirprofile.php
+++ /dev/null
@@ -1,184 +0,0 @@
-<?php
-
-require_once('include/dir_fns.php');
-require_once('include/bbcode.php');
-
-function dirprofile_init(&$a) {
-
- if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
- notice( t('Public access denied.') . EOL);
- return;
- }
-
- $hash = $_REQUEST['hash'];
- if(! $hash)
- return '';
-
- $o = '';
-
- $dirmode = intval(get_config('system','directory_mode'));
-
- if(($dirmode == DIRECTORY_MODE_PRIMARY) || ($dirmode == DIRECTORY_MODE_STANDALONE)) {
- $url = z_root() . '/dirsearch';
- }
- if(! $url) {
- $directory = find_upstream_directory($dirmode);
- $url = $directory['url'] . '/dirsearch';
- }
- logger('mod_directory: URL = ' . $url, LOGGER_DEBUG);
-
- $contacts = array();
-
- if(local_user()) {
- $x = q("select abook_xchan from abook where abook_channel = %d",
- intval(local_user())
- );
- if($x) {
- foreach($x as $xx)
- $contacts[] = $xx['abook_xchan'];
- }
- }
-
-
-
- if($url) {
-
- $query = $url . '?f=&hash=' . $hash;
-
- $x = z_fetch_url($query);
- logger('dirprofile: return from upstream: ' . print_r($x,true), LOGGER_DATA);
-
- if($x['success']) {
- $t = 0;
- $j = json_decode($x['body'],true);
- if($j) {
-
- if($j['results']) {
-
- $entries = array();
-
- $photo = 'thumb';
-
- foreach($j['results'] as $rr) {
-
- $profile_link = chanlink_url($rr['url']);
-
- $pdesc = (($rr['description']) ? $rr['description'] . '<br />' : '');
-
- $qrlink = zid($rr['url']);
- $connect_link = ((local_user()) ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : '');
-
- $online = remote_online_status($rr['address']);
-
-
- if(in_array($rr['hash'],$contacts))
- $connect_link = '';
-
- $details = '';
- if(strlen($rr['locale']))
- $details .= $rr['locale'];
- if(strlen($rr['region'])) {
- if(strlen($rr['locale']))
- $details .= ', ';
- $details .= $rr['region'];
- }
- if(strlen($rr['country'])) {
- if(strlen($details))
- $details .= ', ';
- $details .= $rr['country'];
- }
- if(strlen($rr['birthday'])) {
- if(($years = age($rr['birthday'],'UTC','')) != 0)
- $details .= '<br />' . t('Age: ') . $years ;
- }
- if(strlen($rr['gender']))
- $details .= '<br />' . t('Gender: ') . $rr['gender'];
-
- $page_type = '';
-
- $profile = $rr;
-
- if ((x($profile,'locale') == 1)
- || (x($profile,'region') == 1)
- || (x($profile,'postcode') == 1)
- || (x($profile,'country') == 1))
- $location = t('Location:');
-
-
- $marital = ((x($profile,'marital') == 1) ? t('Status: ') . $profile['marital'] : False);
- $sexual = ((x($profile,'sexual') == 1) ? t('Sexual Preference: ') . $profile['sexual'] : False);
-
- $homepage = ((x($profile,'homepage') == 1) ? t('Homepage: ') . linkify($profile['homepage']) : False);
- $hometown = ((x($profile,'hometown') == 1) ? t('Hometown: ') . $profile['hometown'] : False);
-
- $about = ((x($profile,'about') == 1) ? t('About: ') . bbcode($profile['about']) : False);
-
- $keywords = ((x($profile,'keywords')) ? $profile['keywords'] : '');
- if($keywords) {
- $keywords = str_replace(',',' ', $keywords);
- $keywords = str_replace(' ',' ', $keywords);
- $karr = explode(' ', $keywords);
- $out = '';
- if($karr) {
- if(local_user()) {
- $r = q("select keywords from profile where uid = %d and is_default = 1 limit 1",
- intval(local_user())
- );
- if($r) {
- $keywords = str_replace(',',' ', $r[0]['keywords']);
- $keywords = str_replace(' ',' ', $keywords);
- $marr = explode(' ', $keywords);
- }
- }
- foreach($karr as $k) {
- if(strlen($out))
- $out .= ', ';
- if($marr && in_arrayi($k,$marr))
- $out .= '<strong>' . $k . '</strong>';
- else
- $out .= $k;
- }
- }
-
- }
- $entry = replace_macros(get_markup_template('direntry_large.tpl'), array(
- '$id' => ++$t,
- '$profile_link' => $profile_link,
- '$qrlink' => $qrlink,
- '$photo' => $rr['photo_l'],
- '$alttext' => $rr['name'] . ' ' . $rr['address'],
- '$name' => $rr['name'],
- '$online' => (($online) ? t('Online Now') : ''),
- '$details' => $pdesc . $details,
- '$profile' => $profile,
- '$address' => $rr['address'],
- '$location' => $location,
- '$gender' => $gender,
- '$pdesc' => $pdesc,
- '$marital' => $marital,
- '$homepage' => $homepage,
- '$hometown' => $hometown,
- '$about' => $about,
- '$kw' => (($out) ? t('Keywords: ') : ''),
- '$keywords' => $out,
- '$conn_label' => t('Connect'),
- '$connect' => $connect_link,
- ));
-
-
- echo $entry;
- killme();
-
- }
- }
- else {
- info( t("Not found.") . EOL);
- }
- }
- }
- }
-
-
-
-
-} \ No newline at end of file
diff --git a/view/css/mod_directory.css b/view/css/mod_directory.css
index bc8054937..98b99ef50 100644
--- a/view/css/mod_directory.css
+++ b/view/css/mod_directory.css
@@ -8,15 +8,17 @@
.directory-photo {
margin-left: 25px;
}
+.directory-photo-img {
+ margin-left: auto;
+ margin-right: auto;
+ display:block;
+}
.directory-details {
text-align: center;
margin-left: 5px;
margin-right: 5px;
}
.directory-item {
- float: left;
- width: 225px;
- height: 260px;
overflow: hidden;
margin: 2px;
}
@@ -42,3 +44,26 @@ div.dirtagblock.widget {
float: left;
width: 225px;
}
+
+.contact-photo {
+ float: left;
+ margin-right: 16px;
+}
+
+.contact-name {
+ font-size: larger;
+}
+
+.contact-info {
+ display: block;
+ overflow: hidden;
+}
+
+.directory-item {
+ margin: 16px;
+}
+.directory-connect {
+ display:block;
+ margin-left:auto;
+ margin-right: auto;
+}
diff --git a/view/tpl/direntry.tpl b/view/tpl/direntry.tpl
index a6252bb9a..691905ecd 100755
--- a/view/tpl/direntry.tpl
+++ b/view/tpl/direntry.tpl
@@ -3,12 +3,27 @@
<div class="contact-photo-wrapper" id="directory-photo-wrapper-{{$entry.id}}" >
<div class="contact-photo" id="directory-photo-{{$entry.id}}" >
<a href="{{$entry.profile_link}}" class="directory-profile-link" id="directory-profile-link-{{$entry.id}}" ><img class="directory-photo-img" src="{{$entry.photo}}" alt="{{$entry.alttext}}" title="{{$entry.alttext}}" /></a>
-</div>
-</div>
-
-<div class="contact-name" id="directory-name-{{$entry.id}}" ><span onclick="dirdetails('{{$entry.hash}}');" class="fakelink" >{{$entry.name}}</span></div>
{{if $entry.connect}}
<div class="directory-connect btn btn-default"><a href="{{$entry.connect}}"><i class="icon-plus connect-icon"></i> {{$entry.conn_label}}</a></div>
{{/if}}
+</div>
+</div>
+
+<div class='contact-info'>
+<div class="contact-name" id="directory-name-{{$entry.id}}" ><a href='{{$entry.profile_link}}' >{{$entry.name}}</a>{{if $entry.online}} <i class="icon-asterisk online-now" title="{{$entry.online}}"></i>{{/if}}</div>
+
<div class="contact-details">{{$entry.details}}</div>
+{{if $entry.hometown}}
+<div class="directory-hometown">{{$entry.hometown}} </div>
+{{/if}}
+{{if $entry.about}}
+<div class="directory-about">{{$entry.about}} </div>
+{{/if}}
+{{if $entry.homepage}}
+<div class="directory-homepage">{{$entry.homepage}}<a href='{{$entry.homepageurl}}'>{{$entry.homepageurl}}</a> </div>
+{{/if}}
+{{if $entry.kw}}
+<div class="directory-keywords">{{$entry.kw}} {{$entry.keywords}}</div>
+{{/if}}
+</div>
</div>
diff --git a/view/tpl/direntry_large.tpl b/view/tpl/direntry_large.tpl
deleted file mode 100755
index da6ea1a44..000000000
--- a/view/tpl/direntry_large.tpl
+++ /dev/null
@@ -1,43 +0,0 @@
-<div class="directory-popup-item lframe" id="directory-item-{{$id}}" >
-<div class="generic-content-wrapper">
-
-<div class="contact-photo-wrapper" id="directory-photo-wrapper-{{$id}}" >
- <div class="contact-photo dirpopup" id="directory-photo-{{$id}}" >
- <a href="{{$profile_link}}" class="directory-profile-link" id="directory-profile-link-{{$id}}" ><img class="directory-photo-img" style="height:175px; width:175px;" src="{{$photo}}" alt="{{$alttext}}" title="{{$alttext}}" /></a>
- </div>
- <div class="contact-photo dirpopup" id="directory-qr-{{$id}}" >
- <img class="directory-photo-img" style="height:175px; width:175px;" src="photo/qr?f=&qr={{$qrlink}}" alt="QR" title="{{$qrlink}}" />
- </div>
-</div>
-
-<div class="clear"></div>
-
-
-<div class="contact-name" id="directory-name-{{$id}}" >{{$name}}{{if $online}} <i class="icon-asterisk online-now" title="{{$online}}"></i>{{/if}}</div>
-{{if $connect}}
-<div class="directory-connect btn btn-default"><a href="{{$connect}}"><i class="icon-plus connect-icon"></i> {{$conn_label}}</a></div>
-{{/if}}
-
-<div class="contact-webbie">{{$address}}</div>
-
-<div class="contact-details">{{$details}}</div>
-{{if $marital}}
-<div class="directory-marital">{{$marital}} </div>
-{{/if}}
-{{if $sexual}}
-<div class="directory-sexual">{{$sexual}} </div>
-{{/if}}
-{{if $homepage}}
-<div class="directory-homepage">{{$homepage}} </div>
-{{/if}}
-{{if $hometown}}
-<div class="directory-hometown">{{$hometown}} </div>
-{{/if}}
-{{if $about}}
-<div class="directory-about">{{$about}} </div>
-{{/if}}
-{{if $kw}}
-<div class="directory-keywords">{{$kw}} {{$keywords}}</div>
-{{/if}}
-</div>
-</div>