Changeset 900

Show
Ignore:
Timestamp:
2007-09-28 10:04:26 (14 months ago)
Author:
martinkou
Message:

Fixed #356 and #363 : Merged find and replace dialogs.

Location:
FCKeditor/trunk/editor
Files:
9 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/editor/dialog/fck_replace.html

    r743 r900  
    2020 * == END LICENSE == 
    2121 * 
    22  * "Replace" dialog box window. 
     22 * "Find" and "Replace" dialog box window. 
    2323--> 
    2424<html xmlns="http://www.w3.org/1999/xhtml"> 
     
    2727        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    2828        <meta content="noindex, nofollow" name="robots" /> 
     29        <script src="common/fck_dialog_common.js" type="text/javascript"></script> 
    2930        <script type="text/javascript"> 
    3031 
    3132var oEditor = window.parent.InnerDialogLoaded() ; 
     33var FCKLang = oEditor.FCKLang ; 
     34 
     35window.parent.AddTab( 'Find', FCKLang.DlgFindTitle ) ; 
     36window.parent.AddTab( 'Replace', FCKLang.DlgReplaceTitle ) ; 
     37var idMap = {} ; 
     38 
     39function OnDialogTabChange( tabCode ) 
     40{ 
     41        ShowE( 'divFind', ( tabCode == 'Find' ) ) ; 
     42        ShowE( 'divReplace', ( tabCode == 'Replace' ) ) ; 
     43        idMap['FindText'] = 'txtFind' + tabCode ; 
     44        idMap['CheckCase'] = 'chkCase' + tabCode ; 
     45        idMap['CheckWord'] = 'chkWord' + tabCode ; 
     46 
     47        window.parent.SetAutoSize( true ) ; 
     48} 
    3249 
    3350function OnLoad() 
     
    4562        range.Collapse( true ) ; 
    4663        range.Select() ; 
     64 
     65        // Show the appropriate tab at startup. 
     66        if ( window.parent.name.search( 'Replace' ) == -1 ) 
     67                window.parent.SetSelectedTab( 'Find' ) ; 
     68        else 
     69                window.parent.SetSelectedTab( 'Replace' ) ; 
    4770} 
    4871 
     
    5174        document.getElementById('btnReplace').disabled = 
    5275                document.getElementById('btnReplaceAll').disabled = 
    53                         ( document.getElementById('txtFind').value.length == 0 ) ; 
     76                        document.getElementById('btnFind').disabled = 
     77                                ( document.getElementById(idMap["FindText"]).value.length == 0 ) ; 
    5478} 
    5579 
     
    6387function GetSearchString() 
    6488{ 
    65         return document.getElementById("txtFind").value ; 
     89        return document.getElementById(idMap['FindText']).value ; 
    6690} 
    6791 
     
    7397function GetCheckCase() 
    7498{ 
    75         return !! ( document.getElementById("chkCase").checked ) ; 
     99        return !! ( document.getElementById(idMap['CheckCase']).checked ) ; 
    76100} 
    77101 
    78102function GetMatchWord() 
    79103{ 
    80         return !! ( document.getElementById("chkWord").checked ) ; 
     104        return !! ( document.getElementById(idMap['CheckWord']).checked ) ; 
    81105} 
    82106 
     
    210234}; 
    211235 
    212 function Find() 
     236function _Find() 
    213237{ 
    214238        // Start from the end of the current selection. 
     
    308332} 
    309333 
     334function Find() 
     335{ 
     336        var range = new oEditor.FCKDomRange( oEditor.FCK.EditorWindow ) ; 
     337        range.MoveToSelection() ; 
     338        range.Collapse( false ) ; 
     339        range.Select() ; 
     340 
     341        if ( ! _Find() ) 
     342                alert( FCKLang.DlgFindNotFoundMsg ) ; 
     343} 
     344 
    310345function Replace() 
    311346{ 
     
    315350        if ( selection.CheckIsCollapsed() ) 
    316351        { 
    317                 if (! Find() ) 
    318                         alert( oEditor.FCKLang.DlgFindNotFoundMsg ) ; 
     352                if (! _Find() ) 
     353                        alert( FCKLang.DlgFindNotFoundMsg ) ; 
    319354        } 
    320355        else 
     
    335370        var replaceCount = 0 ; 
    336371 
    337         while ( Find() ) 
     372        while ( _Find() ) 
    338373        { 
    339374                range.MoveToSelection() ; 
     
    345380        } 
    346381        if ( replaceCount == 0 ) 
    347                 alert( oEditor.FCKLang.DlgFindNotFoundMsg ) ; 
     382                alert( FCKLang.DlgFindNotFoundMsg ) ; 
    348383        window.parent.Cancel() ; 
    349384} 
     
    351386</head> 
    352387<body onload="OnLoad()" style="overflow: hidden"> 
    353         <table cellspacing="3" cellpadding="2" width="100%" border="0"> 
    354                 <tr> 
    355                         <td nowrap="nowrap"> 
    356                                 <label for="txtFind" fcklang="DlgReplaceFindLbl"> 
    357                                         Find what:</label> 
    358                         </td> 
    359                         <td width="100%"> 
    360                                 <input id="txtFind" onkeyup="btnStat(this.form)" style="width: 100%" tabindex="1" 
    361                                         type="text" /> 
    362                         </td> 
    363                         <td> 
    364                                 <input id="btnReplace" style="width: 100%" disabled="disabled" onclick="Replace();" 
    365                                         type="button" value="Replace" fcklang="DlgReplaceReplaceBtn" /> 
    366                         </td> 
    367                 </tr> 
    368                 <tr> 
    369                         <td valign="top" nowrap="nowrap"> 
    370                                 <label for="txtReplace" fcklang="DlgReplaceReplaceLbl"> 
    371                                         Replace with:</label> 
    372                         </td> 
    373                         <td valign="top"> 
    374                                 <input id="txtReplace" style="width: 100%" tabindex="2" type="text" /> 
    375                         </td> 
    376                         <td> 
    377                                 <input id="btnReplaceAll" disabled="disabled" onclick="ReplaceAll()" type="button" 
    378                                         value="Replace All" fcklang="DlgReplaceReplAllBtn" /> 
    379                         </td> 
    380                 </tr> 
    381                 <tr> 
    382                         <td valign="bottom" colspan="3"> 
    383                                 &nbsp;<input id="chkCase" tabindex="3" type="checkbox" /><label for="chkCase" fcklang="DlgReplaceCaseChk">Match 
    384                                         case</label> 
    385                                 <br /> 
    386                                 &nbsp;<input id="chkWord" tabindex="4" type="checkbox" /><label for="chkWord" fcklang="DlgReplaceWordChk">Match 
    387                                         whole word</label> 
    388                         </td> 
    389                 </tr> 
    390         </table> 
     388        <div id="divFind" style="display: none"> 
     389                <table cellspacing="3" cellpadding="2" width="100%" border="0"> 
     390                        <tr> 
     391                                <td nowrap="nowrap"> 
     392                                        <label for="txtFindFind" fcklang="DlgReplaceFindLbl"> 
     393                                                Find what:</label> 
     394                                </td> 
     395                                <td width="100%"> 
     396                                        <input id="txtFindFind" onkeyup="btnStat(this.form)" style="width: 100%" tabindex="1" 
     397                                                type="text" /> 
     398                                </td> 
     399                                <td> 
     400                                        <input id="btnFind" style="width: 80px" disabled="disabled" onclick="Find();" 
     401                                                type="button" value="Find" fcklang="DlgFindFindBtn" /> 
     402                                </td> 
     403                        </tr> 
     404                        <tr> 
     405                                <td valign="bottom" colspan="3"> 
     406                                        &nbsp;<input id="chkCaseFind" tabindex="3" type="checkbox" /><label for="chkCaseFind" fcklang="DlgReplaceCaseChk">Match 
     407                                                case</label> 
     408                                        <br /> 
     409                                        &nbsp;<input id="chkWordFind" tabindex="4" type="checkbox" /><label for="chkWordFind" fcklang="DlgReplaceWordChk">Match 
     410                                                whole word</label> 
     411                                </td> 
     412                        </tr> 
     413                </table> 
     414        </div> 
     415        <div id="divReplace" style="display:none"> 
     416                <table cellspacing="3" cellpadding="2" width="100%" border="0"> 
     417                        <tr> 
     418                                <td nowrap="nowrap"> 
     419                                        <label for="txtFindReplace" fcklang="DlgReplaceFindLbl"> 
     420                                                Find what:</label> 
     421                                </td> 
     422                                <td width="100%"> 
     423                                        <input id="txtFindReplace" onkeyup="btnStat(this.form)" style="width: 100%" tabindex="1" 
     424                                                type="text" /> 
     425                                </td> 
     426                                <td> 
     427                                        <input id="btnReplace" style="width: 80px" disabled="disabled" onclick="Replace();" 
     428                                                type="button" value="Replace" fcklang="DlgReplaceReplaceBtn" /> 
     429                                </td> 
     430                        </tr> 
     431                        <tr> 
     432                                <td valign="top" nowrap="nowrap"> 
     433                                        <label for="txtReplace" fcklang="DlgReplaceReplaceLbl"> 
     434                                                Replace with:</label> 
     435                                </td> 
     436                                <td valign="top"> 
     437                                        <input id="txtReplace" style="width: 100%" tabindex="2" type="text" /> 
     438                                </td> 
     439                                <td> 
     440                                        <input id="btnReplaceAll" style="width: 80px" disabled="disabled" onclick="ReplaceAll()" type="button" 
     441                                                value="Replace All" fcklang="DlgReplaceReplAllBtn" /> 
     442                                </td> 
     443                        </tr> 
     444                        <tr> 
     445                                <td valign="bottom" colspan="3"> 
     446                                        &nbsp;<input id="chkCaseReplace" tabindex="3" type="checkbox" /><label for="chkCaseReplace" fcklang="DlgReplaceCaseChk">Match 
     447                                                case</label> 
     448                                        <br /> 
     449                                        &nbsp;<input id="chkWordReplace" tabindex="4" type="checkbox" /><label for="chkWordReplace" fcklang="DlgReplaceWordChk">Match 
     450                                                whole word</label> 
     451                                </td> 
     452                        </tr> 
     453                </table> 
     454        </div> 
    391455</body> 
    392456</html> 
  • FCKeditor/trunk/editor/lang/en-au.js

    r850 r900  
    332332DlgCellBtnSelect        : "Select...", 
    333333 
     334// Find and Replace Dialog 
     335DlgFindAndReplaceTitle  : "Find and Replace", 
     336 
    334337// Find Dialog 
    335338DlgFindTitle            : "Find", 
  • FCKeditor/trunk/editor/lang/en-ca.js

    r850 r900  
    332332DlgCellBtnSelect        : "Select...", 
    333333 
     334// Find and Replace Dialog 
     335DlgFindAndReplaceTitle  : "Find and Replace", 
     336 
    334337// Find Dialog 
    335338DlgFindTitle            : "Find", 
  • FCKeditor/trunk/editor/lang/en.js

    r850 r900  
    332332DlgCellBtnSelect        : "Select...", 
    333333 
     334// Find and Replace Dialog 
     335DlgFindAndReplaceTitle  : "Find and Replace", 
     336 
    334337// Find Dialog 
    335338DlgFindTitle            : "Find", 
  • FCKeditor/trunk/editor/lang/en-uk.js

    r850 r900  
    332332DlgCellBtnSelect        : "Select...", 
    333333 
     334// Find and Replace Dialog 
     335DlgFindAndReplaceTitle  : "Find and Replace", 
     336 
    334337// Find Dialog 
    335338DlgFindTitle            : "Find", 
  • FCKeditor/trunk/editor/lang/zh-cn.js

    r850 r900  
    332332DlgCellBtnSelect        : "选择...", 
    333333 
     334// Find and Replace Dialog 
     335DlgFindAndReplaceTitle  : "查找和替换", 
     336 
    334337// Find Dialog 
    335338DlgFindTitle            : "查找", 
  • FCKeditor/trunk/editor/lang/zh.js

    r850 r900  
    332332DlgCellBtnSelect        : "請選擇…", 
    333333 
     334// Find and Replace Dialog 
     335DlgFindAndReplaceTitle  : "尋找與取代", 
     336 
    334337// Find Dialog 
    335338DlgFindTitle            : "尋找", 
  • FCKeditor/trunk/editor/_source/internals/fckcommands.js

    r869 r900  
    5858                case 'About'            : oCommand = new FCKDialogCommand( 'About'              , FCKLang.About                                 , 'dialog/fck_about.html'               , 400, 330 ) ; break ; 
    5959 
    60                 case 'Find'                     : oCommand = new FCKDialogCommand( 'Find'               , FCKLang.DlgFindTitle                  , 'dialog/fck_find.html'                , 340, 170, FCKCommands.GetBooleanState, FCKBrowserInfo.IsOpera ) ; break ; 
    61                 case 'Replace'          : oCommand = new FCKDialogCommand( 'Replace'    , FCKLang.DlgReplaceTitle               , 'dialog/fck_replace.html'             , 340, 200 ) ; break ; 
     60                case 'Find'                     : oCommand = new FCKDialogCommand( 'Find'               , FCKLang.DlgFindAndReplaceTitle                        , 'dialog/fck_replace.html'             , 340, 170 ) ; break ; 
     61                case 'Replace'          : oCommand = new FCKDialogCommand( 'Replace'    , FCKLang.DlgFindAndReplaceTitle                , 'dialog/fck_replace.html'             , 340, 220 ) ; break ; 
    6262 
    6363                case 'Image'            : oCommand = new FCKDialogCommand( 'Image'              , FCKLang.DlgImgTitle                   , 'dialog/fck_image.html'               , 450, 400 ) ; break ; 
  • FCKeditor/trunk/editor/_source/internals/fcktoolbarset.js

    r779 r900  
    102102                        oToolbarSet = eToolbarTarget.__FCKToolbarSet = new FCKToolbarSet( eTargetDocument ) ; 
    103103                        oToolbarSet._IFrame = eToolbarIFrame ; 
    104  
     104                         
    105105                        if ( FCK.IECleanup ) 
    106106                                FCK.IECleanup.AddItem( eToolbarTarget, FCKToolbarSet_Target_Cleanup ) ;