- Remove tinyMCE mentions or convert to addeditortext()

- Remove $editselect template value
This commit is contained in:
Hypolite Petovan 2017-01-26 22:50:27 -05:00
parent a2740d2034
commit 9d5384f107
19 changed files with 122 additions and 623 deletions

View file

@ -1170,23 +1170,14 @@ function format_like($cnt,$arr,$type,$id) {
function status_editor($a,$x, $notes_cid = 0, $popup=false) {
$o = '';
$geotag = (($x['allow_location']) ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '');
/* $plaintext = false;
if( local_user() && (intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled(local_user(),'richtext')) )
$plaintext = true;*/
$plaintext = true;
if( local_user() && feature_enabled(local_user(),'richtext') )
$plaintext = false;
$tpl = get_markup_template('jot-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array(
'$newpost' => 'true',
'$baseurl' => App::get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$geotag' => $geotag,
'$nickname' => $x['nickname'],
'$ispublic' => t('Visible to <strong>everybody</strong>'),
@ -1199,12 +1190,10 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
'$delitems' => t('Delete item(s)?')
));
$tpl = get_markup_template('jot-end.tpl');
$a->page['end'] .= replace_macros($tpl, array(
'$newpost' => 'true',
'$baseurl' => App::get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$geotag' => $geotag,
'$nickname' => $x['nickname'],
'$ispublic' => t('Visible to <strong>everybody</strong>'),

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

@ -118,9 +118,6 @@
input.val(val);
});
/* setup field_richtext */
setupFieldRichtext();
/* popup menus */
function close_last_popup_menu() {
if(last_popup_menu) {
@ -655,7 +652,6 @@
function preview_post() {
$("#jot-preview").val("1");
$("#jot-preview-content").show();
tinyMCE.triggerSave();
$.post(
"item",
$("#profile-jot-form").serialize(),
@ -767,59 +763,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');

View file

@ -67,10 +67,6 @@ function cal_init(App $a) {
function cal_content(App $a) {
nav_set_selected('events');
$editselect = 'none';
if( feature_enabled(local_user(), 'richtext') )
$editselect = 'textareas';
// First day of the week (0 = Sunday)
$firstDay = get_pconfig(local_user(),'system','first_day_of_week');
if ($firstDay === false) $firstDay=0;
@ -84,13 +80,11 @@ function cal_content(App $a) {
'$module_url' => '/cal/' . $a->data['user']['nickname'],
'$modparams' => 2,
'$i18n' => $i18n,
'$editselect' => $editselect
));
$etpl = get_markup_template('event_end.tpl');
$a->page['end'] .= replace_macros($etpl,array(
'$baseurl' => App::get_baseurl(),
'$editselect' => $editselect
));
$o ="";

View file

@ -489,17 +489,11 @@ function contacts_content(App $a) {
$contact_id = $a->data['contact']['id'];
$contact = $a->data['contact'];
$editselect = 'none';
if( feature_enabled(local_user(),'richtext') )
$editselect = 'exact';
$a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), array(
'$baseurl' => App::get_baseurl(true),
'$editselect' => $editselect,
));
$a->page['end'] .= replace_macros(get_markup_template('contact_end.tpl'), array(
'$baseurl' => App::get_baseurl(true),
'$editselect' => $editselect,
));
require_once('include/contact_selectors.php');

View file

@ -28,14 +28,6 @@ function editpost_content(App $a) {
return;
}
/* $plaintext = false;
if( local_user() && intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled(local_user(),'richtext') )
$plaintext = true;*/
$plaintext = true;
if( local_user() && feature_enabled(local_user(),'richtext') )
$plaintext = false;
$o .= replace_macros(get_markup_template("section_title.tpl"),array(
'$title' => t('Edit post')
));
@ -43,7 +35,6 @@ function editpost_content(App $a) {
$tpl = get_markup_template('jot-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
'$geotag' => $geotag,
'$nickname' => $a->user['nickname']
@ -52,7 +43,6 @@ function editpost_content(App $a) {
$tpl = get_markup_template('jot-end.tpl');
$a->page['end'] .= replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
'$geotag' => $geotag,
'$nickname' => $a->user['nickname']

View file

@ -220,11 +220,6 @@ function events_content(App $a) {
nav_set_selected('events');
}
$editselect = 'none';
if ( feature_enabled(local_user(), 'richtext') ) {
$editselect = 'textareas';
}
// get the translation strings for the callendar
$i18n = get_event_strings();
@ -234,13 +229,11 @@ function events_content(App $a) {
'$module_url' => '/events',
'$modparams' => 1,
'$i18n' => $i18n,
'$editselect' => $editselect
));
$etpl = get_markup_template('event_end.tpl');
$a->page['end'] .= replace_macros($etpl,array(
'$baseurl' => App::get_baseurl(),
'$editselect' => $editselect
));
$o ="";

View file

@ -275,18 +275,9 @@ function message_content(App $a) {
$o .= $header;
/* $plaintext = false;
if(intval(get_pconfig(local_user(),'system','plaintext')))
$plaintext = true;*/
$plaintext = true;
if( local_user() && feature_enabled(local_user(),'richtext') )
$plaintext = false;
$tpl = get_markup_template('msg-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:')
));
@ -294,7 +285,6 @@ function message_content(App $a) {
$tpl = get_markup_template('msg-end.tpl');
$a->page['end'] .= replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:')
));
@ -397,10 +387,6 @@ function message_content(App $a) {
$o .= $header;
$plaintext = true;
if( local_user() && feature_enabled(local_user(),'richtext') )
$plaintext = false;
$r = q("SELECT `mail`.*, `contact`.`name`, `contact`.`url`, `contact`.`thumb`
FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id`
WHERE `mail`.`uid` = %d AND `mail`.`id` = %d LIMIT 1",
@ -439,7 +425,6 @@ function message_content(App $a) {
$tpl = get_markup_template('msg-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:')
));
@ -447,12 +432,10 @@ function message_content(App $a) {
$tpl = get_markup_template('msg-end.tpl');
$a->page['end'] .= replace_macros($tpl, array(
'$baseurl' => App::get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$nickname' => $a->user['nickname'],
'$linkurl' => t('Please enter a link URL:')
));
$mails = array();
$seen = 0;
$unknown = false;

View file

@ -623,23 +623,13 @@ function profiles_content(App $a) {
require_once('include/profile_selectors.php');
/* $editselect = 'textareas';
if( intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled(local_user(),'richtext') )
$editselect = 'none';*/
$editselect = 'none';
if( feature_enabled(local_user(),'richtext') )
$editselect = 'textareas';
$a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array(
'$baseurl' => App::get_baseurl(true),
'$editselect' => $editselect,
));
$a->page['end'] .= replace_macros(get_markup_template('profed_end.tpl'), array(
'$baseurl' => App::get_baseurl(true),
'$editselect' => $editselect,
));
$opt_tpl = get_markup_template("profile-hide-friends.tpl");
$hide_friends = replace_macros($opt_tpl,array(
'$yesno' => array(

View file

@ -113,16 +113,9 @@ function wallmessage_content(App $a) {
return;
}
$editselect = 'none';
if( feature_enabled(local_user(), 'richtext') )
$editselect = '/(profile-jot-text|prvmail-text)/';
$tpl = get_markup_template('wallmsg-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(true),
'$editselect' => $editselect,
'$nickname' => $user['nickname'],
'$linkurl' => t('Please enter a link URL:')
));
@ -130,13 +123,10 @@ function wallmessage_content(App $a) {
$tpl = get_markup_template('wallmsg-end.tpl');
$a->page['end'] .= replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(true),
'$editselect' => $editselect,
'$nickname' => $user['nickname'],
'$linkurl' => t('Please enter a link URL:')
));
$tpl = get_markup_template('wallmessage.tpl');
$o .= replace_macros($tpl,array(
'$header' => t('Send Private Message'),

View file

@ -1,32 +0,0 @@
<script language="javascript" type="text/javascript"
src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
theme : "advanced",
mode : "{{$editselect}}",
elements: "contact-edit-info",
plugins : "bbcode",
theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "center",
theme_advanced_styles : "blockquote,code",
theme_advanced_resizing : true,
gecko_spellcheck : true,
entity_encoding : "raw",
add_unload_trigger : false,
remove_linebreaks : false,
//force_p_newlines : false,
//force_br_newlines : true,
forced_root_block : 'div',
content_css: "{{$baseurl}}/view/custom_tinymce.css"
});
</script>

View file

@ -156,49 +156,10 @@
});
</script>
{{if $editselect != 'none'}}
<script language="javascript" type="text/javascript"
src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
theme : "advanced",
mode : "textareas",
plugins : "bbcode,paste",
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,
gecko_spellcheck : true,
paste_text_sticky : true,
entity_encoding : "raw",
add_unload_trigger : false,
remove_linebreaks : false,
forced_root_block : 'div',
content_css: "{{$baseurl}}/view/custom_tinymce.css",
theme_advanced_path : false,
setup : function(ed) {
ed.onInit.add(function(ed) {
ed.pasteAsPlainText = true;
});
}
});
$(document).ready(function() {
$('.comment-edit-bb').hide();
});
{{else}}
<script language="javascript" type="text/javascript">
{{/if}}
$(document).ready(function() {
{{if $editselect = 'none'}}
$("#comment-edit-text-desc").bbco_autocomplete('bbcode');
{{/if}}
$('#id_share').change(function() {

View file

@ -42,7 +42,6 @@
<script type="text/javascript" src="library/colorbox/jquery.colorbox-min.js"></script>
<script type="text/javascript" src="library/jgrowl/jquery.jgrowl_minimized.js"></script>
<script type="text/javascript" src="library/datetimepicker/jquery.datetimepicker.js"></script>
<script type="text/javascript" src="library/tinymce/jscripts/tiny_mce/tiny_mce_src.js" ></script>
<script type="text/javascript" src="library/perfect-scrollbar/perfect-scrollbar.jquery.min.js" ></script>
<script type="text/javascript" src="js/acl.js" ></script>
<script type="text/javascript" src="js/webtoolkit.base64.js" ></script>

View file

@ -2,12 +2,11 @@
<script language="javascript" type="text/javascript">
var editor=false;
var editor = false;
var textlen = 0;
var plaintext = '{{$editselect}}';
function initEditor(cb){
if (editor==false){
function initEditor(callback) {
if (editor == false) {
var colorbox_options = {
{{if $APP->is_mobile}}
'width' : '100%',
@ -16,115 +15,27 @@ function initEditor(cb){
'inline' : true,
'transition' : 'elastic'
}
$("#profile-jot-text-loading").show();
if(plaintext == 'none') {
$("#profile-jot-text-loading").hide();
$("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
$("#profile-jot-text").editor_autocomplete(baseurl+"/acl");
$("#profile-jot-text").bbco_autocomplete('bbcode');
editor = true;
$("a#jot-perms-icon").colorbox(colorbox_options);
$(".jothidden").show();
if (typeof cb!="undefined") cb();
return;
}
tinyMCE.init({
theme : "advanced",
mode : "specific_textareas",
editor_selector: {{$editselect}},
auto_focus: "profile-jot-text",
plugins : "bbcode,paste,autoresize, 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,
gecko_spellcheck : 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",
setup : function(ed) {
cPopup = null;
ed.onKeyDown.add(function(ed,e) {
if(cPopup !== null)
cPopup.onkey(e);
});
ed.onKeyUp.add(function(ed, e) {
var txt = tinyMCE.activeEditor.getContent();
match = txt.match(/@([^ \n]+)$/);
if(match!==null) {
if(cPopup === null) {
cPopup = new ACPopup(this,baseurl+"/acl");
}
if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
if(! cPopup.ready) cPopup = null;
}
else {
if(cPopup !== null) { cPopup.close(); cPopup = null; }
}
textlen = txt.length;
if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
$('#profile-jot-desc').html(ispublic);
}
else {
$('#profile-jot-desc').html('&nbsp;');
}
//Character count
if(textlen <= 140) {
$('#character-counter').removeClass('red');
$('#character-counter').removeClass('orange');
$('#character-counter').addClass('grey');
}
if((textlen > 140) && (textlen <= 420)) {
$('#character-counter').removeClass('grey');
$('#character-counter').removeClass('red');
$('#character-counter').addClass('orange');
}
if(textlen > 420) {
$('#character-counter').removeClass('grey');
$('#character-counter').removeClass('orange');
$('#character-counter').addClass('red');
}
$('#character-counter').text(textlen);
});
ed.onInit.add(function(ed) {
ed.pasteAsPlainText = true;
$("#profile-jot-text-loading").hide();
$(".jothidden").show();
if (typeof cb!="undefined") cb();
});
}
});
editor = true;
// setup acl popup
$("#profile-jot-text-loading").hide();
$("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
$("#profile-jot-text").editor_autocomplete(baseurl+"/acl");
$("#profile-jot-text").bbco_autocomplete('bbcode');
$("a#jot-perms-icon").colorbox(colorbox_options);
} else {
if (typeof cb!="undefined") cb();
$(".jothidden").show();
editor = true;
}
if (typeof callback != "undefined") {
callback();
}
}
function enableOnUser(){
if (editor) return;
$(this).val("");
if (editor) {
return;
}
$(this).val('');
initEditor();
}
@ -136,13 +47,10 @@ function enableOnUser(){
$(document).ready(function() {
/* enable tinymce on focus and click */
/* enable editor on focus and click */
$("#profile-jot-text").focus(enableOnUser);
$("#profile-jot-text").click(enableOnUser);
/* show images / file browser window
*
**/
@ -164,33 +72,6 @@ function enableOnUser(){
$('#wall-file-upload').on('click', function(){
Dialog.doFileBrowser("main");
});
/**
var uploader = new window.AjaxUpload(
'wall-image-upload',
{ action: 'wall_upload/{{$nickname}}',
name: 'userfile',
onSubmit: function(file,ext) { $('#profile-rotator').show(); },
onComplete: function(file,response) {
addeditortext(response);
$('#profile-rotator').hide();
}
}
);
var file_uploader = new window.AjaxUpload(
'wall-file-upload',
{ action: 'wall_attach/{{$nickname}}',
name: 'userfile',
onSubmit: function(file,ext) { $('#profile-rotator').show(); },
onComplete: function(file,response) {
addeditortext(response);
$('#profile-rotator').hide();
}
}
);
}
**/
});
@ -345,12 +226,8 @@ function enableOnUser(){
}
function addeditortext(data) {
if(plaintext == 'none') {
var currentText = $("#profile-jot-text").val();
$("#profile-jot-text").val(currentText + data);
}
else
tinyMCE.execCommand('mceInsertRawHTML',false,data);
var currentText = $("#profile-jot-text").val();
$("#profile-jot-text").val(currentText + data);
}
{{$geotag}}

View file

@ -1,52 +1,5 @@
<script language="javascript" type="text/javascript" src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
<script language="javascript" type="text/javascript">
var plaintext = '{{$editselect}}';
if(plaintext != 'none') {
tinyMCE.init({
theme : "advanced",
mode : "specific_textareas",
editor_selector: /(profile-jot-text|prvmail-text)/,
plugins : "bbcode,paste",
theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
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,
gecko_spellcheck : 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",
//Character count
theme_advanced_path : false,
setup : function(ed) {
ed.onInit.add(function(ed) {
ed.pasteAsPlainText = true;
var editorId = ed.editorId;
var textarea = $('#'+editorId);
if (typeof(textarea.attr('tabindex')) != "undefined") {
$('#'+editorId+'_ifr').attr('tabindex', textarea.attr('tabindex'));
textarea.attr('tabindex', null);
}
});
}
});
}
else
$("#prvmail-text").editor_autocomplete(baseurl+"/acl");
$("#prvmail-text").editor_autocomplete(baseurl + '/acl');
</script>
<script type="text/javascript" src="js/ajaxupload.js" ></script>
<script>
@ -57,17 +10,13 @@ else
name: 'userfile',
onSubmit: function(file,ext) { $('#profile-rotator').show(); },
onComplete: function(file,response) {
tinyMCE.execCommand('mceInsertRawHTML',false,response);
addeditortext(response);
$('#profile-rotator').hide();
}
}
}
);
{{if $editselect = 'none'}}
$("#prvmail-text").bbco_autocomplete('bbcode');
{{/if}}
});
function jotGetLink() {
@ -75,7 +24,7 @@ else
if(reply && reply.length) {
$('#profile-rotator').show();
$.get('parse_url?url=' + reply, function(data) {
tinyMCE.execCommand('mceInsertRawHTML',false,data);
addeditortext(data);
$('#profile-rotator').hide();
});
}
@ -94,7 +43,7 @@ else
if(reply && reply.length) {
$('#profile-rotator').show();
$.get('parse_url?url=' + reply, function(data) {
tinyMCE.execCommand('mceInsertRawHTML',false,data);
addeditortext(data);
$('#profile-rotator').hide();
});
}

View file

@ -1,40 +1 @@
<script type="text/javascript" src="js/country.js" ></script>
<script language="javascript" type="text/javascript"
src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
theme : "advanced",
mode : "{{$editselect}}",
plugins : "bbcode,paste",
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,
gecko_spellcheck : 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',
content_css: "{{$baseurl}}/view/custom_tinymce.css",
theme_advanced_path : false,
setup : function(ed) {
ed.onInit.add(function(ed) {
ed.pasteAsPlainText = true;
});
}
});
</script>
<script type="text/javascript" src="js/country.js" ></script>

View file

@ -1,52 +1,5 @@
<script language="javascript" type="text/javascript" src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
<script language="javascript" type="text/javascript">
var plaintext = '{{$editselect}}';
if(plaintext != 'none') {
tinyMCE.init({
theme : "advanced",
mode : "specific_textareas",
editor_selector: /(profile-jot-text|prvmail-text)/,
plugins : "bbcode,paste",
theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
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,
gecko_spellcheck : 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",
//Character count
theme_advanced_path : false,
setup : function(ed) {
ed.onInit.add(function(ed) {
ed.pasteAsPlainText = true;
var editorId = ed.editorId;
var textarea = $('#'+editorId);
if (typeof(textarea.attr('tabindex')) != "undefined") {
$('#'+editorId+'_ifr').attr('tabindex', textarea.attr('tabindex'));
textarea.attr('tabindex', null);
}
});
}
});
}
else
$("#prvmail-text").editor_autocomplete(baseurl+"/acl");
</script>
<script>
@ -55,7 +8,7 @@ else
if(reply && reply.length) {
$('#profile-rotator').show();
$.get('parse_url?url=' + reply, function(data) {
tinyMCE.execCommand('mceInsertRawHTML',false,data);
addeditortext(data);
$('#profile-rotator').hide();
});
}
@ -74,7 +27,7 @@ else
if(reply && reply.length) {
$('#profile-rotator').show();
$.get('parse_url?url=' + reply, function(data) {
tinyMCE.execCommand('mceInsertRawHTML',false,data);
addeditortext(data);
$('#profile-rotator').hide();
});
}

View file

@ -66,7 +66,6 @@
<script type="text/javascript" src="library/colorbox/jquery.colorbox-min.js"></script>
<script type="text/javascript" src="library/jgrowl/jquery.jgrowl_minimized.js"></script>
<script type="text/javascript" src="library/datetimepicker/jquery.datetimepicker.js"></script>
<script type="text/javascript" src="library/tinymce/jscripts/tiny_mce/tiny_mce_src.js" ></script>
<script type="text/javascript" src="library/perfect-scrollbar/perfect-scrollbar.jquery.min.js" ></script>
<script type="text/javascript" src="js/acl.js" ></script>
<script type="text/javascript" src="js/webtoolkit.base64.js" ></script>