Merge remote-tracking branch 'friendica/master'

This commit is contained in:
Fabio Comuni 2012-01-06 09:11:48 +01:00
commit f9b0af6f2f
12 changed files with 146 additions and 17 deletions

View File

@ -40,3 +40,36 @@ function findpeople_widget() {
} }
function networks_widget($baseurl,$selected = '') {
$a = get_app();
if(! local_user())
return '';
$r = q("select distinct(network) from contact where uid = %d",
intval(local_user())
);
$nets = array();
if(count($r)) {
require_once('include/contact_selectors.php');
foreach($r as $rr) {
if($rr['network'])
$nets[] = array('ref' => $rr['network'], 'name' => network_to_name($rr['network']), 'selected' => (($selected == $rr['network']) ? 'selected' : '' ));
}
}
return replace_macros(get_markup_template('nets.tpl'),array(
'$title' => t('Networks'),
'$desc' => '',
'$sel_all' => (($selected == '') ? 'selected' : ''),
'$all' => t('All Networks'),
'$nets' => $nets,
'$base' => $baseurl,
));
}

View File

@ -129,7 +129,7 @@ function localize_item(&$item){
* that are based on unique features of the calling module. * that are based on unique features of the calling module.
* *
*/ */
function conversation(&$a, $items, $mode, $update) { function conversation(&$a, $items, $mode, $update, $preview = false) {
require_once('bbcode.php'); require_once('bbcode.php');
@ -287,7 +287,7 @@ function conversation(&$a, $items, $mode, $update) {
'$like' => '', '$like' => '',
'$dislike' => '', '$dislike' => '',
'$comment' => '', '$comment' => '',
'$conv' => array('href'=> $a->get_baseurl() . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context')), '$conv' => (($preview) ? '' : array('href'=> $a->get_baseurl() . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))),
'$wait' => t('Please wait'), '$wait' => t('Please wait'),
)); ));
@ -483,6 +483,7 @@ function conversation(&$a, $items, $mode, $update) {
'$myphoto' => $a->contact['thumb'], '$myphoto' => $a->contact['thumb'],
'$comment' => t('Comment'), '$comment' => t('Comment'),
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$preview' => t('Preview'),
'$ww' => (($mode === 'network') ? $commentww : '') '$ww' => (($mode === 'network') ? $commentww : '')
)); ));
} }

View File

@ -389,6 +389,7 @@
unpause(); unpause();
commentBusy = true; commentBusy = true;
$('body').css('cursor', 'wait'); $('body').css('cursor', 'wait');
$("#comment-preview-inp-" + id).val("0");
$.post( $.post(
"item", "item",
$("#comment-edit-form-" + id).serialize(), $("#comment-edit-form-" + id).serialize(),
@ -411,6 +412,28 @@
return false; return false;
} }
function preview_comment(id) {
$("#comment-preview-inp-" + id).val("1");
$("#comment-edit-preview-" + id).show();
$.post(
"item",
$("#comment-edit-form-" + id).serialize(),
function(data) {
if(data.preview) {
$("#comment-edit-preview-" + id).html(data.preview);
$("#comment-edit-preview-" + id + " a").removeAttr('href');
}
},
"json"
);
return true;
}
function unpause() { function unpause() {
// unpause auto reloads if they are currently stopped // unpause auto reloads if they are currently stopped
totStopped = false; totStopped = false;

View File

@ -586,11 +586,9 @@ function item_post(&$a) {
// preview mode - prepare the body for display and send it via json // preview mode - prepare the body for display and send it via json
if($preview) { if($preview) {
$b = prepare_body($datarray,true);
require_once('include/conversation.php'); require_once('include/conversation.php');
$o = conversation(&$a,array(array_merge($datarray,$contact_record)),'search',false); $o = conversation(&$a,array(array_merge($contact_record,$datarray)),'search',false,true);
$json = array('preview' => $o); echo json_encode(array('preview' => $o));
echo json_encode($json);
killme(); killme();
} }

View File

@ -10,6 +10,8 @@ function network_init(&$a) {
$group_id = (($a->argc > 1 && intval($a->argv[1])) ? intval($a->argv[1]) : 0); $group_id = (($a->argc > 1 && intval($a->argv[1])) ? intval($a->argv[1]) : 0);
require_once('include/group.php'); require_once('include/group.php');
require_once('include/contact_widgets.php');
if(! x($a->page,'aside')) if(! x($a->page,'aside'))
$a->page['aside'] = ''; $a->page['aside'] = '';
@ -42,6 +44,7 @@ function network_init(&$a) {
} }
$a->page['aside'] .= group_side('network','network',true,$group_id); $a->page['aside'] .= group_side('network','network',true,$group_id);
$a->page['aside'] .= networks_widget($a->get_baseurl() . '/network',(($_GET['nets']) ? $_GET['nets'] : ''));
$a->page['aside'] .= saved_searches($search); $a->page['aside'] .= saved_searches($search);
} }
@ -52,7 +55,8 @@ function saved_searches($search) {
. ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '') . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '')
. ((x($_GET,'star')) ? '?star=' . $_GET['star'] : '') . ((x($_GET,'star')) ? '?star=' . $_GET['star'] : '')
. ((x($_GET,'bmark')) ? '?bmark=' . $_GET['bmark'] : '') . ((x($_GET,'bmark')) ? '?bmark=' . $_GET['bmark'] : '')
. ((x($_GET,'conv')) ? '?conv=' . $_GET['conv'] : ''); . ((x($_GET,'conv')) ? '?conv=' . $_GET['conv'] : '')
. ((x($_GET,'nets')) ? '?nets=' . $_GET['nets'] : '');
$o = ''; $o = '';
@ -203,7 +207,7 @@ function network_content(&$a, $update = 0) {
$order = ((x($_GET,'order')) ? notags($_GET['order']) : 'comment'); $order = ((x($_GET,'order')) ? notags($_GET['order']) : 'comment');
$liked = ((x($_GET,'liked')) ? intval($_GET['liked']) : 0); $liked = ((x($_GET,'liked')) ? intval($_GET['liked']) : 0);
$conv = ((x($_GET,'conv')) ? intval($_GET['conv']) : 0); $conv = ((x($_GET,'conv')) ? intval($_GET['conv']) : 0);
$nets = ((x($_GET,'nets')) ? $_GET['nets'] : '');
if(($a->argc > 2) && $a->argv[2] === 'new') if(($a->argc > 2) && $a->argv[2] === 'new')
$nouveau = true; $nouveau = true;
@ -263,6 +267,8 @@ function network_content(&$a, $update = 0) {
$sql_options = (($star) ? " and starred = 1 " : ''); $sql_options = (($star) ? " and starred = 1 " : '');
$sql_options .= (($bmark) ? " and bookmark = 1 " : ''); $sql_options .= (($bmark) ? " and bookmark = 1 " : '');
$sql_nets = (($nets) ? sprintf(" and `contact`.`network` = '%s' ", dbesc($nets)) : '');
// We'll need the following line if starred/bookmarks are allowed in comments in the future // We'll need the following line if starred/bookmarks are allowed in comments in the future
// $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` $sql_options ) "; // $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` $sql_options ) ";
@ -336,6 +342,7 @@ function network_content(&$a, $update = 0) {
. ((x($_GET,'bmark')) ? '&bmark=' . $_GET['bmark'] : '') . ((x($_GET,'bmark')) ? '&bmark=' . $_GET['bmark'] : '')
. ((x($_GET,'liked')) ? '&liked=' . $_GET['liked'] : '') . ((x($_GET,'liked')) ? '&liked=' . $_GET['liked'] : '')
. ((x($_GET,'conv')) ? '&conv=' . $_GET['conv'] : '') . ((x($_GET,'conv')) ? '&conv=' . $_GET['conv'] : '')
. ((x($_GET,'nets')) ? '&nets=' . $_GET['nets'] : '')
. "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n"; . "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
} }
@ -374,7 +381,7 @@ function network_content(&$a, $update = 0) {
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$sql_extra2 $sql_extra2
$sql_extra ", $sql_extra $sql_nets ",
intval($_SESSION['uid']) intval($_SESSION['uid'])
); );
@ -399,7 +406,7 @@ function network_content(&$a, $update = 0) {
$simple_update $simple_update
AND `contact`.`id` = `item`.`contact-id` AND `contact`.`id` = `item`.`contact-id`
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$sql_extra $sql_extra $sql_nets
ORDER BY `item`.`received` DESC $pager_sql ", ORDER BY `item`.`received` DESC $pager_sql ",
intval($_SESSION['uid']) intval($_SESSION['uid'])
); );
@ -423,7 +430,7 @@ function network_content(&$a, $update = 0) {
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
and `item`.`unseen` = 1 and `item`.`unseen` = 1
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$sql_extra ", $sql_extra $sql_nets ",
intval(local_user()) intval(local_user())
); );
} }
@ -433,7 +440,7 @@ function network_content(&$a, $update = 0) {
WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
AND `item`.`parent` = `item`.`id` AND `item`.`parent` = `item`.`id`
$sql_extra $sql_extra $sql_nets
ORDER BY `item`.$ordering DESC $pager_sql ", ORDER BY `item`.$ordering DESC $pager_sql ",
intval(local_user()) intval(local_user())
); );
@ -459,7 +466,7 @@ function network_content(&$a, $update = 0) {
AND `contact`.`id` = `item`.`contact-id` AND `contact`.`id` = `item`.`contact-id`
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
AND `item`.`parent` IN ( %s ) AND `item`.`parent` IN ( %s )
$sql_extra ", $sql_extra $sql_nets",
intval(local_user()), intval(local_user()),
dbesc($parents_str) dbesc($parents_str)
); );

View File

@ -1203,6 +1203,7 @@ function photos_content(&$a) {
'$myphoto' => $contact['thumb'], '$myphoto' => $contact['thumb'],
'$comment' => t('Comment'), '$comment' => t('Comment'),
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$preview' => t('Preview'),
'$ww' => '' '$ww' => ''
)); ));
} }

View File

@ -190,6 +190,12 @@ function ping_init(&$a) {
}; };
} }
if (count($cit)){
foreach ($cit as $i) {
echo xmlize( $a->get_baseurl().'/display/'.$a->user['nickname']."/".$i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), t("{0} mentioned you in a post") );
};
}
echo " </notif>"; echo " </notif>";
} }
echo " <sysmsgs>"; echo " <sysmsgs>";

View File

@ -5,6 +5,7 @@
<input type="hidden" name="parent" value="$parent" /> <input type="hidden" name="parent" value="$parent" />
<input type="hidden" name="return" value="$return_path" /> <input type="hidden" name="return" value="$return_path" />
<input type="hidden" name="jsreload" value="$jsreload" /> <input type="hidden" name="jsreload" value="$jsreload" />
<input type="hidden" name="preview" id="comment-preview-inp-$id" value="0" />
<div class="comment-edit-photo" id="comment-edit-photo-$id" > <div class="comment-edit-photo" id="comment-edit-photo-$id" >
<a class="comment-edit-photo-link" href="$mylink" title="$mytitle"><img class="my-comment-photo" src="$myphoto" alt="$mytitle" title="$mytitle" /></a> <a class="comment-edit-photo-link" href="$mylink" title="$mytitle"><img class="my-comment-photo" src="$myphoto" alt="$mytitle" title="$mytitle" /></a>
@ -15,6 +16,8 @@
<div class="comment-edit-text-end"></div> <div class="comment-edit-text-end"></div>
<div class="comment-edit-submit-wrapper" id="comment-edit-submit-wrapper-$id" style="display: none;" > <div class="comment-edit-submit-wrapper" id="comment-edit-submit-wrapper-$id" style="display: none;" >
<input type="submit" onclick="post_comment($id); return false;" id="comment-edit-submit-$id" class="comment-edit-submit" name="submit" value="$submit" /> <input type="submit" onclick="post_comment($id); return false;" id="comment-edit-submit-$id" class="comment-edit-submit" name="submit" value="$submit" />
<span onclick="preview_comment($id);" id="comment-edit-preview-link-$id" class="fakelink">$preview</span>
<div id="comment-edit-preview-$id" style="display:none;"></div>
</div> </div>
<div class="comment-edit-end"></div> <div class="comment-edit-end"></div>

10
view/nets.tpl Normal file
View File

@ -0,0 +1,10 @@
<div id="nets-sidebar" class="widget">
<h3>$title</h3>
<div id="nets-desc">$desc</div>
<a href="$base" class="nets-link{{ if $sel_all }} nets-selected{{ endif }} nets-all">$all</a>
<ul class="nets-ul">
{{ for $nets as $net }}
<li><a href="$base?nets=$net.ref" class="nets-link{{ if $net.selected }} nets-selected{{ endif }}">$net.name</a></li>
{{ endfor }}
</ul>
</div>

View File

@ -306,7 +306,7 @@ div.wall-item-content-wrapper.shiny {
margin-bottom: 10px; margin-bottom: 10px;
} }
.group-selected { .group-selected, .nets-selected {
padding: 3px; padding: 3px;
-moz-border-radius: 3px; -moz-border-radius: 3px;
border-radius: 3px; border-radius: 3px;
@ -1842,6 +1842,21 @@ a.mail-list-link {
margin-top: 10px; margin-top: 10px;
} }
.nets-ul {
list-style-type: none;
}
.nets-ul li {
margin-top: 10px;
}
.nets-link {
margin-left: 24px;
}
.nets-all {
margin-left: 42px;
}
#search-save { #search-save {
margin-left: 5px; margin-left: 5px;
} }

View File

@ -164,7 +164,7 @@ blockquote:before {
margin-bottom: 10px; margin-bottom: 10px;
} }
.group-selected { .group-selected, .nets-selected {
padding: 3px; padding: 3px;
border: 1px solid #CCCCCC; border: 1px solid #CCCCCC;
background: #F8F8F8; background: #F8F8F8;
@ -1901,6 +1901,21 @@ a.mail-list-link {
width: 12px; width: 12px;
} }
.nets-ul {
list-style-type: none;
}
.nets-ul li {
margin-top: 10px;
}
.nets-link {
margin-left: 24px;
}
.nets-all {
margin-left: 42px;
}
#search-save { #search-save {
margin-left: 5px; margin-left: 5px;
} }

View File

@ -630,7 +630,7 @@ h3#search:before {
top:1px; top:1px;
} }
.group-selected { .group-selected, .nets-selected {
padding-bottom: 0px; padding-bottom: 0px;
padding-left: 2px; padding-left: 2px;
padding-right: 2px; padding-right: 2px;
@ -668,6 +668,23 @@ ul .sidebar-group-li .icon{
width: 12px; width: 12px;
} }
.nets-ul {
list-style-type: none;
}
.nets-ul li {
margin-top: 10px;
}
.nets-link {
margin-left: 24px;
}
.nets-all {
margin-left: 42px;
}
.widget h3{ .widget h3{
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #f0edf0), color-stop(1, #e2e2e2) ); background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #f0edf0), color-stop(1, #e2e2e2) );
background:-moz-linear-gradient( center top, #f0edf0 5%, #e2e2e2 100% ); background:-moz-linear-gradient( center top, #f0edf0 5%, #e2e2e2 100% );