source: sandbox/expressoServiceImap/library/ckeditor/plugins/aspell/spellerpages/controlWindow.js @ 5081

Revision 5081, 2.2 KB checked in by airton, 13 years ago (diff)

Ticket #2086 - Troca do atual editor de emails do expresso - Adicionando a biblioteca ckeditor

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