aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-12-23 17:24:25 -0800
committerfriendica <info@friendica.com>2013-12-23 17:24:25 -0800
commitb08d4cc1fe2b8dd45de7546f05cf9a9601aeca03 (patch)
tree6833e203577682e909bccd4ca92dc0b5e652fd9d
parent49d2ada4f893e4de17567b40873b31e5a63ec01e (diff)
downloadvolse-hubzilla-b08d4cc1fe2b8dd45de7546f05cf9a9601aeca03.tar.gz
volse-hubzilla-b08d4cc1fe2b8dd45de7546f05cf9a9601aeca03.tar.bz2
volse-hubzilla-b08d4cc1fe2b8dd45de7546f05cf9a9601aeca03.zip
first cut at a directory popup. It's a bit annoying at the moment, so we'll have to make it less so. Also had second thoughts about the project homepage changes made yesterday. Just because a bunch of Reddit trolls can't get social networking out of their brain long enough to explore other technologies or even read the project page doesn't mean we should pander to them and explain how or why we either are or aren't a social network.
-rw-r--r--assets/home.html3
-rw-r--r--mod/directory.php3
-rw-r--r--mod/dirprofile.php151
-rw-r--r--mod/dirsearch.php18
-rw-r--r--view/css/conversation.css2
-rw-r--r--view/js/mod_directory.js8
-rwxr-xr-xview/tpl/direntry.tpl2
-rwxr-xr-xview/tpl/direntry_large.tpl16
-rwxr-xr-xview/tpl/jot.tpl2
9 files changed, 196 insertions, 9 deletions
diff --git a/assets/home.html b/assets/home.html
index 3a3628748..3f018edfc 100644
--- a/assets/home.html
+++ b/assets/home.html
@@ -116,9 +116,6 @@ The internet is broken. We're fixing it.</div>
Now open your eyes. We've done some amazing things with decentralisation technology over the last few years and have created a different kind of network. We call it the Red Matrix. Forget the old internet - it's hopelessly broken and increasingly being choked off in order to take your money and spy on you. We're building tomorrow's internet today. And we're doing things a bit differently than what you may be used to. We could wait for this new internet to be built, but we don't really trust the typical corporations and governmental bodies to do it right. So we're building it on top of the old internet. And we're building privacy into its DNA. And it's <strong>here now</strong>.
</p>
<p>
-It seems that many people can only envision the internet through the distorted perception of social networking. So let's get a few things straight. Is the Red Matrix a <em>social network</em>? No. <strong>Is your car an air-conditioner</strong>? No. Your car may <strong>have</strong> an air conditioner, but that isn't its prime function. Its prime function is a transportation device. The Red Matrix has some very advanced communication technology embedded in it, (much more advanced than many so-called <em>social networks</em>), and one can do social network things with it (quite well in fact); but its prime function is a decentralised <strong>identity-aware</strong> web publishing platform. More on that in a minute. Decentralised privacy aware communications between channels is (like your car's air conditioner) just another feature the Red Matrix provides. It doesn't belong to a corporation; it's just an integral part of your new internet.
-</p>
-<p>
The Red Matrix is a decentralised network where the <strong>people using it are in charge</strong> and the size of your server farm and wealth do not offer any comparable advantage. Anybody may participate on a level playing field. Cloud storage, file sharing, communications, content creation and management belong to <strong>everybody</strong> and can be shared with <strong>anybody</strong> (or <strong>somebody</strong>, or <strong>nobody</strong>). This is only a representative sample of the services we plan to offer. In an internet where creativity is allowed to flourish and corporate overlords have no power, the door is open to entirely new forms of expression and applications. The Red Matrix software is free and open source; created by volunteers and distributed under the MIT license.
</p>
<p>
diff --git a/mod/directory.php b/mod/directory.php
index 9e4c37fae..53542db60 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -168,6 +168,7 @@ function directory_content(&$a) {
'id' => ++$t,
'profile_link' => $profile_link,
'photo' => $rr['photo'],
+ 'hash' => $rr['hash'],
'alttext' => $rr['name'] . ' ' . $rr['address'],
'name' => $rr['name'],
'details' => $pdesc . $details,
@@ -186,7 +187,7 @@ function directory_content(&$a) {
call_hooks('directory_item', $arr);
- $entries[] = $entry;
+ $entries[] = $arr['entry'];
unset($profile);
unset($location);
diff --git a/mod/dirprofile.php b/mod/dirprofile.php
new file mode 100644
index 000000000..133089419
--- /dev/null
+++ b/mod/dirprofile.php
@@ -0,0 +1,151 @@
+<?php
+
+require_once('include/dir_fns.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);
+
+ if($directory) {
+ $url = $directory['url'] . '/dirsearch';
+ }
+ else {
+ $url = DIRECTORY_FALLBACK_MASTER . '/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 />' : '');
+ $connect_link = ((local_user()) ? z_root() . '/follow?f=&url=' . urlencode($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:');
+
+ $gender = ((x($profile,'gender') == 1) ? t('Gender:') : False);
+
+ $marital = ((x($profile,'marital') == 1) ? t('Status:') : False);
+
+ $homepage = ((x($profile,'homepage') == 1) ? t('Homepage:') : False);
+
+ $about = ((x($profile,'about') == 1) ? t('About:') : False);
+
+
+
+ $entry = replace_macros(get_markup_template('direntry_large.tpl'), array(
+ '$id' => ++$t,
+ '$profile_link' => $profile_link,
+ '$photo' => $rr['photo_l'],
+ '$alttext' => $rr['name'] . ' ' . $rr['address'],
+ '$name' => $rr['name'],
+ '$details' => $pdesc . $details,
+ '$profile' => $profile,
+ '$location' => $location,
+ '$gender' => $gender,
+ '$pdesc' => $pdesc,
+ '$marital' => $marital,
+ '$homepage' => $homepage,
+ '$about' => $about,
+ '$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/mod/dirsearch.php b/mod/dirsearch.php
index 6315cae31..6490d59df 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -27,9 +27,10 @@ function dirsearch_content(&$a) {
json_return_and_die($ret);
}
+ $hash = ((x($_REQUEST['hash'])) ? $_REQUEST['hash'] : '');
$name = ((x($_REQUEST,'name')) ? $_REQUEST['name'] : '');
- $hub = ((x($_REQUEST,'hub')) ? $_REQUEST['hub'] : '');
+ $hub = ((x($_REQUEST,'hub')) ? $_REQUEST['hub'] : '');
$address = ((x($_REQUEST,'address')) ? $_REQUEST['address'] : '');
$locale = ((x($_REQUEST,'locale')) ? $_REQUEST['locale'] : '');
$region = ((x($_REQUEST,'region')) ? $_REQUEST['region'] : '');
@@ -91,6 +92,13 @@ function dirsearch_content(&$a) {
$sql_extra .= " AND xprof_age >= " . intval($agege) . ") ";
}
+
+ if($hash) {
+ $sql_extra = " AND xchan_hash = '" . dbesc($hash) . "' ";
+ }
+
+
+
$perpage = (($_REQUEST['n']) ? $_REQUEST['n'] : 80);
$page = (($_REQUEST['p']) ? intval($_REQUEST['p'] - 1) : 0);
$startrec = (($page+1) * $perpage) - $perpage;
@@ -112,6 +120,9 @@ function dirsearch_content(&$a) {
$logic = ((strlen($sql_extra)) ? 0 : 1);
+ if($hash)
+ $logic = 1;
+
$safesql = (($safe > 0) ? " and not ( xchan_flags & " . intval(XCHAN_FLAGS_CENSORED|XCHAN_FLAGS_SELFCENSORED) . " ) " : '');
if($safe < 0)
$safesql = " and ( xchan_flags & " . intval(XCHAN_FLAGS_CENSORED|XCHAN_FLAGS_SELFCENSORED) . " ) ";
@@ -161,13 +172,13 @@ function dirsearch_content(&$a) {
json_return_and_die($spkt);
}
else {
-
+dbg(1);
$r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash where ( $logic $sql_extra ) and not ( xchan_flags & %d ) and not ( xchan_flags & %d ) and not ( xchan_flags & %d ) $safesql $order $qlimit ",
intval(XCHAN_FLAGS_HIDDEN),
intval(XCHAN_FLAGS_ORPHAN),
intval(XCHAN_FLAGS_DELETED)
);
-
+dbg(0);
}
$ret['page'] = $page + 1;
@@ -187,6 +198,7 @@ function dirsearch_content(&$a) {
// $entry['updated'] = (($rr['ud_date']) ? $rr['ud_date'] : '0000-00-00 00:00:00');
// $entry['update_guid'] = (($rr['ud_guid']) ? $rr['ud_guid'] : '');
$entry['url'] = $rr['xchan_url'];
+ $entry['photo_l'] = $rr['xchan_photo_l'];
$entry['photo'] = $rr['xchan_photo_m'];
$entry['address'] = $rr['xchan_addr'];
$entry['description'] = $rr['xprof_desc'];
diff --git a/view/css/conversation.css b/view/css/conversation.css
index 8125b6278..493ce9cd5 100644
--- a/view/css/conversation.css
+++ b/view/css/conversation.css
@@ -55,6 +55,8 @@
#profile-expires,
#profile-expires,
#jot-perms-icon,
+#jot-preview-link,
+#profile-encrypt,
.hover, .focus {
cursor: pointer;
}
diff --git a/view/js/mod_directory.js b/view/js/mod_directory.js
new file mode 100644
index 000000000..96a38a109
--- /dev/null
+++ b/view/js/mod_directory.js
@@ -0,0 +1,8 @@
+function dirdetails(hash) {
+
+ $.get('dirprofile' + '?f=&hash=' + hash, function( data ) {
+ $.colorbox({ html: data });
+ });
+
+}
+
diff --git a/view/tpl/direntry.tpl b/view/tpl/direntry.tpl
index 35bbbe0fd..ae2291d01 100755
--- a/view/tpl/direntry.tpl
+++ b/view/tpl/direntry.tpl
@@ -7,7 +7,7 @@
</div>
</div>
-<div class="contact-name" id="directory-name-{{$entry.id}}">{{$entry.name}}</div>
+<div class="contact-name" id="directory-name-{{$entry.id}}" ><span onmouseover="dirdetails('{{$entry.hash}}');" class="fakelink" >{{$entry.name}}</span></div>
{{if $entry.connect}}
<div class="directory-connect"><a href="{{$entry.connect}}">{{$entry.conn_label}}</a></div>
{{/if}}
diff --git a/view/tpl/direntry_large.tpl b/view/tpl/direntry_large.tpl
new file mode 100755
index 000000000..cf45d8f48
--- /dev/null
+++ b/view/tpl/direntry_large.tpl
@@ -0,0 +1,16 @@
+<div class="directory-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" id="directory-photo-{{$id}}" >
+<a href="{{$profile_link}}" class="directory-profile-link" id="directory-profile-link-{{$id}}" ><img class="directory-photo-img" src="{{$photo}}" alt="{{$alttext}}" title="{{$alttext}}" /></a>
+</div>
+</div>
+
+<div class="contact-name" id="directory-name-{{$id}}" >{{$name}}</div>
+{{if $entry.connect}}
+<div class="directory-connect"><a href="{{$connect}}">{{$conn_label}}</a></div>
+{{/if}}
+<div class="contact-details">{{$details}}</div>
+</div>
+</div>
diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl
index 9038155be..e1e1e3080 100755
--- a/view/tpl/jot.tpl
+++ b/view/tpl/jot.tpl
@@ -70,7 +70,7 @@
</div>
{{/if}}
- {{if $preview}}<span onclick="preview_post();" id="jot-preview-link" class="fakelink"><i class="icon-eye-open jot-icons" title="{{$preview}}"></i></span>{{/if}}
+ {{if $preview}}<span onclick="preview_post();" id="jot-preview-link"><i class="icon-eye-open jot-icons" title="{{$preview}}"></i></span>{{/if}}
<div id="profile-jot-perms-end"></div>