aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-08-23 00:01:02 -0700
committerzotlabs <mike@macgirvin.com>2017-08-23 00:01:02 -0700
commite084b776eee9f1fc66e3f4a37b92ec70ccc49286 (patch)
treebf19cfd1d3823ec13df1606319bd638e142a4849 /include
parent41ff8fdd375fcf395b547dd02f3bdcbb198ec0c1 (diff)
downloadvolse-hubzilla-e084b776eee9f1fc66e3f4a37b92ec70ccc49286.tar.gz
volse-hubzilla-e084b776eee9f1fc66e3f4a37b92ec70ccc49286.tar.bz2
volse-hubzilla-e084b776eee9f1fc66e3f4a37b92ec70ccc49286.zip
cards feature
Diffstat (limited to 'include')
-rw-r--r--include/contact_widgets.php43
-rw-r--r--include/conversation.php16
-rw-r--r--include/features.php9
-rw-r--r--include/nav.php12
-rw-r--r--include/taxonomy.php76
5 files changed, 154 insertions, 2 deletions
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index 8f76bb4bc..aac756a46 100644
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -100,6 +100,49 @@ function categories_widget($baseurl,$selected = '') {
return '';
}
+function cardcategories_widget($baseurl,$selected = '') {
+
+ if(! feature_enabled(App::$profile['profile_uid'],'categories'))
+ return '';
+
+ $item_normal = "and item.item_hidden = 0 and item.item_type = 6 and item.item_deleted = 0
+ and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_pending_remove = 0
+ and item.item_blocked = 0 ";
+
+ $terms = array();
+ $r = q("select distinct(term.term)
+ from term join item on term.oid = item.id
+ where item.uid = %d
+ and term.uid = item.uid
+ and term.ttype = %d
+ and term.otype = %d
+ and item.owner_xchan = '%s'
+ $item_normal
+ order by term.term asc",
+ intval(App::$profile['profile_uid']),
+ intval(TERM_CATEGORY),
+ intval(TERM_OBJ_POST),
+ dbesc(App::$profile['channel_hash'])
+ );
+ if($r && count($r)) {
+ foreach($r as $rr)
+ $terms[] = array('name' => $rr['term'], 'selected' => (($selected == $rr['term']) ? 'selected' : ''));
+
+ return replace_macros(get_markup_template('categories_widget.tpl'),array(
+ '$title' => t('Categories'),
+ '$desc' => '',
+ '$sel_all' => (($selected == '') ? 'selected' : ''),
+ '$all' => t('Everything'),
+ '$terms' => $terms,
+ '$base' => $baseurl,
+
+ ));
+ }
+ return '';
+}
+
+
+
function common_friends_visitor_widget($profile_uid) {
if(local_channel() == $profile_uid)
diff --git a/include/conversation.php b/include/conversation.php
index 3b8ec19d3..c9142ac30 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1835,7 +1835,8 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
require_once('include/menu.php');
$has_bookmarks = menu_list_count(local_channel(),'',MENU_BOOKMARK) + menu_list_count(local_channel(),'',MENU_SYSTEM|MENU_BOOKMARK);
- if ($is_owner && $has_bookmarks) {
+
+ if($is_owner && $has_bookmarks) {
$tabs[] = array(
'label' => t('Bookmarks'),
'url' => z_root() . '/bookmarks',
@@ -1846,6 +1847,17 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
);
}
+ if(feature_enabled($uid,'cards')) {
+ $tabs[] = array(
+ 'label' => t('Cards'),
+ 'url' => z_root() . '/cards/' . $nickname,
+ 'sel' => ((argv(0) == 'cards') ? 'active' : ''),
+ 'title' => t('View Cards'),
+ 'id' => 'cards-tab',
+ 'icon' => 'list'
+ );
+ }
+
if($has_webpages && feature_enabled($uid,'webpages')) {
$tabs[] = array(
'label' => t('Webpages'),
@@ -1856,7 +1868,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
'icon' => 'newspaper-o'
);
}
-
+
if ($p['view_wiki']) {
if(feature_enabled($uid,'wiki') && (get_account_techlevel($account_id) > 3)) {
diff --git a/include/features.php b/include/features.php
index f32dbe82e..f84c9cb05 100644
--- a/include/features.php
+++ b/include/features.php
@@ -118,6 +118,15 @@ function get_features($filtered = true) {
],
[
+ 'cards',
+ t('Cards'),
+ t('Create personal planning cards'),
+ false,
+ get_config('feature_lock','cards'),
+ feature_level('cards',1),
+ ],
+
+ [
'nav_channel_select',
t('Navigation Channel Select'),
t('Change channels directly from within the navigation dropdown menu'),
diff --git a/include/nav.php b/include/nav.php
index 76a8f8fb9..f5a1236a8 100644
--- a/include/nav.php
+++ b/include/nav.php
@@ -434,6 +434,18 @@ function channel_apps($is_owner = false, $nickname = null) {
];
}
+ if($p['view_pages'] && feature_enabled($uid,'cards')) {
+ $tabs[] = [
+ 'label' => t('Cards'),
+ 'url' => z_root() . '/cards/' . $nickname ,
+ 'sel' => ((argv(0) == 'cards') ? 'active' : ''),
+ 'title' => t('View Cards'),
+ 'id' => 'cards-tab',
+ 'icon' => 'list'
+ ];
+ }
+
+
if($has_webpages && feature_enabled($uid,'webpages')) {
$tabs[] = [
'label' => t('Webpages'),
diff --git a/include/taxonomy.php b/include/taxonomy.php
index 46d661581..36e05b008 100644
--- a/include/taxonomy.php
+++ b/include/taxonomy.php
@@ -199,6 +199,62 @@ function tagadelic($uid, $count = 0, $authors = '', $owner = '', $flags = 0, $re
}
+
+
+function card_tagadelic($uid, $count = 0, $authors = '', $owner = '', $flags = 0, $restrict = 0, $type = TERM_CATEGORY) {
+
+ require_once('include/security.php');
+
+ if(! perm_is_allowed($uid,get_observer_hash(),'view_pages'))
+ return array();
+
+
+ $item_normal = item_normal();
+ $sql_options = item_permissions_sql($uid);
+ $count = intval($count);
+
+ if($flags) {
+ if($flags === 'wall')
+ $sql_options .= " and item_wall = 1 ";
+ }
+
+ if($authors) {
+ if(! is_array($authors))
+ $authors = array($authors);
+
+ stringify_array_elms($authors,true);
+ $sql_options .= " and author_xchan in (" . implode(',',$authors) . ") ";
+ }
+
+ if($owner) {
+ $sql_options .= " and owner_xchan = '" . dbesc($owner) . "' ";
+ }
+
+
+ // Fetch tags
+ $r = q("select term, count(term) as total from term left join item on term.oid = item.id
+ where term.uid = %d and term.ttype = %d
+ and otype = %d and item_type = %d and item_private = 0
+ $sql_options $item_normal
+ group by term order by total desc %s",
+ intval($uid),
+ intval($type),
+ intval(TERM_OBJ_POST),
+ intval($restrict),
+ ((intval($count)) ? "limit $count" : '')
+ );
+
+ if(! $r)
+ return array();
+
+ return Zotlabs\Text\Tagadelic::calc($r);
+
+}
+
+
+
+
+
function dir_tagadelic($count = 0) {
$count = intval($count);
@@ -316,6 +372,26 @@ function catblock($uid,$count = 0,$authors = '',$owner = '', $flags = 0,$restric
return $o;
}
+function card_catblock($uid,$count = 0,$authors = '',$owner = '', $flags = 0,$restrict = 0,$type = TERM_CATEGORY) {
+ $o = '';
+
+ $r = card_tagadelic($uid,$count,$authors,$owner,$flags,$restrict,$type);
+
+ if($r) {
+ $c = q("select channel_address from channel where channel_id = %d limit 1",
+ intval($uid)
+ );
+
+ $o = '<div class="tagblock widget"><h3>' . t('Categories') . '</h3><div class="tags" align="center">';
+ foreach($r as $rr) {
+ $o .= '<a href="cards/' . $c[0]['channel_address']. '?f=&cat=' . urlencode($rr[0]).'" class="tag'.$rr[2].'">'.$rr[0].'</a> ' . "\r\n";
+ }
+ $o .= '</div></div>';
+ }
+
+ return $o;
+}
+
function dir_tagblock($link,$r) {
$o = '';