From 2ed832c729c3d602fc5fe43d9b76405a35eecd39 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Fri, 7 Sep 2012 17:31:25 +0100 Subject: [PATCH] Param adjust and setting up functions for process Not refering to a number when calling replaceInFileSingle, instead set file ref as a string param replaceInFileSingle simply sends the fileRef and find & replace values to the new replaceInFile function so it can begin it's process replaceInFilesAll runs through all files in the foundArray and calls replaceFileInSingle repeatedly with the fileRef When it's finished running through all files, it hides the blackMask, returning to the usual view --- lib/multiple-results.php | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/lib/multiple-results.php b/lib/multiple-results.php index 6fe2949..08aea43 100644 --- a/lib/multiple-results.php +++ b/lib/multiple-results.php @@ -110,7 +110,7 @@ if (startTab!=top.ICEcoder.selectedTab) { $ret .= ""; $ret .= str_replace($base,"",$fullPath)."
Found X times
"; if (isset($_GET['replace'])) { - $ret .= "
replace
"; + $ret .= "
replace
"; }; $ret .= '
'; echo 'foundArray.push("'.$fullPath.'");'; @@ -160,21 +160,15 @@ var replaceAll = function() { top.ICEcoder.showHide('hide',top.document.getElementById('blackMask')); } -var replaceInFileSingle = function(fileNum) { - console.log(fileNum + "::" + foundArray[fileNum]); - //top.ICEcoder.switchTab(tab); - //cM = top.ICEcoder.getcMInstance(); - //content = cM.getValue(); - //cM.setValue(cM.getValue().replace(rExp,top.document.getElementById('replace').value)); - //document.getElementById('foundCount'+tab).innerHTML = document.getElementById('foundCount'+tab).innerHTML.replace('Found','Replaced'); +var replaceInFileSingle = function(fileRef) { + top.ICEcoder.replaceInFile(fileRef,'',''); } var replaceInFilesAll = function() { - //for (var i=0;i<=foundArray.length-1;i++) { - // replaceSingle(foundArray[i]); - //} - //top.ICEcoder.showHide('hide',top.document.getElementById('blackMask')); - console.log('REPLACE IN ALL FILES'); + for (var i=0;i<=foundArray.length-1;i++) { + replaceInFileSingle(foundArray[i]); + } + top.ICEcoder.showHide('hide',top.document.getElementById('blackMask')); } var renameSingle = function(arrayRef) {