19 include_once($ROOT_PATH.
'wysiwyg_plugin.inc');
55 $this->_add_button(
'chooselang',
'',
'',
'',
'');
68 $common_languages = Array(
88 this.config.chooselang = {
89 "-- choose language --":
"",<?php
90 foreach ($common_languages as $code => $name) {
91 echo
'"'.$name.
'": "'.$code.
'",'.
"\n";
94 "---------------------":
"",<?php
95 require_once SQ_FUDGE_PATH.
'/standards_lists/languages.inc';
97 foreach ($standards_lists_languages as $code => $name) {
98 if (array_key_exists($code, $common_languages)) {
102 if ($count == count($standards_lists_languages)) {
103 echo
'"'.$name.
'": "'.$code.
'"'.
"\n";
105 echo
'"'.$name.
'": "'.$code.
'",'.
"\n";
126 options = editor.config[txt];
145 var options = this.config[
"chooselang"];
146 var current_span = this.getClosest(
"span");
149 var value = current_span.lang;
151 for (var j in options) {
152 if (options[j].toLowerCase() == value) {
153 btn.element.selectedIndex = k;
160 if (!found) {btn.element.selectedIndex = 0; }
179 var current_span = this.getClosest(
"span");
185 var sel = this._getSelection();
186 var range = this._createRange(sel);
187 var span_parent = current_span.parentNode;
188 for (var i = 0; i < span_parent.childNodes.length; i++) {
189 var child_node = span_parent.childNodes[i];
190 if (child_node.tagName ==
"SPAN") {
191 if (child_node.innerHTML == current_span.innerHTML) {
192 if (HTMLArea.is_gecko) {
194 if (child_node.attributes.length == 1) {
197 if (child_node.attributes[0].name ==
"lang") {
198 range.selectNode(child_node);
199 this.insertHTML(child_node.innerHTML, range);
201 }
else if (child_node.attributes.length > 1) {
204 var attrs = child_node.attributes;
205 var lang_found =
false;
206 var xml_lang_found =
false;
207 var tmp_span =
"<span ";
208 for (var j = 0; j < attrs.length; j++) {
209 if (attrs[j].name ==
"lang") {
211 }
else if (attrs[j].name ==
"xml:lang") {
212 xml_lang_found =
true;
214 tmp_span = tmp_span + attrs[j].name +
"=\"" + attrs[j].value +
"\" ";
218 if (lang_found && xml_lang_found && attrs.length == 2) {
219 range.selectNode(child_node);
220 this.insertHTML(child_node.innerHTML, range);
221 }
else if (lang_found || xml_lang_found) {
223 range.selectNode(child_node);
224 this.insertHTML(tmp_span + child_node.innerHTML +
"</span>", range)
227 }
else if (HTMLArea.is_ie) {
228 var inner_html = child_node.innerHTML
229 var new_child = this._doc.createTextNode(
'');
230 if (typeof(visual_aid_mode) !=
'undefined' && visual_aid_mode) {
231 var e =
'<span id=wysiwyg-visual-aid-plugin-lang[^>]*>[^>]*<\/span>';
232 var re =
new RegExp(e,
"ig");
233 inner_html = inner_html.replace(re,
'');
235 span_parent.replaceChild(new_child, child_node);
236 range.pasteHTML(inner_html);
245 this.selectNodeContents(current_span);
246 current_span.lang = value;
248 }
else if (value !=
"") {
252 if (this.getSelectedHTML().length != 0) {
253 this.surroundHTML(
"<span lang=\"" + value +
"\">",
"</span>");