diff --git a/lib/ice-coder.js b/lib/ice-coder.js index 7e3427b..3e6f1e5 100644 --- a/lib/ice-coder.js +++ b/lib/ice-coder.js @@ -554,7 +554,7 @@ var ICEcoder = { // Prompt a rename dialog on demand renameFile: function(oldName,newName) { - var shortURL, fileName; + var shortURL, fileName, i; if (!oldName) { shortURL = top.ICEcoder.rightClickedFile.replace(/\|/g,"/"); @@ -566,7 +566,8 @@ var ICEcoder = { newName = top.ICEcoder.getInput('Please enter the new name for',shortURL); } if (newName) { - if(top.ICEcoder.openFiles.indexOf(shortURL.replace(/\|/g,"/"))>-1) { + i = top.ICEcoder.openFiles.indexOf(shortURL.replace(/\|/g,"/")); + if(i>-1) { // rename array item and the tab top.ICEcoder.openFiles[i] = newName; closeTabLink = ''; @@ -722,15 +723,16 @@ var ICEcoder = { // Renaming files if (action=="rename") { // Get short URL of our right clicked file and get target elem based on this - shortURL = oldName; - targetElem = document.getElementById('filesFrame').contentWindow.document.getElementById(shortURL.replace(/\//g,"|")); + shortURL = oldName.replace(/\//g,"|"); + targetElem = document.getElementById('filesFrame').contentWindow.document.getElementById(shortURL); // Set the name to be as per our new file/folder name targetElem.innerHTML = file; // Finally, update the ID of the target & set a new mouseover function for the parent too targetElem.id = location.replace(/\//g,"|") + "|" + file; newMouseOver = targetElem.parentNode.onmouseover.toString().replace(shortURL.substring(shortURL.lastIndexOf("|")+1),file).split('\''); eval("targetElem.parentNode.onmouseover = function() { top.ICEcoder.overFileFolder('"+newMouseOver[1]+"','"+newMouseOver[3]+"');}"); - targetElemPerms = document.getElementById('filesFrame').contentWindow.document.getElementById(shortURL.replace(/\//g,"|")+"_perms"); + eval("targetElem.parentNode.title = newMouseOver[3];"); + targetElemPerms = document.getElementById('filesFrame').contentWindow.document.getElementById(shortURL+"_perms"); targetElemPerms.id = location.replace(/\//g,"|") + "|" + file + "_perms"; }