- 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) { function status_editor($a,$x, $notes_cid = 0, $popup=false) {
$o = ''; $o = '';
$geotag = (($x['allow_location']) ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : ''); $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'); $tpl = get_markup_template('jot-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array( $a->page['htmlhead'] .= replace_macros($tpl, array(
'$newpost' => 'true', '$newpost' => 'true',
'$baseurl' => App::get_baseurl(true), '$baseurl' => App::get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$geotag' => $geotag, '$geotag' => $geotag,
'$nickname' => $x['nickname'], '$nickname' => $x['nickname'],
'$ispublic' => t('Visible to <strong>everybody</strong>'), '$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)?') '$delitems' => t('Delete item(s)?')
)); ));
$tpl = get_markup_template('jot-end.tpl'); $tpl = get_markup_template('jot-end.tpl');
$a->page['end'] .= replace_macros($tpl, array( $a->page['end'] .= replace_macros($tpl, array(
'$newpost' => 'true', '$newpost' => 'true',
'$baseurl' => App::get_baseurl(true), '$baseurl' => App::get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$geotag' => $geotag, '$geotag' => $geotag,
'$nickname' => $x['nickname'], '$nickname' => $x['nickname'],
'$ispublic' => t('Visible to <strong>everybody</strong>'), '$ispublic' => t('Visible to <strong>everybody</strong>'),

View file

@ -43,49 +43,44 @@ function ACL(backend_url, preset, automention, is_mobile){
} }
ACL.prototype.remove_mention = function(id) { ACL.prototype.remove_mention = function(id) {
if (!this.automention) return; if (!this.automention) {
var nick = this.data[id].nick; return;
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);
} }
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) { ACL.prototype.add_mention = function(id) {
if (!this.automention) return; if (!this.automention) {
var nick = this.data[id].nick; return;
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);
} }
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(){ ACL.prototype.on_submit = function(){
aclfileds = $("#acl-fields").html(""); var aclfields = $("#acl-fields").html("");
$(this.allow_gid).each(function(i,v){ $(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){ $(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){ $(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){ $(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+"'>");
}); });
} }

View file

@ -347,61 +347,38 @@ function string2bb(element) {
})( jQuery ); })( jQuery );
/** /**
* Friendica people autocomplete legacy * Friendica people autocomplete legacy code
* code which is needed for tinymce
* *
* require jQuery, jquery.textareas * require jQuery, jquery.textareas
*/ */
function ACPopup(elm, backend_url){
function ACPopup(elm,backend_url){ this.idsel = -1;
this.idsel=-1;
this.element = elm; this.element = elm;
this.searchText=""; this.searchText = '';
this.ready=true; this.ready = true;
this.kp_timer = false; this.kp_timer = false;
this.url = backend_url; this.url = backend_url;
this.conversation_id = null; this.conversation_id = null;
var conv_id = this.element.id.match(/\d+$/); var conv_id = this.element.id.match(/\d+$/);
if (conv_id) this.conversation_id = conv_id[0]; if (conv_id) {
console.log("ACPopup elm id",this.element.id,"conversation",this.conversation_id); this.conversation_id = conv_id[0];
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();
} }
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.width = w;
style.position = 'absolute'; 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'; style.display = 'none';
this.cont = $("<div class='acpopup-mce'></div>"); this.cont = $('<div class="acpopup-mce"></div>');
this.cont.css(style); this.cont.css(style);
$("body").append(this.cont); $('body').append(this.cont);
} }
ACPopup.prototype.close = function(){ ACPopup.prototype.close = function(){
$(this.cont).remove(); $(this.cont).remove();
@ -449,48 +426,42 @@ ACPopup.prototype._search = function(){
} }
ACPopup.prototype.add = function(label, value){ ACPopup.prototype.add = function(label, value){
var that=this; var that = this;
var elm = $("<div class='acpopupitem' title='"+value+"'>"+label+"</div>"); var elm = $('<div class="acpopupitem" title="' + value + '">' + label + '</div>');
elm.click(function(e){ elm.click(function(e){
t = $(this).attr('title').replace(new RegExp(' \- .*'),''); t = $(this).attr('title').replace(new RegExp(' \- .*'), '');
if(typeof(that.element.container) === "undefined") { el = $(that.element);
el=$(that.element);
sel = el.getSelection(); sel = el.getSelection();
sel.start = sel.start- that.searchText.length; sel.start = sel.start - that.searchText.length;
el.setSelection(sel.start,sel.end).replaceSelectedText(t+' ').collapseSelection(false); el.setSelection(sel.start, sel.end).replaceSelectedText(t + ' ').collapseSelection(false);
that.close(); 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();
}
}); });
$(this.cont).append(elm); $(this.cont).append(elm);
} }
ACPopup.prototype.onkey = function(event){ ACPopup.prototype.onkey = function(event){
if (event.keyCode == '13') { if (event.keyCode == '13') {
if(this.idsel>-1) { if(this.idsel > -1) {
this.cont.children()[this.idsel].click(); this.cont.children()[this.idsel].click();
event.preventDefault(); event.preventDefault();
} } else {
else
this.close(); this.close();
} }
}
if (event.keyCode == '38') { //cursor up if (event.keyCode == '38') { //cursor up
cmax = this.cont.children().size()-1; var cmax = this.cont.children().size() - 1;
this.idsel--; this.idsel--;
if (this.idsel<0) this.idsel=cmax; if (this.idsel < 0) {
this.idsel = cmax;
}
event.preventDefault(); event.preventDefault();
} }
if (event.keyCode == '40' || event.keyCode == '9') { //cursor down if (event.keyCode == '40' || event.keyCode == '9') { //cursor down
cmax = this.cont.children().size()-1; var cmax = this.cont.children().size() - 1;
this.idsel++; this.idsel++;
if (this.idsel>cmax) this.idsel=0; if (this.idsel > cmax) {
this.idsel = 0;
}
event.preventDefault(); event.preventDefault();
} }

View file

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

View file

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

View file

@ -489,17 +489,11 @@ function contacts_content(App $a) {
$contact_id = $a->data['contact']['id']; $contact_id = $a->data['contact']['id'];
$contact = $a->data['contact']; $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( $a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), array(
'$baseurl' => App::get_baseurl(true), '$baseurl' => App::get_baseurl(true),
'$editselect' => $editselect,
)); ));
$a->page['end'] .= replace_macros(get_markup_template('contact_end.tpl'), array( $a->page['end'] .= replace_macros(get_markup_template('contact_end.tpl'), array(
'$baseurl' => App::get_baseurl(true), '$baseurl' => App::get_baseurl(true),
'$editselect' => $editselect,
)); ));
require_once('include/contact_selectors.php'); require_once('include/contact_selectors.php');

View file

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

View file

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

View file

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

View file

@ -623,23 +623,13 @@ function profiles_content(App $a) {
require_once('include/profile_selectors.php'); 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( $a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array(
'$baseurl' => App::get_baseurl(true), '$baseurl' => App::get_baseurl(true),
'$editselect' => $editselect,
)); ));
$a->page['end'] .= replace_macros(get_markup_template('profed_end.tpl'), array( $a->page['end'] .= replace_macros(get_markup_template('profed_end.tpl'), array(
'$baseurl' => App::get_baseurl(true), '$baseurl' => App::get_baseurl(true),
'$editselect' => $editselect,
)); ));
$opt_tpl = get_markup_template("profile-hide-friends.tpl"); $opt_tpl = get_markup_template("profile-hide-friends.tpl");
$hide_friends = replace_macros($opt_tpl,array( $hide_friends = replace_macros($opt_tpl,array(
'$yesno' => array( '$yesno' => array(

View file

@ -113,16 +113,9 @@ function wallmessage_content(App $a) {
return; return;
} }
$editselect = 'none';
if( feature_enabled(local_user(), 'richtext') )
$editselect = '/(profile-jot-text|prvmail-text)/';
$tpl = get_markup_template('wallmsg-header.tpl'); $tpl = get_markup_template('wallmsg-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array( $a->page['htmlhead'] .= replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(true), '$baseurl' => $a->get_baseurl(true),
'$editselect' => $editselect,
'$nickname' => $user['nickname'], '$nickname' => $user['nickname'],
'$linkurl' => t('Please enter a link URL:') '$linkurl' => t('Please enter a link URL:')
)); ));
@ -130,13 +123,10 @@ function wallmessage_content(App $a) {
$tpl = get_markup_template('wallmsg-end.tpl'); $tpl = get_markup_template('wallmsg-end.tpl');
$a->page['end'] .= replace_macros($tpl, array( $a->page['end'] .= replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(true), '$baseurl' => $a->get_baseurl(true),
'$editselect' => $editselect,
'$nickname' => $user['nickname'], '$nickname' => $user['nickname'],
'$linkurl' => t('Please enter a link URL:') '$linkurl' => t('Please enter a link URL:')
)); ));
$tpl = get_markup_template('wallmessage.tpl'); $tpl = get_markup_template('wallmessage.tpl');
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$header' => t('Send Private Message'), '$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> </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"> <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() { $(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'); $("#comment-edit-text-desc").bbco_autocomplete('bbcode');
{{/if}}
$('#id_share').change(function() { $('#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/colorbox/jquery.colorbox-min.js"></script>
<script type="text/javascript" src="library/jgrowl/jquery.jgrowl_minimized.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/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="library/perfect-scrollbar/perfect-scrollbar.jquery.min.js" ></script>
<script type="text/javascript" src="js/acl.js" ></script> <script type="text/javascript" src="js/acl.js" ></script>
<script type="text/javascript" src="js/webtoolkit.base64.js" ></script> <script type="text/javascript" src="js/webtoolkit.base64.js" ></script>

View file

@ -2,12 +2,11 @@
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
var editor=false; var editor = false;
var textlen = 0; var textlen = 0;
var plaintext = '{{$editselect}}';
function initEditor(cb){ function initEditor(callback) {
if (editor==false){ if (editor == false) {
var colorbox_options = { var colorbox_options = {
{{if $APP->is_mobile}} {{if $APP->is_mobile}}
'width' : '100%', 'width' : '100%',
@ -17,114 +16,26 @@ function initEditor(cb){
'transition' : 'elastic' 'transition' : 'elastic'
} }
$("#profile-jot-text-loading").show(); $("#profile-jot-text-loading").show();
if(plaintext == 'none') {
$("#profile-jot-text-loading").hide(); $("#profile-jot-text-loading").hide();
$("#profile-jot-text").css({ 'height': 200, 'color': '#000' }); $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
$("#profile-jot-text").editor_autocomplete(baseurl+"/acl"); $("#profile-jot-text").editor_autocomplete(baseurl+"/acl");
$("#profile-jot-text").bbco_autocomplete('bbcode'); $("#profile-jot-text").bbco_autocomplete('bbcode');
editor = true;
$("a#jot-perms-icon").colorbox(colorbox_options); $("a#jot-perms-icon").colorbox(colorbox_options);
$(".jothidden").show(); $(".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; editor = true;
// setup acl popup }
$("a#jot-perms-icon").colorbox(colorbox_options); if (typeof callback != "undefined") {
} else { callback();
if (typeof cb!="undefined") cb();
} }
} }
function enableOnUser(){ function enableOnUser(){
if (editor) return; if (editor) {
$(this).val(""); return;
}
$(this).val('');
initEditor(); initEditor();
} }
@ -136,13 +47,10 @@ function enableOnUser(){
$(document).ready(function() { $(document).ready(function() {
/* enable tinymce on focus and click */ /* enable editor on focus and click */
$("#profile-jot-text").focus(enableOnUser); $("#profile-jot-text").focus(enableOnUser);
$("#profile-jot-text").click(enableOnUser); $("#profile-jot-text").click(enableOnUser);
/* show images / file browser window /* show images / file browser window
* *
**/ **/
@ -164,33 +72,6 @@ function enableOnUser(){
$('#wall-file-upload').on('click', function(){ $('#wall-file-upload').on('click', function(){
Dialog.doFileBrowser("main"); 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,13 +226,9 @@ function enableOnUser(){
} }
function addeditortext(data) { function addeditortext(data) {
if(plaintext == 'none') {
var currentText = $("#profile-jot-text").val(); var currentText = $("#profile-jot-text").val();
$("#profile-jot-text").val(currentText + data); $("#profile-jot-text").val(currentText + data);
} }
else
tinyMCE.execCommand('mceInsertRawHTML',false,data);
}
{{$geotag}} {{$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"> <script language="javascript" type="text/javascript">
$("#prvmail-text").editor_autocomplete(baseurl + '/acl');
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>
<script type="text/javascript" src="js/ajaxupload.js" ></script> <script type="text/javascript" src="js/ajaxupload.js" ></script>
<script> <script>
@ -57,17 +10,13 @@ else
name: 'userfile', name: 'userfile',
onSubmit: function(file,ext) { $('#profile-rotator').show(); }, onSubmit: function(file,ext) { $('#profile-rotator').show(); },
onComplete: function(file,response) { onComplete: function(file,response) {
tinyMCE.execCommand('mceInsertRawHTML',false,response); addeditortext(response);
$('#profile-rotator').hide(); $('#profile-rotator').hide();
} }
} }
); );
{{if $editselect = 'none'}}
$("#prvmail-text").bbco_autocomplete('bbcode'); $("#prvmail-text").bbco_autocomplete('bbcode');
{{/if}}
}); });
function jotGetLink() { function jotGetLink() {
@ -75,7 +24,7 @@ else
if(reply && reply.length) { if(reply && reply.length) {
$('#profile-rotator').show(); $('#profile-rotator').show();
$.get('parse_url?url=' + reply, function(data) { $.get('parse_url?url=' + reply, function(data) {
tinyMCE.execCommand('mceInsertRawHTML',false,data); addeditortext(data);
$('#profile-rotator').hide(); $('#profile-rotator').hide();
}); });
} }
@ -94,7 +43,7 @@ else
if(reply && reply.length) { if(reply && reply.length) {
$('#profile-rotator').show(); $('#profile-rotator').show();
$.get('parse_url?url=' + reply, function(data) { $.get('parse_url?url=' + reply, function(data) {
tinyMCE.execCommand('mceInsertRawHTML',false,data); addeditortext(data);
$('#profile-rotator').hide(); $('#profile-rotator').hide();
}); });
} }

View file

@ -1,40 +1 @@
<script type="text/javascript" src="js/country.js" ></script> <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>

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"> <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>
<script> <script>
@ -55,7 +8,7 @@ else
if(reply && reply.length) { if(reply && reply.length) {
$('#profile-rotator').show(); $('#profile-rotator').show();
$.get('parse_url?url=' + reply, function(data) { $.get('parse_url?url=' + reply, function(data) {
tinyMCE.execCommand('mceInsertRawHTML',false,data); addeditortext(data);
$('#profile-rotator').hide(); $('#profile-rotator').hide();
}); });
} }
@ -74,7 +27,7 @@ else
if(reply && reply.length) { if(reply && reply.length) {
$('#profile-rotator').show(); $('#profile-rotator').show();
$.get('parse_url?url=' + reply, function(data) { $.get('parse_url?url=' + reply, function(data) {
tinyMCE.execCommand('mceInsertRawHTML',false,data); addeditortext(data);
$('#profile-rotator').hide(); $('#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/colorbox/jquery.colorbox-min.js"></script>
<script type="text/javascript" src="library/jgrowl/jquery.jgrowl_minimized.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/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="library/perfect-scrollbar/perfect-scrollbar.jquery.min.js" ></script>
<script type="text/javascript" src="js/acl.js" ></script> <script type="text/javascript" src="js/acl.js" ></script>
<script type="text/javascript" src="js/webtoolkit.base64.js" ></script> <script type="text/javascript" src="js/webtoolkit.base64.js" ></script>