wall tags

This commit is contained in:
friendica 2014-12-15 14:37:31 -08:00
parent 1780ba5e7d
commit f28103d595
10 changed files with 65 additions and 18 deletions

View File

@ -216,6 +216,26 @@ function tagblock($link,$uid,$count = 0,$authors = '',$flags = 0,$restrict = 0,$
return $o;
}
function wtagblock($uid,$count = 0,$authors = '',$flags = 0,$restrict = 0,$type = TERM_HASHTAG) {
$o = '';
$tab = 0;
$r = tagadelic($uid,$count,$authors,$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('Tags') . '</h3><div class="tags" align="center">';
foreach($r as $rr) {
$o .= '<span class="tag' . $rr[2] . '">#</span><a href="channel/' . $c[0]['channel_address'] . '?f=&tag=' . urlencode($rr[0]).'" class="tag'.$rr[2].'">'.$rr[0].'</a> ' . "\r\n";
}
$o .= '</div></div>';
}
return $o;
}
function catblock($uid,$count = 0,$authors = '',$flags = 0,$restrict = 0,$type = TERM_CATEGORY) {
$o = '';
$tab = 0;

View File

@ -236,9 +236,13 @@ function widget_savedsearch($arr) {
$hasq = ((strpos($srchurl,'?') !== false) ? true : false);
$srchurl = rtrim(preg_replace('/search\=[^\&].*?(\&|$)/is','',$srchurl),'&');
$srchurl = rtrim(preg_replace('/submit\=[^\&].*?(\&|$)/is','',$srchurl),'&');
$srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl);
$hasq = ((strpos($srchurl,'?') !== false) ? true : false);
$o = '';
$r = q("select `tid`,`term` from `term` WHERE `uid` = %d and `type` = %d ",
@ -387,7 +391,7 @@ function widget_tagcloud_wall($arr) {
$limit = ((array_key_exists('limit', $arr)) ? intval($arr['limit']) : 50);
if(feature_enabled($a->profile['profile_uid'], 'tagadelic'))
return tagblock('search', $a->profile['profile_uid'], $limit, $a->profile['channel_hash'], ITEM_WALL);
return wtagblock($a->profile['profile_uid'], $limit, $a->profile['channel_hash'], ITEM_WALL);
return '';
}

View File

@ -57,6 +57,7 @@ function channel_content(&$a, $update = 0, $load = false) {
}
$category = ((x($_REQUEST,'cat')) ? $_REQUEST['cat'] : '');
$hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : '');
$groups = array();
@ -174,6 +175,9 @@ function channel_content(&$a, $update = 0, $load = false) {
if(x($category)) {
$sql_extra .= protect_sprintf(term_query('item', $category, TERM_CATEGORY));
}
if(x($hashtags)) {
$sql_extra .= protect_sprintf(term_query('item', $hashtags, TERM_HASHTAG));
}
if($datequery) {
$sql_extra2 .= protect_sprintf(sprintf(" AND item.created <= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery))));
@ -281,6 +285,7 @@ function channel_content(&$a, $update = 0, $load = false) {
'$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0),
'$file' => '',
'$cats' => (($category) ? $category : ''),
'$tags' => (($hashtags) ? $hashtags : ''),
'$mid' => $mid,
'$dend' => $datequery,
'$dbegin' => $datequery2

View File

@ -133,6 +133,7 @@ function display_content(&$a, $update = 0, $load = false) {
'$order' => '',
'$file' => '',
'$cats' => '',
'$tags' => '',
'$dend' => '',
'$dbegin' => '',
'$mid' => $item_hash

View File

@ -141,6 +141,7 @@ function home_content(&$a, $update = 0, $load = false) {
'$order' => 'comment',
'$file' => '',
'$cats' => '',
'$tags' => '',
'$dend' => '',
'$mid' => '',
'$dbegin' => ''

View File

@ -34,6 +34,21 @@ function network_content(&$a, $update = 0, $load = false) {
$channel = $a->get_channel();
$datequery = $datequery2 = '';
$group = 0;
$nouveau = false;
$datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : '');
$datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : '');
$nouveau = ((x($_GET,'new')) ? intval($_GET['new']) : 0);
$gid = ((x($_GET,'gid')) ? intval($_GET['gid']) : 0);
$category = ((x($_REQUEST,'cat')) ? $_REQUEST['cat'] : '');
$hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : '');
$search = (($_GET['search']) ? $_GET['search'] : '');
if($search) {
if(strpos($search,'@') === 0) {
@ -47,23 +62,11 @@ function network_content(&$a, $update = 0, $load = false) {
}
}
elseif(strpos($search,'#') === 0) {
$search = $_GET['search'] = substr($search,1);
$hashtags = substr($search,1);
$search = $_GET['search'] = '';
}
}
$datequery = $datequery2 = '';
$group = 0;
$nouveau = false;
$datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : '');
$datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : '');
$nouveau = ((x($_GET,'new')) ? intval($_GET['new']) : 0);
$gid = ((x($_GET,'gid')) ? intval($_GET['gid']) : 0);
if($datequery)
$_GET['order'] = 'post';
@ -199,6 +202,12 @@ function network_content(&$a, $update = 0, $load = false) {
}
}
if(x($category)) {
$sql_extra .= protect_sprintf(term_query('item', $category, TERM_CATEGORY));
}
if(x($hashtags)) {
$sql_extra .= protect_sprintf(term_query('item', $hashtags, TERM_HASHTAG));
}
if(! $update) {
// The special div is needed for liveUpdate to kick in for this page.
@ -238,7 +247,8 @@ function network_content(&$a, $update = 0, $load = false) {
'$search' => (($search) ? $search : ''),
'$order' => $order,
'$file' => $file,
'$cats' => '',
'$cats' => $category,
'$tags' => $hashtags,
'$dend' => $datequery,
'$mid' => '',
'$dbegin' => $datequery2

View File

@ -107,6 +107,7 @@ function search_content(&$a,$update = 0, $load = false) {
'$order' => '',
'$file' => '',
'$cats' => '',
'$tags' => '',
'$mid' => '',
'$dend' => '',
'$dbegin' => ''

View File

@ -1 +1 @@
2014-12-14.889
2014-12-15.890

View File

@ -903,7 +903,7 @@ function updateConvItems(mode,data) {
function preview_post() {
$("#jot-preview").val("1");
$("#jot-preview-content").show();
tinyMCE.triggerSave();
// tinyMCE.triggerSave();
$.post(
"item",
$("#profile-jot-form").serialize(),
@ -1020,6 +1020,8 @@ function fcFileBrowser (field_name, url, type, win) {
}
function setupFieldRichtext(){
return;
/*
tinyMCE.init({
theme : "advanced",
mode : "specific_textareas",
@ -1043,6 +1045,7 @@ function setupFieldRichtext(){
theme_advanced_path : false,
file_browser_callback : "fcFileBrowser",
});
*/
}

View File

@ -22,6 +22,7 @@
var bParam_order = "{{$order}}";
var bParam_file = "{{$file}}";
var bParam_cats = "{{$cats}}";
var bParam_tags = "{{$tags}}";
var bParam_dend = "{{$dend}}";
var bParam_dbegin = "{{$dbegin}}";
var bParam_mid = "{{$mid}}";
@ -46,6 +47,7 @@
if(bParam_order != "") bCmd = bCmd + "&order=" + bParam_order;
if(bParam_file != "") bCmd = bCmd + "&file=" + bParam_file;
if(bParam_cats != "") bCmd = bCmd + "&cat=" + bParam_cats;
if(bParam_tags != "") bCmd = bCmd + "&tag=" + bParam_tags;
if(bParam_dend != "") bCmd = bCmd + "&dend=" + bParam_dend;
if(bParam_dbegin != "") bCmd = bCmd + "&dbegin=" + bParam_dbegin;
if(bParam_mid != "") bCmd = bCmd + "&mid=" + bParam_mid;