How can I set my source editor to automatically drill down to a specified directory without manually doing it each startup?
Announcement
Collapse
No announcement yet.
[HELPED]ifs default directory
Collapse
X
-
iDav,
I have made a small modification to The Editor so that it will look at local storage for a default location. If found it will use that instead of the default '/'.
Code:var defaultLoc = (localStorage) ? localStorage.getItem(window.location.host + 'defaultFolder') : null; var tree = new Nitro.editor.tree.IfsExplorer({ region: 'west', collapsible: true, split: true, width: 200, root: { id: (defaultLoc) ? defaultLoc : '/', text: (defaultLoc) ? defaultLoc : 'IFS Root', expanded: true, iconCls: (defaultLoc) ? 'folder' : 'server' }, listeners: { opensource: function(o) { mainpanel.openSource(o); }, createnewblankfile: function(fileName, node) { mainpanel.createNewBlankFile(fileName, node); } } });
- Replace the index.html file with the one attached in this post. The index.html location on the ifs is yourValenceDirectory/html/nitro/editor/index.html
- Using Chrome/Firefox navigate to the valence login page and open the developer console and set you default directory using localStorage.setItem. Example on setting the Valence 3.2 base html as your default root folder "localStorage.setItem(window.location.host + 'defaultFolder', '/valence-3.2/html');"
Using "window.location.host" as part of the item identifier will allow you to have a default location of each valence instance if your using multiple instances.
At anytime you can change the default folder by running the localStorage.setItem always passing the first variable of "window.location.host + 'defaultFolder'" and the second param would be a valid folder path on your ifs.
If you want to go back so that The Editor looks at the root of the ifs just perform "localStorage.removeItem(window.location.host + 'defaultFolder');"
I have attached two files one screenshot of setting the default folder and the index.html (in the zip file) that you would need to replace.
Thanks
Screen Shot 2013-06-20 at 10.09.40 AM.jpgindex.html.zip
Comment
Comment