diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index ca4cce612..c87240031 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -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 .= ""; + $text .= $labelFound.""; } 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 = "".$value.""; + } + break; case 'hidden': diff --git a/e107_plugins/tinymce/plugins/e107bbcode/dialog.php b/e107_plugins/tinymce/plugins/e107bbcode/dialog.php new file mode 100644 index 000000000..ea47475db --- /dev/null +++ b/e107_plugins/tinymce/plugins/e107bbcode/dialog.php @@ -0,0 +1,169 @@ +' + buttonText + ''; + // 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 = ' + '; + + $text .= '
+
'.$this->buttonForm().'
'; + + // $text = '
Wow
'; + + $text .= '
'; + + 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 .= "
"; + foreach($buttonTypes as $type=>$diz) + { + + $label = ''; + $butSelect .= $frm->radio('buttonType', $type, false, array('label'=>$label)); + + } + $butSelect .= "
"; + + $butSize = "
"; + + foreach($buttonSizes as $size=>$label) + { + $selected = ($size == '') ? true : false; + $butSize .= $frm->radio('buttonSize', $size, $selected, array('label'=>$label)); + } + $butSize .= "
"; + + + + $text = " + + + + + + + + + + + + + + + + + + + +
Button Style".$butSelect."
Button Size

".$butSize."

Button Text

".$frm->text('buttonText',$value,50)."

Button Url

".$frm->text('buttonUrl','',255)."

+ +
". $frm->admin_button('insertButton','save','other',"Insert") ." + +
"; + + + 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; +// + + +?> \ No newline at end of file diff --git a/e107_plugins/tinymce/plugins/e107bbcode/editor_plugin.js b/e107_plugins/tinymce/plugins/e107bbcode/editor_plugin.js index a65c64b86..9b3546cfa 100644 --- a/e107_plugins/tinymce/plugins/e107bbcode/editor_plugin.js +++ b/e107_plugins/tinymce/plugins/e107bbcode/editor_plugin.js @@ -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) { diff --git a/e107_plugins/tinymce/plugins/e107bbcode/img/bootstrap.png b/e107_plugins/tinymce/plugins/e107bbcode/img/bootstrap.png new file mode 100644 index 000000000..faa225dfc Binary files /dev/null and b/e107_plugins/tinymce/plugins/e107bbcode/img/bootstrap.png differ diff --git a/e107_plugins/tinymce/templates/mainadmin.xml b/e107_plugins/tinymce/templates/mainadmin.xml index cb7f76120..33780c6f5 100644 --- a/e107_plugins/tinymce/templates/mainadmin.xml +++ b/e107_plugins/tinymce/templates/mainadmin.xml @@ -2,6 +2,6 @@ Main Admin advhr,advlink,autosave,contextmenu,directionality,e107bbcode,emoticons,ibrowser,jqueryinlinepopups,paste,table,visualchars,wordcount,xhtmlxtras,youtube,fullscreen - link, unlink, bold, italic, underline, undo, redo,formatselect,justifyleft,justifycenter,justifyright,justifyfull, |, ibrowser, forecolor, removeformat, table, bullist, numlist, outdent, indent, cleanup, emoticons, youtube, fullscreen + 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 object[*],embed[*] diff --git a/e107_plugins/tinymce/wysiwyg.php b/e107_plugins/tinymce/wysiwyg.php index bf22d55af..b30c808d6 100644 --- a/e107_plugins/tinymce/wysiwyg.php +++ b/e107_plugins/tinymce/wysiwyg.php @@ -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' ); diff --git a/e107_web/js/core/mediaManager.js b/e107_web/js/core/mediaManager.js index f62a0df73..bc8ad4a14 100644 --- a/e107_web/js/core/mediaManager.js +++ b/e107_web/js/core/mediaManager.js @@ -86,7 +86,7 @@ $(document).ready(function() } // Set the Html / Wysiwyg Value. - var html = '\"\"'; + var html = '\"\"'; $('#html_holder').val(html); // Only Do width/height styling on bbcodes --