summaryrefslogtreecommitdiff
path: root/plugins/wsc/dialogs/wsc.js
diff options
context:
space:
mode:
authorlsces <lester@lsces.co.uk>2013-07-15 14:18:47 +0100
committerlsces <lester@lsces.co.uk>2013-07-15 14:18:47 +0100
commitde6d09676a9527919813a4474cc28af554a35fe1 (patch)
treea2b3c2ddf01eca1600e130125733d324b59744bb /plugins/wsc/dialogs/wsc.js
parent1d0d1733baef4dbab3f8cd7d7150a55ef2828464 (diff)
downloadckeditor-de6d09676a9527919813a4474cc28af554a35fe1.tar.gz
ckeditor-de6d09676a9527919813a4474cc28af554a35fe1.tar.bz2
ckeditor-de6d09676a9527919813a4474cc28af554a35fe1.zip
Upgrade to CKEditor V4
Directory structure changed so many files removed and replace in a new location This batch is the actuall file changes
Diffstat (limited to 'plugins/wsc/dialogs/wsc.js')
-rw-r--r--plugins/wsc/dialogs/wsc.js2097
1 files changed, 2091 insertions, 6 deletions
diff --git a/plugins/wsc/dialogs/wsc.js b/plugins/wsc/dialogs/wsc.js
index 8ca567b..f71918a 100644
--- a/plugins/wsc/dialogs/wsc.js
+++ b/plugins/wsc/dialogs/wsc.js
@@ -1,7 +1,2092 @@
-/*
-Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
-For licensing, see LICENSE.html or http://ckeditor.com/license
-*/
+/**
+ * @license Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.html or http://ckeditor.com/license
+ */
-CKEDITOR.dialog.add('checkspell',function(a){var b=CKEDITOR.tools.getNextNumber(),c='cke_frame_'+b,d='cke_data_'+b,e='cke_error_'+b,f,g=document.location.protocol||'http:',h=a.lang.spellCheck.notAvailable,i='<textarea style="display: none" id="'+d+'"'+' rows="10"'+' cols="40">'+' </textarea><div'+' id="'+e+'"'+' style="display:none;color:red;font-size:16px;font-weight:bold;padding-top:160px;text-align:center;z-index:11;">'+'</div><iframe'+' src=""'+' style="width:100%;background-color:#f1f1e3;"'+' frameborder="0"'+' name="'+c+'"'+' id="'+c+'"'+' allowtransparency="1">'+'</iframe>',j=a.config.wsc_customLoaderScript||g+'//loader.webspellchecker.net/sproxy_fck/sproxy.php'+'?plugin=fck2'+'&customerid='+a.config.wsc_customerId+'&cmd=script&doc=wsc&schema=22';if(a.config.wsc_customLoaderScript)h+='<p style="color:#000;font-size:11px;font-weight: normal;text-align:center;padding-top:10px">'+a.lang.spellCheck.errorLoading.replace(/%s/g,a.config.wsc_customLoaderScript)+'</p>';function k(m,n){var o=0;return function(){if(typeof window.doSpell=='function'){if(typeof f!='undefined')window.clearInterval(f);l(m);}else if(o++==180)window._cancelOnError(n);};};window._cancelOnError=function(m){if(typeof window.WSC_Error=='undefined'){CKEDITOR.document.getById(c).setStyle('display','none');var n=CKEDITOR.document.getById(e);n.setStyle('display','block');n.setHtml(m||a.lang.spellCheck.notAvailable);}};function l(m){var n=new window._SP_FCK_LangCompare(),o=CKEDITOR.getUrl(a.plugins.wsc.path+'dialogs/'),p=o+'tmpFrameset.html';window.gFCKPluginName='wsc';n.setDefaulLangCode(a.config.defaultLanguage);window.doSpell({ctrl:d,lang:a.config.wsc_lang||n.getSPLangCode(a.langCode),intLang:a.config.wsc_uiLang||n.getSPLangCode(a.langCode),winType:c,onCancel:function(){m.hide();},onFinish:function(q){a.focus();m.getParentEditor().setData(q.value);m.hide();},staticFrame:p,framesetPath:p,iframePath:o+'ciframe.html',schemaURI:o+'wsc.css',userDictionaryName:a.config.wsc_userDictionaryName,customDictionaryName:a.config.wsc_customDictionaryIds&&a.config.wsc_customDictionaryIds.split(','),domainName:a.config.wsc_domainName});CKEDITOR.document.getById(e).setStyle('display','none');CKEDITOR.document.getById(c).setStyle('display','block');};return{title:a.config.wsc_dialogTitle||a.lang.spellCheck.title,minWidth:485,minHeight:380,buttons:[CKEDITOR.dialog.cancelButton],onShow:function(){var m=this.getContentElement('general','content').getElement();m.setHtml(i);m.getChild(2).setStyle('height',this._.contentSize.height+'px');
-if(typeof window.doSpell!='function')CKEDITOR.document.getHead().append(CKEDITOR.document.createElement('script',{attributes:{type:'text/javascript',src:j}}));var n=a.getData();CKEDITOR.document.getById(d).setValue(n);f=window.setInterval(k(this,h),250);},onHide:function(){window.ooo=undefined;window.int_framsetLoaded=undefined;window.framesetLoaded=undefined;window.is_window_opened=false;},contents:[{id:'general',label:a.config.wsc_dialogTitle||a.lang.spellCheck.title,padding:0,elements:[{type:'html',id:'content',html:''}]}]};});CKEDITOR.dialog.on('resize',function(a){var b=a.data,c=b.dialog;if(c._.name=='checkspell'){var d=c.getContentElement('general','content').getElement(),e=d&&d.getChild(2);e&&e.setSize('height',b.height);e&&e.setSize('width',b.width);}});
+/** ManagerPostMessage
+ *************************/
+var ManagerPostMessage = function() {
+ var _init = function(handler) {
+ if (document.addEventListener) {
+ window.addEventListener('message', handler, false);
+ } else {
+ window.attachEvent("onmessage", handler);
+ };
+ };
+ var _sendCmd = function(o) {
+ var str,
+ type = Object.prototype.toString,
+ objObject = "[object Object]";
+ fn = o.fn || null;
+ id = o.id || '';
+ target = o.target || window;
+ message = o.message || {
+ 'id': id
+ };
+
+ if (type.call(o.message) == objObject) {
+ (o.message.id) ? o.message.id : o.message.id = id;
+ message = o.message;
+ };
+
+ str = JSON.stringify(message, fn);
+ target.postMessage(str, '*');
+ };
+
+ return {
+ init: _init,
+ send: _sendCmd
+ }
+};
+
+/** Tools
+ *************************/
+var tools = {
+ hash: {
+ create: function(o, fn) {
+ var fn = fn || null;
+ var str = JSON.stringify(o, fn);
+ return str;
+ },
+ parse: function(str, fn) {
+ var fn = fn || null;
+ return JSON.parse(str, fn);
+ }
+ },
+ filter4html: function(str) {
+ return str.replace(/"/g, "&quot;").replace(/'/g, "&#146;");
+ },
+ setCookie: function(name, value, options) {
+ options = options || {};
+
+ var expires = options.expires;
+
+ if (typeof expires == "number" && expires) {
+ var d = new Date();
+ d.setTime(d.getTime() + expires*1000);
+ expires = options.expires = d;
+ }
+ if (expires && expires.toUTCString) {
+ options.expires = expires.toUTCString();
+ }
+
+ value = encodeURIComponent(value);
+
+ var updatedCookie = name + "=" + value;
+
+ for(var propName in options) {
+ updatedCookie += "; " + propName;
+ var propValue = options[propName];
+ if (propValue !== true) {
+ updatedCookie += "=" + propValue;
+ }
+ }
+
+ document.cookie = updatedCookie;
+ },
+ getCookie: function(name) {
+ var matches = document.cookie.match(new RegExp(
+ "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
+ ));
+ return matches ? decodeURIComponent(matches[1]) : undefined;
+ },
+ deleteCookie: function(name) {
+ setCookie(name, "", { expires: -1 })
+ }
+};
+
+var optionsDataObject = {};
+var NS = {};
+var nameNode = null;
+NS.targetFromFrame = {};
+//NS.currentLang = CKEDITOR.config.wsc_lang || 'en_US';
+NS.wsc_customerId = CKEDITOR.config.wsc_customerId;
+NS.cust_dic_ids = CKEDITOR.config.wsc_customDictionaryIds;
+NS.userDictionaryName = CKEDITOR.config.wsc_userDictionaryName;
+NS.defaultLanguage = CKEDITOR.config.defaultLanguage;
+NS.LocalizationComing = {};
+
+function OptionsConfirm(state) {
+ if (state) {
+ nameNode.setValue('');
+ };
+};
+
+CKEDITOR.dialog.add('checkspell', function(editor) {
+
+ CKEDITOR.on('dialogDefinition', function(dialogDefinitionEvent) {
+ var dialogDefinition = dialogDefinitionEvent.data.definition;
+ dialogDefinition.dialog.on('cancel', function(cancelEvent) {
+ return false;
+ }, this, null, -1);
+ });
+
+ /* NameSpace Plugin
+ *************************/
+ NS.CKNumber = CKEDITOR.tools.getNextNumber();
+ NS.iframeNumber = 'cke_frame_' + NS.CKNumber;
+ NS.TextAreaNumber = 'cke_textarea_' + NS.CKNumber;
+ NS.pluginPath = CKEDITOR.getUrl(editor.plugins.wsc.path);
+ NS.logotype = DefaultParams.logoPath;
+ NS.templatePath = NS.pluginPath + 'dialogs/tmp.html';
+ NS.div_overlay_no_check = null;
+ NS.loadIcon = DefaultParams.iconPath;
+ NS.loadIconEmptyEditor = DefaultParams.iconPathEmptyEditor;
+ NS.LangComparer = new _SP_FCK_LangCompare();
+ NS.LangComparer.setDefaulLangCode( NS.defaultLanguage );
+ NS.currentLang = editor.config.wsc_lang || NS.LangComparer.getSPLangCode( editor.langCode );
+ NS.LocalizationButton = {
+ 'ChangeTo': {
+ 'instance' : null,
+ 'text' : 'Change to'
+ },
+
+ 'ChangeAll': {
+ 'instance' : null,
+ 'text' : 'Change All'
+ },
+
+ 'IgnoreWord': {
+ 'instance' : null,
+ 'text' : 'Ignore word'
+ },
+
+ 'IgnoreAllWords': {
+ 'instance' : null,
+ 'text' : 'Ignore all words'
+ },
+
+ 'Options': {
+ 'instance' : null,
+ 'text' : 'Options',
+ 'optionsDialog': {
+ 'instance' : null
+ }
+ },
+
+ 'AddWord': {
+ 'instance' : null,
+ 'text' : 'Add word'
+ },
+
+ 'FinishChecking': {
+ 'instance' : null,
+ 'text' : 'Finish Checking'
+ }
+ };
+
+ NS.LocalizationLabel = {
+ 'ChangeTo': {
+ 'instance' : null,
+ 'text' : 'Change to'
+ },
+
+ 'Suggestions': {
+ 'instance' : null,
+ 'text' : 'Suggestions'
+ }
+ };
+
+ var SetLocalizationButton = function(obj) {
+
+ for(var i in obj) {
+ obj[i].instance.getElement().setText(NS.LocalizationComing[i]);
+ };
+ };
+
+ var SetLocalizationLabel = function(obj) {
+
+ for(var i in obj) {
+ if (!obj[i].instance.setLabel) {
+ return;
+ };
+ obj[i].instance.setLabel(NS.LocalizationComing[i]);
+ };
+ };
+
+
+ NS.load = true;
+ NS.cmd = {
+ "SpellTab": 'spell',
+ "Thesaurus": 'thes',
+ "GrammTab": 'grammar'
+ };
+ NS.dialog = null;
+ NS.optionNode = null;
+ NS.selectNode = null;
+ NS.grammerSuggest = null;
+ NS.textNode = {};
+ NS.iframeMain = null;
+ NS.dataTemp = '';
+ NS.div_overlay = null;
+ NS.textNodeInfo = {};
+ NS.selectNode = {};
+ NS.selectNodeResponce = {};
+ NS.selectingLang = NS.currentLang;//NS.LangComparer.getSPLangCode( NS.currentLang ) || NS.LangComparer.getDefaulLangCode();
+ NS.langList = null;
+ NS.serverLocationHash = DefaultParams.serviceHost;
+ NS.serverLocation = '#server=' + NS.serverLocationHash;
+ NS.langSelectbox = null;
+ NS.banner = '';
+
+ var manageMessage = null;
+ iframeOnload = false;
+
+
+ NS.framesetHtml = function(tab) {
+ var str = '<iframe src="' + NS.templatePath + NS.serverLocation +'" id=' + NS.iframeNumber + '_' + tab + ' frameborder="0" allowtransparency="1" style="width:100%;border: 1px solid #AEB3B9;overflow: auto;background:#fff; border-radius: 3px;"></iframe>'
+ return str;
+ };
+
+ NS.setIframe = function(that, nameTab) {
+ var str = NS.framesetHtml(nameTab);
+ return that.getElement().setHtml(str);
+ };
+
+ NS.setCurrentIframe = function(currentTab) {
+ var that = NS.dialog._.contents[currentTab].Content,
+ tabID, iframe;
+
+ NS.setIframe(that, currentTab);
+
+ };
+
+ NS.sendData = function() {
+ var currentTab = NS.dialog._.currentTabId,
+ that = NS.dialog._.contents[currentTab].Content,
+ tabID, iframe;
+
+ NS.setIframe(that, currentTab);
+ NS.dialog.parts.tabs.removeAllListeners();
+
+ NS.dialog.parts.tabs.on('click', function(event) {
+ event = event || window.event;
+ if (!event.data.getTarget().is('a')) {
+ return
+ };
+
+ if (currentTab == NS.dialog._.currentTabId) { return };
+
+ currentTab = NS.dialog._.currentTabId;
+ that = NS.dialog._.contents[currentTab].Content;
+ tabID = NS.iframeNumber + '_' + currentTab;
+
+
+ if (that.getElement().$.children.length == 0) {
+ NS.setIframe(that, currentTab);
+ iframe = document.getElementById(tabID);
+
+ /* iframe.onload = function() {
+ NS.targetFromFrame[tabID] = iframe.contentWindow;
+ //sendData(NS.targetFromFrame[tabID], NS.cmd[currentTab], null);
+ };*/
+ NS.targetFromFrame[tabID] = iframe.contentWindow;
+ //NS.div_overlay.setDisable();
+ } else {
+ sendData(NS.targetFromFrame[tabID], NS.cmd[currentTab]);
+ //NS.div_overlay.setDisable();
+ };
+ });
+
+ };
+
+ NS.buildOptionSynonyms = function(key) {
+ var syn = NS.selectNodeResponce[key];
+ NS.selectNode['synonyms'].clear();
+
+ for (var item = 0; item < syn.length; item++) {
+ NS.selectNode['synonyms'].add(syn[item], syn[item]);
+ };
+
+ NS.selectNode['synonyms'].getInputElement().$.firstChild.selected = true;
+ NS.textNode['Thesaurus'].setValue(NS.selectNode['synonyms'].getInputElement().getValue())
+ };
+
+ NS.buildSelectLang = function() {
+ var divContainer = new CKEDITOR.dom.element('div'),
+ selectContainer = new CKEDITOR.dom.element('select'),
+ id = "wscLang" + NS.CKNumber;
+
+ divContainer.addClass("cke_dialog_ui_input_select");
+ divContainer.setAttribute("role", "presentation");
+ divContainer.setStyles({
+ 'height': 'auto',
+ 'position': 'absolute',
+ 'right': '0',
+ 'top': '-1px',
+ 'width': '160px',
+ 'white-space': 'normal'
+ });
+
+ selectContainer.setAttribute('id', id)
+ selectContainer.addClass("cke_dialog_ui_input_select");
+ selectContainer.setStyles({
+ 'width': '160px'
+ });
+ var currentTabId = NS.dialog._.currentTabId,
+ frameId = NS.iframeNumber + '_' + currentTabId;
+
+ divContainer.append(selectContainer);
+
+ return divContainer;
+
+ };
+
+ NS.buildOptionLang = function(key) {
+ var id = "wscLang" + NS.CKNumber;
+ var select = document.getElementById(id),
+ create_option, txt_option;
+
+ if(select.options.length === 0) {
+ for (var lang in key) {
+ create_option=document.createElement("option");
+ create_option.setAttribute("value", key[lang]);
+ txt_option = document.createTextNode(lang);
+ create_option.appendChild(txt_option);
+
+ if (key[lang] == NS.selectingLang) {
+ create_option.selected = true;
+ };
+
+ select.appendChild(create_option);
+ };
+ };
+
+ for (var i = 0; i < select.options.length; i++) {
+ if (select.options[i].value == NS.selectingLang) {
+ select.options[i].selected = true;
+ };
+ continue;
+ };
+
+ };
+
+ // banner add
+ var setBannerInPlace = function(htmlBanner) {
+ var findBannerPlace = NS.dialog.getContentElement(NS.dialog._.currentTabId, 'banner').getElement();
+ findBannerPlace.setHtml(htmlBanner);
+ };
+
+
+ // Create overlay block on iframe when run button "options"
+ var overlayBlock = function overlayBlock(opt) {
+ var progress = opt.progress || "",
+ doc = document,
+ target = opt.target || doc.body,
+ overlayId = opt.id || "overlayBlock",
+ opacity = opt.opacity || "0.9",
+ background = opt.background || "#f1f1f1",
+ getOverlay = doc.getElementById(overlayId),
+ thisOverlay = getOverlay || doc.createElement("div");
+
+ thisOverlay.style.cssText = "position: absolute;" +
+ "top:30px;" +
+ "bottom:40px;" +
+ "left:1px;" +
+ "right:1px;" +
+ "z-index: 10020;" +
+ "padding:0;" +
+ "margin:0;" +
+ "background:" + background + ";" +
+ "opacity: " + opacity + ";" +
+ "filter: alpha(opacity=" + opacity * 100 + ");" +
+ "display: none;"
+ thisOverlay.id = overlayId;
+
+ if (!getOverlay) {
+ target.appendChild(thisOverlay);
+ }
+
+ return {
+ setDisable: function() {
+ thisOverlay.style.display = "none";
+ },
+ setEnable: function() {
+ thisOverlay.style.display = "block";
+ }
+ }
+ };
+
+
+ var buildRadioInputs = function(key, value, check) {
+ var divContainer = new CKEDITOR.dom.element('div'),
+ radioButton = new CKEDITOR.dom.element('input'),
+ radioLabel = new CKEDITOR.dom.element('label'),
+ id = "wscGrammerSuggest" + key + "_" + value;
+
+
+ divContainer.addClass("cke_dialog_ui_input_radio");
+ divContainer.setAttribute("role", "presentation");
+ divContainer.setStyles({
+ width: "97%",
+ padding: "5px",
+ 'white-space': 'normal'
+ });
+
+ radioButton.setAttributes({
+ type: "radio",
+ value: value,
+ name: 'wscGrammerSuggest',
+ id: id
+ });
+ radioButton.setStyles({
+ "float":"left"
+ });
+
+ radioButton.on("click", function(data) {
+ NS.textNode['GrammTab'].setValue(data.sender.getValue())
+ });
+
+ (check) ? radioButton.setAttribute("checked", true) : false;
+
+ radioButton.addClass("cke_dialog_ui_radio_input");
+
+ radioLabel.appendText(key);
+ radioLabel.setAttribute("for", id);
+ radioLabel.setStyles({
+ 'display': "block",
+ 'line-height': '16px',
+ 'margin-left': '18px',
+ 'white-space': 'normal'
+ });
+
+ divContainer.append(radioButton);
+ divContainer.append(radioLabel);
+
+ return divContainer;
+ };
+
+var langConstructor = function(lang) {
+ var langSelectBox = new __constructLangSelectbox(lang),
+ selectId = "wscLang" + NS.CKNumber,
+ selectContainer = document.getElementById(selectId),
+ currentTabId = NS.dialog._.currentTabId,
+ frameId = NS.iframeNumber + '_' + currentTabId;
+
+ NS.buildOptionLang(langSelectBox.setLangList);
+
+ //tabView[langSelectBox.getCurrentLangGroup(NS.selectingLang)]();
+
+ selectContainer.onchange = function(e){
+ e = e || window.event;
+ tabView[langSelectBox.getCurrentLangGroup(this.value)]();
+ NS.div_overlay.setEnable();
+
+ NS.selectingLang = this.value;
+
+ manageMessage.send({
+ 'message': {
+ 'changeLang': NS.selectingLang,
+ 'text': NS.dataTemp
+ },
+ 'target': NS.targetFromFrame[frameId],
+ 'id': 'selectionLang_outer__page'
+ });
+ //NS.div_overlay.setDisable();
+ };
+
+};
+
+var disableButtonSuggest = function(word) {
+ if (word == 'no_any_suggestions') {
+ word = 'No suggestions';
+ NS.LocalizationButton['ChangeTo'].instance.disable();
+ NS.LocalizationButton['ChangeAll'].instance.disable();
+
+ // hack for css disable button ckeditor 4
+ function styleDisable(/* string */instanceButton) {
+ var button = NS.LocalizationButton[instanceButton].instance;
+ button.getElement().hasClass('cke_disabled') ? button.getElement().setStyle('color', '#a0a0a0') : button.disable();
+ };
+
+ styleDisable('ChangeTo');
+ styleDisable('ChangeAll');
+
+ return word;
+ } else {
+ NS.LocalizationButton['ChangeTo'].instance.enable();
+ NS.LocalizationButton['ChangeAll'].instance.enable();
+ NS.LocalizationButton['ChangeTo'].instance.getElement().setStyle('color', '#333');
+ NS.LocalizationButton['ChangeAll'].instance.getElement().setStyle('color', '#333');
+ return word;
+ };
+
+};
+
+ var handlerId = {
+ iframeOnload: function(response) {
+ NS.div_overlay.setEnable();
+ iframeOnload = true;
+ var currentTab = NS.dialog._.currentTabId,
+ tabId = NS.iframeNumber + '_' + currentTab;
+ //debugger
+
+ sendData(NS.targetFromFrame[tabId], NS.cmd[currentTab]);
+ },
+
+ suggestlist: function(response) {
+ delete response.id;
+ NS.div_overlay_no_check.setDisable();
+ hideCurrentFinishChecking();
+ langConstructor(NS.langList);
+
+
+ var word = disableButtonSuggest(response.word),
+ suggestionsList = '';
+
+ if (word instanceof Array) {
+ word = response.word[0];
+
+ };
+ word = word.split(',');
+
+
+ //NS.langSelectbox = new __constructLangSelectbox(NS.langList);
+
+ //tabView[NS.langSelectbox.getCurrentLangGroup(NS.selectingLang)]();
+
+ //NS.buildOptionLang(NS.langSelectbox.setLangList);
+
+ suggestionsList = word;
+
+ selectNode.clear();
+ NS.textNode['SpellTab'].setValue(suggestionsList[0]);
+
+ for (var item = 0; item < suggestionsList.length; item++) {
+ selectNode.add(suggestionsList[item], suggestionsList[item]);
+ };
+
+ showCurrentTabs();
+ //NS.div_overlay.setEnable();
+ NS.div_overlay.setDisable();
+
+ },
+
+ grammerSuggest: function(response) {
+ delete response.id;
+// NS.langList = response.mocklangs;
+
+// langConstructor(NS.langList);
+ delete response.mocklangs;
+
+ hideCurrentFinishChecking();
+ var firstSuggestValue = response.grammSuggest[0];// ? firstSuggestValue = response.grammSuggest[0] : firstSuggestValue = 'No suggestion for this words';
+ NS.grammerSuggest.getElement().setHtml('');
+ NS.textNode['GrammTab'].reset();
+ NS.textNode['GrammTab'].setValue(firstSuggestValue);
+
+ NS.textNodeInfo['GrammTab'].getElement().setHtml('');
+ NS.textNodeInfo['GrammTab'].getElement().setText(response.info);
+
+ var arr = response.grammSuggest,
+ len = arr.length,
+ check = true;
+
+ for (var i = 0; i < len; i++) {
+ NS.grammerSuggest.getElement().append(buildRadioInputs(arr[i], arr[i], check));
+ check = false;
+ };
+
+ showCurrentTabs();
+ NS.div_overlay.setDisable();
+ },
+
+ thesaurusSuggest: function(response) {
+ delete response.id;
+// NS.langList = response.mocklangs;
+// langConstructor(NS.langList);
+ delete response.mocklangs;
+
+ hideCurrentFinishChecking();
+
+ NS.selectNodeResponce = response;
+
+ NS.textNode['Thesaurus'].reset();
+ NS.selectNode['categories'].clear();
+
+ for (var i in response) {
+ NS.selectNode['categories'].add(i, i);
+ };
+
+ var synKey = NS.selectNode['categories'].getInputElement().getChildren().$[0].value;
+
+ NS.selectNode['categories'].getInputElement().getChildren().$[0].selected = true;
+
+ NS.buildOptionSynonyms(synKey);
+
+ showCurrentTabs();
+ NS.div_overlay.setDisable();
+ },
+ finish: function(response) {
+ delete response.id;
+
+ hideCurrentTabs();
+ showCurrentFinishChecking();
+ NS.div_overlay.setDisable();
+ },
+ settext: function(response) {
+ delete response.id;
+
+ NS.dialog.getParentEditor().focus();
+ NS.dialog.getParentEditor().setData(response.text, NS.dialog.hide());
+ //NS.dataTemp = NS.dialog.getParentEditor().getData();
+
+ },
+ ReplaceText: function(response) {
+ delete response.id;
+ NS.div_overlay.setEnable();
+
+ NS.dataTemp = response.text;
+ NS.selectingLang = response.currentLang;
+
+ window.setTimeout(function() {
+ NS.div_overlay.setDisable();
+ }, 500);
+
+ SetLocalizationButton(NS.LocalizationButton);
+ SetLocalizationLabel(NS.LocalizationLabel);
+
+ },
+
+ options_checkbox_send: function(response) {
+ delete response.id;
+
+ var obj = {
+ 'osp': tools.getCookie('osp'),
+ 'udn': tools.getCookie('udn'),
+ //'ud': tools.getCookie('ud'),
+ 'cust_dic_ids': NS.cust_dic_ids
+ //'udnCmd': tools.getCookie('udnCmd')
+ }
+
+ var currentTabId = NS.dialog._.currentTabId,
+ frameId = NS.iframeNumber + '_' + currentTabId;
+
+ manageMessage.send({
+ 'message': obj,
+ 'target': NS.targetFromFrame[frameId],
+ 'id': 'options_outer__page'
+ });
+ },
+
+ getOptions: function(response) {
+ var udn = response.DefOptions.udn;
+ NS.LocalizationComing = response.DefOptions.localizationButtonsAndText;
+
+ NS.langList = response.lang;
+
+ setBannerInPlace(response.banner);
+
+ if (udn == 'undefined') {
+ if (NS.userDictionaryName) {
+ udn = NS.userDictionaryName;
+
+ var obj = {
+ 'osp': tools.getCookie('osp'),
+ 'udn': NS.userDictionaryName,
+ //'ud': tools.getCookie('ud'),
+ 'cust_dic_ids': NS.cust_dic_ids,
+ 'id': 'options_dic_send',
+ 'udnCmd': 'create'
+ };
+
+ manageMessage.send({
+ 'message': obj,
+ 'target': NS.targetFromFrame[frameId]
+ });
+
+ } else{
+ udn = '';
+ };
+ };
+
+ tools.setCookie('osp', response.DefOptions.osp);
+ tools.setCookie('udn', udn);
+ //tools.setCookie('ud', response.ud);
+ tools.setCookie('cust_dic_ids', response.DefOptions.cust_dic_ids);
+
+ manageMessage.send({
+ 'id': 'giveOptions'
+ });
+ },
+
+ options_dic_send: function(response) {
+ //delete response.id;
+
+ var obj = {
+ 'osp': tools.getCookie('osp'),
+ 'udn': tools.getCookie('udn'),
+ //'ud': tools.getCookie('ud'),
+ 'cust_dic_ids': NS.cust_dic_ids,
+ 'id': 'options_dic_send',
+ 'udnCmd': tools.getCookie('udnCmd')
+ };
+
+ var currentTabId = NS.dialog._.currentTabId,
+ frameId = NS.iframeNumber + '_' + currentTabId;
+
+ manageMessage.send({
+ 'message': obj,
+ 'target': NS.targetFromFrame[frameId]
+ });
+ },
+ data: function(response) {
+ delete response.id; // fix from ie9
+ },
+
+ giveOptions: function() {
+
+ },
+
+ setOptionsConfirmF:function() {
+ OptionsConfirm(false);
+ },
+
+ setOptionsConfirmT:function() {
+ OptionsConfirm(true);
+ },
+
+ clickBusy: function() {
+ NS.div_overlay.setEnable();
+ },
+
+ suggestAllCame: function() {
+ NS.div_overlay.setDisable();
+ NS.div_overlay_no_check.setDisable();
+ },
+
+ TextCorrect: function() {
+ langConstructor(NS.langList);
+ }
+
+ }
+
+ var handlerIncomingData = function(event) {
+ event = event || window.event;
+ var response = JSON.parse(event.data);
+
+ handlerId[response.id](response);
+ };
+
+ var handlerButtonOptions = function(event) {
+ event = event || window.event;
+
+ var currentTabId = NS.dialog._.currentTabId,
+ frameId = NS.iframeNumber + '_' + currentTabId;
+
+ manageMessage.send({
+ 'message': {
+ 'cmd': 'Options'
+ },
+ 'target': NS.targetFromFrame[frameId],
+ 'id': 'cmd'
+ });
+
+ };
+
+ var handlerButtons = function(event) {
+ event = event || window.event;
+ NS.div_overlay.setEnable();
+ var currentTabId = NS.dialog._.currentTabId,
+ frameId = NS.iframeNumber + '_' + currentTabId,
+ new_word = NS.textNode[currentTabId].getValue();
+
+ manageMessage.send({
+ 'message': {
+ 'cmd': this.getElement().getAttribute("title-cmd"),
+ 'tabId': currentTabId,
+ 'new_word': new_word
+ },
+ 'target': NS.targetFromFrame[frameId],
+ 'id': 'cmd_outer__page'
+ });
+
+ };
+
+ var sendData = function(frameTarget, cmd, sendText, reset_suggest) {
+ cmd = cmd || CKEDITOR.config.wsc_cmd || 'spell';
+ reset_suggest = reset_suggest || false;
+ sendText = sendText || NS.dataTemp;
+
+ manageMessage.send({
+ 'message': {
+ 'customerId': NS.wsc_customerId,
+ 'text': sendText,
+ 'txt_ctrl': NS.TextAreaNumber,
+ 'cmd': cmd,
+ 'cust_dic_ids': NS.cust_dic_ids,
+ 'udn': NS.userDictionaryName,
+ 'slang': NS.selectingLang,
+ 'reset_suggest': reset_suggest
+ },
+ 'target': frameTarget,
+ 'id': 'data_outer__page'
+ });
+NS.div_overlay.setEnable();
+ };
+
+ var tabView = {
+ "superset" : function() {
+ showThesaurusTab();
+ showGrammTab();
+ showSpellTab();
+ },
+ "usual" : function() {
+ hideThesaurusTab();
+ hideGrammTab();
+ showSpellTab();
+ }
+ };
+
+ var showFirstTab = function() {
+
+
+
+
+ var cmdManger = function(cmdView) {
+ var obj = {};
+ var _getCmd = function(cmd) {
+ for (var tabId in cmdView) {
+ obj[cmdView[tabId]] = tabId;
+ };
+ return obj[cmd];
+ };
+ return {
+ getCmdByTab: _getCmd
+ }
+ };
+
+ var cmdM = new cmdManger(NS.cmd);
+ NS.dialog.selectPage(cmdM.getCmdByTab(CKEDITOR.config.wsc_cmd));
+ NS.sendData();
+// tabView[langSelectBox.getCurrentLangGroup(NS.selectingLang)]()
+ //NS.dialog._.currentTabId.click();
+ };
+
+ var showThesaurusTab = function() {
+ NS.dialog.showPage('Thesaurus');
+ };
+
+ var hideThesaurusTab = function() {
+ NS.dialog.hidePage('Thesaurus');
+ };
+
+ var showGrammTab = function() {
+ NS.dialog.showPage('GrammTab');
+ };
+
+ var hideGrammTab = function() {
+ NS.dialog.hidePage('GrammTab');
+ };
+
+ var showSpellTab = function() {
+ NS.dialog.showPage('SpellTab');
+ };
+
+ var hideSpellTab = function() {
+ NS.dialog.hidePage('SpellTab');
+ };
+
+ var showCurrentTabs = function() {
+ /*if (NS.dialog._.currentTabId == 'Thesaurus') {
+ return;
+ };*/
+
+ NS.dialog.getContentElement(NS.dialog._.currentTabId, 'bottomGroup').getElement().show();
+ };
+
+ var hideCurrentTabs = function() {
+ /*if (NS.dialog._.currentTabId == 'Thesaurus') {
+ return;
+ };*/
+
+ NS.dialog.getContentElement(NS.dialog._.currentTabId, 'bottomGroup').getElement().hide();
+ };
+
+ var showCurrentFinishChecking = function() {
+ /*if (NS.dialog._.currentTabId == 'Thesaurus') {
+ return;
+ };*/
+
+ NS.dialog.getContentElement(NS.dialog._.currentTabId, 'BlockFinishChecking').getElement().show();
+ };
+
+ var hideCurrentFinishChecking = function() {
+ /*if (NS.dialog._.currentTabId == 'Thesaurus') {
+ return;
+ };*/
+
+ NS.dialog.getContentElement(NS.dialog._.currentTabId, 'BlockFinishChecking').getElement().hide();
+ };
+
+
+
+function __constructLangSelectbox(languageGroup) {
+
+ if ( !languageGroup ) throw "Languages-by-groups list are required for construct selectbox";
+
+ var that = this,
+ o_arr = [],
+ priorLang ="en_US",
+ priorLangTitle = "",
+ currLang = NS.selectingLang;
+
+
+ for ( var group in languageGroup){
+ for ( var langCode in languageGroup[group]){
+ var langName = languageGroup[group][langCode];
+ if ( langName == priorLang )
+ priorLangTitle = langName;
+ else
+ o_arr.push( langName );
+ }
+
+ }
+
+ o_arr.sort();
+ if(priorLangTitle) {
+ o_arr.unshift( priorLangTitle );
+ };
+
+ var searchGroup = function ( code ){
+ for ( var group in languageGroup){
+ for ( var langCode in languageGroup[group]){
+ if ( langCode.toUpperCase() === code.toUpperCase() )
+ return group;
+ };
+
+ };
+ return "";
+ };
+
+ var _setLangList = function() {
+ var langList = {},
+ langArray = [];
+ for (var group in languageGroup) {
+ for ( var langCode in languageGroup[group]){
+ langList[languageGroup[group][langCode]] = langCode;
+ };
+ };
+ return langList;
+ };
+
+
+ var _return = {
+ getCurrentLangGroup: function(code) {
+ return searchGroup(code);
+ },
+ setLangList: _setLangList()
+ };
+
+
+ return _return;
+
+};
+
+ return {
+ title: editor.config.wsc_dialogTitle || editor.lang.wsc.title,
+ minWidth: 560,
+ minHeight: 350,
+ resizable: CKEDITOR.DIALOG_RESIZE_NONE,
+ buttons: [CKEDITOR.dialog.cancelButton],
+ onLoad: function() {
+ manageMessage = new ManagerPostMessage();
+ NS.dialog = this;
+ showFirstTab();
+ NS.dataTemp = NS.dialog.getParentEditor().getData();
+ manageMessage.init(handlerIncomingData);
+
+ NS.div_overlay = new overlayBlock({
+ opacity: "0.95",
+ background: "#fff url(" + NS.loadIcon + ") no-repeat 50% 50%",
+ target: this.parts.tabs.getParent().$
+ });
+
+ NS.div_overlay_no_check = new overlayBlock({
+ opacity: "1",
+ id: 'no_check_over',
+ background: "#fff url(" + NS.loadIconEmptyEditor + ") no-repeat 50% 50%",
+ target: this.parts.tabs.getParent().$
+ });
+ //NS.div_overlay.setDisable();
+
+ //NS.sendData();
+ var number_ck = NS.CKNumber + 1,
+ id_tab = CKEDITOR.document.getById('cke_dialog_tabs_' + number_ck);
+
+ id_tab.setStyle('width', '97%');
+ id_tab.append(NS.buildSelectLang());
+
+ },
+ onShow: function() {
+ NS.div_overlay.setDisable();
+ /*var tabId = NS.iframeNumber + '_' + NS.dialog._.currentTabId;
+ NS.dataTemp = NS.dialog.getParentEditor().getData();*/
+ showFirstTab();
+ //sendData(NS.targetFromFrame[tabId], null, null, true);
+ if ( NS.dialog.getParentEditor().getData() == '' ) {
+ NS.div_overlay_no_check.setEnable();
+ //alert( 'Nothing to check' );
+ //NS.dialog.getParentEditor().focus();
+ //NS.dialog.hide()
+ };
+ },
+ onHide: function() {
+ //var firstTabId = NS.iframeNumber + '_SpellTab';
+ //sendData(NS.targetFromFrame[firstTabId], null, NS.dataTemp, true);
+ /*manageMessage.send({
+ 'message': { 'changeLang': NS.selectingLang},
+ 'target': NS.targetFromFrame[firstTabId],
+ 'id': 'selectionLang_outer__page'
+ });*/
+ NS.dataTemp = null;
+ },
+ contents: [
+ {
+ id: 'SpellTab',
+ label: 'SpellChecker',
+ accessKey: 'S',
+ elements: [
+ {
+ type: 'html',
+ id: 'banner',
+ label: 'banner',
+ html: '<div></div>'
+ },
+ {
+ type: 'html',
+ id: 'Content',
+ label: 'spellContent',
+ html: '',
+ onLoad: function() {
+ //NS.setCurrentIframe(NS.dialog._.currentTabId);
+ var tabId = NS.iframeNumber + '_' + NS.dialog._.currentTabId;
+ var iframe = document.getElementById(tabId);
+ NS.targetFromFrame[tabId] = iframe.contentWindow;
+
+ },
+ onShow: function() {
+ NS.dataTemp = NS.dialog.getParentEditor().getData();
+ var tabId = NS.iframeNumber + '_' + NS.dialog._.currentTabId;
+ //sendData(NS.targetFromFrame[tabId], null, NS.dataTemp);
+ NS.div_overlay.setEnable();
+ }
+ },
+ {
+ type: 'hbox',
+ id: 'bottomGroup',
+ widths: ['50%', '50%'],
+ children: [
+ {
+ type: 'hbox',
+ id: 'leftCol',
+ align: 'left',
+ width: '50%',
+ children: [
+ {
+ type: 'vbox',
+ id: 'rightCol1',
+ widths: ['50%', '50%'],
+ children: [
+ {
+ type: 'text',
+ id: 'text',
+ label: NS.LocalizationLabel['ChangeTo'].text + ':',
+ labelLayout: 'horizontal',
+ labelStyle: 'font: 12px/25px arial, sans-serif;',
+ width: '140px',
+ 'default': '',
+ onLoad: function() {
+ NS.textNode['SpellTab'] = this;
+ NS.LocalizationLabel['ChangeTo'].instance = this;
+ },
+ onHide: function() {
+ this.reset();
+ }
+ },
+ {
+ type: 'hbox',
+ id: 'rightCol',
+ align: 'right',
+ width: '30%',
+ children: [
+ {
+ type: 'vbox',
+ id: 'rightCol_col__left',
+ children: [
+ {
+ type: 'text',
+ id: 'labelSuggestions',
+ label: NS.LocalizationLabel['Suggestions'].text + ':',
+ onLoad: function() {
+ NS.LocalizationLabel['Suggestions'].instance = this;
+ this.getInputElement().hide();
+ }
+ },
+ {
+ type: 'html',
+ id: 'logo',
+ html: '<img width="99" height="68" border="0" src="" title="WebSpellChecker.net" alt="WebSpellChecker.net" style="display: inline-block;">',
+ onShow: function() {
+ this.getElement().$.src = NS.logotype;
+ this.getElement().getParent().setStyles({
+ "text-align": "left"
+ })
+ }
+ }
+ ]
+ },
+ {
+ type: 'select',
+ id: 'list_of_suggestions',
+ labelStyle: 'font: 12px/25px arial, sans-serif;',
+ size: '6',
+ inputStyle: 'width: 140px; height: auto;',
+ items: [['loading...']],
+ onShow: function() {
+ selectNode = this;
+ },
+ onHide: function() {
+ this.clear();
+ },
+ onChange: function() {
+ NS.textNode['SpellTab'].setValue(this.getValue());
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ type: 'hbox',
+ id: 'rightCol',
+ align: 'right',
+ width: '50%',
+ children: [
+ {
+ type: 'vbox',
+ id: 'rightCol_col__left',
+ widths: ['50%', '50%', '50%', '50%'],
+ children: [
+ {
+ type: 'button',
+ id: 'ChangeTo',
+ label: NS.LocalizationButton['ChangeTo'].text,
+ title: 'Change to',
+ style: 'width: 100%;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ NS.LocalizationButton['ChangeTo'].instance = this;
+ },
+ onClick: handlerButtons
+ },
+ {
+ type: 'button',
+ id: 'ChangeAll',
+ label: NS.LocalizationButton['ChangeAll'].text,
+ title: 'Change All',
+ style: 'width: 100%;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ NS.LocalizationButton['ChangeAll'].instance = this;
+ },
+ onClick: handlerButtons
+ },
+ {
+ type: 'button',
+ id: 'AddWord',
+ label: NS.LocalizationButton['AddWord'].text,
+ title: 'Add word',
+ style: 'width: 100%;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ NS.LocalizationButton['AddWord'].instance = this;
+ },
+ onClick: handlerButtons
+ },
+ {
+ type: 'button',
+ id: 'FinishChecking',
+ label: NS.LocalizationButton['FinishChecking'].text,
+ title: 'Finish Checking',
+ style: 'width: 100%;margin-top: 9px;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ NS.LocalizationButton['FinishChecking'].instance = this;
+ },
+ onClick: handlerButtons
+ }
+ ]
+ },
+ {
+ type: 'vbox',
+ id: 'rightCol_col__right',
+ widths: ['50%', '50%', '50%'],
+ children: [
+ {
+ type: 'button',
+ id: 'IgnoreWord',
+ label: NS.LocalizationButton['IgnoreWord'].text,
+ title: 'Ignore word',
+ style: 'width: 100%;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ NS.LocalizationButton['IgnoreWord'].instance = this;
+ },
+ onClick: handlerButtons
+ },
+ {
+ type: 'button',
+ id: 'IgnoreAllWords',
+ label: NS.LocalizationButton['IgnoreAllWords'].text,
+ title: 'Ignore all words',
+ style: 'width: 100%;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ NS.LocalizationButton['IgnoreAllWords'].instance = this;
+ },
+ onClick: handlerButtons
+ },
+ {
+ type: 'button',
+ id: 'option',
+ label: NS.LocalizationButton['Options'].text,
+ title: 'Option',
+ style: 'width: 100%;',
+ onLoad: function() {
+ NS.LocalizationButton['Options'].instance = this;
+ },
+ onClick: function() {
+ editor.openDialog('options');
+ }
+ }
+ ]
+ }
+
+ ]
+ }
+ ]
+ },
+ {
+ type: 'hbox',
+ id: 'BlockFinishChecking',
+ widths: ['70%', '30%'],
+ onShow: function() {
+ this.getElement().hide();
+ },
+ onHide: showCurrentTabs,
+ children: [
+
+ {
+ type: 'hbox',
+ id: 'leftCol',
+ align: 'left',
+ width: '70%',
+ children: [
+ {
+ type: 'vbox',
+ id: 'rightCol1',
+ children: [
+ {
+ type: 'html',
+ id: 'logo',
+ html: '<img width="99" height="68" border="0" src="" title="WebSpellChecker.net" alt="WebSpellChecker.net" style="display: inline-block;">',
+ onShow: function() {
+ this.getElement().$.src = NS.logotype;
+ this.getElement().getParent().setStyles({
+ "text-align": "center"
+ })
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ type: 'hbox',
+ id: 'rightCol',
+ align: 'right',
+ width: '30%',
+ children: [
+ {
+ type: 'vbox',
+ id: 'rightCol_col__left',
+ children: [
+ {
+ type: 'button',
+ id: 'Option_button',
+ label: NS.LocalizationButton['Options'].text,
+ title: 'Option',
+ style: 'width: 100%;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ },
+ onClick: function() {
+ editor.openDialog('options');
+ }
+ },
+ {
+ type: 'button',
+ id: 'FinishChecking',
+ label: NS.LocalizationButton['FinishChecking'].text,
+ title: 'Finish Checking',
+ style: 'width: 100%;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ },
+ onClick: handlerButtons
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ id: 'GrammTab',
+ label: 'Grammar',
+ accessKey: 'G',
+ elements: [
+ {
+ type: 'html',
+ id: 'banner',
+ label: 'banner',
+ html: '<div></div>'
+ },
+ {
+ type: 'html',
+ id: 'Content',
+ label: 'GrammarContent',
+ html: '',
+ onShow: function() {
+ var tabId = NS.iframeNumber + '_' + NS.dialog._.currentTabId;
+ var iframe = document.getElementById(tabId);
+ NS.targetFromFrame[tabId] = iframe.contentWindow;
+ }
+ },
+ {
+ type: 'vbox',
+ id: 'bottomGroup',
+ children: [
+ {
+ type: 'hbox',
+ id: 'leftCol',
+ widths: ['66%', '34%'],
+ children: [
+ {
+ type: 'vbox',
+ children: [
+ {
+ type: 'text',
+ id: 'text',
+ label: "Change to:",
+ labelLayout: 'horizontal',
+ labelStyle: 'font: 12px/25px arial, sans-serif; float: right;margin-right: 80px;',
+ inputStyle: '',
+ width: '200px',
+ 'default': '',
+ onLoad: function(e) {
+ NS.textNode['GrammTab'] = this;
+ },
+ onHide: function() {
+ this.reset();
+ }
+ },
+ {
+
+ type: 'html',
+ id: 'html_text',
+ html: "<div style='min-height: 17px; width: 330px; line-height: 17px; padding: 5px; text-align: left;background: #F1F1F1;color: #595959; white-space: normal!important;'></div>",
+ onLoad: function(e) {
+ NS.textNodeInfo['GrammTab'] = this;
+ }
+ },
+ {
+ type: 'html',
+ id: 'radio',
+ html: "",
+ onLoad: function() {
+ NS.grammerSuggest = this;
+ }
+ }
+ ]
+ },
+ {
+ type: 'vbox',
+ children: [
+ {
+ type: 'button',
+ id: 'ChangeTo',
+ label: 'Change to',
+ title: 'Change to',
+ style: 'width: 133px; float: right;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ },
+ onClick: handlerButtons
+ },
+ {
+ type: 'button',
+ id: 'IgnoreWord',
+ label: 'Ignore word',
+ title: 'Ignore word',
+ style: 'width: 133px; float: right;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ },
+ onClick: handlerButtons
+ },
+ {
+ type: 'button',
+ id: 'IgnoreAllWords',
+ label: 'Ignore Problem',
+ title: 'Ignore Problem',
+ style: 'width: 133px; float: right;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ },
+ onClick: handlerButtons
+ },
+ {
+ type: 'button',
+ id: 'FinishChecking',
+ label: 'Finish Checking',
+ title: 'Finish Checking',
+ style: 'width: 133px; float: right; margin-top: 9px;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ },
+ onClick: handlerButtons
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ type: 'hbox',
+ id: 'BlockFinishChecking',
+ widths: ['70%', '30%'],
+ onShow: function() {
+ this.getElement().hide();
+ },
+ onHide: showCurrentTabs,
+ children: [
+ {
+ type: 'hbox',
+ id: 'leftCol',
+ align: 'left',
+ width: '70%',
+ children: [
+ {
+ type: 'vbox',
+ id: 'rightCol1',
+ children: [
+ {
+ type: 'html',
+ id: 'logo',
+ html: '<img width="99" height="68" border="0" src="" title="WebSpellChecker.net" alt="WebSpellChecker.net" style="display: inline-block;">',
+ onShow: function() {
+ this.getElement().$.src = NS.logotype;
+ this.getElement().getParent().setStyles({
+ "text-align": "center"
+ })
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ type: 'hbox',
+ id: 'rightCol',
+ align: 'right',
+ width: '30%',
+ children: [
+ {
+ type: 'vbox',
+ id: 'rightCol_col__left',
+ children: [
+ {
+ type: 'button',
+ id: 'FinishChecking',
+ label: 'Finish Checking',
+ title: 'Finish Checking',
+ style: 'width: 100%;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ },
+ onClick: handlerButtons
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ id: 'Thesaurus',
+ label: 'Thesaurus',
+ accessKey: 'T',
+ elements: [
+ {
+ type: 'html',
+ id: 'banner',
+ label: 'banner',
+ html: '<div></div>'
+ },
+ {
+ type: 'html',
+ id: 'Content',
+ label: 'spellContent',
+ html: '',
+ onShow: function() {
+ var tabId = NS.iframeNumber + '_' + NS.dialog._.currentTabId;
+ var iframe = document.getElementById(tabId);
+ NS.targetFromFrame[tabId] = iframe.contentWindow;
+ }
+ },
+ {
+ type: 'vbox',
+ id: 'bottomGroup',
+ children: [
+ {
+ type: 'hbox',
+ widths: ['75%', '25%'],
+ children: [
+ {
+ type: 'vbox',
+ children: [
+ {
+ type: 'hbox',
+ widths: ['65%', '35%'],
+ children: [
+ {
+ type: 'text',
+ id: 'ChangeTo',
+ label: 'Change to:',
+ labelLayout: 'horizontal',
+ inputStyle: 'width: 160px;',
+ labelStyle: 'font: 12px/25px arial, sans-serif;',
+ 'default': '',
+ onLoad: function(e) {
+ NS.textNode['Thesaurus'] = this;
+ },
+ onHide: function() {
+ this.reset();
+ }
+ },
+ {
+ type: 'button',
+ id: 'ChangeTo',
+ label: 'Change to',
+ title: 'Change to',
+ style: 'width: 121px; margin-top: 1px;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ },
+ onClick: handlerButtons
+ }
+ ]
+ },
+ {
+ type: 'hbox',
+ children: [
+ {
+ type: 'select',
+ id: 'categories',
+ label: "Categories:",
+ labelStyle: 'font: 12px/25px arial, sans-serif;',
+ size: '6',
+ inputStyle: 'width: 180px; height: auto;',
+ items: [],
+ onLoad: function(e) {
+ NS.selectNode['categories'] = this;
+
+ },
+ onHide: function() {
+ this.clear();
+ },
+ onChange: function() {
+ NS.buildOptionSynonyms(this.getValue())
+ }
+ },
+ {
+ type: 'select',
+ id: 'synonyms',
+ label: "Synonyms:",
+ labelStyle: 'font: 12px/25px arial, sans-serif;',
+ size: '6',
+ inputStyle: 'width: 180px; height: auto;',
+ items: [],
+ onLoad: function(e) {
+ NS.selectNode['synonyms'] = this;
+ },
+ onShow: function() {
+ NS.textNode['Thesaurus'].setValue(this.getValue());
+ },
+ onHide: function() {
+ this.clear();
+ },
+ onChange: function(e) {
+ NS.textNode['Thesaurus'].setValue(this.getValue());
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ type: 'vbox',
+ width: '120px',
+ style: "margin-top:46px;",
+ children: [
+ {
+ type: 'html',
+ id: 'logotype',
+ label: 'WebSpellChecker.net',
+ html: '<img width="99" height="68" border="0" src="" title="WebSpellChecker.net" alt="WebSpellChecker.net" style="display: inline-block;">',
+ onShow: function() {
+ this.getElement().$.src = NS.logotype;
+ this.getElement().getParent().setStyles({
+ "text-align": "center"
+ })
+ }
+ },
+ {
+ type: 'button',
+ id: 'FinishChecking',
+ label: 'Finish Checking',
+ title: 'Finish Checking',
+ style: 'width: 121px; float: right; margin-top: 9px;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ },
+ onClick: handlerButtons
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ type: 'hbox',
+ id: 'BlockFinishChecking',
+ widths: ['70%', '30%'],
+ onShow: function() {
+ this.getElement().hide();
+ },
+ onHide: showCurrentTabs,
+ children: [
+ {
+ type: 'hbox',
+ id: 'leftCol',
+ align: 'left',
+ width: '70%',
+ children: [
+ {
+ type: 'vbox',
+ id: 'rightCol1',
+ children: [
+ {
+ type: 'html',
+ id: 'logo',
+ html: '<img width="99" height="68" border="0" src="" title="WebSpellChecker.net" alt="WebSpellChecker.net" style="display: inline-block;">',
+ onShow: function() {
+ this.getElement().$.src = NS.logotype;
+ this.getElement().getParent().setStyles({
+ "text-align": "center"
+ })
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ type: 'hbox',
+ id: 'rightCol',
+ align: 'right',
+ width: '30%',
+ children: [
+ {
+ type: 'vbox',
+ id: 'rightCol_col__left',
+ children: [
+ {
+ type: 'button',
+ id: 'FinishChecking',
+ label: 'Finish Checking',
+ title: 'Finish Checking',
+ style: 'width: 100%;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ },
+ onClick: handlerButtons
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ };
+});
+
+
+// Options dialog
+CKEDITOR.dialog.add('options', function(editor) {
+ var manageMessage = new ManagerPostMessage;
+ var dialog = null;
+ var linkOnCheckbox = {};
+ var checkboxState = {};
+ var ospString = null;
+ var OptionsTextError = null;
+ var cmd = null;
+
+ var set_osp = [];
+ var dictionaryState = {
+ 'udn': tools.getCookie('udn'),
+ 'osp': tools.getCookie('osp')
+ //'ud': tools.getCookie('ud'),
+ //'cmd': ''
+ }
+
+ var setHandlerOptions = function() {
+ var osp = tools.getCookie('osp');
+ strToArr = osp.split('');
+
+ checkboxState['IgnoreAllCapsWords'] = strToArr[0];
+ checkboxState['IgnoreWordsNumbers'] = strToArr[1];
+ checkboxState['IgnoreMixedCaseWords'] = strToArr[2];
+ checkboxState['IgnoreDomainNames'] = strToArr[3];
+ };
+
+ var sendDicOptions = function(event) {
+ event = event || window.event;
+ cmd = this.getElement().getAttribute("title-cmd");
+ var osp = [];
+
+ osp[0] = checkboxState['IgnoreAllCapsWords'];
+ osp[1] = checkboxState['IgnoreWordsNumbers'];
+ osp[2] = checkboxState['IgnoreMixedCaseWords'];
+ osp[3] = checkboxState['IgnoreDomainNames'];
+
+ osp = osp.toString().replace(/,/g, "");
+
+
+ tools.setCookie('osp', osp);
+ tools.setCookie('udnCmd', cmd ? cmd : 'ignore');
+ if (cmd == "delete") {
+
+ manageMessage.send({
+ 'id': 'options_dic_send'
+ });
+ } else {
+ tools.setCookie('udn', nameNode.getValue() == '' ? '' : nameNode.getValue());
+ manageMessage.send({
+ 'id': 'options_dic_send'
+ });
+ };
+
+ };
+
+
+ var sendAllOptions = function() {
+ var osp = [];
+
+ osp[0] = checkboxState['IgnoreAllCapsWords'];
+ osp[1] = checkboxState['IgnoreWordsNumbers'];
+ osp[2] = checkboxState['IgnoreMixedCaseWords'];
+ osp[3] = checkboxState['IgnoreDomainNames'];
+
+ osp = osp.toString().replace(/,/g, "");
+
+ tools.setCookie('osp', osp);
+ tools.setCookie('udn', nameNode.getValue());
+ //tools.setCookie('udnCmd', cmd ? cmd : 'ignore');
+ //tools.setCookie('ud', tools.getCookie('ud'));
+
+ manageMessage.send({
+ 'id': 'options_checkbox_send'
+ });
+
+
+ };
+
+ var cameOptions = function() {
+ OptionsTextError.getElement().setHtml(NS.LocalizationComing['error']);
+ OptionsTextError.getElement().show();
+ };
+
+ return {
+ title: NS.LocalizationComing['Options'],
+ minWidth: 430,
+ minHeight: 130,
+ resizable: CKEDITOR.DIALOG_RESIZE_NONE,
+ contents: [
+ {
+ id: 'OptionsTab',
+ label: 'Options',
+ accessKey: 'O',
+ elements: [
+ {
+ type: 'hbox',
+ id: 'options_error',
+ children: [
+ {
+ type: 'html',
+ style: "display: block;text-align: center;white-space: normal!important; font-size: 12px;color:red",
+ html: '<div></div>',
+ onShow: function() {
+ OptionsTextError = this;
+ }
+ }
+ ]
+ },
+ {
+ type: 'vbox',
+ id: 'Options_content',
+ children: [
+ {
+ type: 'hbox',
+ id: 'Options_manager',
+ widths: ['52%', '48%'],
+ children: [
+ {
+ type: 'fieldset',
+ label: 'Spell Checking Options',
+ style: 'border: none;margin-top: 13px;padding: 10px 0 10px 10px',
+ onShow: function() {
+ this.getInputElement().$.children[0].innerHTML = NS.LocalizationComing['SpellCheckingOptions'];
+ },
+ children: [
+ {
+ type: 'vbox',
+ id: 'Options_checkbox',
+ children: [
+ {
+ type: 'checkbox',
+ id: 'IgnoreAllCapsWords',
+ label: 'Ignore All-Caps Words',
+ labelStyle: 'margin-left: 5px; font: 12px/16px arial, sans-serif;display: inline-block;white-space: normal;',
+ style: "float:left; min-height: 16px;",
+ 'default': '',
+ onClick: function() {
+ checkboxState[this.id] = (this.getValue() == false) ? 0 : 1;
+ }
+ },
+ {
+ type: 'checkbox',
+ id: 'IgnoreWordsNumbers',
+ label: 'Ignore Words with Numbers',
+ labelStyle: 'margin-left: 5px; font: 12px/16px arial, sans-serif;display: inline-block;white-space: normal;',
+ style: "float:left; min-height: 16px;",
+ 'default': '',
+ onClick: function() {
+ checkboxState[this.id] = (this.getValue() == false) ? 0 : 1;
+ }
+ },
+ {
+ type: 'checkbox',
+ id: 'IgnoreMixedCaseWords',
+ label: 'Ignore Mixed-Case Words',
+ labelStyle: 'margin-left: 5px; font: 12px/16px arial, sans-serif;display: inline-block;white-space: normal;',
+ style: "float:left; min-height: 16px;",
+ 'default': '',
+ onClick: function() {
+ checkboxState[this.id] = (this.getValue() == false) ? 0 : 1;
+ }
+ },
+ {
+ type: 'checkbox',
+ id: 'IgnoreDomainNames',
+ label: 'Ignore Domain Names',
+ labelStyle: 'margin-left: 5px; font: 12px/16px arial, sans-serif;display: inline-block;white-space: normal;',
+ style: "float:left; min-height: 16px;",
+ 'default': '',
+ onClick: function() {
+ checkboxState[this.id] = (this.getValue() == false) ? 0 : 1;
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ type: 'vbox',
+ id: 'Options_DictionaryName',
+ children: [
+ {
+ type: 'text',
+ id: 'DictionaryName',
+ style: 'margin-bottom: 10px',
+ label: 'Dictionary Name:',
+ labelLayout: 'vertical',
+ labelStyle: 'font: 12px/25px arial, sans-serif;',
+ 'default': '',
+ onLoad: function() {
+ nameNode = this;
+ var udn = NS.userDictionaryName ? NS.userDictionaryName : tools.getCookie('udn') && undefined ? ' ' : this.getValue();
+ this.setValue(udn);
+ },
+ onShow: function() {
+ nameNode = this;
+ var udn = !tools.getCookie('udn') ? this.getValue() : tools.getCookie('udn');
+ this.setValue(udn);
+
+ this.setLabel(NS.LocalizationComing['DictionaryName']);
+ },
+ onHide: function() {
+ this.reset();
+ }
+ },
+ {
+ type: 'hbox',
+ id: 'Options_buttons',
+ children: [
+
+ {
+ type: 'vbox',
+ id: 'Options_leftCol_col',
+ widths: ['50%', '50%'],
+ children: [
+ {
+ type: 'button',
+ id: 'create',
+ label: 'Create',
+ title: 'Create',
+ style: 'width: 100%;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ },
+ onShow: function() {
+ this.getElement().setText(NS.LocalizationComing['Create']);
+ },
+ onClick: sendDicOptions
+ },
+ {
+ type: 'button',
+ id: 'restore',
+ label: 'Restore',
+ title: 'Restore',
+ style: 'width: 100%;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ },
+ onShow: function() {
+ this.getElement().setText(NS.LocalizationComing['Restore']);
+ },
+ onClick: sendDicOptions
+ }
+ ]
+ },
+ {
+ type: 'vbox',
+ id: 'Options_rightCol_col',
+ widths: ['50%', '50%'],
+ children: [
+ {
+ type: 'button',
+ id: 'rename',
+ label: 'Rename',
+ title: 'Rename',
+ style: 'width: 100%;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ },
+ onShow: function() {
+ this.getElement().setText(NS.LocalizationComing['Rename']);
+ },
+ onClick: sendDicOptions
+ },
+ {
+ type: 'button',
+ id: 'delete',
+ label: 'Remove',
+ title: 'Remove',
+ style: 'width: 100%;',
+ onLoad: function() {
+ this.getElement().setAttribute("title-cmd", this.id);
+ },
+ onShow: function() {
+ this.getElement().setText(NS.LocalizationComing['Remove']);
+ },
+ onClick: sendDicOptions
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ type: 'hbox',
+ id: 'Options_text',
+ children: [
+ {
+ type: 'html',
+ style: "text-align: justify;margin-top: 15px;white-space: normal!important; font-size: 12px;color:#777;",
+ html: "<div>" + NS.LocalizationComing['OptionsTextIntro'] + "</div>",
+ onShow: function() {
+ this.getElement().setText(NS.LocalizationComing['OptionsTextIntro']);
+
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ buttons: [CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton],
+ onOk: function() {
+ //sendCheckboxOptions(checkboxState);
+ sendAllOptions();
+ OptionsTextError.getElement().hide();
+ OptionsTextError.getElement().setHtml(' ');
+ },
+ onLoad: function() {
+ dialog = this;
+ manageMessage.init(cameOptions);
+
+ linkOnCheckbox['IgnoreAllCapsWords'] = dialog.getContentElement('OptionsTab', 'IgnoreAllCapsWords');
+ linkOnCheckbox['IgnoreWordsNumbers'] = dialog.getContentElement('OptionsTab', 'IgnoreWordsNumbers');
+ linkOnCheckbox['IgnoreMixedCaseWords'] = dialog.getContentElement('OptionsTab', 'IgnoreMixedCaseWords');
+ linkOnCheckbox['IgnoreDomainNames'] = dialog.getContentElement('OptionsTab', 'IgnoreDomainNames');
+
+ },
+ onShow: function() {
+ setHandlerOptions();
+
+ (checkboxState['IgnoreAllCapsWords'] == 0) ? linkOnCheckbox['IgnoreAllCapsWords'].setValue('', false) : linkOnCheckbox['IgnoreAllCapsWords'].setValue('checked', false);
+ (checkboxState['IgnoreWordsNumbers'] == 0) ? linkOnCheckbox['IgnoreWordsNumbers'].setValue('', false) : linkOnCheckbox['IgnoreWordsNumbers'].setValue('checked', false);
+ (checkboxState['IgnoreMixedCaseWords'] == 0) ? linkOnCheckbox['IgnoreMixedCaseWords'].setValue('', false) : linkOnCheckbox['IgnoreMixedCaseWords'].setValue('checked', false);
+ (checkboxState['IgnoreDomainNames'] == 0) ? linkOnCheckbox['IgnoreDomainNames'].setValue('', false) : linkOnCheckbox['IgnoreDomainNames'].setValue('checked', false);
+
+ checkboxState['IgnoreAllCapsWords'] = (linkOnCheckbox['IgnoreAllCapsWords'].getValue() == false) ? 0 : 1;
+ checkboxState['IgnoreWordsNumbers'] = (linkOnCheckbox['IgnoreWordsNumbers'].getValue() == false) ? 0 : 1;
+ checkboxState['IgnoreMixedCaseWords'] = (linkOnCheckbox['IgnoreMixedCaseWords'].getValue() == false) ? 0 : 1;
+ checkboxState['IgnoreDomainNames'] = (linkOnCheckbox['IgnoreDomainNames'].getValue() == false) ? 0 : 1;
+
+ linkOnCheckbox['IgnoreAllCapsWords'].getElement().$.lastChild.innerHTML = NS.LocalizationComing['IgnoreAllCapsWords'];
+ linkOnCheckbox['IgnoreWordsNumbers'].getElement().$.lastChild.innerHTML = NS.LocalizationComing['IgnoreWordsWithNumbers'];
+ linkOnCheckbox['IgnoreMixedCaseWords'].getElement().$.lastChild.innerHTML = NS.LocalizationComing['IgnoreMixedCaseWords'];
+ linkOnCheckbox['IgnoreDomainNames'].getElement().$.lastChild.innerHTML = NS.LocalizationComing['IgnoreDomainNames'];
+ }
+ };
+});