mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 07:13:59 +01:00
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.
This commit is contained in:
@@ -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 = '<a nohref onClick="top.ICEcoder.files.contentWindow.closeTab('+(i+1)+')"><img src="images/nav-close.gif" id="closeTabButton'+(i+1)+'" class="closeTab" onMouseOver="prevBG=this.style.backgroundColor;this.style.backgroundColor=\'#333\'" onMouseOut="this.style.backgroundColor=prevBG"></a>';
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user