- editor.addCommand('wfpl_images', new CKEDITOR.dialogCommand('wfpl_images_dialog'));
- editor.ui.addButton('wfpl_images', {
- label: 'Insert Image',
- command: 'wfpl_images',
- toolbar: 'insert'
- });
- CKEDITOR.dialog.add('wfpl_images_dialog', function (api) {
- return {
- title: 'Insert Image',
- minWidth: 700,
- minHeight: 350,
- contents: [
- {
- expand: true,
- padding: 0,
- elements: [
- {
- type: 'html',
- html: '<div class="cke_wfpl_images_dialog">'
- + '<h3>Step 1: Choose an image to insert:</h3>'
- + "<div class=\"cke_wfpl_thumbs\">~wfpl_images {~ <div class=\"~ first {~selected ~}~cke_wfpl_thumb\" onclick=\"return window.cke_wfpl_images_thumb_click("+plugin_id+", this, ~id~)\" style=\"background-image: url(~image thumb_src attr jsdq~)\">~caption empty {~~name html jsdq~~}~~caption nonempty {~~caption html jsdq~~}~</div>~}~</div>"
- + '<p>If you\'d like to insert an image not shown above, you can <a href="admin_images?new=1" target="_blank">upload it here</a>. Sorry, it won\'t appear here until you reload this editor page (hit Save below, then "edit this page" again.)</p>'
- + '</div>'
- }
- ]
- }
- ],
- buttons: [
- {
- type: 'button',
- label: 'Insert on Left',
- className: 'cke_dialog_ui_button_ok',
- onClick: function() {
- cke_wfpl_images_insert_click(plugin_id, 'left');
- }
- },
- {
- type: 'button',
- label: 'Insert Centered',
- className: 'cke_dialog_ui_button_ok',
- onClick: function() {
- cke_wfpl_images_insert_click(plugin_id, 'centered');
- }
- },
- {
- type: 'button',
- label: 'Insert on Right',
- className: 'cke_dialog_ui_button_ok',
- onClick: function() {
- cke_wfpl_images_insert_click(plugin_id, 'right');
- }
- },
- {
- type: 'button',
- label: 'Insert BIG',
- className: 'cke_dialog_ui_button_ok',
- onClick: function() {
- cke_wfpl_images_insert_click(plugin_id, 'full');
- }
- },
- CKEDITOR.dialog.cancelButton
- ]
- };
- });
- }
- });
- function make_wysiwyg(name) {
- CKEDITOR.replace(name, {
- 'contentsCss': 'style.css?m=~style.css mtime~',
- 'allowedContent': true,
- 'stylesSet': [
- { name: 'Paragraph', element: 'p'},
- { name: 'Page Headline', element: 'h1'},
- { name: 'Section Headline', element: 'h2'},
- { name: 'Subsection Headline', element: 'h3'},
- { name: 'Tagline (under headline)', element: 'h4', attributes: { class: 'tagline'}},
- { name: 'Quote', element: 'p', attributes: { class: 'quote'}},
- { name: 'Quote Author', element: 'p', attributes: { class: 'attrib'}}
- ],
- 'uiColor': '#ccccff',
- 'removePlugins': 'forms,templates,smiley,pagebreak,save,newpage,preview,print',
- 'extraPlugins': 'wfpl_images',
- 'height': '300px',
- 'toolbar': [
- ['Source'],
- ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'SpellChecker', 'Scayt'],
- ['Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat'],
- '/',
- ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript'],
- ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'],
- ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
- ['Link', 'Unlink', 'Anchor'],
- ['wfpl_images', 'Table', 'HorizontalRule', 'SpecialChar', 'PageBreak'],
- '/',
- ['Styles', 'Font', 'FontSize'],
- ['TextColor', 'BGColor'],
- ['Maximize', 'ShowBlocks']
- ]
- });
- }
- </script>
- <!--~}~-->
+ editor.addCommand('wfpl_images', new CKEDITOR.dialogCommand('wfpl_images_dialog'));
+ editor.ui.addButton('wfpl_images', {
+ label: 'Insert Image',
+ command: 'wfpl_images',
+ toolbar: 'insert'
+ });
+ CKEDITOR.dialog.add('wfpl_images_dialog', function (api) {
+ var i, im, selected, thumbs;
+ selected = 'selected ';
+ thumbs = '<div class="cke_wfpl_thumbs">'
+ for (i in window.cke_wfpl_images.images) {
+ im = window.cke_wfpl_images.images[i];
+ thumbs += '<div class="'+selected+'cke_wfpl_thumb" onclick="return window.cke_wfpl_images_thumb_click('+plugin_id+', this, '+im.id+')" style="background-image: url('+im.src.substr(0, im.src.length - 4) + 'w' + window.cke_wfpl_images.thumb_width + im.src.substr(im.src.length - 4) + ')">'+ enc_html(im.name.length > 0 ? im.name : im.caption) + '</div>';
+ selected = '';
+ }
+ thumbs += '</div>'
+ return {
+ title: 'Insert Image',
+ minWidth: 700,
+ minHeight: 350,
+ contents: [
+ {
+ expand: true,
+ padding: 0,
+ elements: [
+ {
+ type: 'html',
+ html: '<div class="cke_wfpl_images_dialog">'
+ + '<h3>Step 1: Choose an image to insert:</h3>'
+ + thumbs
+ + '<p>If you\'d like to insert an image not shown above, you can <a href="admin_images?new=1" target="_blank">upload it here</a>. Sorry, it won\'t appear here until you reload this editor page (hit Save below, then "edit this page" again.)</p>'
+ + '</div>'
+ }
+ ]
+ }
+ ],
+ buttons: [
+ {
+ type: 'button',
+ label: 'Insert on Left',
+ className: 'cke_dialog_ui_button_ok',
+ onClick: function() {
+ cke_wfpl_images_insert_click(plugin_id, 'left');
+ }
+ },
+ {
+ type: 'button',
+ label: 'Insert Centered',
+ className: 'cke_dialog_ui_button_ok',
+ onClick: function() {
+ cke_wfpl_images_insert_click(plugin_id, 'centered');
+ }
+ },
+ {
+ type: 'button',
+ label: 'Insert on Right',
+ className: 'cke_dialog_ui_button_ok',
+ onClick: function() {
+ cke_wfpl_images_insert_click(plugin_id, 'right');
+ }
+ },
+ {
+ type: 'button',
+ label: 'Insert BIG',
+ className: 'cke_dialog_ui_button_ok',
+ onClick: function() {
+ cke_wfpl_images_insert_click(plugin_id, 'full');
+ }
+ },
+ CKEDITOR.dialog.cancelButton
+ ]
+ };
+ });
+ }
+ });
+ function make_wysiwyg(name, bodyid_postfix) {
+ CKEDITOR.replace(name, {
+ 'contentsCss': 'css.css?m=~css.css mtime~',
+ 'allowedContent': true,
+ bodyId: '~$basename~' + '_wysiwyg_' + (bodyid_postfix ? bodyid_postfix : name),
+ 'stylesSet': [
+ { name: 'Paragraph', element: 'p'},
+ { name: 'Page Headline', element: 'h1'},
+ { name: 'Section Headline', element: 'h2'},
+ { name: 'Subsection Headline', element: 'h3'},
+ { name: 'Tagline (under headline)', element: 'h4', attributes: { class: 'tagline'}},
+ { name: 'Quote', element: 'p', attributes: { class: 'quote'}},
+ { name: 'Quote Author', element: 'p', attributes: { class: 'attrib'}},
+ { name: 'div (generic box)', element: 'div'}
+ ],
+ 'uiColor': '#ccccff',
+ 'removePlugins': 'forms,templates,smiley,pagebreak,save,newpage,preview,print',
+ 'extraPlugins': 'wfpl_images',
+ 'height': '300px',
+ 'toolbar': [
+ ['Source'],
+ ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'SpellChecker', 'Scayt'],
+ ['Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat'],
+ '/',
+ ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript'],
+ ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'],
+ ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
+ ['Link', 'Unlink', 'Anchor'],
+ ['wfpl_images', 'Table', 'HorizontalRule', 'SpecialChar', 'PageBreak'],
+ '/',
+ ['Styles', 'Font', 'FontSize'],
+ ['TextColor', 'BGColor'],
+ ['Maximize', 'ShowBlocks']
+ ]
+ });
+ }
+ window.admin_pages_cur_layout = null
+ function admin_pages_layout(layout) {
+ if (layout === undefined) {
+ layout = document.getElementById('layout').value
+ }
+ if (typeof layout === 'string') {
+ layout = parseInt(layout);
+ }
+ if (layout === window.admin_pages_cur_layout) {
+ return;
+ }
+ // hide/show sidebar editor
+ if (layout === 0) {
+ document.getElementById('sidebar_editor').style.display = 'none'
+ } else {
+ document.getElementById('sidebar_editor').style.display = 'block'
+ }
+ // remove existing ckeditors
+ if (window.admin_pages_cur_layout !== null) {
+ for (name in CKEDITOR.instances) {
+ CKEDITOR.instances[name].destroy();
+ }
+ }
+ // create ckeditors
+ if (layout === 0) {
+ make_wysiwyg('content', 'content_full_main');
+ } else if (layout === 1) {
+ make_wysiwyg('content', 'content_with_sidebar_main');
+ make_wysiwyg('sidebar_content', 'content_with_sidebar_sidebar_plain');
+ } else {
+ make_wysiwyg('content', 'content_with_sidebar_main');
+ make_wysiwyg('sidebar_content', 'content_with_sidebar_sidebar_bordered');
+ }
+
+ window.admin_pages_cur_layout = layout
+ }
+ </script>
+ <!--~}~-->