mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
Tinymce enhancements.
This commit is contained in:
@@ -993,14 +993,21 @@ class e_form
|
||||
return $this->radio_multi($name, $value, $checked, $options);
|
||||
}
|
||||
|
||||
$labelFound = vartrue($options['label']);
|
||||
unset($options['label']); // label attribute not valid in html5
|
||||
|
||||
$options = $this->format_options('radio', $name, $options);
|
||||
$options['checked'] = $checked; //comes as separate argument just for convenience
|
||||
// $options['class'] = 'inline';
|
||||
$text = "";
|
||||
|
||||
if(vartrue($options['label'])) // Bootstrap compatible markup
|
||||
|
||||
|
||||
|
||||
if($labelFound) // Bootstrap compatible markup
|
||||
{
|
||||
$text .= "<label class='radio'>";
|
||||
|
||||
}
|
||||
|
||||
$text .= "<input type='radio' name='{$name}' value='".$value."'".$this->get_attributes($options, $name, $value)." />";
|
||||
@@ -1010,9 +1017,9 @@ class e_form
|
||||
$text .= "<div class='field-help'>".$options['help']."</div>";
|
||||
}
|
||||
|
||||
if(vartrue($options['label']))
|
||||
if($labelFound)
|
||||
{
|
||||
$text .= $options['label']."</label>";
|
||||
$text .= $labelFound."</label>";
|
||||
}
|
||||
|
||||
return $text;
|
||||
@@ -2567,6 +2574,16 @@ class e_form
|
||||
case 'method': // Custom Function
|
||||
$method = $attributes['field']; // prevents table alias in method names. ie. u.my_method.
|
||||
$value = call_user_func_array(array($this, $method), array($value, 'read', $parms));
|
||||
|
||||
// Inline Editing.
|
||||
if(!vartrue($attributes['noedit']) && vartrue($parms['editable'])) // avoid bad markup, better solution coming up
|
||||
{
|
||||
$mode = preg_replace('/[^\w]/', '', vartrue($_GET['mode'], ''));
|
||||
$methodParms = call_user_func_array(array($this, $method), array($value, 'inline', $parms));
|
||||
$source = str_replace('"',"'",json_encode($methodParms));
|
||||
$value = "<a class='e-tip e-editable editable-click' data-type='select' data-name='".$field."' data-source=\"".$source."\" title=\"".LAN_EDIT." ".$attributes['title']."\" data-pk='".$id."' data-url='".e_SELF."?mode=&action=inline&id={$id}&ajax_used=1' href='#'>".$value."</a>";
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'hidden':
|
||||
|
169
e107_plugins/tinymce/plugins/e107bbcode/dialog.php
Normal file
169
e107_plugins/tinymce/plugins/e107bbcode/dialog.php
Normal file
@@ -0,0 +1,169 @@
|
||||
<?php
|
||||
|
||||
define("e_ADMIN_AREA", true);
|
||||
require_once("../../../../class2.php");
|
||||
//e107::lan('core','admin',TRUE);
|
||||
define("e_IFRAME",true);
|
||||
require_once(e_ADMIN."auth.php");
|
||||
|
||||
|
||||
if(!USER || check_class($pref['post_html']) == FALSE){
|
||||
exit;
|
||||
}
|
||||
|
||||
e107::css('inline',"
|
||||
|
||||
.selectEmote { display:inline-block; cursor:pointer;margin:3px }
|
||||
body { text-align:center }
|
||||
.area { border-left: 1px solid rgb(221, 221, 221); border-bottom: 1px solid rgb(221, 221, 221);
|
||||
background-color: rgb(246, 246, 246); margin-top:-1px
|
||||
}
|
||||
|
||||
");
|
||||
|
||||
e107::js('tinymce','tiny_mce_popup.js');
|
||||
|
||||
e107::js('inline',"
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
$('#insertButton').click(function () {
|
||||
|
||||
var buttonType = $('input:radio[name=buttonType]:checked').val();
|
||||
var buttonSize = $('input:radio[name=buttonSize]:checked').val();
|
||||
|
||||
var buttonText = $('#buttonText').val();
|
||||
var buttonUrl = $('#buttonUrl').val();
|
||||
|
||||
var buttonClass = (buttonType != '') ? 'btn-'+buttonType : '';
|
||||
|
||||
|
||||
var html = '<a class=\"btn ' + buttonClass + ' ' + buttonSize + '\" href=\"' + buttonUrl + '\" >' + buttonText + '</a>';
|
||||
// alert(html);
|
||||
tinyMCEPopup.editor.execCommand('mceInsertContent', false, html);
|
||||
tinyMCEPopup.close();
|
||||
});
|
||||
|
||||
$('#e-cancel').click(function () {
|
||||
|
||||
tinyMCEPopup.close();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
",'jquery');
|
||||
|
||||
|
||||
class e_bootstrap
|
||||
{
|
||||
|
||||
function init()
|
||||
{
|
||||
$ns = e107::getRender();
|
||||
|
||||
$text = '
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active" ><a href="#mbuttons" data-toggle="tab">Buttons</a></li>';
|
||||
|
||||
// $text .= '<li><a href="#mprofile" data-toggle="tab">Profile</a></li>';
|
||||
|
||||
$text .= '</ul>';
|
||||
|
||||
$text .= '<div class="tab-content">
|
||||
<div class="tab-pane active left" id="mbuttons">'.$this->buttonForm().'</div>';
|
||||
|
||||
// $text = '<div class="tab-pane" id="mprofile">Wow</div>';
|
||||
|
||||
$text .= '</div>';
|
||||
|
||||
echo $text;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function buttonForm()
|
||||
{
|
||||
$frm = e107::getForm();
|
||||
|
||||
$buttonTypes = array(''=>'Default', 'primary'=>"Primary", 'success'=>"Success", 'info'=>"Info", 'warning'=>"Warning",'danger'=>"Danger",'inverse'=>"Inverse");
|
||||
$buttonSizes = array(''=>'Default', 'btn-mini'=>"Mini", 'btn-small'=>"Small", 'btn-large' => "Large");
|
||||
|
||||
$butSelect = "";
|
||||
$butSelect .= "<div class='form-inline' style='padding:5px'>";
|
||||
foreach($buttonTypes as $type=>$diz)
|
||||
{
|
||||
|
||||
$label = '<button class="btn btn-'.$type.'" >'.$diz.'</button>';
|
||||
$butSelect .= $frm->radio('buttonType', $type, false, array('label'=>$label));
|
||||
|
||||
}
|
||||
$butSelect .= "</div>";
|
||||
|
||||
$butSize = "<div class='form-inline' style='padding:5px'>";
|
||||
|
||||
foreach($buttonSizes as $size=>$label)
|
||||
{
|
||||
$selected = ($size == '') ? true : false;
|
||||
$butSize .= $frm->radio('buttonSize', $size, $selected, array('label'=>$label));
|
||||
}
|
||||
$butSize .= "</div>";
|
||||
|
||||
|
||||
|
||||
$text = "
|
||||
<table class='table area'>
|
||||
<tr>
|
||||
<td>Button Style</td>
|
||||
<td>".$butSelect."</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Button Size</td>
|
||||
<td><p>".$butSize."</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Button Text</td>
|
||||
<td><p>".$frm->text('buttonText',$value,50)."</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Button Url</td>
|
||||
<td><p>".$frm->text('buttonUrl','',255)."</p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
<div class='center'>". $frm->admin_button('insertButton','save','other',"Insert") ."
|
||||
<button class='btn ' id='e-cancel'>".LAN_CANCEL."</button>
|
||||
</div>";
|
||||
|
||||
|
||||
return $text;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
require_once(e_ADMIN."auth.php");
|
||||
//e107::lan('core','admin',TRUE);
|
||||
|
||||
|
||||
$bootObj = new e_bootstrap;
|
||||
$bootObj->init();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
require_once(e_ADMIN."footer.php");
|
||||
exit;
|
||||
//
|
||||
|
||||
|
||||
?>
|
@@ -8,6 +8,35 @@
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.e107BBCodePlugin', {
|
||||
init : function(ed, url) {
|
||||
|
||||
ed.addCommand('mceBoot', function() {
|
||||
ed.windowManager.open({
|
||||
file : url + '/dialog.php',
|
||||
width : 900 , // + parseInt(ed.getLang('e107bbcode.delta_width', 0)),
|
||||
height : 400, // + parseInt(ed.getLang('e107bbcode.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url, // Plugin absolute URL
|
||||
some_custom_arg : 'custom arg' // Custom argument
|
||||
});
|
||||
});
|
||||
|
||||
// Register button
|
||||
ed.addButton('e107bbcode', {
|
||||
title : 'example.desc',
|
||||
cmd : 'mceBoot',
|
||||
image : url + '/img/bootstrap.png'
|
||||
});
|
||||
|
||||
// Add a node change handler, selects the button in the UI when a image is selected
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
cm.setActive('example', n.nodeName == 'IMG');
|
||||
});
|
||||
|
||||
|
||||
// ------------
|
||||
|
||||
|
||||
var t = this, dialect = ed.getParam('bbcode_dialect', 'e107').toLowerCase();
|
||||
|
||||
ed.onBeforeSetContent.add(function(ed, o) {
|
||||
|
BIN
e107_plugins/tinymce/plugins/e107bbcode/img/bootstrap.png
Normal file
BIN
e107_plugins/tinymce/plugins/e107bbcode/img/bootstrap.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
@@ -2,6 +2,6 @@
|
||||
<tinymce>
|
||||
<tinymce_name>Main Admin</tinymce_name>
|
||||
<tinymce_plugins>advhr,advlink,autosave,contextmenu,directionality,e107bbcode,emoticons,ibrowser,jqueryinlinepopups,paste,table,visualchars,wordcount,xhtmlxtras,youtube,fullscreen</tinymce_plugins>
|
||||
<tinymce_buttons1>link, unlink, bold, italic, underline, undo, redo,formatselect,justifyleft,justifycenter,justifyright,justifyfull, |, ibrowser, forecolor, removeformat, table, bullist, numlist, outdent, indent, cleanup, emoticons, youtube, fullscreen</tinymce_buttons1>
|
||||
<tinymce_buttons1>link, unlink, bold, italic, underline, undo, redo,formatselect,justifyleft,justifycenter,justifyright,justifyfull, |, ibrowser, forecolor, removeformat, table, bullist, numlist, outdent, indent, cleanup, emoticons, youtube, e107bbcode, fullscreen</tinymce_buttons1>
|
||||
<extended_valid_elements>object[*],embed[*]</extended_valid_elements>
|
||||
</tinymce>
|
||||
|
@@ -212,7 +212,9 @@ class wysiwyg
|
||||
|
||||
|
||||
function getConfig($config=FALSE)
|
||||
{
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
|
||||
if(getperms('0'))
|
||||
{
|
||||
$template = "mainadmin.xml";
|
||||
@@ -249,6 +251,11 @@ class wysiwyg
|
||||
'plugins' => $this->filter_plugins($config['tinymce_plugins'])
|
||||
);
|
||||
|
||||
$content_css = vartrue($config['content_css'], "{e_WEB_ABS}js/bootstrap/css/bootstrap.min.css");
|
||||
$content_styles = array('Bootstrap Button' => 'btn btn-primary', 'Bootstrap Table' => 'table');
|
||||
|
||||
|
||||
|
||||
$this->config += array(
|
||||
|
||||
'theme_advanced_buttons1' => $config['tinymce_buttons1'],
|
||||
@@ -257,7 +264,9 @@ class wysiwyg
|
||||
'theme_advanced_buttons4' => vartrue($config['tinymce_buttons4']),
|
||||
'theme_advanced_toolbar_location' => vartrue($config['theme_advanced_toolbar_location'],'top'),
|
||||
'theme_advanced_toolbar_align' => 'left',
|
||||
'theme_advanced_blockformats' => 'p,h2,h3,blockquote,code',
|
||||
'theme_advanced_blockformats' => 'p,h2,h3,h4,h5,h6,blockquote,pre,code',
|
||||
'theme_advanced_styles' => str_replace(array("+")," ",http_build_query($content_styles)), //'Bootstrap Button=btn btn-primary;Bootstrap Table=table;border=border;fborder=fborder;tbox=tbox;caption=caption;fcaption=fcaption;forumheader=forumheader;forumheader3=forumheader3',
|
||||
|
||||
// 'theme_advanced_resize_vertical' => 'true',
|
||||
'dialog_type' => "modal",
|
||||
// 'theme_advanced_source_editor_height' => '400',
|
||||
@@ -305,6 +314,7 @@ class wysiwyg
|
||||
'auto_cleanup_word' => 'true',
|
||||
'cleanup' => 'true',
|
||||
'convert_fonts_to_spans' => 'true',
|
||||
'content_css' => $tp->replaceConstants($content_css),
|
||||
'trim_span_elements' => 'true',
|
||||
'inline_styles' => 'true',
|
||||
'auto_resize' => 'false',
|
||||
@@ -322,7 +332,6 @@ class wysiwyg
|
||||
'relative_urls' => 'false', //Media Manager prefers it like this.
|
||||
'preformatted' => 'true',
|
||||
'document_base_url' => SITEURL,
|
||||
'theme_advanced_styles' => 'border=border;fborder=fborder;tbox=tbox;caption=caption;fcaption=fcaption;forumheader=forumheader;forumheader3=forumheader3',
|
||||
'verify_css_classes' => 'false'
|
||||
|
||||
);
|
||||
|
@@ -86,7 +86,7 @@ $(document).ready(function()
|
||||
}
|
||||
|
||||
// Set the Html / Wysiwyg Value.
|
||||
var html = '<img style=\"' + style + '\" src=\"'+ src +'\" alt=\"\" width=\"' + width + '\" height=\"' + height + '\" />';
|
||||
var html = '<img class="img-rounded" style=\"' + style + '\" src=\"'+ src +'\" alt=\"\" width=\"' + width + '\" height=\"' + height + '\" />';
|
||||
$('#html_holder').val(html);
|
||||
|
||||
// Only Do width/height styling on bbcodes --
|
||||
|
Reference in New Issue
Block a user