Merge branch 'develop' into issue/#3062

* develop: (68 commits)
  Added documentation
  update to the translation
  update to the translations
  translation docs now contain basic usage of the Transifex client
  - Replace TinyMCE-enabled filebrowser.tpl by filebrowser_plain.tpl content
  - Remove misc TinyMCE mentions in docs and minifyjs
  - Remove $theme_richtext_editor boot var - Remove "richtext" feature - Remove fix_mce_lf() function - Remove nomce parameter
  - Remove TinyMCE mentions in themes
  - Remove tinyMCE mentions or convert to addeditortext() - Remove $editselect template value
  Remove tinyMCE libraries
  limit the description of the meta tag to 160 characters in /mod/display
  Improved handling of non string values in the config
  Bugfix: Caching of non string cache values now works.
  Reformatted stuff, improved query
  Auto-focus first input field of modal when shown
  Use cache instead of config for storing last proc_run time
  Some added logging
  Bugfix for masses of php warnings
  Rearranged the logging
  Some changed logging
  ...

# Conflicts:
#	view/theme/frost-mobile/js/theme.js
#	view/theme/frost/js/theme.js
This commit is contained in:
Hypolite Petovan 2017-01-27 15:30:21 -05:00
commit c38a5e443d
438 changed files with 108865 additions and 144355 deletions

117
js/acl.js
View file

@ -1,12 +1,12 @@
function ACL(backend_url, preset, automention, is_mobile){
this.url = backend_url;
this.automention = automention;
this.is_mobile = is_mobile;
this.kp_timer = null;
if (preset==undefined) preset = [];
this.allow_cid = (preset[0] || []);
this.allow_gid = (preset[1] || []);
@ -19,74 +19,69 @@ function ACL(backend_url, preset, automention, is_mobile){
} else {
this.nw = 4;
}
this.list_content = $("#acl-list-content");
this.item_tpl = unescape($(".acl-list-item[rel=acl-template]").html());
this.showall = $("#acl-showall");
if (preset.length==0) this.showall.addClass("selected");
/*events*/
this.showall.click(this.on_showall.bind(this));
$(document).on("click", ".acl-button-show", this.on_button_show.bind(this));
$(document).on("click", ".acl-button-hide", this.on_button_hide.bind(this));
$("#acl-search").keypress(this.on_search.bind(this));
$("#acl-wrapper").parents("form").submit(this.on_submit.bind(this));
/* add/remove mentions */
this.element = $("#profile-jot-text");
this.htmlelm = this.element.get()[0];
/* startup! */
this.get(0,100);
}
ACL.prototype.remove_mention = function(id) {
if (!this.automention) return;
var nick = this.data[id].nick;
var searchText = "@"+nick+"+"+id+" ";
if (tinyMCE.activeEditor===null) {
start = this.element.val().indexOf(searchText);
if ( start<0) return;
end = start+searchText.length;
this.element.setSelection(start,end).replaceSelectedText('').collapseSelection(false);
} else {
start = tinyMCE.activeEditor.getContent({format : 'raw'}).search( searchText );
if ( start<0 ) return;
txt = tinyMCE.activeEditor.getContent();
newtxt = txt.replace(searchText, '');
tinyMCE.activeEditor.setContent(newtxt);
if (!this.automention) {
return;
}
var nick = this.data[id].nick;
var searchText = "@" + nick + "+" + id + " ";
var start = this.element.val().indexOf(searchText);
if (start < 0) {
return;
}
var end = start + searchText.length;
this.element.setSelection(start, end).replaceSelectedText('').collapseSelection(false);
}
ACL.prototype.add_mention = function(id) {
if (!this.automention) return;
var nick = this.data[id].nick;
var searchText = "@"+nick+"+"+id+" ";
if (tinyMCE.activeEditor===null) {
if ( this.element.val().indexOf( searchText) >= 0 ) return;
this.element.val( searchText + this.element.val() );
} else {
if ( tinyMCE.activeEditor.getContent({format : 'raw'}).search(searchText) >= 0 ) return;
tinyMCE.activeEditor.dom.add(tinyMCE.activeEditor.getBody(), 'dummy', {}, searchText);
if (!this.automention) {
return;
}
var nick = this.data[id].nick;
var searchText = "@" + nick + "+" + id + " ";
if (this.element.val().indexOf( searchText) >= 0 ) {
return;
}
this.element.val(searchText + this.element.val());
}
ACL.prototype.on_submit = function(){
aclfileds = $("#acl-fields").html("");
var aclfields = $("#acl-fields").html("");
$(this.allow_gid).each(function(i,v){
aclfileds.append("<input type='hidden' name='group_allow[]' value='"+v+"'>");
aclfields.append("<input type='hidden' name='group_allow[]' value='"+v+"'>");
});
$(this.allow_cid).each(function(i,v){
aclfileds.append("<input type='hidden' name='contact_allow[]' value='"+v+"'>");
aclfields.append("<input type='hidden' name='contact_allow[]' value='"+v+"'>");
});
$(this.deny_gid).each(function(i,v){
aclfileds.append("<input type='hidden' name='group_deny[]' value='"+v+"'>");
aclfields.append("<input type='hidden' name='group_deny[]' value='"+v+"'>");
});
$(this.deny_cid).each(function(i,v){
aclfileds.append("<input type='hidden' name='contact_deny[]' value='"+v+"'>");
});
aclfields.append("<input type='hidden' name='contact_deny[]' value='"+v+"'>");
});
}
ACL.prototype.search = function(){
@ -103,19 +98,19 @@ ACL.prototype.on_search = function(event){
ACL.prototype.on_showall = function(event){
event.preventDefault()
event.stopPropagation();
if (this.showall.hasClass("selected")){
return false;
}
this.showall.addClass("selected");
this.allow_cid = [];
this.allow_gid = [];
this.deny_cid = [];
this.deny_gid = [];
this.update_view();
return false;
}
@ -123,7 +118,7 @@ ACL.prototype.on_button_show = function(event){
event.preventDefault()
event.stopImmediatePropagation()
event.stopPropagation();
this.set_allow($(event.target).parent().attr('id'));
return false;
@ -141,7 +136,7 @@ ACL.prototype.on_button_hide = function(event){
ACL.prototype.set_allow = function(itemid){
type = itemid[0];
id = parseInt(itemid.substr(1));
switch(type){
case "g":
if (this.allow_gid.indexOf(id)<0){
@ -159,7 +154,7 @@ ACL.prototype.set_allow = function(itemid){
this.allow_cid.remove(id);
if (this.data[id].forum=="1") this.remove_mention(id);
}
if (this.deny_cid.indexOf(id)>=0) this.deny_cid.remove(id);
if (this.deny_cid.indexOf(id)>=0) this.deny_cid.remove(id);
break;
}
this.update_view();
@ -168,7 +163,7 @@ ACL.prototype.set_allow = function(itemid){
ACL.prototype.set_deny = function(itemid){
type = itemid[0];
id = parseInt(itemid.substr(1));
switch(type){
case "g":
if (this.deny_gid.indexOf(id)<0){
@ -202,31 +197,31 @@ ACL.prototype.update_view = function(){
/* jot acl */
$('#jot-perms-icon').removeClass('lock').addClass('unlock');
$('#jot-public').show();
$('.profile-jot-net input').attr('disabled', false);
$('.profile-jot-net input').attr('disabled', false);
if(typeof editor != 'undefined' && editor != false) {
$('#profile-jot-desc').html(ispublic);
}
} else {
this.showall.removeClass("selected");
/* jot acl */
$('#jot-perms-icon').removeClass('unlock').addClass('lock');
$('#jot-public').hide();
$('.profile-jot-net input').attr('disabled', 'disabled');
$('.profile-jot-net input').attr('disabled', 'disabled');
$('#profile-jot-desc').html('&nbsp;');
}
$("#acl-list-content .acl-list-item").each(function(){
$(this).removeClass("groupshow grouphide");
});
$("#acl-list-content .acl-list-item").each(function(index, element){
itemid = $(element).attr('id');
type = itemid[0];
id = parseInt(itemid.substr(1));
btshow = $(element).children(".acl-button-show").removeClass("selected");
bthide = $(element).children(".acl-button-hide").removeClass("selected");
bthide = $(element).children(".acl-button-hide").removeClass("selected");
switch(type){
case "g":
var uclass = "";
@ -240,7 +235,7 @@ ACL.prototype.update_view = function(){
bthide.addClass("selected");
uclass="grouphide";
}
$(this.group_uids[id]).each(function(i,v) {
if(uclass == "grouphide")
$("#c"+v).removeClass("groupshow");
@ -253,7 +248,7 @@ ACL.prototype.update_view = function(){
$("#c"+v).addClass(uclass);
}
});
break;
case "c":
if (this.allow_cid.indexOf(id)>=0){
@ -263,11 +258,11 @@ ACL.prototype.update_view = function(){
if (this.deny_cid.indexOf(id)>=0){
btshow.removeClass("selected");
bthide.addClass("selected");
}
}
}
}.bind(this));
}
@ -277,7 +272,7 @@ ACL.prototype.get = function(start,count, search){
count:count,
search:search,
}
$.ajax({
type:'POST',
url: this.url,
@ -295,7 +290,7 @@ ACL.prototype.populate = function(data){
html = "<div class='acl-list-item {4} {5} type{2}' title='{6}' id='{2}{3}'>"+this.item_tpl+"</div>";
html = html.format(item.photo, item.name, item.type, item.id, (item.forum=='1'?'forum':''), item.network, item.link);
if (item.uids!=undefined) this.group_uids[item.id] = item.uids;
this.list_content.append(html);
this.data[item.id] = item;
}.bind(this));
@ -303,7 +298,7 @@ ACL.prototype.populate = function(data){
// Add src attribute for images with a data-src attribute
$(el).attr('src', $(el).data("src"));
});
this.update_view();
}

View file

@ -2,10 +2,10 @@
* @brief Friendica people autocomplete
*
* require jQuery, jquery.textcomplete
*
*
* for further documentation look at:
* http://yuku-t.com/jquery-textcomplete/
*
*
* https://github.com/yuku-t/jquery-textcomplete/blob/master/doc/how_to_use.md
*/
@ -91,7 +91,7 @@ function editor_replace(item) {
// 16 chars of hash should be enough. Full hash could be used if it can be done in a visually appealing way.
// 16 chars is also the minimum length in the backend (otherwise it's interpreted as a local id).
if(id.length > 16)
if(id.length > 16)
id = item.id.substring(0,16);
return '$1$2' + item.nick.replace(' ', '') + '+' + id + ' ';
@ -347,61 +347,38 @@ function string2bb(element) {
})( jQuery );
/**
* Friendica people autocomplete legacy
* code which is needed for tinymce
* Friendica people autocomplete legacy code
*
* require jQuery, jquery.textareas
*/
function ACPopup(elm,backend_url){
this.idsel=-1;
function ACPopup(elm, backend_url){
this.idsel = -1;
this.element = elm;
this.searchText="";
this.ready=true;
this.searchText = '';
this.ready = true;
this.kp_timer = false;
this.url = backend_url;
this.conversation_id = null;
var conv_id = this.element.id.match(/\d+$/);
if (conv_id) this.conversation_id = conv_id[0];
console.log("ACPopup elm id",this.element.id,"conversation",this.conversation_id);
var w = 530;
var h = 130;
if(tinyMCE.activeEditor == null) {
style = $(elm).offset();
w = $(elm).width();
h = $(elm).height();
}
else {
// I can't find an "official" way to get the element who get all
// this fraking thing that is tinyMCE.
// This code will broke again at some point...
var container = $(tinyMCE.activeEditor.getContainer()).find("table");
style = $(container).offset();
w = $(container).width();
h = $(container).height();
if (conv_id) {
this.conversation_id = conv_id[0];
}
style.top=style.top+h;
var w = $(elm).width();
var h = $(elm).height();
var style = $(elm).offset();
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-mce'></div>");
this.cont = $('<div class="acpopup-mce"></div>');
this.cont.css(style);
$("body").append(this.cont);
}
$('body').append(this.cont);
}
ACPopup.prototype.close = function(){
$(this.cont).remove();
@ -449,48 +426,42 @@ ACPopup.prototype._search = function(){
}
ACPopup.prototype.add = function(label, value){
var that=this;
var elm = $("<div class='acpopupitem' title='"+value+"'>"+label+"</div>");
var that = this;
var elm = $('<div class="acpopupitem" title="' + value + '">' + label + '</div>');
elm.click(function(e){
t = $(this).attr('title').replace(new RegExp(' \- .*'),'');
if(typeof(that.element.container) === "undefined") {
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();
}
else {
txt = tinyMCE.activeEditor.getContent();
// alert(that.searchText + ':' + t);
newtxt = txt.replace('@' + that.searchText,'@' + t +' ');
tinyMCE.activeEditor.setContent(newtxt);
tinyMCE.activeEditor.focus();
that.close();
}
t = $(this).attr('title').replace(new RegExp(' \- .*'), '');
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') {
if(this.idsel>-1) {
if(this.idsel > -1) {
this.cont.children()[this.idsel].click();
event.preventDefault();
}
else
} else {
this.close();
}
}
if (event.keyCode == '38') { //cursor up
cmax = this.cont.children().size()-1;
var cmax = this.cont.children().size() - 1;
this.idsel--;
if (this.idsel<0) this.idsel=cmax;
if (this.idsel < 0) {
this.idsel = cmax;
}
event.preventDefault();
}
if (event.keyCode == '40' || event.keyCode == '9') { //cursor down
cmax = this.cont.children().size()-1;
var cmax = this.cont.children().size() - 1;
this.idsel++;
if (this.idsel>cmax) this.idsel=0;
if (this.idsel > cmax) {
this.idsel = 0;
}
event.preventDefault();
}

View file

@ -122,9 +122,6 @@
input.val(val);
});
/* setup field_richtext */
setupFieldRichtext();
/* popup menus */
function close_last_popup_menu() {
if(last_popup_menu) {
@ -659,7 +656,6 @@
function preview_post() {
$("#jot-preview").val("1");
$("#jot-preview-content").show();
tinyMCE.triggerSave();
$.post(
"item",
$("#profile-jot-form").serialize(),
@ -771,59 +767,6 @@ function notifyMarkAll() {
});
}
// code from http://www.tinymce.com/wiki.php/How-to_implement_a_custom_file_browser
function fcFileBrowser (field_name, url, type, win) {
/* TODO: If you work with sessions in PHP and your client doesn't accept cookies you might need to carry
the session name and session ID in the request string (can look like this: "?PHPSESSID=88p0n70s9dsknra96qhuk6etm5").
These lines of code extract the necessary parameters and add them back to the filebrowser URL again. */
var cmsURL = baseurl+"/fbrowser/"+type+"/";
tinyMCE.activeEditor.windowManager.open({
file : cmsURL,
title : 'File Browser',
width : 420, // Your dimensions may differ - toy around with them!
height : 400,
resizable : "yes",
inline : "yes", // This parameter only has an effect if you use the inlinepopups plugin!
close_previous : "no"
}, {
window : win,
input : field_name
});
return false;
}
function setupFieldRichtext(){
tinyMCE.init({
theme : "advanced",
mode : "specific_textareas",
editor_selector: "fieldRichtext",
plugins : "bbcode,paste, inlinepopups",
theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "center",
theme_advanced_blockformats : "blockquote,code",
theme_advanced_resizing : true,
paste_text_sticky : true,
entity_encoding : "raw",
add_unload_trigger : false,
remove_linebreaks : false,
//force_p_newlines : false,
//force_br_newlines : true,
forced_root_block : 'div',
convert_urls: false,
content_css: baseurl+"/view/custom_tinymce.css",
theme_advanced_path : false,
file_browser_callback : "fcFileBrowser",
});
}
/**
* sprintf in javascript
* "{0} and {1}".format('zero','uno');