cable 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. data/app/controllers/cable/admin_controller.rb +8 -0
  2. data/app/helpers/admin_helper.rb +7 -0
  3. data/app/models/cable/global_setting.rb +3 -0
  4. data/app/views/cable/admin/index.html.erb +2 -0
  5. data/app/views/cable/layouts/_messages.html.erb +12 -0
  6. data/app/views/cable/layouts/admin.html.erb +49 -0
  7. data/config/routes.rb +4 -0
  8. data/lib/cable.rb +3 -0
  9. data/lib/cable/engine.rb +10 -0
  10. data/lib/generators/cable/controllers_generator.rb +21 -0
  11. data/lib/generators/cable/install_generator.rb +35 -0
  12. data/lib/generators/cable/templates/admin_navigation.rb +5 -0
  13. data/lib/generators/cable/templates/javascripts/admin.js +24 -0
  14. data/lib/generators/cable/templates/javascripts/wymeditor/GPL-license.txt +278 -0
  15. data/lib/generators/cable/templates/javascripts/wymeditor/MIT-license.txt +20 -0
  16. data/lib/generators/cable/templates/javascripts/wymeditor/README +33 -0
  17. data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-blockquote.png +0 -0
  18. data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-h1.png +0 -0
  19. data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-h2.png +0 -0
  20. data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-h3.png +0 -0
  21. data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-h4.png +0 -0
  22. data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-h5.png +0 -0
  23. data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-h6.png +0 -0
  24. data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-p.png +0 -0
  25. data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/lbl-pre.png +0 -0
  26. data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/wymiframe.css +93 -0
  27. data/lib/generators/cable/templates/javascripts/wymeditor/iframe/default/wymiframe.html +26 -0
  28. data/lib/generators/cable/templates/javascripts/wymeditor/jquery.wymeditor.js +4724 -0
  29. data/lib/generators/cable/templates/javascripts/wymeditor/jquery.wymeditor.min.js +1 -0
  30. data/lib/generators/cable/templates/javascripts/wymeditor/jquery.wymeditor.pack.js +1 -0
  31. data/lib/generators/cable/templates/javascripts/wymeditor/lang/bg.js +45 -0
  32. data/lib/generators/cable/templates/javascripts/wymeditor/lang/ca.js +45 -0
  33. data/lib/generators/cable/templates/javascripts/wymeditor/lang/cs.js +45 -0
  34. data/lib/generators/cable/templates/javascripts/wymeditor/lang/cy.js +45 -0
  35. data/lib/generators/cable/templates/javascripts/wymeditor/lang/de.js +45 -0
  36. data/lib/generators/cable/templates/javascripts/wymeditor/lang/en.js +46 -0
  37. data/lib/generators/cable/templates/javascripts/wymeditor/lang/es.js +45 -0
  38. data/lib/generators/cable/templates/javascripts/wymeditor/lang/fa.js +46 -0
  39. data/lib/generators/cable/templates/javascripts/wymeditor/lang/fi.js +44 -0
  40. data/lib/generators/cable/templates/javascripts/wymeditor/lang/fr.js +45 -0
  41. data/lib/generators/cable/templates/javascripts/wymeditor/lang/gl.js +45 -0
  42. data/lib/generators/cable/templates/javascripts/wymeditor/lang/he.js +45 -0
  43. data/lib/generators/cable/templates/javascripts/wymeditor/lang/hr.js +45 -0
  44. data/lib/generators/cable/templates/javascripts/wymeditor/lang/hu.js +45 -0
  45. data/lib/generators/cable/templates/javascripts/wymeditor/lang/it.js +45 -0
  46. data/lib/generators/cable/templates/javascripts/wymeditor/lang/ja.js +44 -0
  47. data/lib/generators/cable/templates/javascripts/wymeditor/lang/nb.js +45 -0
  48. data/lib/generators/cable/templates/javascripts/wymeditor/lang/nl.js +45 -0
  49. data/lib/generators/cable/templates/javascripts/wymeditor/lang/nn.js +45 -0
  50. data/lib/generators/cable/templates/javascripts/wymeditor/lang/pl.js +45 -0
  51. data/lib/generators/cable/templates/javascripts/wymeditor/lang/pt-br.js +45 -0
  52. data/lib/generators/cable/templates/javascripts/wymeditor/lang/pt.js +45 -0
  53. data/lib/generators/cable/templates/javascripts/wymeditor/lang/ru.js +45 -0
  54. data/lib/generators/cable/templates/javascripts/wymeditor/lang/sv.js +46 -0
  55. data/lib/generators/cable/templates/javascripts/wymeditor/lang/tr.js +45 -0
  56. data/lib/generators/cable/templates/javascripts/wymeditor/lang/zh_cn.js +47 -0
  57. data/lib/generators/cable/templates/javascripts/wymeditor/plugins/embed/jquery.wymeditor.embed.js +52 -0
  58. data/lib/generators/cable/templates/javascripts/wymeditor/plugins/fullscreen/icon_fullscreen.gif +0 -0
  59. data/lib/generators/cable/templates/javascripts/wymeditor/plugins/fullscreen/jquery.wymeditor.fullscreen.js +127 -0
  60. data/lib/generators/cable/templates/javascripts/wymeditor/plugins/hovertools/jquery.wymeditor.hovertools.js +57 -0
  61. data/lib/generators/cable/templates/javascripts/wymeditor/plugins/mediabrowser/browser.png +0 -0
  62. data/lib/generators/cable/templates/javascripts/wymeditor/plugins/mediabrowser/jquery.wymeditor.mediabrowser.js +115 -0
  63. data/lib/generators/cable/templates/javascripts/wymeditor/plugins/resizable/jquery.wymeditor.resizable.js +91 -0
  64. data/lib/generators/cable/templates/javascripts/wymeditor/plugins/resizable/readme.txt +124 -0
  65. data/lib/generators/cable/templates/javascripts/wymeditor/plugins/tidy/README +19 -0
  66. data/lib/generators/cable/templates/javascripts/wymeditor/plugins/tidy/jquery.wymeditor.tidy.js +82 -0
  67. data/lib/generators/cable/templates/javascripts/wymeditor/plugins/tidy/tidy.php +36 -0
  68. data/lib/generators/cable/templates/javascripts/wymeditor/plugins/tidy/wand.png +0 -0
  69. data/lib/generators/cable/templates/javascripts/wymeditor/skins/compact/icons.png +0 -0
  70. data/lib/generators/cable/templates/javascripts/wymeditor/skins/compact/skin.css +134 -0
  71. data/lib/generators/cable/templates/javascripts/wymeditor/skins/compact/skin.js +35 -0
  72. data/lib/generators/cable/templates/javascripts/wymeditor/skins/default/icons.png +0 -0
  73. data/lib/generators/cable/templates/javascripts/wymeditor/skins/default/skin.css +158 -0
  74. data/lib/generators/cable/templates/javascripts/wymeditor/skins/default/skin.js +40 -0
  75. data/lib/generators/cable/templates/javascripts/wymeditor/skins/minimal/images/bg.header.gif +0 -0
  76. data/lib/generators/cable/templates/javascripts/wymeditor/skins/minimal/images/bg.selector.silver.gif +0 -0
  77. data/lib/generators/cable/templates/javascripts/wymeditor/skins/minimal/images/bg.wymeditor.png +0 -0
  78. data/lib/generators/cable/templates/javascripts/wymeditor/skins/minimal/images/icons.silver.gif +0 -0
  79. data/lib/generators/cable/templates/javascripts/wymeditor/skins/minimal/skin.css +131 -0
  80. data/lib/generators/cable/templates/javascripts/wymeditor/skins/minimal/skin.js +30 -0
  81. data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/COPYING +674 -0
  82. data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/README +27 -0
  83. data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/images/bg.header.gif +0 -0
  84. data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/images/bg.selector.silver.gif +0 -0
  85. data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/images/bg.wymeditor.png +0 -0
  86. data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/images/icons.silver.gif +0 -0
  87. data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/skin.css +297 -0
  88. data/lib/generators/cable/templates/javascripts/wymeditor/skins/silver/skin.js +61 -0
  89. data/lib/generators/cable/templates/javascripts/wymeditor/skins/twopanels/icons.png +0 -0
  90. data/lib/generators/cable/templates/javascripts/wymeditor/skins/twopanels/skin.css +134 -0
  91. data/lib/generators/cable/templates/javascripts/wymeditor/skins/twopanels/skin.js +39 -0
  92. data/lib/generators/cable/templates/javascripts/wymeditor/skins/wymeditor_icon.png +0 -0
  93. data/lib/generators/cable/templates/stylesheets/admin.css +417 -0
  94. data/lib/generators/cable/templates/stylesheets/admin/blueprint/ie.css +36 -0
  95. data/lib/generators/cable/templates/stylesheets/admin/blueprint/plugins/buttons/icons/cross.png +0 -0
  96. data/lib/generators/cable/templates/stylesheets/admin/blueprint/plugins/buttons/icons/key.png +0 -0
  97. data/lib/generators/cable/templates/stylesheets/admin/blueprint/plugins/buttons/icons/tick.png +0 -0
  98. data/lib/generators/cable/templates/stylesheets/admin/blueprint/plugins/buttons/readme.txt +32 -0
  99. data/lib/generators/cable/templates/stylesheets/admin/blueprint/plugins/buttons/screen.css +97 -0
  100. data/lib/generators/cable/templates/stylesheets/admin/blueprint/plugins/fancy-type/readme.txt +14 -0
  101. data/lib/generators/cable/templates/stylesheets/admin/blueprint/plugins/fancy-type/screen.css +71 -0
  102. data/lib/generators/cable/templates/stylesheets/admin/blueprint/plugins/link-icons/icons/doc.png +0 -0
  103. data/lib/generators/cable/templates/stylesheets/admin/blueprint/plugins/link-icons/icons/email.png +0 -0
  104. data/lib/generators/cable/templates/stylesheets/admin/blueprint/plugins/link-icons/icons/external.png +0 -0
  105. data/lib/generators/cable/templates/stylesheets/admin/blueprint/plugins/link-icons/icons/feed.png +0 -0
  106. data/lib/generators/cable/templates/stylesheets/admin/blueprint/plugins/link-icons/icons/im.png +0 -0
  107. data/lib/generators/cable/templates/stylesheets/admin/blueprint/plugins/link-icons/icons/pdf.png +0 -0
  108. data/lib/generators/cable/templates/stylesheets/admin/blueprint/plugins/link-icons/icons/visited.png +0 -0
  109. data/lib/generators/cable/templates/stylesheets/admin/blueprint/plugins/link-icons/icons/xls.png +0 -0
  110. data/lib/generators/cable/templates/stylesheets/admin/blueprint/plugins/link-icons/readme.txt +18 -0
  111. data/lib/generators/cable/templates/stylesheets/admin/blueprint/plugins/link-icons/screen.css +40 -0
  112. data/lib/generators/cable/templates/stylesheets/admin/blueprint/plugins/rtl/readme.txt +10 -0
  113. data/lib/generators/cable/templates/stylesheets/admin/blueprint/plugins/rtl/screen.css +110 -0
  114. data/lib/generators/cable/templates/stylesheets/admin/blueprint/print.css +29 -0
  115. data/lib/generators/cable/templates/stylesheets/admin/blueprint/screen.css +260 -0
  116. data/lib/generators/cable/templates/stylesheets/admin/blueprint/src/forms.css +73 -0
  117. data/lib/generators/cable/templates/stylesheets/admin/blueprint/src/grid.css +280 -0
  118. data/lib/generators/cable/templates/stylesheets/admin/blueprint/src/grid.png +0 -0
  119. data/lib/generators/cable/templates/stylesheets/admin/blueprint/src/ie.css +77 -0
  120. data/lib/generators/cable/templates/stylesheets/admin/blueprint/src/print.css +85 -0
  121. data/lib/generators/cable/templates/stylesheets/admin/blueprint/src/reset.css +67 -0
  122. data/lib/generators/cable/templates/stylesheets/admin/blueprint/src/typography.css +121 -0
  123. data/lib/railties/tasks.rake +6 -0
  124. metadata +187 -0
@@ -0,0 +1,57 @@
1
+ /*
2
+ * WYMeditor : what you see is What You Mean web-based editor
3
+ * Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
4
+ * Dual licensed under the MIT (MIT-license.txt)
5
+ * and GPL (GPL-license.txt) licenses.
6
+ *
7
+ * For further information visit:
8
+ * http://www.wymeditor.org/
9
+ *
10
+ * File Name:
11
+ * jquery.wymeditor.hovertools.js
12
+ * hovertools plugin for WYMeditor
13
+ *
14
+ * File Authors:
15
+ * Jean-Francois Hovinne (jf.hovinne a-t wymeditor dotorg)
16
+ */
17
+
18
+ //Extend WYMeditor
19
+ WYMeditor.editor.prototype.hovertools = function() {
20
+
21
+ var wym = this;
22
+
23
+ //bind events on buttons
24
+ jQuery(this._box).find(this._options.toolSelector).hover(
25
+ function() {
26
+ wym.status(jQuery(this).html());
27
+ },
28
+ function() {
29
+ wym.status(' ');
30
+ }
31
+ );
32
+
33
+ //classes: add/remove a style attr to matching elems
34
+ //while mouseover/mouseout
35
+ jQuery(this._box).find(this._options.classSelector).hover(
36
+ function() {
37
+ var aClasses = eval(wym._options.classesItems);
38
+ var sName = jQuery(this).attr(WYMeditor.NAME);
39
+ var oClass = WYMeditor.Helper.findByName(aClasses, sName);
40
+
41
+ if(oClass){
42
+ jqexpr = oClass.expr;
43
+ //don't use jQuery.find() on the iframe body
44
+ //because of MSIE + jQuery + expando issue (#JQ1143)
45
+ if(!jQuery.browser.msie)
46
+ jQuery(wym._doc).find(jqexpr).css('background-color','#cfc');
47
+ }
48
+ },
49
+ function() {
50
+ //don't use jQuery.find() on the iframe body
51
+ //because of MSIE + jQuery + expando issue (#JQ1143)
52
+ if(!jQuery.browser.msie)
53
+ jQuery(wym._doc).find('*').removeAttr('style');
54
+ }
55
+ );
56
+
57
+ };
@@ -0,0 +1,115 @@
1
+ (function($, undefined) {
2
+ function MediaBrowser (options, wym) {
3
+ var self = this;
4
+
5
+ this.options = $.extend(true, {}, this.defaults, options);
6
+
7
+ this.element = $('<div id="' + this.options.dialogClass + '-' + new Date().getTime() + '" class="' + this.options.dialogClass + '"></div>')
8
+ .hide()
9
+ .appendTo(document.body)
10
+ .dialog(this.options.dialog)
11
+ .bind('dialogclose', $.proxy(this, 'onClose'))
12
+ .data('mediaBrowser', this);
13
+
14
+ this.wym = wym;
15
+
16
+ if (this.options.onInit) {
17
+ this.options.onInit();
18
+ }
19
+ };
20
+
21
+ MediaBrowser.prototype = {
22
+ defaults: {
23
+ dialogClass: 'media-browser',
24
+ contentSelector: 'img',
25
+ contentEvent: 'dblclick',
26
+ reloadOnOpen: true,
27
+ url: '/admin/photos/wym',
28
+ dialog: {
29
+ title: 'Media Browser',
30
+ autoOpen: false,
31
+ width: 900,
32
+ height: 700,
33
+ modal: true
34
+ },
35
+ onInit: null,
36
+ onLoad: null
37
+ },
38
+
39
+ open: function (targetElement) {
40
+ this.targetElement = targetElement = (targetElement && targetElement[0]) || targetElement;
41
+
42
+ this.element.dialog('open');
43
+
44
+ if (this.options.reloadOnOpen || !this.element[0].children.length) {
45
+ this.element.load(this.options.url, $.proxy(this, 'onLoad'));
46
+ } else {
47
+ this.onLoad();
48
+ }
49
+ },
50
+
51
+ onLoad: function () {
52
+ if (this.options.onLoad) {
53
+ this.options.onLoad();
54
+ }
55
+ },
56
+
57
+ onClose: function () {
58
+ this.element.removeData('targetElement');
59
+ this.targetElement = null;
60
+ },
61
+
62
+ insert: function (html, place) {
63
+ var container = $(this.wym.selected(), this.wym._doc);
64
+ targetElement = (place && typeof place === 'object') ?
65
+ place : this.targetElement;
66
+
67
+ switch (place) {
68
+ case 'prepend':
69
+ container.prepend(html);
70
+ break;
71
+ case 'append':
72
+ container.append(html);
73
+ break;
74
+ default: // replace
75
+ if (targetElement) {
76
+ $(targetElement, this.wym._doc).replaceWith(html);
77
+ } else {
78
+ this.wym.insert(html);
79
+ }
80
+ }
81
+ }
82
+ };
83
+
84
+ // Extend WYMeditor
85
+ WYMeditor.editor.prototype.initMediaBrowser = function(options) {
86
+ var browser = new MediaBrowser(options, this),
87
+ wym = this;
88
+
89
+ // Construct the button's html
90
+ var html = "<li class='wym_tools_media'>"
91
+ + "<a name='Media browser' href='#'"
92
+ + " style='background-image:"
93
+ + " url(" + wym._options.basePath +"plugins/mediabrowser/browser.png)'>"
94
+ + "Meda browser"
95
+ + "</a></li>",
96
+
97
+ // Add the button to the tools box
98
+ li = $(html).appendTo(
99
+ $(wym._box).find(wym._options.toolsSelector
100
+ + wym._options.toolsListSelector));
101
+
102
+ // Handle button click event
103
+ li.children('a').bind('click', function() {
104
+ browser.open(wym._selected_image);
105
+ });
106
+
107
+ // Handle events inside the editor
108
+ $(wym._doc).bind(browser.options.contentEvent, function (event) {
109
+ var target = $(event.target);
110
+ if (target.is(browser.options.contentSelector)) {
111
+ browser.open(target);
112
+ }
113
+ });
114
+ };
115
+ })(jQuery)
@@ -0,0 +1,91 @@
1
+ /*
2
+ * WYMeditor : what you see is What You Mean web-based editor
3
+ * Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
4
+ * Dual licensed under the MIT (MIT-license.txt)
5
+ * and GPL (GPL-license.txt) licenses.
6
+ *
7
+ * For further information visit:
8
+ * http://www.wymeditor.org/
9
+ *
10
+ * File Name:
11
+ * jquery.wymeditor.resizable.js
12
+ * resize plugin for WYMeditor
13
+ *
14
+ * File Authors:
15
+ * Peter Eschler (peschler _at_ gmail.com)
16
+ * Jean-Francois Hovinne - http://www.hovinne.com/
17
+ *
18
+ * Version:
19
+ * 0.4
20
+ *
21
+ * Changelog:
22
+ *
23
+ * 0.4
24
+ * - Removed UI and UI.resizable scripts loading - see #167 (jfh).
25
+ *
26
+ * 0.3
27
+ * - Added 'iframeOriginalSize' and removed 'ui.instance' calls (jfh).
28
+ *
29
+ * 0.2
30
+ * - Added full support for all jQueryUI resizable plugin options.
31
+ * - Refactored and documented code.
32
+ * 0.1
33
+ * - Initial release.
34
+ */
35
+
36
+ /**
37
+ * The resizable plugin makes the wymeditor box vertically resizable.
38
+ * It it based on the ui.resizable.js plugin of the jQuery UI library.
39
+ *
40
+ * The WYMeditor resizable plugin supports all parameters of the jQueryUI
41
+ * resizable plugin. The parameters are passed like this:
42
+ *
43
+ * wym.resizable({ handles: "s,e",
44
+ * maxHeight: 600 });
45
+ *
46
+ * DEPENDENCIES: jQuery UI, jQuery UI resizable
47
+ *
48
+ * @param options options for the plugin
49
+ */
50
+ WYMeditor.editor.prototype.resizable = function(options) {
51
+
52
+ var wym = this;
53
+ var iframe = jQuery(wym._box).find('iframe');
54
+ var iframeOriginalSize = {};
55
+
56
+ // Define some default options
57
+ var default_options = {
58
+ start: function(e, ui) {
59
+ iframeOriginalSize = {
60
+ width: jQuery(iframe).width(),
61
+ height: jQuery(iframe).height()
62
+ }
63
+ },
64
+
65
+ // resize is called by the jQuery resizable plugin whenever the
66
+ // client area was resized.
67
+ resize: function(e, ui) {
68
+ var diff = ui.size.height - ui.originalSize.height;
69
+ jQuery(iframe).height( iframeOriginalSize.height + diff );
70
+
71
+ // If the plugin has horizontal resizing disabled we need to
72
+ // adjust the "width" attribute of the area css, because the
73
+ // resizing will set a fixed width (which breaks liquid layout
74
+ // of the wymeditor area).
75
+ if( !ui.options.handles['w'] && !ui.options.handles['e'] ) {
76
+ ui.size.width = "inherit";
77
+ }
78
+ },
79
+ handles: "s,e,se",
80
+ minHeight: 250,
81
+ maxHeight: 600
82
+ };
83
+
84
+ // Merge given options with default options. Given options override
85
+ // default ones.
86
+ var final_options = jQuery.extend(default_options, options);
87
+
88
+ if(jQuery.isFunction( jQuery.fn.resizable )) jQuery(wym._box).resizable(final_options);
89
+ else WYMeditor.console.error('Oops, jQuery UI.resizable unavailable.');
90
+
91
+ };
@@ -0,0 +1,124 @@
1
+
2
+
3
+ resizable plugin for WYMeditor
4
+ ##############################
5
+
6
+ The ``resizable`` plugin for WYMeditor_ enables vertical resizing of the
7
+ editor area. The plugin is based on the jQuery UI library.
8
+
9
+ Requirements
10
+ ============
11
+ The following packages are required for using the WYMeditor ``resizable``
12
+ plugin:
13
+
14
+ * jQuery (tested with jQuery ``jquery-1.2.4a.js`` from ``jquery.ui`` package)
15
+ * WYMeditor SVN trunk (Revision: 482)
16
+ * jQuery-UI (tested with ``jquery.ui-1.5b2``)
17
+
18
+ It should be possible to use this plugin with ``WYMeditor-0.4`` but I have not
19
+ tried.
20
+
21
+ Download
22
+ ========
23
+ You can download the WYMeditor ``resizable`` plugin here:
24
+
25
+ * wymeditor-resizable-plugin-0.2.tgz_
26
+ * wymeditor-resizable-plugin-0.1.tgz_
27
+
28
+ See the Changelog_ for more infos about the releases.
29
+
30
+ .. _wymeditor-resizable-plugin-0.2.tgz: http://pyjax.net/download/wymeditor-resizable-plugin-0.2.tgz
31
+ .. _wymeditor-resizable-plugin-0.1.tgz: http://pyjax.net/download/wymeditor-resizable-plugin-0.1.tgz
32
+
33
+ Installation
34
+ ============
35
+ Just extract the downloaded archive into your WYMeditor's ``plugin``
36
+ directory.
37
+
38
+ Usage
39
+ =====
40
+ For general instructions on WYMeditor plugins please refer to the `WYMeditor
41
+ plugin page`_.
42
+
43
+ To use the ``resizable`` plugin simply include the plugin's JavaScript file in
44
+ your code. You **do not** need to include the jQuery UI files - this is done
45
+ automatically by the plugin (see `Internals`_)::
46
+
47
+ <script type="text/javascript"
48
+ src="/js/wymeditor/plugins/resizable/jquery.wymeditor.resizable.js">
49
+ </script>
50
+
51
+ Make sure to adjust the ``src`` attribute to your needs, then initialize the
52
+ plugin in WYMeditor's ``postInit`` function::
53
+
54
+ wymeditor({postInit: function(wym) {
55
+ wym.hovertools(); // other plugins...
56
+ wym.resizable({handles: "s,e",
57
+ maxHeight: 600});
58
+ }
59
+ })
60
+
61
+ The ``resizable`` plugin takes exactly one parameter, which is an object literal
62
+ containing the options of the plugin. The WYMeditor ``resizable`` plugin
63
+ supports all options of the jQuery UI ``resizable`` plugin. These are the
64
+ default values used by the plugin::
65
+
66
+ handles: "s,e,se",
67
+ minHeight: 250,
68
+ maxHeight: 600
69
+
70
+ See the `jQuery UI resizable plugin docs`_ for a list of all options.
71
+
72
+ That's it! You are now able to resize the WYMeditor vertically, horizontally or
73
+ both, depending on your options.
74
+
75
+ .. _jQuery UI resizable plugin docs: http://docs.jquery.com/UI/Resizables
76
+
77
+ Internals
78
+ =========
79
+ The plugin takes care of loading the necessary jQuery UI files (``base`` and
80
+ ``resizable``) from the same path the jQuery library was loaded. Here's how
81
+ it's done::
82
+
83
+ // Get the jQuery path from the editor, stripping away the jQuery file.
84
+ // see http://www.oreilly.com/catalog/regex/chapter/ch04.html
85
+ // The match result array contains the path and the filename.
86
+ var jQueryPath = wym.computeJqueryPath().match(/^(.*)\/(.*)$/)[1];
87
+
88
+ // Make an array of the external JavaScript files required by the plugin.
89
+ var jQueryPlugins = [jQueryPath + '/ui.base.js',
90
+ jQueryPath + '/ui.resizable.js'];
91
+
92
+ // First get the jQuery UI base file
93
+ $.getScript(jQueryPlugins[0]);
94
+
95
+ // Get the jQuery UI resizeable plugin and then init the wymeditor resizable
96
+ // plugin. It is import to do the initialisation after loading the
97
+ // necessary jQuery UI files has finished, otherwise the "resizable" method
98
+ // would not be available.
99
+ $.getScript(jQueryPlugins[1], function() {
100
+ jQuery(wym._box).resizable(final_options);
101
+ });
102
+
103
+ An alternative approach would be to use an AJAX queue when getting the script
104
+ files to ensure that all jQuery files are loaded before the initialisation code
105
+ of the plugin is executed. There is an `jQuery AJAX queue plugin`_ which does
106
+ that.
107
+
108
+ .. _jQuery AJAX queue plugin: http://plugins.jquery.com/project/ajaxqueue
109
+
110
+ Changelog
111
+ =========
112
+
113
+ 0.2
114
+ ---
115
+ - Added full support for all jQuery UI resizable plugin options.
116
+ - Refactored and documented code.
117
+ - Now contains a packed version (775 bytes).
118
+
119
+ 0.1
120
+ ---
121
+ - Initial release.
122
+
123
+ .. _WYMeditor: http://www.wymeditor.org/
124
+ .. _WYMeditor plugin page: http://trac.wymeditor.org/trac/wiki/0.4/Plugins
@@ -0,0 +1,19 @@
1
+ WYMeditor : what you see is What You Mean web-based editor
2
+ Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
3
+ Dual licensed under the MIT (MIT-license.txt)
4
+ and GPL (GPL-license.txt) licenses.
5
+
6
+ For further information visit:
7
+ http://www.wymeditor.org/
8
+
9
+ File Name:
10
+ README - HTML Tidy plugin for WYMeditor
11
+
12
+ File Authors:
13
+ Jean-François Hovinne (jf.hovinne a-t wymeditor dotorg)
14
+
15
+ Credits:
16
+ 'HTML Tidy' by Dave Ragget - http://tidy.sourceforge.net/
17
+ Icon 'wand' by Mark James - http://famfamfam.com/
18
+
19
+ WYMeditor documentation is available online at http://www.wymeditor.org/
@@ -0,0 +1,82 @@
1
+ /*
2
+ * WYMeditor : what you see is What You Mean web-based editor
3
+ * Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
4
+ * Dual licensed under the MIT (MIT-license.txt)
5
+ * and GPL (GPL-license.txt) licenses.
6
+ *
7
+ * For further information visit:
8
+ * http://www.wymeditor.org/
9
+ *
10
+ * File Name:
11
+ * jquery.wymeditor.tidy.js
12
+ * HTML Tidy plugin for WYMeditor
13
+ *
14
+ * File Authors:
15
+ * Jean-Francois Hovinne (jf.hovinne a-t wymeditor dotorg)
16
+ */
17
+
18
+ //Extend WYMeditor
19
+ WYMeditor.editor.prototype.tidy = function(options) {
20
+ var tidy = new WymTidy(options, this);
21
+ return(tidy);
22
+ };
23
+
24
+ //WymTidy constructor
25
+ function WymTidy(options, wym) {
26
+
27
+ options = jQuery.extend({
28
+
29
+ sUrl: wym._options.basePath + "plugins/tidy/tidy.php",
30
+ sButtonHtml: "<li class='wym_tools_tidy'>"
31
+ + "<a name='CleanUp' href='#'"
32
+ + " style='background-image:"
33
+ + " url(" + wym._options.basePath + "plugins/tidy/wand.png)'>"
34
+ + "Clean up HTML"
35
+ + "</a></li>",
36
+
37
+ sButtonSelector: "li.wym_tools_tidy a"
38
+
39
+ }, options);
40
+
41
+ this._options = options;
42
+ this._wym = wym;
43
+
44
+ };
45
+
46
+ //WymTidy initialization
47
+ WymTidy.prototype.init = function() {
48
+
49
+ var tidy = this;
50
+
51
+ jQuery(this._wym._box).find(
52
+ this._wym._options.toolsSelector + this._wym._options.toolsListSelector)
53
+ .append(this._options.sButtonHtml);
54
+
55
+ //handle click event
56
+ jQuery(this._wym._box).find(this._options.sButtonSelector).click(function() {
57
+ tidy.cleanup();
58
+ return(false);
59
+ });
60
+
61
+ };
62
+
63
+ //WymTidy cleanup
64
+ WymTidy.prototype.cleanup = function() {
65
+
66
+ var wym = this._wym;
67
+ var html = "<html><body>" + wym.xhtml() + "</body></html>";
68
+
69
+ jQuery.post(this._options.sUrl, { html: html}, function(data) {
70
+
71
+ if(data.length > 0 && data != '0') {
72
+ if(data.indexOf("<?php") == 0) {
73
+ wym.status("Ooops... Is PHP installed?");
74
+ } else {
75
+ wym.html(data);
76
+ wym.status("HTML has been cleaned up.");
77
+ }
78
+ } else {
79
+ wym.status("An error occurred.");
80
+ }
81
+ });
82
+ };