mirador_rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +5 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.txt +13 -0
  7. data/README.md +97 -0
  8. data/Rakefile +6 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/lib/mirador_rails.rb +16 -0
  12. data/lib/mirador_rails/version.rb +3 -0
  13. data/lib/mirador_rails/view_helpers.rb +30 -0
  14. data/mirador_rails.gemspec +30 -0
  15. data/vendor/assets/images/border_type_1.png +0 -0
  16. data/vendor/assets/images/border_type_2.png +0 -0
  17. data/vendor/assets/images/border_type_3.png +0 -0
  18. data/vendor/assets/images/debut_dark.png +0 -0
  19. data/vendor/assets/javascripts/mirador.js +1 -0
  20. data/vendor/assets/javascripts/mirador.min.js +88 -0
  21. data/vendor/assets/javascripts/mirador.min.js.map +1 -0
  22. data/vendor/assets/locales/ar/translation.json +42 -0
  23. data/vendor/assets/locales/de/translation.json +77 -0
  24. data/vendor/assets/locales/en/translation.json +82 -0
  25. data/vendor/assets/locales/es/translation.json +35 -0
  26. data/vendor/assets/locales/fr/translation.json +77 -0
  27. data/vendor/assets/locales/ga/translation.json +39 -0
  28. data/vendor/assets/locales/ja/translation.json +82 -0
  29. data/vendor/assets/locales/ko/translation.json +74 -0
  30. data/vendor/assets/locales/nl/translation.json +39 -0
  31. data/vendor/assets/locales/zh-CN/translation.json +74 -0
  32. data/vendor/assets/locales/zh-TW/translation.json +74 -0
  33. data/vendor/assets/locales/zh/translation.json +74 -0
  34. data/vendor/assets/plugins/plugins/advlist/plugin.js +97 -0
  35. data/vendor/assets/plugins/plugins/advlist/plugin.min.js +1 -0
  36. data/vendor/assets/plugins/plugins/anchor/plugin.js +45 -0
  37. data/vendor/assets/plugins/plugins/anchor/plugin.min.js +1 -0
  38. data/vendor/assets/plugins/plugins/autolink/plugin.js +194 -0
  39. data/vendor/assets/plugins/plugins/autolink/plugin.min.js +1 -0
  40. data/vendor/assets/plugins/plugins/autoresize/plugin.js +152 -0
  41. data/vendor/assets/plugins/plugins/autoresize/plugin.min.js +1 -0
  42. data/vendor/assets/plugins/plugins/autosave/plugin.js +165 -0
  43. data/vendor/assets/plugins/plugins/autosave/plugin.min.js +1 -0
  44. data/vendor/assets/plugins/plugins/bbcode/plugin.js +123 -0
  45. data/vendor/assets/plugins/plugins/bbcode/plugin.min.js +1 -0
  46. data/vendor/assets/plugins/plugins/charmap/plugin.js +370 -0
  47. data/vendor/assets/plugins/plugins/charmap/plugin.min.js +1 -0
  48. data/vendor/assets/plugins/plugins/code/plugin.js +60 -0
  49. data/vendor/assets/plugins/plugins/code/plugin.min.js +1 -0
  50. data/vendor/assets/plugins/plugins/colorpicker/plugin.js +112 -0
  51. data/vendor/assets/plugins/plugins/colorpicker/plugin.min.js +1 -0
  52. data/vendor/assets/plugins/plugins/compat3x/css/dialog.css +118 -0
  53. data/vendor/assets/plugins/plugins/compat3x/img/buttons.png +0 -0
  54. data/vendor/assets/plugins/plugins/compat3x/img/icons.gif +0 -0
  55. data/vendor/assets/plugins/plugins/compat3x/img/items.gif +0 -0
  56. data/vendor/assets/plugins/plugins/compat3x/img/menu_arrow.gif +0 -0
  57. data/vendor/assets/plugins/plugins/compat3x/img/menu_check.gif +0 -0
  58. data/vendor/assets/plugins/plugins/compat3x/img/progress.gif +0 -0
  59. data/vendor/assets/plugins/plugins/compat3x/img/tabs.gif +0 -0
  60. data/vendor/assets/plugins/plugins/compat3x/plugin.js +297 -0
  61. data/vendor/assets/plugins/plugins/compat3x/plugin.min.js +1 -0
  62. data/vendor/assets/plugins/plugins/compat3x/tiny_mce_popup.js +542 -0
  63. data/vendor/assets/plugins/plugins/compat3x/utils/editable_selects.js +70 -0
  64. data/vendor/assets/plugins/plugins/compat3x/utils/form_utils.js +210 -0
  65. data/vendor/assets/plugins/plugins/compat3x/utils/mctabs.js +164 -0
  66. data/vendor/assets/plugins/plugins/compat3x/utils/validate.js +252 -0
  67. data/vendor/assets/plugins/plugins/contextmenu/plugin.js +87 -0
  68. data/vendor/assets/plugins/plugins/contextmenu/plugin.min.js +1 -0
  69. data/vendor/assets/plugins/plugins/directionality/plugin.js +64 -0
  70. data/vendor/assets/plugins/plugins/directionality/plugin.min.js +1 -0
  71. data/vendor/assets/plugins/plugins/emoticons/img/smiley-cool.gif +0 -0
  72. data/vendor/assets/plugins/plugins/emoticons/img/smiley-cry.gif +0 -0
  73. data/vendor/assets/plugins/plugins/emoticons/img/smiley-embarassed.gif +0 -0
  74. data/vendor/assets/plugins/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
  75. data/vendor/assets/plugins/plugins/emoticons/img/smiley-frown.gif +0 -0
  76. data/vendor/assets/plugins/plugins/emoticons/img/smiley-innocent.gif +0 -0
  77. data/vendor/assets/plugins/plugins/emoticons/img/smiley-kiss.gif +0 -0
  78. data/vendor/assets/plugins/plugins/emoticons/img/smiley-laughing.gif +0 -0
  79. data/vendor/assets/plugins/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
  80. data/vendor/assets/plugins/plugins/emoticons/img/smiley-sealed.gif +0 -0
  81. data/vendor/assets/plugins/plugins/emoticons/img/smiley-smile.gif +0 -0
  82. data/vendor/assets/plugins/plugins/emoticons/img/smiley-surprised.gif +0 -0
  83. data/vendor/assets/plugins/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
  84. data/vendor/assets/plugins/plugins/emoticons/img/smiley-undecided.gif +0 -0
  85. data/vendor/assets/plugins/plugins/emoticons/img/smiley-wink.gif +0 -0
  86. data/vendor/assets/plugins/plugins/emoticons/img/smiley-yell.gif +0 -0
  87. data/vendor/assets/plugins/plugins/emoticons/plugin.js +65 -0
  88. data/vendor/assets/plugins/plugins/emoticons/plugin.min.js +1 -0
  89. data/vendor/assets/plugins/plugins/example/dialog.html +8 -0
  90. data/vendor/assets/plugins/plugins/example/plugin.js +68 -0
  91. data/vendor/assets/plugins/plugins/example/plugin.min.js +1 -0
  92. data/vendor/assets/plugins/plugins/example_dependency/plugin.js +22 -0
  93. data/vendor/assets/plugins/plugins/example_dependency/plugin.min.js +1 -0
  94. data/vendor/assets/plugins/plugins/fullpage/plugin.js +490 -0
  95. data/vendor/assets/plugins/plugins/fullpage/plugin.min.js +1 -0
  96. data/vendor/assets/plugins/plugins/fullscreen/plugin.js +136 -0
  97. data/vendor/assets/plugins/plugins/fullscreen/plugin.min.js +1 -0
  98. data/vendor/assets/plugins/plugins/hr/plugin.js +30 -0
  99. data/vendor/assets/plugins/plugins/hr/plugin.min.js +1 -0
  100. data/vendor/assets/plugins/plugins/image/plugin.js +439 -0
  101. data/vendor/assets/plugins/plugins/image/plugin.min.js +1 -0
  102. data/vendor/assets/plugins/plugins/importcss/plugin.js +195 -0
  103. data/vendor/assets/plugins/plugins/importcss/plugin.min.js +1 -0
  104. data/vendor/assets/plugins/plugins/insertdatetime/plugin.js +121 -0
  105. data/vendor/assets/plugins/plugins/insertdatetime/plugin.min.js +1 -0
  106. data/vendor/assets/plugins/plugins/layer/plugin.js +225 -0
  107. data/vendor/assets/plugins/plugins/layer/plugin.min.js +1 -0
  108. data/vendor/assets/plugins/plugins/legacyoutput/plugin.js +211 -0
  109. data/vendor/assets/plugins/plugins/legacyoutput/plugin.min.js +1 -0
  110. data/vendor/assets/plugins/plugins/link/plugin.js +400 -0
  111. data/vendor/assets/plugins/plugins/link/plugin.min.js +1 -0
  112. data/vendor/assets/plugins/plugins/lists/plugin.js +791 -0
  113. data/vendor/assets/plugins/plugins/lists/plugin.min.js +1 -0
  114. data/vendor/assets/plugins/plugins/media/moxieplayer.swf +0 -0
  115. data/vendor/assets/plugins/plugins/media/plugin.js +774 -0
  116. data/vendor/assets/plugins/plugins/media/plugin.min.js +1 -0
  117. data/vendor/assets/plugins/plugins/nonbreaking/plugin.js +53 -0
  118. data/vendor/assets/plugins/plugins/nonbreaking/plugin.min.js +1 -0
  119. data/vendor/assets/plugins/plugins/noneditable/plugin.js +540 -0
  120. data/vendor/assets/plugins/plugins/noneditable/plugin.min.js +1 -0
  121. data/vendor/assets/plugins/plugins/pagebreak/plugin.js +88 -0
  122. data/vendor/assets/plugins/plugins/pagebreak/plugin.min.js +1 -0
  123. data/vendor/assets/plugins/plugins/paste/classes/Clipboard.js +634 -0
  124. data/vendor/assets/plugins/plugins/paste/classes/Plugin.js +110 -0
  125. data/vendor/assets/plugins/plugins/paste/classes/Quirks.js +159 -0
  126. data/vendor/assets/plugins/plugins/paste/classes/Utils.js +130 -0
  127. data/vendor/assets/plugins/plugins/paste/classes/WordFilter.js +493 -0
  128. data/vendor/assets/plugins/plugins/paste/plugin.dev.js +120 -0
  129. data/vendor/assets/plugins/plugins/paste/plugin.js +1625 -0
  130. data/vendor/assets/plugins/plugins/paste/plugin.min.js +1 -0
  131. data/vendor/assets/plugins/plugins/preview/plugin.js +88 -0
  132. data/vendor/assets/plugins/plugins/preview/plugin.min.js +1 -0
  133. data/vendor/assets/plugins/plugins/print/plugin.js +32 -0
  134. data/vendor/assets/plugins/plugins/print/plugin.min.js +1 -0
  135. data/vendor/assets/plugins/plugins/save/plugin.js +94 -0
  136. data/vendor/assets/plugins/plugins/save/plugin.min.js +1 -0
  137. data/vendor/assets/plugins/plugins/searchreplace/plugin.js +594 -0
  138. data/vendor/assets/plugins/plugins/searchreplace/plugin.min.js +1 -0
  139. data/vendor/assets/plugins/plugins/spellchecker/classes/DomTextMatcher.js +470 -0
  140. data/vendor/assets/plugins/plugins/spellchecker/classes/Plugin.js +436 -0
  141. data/vendor/assets/plugins/plugins/spellchecker/plugin.dev.js +117 -0
  142. data/vendor/assets/plugins/plugins/spellchecker/plugin.js +996 -0
  143. data/vendor/assets/plugins/plugins/spellchecker/plugin.min.js +1 -0
  144. data/vendor/assets/plugins/plugins/tabfocus/plugin.js +120 -0
  145. data/vendor/assets/plugins/plugins/tabfocus/plugin.min.js +1 -0
  146. data/vendor/assets/plugins/plugins/table/classes/CellSelection.js +176 -0
  147. data/vendor/assets/plugins/plugins/table/classes/Dialogs.js +749 -0
  148. data/vendor/assets/plugins/plugins/table/classes/Plugin.js +422 -0
  149. data/vendor/assets/plugins/plugins/table/classes/Quirks.js +372 -0
  150. data/vendor/assets/plugins/plugins/table/classes/TableGrid.js +864 -0
  151. data/vendor/assets/plugins/plugins/table/plugin.dev.js +118 -0
  152. data/vendor/assets/plugins/plugins/table/plugin.js +2680 -0
  153. data/vendor/assets/plugins/plugins/table/plugin.min.js +1 -0
  154. data/vendor/assets/plugins/plugins/template/plugin.js +262 -0
  155. data/vendor/assets/plugins/plugins/template/plugin.min.js +1 -0
  156. data/vendor/assets/plugins/plugins/textcolor/plugin.js +272 -0
  157. data/vendor/assets/plugins/plugins/textcolor/plugin.min.js +1 -0
  158. data/vendor/assets/plugins/plugins/textpattern/plugin.js +268 -0
  159. data/vendor/assets/plugins/plugins/textpattern/plugin.min.js +1 -0
  160. data/vendor/assets/plugins/plugins/visualblocks/css/visualblocks.css +135 -0
  161. data/vendor/assets/plugins/plugins/visualblocks/img/address.gif +0 -0
  162. data/vendor/assets/plugins/plugins/visualblocks/img/article.gif +0 -0
  163. data/vendor/assets/plugins/plugins/visualblocks/img/aside.gif +0 -0
  164. data/vendor/assets/plugins/plugins/visualblocks/img/blockquote.gif +0 -0
  165. data/vendor/assets/plugins/plugins/visualblocks/img/div.gif +0 -0
  166. data/vendor/assets/plugins/plugins/visualblocks/img/dl.gif +0 -0
  167. data/vendor/assets/plugins/plugins/visualblocks/img/figure.gif +0 -0
  168. data/vendor/assets/plugins/plugins/visualblocks/img/h1.gif +0 -0
  169. data/vendor/assets/plugins/plugins/visualblocks/img/h2.gif +0 -0
  170. data/vendor/assets/plugins/plugins/visualblocks/img/h3.gif +0 -0
  171. data/vendor/assets/plugins/plugins/visualblocks/img/h4.gif +0 -0
  172. data/vendor/assets/plugins/plugins/visualblocks/img/h5.gif +0 -0
  173. data/vendor/assets/plugins/plugins/visualblocks/img/h6.gif +0 -0
  174. data/vendor/assets/plugins/plugins/visualblocks/img/hgroup.gif +0 -0
  175. data/vendor/assets/plugins/plugins/visualblocks/img/ol.gif +0 -0
  176. data/vendor/assets/plugins/plugins/visualblocks/img/p.gif +0 -0
  177. data/vendor/assets/plugins/plugins/visualblocks/img/pre.gif +0 -0
  178. data/vendor/assets/plugins/plugins/visualblocks/img/section.gif +0 -0
  179. data/vendor/assets/plugins/plugins/visualblocks/img/ul.gif +0 -0
  180. data/vendor/assets/plugins/plugins/visualblocks/plugin.js +86 -0
  181. data/vendor/assets/plugins/plugins/visualblocks/plugin.min.js +1 -0
  182. data/vendor/assets/plugins/plugins/visualchars/plugin.js +88 -0
  183. data/vendor/assets/plugins/plugins/visualchars/plugin.min.js +1 -0
  184. data/vendor/assets/plugins/plugins/wordcount/plugin.js +69 -0
  185. data/vendor/assets/plugins/plugins/wordcount/plugin.min.js +1 -0
  186. data/vendor/assets/skins/skins/lightgray/content.inline.min.css +1 -0
  187. data/vendor/assets/skins/skins/lightgray/content.min.css +1 -0
  188. data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.eot +0 -0
  189. data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.svg +62 -0
  190. data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.ttf +0 -0
  191. data/vendor/assets/skins/skins/lightgray/fonts/tinymce-small.woff +0 -0
  192. data/vendor/assets/skins/skins/lightgray/fonts/tinymce.eot +0 -0
  193. data/vendor/assets/skins/skins/lightgray/fonts/tinymce.svg +63 -0
  194. data/vendor/assets/skins/skins/lightgray/fonts/tinymce.ttf +0 -0
  195. data/vendor/assets/skins/skins/lightgray/fonts/tinymce.woff +0 -0
  196. data/vendor/assets/skins/skins/lightgray/img/anchor.gif +0 -0
  197. data/vendor/assets/skins/skins/lightgray/img/loader.gif +0 -0
  198. data/vendor/assets/skins/skins/lightgray/img/object.gif +0 -0
  199. data/vendor/assets/skins/skins/lightgray/img/trans.gif +0 -0
  200. data/vendor/assets/skins/skins/lightgray/skin.ie7.min.css +1 -0
  201. data/vendor/assets/skins/skins/lightgray/skin.min.css +1 -0
  202. data/vendor/assets/stylesheets/mirador-combined.css +3969 -0
  203. data/vendor/assets/stylesheets/mirador.css +11 -0
  204. data/vendor/assets/themes/themes/modern/theme.js +617 -0
  205. data/vendor/assets/themes/themes/modern/theme.min.js +1 -0
  206. metadata +318 -0
@@ -0,0 +1,70 @@
1
+ /**
2
+ * editable_selects.js
3
+ *
4
+ * Copyright, Moxiecode Systems AB
5
+ * Released under LGPL License.
6
+ *
7
+ * License: http://www.tinymce.com/license
8
+ * Contributing: http://www.tinymce.com/contributing
9
+ */
10
+
11
+ var TinyMCE_EditableSelects = {
12
+ editSelectElm : null,
13
+
14
+ init : function() {
15
+ var nl = document.getElementsByTagName("select"), i, d = document, o;
16
+
17
+ for (i=0; i<nl.length; i++) {
18
+ if (nl[i].className.indexOf('mceEditableSelect') != -1) {
19
+ o = new Option(tinyMCEPopup.editor.translate('value'), '__mce_add_custom__');
20
+
21
+ o.className = 'mceAddSelectValue';
22
+
23
+ nl[i].options[nl[i].options.length] = o;
24
+ nl[i].onchange = TinyMCE_EditableSelects.onChangeEditableSelect;
25
+ }
26
+ }
27
+ },
28
+
29
+ onChangeEditableSelect : function(e) {
30
+ var d = document, ne, se = window.event ? window.event.srcElement : e.target;
31
+
32
+ if (se.options[se.selectedIndex].value == '__mce_add_custom__') {
33
+ ne = d.createElement("input");
34
+ ne.id = se.id + "_custom";
35
+ ne.name = se.name + "_custom";
36
+ ne.type = "text";
37
+
38
+ ne.style.width = se.offsetWidth + 'px';
39
+ se.parentNode.insertBefore(ne, se);
40
+ se.style.display = 'none';
41
+ ne.focus();
42
+ ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput;
43
+ ne.onkeydown = TinyMCE_EditableSelects.onKeyDown;
44
+ TinyMCE_EditableSelects.editSelectElm = se;
45
+ }
46
+ },
47
+
48
+ onBlurEditableSelectInput : function() {
49
+ var se = TinyMCE_EditableSelects.editSelectElm;
50
+
51
+ if (se) {
52
+ if (se.previousSibling.value != '') {
53
+ addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value);
54
+ selectByValue(document.forms[0], se.id, se.previousSibling.value);
55
+ } else
56
+ selectByValue(document.forms[0], se.id, '');
57
+
58
+ se.style.display = 'inline';
59
+ se.parentNode.removeChild(se.previousSibling);
60
+ TinyMCE_EditableSelects.editSelectElm = null;
61
+ }
62
+ },
63
+
64
+ onKeyDown : function(e) {
65
+ e = e || window.event;
66
+
67
+ if (e.keyCode == 13)
68
+ TinyMCE_EditableSelects.onBlurEditableSelectInput();
69
+ }
70
+ };
@@ -0,0 +1,210 @@
1
+ /**
2
+ * form_utils.js
3
+ *
4
+ * Copyright, Moxiecode Systems AB
5
+ * Released under LGPL License.
6
+ *
7
+ * License: http://www.tinymce.com/license
8
+ * Contributing: http://www.tinymce.com/contributing
9
+ */
10
+
11
+ var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme"));
12
+
13
+ function getColorPickerHTML(id, target_form_element) {
14
+ var h = "", dom = tinyMCEPopup.dom;
15
+
16
+ if (label = dom.select('label[for=' + target_form_element + ']')[0]) {
17
+ label.id = label.id || dom.uniqueId();
18
+ }
19
+
20
+ h += '<a role="button" aria-labelledby="' + id + '_label" id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">';
21
+ h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '">&nbsp;<span id="' + id + '_label" class="mceVoiceLabel mceIconOnly" style="display:none;">' + tinyMCEPopup.getLang('browse') + '</span></span></a>';
22
+
23
+ return h;
24
+ }
25
+
26
+ function updateColor(img_id, form_element_id) {
27
+ document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
28
+ }
29
+
30
+ function setBrowserDisabled(id, state) {
31
+ var img = document.getElementById(id);
32
+ var lnk = document.getElementById(id + "_link");
33
+
34
+ if (lnk) {
35
+ if (state) {
36
+ lnk.setAttribute("realhref", lnk.getAttribute("href"));
37
+ lnk.removeAttribute("href");
38
+ tinyMCEPopup.dom.addClass(img, 'disabled');
39
+ } else {
40
+ if (lnk.getAttribute("realhref"))
41
+ lnk.setAttribute("href", lnk.getAttribute("realhref"));
42
+
43
+ tinyMCEPopup.dom.removeClass(img, 'disabled');
44
+ }
45
+ }
46
+ }
47
+
48
+ function getBrowserHTML(id, target_form_element, type, prefix) {
49
+ var option = prefix + "_" + type + "_browser_callback", cb, html;
50
+
51
+ cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback"));
52
+
53
+ if (!cb)
54
+ return "";
55
+
56
+ html = "";
57
+ html += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">';
58
+ html += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '">&nbsp;</span></a>';
59
+
60
+ return html;
61
+ }
62
+
63
+ function openBrowser(img_id, target_form_element, type, option) {
64
+ var img = document.getElementById(img_id);
65
+
66
+ if (img.className != "mceButtonDisabled")
67
+ tinyMCEPopup.openBrowser(target_form_element, type, option);
68
+ }
69
+
70
+ function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
71
+ if (!form_obj || !form_obj.elements[field_name])
72
+ return;
73
+
74
+ if (!value)
75
+ value = "";
76
+
77
+ var sel = form_obj.elements[field_name];
78
+
79
+ var found = false;
80
+ for (var i=0; i<sel.options.length; i++) {
81
+ var option = sel.options[i];
82
+
83
+ if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
84
+ option.selected = true;
85
+ found = true;
86
+ } else
87
+ option.selected = false;
88
+ }
89
+
90
+ if (!found && add_custom && value != '') {
91
+ var option = new Option(value, value);
92
+ option.selected = true;
93
+ sel.options[sel.options.length] = option;
94
+ sel.selectedIndex = sel.options.length - 1;
95
+ }
96
+
97
+ return found;
98
+ }
99
+
100
+ function getSelectValue(form_obj, field_name) {
101
+ var elm = form_obj.elements[field_name];
102
+
103
+ if (elm == null || elm.options == null || elm.selectedIndex === -1)
104
+ return "";
105
+
106
+ return elm.options[elm.selectedIndex].value;
107
+ }
108
+
109
+ function addSelectValue(form_obj, field_name, name, value) {
110
+ var s = form_obj.elements[field_name];
111
+ var o = new Option(name, value);
112
+ s.options[s.options.length] = o;
113
+ }
114
+
115
+ function addClassesToList(list_id, specific_option) {
116
+ // Setup class droplist
117
+ var styleSelectElm = document.getElementById(list_id);
118
+ var styles = tinyMCEPopup.getParam('theme_advanced_styles', false);
119
+ styles = tinyMCEPopup.getParam(specific_option, styles);
120
+
121
+ if (styles) {
122
+ var stylesAr = styles.split(';');
123
+
124
+ for (var i=0; i<stylesAr.length; i++) {
125
+ if (stylesAr != "") {
126
+ var key, value;
127
+
128
+ key = stylesAr[i].split('=')[0];
129
+ value = stylesAr[i].split('=')[1];
130
+
131
+ styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
132
+ }
133
+ }
134
+ } else {
135
+ /*tinymce.each(tinyMCEPopup.editor.dom.getClasses(), function(o) {
136
+ styleSelectElm.options[styleSelectElm.length] = new Option(o.title || o['class'], o['class']);
137
+ });*/
138
+ }
139
+ }
140
+
141
+ function isVisible(element_id) {
142
+ var elm = document.getElementById(element_id);
143
+
144
+ return elm && elm.style.display != "none";
145
+ }
146
+
147
+ function convertRGBToHex(col) {
148
+ var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
149
+
150
+ var rgb = col.replace(re, "$1,$2,$3").split(',');
151
+ if (rgb.length == 3) {
152
+ r = parseInt(rgb[0]).toString(16);
153
+ g = parseInt(rgb[1]).toString(16);
154
+ b = parseInt(rgb[2]).toString(16);
155
+
156
+ r = r.length == 1 ? '0' + r : r;
157
+ g = g.length == 1 ? '0' + g : g;
158
+ b = b.length == 1 ? '0' + b : b;
159
+
160
+ return "#" + r + g + b;
161
+ }
162
+
163
+ return col;
164
+ }
165
+
166
+ function convertHexToRGB(col) {
167
+ if (col.indexOf('#') != -1) {
168
+ col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
169
+
170
+ r = parseInt(col.substring(0, 2), 16);
171
+ g = parseInt(col.substring(2, 4), 16);
172
+ b = parseInt(col.substring(4, 6), 16);
173
+
174
+ return "rgb(" + r + "," + g + "," + b + ")";
175
+ }
176
+
177
+ return col;
178
+ }
179
+
180
+ function trimSize(size) {
181
+ return size.replace(/([0-9\.]+)(px|%|in|cm|mm|em|ex|pt|pc)/i, '$1$2');
182
+ }
183
+
184
+ function getCSSSize(size) {
185
+ size = trimSize(size);
186
+
187
+ if (size == "")
188
+ return "";
189
+
190
+ // Add px
191
+ if (/^[0-9]+$/.test(size))
192
+ size += 'px';
193
+ // Sanity check, IE doesn't like broken values
194
+ else if (!(/^[0-9\.]+(px|%|in|cm|mm|em|ex|pt|pc)$/i.test(size)))
195
+ return "";
196
+
197
+ return size;
198
+ }
199
+
200
+ function getStyle(elm, attrib, style) {
201
+ var val = tinyMCEPopup.dom.getAttrib(elm, attrib);
202
+
203
+ if (val != '')
204
+ return '' + val;
205
+
206
+ if (typeof(style) == 'undefined')
207
+ style = attrib;
208
+
209
+ return tinyMCEPopup.dom.getStyle(elm, style);
210
+ }
@@ -0,0 +1,164 @@
1
+ /**
2
+ * mctabs.js
3
+ *
4
+ * Copyright, Moxiecode Systems AB
5
+ * Released under LGPL License.
6
+ *
7
+ * License: http://www.tinymce.com/license
8
+ * Contributing: http://www.tinymce.com/contributing
9
+ */
10
+
11
+ /*jshint globals: tinyMCEPopup */
12
+
13
+ function MCTabs() {
14
+ this.settings = [];
15
+ this.onChange = tinyMCEPopup.editor.windowManager.createInstance('tinymce.util.Dispatcher');
16
+ };
17
+
18
+ MCTabs.prototype.init = function(settings) {
19
+ this.settings = settings;
20
+ };
21
+
22
+ MCTabs.prototype.getParam = function(name, default_value) {
23
+ var value = null;
24
+
25
+ value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
26
+
27
+ // Fix bool values
28
+ if (value == "true" || value == "false")
29
+ return (value == "true");
30
+
31
+ return value;
32
+ };
33
+
34
+ MCTabs.prototype.showTab =function(tab){
35
+ tab.className = 'current';
36
+ tab.setAttribute("aria-selected", true);
37
+ tab.setAttribute("aria-expanded", true);
38
+ tab.tabIndex = 0;
39
+ };
40
+
41
+ MCTabs.prototype.hideTab =function(tab){
42
+ var t=this;
43
+
44
+ tab.className = '';
45
+ tab.setAttribute("aria-selected", false);
46
+ tab.setAttribute("aria-expanded", false);
47
+ tab.tabIndex = -1;
48
+ };
49
+
50
+ MCTabs.prototype.showPanel = function(panel) {
51
+ panel.className = 'current';
52
+ panel.setAttribute("aria-hidden", false);
53
+ };
54
+
55
+ MCTabs.prototype.hidePanel = function(panel) {
56
+ panel.className = 'panel';
57
+ panel.setAttribute("aria-hidden", true);
58
+ };
59
+
60
+ MCTabs.prototype.getPanelForTab = function(tabElm) {
61
+ return tinyMCEPopup.dom.getAttrib(tabElm, "aria-controls");
62
+ };
63
+
64
+ MCTabs.prototype.displayTab = function(tab_id, panel_id, avoid_focus) {
65
+ var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i, t = this;
66
+
67
+ tabElm = document.getElementById(tab_id);
68
+
69
+ if (panel_id === undefined) {
70
+ panel_id = t.getPanelForTab(tabElm);
71
+ }
72
+
73
+ panelElm= document.getElementById(panel_id);
74
+ panelContainerElm = panelElm ? panelElm.parentNode : null;
75
+ tabContainerElm = tabElm ? tabElm.parentNode : null;
76
+ selectionClass = t.getParam('selection_class', 'current');
77
+
78
+ if (tabElm && tabContainerElm) {
79
+ nodes = tabContainerElm.childNodes;
80
+
81
+ // Hide all other tabs
82
+ for (i = 0; i < nodes.length; i++) {
83
+ if (nodes[i].nodeName == "LI") {
84
+ t.hideTab(nodes[i]);
85
+ }
86
+ }
87
+
88
+ // Show selected tab
89
+ t.showTab(tabElm);
90
+ }
91
+
92
+ if (panelElm && panelContainerElm) {
93
+ nodes = panelContainerElm.childNodes;
94
+
95
+ // Hide all other panels
96
+ for (i = 0; i < nodes.length; i++) {
97
+ if (nodes[i].nodeName == "DIV")
98
+ t.hidePanel(nodes[i]);
99
+ }
100
+
101
+ if (!avoid_focus) {
102
+ tabElm.focus();
103
+ }
104
+
105
+ // Show selected panel
106
+ t.showPanel(panelElm);
107
+ }
108
+ };
109
+
110
+ MCTabs.prototype.getAnchor = function() {
111
+ var pos, url = document.location.href;
112
+
113
+ if ((pos = url.lastIndexOf('#')) != -1)
114
+ return url.substring(pos + 1);
115
+
116
+ return "";
117
+ };
118
+
119
+
120
+ //Global instance
121
+ var mcTabs = new MCTabs();
122
+
123
+ tinyMCEPopup.onInit.add(function() {
124
+ var tinymce = tinyMCEPopup.getWin().tinymce, dom = tinyMCEPopup.dom, each = tinymce.each;
125
+
126
+ each(dom.select('div.tabs'), function(tabContainerElm) {
127
+ //var keyNav;
128
+
129
+ dom.setAttrib(tabContainerElm, "role", "tablist");
130
+
131
+ var items = tinyMCEPopup.dom.select('li', tabContainerElm);
132
+ var action = function(id) {
133
+ mcTabs.displayTab(id, mcTabs.getPanelForTab(id));
134
+ mcTabs.onChange.dispatch(id);
135
+ };
136
+
137
+ each(items, function(item) {
138
+ dom.setAttrib(item, 'role', 'tab');
139
+ dom.bind(item, 'click', function(evt) {
140
+ action(item.id);
141
+ });
142
+ });
143
+
144
+ dom.bind(dom.getRoot(), 'keydown', function(evt) {
145
+ if (evt.keyCode === 9 && evt.ctrlKey && !evt.altKey) { // Tab
146
+ //keyNav.moveFocus(evt.shiftKey ? -1 : 1);
147
+ tinymce.dom.Event.cancel(evt);
148
+ }
149
+ });
150
+
151
+ each(dom.select('a', tabContainerElm), function(a) {
152
+ dom.setAttrib(a, 'tabindex', '-1');
153
+ });
154
+
155
+ /*keyNav = tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {
156
+ root: tabContainerElm,
157
+ items: items,
158
+ onAction: action,
159
+ actOnFocus: true,
160
+ enableLeftRight: true,
161
+ enableUpDown: true
162
+ }, tinyMCEPopup.dom);*/
163
+ });
164
+ });
@@ -0,0 +1,252 @@
1
+ /**
2
+ * validate.js
3
+ *
4
+ * Copyright, Moxiecode Systems AB
5
+ * Released under LGPL License.
6
+ *
7
+ * License: http://www.tinymce.com/license
8
+ * Contributing: http://www.tinymce.com/contributing
9
+ */
10
+
11
+ /**
12
+ // String validation:
13
+
14
+ if (!Validator.isEmail('myemail'))
15
+ alert('Invalid email.');
16
+
17
+ // Form validation:
18
+
19
+ var f = document.forms['myform'];
20
+
21
+ if (!Validator.isEmail(f.myemail))
22
+ alert('Invalid email.');
23
+ */
24
+
25
+ var Validator = {
26
+ isEmail : function(s) {
27
+ return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
28
+ },
29
+
30
+ isAbsUrl : function(s) {
31
+ return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
32
+ },
33
+
34
+ isSize : function(s) {
35
+ return this.test(s, '^[0-9.]+(%|in|cm|mm|em|ex|pt|pc|px)?$');
36
+ },
37
+
38
+ isId : function(s) {
39
+ return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
40
+ },
41
+
42
+ isEmpty : function(s) {
43
+ var nl, i;
44
+
45
+ if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
46
+ return true;
47
+
48
+ if (s.type == 'checkbox' && !s.checked)
49
+ return true;
50
+
51
+ if (s.type == 'radio') {
52
+ for (i=0, nl = s.form.elements; i<nl.length; i++) {
53
+ if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
54
+ return false;
55
+ }
56
+
57
+ return true;
58
+ }
59
+
60
+ return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
61
+ },
62
+
63
+ isNumber : function(s, d) {
64
+ return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
65
+ },
66
+
67
+ test : function(s, p) {
68
+ s = s.nodeType == 1 ? s.value : s;
69
+
70
+ return s == '' || new RegExp(p).test(s);
71
+ }
72
+ };
73
+
74
+ var AutoValidator = {
75
+ settings : {
76
+ id_cls : 'id',
77
+ int_cls : 'int',
78
+ url_cls : 'url',
79
+ number_cls : 'number',
80
+ email_cls : 'email',
81
+ size_cls : 'size',
82
+ required_cls : 'required',
83
+ invalid_cls : 'invalid',
84
+ min_cls : 'min',
85
+ max_cls : 'max'
86
+ },
87
+
88
+ init : function(s) {
89
+ var n;
90
+
91
+ for (n in s)
92
+ this.settings[n] = s[n];
93
+ },
94
+
95
+ validate : function(f) {
96
+ var i, nl, s = this.settings, c = 0;
97
+
98
+ nl = this.tags(f, 'label');
99
+ for (i=0; i<nl.length; i++) {
100
+ this.removeClass(nl[i], s.invalid_cls);
101
+ nl[i].setAttribute('aria-invalid', false);
102
+ }
103
+
104
+ c += this.validateElms(f, 'input');
105
+ c += this.validateElms(f, 'select');
106
+ c += this.validateElms(f, 'textarea');
107
+
108
+ return c == 3;
109
+ },
110
+
111
+ invalidate : function(n) {
112
+ this.mark(n.form, n);
113
+ },
114
+
115
+ getErrorMessages : function(f) {
116
+ var nl, i, s = this.settings, field, msg, values, messages = [], ed = tinyMCEPopup.editor;
117
+ nl = this.tags(f, "label");
118
+ for (i=0; i<nl.length; i++) {
119
+ if (this.hasClass(nl[i], s.invalid_cls)) {
120
+ field = document.getElementById(nl[i].getAttribute("for"));
121
+ values = { field: nl[i].textContent };
122
+ if (this.hasClass(field, s.min_cls, true)) {
123
+ message = ed.getLang('invalid_data_min');
124
+ values.min = this.getNum(field, s.min_cls);
125
+ } else if (this.hasClass(field, s.number_cls)) {
126
+ message = ed.getLang('invalid_data_number');
127
+ } else if (this.hasClass(field, s.size_cls)) {
128
+ message = ed.getLang('invalid_data_size');
129
+ } else {
130
+ message = ed.getLang('invalid_data');
131
+ }
132
+
133
+ message = message.replace(/{\#([^}]+)\}/g, function(a, b) {
134
+ return values[b] || '{#' + b + '}';
135
+ });
136
+ messages.push(message);
137
+ }
138
+ }
139
+ return messages;
140
+ },
141
+
142
+ reset : function(e) {
143
+ var t = ['label', 'input', 'select', 'textarea'];
144
+ var i, j, nl, s = this.settings;
145
+
146
+ if (e == null)
147
+ return;
148
+
149
+ for (i=0; i<t.length; i++) {
150
+ nl = this.tags(e.form ? e.form : e, t[i]);
151
+ for (j=0; j<nl.length; j++) {
152
+ this.removeClass(nl[j], s.invalid_cls);
153
+ nl[j].setAttribute('aria-invalid', false);
154
+ }
155
+ }
156
+ },
157
+
158
+ validateElms : function(f, e) {
159
+ var nl, i, n, s = this.settings, st = true, va = Validator, v;
160
+
161
+ nl = this.tags(f, e);
162
+ for (i=0; i<nl.length; i++) {
163
+ n = nl[i];
164
+
165
+ this.removeClass(n, s.invalid_cls);
166
+
167
+ if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
168
+ st = this.mark(f, n);
169
+
170
+ if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
171
+ st = this.mark(f, n);
172
+
173
+ if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
174
+ st = this.mark(f, n);
175
+
176
+ if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
177
+ st = this.mark(f, n);
178
+
179
+ if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
180
+ st = this.mark(f, n);
181
+
182
+ if (this.hasClass(n, s.size_cls) && !va.isSize(n))
183
+ st = this.mark(f, n);
184
+
185
+ if (this.hasClass(n, s.id_cls) && !va.isId(n))
186
+ st = this.mark(f, n);
187
+
188
+ if (this.hasClass(n, s.min_cls, true)) {
189
+ v = this.getNum(n, s.min_cls);
190
+
191
+ if (isNaN(v) || parseInt(n.value) < parseInt(v))
192
+ st = this.mark(f, n);
193
+ }
194
+
195
+ if (this.hasClass(n, s.max_cls, true)) {
196
+ v = this.getNum(n, s.max_cls);
197
+
198
+ if (isNaN(v) || parseInt(n.value) > parseInt(v))
199
+ st = this.mark(f, n);
200
+ }
201
+ }
202
+
203
+ return st;
204
+ },
205
+
206
+ hasClass : function(n, c, d) {
207
+ return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
208
+ },
209
+
210
+ getNum : function(n, c) {
211
+ c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
212
+ c = c.replace(/[^0-9]/g, '');
213
+
214
+ return c;
215
+ },
216
+
217
+ addClass : function(n, c, b) {
218
+ var o = this.removeClass(n, c);
219
+ n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
220
+ },
221
+
222
+ removeClass : function(n, c) {
223
+ c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
224
+ return n.className = c != ' ' ? c : '';
225
+ },
226
+
227
+ tags : function(f, s) {
228
+ return f.getElementsByTagName(s);
229
+ },
230
+
231
+ mark : function(f, n) {
232
+ var s = this.settings;
233
+
234
+ this.addClass(n, s.invalid_cls);
235
+ n.setAttribute('aria-invalid', 'true');
236
+ this.markLabels(f, n, s.invalid_cls);
237
+
238
+ return false;
239
+ },
240
+
241
+ markLabels : function(f, n, ic) {
242
+ var nl, i;
243
+
244
+ nl = this.tags(f, "label");
245
+ for (i=0; i<nl.length; i++) {
246
+ if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
247
+ this.addClass(nl[i], ic);
248
+ }
249
+
250
+ return null;
251
+ }
252
+ };