update address standardization for cust_location changes
[freeside.git] / rt / share / html / NoAuth / RichText / FCKeditor / editor / dialog / fck_spellerpages / spellerpages / wordWindow.js
diff --git a/rt/share/html/NoAuth/RichText/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/wordWindow.js b/rt/share/html/NoAuth/RichText/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/wordWindow.js
deleted file mode 100644 (file)
index 7990296..0000000
+++ /dev/null
@@ -1,272 +0,0 @@
-////////////////////////////////////////////////////\r
-// wordWindow object\r
-////////////////////////////////////////////////////\r
-function wordWindow() {\r
-       // private properties\r
-       this._forms = [];\r
-\r
-       // private methods\r
-       this._getWordObject = _getWordObject;\r
-       //this._getSpellerObject = _getSpellerObject;\r
-       this._wordInputStr = _wordInputStr;\r
-       this._adjustIndexes = _adjustIndexes;\r
-       this._isWordChar = _isWordChar;\r
-       this._lastPos = _lastPos;\r
-\r
-       // public properties\r
-       this.wordChar = /[a-zA-Z]/;\r
-       this.windowType = "wordWindow";\r
-       this.originalSpellings = new Array();\r
-       this.suggestions = new Array();\r
-       this.checkWordBgColor = "pink";\r
-       this.normWordBgColor = "white";\r
-       this.text = "";\r
-       this.textInputs = new Array();\r
-       this.indexes = new Array();\r
-       //this.speller = this._getSpellerObject();\r
-\r
-       // public methods\r
-       this.resetForm = resetForm;\r
-       this.totalMisspellings = totalMisspellings;\r
-       this.totalWords = totalWords;\r
-       this.totalPreviousWords = totalPreviousWords;\r
-       //this.getTextObjectArray = getTextObjectArray;\r
-       this.getTextVal = getTextVal;\r
-       this.setFocus = setFocus;\r
-       this.removeFocus = removeFocus;\r
-       this.setText = setText;\r
-       //this.getTotalWords = getTotalWords;\r
-       this.writeBody = writeBody;\r
-       this.printForHtml = printForHtml;\r
-}\r
-\r
-function resetForm() {\r
-       if( this._forms ) {\r
-               for( var i = 0; i < this._forms.length; i++ ) {\r
-                       this._forms[i].reset();\r
-               }\r
-       }\r
-       return true;\r
-}\r
-\r
-function totalMisspellings() {\r
-       var total_words = 0;\r
-       for( var i = 0; i < this.textInputs.length; i++ ) {\r
-               total_words += this.totalWords( i );\r
-       }\r
-       return total_words;\r
-}\r
-\r
-function totalWords( textIndex ) {\r
-       return this.originalSpellings[textIndex].length;\r
-}\r
-\r
-function totalPreviousWords( textIndex, wordIndex ) {\r
-       var total_words = 0;\r
-       for( var i = 0; i <= textIndex; i++ ) {\r
-               for( var j = 0; j < this.totalWords( i ); j++ ) {\r
-                       if( i == textIndex && j == wordIndex ) {\r
-                               break;\r
-                       } else {\r
-                               total_words++;\r
-                       }\r
-               }\r
-       }\r
-       return total_words;\r
-}\r
-\r
-//function getTextObjectArray() {\r
-//     return this._form.elements;\r
-//}\r
-\r
-function getTextVal( textIndex, wordIndex ) {\r
-       var word = this._getWordObject( textIndex, wordIndex );\r
-       if( word ) {\r
-               return word.value;\r
-       }\r
-}\r
-\r
-function setFocus( textIndex, wordIndex ) {\r
-       var word = this._getWordObject( textIndex, wordIndex );\r
-       if( word ) {\r
-               if( word.type == "text" ) {\r
-                       word.focus();\r
-                       word.style.backgroundColor = this.checkWordBgColor;\r
-               }\r
-       }\r
-}\r
-\r
-function removeFocus( textIndex, wordIndex ) {\r
-       var word = this._getWordObject( textIndex, wordIndex );\r
-       if( word ) {\r
-               if( word.type == "text" ) {\r
-                       word.blur();\r
-                       word.style.backgroundColor = this.normWordBgColor;\r
-               }\r
-       }\r
-}\r
-\r
-function setText( textIndex, wordIndex, newText ) {\r
-       var word = this._getWordObject( textIndex, wordIndex );\r
-       var beginStr;\r
-       var endStr;\r
-       if( word ) {\r
-               var pos = this.indexes[textIndex][wordIndex];\r
-               var oldText = word.value;\r
-               // update the text given the index of the string\r
-               beginStr = this.textInputs[textIndex].substring( 0, pos );\r
-               endStr = this.textInputs[textIndex].substring(\r
-                       pos + oldText.length,\r
-                       this.textInputs[textIndex].length\r
-               );\r
-               this.textInputs[textIndex] = beginStr + newText + endStr;\r
-\r
-               // adjust the indexes on the stack given the differences in\r
-               // length between the new word and old word.\r
-               var lengthDiff = newText.length - oldText.length;\r
-               this._adjustIndexes( textIndex, wordIndex, lengthDiff );\r
-\r
-               word.size = newText.length;\r
-               word.value = newText;\r
-               this.removeFocus( textIndex, wordIndex );\r
-       }\r
-}\r
-\r
-\r
-function writeBody() {\r
-       var d = window.document;\r
-       var is_html = false;\r
-\r
-       d.open();\r
-\r
-       // iterate through each text input.\r
-       for( var txtid = 0; txtid < this.textInputs.length; txtid++ ) {\r
-               var end_idx = 0;\r
-               var begin_idx = 0;\r
-               d.writeln( '<form name="textInput'+txtid+'">' );\r
-               var wordtxt = this.textInputs[txtid];\r
-               this.indexes[txtid] = [];\r
-\r
-               if( wordtxt ) {\r
-                       var orig = this.originalSpellings[txtid];\r
-                       if( !orig ) break;\r
-\r
-                       //!!! plain text, or HTML mode?\r
-                       d.writeln( '<div class="plainText">' );\r
-                       // iterate through each occurrence of a misspelled word.\r
-                       for( var i = 0; i < orig.length; i++ ) {\r
-                               // find the position of the current misspelled word,\r
-                               // starting at the last misspelled word.\r
-                               // and keep looking if it's a substring of another word\r
-                               do {\r
-                                       begin_idx = wordtxt.indexOf( orig[i], end_idx );\r
-                                       end_idx = begin_idx + orig[i].length;\r
-                                       // word not found? messed up!\r
-                                       if( begin_idx == -1 ) break;\r
-                                       // look at the characters immediately before and after\r
-                                       // the word. If they are word characters we'll keep looking.\r
-                                       var before_char = wordtxt.charAt( begin_idx - 1 );\r
-                                       var after_char = wordtxt.charAt( end_idx );\r
-                               } while (\r
-                                       this._isWordChar( before_char )\r
-                                       || this._isWordChar( after_char )\r
-                               );\r
-\r
-                               // keep track of its position in the original text.\r
-                               this.indexes[txtid][i] = begin_idx;\r
-\r
-                               // write out the characters before the current misspelled word\r
-                               for( var j = this._lastPos( txtid, i ); j < begin_idx; j++ ) {\r
-                                       // !!! html mode? make it html compatible\r
-                                       d.write( this.printForHtml( wordtxt.charAt( j )));\r
-                               }\r
-\r
-                               // write out the misspelled word.\r
-                               d.write( this._wordInputStr( orig[i] ));\r
-\r
-                               // if it's the last word, write out the rest of the text\r
-                               if( i == orig.length-1 ){\r
-                                       d.write( printForHtml( wordtxt.substr( end_idx )));\r
-                               }\r
-                       }\r
-\r
-                       d.writeln( '</div>' );\r
-\r
-               }\r
-               d.writeln( '</form>' );\r
-       }\r
-       //for ( var j = 0; j < d.forms.length; j++ ) {\r
-       //      alert( d.forms[j].name );\r
-       //      for( var k = 0; k < d.forms[j].elements.length; k++ ) {\r
-       //              alert( d.forms[j].elements[k].name + ": " + d.forms[j].elements[k].value );\r
-       //      }\r
-       //}\r
-\r
-       // set the _forms property\r
-       this._forms = d.forms;\r
-       d.close();\r
-}\r
-\r
-// return the character index in the full text after the last word we evaluated\r
-function _lastPos( txtid, idx ) {\r
-       if( idx > 0 )\r
-               return this.indexes[txtid][idx-1] + this.originalSpellings[txtid][idx-1].length;\r
-       else\r
-               return 0;\r
-}\r
-\r
-function printForHtml( n ) {\r
-       return n ;              // by FredCK\r
-/*\r
-       var htmlstr = n;\r
-       if( htmlstr.length == 1 ) {\r
-               // do simple case statement if it's just one character\r
-               switch ( n ) {\r
-                       case "\n":\r
-                               htmlstr = '<br/>';\r
-                               break;\r
-                       case "<":\r
-                               htmlstr = '&lt;';\r
-                               break;\r
-                       case ">":\r
-                               htmlstr = '&gt;';\r
-                               break;\r
-               }\r
-               return htmlstr;\r
-       } else {\r
-               htmlstr = htmlstr.replace( /</g, '&lt' );\r
-               htmlstr = htmlstr.replace( />/g, '&gt' );\r
-               htmlstr = htmlstr.replace( /\n/g, '<br/>' );\r
-               return htmlstr;\r
-       }\r
-*/\r
-}\r
-\r
-function _isWordChar( letter ) {\r
-       if( letter.search( this.wordChar ) == -1 ) {\r
-               return false;\r
-       } else {\r
-               return true;\r
-       }\r
-}\r
-\r
-function _getWordObject( textIndex, wordIndex ) {\r
-       if( this._forms[textIndex] ) {\r
-               if( this._forms[textIndex].elements[wordIndex] ) {\r
-                       return this._forms[textIndex].elements[wordIndex];\r
-               }\r
-       }\r
-       return null;\r
-}\r
-\r
-function _wordInputStr( word ) {\r
-       var str = '<input readonly ';\r
-       str += 'class="blend" type="text" value="' + word + '" size="' + word.length + '">';\r
-       return str;\r
-}\r
-\r
-function _adjustIndexes( textIndex, wordIndex, lengthDiff ) {\r
-       for( var i = wordIndex + 1; i < this.originalSpellings[textIndex].length; i++ ) {\r
-               this.indexes[textIndex][i] = this.indexes[textIndex][i] + lengthDiff;\r
-       }\r
-}\r