1
0
mirror of https://github.com/e107inc/e107.git synced 2025-02-13 11:04:38 +01:00

153 lines
4.3 KiB
PHP
Raw Normal View History

2006-12-22 18:45:32 +00:00
<?php
/*
2009-11-17 10:46:35 +00:00
* e107 website system
*
2009-11-18 01:06:08 +00:00
* Copyright (C) 2008-2009 e107 Inc (e107.org)
2009-11-17 10:46:35 +00:00
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*
*
2011-06-07 12:57:55 +00:00
* $URL$
* $Id$
2009-11-17 10:46:35 +00:00
*/
2006-12-22 18:45:32 +00:00
if (!defined('e107_INIT')) { exit; }
2012-04-30 20:35:59 +00:00
if(e_WYSIWYG || strpos(e_SELF,"tinymce/admin_config.php") )
2006-12-22 18:45:32 +00:00
{
if(e_PAGE != 'image.php')
{
e107::js('tinymce','tiny_mce.js','jquery');
2012-08-11 05:00:50 +00:00
e107::js('tinymce','wysiwyg.php','jquery',5);
}
else
{
2013-03-04 22:59:03 -08:00
// e107::js('tinymce','tiny_mce_popup.js','jquery');
}
if(ADMIN)
{
$insert = "$('#'+id).after('<div>";
$insert .= "<a href=\"#\" id=\"' + id + '\" class=\"e-wysiwyg-toggle btn btn-mini\">Switch to bbcode<\/a>";
if(e_PAGE == 'mailout.php')
{
$insert .= "&nbsp;&nbsp;<a href=\"#\" class=\"btn btn-mini tinyInsert\" data-value=\"|USERNAME|\" >".LAN_MAILOUT_16."<\/a>";
$insert .= "<a href=\"#\" class=\"btn btn-mini tinyInsert\" data-value=\"|DISPLAYNAME|\" >".LAN_MAILOUT_14."<\/a>";
$insert .= "<a href=\"#\" class=\"btn btn-mini tinyInsert\" data-value=\"|SIGNUP_LINK|\" >".LAN_MAILOUT_17."<\/a>";
$insert .= "<a href=\"#\" class=\"btn btn-mini tinyInsert\" data-value=\"|USERID|\" >".LAN_MAILOUT_18."<\/a>";
}
$insert .= "</div>');";
define("SWITCH_TO_BB",$insert);
}
else
{
define("SWITCH_TO_BB","");
}
// print_a($_POST);
// <div><a href='#' class='e-wysiwyg-switch' onclick=\"tinyMCE.execCommand('mceToggleEditor',false,'".$tinyMceID."');expandit('".$toggleID."');\">Toggle WYSIWYG</a></div>
e107::js('inline',"
$(function() {
$('.e-wysiwyg').each(function() {
var id = $(this).attr('id'); // 'e-wysiwyg';
".SWITCH_TO_BB."
// alert(id);
2012-06-09 04:42:32 +00:00
$('#bbcode-panel-'+id+'--preview').hide();
});
$('.tinyInsert').click(function() {
var val = $(this).attr('data-value');
tinyMCE.selectedInstance.execCommand('mceInsertContent',0,val);
return false;
});
2013-03-04 22:59:03 -08:00
/*
$('img.tinyInsertEmote').live('click',function() {
2013-03-04 22:59:03 -08:00
var src = $(this).attr('src');
alert(src);
// var html = '<img src=\''+src +'\' alt=\'emote\' />';
tinyMCE.execCommand('mceInsertRawHTML',false, 'hi there');
;
$('.mceContentBody', window.top.document).tinymce().execCommand('mceInsertContent',false,src);
// tinyMCE.selectedInstance.execCommand('mceInsertContent',0,src);
$('#uiModal').modal('hide');
return true;
});*/
// When new tab is added - convert textarea to TinyMce.
$('.e-tabs-add').on('click',function(){
alert('New Page Added'); // added for delay - quick and dirty work-around. XXX fixme
var idt = $(this).attr('data-target'); // eg. news-body
var ct = parseInt($('#e-tab-count').val());
var id = idt + '-' + ct;
2012-08-11 05:00:50 +00:00
$('#bbcode-panel-'+id+'--preview').hide();
".SWITCH_TO_BB."
2012-08-11 05:00:50 +00:00
tinyMCE.execCommand('mceAddControl', false, id);
});
$('a.e-wysiwyg-toggle').toggle(function(){
var id = $(this).attr('id'); // eg. news-body
2012-06-09 04:42:32 +00:00
$('#bbcode-panel-'+id+'--preview').show();
$(this).text('Switch to wysiwyg');
tinyMCE.execCommand('mceRemoveControl', false, id);
}, function () {
var id = $(this).attr('id');
2012-06-09 04:42:32 +00:00
$('#bbcode-panel-'+id+'--preview').hide();
$(this).text('Switch to bbcode');
tinyMCE.execCommand('mceAddControl', false, id);
});
$('.e-dialog-save').click(function(){
var html = $('#html_holder').val();
// tinyMCE.execCommand('mceInsertContent',false,html);
tinyMCE.execCommand('mceInsertRawHTML',false,html);
tinyMCEPopup.close();
});
2012-08-11 05:00:50 +00:00
2013-03-04 22:59:03 -08:00
$('.e-dialog-close').click(function(){
tinyMCEPopup.close();
});
2012-08-11 05:00:50 +00:00
});
","jquery");
2012-04-30 20:35:59 +00:00
2006-12-22 18:45:32 +00:00
}
2011-06-07 12:57:55 +00:00
2006-12-22 18:45:32 +00:00
2007-09-09 06:58:46 +00:00
?>