Merge pull request #37 from fabrixxm/master
autocomplete contacts metions
This commit is contained in:
commit
6a8b96709e
15 changed files with 569 additions and 70 deletions
|
@ -19,7 +19,7 @@ function tryoembed($match){
|
||||||
if ($o->type=="error") return $match[0];
|
if ($o->type=="error") return $match[0];
|
||||||
|
|
||||||
$html = oembed_format_object($o);
|
$html = oembed_format_object($o);
|
||||||
return oembed_iframe($html,$o->width,$o->height);
|
return $html; //oembed_iframe($html,$o->width,$o->height);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ function oembed_replacecb($matches){
|
||||||
$embedurl=$matches[1];
|
$embedurl=$matches[1];
|
||||||
$j = oembed_fetch_url($embedurl);
|
$j = oembed_fetch_url($embedurl);
|
||||||
$s = oembed_format_object($j);
|
$s = oembed_format_object($j);
|
||||||
return oembed_iframe($s,$j->width,$j->height);
|
return $s;//oembed_iframe($s,$j->width,$j->height);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,7 @@ function oembed_fetch_url($embedurl){
|
||||||
|
|
||||||
function oembed_format_object($j){
|
function oembed_format_object($j){
|
||||||
$embedurl = $j->embedurl;
|
$embedurl = $j->embedurl;
|
||||||
|
$jhtml = oembed_iframe($j->html,$j->width,$j->height );
|
||||||
$ret="<span class='oembed ".$j->type."'>";
|
$ret="<span class='oembed ".$j->type."'>";
|
||||||
switch ($j->type) {
|
switch ($j->type) {
|
||||||
case "video": {
|
case "video": {
|
||||||
|
@ -68,14 +69,14 @@ function oembed_format_object($j){
|
||||||
$tpl=get_markup_template('oembed_video.tpl');
|
$tpl=get_markup_template('oembed_video.tpl');
|
||||||
$ret.=replace_macros($tpl, array(
|
$ret.=replace_macros($tpl, array(
|
||||||
'$embedurl'=>$embedurl,
|
'$embedurl'=>$embedurl,
|
||||||
'$escapedhtml'=>urlencode($j->html),
|
'$escapedhtml'=>base64_encode($jhtml),
|
||||||
'$tw'=>$tw,
|
'$tw'=>$tw,
|
||||||
'$th'=>$th,
|
'$th'=>$th,
|
||||||
'$turl'=>$j->thumbnail_url,
|
'$turl'=>$j->thumbnail_url,
|
||||||
));
|
));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$ret=$j->html;
|
$ret=$jhtml;
|
||||||
}
|
}
|
||||||
$ret.="<br>";
|
$ret.="<br>";
|
||||||
}; break;
|
}; break;
|
||||||
|
@ -88,12 +89,12 @@ function oembed_format_object($j){
|
||||||
}; break;
|
}; break;
|
||||||
case "rich": {
|
case "rich": {
|
||||||
// not so safe..
|
// not so safe..
|
||||||
$ret.= $j->html;
|
$ret.= $jhtml;
|
||||||
}; break;
|
}; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add link to source if not present in "rich" type
|
// add link to source if not present in "rich" type
|
||||||
if ( $j->type!='rich' || !strpos($ret,$embedurl) ){
|
if ( $j->type!='rich' || !strpos($j->html,$embedurl) ){
|
||||||
$embedlink = (isset($j->title))?$j->title:$embedurl;
|
$embedlink = (isset($j->title))?$j->title:$embedurl;
|
||||||
$ret .= "<a href='$embedurl' rel='oembed'>$embedlink</a>";
|
$ret .= "<a href='$embedurl' rel='oembed'>$embedlink</a>";
|
||||||
if (isset($j->author_name)) $ret.=" by ".$j->author_name;
|
if (isset($j->author_name)) $ret.=" by ".$j->author_name;
|
||||||
|
@ -107,7 +108,6 @@ function oembed_format_object($j){
|
||||||
}
|
}
|
||||||
|
|
||||||
function oembed_iframe($src,$width,$height) {
|
function oembed_iframe($src,$width,$height) {
|
||||||
|
|
||||||
if(! $width || strstr($width,'%'))
|
if(! $width || strstr($width,'%'))
|
||||||
$width = '640';
|
$width = '640';
|
||||||
if(! $height || strstr($height,'%'))
|
if(! $height || strstr($height,'%'))
|
||||||
|
|
165
js/fk.autocomplete.js
Normal file
165
js/fk.autocomplete.js
Normal file
|
@ -0,0 +1,165 @@
|
||||||
|
/**
|
||||||
|
* Friendika people autocomplete
|
||||||
|
*
|
||||||
|
* require jQuery, jquery.textareas
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function ACPopup(elm,backend_url){
|
||||||
|
this.idsel=-1;
|
||||||
|
this.element = elm;
|
||||||
|
this.searchText="";
|
||||||
|
this.ready=true;
|
||||||
|
this.kp_timer = false;
|
||||||
|
this.url = backend_url;
|
||||||
|
|
||||||
|
style = $(elm).offset();
|
||||||
|
w = $(elm).width();
|
||||||
|
h = $(elm).height();
|
||||||
|
style.top=style.top+h;
|
||||||
|
style.width = w;
|
||||||
|
style.position = 'absolute';
|
||||||
|
/* style['max-height'] = '150px';
|
||||||
|
style.border = '1px solid red';
|
||||||
|
style.background = '#cccccc';
|
||||||
|
|
||||||
|
style.overflow = 'auto';
|
||||||
|
style['z-index'] = '100000';
|
||||||
|
*/
|
||||||
|
style.display = 'none';
|
||||||
|
|
||||||
|
this.cont = $("<div class='acpopup'></div>");
|
||||||
|
this.cont.css(style);
|
||||||
|
|
||||||
|
$("body").append(this.cont);
|
||||||
|
}
|
||||||
|
ACPopup.prototype.close = function(){
|
||||||
|
$(this.cont).remove();
|
||||||
|
this.ready=false;
|
||||||
|
}
|
||||||
|
ACPopup.prototype.search = function(text){
|
||||||
|
var that = this;
|
||||||
|
this.searchText=text;
|
||||||
|
if (this.kp_timer) clearTimeout(this.kp_timer);
|
||||||
|
this.kp_timer = setTimeout( function(){that._search();}, 500);
|
||||||
|
}
|
||||||
|
ACPopup.prototype._search = function(){
|
||||||
|
console.log("_search");
|
||||||
|
var that = this;
|
||||||
|
var postdata = {
|
||||||
|
start:0,
|
||||||
|
count:100,
|
||||||
|
search:this.searchText,
|
||||||
|
type:'c',
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type:'POST',
|
||||||
|
url: this.url,
|
||||||
|
data: postdata,
|
||||||
|
dataType: 'json',
|
||||||
|
success:function(data){
|
||||||
|
that.cont.html("");
|
||||||
|
if (data.tot>0){
|
||||||
|
that.cont.show();
|
||||||
|
$(data.items).each(function(){
|
||||||
|
html = "<img src='{0}' height='16px' width='16px'>{1} ({2})".format(this.photo, this.name, this.nick)
|
||||||
|
that.add(html, this.nick);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
that.cont.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
ACPopup.prototype.add = function(label, value){
|
||||||
|
var that=this;
|
||||||
|
var elm = $("<div class='acpopupitem' title='"+value+"'>"+label+"</div>");
|
||||||
|
elm.click(function(e){
|
||||||
|
t = $(this).attr('title');
|
||||||
|
el=$(that.element);
|
||||||
|
sel = el.getSelection();
|
||||||
|
sel.start = sel.start- that.searchText.length;
|
||||||
|
el.setSelection(sel.start,sel.end).replaceSelectedText(t).collapseSelection(false);
|
||||||
|
that.close();
|
||||||
|
});
|
||||||
|
$(this.cont).append(elm);
|
||||||
|
}
|
||||||
|
ACPopup.prototype.onkey = function(event){
|
||||||
|
if (event.keyCode == '13' && this.idsel>-1) {
|
||||||
|
this.cont.children()[this.idsel].click();
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
if (event.keyCode == '38') { //cursor up
|
||||||
|
cmax = this.cont.children().size()-1;
|
||||||
|
this.idsel--;
|
||||||
|
if (this.idsel<0) this.idsel=cmax;
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
if (event.keyCode == '40') { //cursor down
|
||||||
|
cmax = this.cont.children().size()-1;
|
||||||
|
this.idsel++;
|
||||||
|
if (this.idsel>cmax) this.idsel=0;
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.keyCode == '38' || event.keyCode == '40' ) {
|
||||||
|
this.cont.children().removeClass('selected');
|
||||||
|
$(this.cont.children()[this.idsel]).addClass('selected');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.keyCode == '27') { //ESC
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ContactAutocomplete(element,backend_url){
|
||||||
|
this.pattern=/@([^ \n]+)$/;
|
||||||
|
this.popup=null;
|
||||||
|
var that = this;
|
||||||
|
|
||||||
|
$(element).unbind('keydown');
|
||||||
|
$(element).unbind('keyup');
|
||||||
|
|
||||||
|
$(element).keydown(function(event){
|
||||||
|
if (that.popup!==null) that.popup.onkey(event);
|
||||||
|
});
|
||||||
|
|
||||||
|
$(element).keyup(function(event){
|
||||||
|
cpos = $(this).getSelection();
|
||||||
|
if (cpos.start==cpos.end){
|
||||||
|
match = $(this).val().substring(0,cpos.start).match(that.pattern);
|
||||||
|
if (match!==null){
|
||||||
|
if (that.popup===null){
|
||||||
|
that.popup = new ACPopup(this, backend_url);
|
||||||
|
}
|
||||||
|
if (that.popup.ready && match[1]!==that.popup.searchText) that.popup.search(match[1]);
|
||||||
|
if (!that.popup.ready) that.popup=null;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (that.popup!==null) {that.popup.close(); that.popup=null;}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* jQuery plugin 'contact_autocomplete'
|
||||||
|
*/
|
||||||
|
(function( $ ){
|
||||||
|
$.fn.contact_autocomplete = function(backend_url) {
|
||||||
|
this.each(function(){
|
||||||
|
new ContactAutocomplete(this, backend_url);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
})( jQuery );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
20
js/jquery.textinputs.js
Normal file
20
js/jquery.textinputs.js
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
Rangy Text Inputs, a cross-browser textarea and text input library plug-in for jQuery.
|
||||||
|
|
||||||
|
Part of Rangy, a cross-browser JavaScript range and selection library
|
||||||
|
http://code.google.com/p/rangy/
|
||||||
|
|
||||||
|
Depends on jQuery 1.0 or later.
|
||||||
|
|
||||||
|
Copyright 2010, Tim Down
|
||||||
|
Licensed under the MIT license.
|
||||||
|
Version: 0.1.205
|
||||||
|
Build date: 5 November 2010
|
||||||
|
*/
|
||||||
|
(function(n){function o(e,g){var a=typeof e[g];return a==="function"||!!(a=="object"&&e[g])||a=="unknown"}function p(e,g,a){if(g<0)g+=e.value.length;if(typeof a=="undefined")a=g;if(a<0)a+=e.value.length;return{start:g,end:a}}function k(){return typeof document.body=="object"&&document.body?document.body:document.getElementsByTagName("body")[0]}var i,h,q,l,r,s,t,u,m;n(document).ready(function(){function e(a,b){return function(){var c=this.jquery?this[0]:this,d=c.nodeName.toLowerCase();if(c.nodeType==
|
||||||
|
1&&(d=="textarea"||d=="input"&&c.type=="text")){c=[c].concat(Array.prototype.slice.call(arguments));c=a.apply(this,c);if(!b)return c}if(b)return this}}var g=document.createElement("textarea");k().appendChild(g);if(typeof g.selectionStart!="undefined"&&typeof g.selectionEnd!="undefined"){i=function(a){return{start:a.selectionStart,end:a.selectionEnd,length:a.selectionEnd-a.selectionStart,text:a.value.slice(a.selectionStart,a.selectionEnd)}};h=function(a,b,c){b=p(a,b,c);a.selectionStart=b.start;a.selectionEnd=
|
||||||
|
b.end};m=function(a,b){if(b)a.selectionEnd=a.selectionStart;else a.selectionStart=a.selectionEnd}}else if(o(g,"createTextRange")&&typeof document.selection=="object"&&document.selection&&o(document.selection,"createRange")){i=function(a){var b=0,c=0,d,f,j;if((j=document.selection.createRange())&&j.parentElement()==a){f=a.value.length;d=a.value.replace(/\r\n/g,"\n");c=a.createTextRange();c.moveToBookmark(j.getBookmark());j=a.createTextRange();j.collapse(false);if(c.compareEndPoints("StartToEnd",j)>
|
||||||
|
-1)b=c=f;else{b=-c.moveStart("character",-f);b+=d.slice(0,b).split("\n").length-1;if(c.compareEndPoints("EndToEnd",j)>-1)c=f;else{c=-c.moveEnd("character",-f);c+=d.slice(0,c).split("\n").length-1}}}return{start:b,end:c,length:c-b,text:a.value.slice(b,c)}};h=function(a,b,c){b=p(a,b,c);c=a.createTextRange();var d=b.start-(a.value.slice(0,b.start).split("\r\n").length-1);c.collapse(true);if(b.start==b.end)c.move("character",d);else{c.moveEnd("character",b.end-(a.value.slice(0,b.end).split("\r\n").length-
|
||||||
|
1));c.moveStart("character",d)}c.select()};m=function(a,b){var c=document.selection.createRange();c.collapse(b);c.select()}}else{k().removeChild(g);window.console&&window.console.log&&window.console.log("TextInputs module for Rangy not supported in your browser. Reason: No means of finding text input caret position");return}k().removeChild(g);l=function(a,b,c,d){var f;if(b!=c){f=a.value;a.value=f.slice(0,b)+f.slice(c)}d&&h(a,b,b)};q=function(a){var b=i(a);l(a,b.start,b.end,true)};u=function(a){var b=
|
||||||
|
i(a),c;if(b.start!=b.end){c=a.value;a.value=c.slice(0,b.start)+c.slice(b.end)}h(a,b.start,b.start);return b.text};r=function(a,b,c,d){var f=a.value;a.value=f.slice(0,c)+b+f.slice(c);if(d){b=c+b.length;h(a,b,b)}};s=function(a,b){var c=i(a),d=a.value;a.value=d.slice(0,c.start)+b+d.slice(c.end);c=c.start+b.length;h(a,c,c)};t=function(a,b,c){var d=i(a),f=a.value;a.value=f.slice(0,d.start)+b+d.text+c+f.slice(d.end);b=d.start+b.length;h(a,b,b+d.length)};n.fn.extend({getSelection:e(i,false),setSelection:e(h,
|
||||||
|
true),collapseSelection:e(m,true),deleteSelectedText:e(q,true),deleteText:e(l,true),extractSelectedText:e(u,false),insertText:e(r,true),replaceSelectedText:e(s,true),surroundSelectedText:e(t,true)})})})(jQuery);
|
|
@ -78,8 +78,6 @@
|
||||||
menu.toggle();
|
menu.toggle();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* notifications template */
|
/* notifications template */
|
||||||
var notifications_tpl= unescape($("#nav-notifications-template[rel=template]").html());
|
var notifications_tpl= unescape($("#nav-notifications-template[rel=template]").html());
|
||||||
|
@ -163,7 +161,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function NavUpdate() {
|
function NavUpdate() {
|
||||||
|
@ -245,6 +245,8 @@
|
||||||
commentBusy = false;
|
commentBusy = false;
|
||||||
$('body').css('cursor', 'auto');
|
$('body').css('cursor', 'auto');
|
||||||
}
|
}
|
||||||
|
/* autocomplete @nicknames */
|
||||||
|
$(".comment-edit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,6 +447,7 @@ function setupFieldRichtext(){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sprintf in javascript
|
* sprintf in javascript
|
||||||
* "{0} and {1}".format('zero','uno');
|
* "{0} and {1}".format('zero','uno');
|
||||||
|
|
142
js/webtoolkit.base64.js
Normal file
142
js/webtoolkit.base64.js
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Base64 encode / decode
|
||||||
|
* http://www.webtoolkit.info/
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
|
||||||
|
var Base64 = {
|
||||||
|
|
||||||
|
// private property
|
||||||
|
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
||||||
|
|
||||||
|
// public method for encoding
|
||||||
|
encode : function (input) {
|
||||||
|
var output = "";
|
||||||
|
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
|
input = Base64._utf8_encode(input);
|
||||||
|
|
||||||
|
while (i < input.length) {
|
||||||
|
|
||||||
|
chr1 = input.charCodeAt(i++);
|
||||||
|
chr2 = input.charCodeAt(i++);
|
||||||
|
chr3 = input.charCodeAt(i++);
|
||||||
|
|
||||||
|
enc1 = chr1 >> 2;
|
||||||
|
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
||||||
|
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
||||||
|
enc4 = chr3 & 63;
|
||||||
|
|
||||||
|
if (isNaN(chr2)) {
|
||||||
|
enc3 = enc4 = 64;
|
||||||
|
} else if (isNaN(chr3)) {
|
||||||
|
enc4 = 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
output = output +
|
||||||
|
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
|
||||||
|
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
},
|
||||||
|
|
||||||
|
// public method for decoding
|
||||||
|
decode : function (input) {
|
||||||
|
var output = "";
|
||||||
|
var chr1, chr2, chr3;
|
||||||
|
var enc1, enc2, enc3, enc4;
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
|
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
||||||
|
|
||||||
|
while (i < input.length) {
|
||||||
|
|
||||||
|
enc1 = this._keyStr.indexOf(input.charAt(i++));
|
||||||
|
enc2 = this._keyStr.indexOf(input.charAt(i++));
|
||||||
|
enc3 = this._keyStr.indexOf(input.charAt(i++));
|
||||||
|
enc4 = this._keyStr.indexOf(input.charAt(i++));
|
||||||
|
|
||||||
|
chr1 = (enc1 << 2) | (enc2 >> 4);
|
||||||
|
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
||||||
|
chr3 = ((enc3 & 3) << 6) | enc4;
|
||||||
|
|
||||||
|
output = output + String.fromCharCode(chr1);
|
||||||
|
|
||||||
|
if (enc3 != 64) {
|
||||||
|
output = output + String.fromCharCode(chr2);
|
||||||
|
}
|
||||||
|
if (enc4 != 64) {
|
||||||
|
output = output + String.fromCharCode(chr3);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
output = Base64._utf8_decode(output);
|
||||||
|
|
||||||
|
return output;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
// private method for UTF-8 encoding
|
||||||
|
_utf8_encode : function (string) {
|
||||||
|
string = string.replace(/\r\n/g,"\n");
|
||||||
|
var utftext = "";
|
||||||
|
|
||||||
|
for (var n = 0; n < string.length; n++) {
|
||||||
|
|
||||||
|
var c = string.charCodeAt(n);
|
||||||
|
|
||||||
|
if (c < 128) {
|
||||||
|
utftext += String.fromCharCode(c);
|
||||||
|
}
|
||||||
|
else if((c > 127) && (c < 2048)) {
|
||||||
|
utftext += String.fromCharCode((c >> 6) | 192);
|
||||||
|
utftext += String.fromCharCode((c & 63) | 128);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
utftext += String.fromCharCode((c >> 12) | 224);
|
||||||
|
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
||||||
|
utftext += String.fromCharCode((c & 63) | 128);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return utftext;
|
||||||
|
},
|
||||||
|
|
||||||
|
// private method for UTF-8 decoding
|
||||||
|
_utf8_decode : function (utftext) {
|
||||||
|
var string = "";
|
||||||
|
var i = 0;
|
||||||
|
var c = c1 = c2 = 0;
|
||||||
|
|
||||||
|
while ( i < utftext.length ) {
|
||||||
|
|
||||||
|
c = utftext.charCodeAt(i);
|
||||||
|
|
||||||
|
if (c < 128) {
|
||||||
|
string += String.fromCharCode(c);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
else if((c > 191) && (c < 224)) {
|
||||||
|
c2 = utftext.charCodeAt(i+1);
|
||||||
|
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
||||||
|
i += 2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
c2 = utftext.charCodeAt(i+1);
|
||||||
|
c3 = utftext.charCodeAt(i+2);
|
||||||
|
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
||||||
|
i += 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
123
mod/acl.php
123
mod/acl.php
|
@ -10,73 +10,90 @@ function acl_init(&$a){
|
||||||
$start = (x($_POST,'start')?$_POST['start']:0);
|
$start = (x($_POST,'start')?$_POST['start']:0);
|
||||||
$count = (x($_POST,'count')?$_POST['count']:100);
|
$count = (x($_POST,'count')?$_POST['count']:100);
|
||||||
$search = (x($_POST,'search')?$_POST['search']:"");
|
$search = (x($_POST,'search')?$_POST['search']:"");
|
||||||
|
$type = (x($_POST,'type')?$_POST['type']:"");
|
||||||
|
|
||||||
|
|
||||||
if ($search!=""){
|
if ($search!=""){
|
||||||
$sql_extra = "AND `name` LIKE '%%".dbesc($search)."%%'";
|
$sql_extra = "AND `name` LIKE '%%".dbesc($search)."%%'";
|
||||||
|
$sql_extra2 = "AND (`name` LIKE '%%".dbesc($search)."%%' OR `nick` LIKE '%%".dbesc($search)."%%')";
|
||||||
}
|
}
|
||||||
|
|
||||||
// count groups and contacts
|
// count groups and contacts
|
||||||
$r = q("SELECT COUNT(`id`) AS g FROM `group` WHERE `deleted` = 0 AND `uid` = %d $sql_extra",
|
if ($type=='' || $type=='g'){
|
||||||
intval(local_user())
|
$r = q("SELECT COUNT(`id`) AS g FROM `group` WHERE `deleted` = 0 AND `uid` = %d $sql_extra",
|
||||||
);
|
intval(local_user())
|
||||||
$group_count = (int)$r[0]['g'];
|
);
|
||||||
$r = q("SELECT COUNT(`id`) AS c FROM `contact`
|
$group_count = (int)$r[0]['g'];
|
||||||
WHERE `uid` = %d AND `self` = 0
|
} else {
|
||||||
AND `blocked` = 0 AND `pending` = 0
|
$group_count = 0;
|
||||||
AND `notify` != '' $sql_extra" ,
|
}
|
||||||
intval(local_user())
|
|
||||||
);
|
if ($type=='' || $type=='c'){
|
||||||
$contact_count = (int)$r[0]['c'];
|
$r = q("SELECT COUNT(`id`) AS c FROM `contact`
|
||||||
|
WHERE `uid` = %d AND `self` = 0
|
||||||
|
AND `blocked` = 0 AND `pending` = 0
|
||||||
|
AND `notify` != '' $sql_extra" ,
|
||||||
|
intval(local_user())
|
||||||
|
);
|
||||||
|
$contact_count = (int)$r[0]['c'];
|
||||||
|
} else {
|
||||||
|
$contact_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$tot = $group_count+$contact_count;
|
$tot = $group_count+$contact_count;
|
||||||
|
|
||||||
$groups = array();
|
$groups = array();
|
||||||
$contacts = array();
|
$contacts = array();
|
||||||
|
|
||||||
$r = q("SELECT `group`.`id`, `group`.`name`, GROUP_CONCAT(DISTINCT `group_member`.`contact-id` SEPARATOR ',') as uids
|
if ($type=='' || $type=='g'){
|
||||||
FROM `group`,`group_member`
|
|
||||||
WHERE `group`.`deleted` = 0 AND `group`.`uid` = %d
|
|
||||||
AND `group_member`.`gid`=`group`.`id`
|
|
||||||
$sql_extra
|
|
||||||
GROUP BY `group`.`id`
|
|
||||||
ORDER BY `group`.`name`
|
|
||||||
LIMIT %d,%d",
|
|
||||||
intval(local_user()),
|
|
||||||
intval($start),
|
|
||||||
intval($count)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
foreach($r as $g){
|
|
||||||
$groups[] = array(
|
|
||||||
"type" => "g",
|
|
||||||
"photo" => "images/default-group-mm.png",
|
|
||||||
"name" => $g['name'],
|
|
||||||
"id" => intval($g['id']),
|
|
||||||
"uids" => array_map("intval", explode(",",$g['uids'])),
|
|
||||||
"link" => ''
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$r = q("SELECT `id`, `name`, `micro`, `network`, `url` FROM `contact`
|
|
||||||
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `notify` != ''
|
|
||||||
$sql_extra
|
|
||||||
ORDER BY `name` ASC ",
|
|
||||||
intval(local_user())
|
|
||||||
);
|
|
||||||
foreach($r as $g){
|
|
||||||
$contacts[] = array(
|
|
||||||
"type" => "c",
|
|
||||||
"photo" => $g['micro'],
|
|
||||||
"name" => $g['name'],
|
|
||||||
"id" => intval($g['id']),
|
|
||||||
"network" => $g['network'],
|
|
||||||
"link" => $g['url'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$r = q("SELECT `group`.`id`, `group`.`name`, GROUP_CONCAT(DISTINCT `group_member`.`contact-id` SEPARATOR ',') as uids
|
||||||
|
FROM `group`,`group_member`
|
||||||
|
WHERE `group`.`deleted` = 0 AND `group`.`uid` = %d
|
||||||
|
AND `group_member`.`gid`=`group`.`id`
|
||||||
|
$sql_extra
|
||||||
|
GROUP BY `group`.`id`
|
||||||
|
ORDER BY `group`.`name`
|
||||||
|
LIMIT %d,%d",
|
||||||
|
intval(local_user()),
|
||||||
|
intval($start),
|
||||||
|
intval($count)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
foreach($r as $g){
|
||||||
|
$groups[] = array(
|
||||||
|
"type" => "g",
|
||||||
|
"photo" => "images/default-group-mm.png",
|
||||||
|
"name" => $g['name'],
|
||||||
|
"id" => intval($g['id']),
|
||||||
|
"uids" => array_map("intval", explode(",",$g['uids'])),
|
||||||
|
"link" => ''
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type=='' || $type=='c'){
|
||||||
|
|
||||||
|
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url` FROM `contact`
|
||||||
|
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `notify` != ''
|
||||||
|
$sql_extra2
|
||||||
|
ORDER BY `name` ASC ",
|
||||||
|
intval(local_user())
|
||||||
|
);
|
||||||
|
foreach($r as $g){
|
||||||
|
$contacts[] = array(
|
||||||
|
"type" => "c",
|
||||||
|
"photo" => $g['micro'],
|
||||||
|
"name" => $g['name'],
|
||||||
|
"id" => intval($g['id']),
|
||||||
|
"network" => $g['network'],
|
||||||
|
"link" => $g['url'],
|
||||||
|
"nick" => $g['nick'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$items = array_merge($groups, $contacts);
|
$items = array_merge($groups, $contacts);
|
||||||
|
|
|
@ -17,11 +17,14 @@
|
||||||
<script type="text/javascript" src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
<script type="text/javascript" src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<script type="text/javascript" src="$baseurl/js/jquery.js" ></script>
|
<script type="text/javascript" src="$baseurl/js/jquery.js" ></script>
|
||||||
|
<script type="text/javascript" src="$baseurl/js/jquery.textinputs.js" ></script>
|
||||||
|
<script type="text/javascript" src="$baseurl/js/fk.autocomplete.js" ></script>
|
||||||
<script type="text/javascript" src="$baseurl/library/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
|
<script type="text/javascript" src="$baseurl/library/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
|
||||||
<script type="text/javascript" src="$baseurl/library/tiptip/jquery.tipTip.minified.js"></script>
|
<script type="text/javascript" src="$baseurl/library/tiptip/jquery.tipTip.minified.js"></script>
|
||||||
<script type="text/javascript" src="$baseurl/library/jgrowl/jquery.jgrowl_minimized.js"></script>
|
<script type="text/javascript" src="$baseurl/library/jgrowl/jquery.jgrowl_minimized.js"></script>
|
||||||
<script type="text/javascript" src="$baseurl/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js" ></script>
|
<script type="text/javascript" src="$baseurl/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js" ></script>
|
||||||
<script type="text/javascript" src="$baseurl/js/acl.js" ></script>
|
<script type="text/javascript" src="$baseurl/js/acl.js" ></script>
|
||||||
|
<script type="text/javascript" src="$baseurl/js/webtoolkit.base64.js" ></script>
|
||||||
<script type="text/javascript" src="$baseurl/js/main.js" ></script>
|
<script type="text/javascript" src="$baseurl/js/main.js" ></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<a href='$embedurl' onclick='this.innerHTML=unescape("$escapedhtml").replace(/\+/g," "); return false;' style='float:left; margin: 1em; position: relative;'>
|
<a href='$embedurl' onclick='this.innerHTML=Base64.decode("$escapedhtml"); return false;' style='float:left; margin: 1em; position: relative;'>
|
||||||
<img width='$tw' height='$th' src='$turl' >
|
<img width='$tw' height='$th' src='$turl' >
|
||||||
<div style='position: absolute; top: 0px; left: 0px; width: $twpx; height: $thpx; background: url(images/icons/48/play.png) no-repeat center center;'></div>
|
<div style='position: absolute; top: 0px; left: 0px; width: $twpx; height: $thpx; background: url(images/icons/48/play.png) no-repeat center center;'></div>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -1250,3 +1250,24 @@ footer { display: block; margin: 50px 20%; clear: both; }
|
||||||
/** /acl **/
|
/** /acl **/
|
||||||
|
|
||||||
|
|
||||||
|
/* autocomplete popup */
|
||||||
|
.acpopup {
|
||||||
|
max-height:150px;
|
||||||
|
background-color:#555753;
|
||||||
|
color: #FFFFFF;
|
||||||
|
overflow:auto;
|
||||||
|
z-index:100000;
|
||||||
|
border:1px solid #cccccc;
|
||||||
|
}
|
||||||
|
.acpopupitem {
|
||||||
|
background-color:#555753; padding: 4px;
|
||||||
|
clear:left;
|
||||||
|
}
|
||||||
|
.acpopupitem img {
|
||||||
|
float: left;
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.acpopupitem.selected {
|
||||||
|
color: #2e3436; background-color: #eeeeec;
|
||||||
|
}
|
||||||
|
|
|
@ -2833,3 +2833,24 @@ a.mail-list-link {
|
||||||
.type-text { background-position: -60px 0px; }
|
.type-text { background-position: -60px 0px; }
|
||||||
.type-unkn { background-position: -80px 0px; }
|
.type-unkn { background-position: -80px 0px; }
|
||||||
|
|
||||||
|
|
||||||
|
/* autocomplete popup */
|
||||||
|
.acpopup {
|
||||||
|
max-height:150px;
|
||||||
|
background-color:#ffffff;
|
||||||
|
overflow:auto;
|
||||||
|
z-index:100000;
|
||||||
|
border:1px solid #cccccc;
|
||||||
|
}
|
||||||
|
.acpopupitem {
|
||||||
|
background-color:#ffffff; padding: 4px;
|
||||||
|
clear:left;
|
||||||
|
}
|
||||||
|
.acpopupitem img {
|
||||||
|
float: left;
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.acpopupitem.selected {
|
||||||
|
color: #FFFFFF; background: #3465A4;
|
||||||
|
}
|
||||||
|
|
|
@ -2745,9 +2745,31 @@ a.mail-list-link {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.type-video { background-position: 0px; 0px; }
|
.type-video { background-position: 0px 0px; }
|
||||||
.type-image { background-position: -20px; 0px; }
|
.type-image { background-position: -20px 0px; }
|
||||||
.type-audio { background-position: -40px; 0px; }
|
.type-audio { background-position: -40px 0px; }
|
||||||
.type-text { background-position: -60px; 0px; }
|
.type-text { background-position: -60px 0px; }
|
||||||
.type-unkn { background-position: -80px; 0px; }
|
.type-unkn { background-position: -80px 0px; }
|
||||||
|
|
||||||
|
/* autocomplete popup */
|
||||||
|
.acpopup {
|
||||||
|
max-height:150px;
|
||||||
|
background-color:#ffffff;
|
||||||
|
overflow:auto;
|
||||||
|
z-index:100000;
|
||||||
|
border:1px solid #cccccc;
|
||||||
|
}
|
||||||
|
.acpopupitem {
|
||||||
|
background-color:#ffffff; padding: 4px;
|
||||||
|
clear:left;
|
||||||
|
}
|
||||||
|
.acpopupitem img {
|
||||||
|
float: left;
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.acpopupitem.selected {
|
||||||
|
color: #FFFFFF; background: #3465A4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -192,6 +192,29 @@ ul.menu-popup {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* autocomplete popup */
|
||||||
|
.acpopup {
|
||||||
|
max-height:150px;
|
||||||
|
background-color:@MenuBg;
|
||||||
|
color: @Menu;
|
||||||
|
border:1px solid #MenuBorder;
|
||||||
|
overflow:auto;
|
||||||
|
z-index:100000;
|
||||||
|
.shadow();
|
||||||
|
}
|
||||||
|
.acpopupitem {
|
||||||
|
color: @MenuItem; padding: 4px;
|
||||||
|
clear:left;
|
||||||
|
img {
|
||||||
|
float: left;
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
&.selected{
|
||||||
|
background-color: @MenuItemHoverBg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#nav-notifications-menu {
|
#nav-notifications-menu {
|
||||||
width: 400px;
|
width: 400px;
|
||||||
img { float: left; margin-right: 5px; }
|
img { float: left; margin-right: 5px; }
|
||||||
|
|
|
@ -388,6 +388,30 @@ ul.menu-popup .empty {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #9eabb0;
|
color: #9eabb0;
|
||||||
}
|
}
|
||||||
|
/* autocomplete popup */
|
||||||
|
.acpopup {
|
||||||
|
max-height: 150px;
|
||||||
|
background-color: #ffffff;
|
||||||
|
color: #2d2d2d;
|
||||||
|
border: 1px solid #MenuBorder;
|
||||||
|
overflow: auto;
|
||||||
|
z-index: 100000;
|
||||||
|
-webkit-box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.7);
|
||||||
|
-moz-box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.7);
|
||||||
|
box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.7);
|
||||||
|
}
|
||||||
|
.acpopupitem {
|
||||||
|
color: #2d2d2d;
|
||||||
|
padding: 4px;
|
||||||
|
clear: left;
|
||||||
|
}
|
||||||
|
.acpopupitem img {
|
||||||
|
float: left;
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
.acpopupitem.selected {
|
||||||
|
background-color: #bdcdd4;
|
||||||
|
}
|
||||||
#nav-notifications-menu {
|
#nav-notifications-menu {
|
||||||
width: 400px;
|
width: 400px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -823,7 +823,7 @@ profile-jot-banner-wrapper {
|
||||||
/* ======== */
|
/* ======== */
|
||||||
|
|
||||||
.tabs {
|
.tabs {
|
||||||
width: 500px;
|
min-width: 500px;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
margin: 0px 0px 10px 0px;
|
margin: 0px 0px 10px 0px;
|
||||||
|
@ -3086,3 +3086,41 @@ ul.menu-popup {
|
||||||
#jGrowl {
|
#jGrowl {
|
||||||
z-index: 20000;
|
z-index: 20000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* autocomplete popup */
|
||||||
|
.acpopup {
|
||||||
|
max-height:150px;
|
||||||
|
overflow:auto;
|
||||||
|
z-index:100000;
|
||||||
|
|
||||||
|
color: #2e3436;
|
||||||
|
border-top: 0px;
|
||||||
|
background: #eeeeee;
|
||||||
|
border-right: 1px solid #dddddd;
|
||||||
|
border-left: 1px solid #dddddd;
|
||||||
|
border-bottom: 1px solid #dddddd;
|
||||||
|
-webkit-border-radius: 0px 5px 5px 5px;
|
||||||
|
-moz-border-radius: 0px 5px 5px 5px;
|
||||||
|
border-radius: 0px 5px 5px 5px;
|
||||||
|
-moz-box-shadow: 3px 3px 4px #959494;
|
||||||
|
-webkit-box-shadow: 3px 3px 4px #959494;
|
||||||
|
box-shadow: 3px 3px 4px #959494;
|
||||||
|
|
||||||
|
}
|
||||||
|
.acpopupitem {
|
||||||
|
color: #2e3436; padding: 4px;
|
||||||
|
clear:left;
|
||||||
|
}
|
||||||
|
.acpopupitem img {
|
||||||
|
float: left;
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.acpopupitem.selected {
|
||||||
|
color: #efefef;
|
||||||
|
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #b20202), color-stop(1, #d60808) );
|
||||||
|
background:-moz-linear-gradient( center top, #b20202 5%, #d60808 100% );
|
||||||
|
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#b20202', endColorstr='#d60808');
|
||||||
|
background-color:#b20202;
|
||||||
|
order-bottom: none;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue