aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-12-03 19:17:02 -0800
committerfriendica <info@friendica.com>2012-12-03 19:17:02 -0800
commitc5cace552b55ff7f7fefca0b2bc1f49f80e65647 (patch)
treee2cf3ec6e3933d286abb41258cd4ca1b3be7d481
parenta4bae6c29b616aac9ee8a4461688e30e0eac8e38 (diff)
downloadvolse-hubzilla-c5cace552b55ff7f7fefca0b2bc1f49f80e65647.tar.gz
volse-hubzilla-c5cace552b55ff7f7fefca0b2bc1f49f80e65647.tar.bz2
volse-hubzilla-c5cace552b55ff7f7fefca0b2bc1f49f80e65647.zip
most of the basic "make friends" stuff except for email notifications, drop community tab
-rw-r--r--include/nav.php15
-rw-r--r--mod/intro.php99
-rw-r--r--view/tpl/intros.tpl16
-rw-r--r--view/tpl/intros_header.tpl1
-rw-r--r--view/tpl/nav.tpl13
5 files changed, 113 insertions, 31 deletions
diff --git a/include/nav.php b/include/nav.php
index 5008b6269..24449409b 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -119,14 +119,6 @@ EOT;
$gdirpath = 'directory';
- if(strlen(get_config('system','singleuser'))) {
- $gdir = dirname(get_config('system','directory_submit_url'));
- if(strlen($gdir))
- $gdirpath = $gdir;
- }
- elseif(! get_config('system','no_community_page'))
- $nav['community'] = array('community', t('Community'), "", t('Conversations on this site'));
-
$nav['directory'] = array($gdirpath, t('Directory'), "", t('People directory'));
/**
@@ -141,9 +133,8 @@ EOT;
$nav['home'] = array('channel/' . $channel['channel_address'], t('Home'), "", t('Your posts and conversations'));
- if($channel['channel_pageflags'] == PAGE_NORMAL) {
- $nav['introductions'] = array('notifications/intros', t('Introductions'), "", t('Connection Requests'));
- }
+ $nav['intros'] = array('intro', t('Introductions'), "", t('New Connections'));
+
$nav['notifications'] = array('notifications', t('Notifications'), "", t('Notifications'));
$nav['notifications']['all']=array('notifications/system', t('See all notifications'), "", "");
@@ -212,7 +203,7 @@ function nav_set_selected($item){
'network' => null,
'home' => null,
'profiles' => null,
- 'introductions' => null,
+ 'intros' => null,
'notifications' => null,
'messages' => null,
'directory' => null,
diff --git a/mod/intro.php b/mod/intro.php
new file mode 100644
index 000000000..4b9d63629
--- /dev/null
+++ b/mod/intro.php
@@ -0,0 +1,99 @@
+<?php
+
+function intro_post(&$a) {
+ if(! local_user())
+ return;
+ if(! intval($_REQUEST['contact_id']))
+ return;
+
+ $flags = 0;
+ if($_REQUEST['submit'] == t('Approve')) {
+ ;
+ }
+ elseif($_REQUEST['submit'] == t('Block')) {
+ $flags = ABOOK_FLAG_BLOCKED;
+ }
+ elseif($_REQUEST['submit'] == t('Ignore')) {
+ $flags = ABOOK_FLAG_IGNORED;
+ }
+ if(intval($_REQUEST['hidden']))
+ $flags |= ABOOK_FLAG_HIDDEN;
+
+ $r = q("update abook set abook_flags = %d where abook_channel = %d and abook_id = %d limit 1",
+ intval($flags),
+ intval(local_user()),
+ intval($_REQUEST['contact_id'])
+ );
+ if($r)
+ info( t('Connection updated.') . EOL);
+ else
+ notice( t('Connection update failed.') . EOL);
+
+}
+
+
+
+function intro_content(&$a) {
+
+ if( ! local_user()) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
+
+
+ $o = replace_macros(get_markup_template('intros_header.tpl'),array(
+ '$title' => t('Introductions and Connection Requests')
+ ));
+
+ $r = q("select count(abook_id) as total from abook where abook_channel = %d and (abook_flags & %d) and not (abook_flags & %d) ",
+ intval(local_user()),
+ intval(ABOOK_FLAG_PENDING),
+ intval(ABOOK_FLAG_SELF)
+ );
+ if($r) {
+ $a->set_pager_total($r[0]['total']);
+ if(! intval($r[0]['total'])) {
+ notice( t('No pending introductions.') . EOL);
+ return;
+ }
+ }
+ else {
+ notice( t('System error. Please try again later.') . EOL);
+ return;
+ }
+
+ $r = q("select abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and (abook_flags & %d) and not (abook_flags & %d) LIMIT %d, %d",
+ intval(local_user()),
+ intval(ABOOK_FLAG_PENDING),
+ intval(ABOOK_FLAG_SELF),
+ intval($a->pager['start']),
+ intval($a->pager['itemspage'])
+ );
+
+ if($r) {
+
+ $tpl = get_markup_template("intros.tpl");
+
+ foreach($r as $rr) {
+ $o .= replace_macros($tpl,array(
+ '$uid' => local_user(),
+
+ '$contact_id' => $rr['abook_id'],
+ '$photo' => ((x($rr,'xchan_photo_l')) ? $rr['xchan_photo_l'] : "images/person-175.jpg"),
+ '$fullname' => $rr['xchan_name'],
+ '$hidden' => array('hidden', t('Hide this contact from others'), ($rr['abook_flags'] & ABOOK_FLAG_HIDDEN), ''),
+ '$activity' => array('activity', t('Post a new friend activity'), (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0), t('if applicable')),
+ '$url' => zid($rr['xchan_url']),
+ '$approve' => t('Approve'),
+ '$block' => t('Block'),
+ '$ignore' => t('Ignore'),
+ '$discard' => t('Discard')
+
+ ));
+ }
+ }
+
+ $o .= paginate($a);
+ return $o;
+
+} \ No newline at end of file
diff --git a/view/tpl/intros.tpl b/view/tpl/intros.tpl
index e7fd53ca4..6d1f1baa0 100644
--- a/view/tpl/intros.tpl
+++ b/view/tpl/intros.tpl
@@ -1,27 +1,17 @@
<div class="intro-wrapper" id="intro-$contact_id" >
-<p class="intro-desc">$str_notifytype $notify_type</p>
<div class="intro-fullname" id="intro-fullname-$contact_id" >$fullname</div>
<a class="intro-url-link" id="intro-url-link-$contact_id" href="$url" ><img id="photo-$contact_id" class="intro-photo" src="$photo" width="175" height=175" title="$fullname" alt="$fullname" /></a>
-<div class="intro-knowyou">$knowyou</div>
-<div class="intro-note" id="intro-note-$contact_id">$note</div>
<div class="intro-wrapper-end" id="intro-wrapper-end-$contact_id"></div>
-<form class="intro-form" action="notifications/$intro_id" method="post">
+<form class="intro-form" action="intro" method="post">
<input class="intro-submit-ignore" type="submit" name="submit" value="$ignore" />
+<input class="intro-submit-block" type="submit" name="submit" value="$block" />
<input class="intro-submit-discard" type="submit" name="submit" value="$discard" />
-</form>
-<div class="intro-form-end"></div>
-
-<form class="intro-approve-form" action="dfrn_confirm" method="post">
{{inc field_checkbox.tpl with $field=$hidden }}{{endinc}}
-{{inc field_checkbox.tpl with $field=$activity }}{{endinc}}
-<input type="hidden" name="dfrn_id" value="$dfrn_id" >
-<input type="hidden" name="intro_id" value="$intro_id" >
+{# {{ inc field_checkbox.tpl with $field=$activity }}{{endinc}} #}
<input type="hidden" name="contact_id" value="$contact_id" >
-$dfrn_text
-
<input class="intro-submit-approve" type="submit" name="submit" value="$approve" />
</form>
</div>
diff --git a/view/tpl/intros_header.tpl b/view/tpl/intros_header.tpl
new file mode 100644
index 000000000..17afd0cbd
--- /dev/null
+++ b/view/tpl/intros_header.tpl
@@ -0,0 +1 @@
+<h3>$title</h3>
diff --git a/view/tpl/nav.tpl b/view/tpl/nav.tpl
index d2e525756..5e909e172 100644
--- a/view/tpl/nav.tpl
+++ b/view/tpl/nav.tpl
@@ -26,12 +26,6 @@
</li>
{{ endif }}
- {{ if $nav.community }}
- <li id="nav-community-link" class="nav-menu $sel.community">
- <a class="$nav.community.2" href="$nav.community.0" title="$nav.community.3" >$nav.community.1</a>
- </li>
- {{ endif }}
-
{{ if $nav.network }}
<li id="nav-network-link" class="nav-menu $sel.network">
<a class="$nav.network.2" href="$nav.network.0" title="$nav.network.3" >$nav.network.1</a>
@@ -45,6 +39,13 @@
</li>
{{ endif }}
+ {{ if $nav.intros }}
+ <li id="nav-intros-link" class="nav-menu $sel.intros">
+ <a class="$nav.intros.2" href="$nav.intros.0" title="$nav.intros.3" >$nav.intros.1</a>
+ <span id="intro-update" class="nav-notify"></span>
+ </li>
+ {{ endif }}
+
{{ if $nav.notifications }}