Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Commit

Permalink
Param adjust and setting up functions for process
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mattpass committed Sep 7, 2012
1 parent bfbf84c commit 2ed832c
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions lib/multiple-results.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function phpGrep($q, $path, $base) {
$ret .= "<a href=\\\"javascript:top.ICEcoder.openFile('".$fullPath."');top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'))\\\">";
$ret .= str_replace($base,"",$fullPath)."</a><div id=\\\"foundCount".$r."\\\">Found X times</div>";
if (isset($_GET['replace'])) {
$ret .= "<div class=\\\"replace\\\" id=\\\"replace\\\" onClick=\\\"replaceInFileSingle($r);this.style.display=\'none\'\\\">replace</div>";
$ret .= "<div class=\\\"replace\\\" id=\\\"replace\\\" onClick=\\\"replaceInFileSingle('".$fullPath."');this.style.display=\'none\'\\\">replace</div>";
};
$ret .= '<hr>';
echo 'foundArray.push("'.$fullPath.'");';
Expand Down Expand Up @@ -160,21 +160,15 @@ function phpGrep($q, $path, $base) {
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,'<?php echo strClean($_GET['find']); ?>','<?php echo strClean($_GET['replace']); ?>');
}

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) {
Expand Down

0 comments on commit 2ed832c

Please sign in to comment.