From 07fd0ab6bf6ee20e839f012163830cc2f00dd331 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Tue, 22 Jan 2013 20:01:54 +0000 Subject: [PATCH] Fixes to rename processes renameFile didn't have i var set, so I have set this to be what is expected so we can now rename open files again. shortURL was having it's slashes replaced with pipes in a few areas but not all which meant it wasn't changing the onmouseover argument. Now doing this on setting the var now which means a fix and less code. Also forgot to alter the title attribute, now changing that on rename too. --- lib/ice-coder.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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"; }