Revision 46:f16f6e0e5b69 src/pithos/content/pithos_object.js
b/src/pithos/content/pithos_object.js | ||
---|---|---|
1 |
// The Pithos File Manager Firefox Extension is funded by GRNET S.A. |
|
2 |
// (http://www.grnet.gr) |
|
3 |
// |
|
4 |
// Copyright (c) 2009, Christos KK Loverdos, Vassilios Karakoidas. |
|
5 |
// All rights reserved. |
|
6 |
// |
|
7 |
// Redistribution and use in source and binary forms, with or without |
|
8 |
// modification, are permitted provided that the following conditions are |
|
9 |
// met: |
|
10 |
// |
|
11 |
// - Redistributions of source code must retain the above copyright |
|
12 |
// notice, this list of conditions and the following disclaimer. |
|
13 |
// - Redistributions in binary form must reproduce the above |
|
14 |
// copyright notice, this list of conditions and the following |
|
15 |
// disclaimer in the documentation and/or other materials provided |
|
16 |
// with the distribution. |
|
17 |
// - Neither the name of GRNET S.A. nor the names of its contributors |
|
18 |
// may be used to endorse or promote products derived from this |
|
19 |
// software without specific prior written permission. |
|
20 |
// |
|
21 |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
22 |
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
23 |
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
24 |
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
25 |
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
26 |
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
27 |
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
28 |
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
29 |
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
30 |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
31 |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
32 |
|
|
1 | 33 |
pithos_object = null; |
2 | 34 |
|
3 | 35 |
// Responsible for UI functionality. |
... | ... | |
51 | 83 |
} |
52 | 84 |
|
53 | 85 |
this.refreshLists = function() { |
54 |
if ( isRemoteDirectory(this.getSelectedDirectoryLeft()) ) {
|
|
86 |
if ( vfs.isRemoteResource(this.getSelectedDirectoryLeft()) ) {
|
|
55 | 87 |
cache.remove(this.getSelectedDirectoryLeft()); |
56 | 88 |
} |
57 |
if ( isRemoteDirectory(this.getSelectedDirectoryRight()) ) {
|
|
89 |
if ( vfs.isRemoteResource(this.getSelectedDirectoryRight()) ) {
|
|
58 | 90 |
cache.remove(this.getSelectedDirectoryRight()); |
59 | 91 |
} |
60 | 92 |
|
... | ... | |
82 | 114 |
|
83 | 115 |
return results; |
84 | 116 |
} |
117 |
|
|
118 |
this.getAllResources = function() { |
|
119 |
var result = new Array(); |
|
120 |
var rowCount = source_tree.view.rowCount; |
|
121 |
|
|
122 |
for ( i = 0; i < rowCount; i++ ) { |
|
123 |
result.push(source_tree_children.children_tag.childNodes[i].childNodes[0].id); |
|
124 |
} |
|
125 |
|
|
126 |
return result; |
|
127 |
} |
|
85 | 128 |
|
86 | 129 |
this.getSourceCurrentDirectory = function() { |
87 | 130 |
if (this.getSourceTree().id == 'tree-files-left') { |
... | ... | |
190 | 233 |
function find_parent(uri) { |
191 | 234 |
var result = ""; |
192 | 235 |
|
193 |
if( isRemoteDirectory(uri) ) {
|
|
236 |
if( vfs.isRemoteResource(uri) ) {
|
|
194 | 237 |
result = getRemoteParentDir(uri); |
195 |
} else if ( isLocalDirectory(uri) ) {
|
|
238 |
} else if ( vfs.isLocalResource(uri) ) {
|
|
196 | 239 |
result = getParentFolder(uri); |
197 | 240 |
} |
198 | 241 |
|
... | ... | |
228 | 271 |
if ( isRootDirectory(directory) ) { |
229 | 272 |
add_item(directory, directory); |
230 | 273 |
} else { |
231 |
if ( isRemoteDirectory(directory) ) {
|
|
274 |
if ( vfs.isRemoteResource(directory) ) {
|
|
232 | 275 |
// remote code |
233 | 276 |
var arr = getRemoteParentDirList(directory); |
234 | 277 |
for ( i = 0; i < arr.length; i++ ) { |
... | ... | |
255 | 298 |
list.appendChild(menuitem); |
256 | 299 |
} |
257 | 300 |
} |
258 |
|
|
301 |
|
|
259 | 302 |
// populate with menu items, local drives |
260 | 303 |
function initialize_menulist(list_id, navigate_command) { |
261 | 304 |
var list = document.getElementById(list_id); |
... | ... | |
265 | 308 |
} |
266 | 309 |
|
267 | 310 |
add_item("Remote - Home", fileroot, navigate_command.replace('[DIR]', fileroot)); |
268 |
list.parentNode.selectedIndex = 0; |
|
269 | 311 |
|
270 |
if (isWindows()) {
|
|
312 |
if ( isWindows() ) {
|
|
271 | 313 |
var drives = getLocalDrives(); |
272 | 314 |
|
273 | 315 |
for ( i = 0;i < drives.length; i++ ) { |
274 | 316 |
add_item("Local - " + drives[i], drives[i], navigate_command.replace('[DIR]', drives[i] + '\\')); |
275 |
} |
|
317 |
}
|
|
276 | 318 |
} |
277 |
if (isUnix()) {
|
|
319 |
if ( isUnix() ) {
|
|
278 | 320 |
add_item("Local - Home", getHomeDirectory(), navigate_command.replace('[DIR]', getHomeDirectory())); |
279 | 321 |
} |
280 | 322 |
|
281 | 323 |
add_item("Remote - Others", connection_obj.user_homepage().others, navigate_command.replace('[DIR]', connection_obj.user_homepage().others)); |
282 | 324 |
add_item("Remote - Shared", connection_obj.user_homepage().shared, navigate_command.replace('[DIR]', connection_obj.user_homepage().shared)); |
283 |
|
|
325 |
add_item("Remote - Trash", connection_obj.user_homepage().trash, navigate_command.replace('[DIR]', connection_obj.user_homepage().trash)); |
|
326 |
|
|
327 |
list.parentNode.selectedIndex = 0; |
|
328 |
|
|
284 | 329 |
// inner functions |
285 | 330 |
function add_item(item_name, item_value, item_onclick) { |
286 | 331 |
var menuitem = document.createElement("menuitem"); |
... | ... | |
297 | 342 |
initialize_menulist("menupopup-right", "pithos_object.populateRightTree('[DIR]');"); |
298 | 343 |
|
299 | 344 |
this.populateLeftTree(fileroot); |
300 |
this.populateRightTree(fileroot); |
|
345 |
|
|
346 |
if (isWindows()) { |
|
347 |
this.populateRightTree(getLocalDrives()[0]); |
|
348 |
} else { |
|
349 |
this.populateRightTree(getHomeDirectory()); |
|
350 |
} |
|
351 |
|
|
352 |
document.getElementById('menupopup-right').parentNode.selectedIndex = 1; |
|
301 | 353 |
|
302 | 354 |
//left_tree.focus(); |
303 | 355 |
} |
Also available in: Unified diff