aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-02-04 17:12:13 -0800
committerfriendica <info@friendica.com>2014-02-04 17:12:13 -0800
commitaede006970fb9124161b4732b9f44002a35d17ef (patch)
tree7d39ad22e8b3ac3f87903666fc454cc9c5dfc025
parent3665bc38ef15137c7d36a12aa13a44c4d0304547 (diff)
downloadvolse-hubzilla-aede006970fb9124161b4732b9f44002a35d17ef.tar.gz
volse-hubzilla-aede006970fb9124161b4732b9f44002a35d17ef.tar.bz2
volse-hubzilla-aede006970fb9124161b4732b9f44002a35d17ef.zip
bookmarks - mop up and go home
-rw-r--r--include/ItemObject.php10
-rw-r--r--include/bookmarks.php2
-rw-r--r--include/conversation.php8
-rw-r--r--include/menu.php2
-rw-r--r--mod/bookmarks.php34
-rw-r--r--view/js/mod_connedit.js2
-rw-r--r--view/js/mod_settings.js2
-rwxr-xr-xview/tpl/conv_item.tpl3
-rwxr-xr-xview/tpl/jot-header.tpl8
9 files changed, 66 insertions, 5 deletions
diff --git a/include/ItemObject.php b/include/ItemObject.php
index e9a0b65c0..9b1a6fbcd 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -171,6 +171,15 @@ class Item extends BaseObject {
);
}
+ $has_bookmarks = false;
+ if(is_array($item['term'])) {
+ foreach($item['term'] as $t) {
+ if($t['type'] == TERM_BOOKMARK)
+ $has_bookmarks = true;
+ }
+ }
+
+
if($this->is_commentable()) {
$like = array( t("I like this \x28toggle\x29"), t("like"));
$dislike = array( t("I don't like this \x28toggle\x29"), t("dislike"));
@@ -237,6 +246,7 @@ class Item extends BaseObject {
'star' => ((feature_enabled($conv->get_profile_owner(),'star_posts')) ? $star : ''),
'tagger' => ((feature_enabled($conv->get_profile_owner(),'commtag')) ? $tagger : ''),
'filer' => ((feature_enabled($conv->get_profile_owner(),'filing')) ? $filer : ''),
+ 'bookmark' => (($conv->get_profile_owner() == local_user() && $has_bookmarks) ? t('Bookmark Links') : ''),
'drop' => $drop,
'multidrop' => ((feature_enabled($conv->get_profile_owner(),'multi_delete')) ? $multidrop : ''),
// end toolbar buttons
diff --git a/include/bookmarks.php b/include/bookmarks.php
index 62ec9fcab..3ca8ee1c1 100644
--- a/include/bookmarks.php
+++ b/include/bookmarks.php
@@ -29,7 +29,7 @@ function bookmark_add($channel,$sender,$taxonomy,$private) {
$arr = array();
$arr['menu_name'] = substr($sender['xchan_hash'],0,16) . ' ' . $sender['xchan_name'];
$arr['menu_desc'] = sprintf( t('%1$s\'s bookmarks'), $sender['xchan_name']);
- $arr['menu_flags'] = MENU_SYSTEM|MENU_BOOKMARK;
+ $arr['menu_flags'] = (($sender['xchan_hash'] === $channel['channel_hash']) ? MENU_BOOKMARK : MENU_SYSTEM|MENU_BOOKMARK);
$arr['menu_channel_id'] = $channel_id;
$x = menu_list($arr['menu_channel_id'],$arr['menu_name'],$arr['menu_flags']);
diff --git a/include/conversation.php b/include/conversation.php
index 316bc1612..633435871 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1496,6 +1496,14 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
'title' => t('Events and Calendar'),
'id' => 'events-tab',
);
+
+ $tabs[] = array(
+ 'label' => t('Bookmarks'),
+ 'url' => $a->get_baseurl() . '/bookmarks',
+ 'sel' => ((argv(0) == 'bookmarks') ? 'active' : ''),
+ 'title' => t('Saved Bookmarks'),
+ 'id' => 'bookmarks-tab',
+ );
}
if($is_owner && feature_enabled($a->profile['profile_uid'],'webpages')) {
diff --git a/include/menu.php b/include/menu.php
index e5bd4a680..105e4216b 100644
--- a/include/menu.php
+++ b/include/menu.php
@@ -110,7 +110,7 @@ function menu_create($arr) {
function menu_list($channel_id, $name = '', $flags = 0) {
$sel_options = '';
- $sel_options .= (($name) ? " and name = '" . protect_sprintf(dbesc($name)) . "' " : '');
+ $sel_options .= (($name) ? " and menu_name = '" . protect_sprintf(dbesc($name)) . "' " : '');
$sel_options .= (($flags) ? " and menu_flags = " . intval($flags) . " " : '');
$r = q("select * from menu where menu_channel_id = %d $sel_options order by menu_name",
diff --git a/mod/bookmarks.php b/mod/bookmarks.php
index 25bf39a7a..fe5ec1e19 100644
--- a/mod/bookmarks.php
+++ b/mod/bookmarks.php
@@ -1,5 +1,39 @@
<?php
+function bookmarks_init(&$a) {
+ if(! local_user())
+ return;
+ $item_id = intval($_REQUEST['item']);
+ if(! $item_id)
+ return;
+
+ $u = $a->get_channel();
+
+ $i = q("select * from item where id = %d and uid = %d limit 1",
+ intval($item_id),
+ intval(local_user())
+ );
+ if(! $i)
+ return;
+
+ $i = fetch_post_tags($i);
+
+ $item = $i[0];
+
+ $terms = get_terms_oftype($item['term'],TERM_BOOKMARK);
+
+ if($terms && (! $i[0]['item_restrict'])) {
+ require_once('include/bookmarks.php');
+ require_once('include/Contact.php');
+ $s = channelx_by_hash($i[0]['author_xchan']);
+ foreach($terms as $t) {
+ bookmark_add($u,$s[0],$t,$i[0]['item_private']);
+ notice( t('Bookmark(s) added') . EOL);
+ }
+ }
+ killme();
+}
+
function bookmarks_content(&$a) {
if(! local_user()) {
notice( t('Permission denied.') . EOL);
diff --git a/view/js/mod_connedit.js b/view/js/mod_connedit.js
index 6bb39fb7a..7a33952dc 100644
--- a/view/js/mod_connedit.js
+++ b/view/js/mod_connedit.js
@@ -17,7 +17,7 @@ function connectFullShare() {
$('#me_id_perms_chat').attr('checked','checked');
$('#me_id_perms_view_storage').attr('checked','checked');
$('#me_id_perms_republish').attr('checked','checked');
- $('#me_id_perms_bookmark').attr('checked','checked');
+
}
function connectCautiousShare() {
diff --git a/view/js/mod_settings.js b/view/js/mod_settings.js
index 7ede7fb73..16101db57 100644
--- a/view/js/mod_settings.js
+++ b/view/js/mod_settings.js
@@ -66,7 +66,7 @@ function channel_privacy_macro(n) {
$('#id_write_pages option').eq(1).attr('selected','selected');
$('#id_delegate option').eq(0).attr('selected','selected');
$('#id_republish option').eq(0).attr('selected','selected');
- $('#id_bookmark option').eq(0).attr('selected','selected');
+ $('#id_bookmark option').eq(1).attr('selected','selected');
$('#id_profile_in_directory_onoff .off').removeClass('hidden');
$('#id_profile_in_directory_onoff .on').addClass('hidden');
$('#id_profile_in_directory').val(0);
diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl
index 50a243ff4..869692bfa 100755
--- a/view/tpl/conv_item.tpl
+++ b/view/tpl/conv_item.tpl
@@ -85,6 +85,9 @@
{{/if}}
{{if $item.filer}}
<i id="filer-{{$item.id}}" onclick="itemFiler({{$item.id}}); return false;" class="filer-item icon-folder-open item-tool" title="{{$item.filer}}"></i>
+ {{/if}}
+ {{if $item.bookmark}}
+ <i id="bookmarker-{{$item.id}}" onclick="itemBookmark({{$item.id}}); return false;" class="bookmark-item icon-bookmark item-tool" title="{{$item.bookmark}}"></i>
{{/if}}
<div id="like-rotator-{{$item.id}}" class="like-rotator"></div>
diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl
index 878e1e7da..80421d552 100755
--- a/view/tpl/jot-header.tpl
+++ b/view/tpl/jot-header.tpl
@@ -185,7 +185,6 @@ function enableOnUser(){
}
}
-
function jotGetLocation() {
reply = prompt("{{$whereareu}}", $('#jot-location').val());
if(reply && reply.length) {
@@ -295,6 +294,13 @@ function enableOnUser(){
}
+ function itemBookmark(id) {
+ $.get('{{$baseurl}}/bookmarks?f=&item=' + id);
+ if(timer) clearTimeout(timer);
+ timer = setTimeout(NavUpdate,1000);
+ }
+
+
function jotClearLocation() {
$('#jot-coord').val('');
$('#profile-nolocation-wrapper').hide();