source: trunk/admin/inc/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/controlWindow.js@ 2

Last change on this file since 2 was 2, checked in by root, 15 years ago

importo il progetto

File size: 2.3 KB
Line 
1////////////////////////////////////////////////////
2// controlWindow object
3////////////////////////////////////////////////////
4function controlWindow( controlForm ) {
5 // private properties
6 this._form = controlForm;
7
8 // public properties
9 this.windowType = "controlWindow";
10// this.noSuggestionSelection = "- No suggestions -"; // by FredCK
11 this.noSuggestionSelection = FCKLang.DlgSpellNoSuggestions ;
12 // set up the properties for elements of the given control form
13 this.suggestionList = this._form.sugg;
14 this.evaluatedText = this._form.misword;
15 this.replacementText = this._form.txtsugg;
16 this.undoButton = this._form.btnUndo;
17
18 // public methods
19 this.addSuggestion = addSuggestion;
20 this.clearSuggestions = clearSuggestions;
21 this.selectDefaultSuggestion = selectDefaultSuggestion;
22 this.resetForm = resetForm;
23 this.setSuggestedText = setSuggestedText;
24 this.enableUndo = enableUndo;
25 this.disableUndo = disableUndo;
26}
27
28function resetForm() {
29 if( this._form ) {
30 this._form.reset();
31 }
32}
33
34function setSuggestedText() {
35 var slct = this.suggestionList;
36 var txt = this.replacementText;
37 var str = "";
38 if( (slct.options[0].text) && slct.options[0].text != this.noSuggestionSelection ) {
39 str = slct.options[slct.selectedIndex].text;
40 }
41 txt.value = str;
42}
43
44function selectDefaultSuggestion() {
45 var slct = this.suggestionList;
46 var txt = this.replacementText;
47 if( slct.options.length == 0 ) {
48 this.addSuggestion( this.noSuggestionSelection );
49 } else {
50 slct.options[0].selected = true;
51 }
52 this.setSuggestedText();
53}
54
55function addSuggestion( sugg_text ) {
56 var slct = this.suggestionList;
57 if( sugg_text ) {
58 var i = slct.options.length;
59 var newOption = new Option( sugg_text, 'sugg_text'+i );
60 slct.options[i] = newOption;
61 }
62}
63
64function clearSuggestions() {
65 var slct = this.suggestionList;
66 for( var j = slct.length - 1; j > -1; j-- ) {
67 if( slct.options[j] ) {
68 slct.options[j] = null;
69 }
70 }
71}
72
73function enableUndo() {
74 if( this.undoButton ) {
75 if( this.undoButton.disabled == true ) {
76 this.undoButton.disabled = false;
77 }
78 }
79}
80
81function disableUndo() {
82 if( this.undoButton ) {
83 if( this.undoButton.disabled == false ) {
84 this.undoButton.disabled = true;
85 }
86 }
87}
Note: See TracBrowser for help on using the repository browser.