Revision 46:f16f6e0e5b69
b/LICENSE | ||
---|---|---|
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. |
b/README | ||
---|---|---|
1 |
This is the code repo for the Firefox plugin of the Pithos service. |
|
1 |
This is the code repo for the Pithos File Manager Firefox extension |
b/src/pithos/content/cache.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 |
cache = null; |
2 | 34 |
|
3 | 35 |
// Directory caching |
... | ... | |
47 | 79 |
// private methods |
48 | 80 |
|
49 | 81 |
// initialisation |
82 |
// never cache shared and others |
|
50 | 83 |
cacheExceptions.push(connection_obj.user_homepage().shared); |
51 | 84 |
cacheExceptions.push(connection_obj.user_homepage().others); |
85 |
cacheExceptions.push(connection_obj.user_homepage().trash); |
|
52 | 86 |
} |
b/src/pithos/content/connection.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 |
connection_obj = null; |
2 | 34 |
|
3 | 35 |
function ConnectionObject() { |
... | ... | |
46 | 78 |
} |
47 | 79 |
|
48 | 80 |
this.create_request_get = function(rest_req) { |
49 |
if ( isRemoteDirectory(rest_req) ) {
|
|
81 |
if ( vfs.isRemoteResource(rest_req) ) {
|
|
50 | 82 |
var gmtstring = (new Date()).toGMTString(); |
51 | 83 |
var sign_url = rest_req.replace(this.rest_url, ""); |
52 | 84 |
var hash = sign(this.token, sign_url, gmtstring, "GET"); |
... | ... | |
76 | 108 |
return req; |
77 | 109 |
} |
78 | 110 |
|
111 |
this.rest_request_get_inline_async = function(rest_req) { |
|
112 |
var url = this.create_request_get(rest_req); |
|
113 |
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); |
|
114 |
var req = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Components.interfaces.nsIXMLHttpRequest); |
|
115 |
req.open("GET", url, true); |
|
116 |
|
|
117 |
req.onload = this.onLoadDefault; |
|
118 |
req.onprogress = this.onProgressDefault; |
|
119 |
req.onerror = this.onErrorDefault; |
|
120 |
|
|
121 |
req.overrideMimeType('text/plain; charset=x-user-defined'); |
|
122 |
req.channel.loadFlags |= Components.interfaces.nsIRequest.LOAD_BYPASS_CACHE; |
|
123 |
req.send(null); |
|
124 |
|
|
125 |
return req; |
|
126 |
} |
|
127 |
|
|
128 |
this.rest_request_put_upload_async = function(source, rest_req, data, mime) { |
|
129 |
var url = rest_req; |
|
130 |
var sign_url = rest_req.replace(current.rest_url, ''); |
|
131 |
var gmtstring = (new Date()).toGMTString(); |
|
132 |
|
|
133 |
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); |
|
134 |
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); |
|
135 |
try { |
|
136 |
file.initWithPath(source); |
|
137 |
} catch(error) { |
|
138 |
alert(error); |
|
139 |
return null; |
|
140 |
} |
|
141 |
|
|
142 |
var stream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream); |
|
143 |
stream.init(file, 0x04 | 0x08, 0644, 0x04); // file is an nsIFile instance |
|
144 |
|
|
145 |
var req = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Components.interfaces.nsIXMLHttpRequest); |
|
146 |
req.open("PUT", url, true); |
|
147 |
|
|
148 |
req.onload = this.onLoadDefault; |
|
149 |
req.onprogress = this.onProgressDefault; |
|
150 |
req.onerror = this.onErrorDefault; |
|
151 |
|
|
152 |
req.setRequestHeader('Authorization', current.username + " " + sign(current.token, sign_url, gmtstring, "PUT")); |
|
153 |
req.setRequestHeader('X-GSS-Date', gmtstring); |
|
154 |
|
|
155 |
req.setRequestHeader("Content-type", mime + "; charset=utf-8"); |
|
156 |
//req.setRequestHeader("Content-length", data.length); |
|
157 |
req.send(stream); |
|
158 |
|
|
159 |
return req; |
|
160 |
} |
|
161 |
|
|
79 | 162 |
this.rest_request_put_upload = function(source, rest_req, data, mime) { |
80 | 163 |
var url = rest_req; |
81 | 164 |
var sign_url = rest_req.replace(current.rest_url, ''); |
... | ... | |
105 | 188 |
|
106 | 189 |
return req; |
107 | 190 |
} |
191 |
|
|
192 |
this.rest_request_post_async = function(rest_req, params, data) { |
|
193 |
return rest_request_generic(rest_req, params, "POST", data, true, this.onLoadDefault, this.onProgressDefault, this.onErrorDefault); |
|
194 |
} |
|
195 |
|
|
196 |
this.rest_request_put_async = function(rest_req, params, data) { |
|
197 |
return rest_request_generic(rest_req, params, "PUT", data, true, this.onLoadDefault, this.onProgressDefault, this.onErrorDefault); |
|
198 |
} |
|
108 | 199 |
|
109 | 200 |
this.rest_request_head = function(rest_req, params) { |
110 | 201 |
return rest_request_generic(rest_req, params, "HEAD", null, false, null, null, null); |
b/src/pithos/content/dialogs/file_properties.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 |
function addData(tree_id, name, value){ |
2 | 34 |
var treeitem = document.createElement('treeitem'); |
3 | 35 |
tree_id.appendChild(treeitem); |
b/src/pithos/content/dialogs/operation_dialog.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 |
|
|
33 |
var current_request = null; |
|
34 |
|
|
35 |
function init() { |
|
36 |
connection_obj = new ConnectionObject(); |
|
37 |
mimes = new Mimes(); |
|
38 |
cache = new FileCache(); |
|
39 |
vfs = new VFS(); |
|
40 |
var operation = window.arguments[0]; |
|
41 |
var uris = window.arguments[1]; |
|
42 |
if ( operation == 'delete_all' ) { |
|
43 |
delete_all_resources(uris); |
|
44 |
} else if ( operation == 'copy' ) { |
|
45 |
var destination = window.arguments[2]; |
|
46 |
copy_resources(uris, destination); |
|
47 |
} else if ( operation == 'move' ) { |
|
48 |
var destination = window.arguments[2]; |
|
49 |
move_resources(uris, destination); |
|
50 |
} |
|
51 |
} |
|
52 |
|
|
53 |
function update_status(message) { |
|
54 |
var l = document.getElementById('label-info'); |
|
55 |
l.value = message; |
|
56 |
l.tooltipText = message; |
|
57 |
} |
|
58 |
|
|
59 |
function delete_all_resources(uris) { |
|
60 |
if (uris.length == 0) { return; } |
|
61 |
|
|
62 |
if( promptBox('Are you sure you want to delete forever the contents of the trash?') ) { |
|
63 |
for (var i = 0; i < uris.length; i++ ) { |
|
64 |
update_status('Deleting ... ' + uris[i]); |
|
65 |
if(!delete_resource(uris[i])) { |
|
66 |
if( !promptBox('Could not delete ' + uris[i] + '. Continue?') ) { |
|
67 |
return; |
|
68 |
} |
|
69 |
} |
|
70 |
update_status('Succesfully deleted ... ' + uris[i]); |
|
71 |
} |
|
72 |
} else { |
|
73 |
promptAlert('Action Canceled'); |
|
74 |
} |
|
75 |
window.close(); |
|
76 |
} |
|
77 |
|
|
78 |
function copy_resources(uris, destination) { |
|
79 |
if (uris.length == 0) { return; } |
|
80 |
|
|
81 |
for (var i = 0; i < uris.length; i++) { |
|
82 |
update_status('Copying ... ' + uris[i] + ' -> ' + destination); |
|
83 |
if ( !copy(uris[i], destination) ) { |
|
84 |
if ( !promptBox('Cannot copy ' + uris[i] + '. Continue?') ) { |
|
85 |
return; |
|
86 |
} |
|
87 |
} |
|
88 |
update_status('Succesfull Copy of ' + uris[i]); |
|
89 |
} |
|
90 |
|
|
91 |
window.close(); |
|
92 |
} |
|
93 |
|
|
94 |
function move_resources(uris, destination) { |
|
95 |
if (uris.length == 0) { return; } |
|
96 |
|
|
97 |
for (var i = 0; i < uris.length; i++) { |
|
98 |
update_status('Copying ... ' + uris[i] + ' -> ' + destination); |
|
99 |
if ( !copy(uris[i], destination) ) { |
|
100 |
if ( !promptBox('Cannot copy ' + uris[i] + '. Continue?') ) { |
|
101 |
return; |
|
102 |
} |
|
103 |
} |
|
104 |
update_status('Succesfull Copy of ' + uris[i]); |
|
105 |
if (!delete_resource(uris[i])) { |
|
106 |
if ( !promptBox('Cannot delete ' + uris[i] + '. Continue?') ) { |
|
107 |
return; |
|
108 |
} |
|
109 |
} |
|
110 |
update_status(uris[i] + ' deleted.'); |
|
111 |
} |
|
112 |
|
|
113 |
window.close(); |
|
114 |
} |
|
115 |
|
|
116 |
function abort() { |
|
117 |
if (current_request != null) { |
|
118 |
// abort |
|
119 |
} |
|
120 |
window.close(); |
|
121 |
} |
|
122 |
|
|
123 |
function promptBox(message) { |
|
124 |
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); |
|
125 |
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService); |
|
126 |
var result = prompts.confirm(window, "Confirm action", message); |
|
127 |
|
|
128 |
return result; |
|
129 |
} |
|
130 |
|
|
131 |
// This is just an alert box, using the prompt xpcom service |
|
132 |
function promptAlert(message) { |
|
133 |
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); |
|
134 |
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService); |
|
135 |
prompts.alert(window, "Information", message); |
|
136 |
} |
b/src/pithos/content/dialogs/operation_dialog.xul | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?> |
|
3 |
<!DOCTYPE pithos SYSTEM "chrome://pithos/locale/pithos.dtd"> |
|
4 |
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="Properties"> |
|
5 |
<head> |
|
6 |
<script type="application/x-javascript" src="../lib/jquery-1.3.2.min.js" /> |
|
7 |
<script type="application/x-javascript" src="../lib/json2.js" /> |
|
8 |
<script type="application/x-javascript" src="../lib/sha.js" /> |
|
9 |
<!-- Load the standard libraries --> |
|
10 |
<script type="application/x-javascript" src="../moz.js" /> |
|
11 |
<script type="application/x-javascript" src="../operations.js" /> |
|
12 |
<script type="application/x-javascript" src="../mimes.js" /> |
|
13 |
<script type="application/x-javascript" src="../cache.js" /> |
|
14 |
<script type="application/x-javascript" src="../connection.js" /> |
|
15 |
<script type="application/x-javascript" src="../file.js" /> |
|
16 |
<script type="application/x-javascript" src="../util.js" /> |
|
17 |
<script type="application/x-javascript" src="../localfile.js" /> |
|
18 |
<script type="application/x-javascript" src="../vfs.js" /> |
|
19 |
<script type="application/x-javascript" src="operation_dialog.js" /> |
|
20 |
</head> |
|
21 |
<vbox flex="1"> |
|
22 |
<label flex="1" id="label-info" value="Inactive"/> |
|
23 |
<hbox> |
|
24 |
<button label="cancel" onclick="abort()" /> |
|
25 |
</hbox> |
|
26 |
</vbox> |
|
27 |
<script type="application/x-javascript"> |
|
28 |
window.setTimeout('init();', 2000); |
|
29 |
</script> |
|
30 |
</window> |
b/src/pithos/content/dialogs/selectlist.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 |
items = null; |
2 | 34 |
|
3 | 35 |
function initGroup() { |
b/src/pithos/content/dragndrop.js | ||
---|---|---|
1 |
function start_dragging(event) { |
|
2 |
event.dataTransfer.setData('text/plain', pithos_object.getCurrentSelection()); |
|
3 |
event.dataTransfer.effectAllowed = "none"; |
|
4 |
event.dataTransfer.dropEffect = "drop"; |
|
5 |
//event.dataTransfer.setDragImage('../skin/gss/windowlist.png', 25, 25); |
|
6 |
} |
|
7 |
|
|
8 |
function end_dragging(event) { |
|
9 |
var source = event.dataTransfer.getData("text/plain"); |
|
10 |
var destination = (event.relatedTarget == 'treech-left') ? pithos_object.getSelectedDirectoryLeft(): pithos_object.getSelectedDirectoryRight(); |
|
11 |
if ( vfs.isLocalResource(source) && vfs.isDirectory(source) ) { |
|
12 |
alert('Cannot copy remote directories!'); |
|
13 |
return; |
|
14 |
} else if ( vfs.isRemoteResource(source) && vfs.isLocalResource(destination) && vfs.isDirectory(source) ) { |
|
15 |
alert('Cannot copy remote directories!'); |
|
16 |
return; |
|
17 |
} else if( copy(source, destination) ) { |
|
18 |
alert('Copied ' + source + ' to ' + destination); |
|
19 |
pithos_object.refreshLists(); |
|
20 |
} else { |
|
21 |
alert('Copy operation failed!'); |
|
22 |
} |
|
23 |
event.preventDefault(); |
|
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 |
|
|
33 |
function start_dragging(event) { |
|
34 |
event.dataTransfer.setData('text/plain', pithos_object.getCurrentSelection()); |
|
35 |
event.dataTransfer.effectAllowed = "none"; |
|
36 |
event.dataTransfer.dropEffect = "drop"; |
|
37 |
//event.dataTransfer.setDragImage('../skin/gss/windowlist.png', 25, 25); |
|
38 |
} |
|
39 |
|
|
40 |
function end_dragging(event) { |
|
41 |
var source = event.dataTransfer.getData("text/plain"); |
|
42 |
var destination = (event.relatedTarget == 'treech-left') ? pithos_object.getSelectedDirectoryLeft(): pithos_object.getSelectedDirectoryRight(); |
|
43 |
|
|
44 |
if ( vfs.isLocalResource(source) && vfs.isDirectory(source) ) { |
|
45 |
alert('Cannot copy remote directories!'); |
|
46 |
return; |
|
47 |
} else if ( vfs.isRemoteResource(source) && vfs.isLocalResource(destination) && vfs.isDirectory(source) ) { |
|
48 |
alert('Cannot copy remote directories!'); |
|
49 |
return; |
|
50 |
} else if( copy(source, destination) ) { |
|
51 |
alert('Copied ' + source + ' to ' + destination); |
|
52 |
pithos_object.refreshLists(); |
|
53 |
} else { |
|
54 |
alert('Copy operation failed!'); |
|
55 |
} |
|
56 |
event.preventDefault(); |
|
24 | 57 |
} |
b/src/pithos/content/file.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 |
function Directory(uri, json_dirlist) { |
2 | 34 |
// public properties |
3 | 35 |
this.directoryName = 'ERROR: directory name not defined yet'; |
... | ... | |
78 | 110 |
function find_parent() { |
79 | 111 |
var result = ""; |
80 | 112 |
|
81 |
if( isRemoteDirectory(current.URI) ) {
|
|
113 |
if( vfs.isRemoteResource(current.URI) ) {
|
|
82 | 114 |
result = getRemoteParentDir(current.URI); |
83 |
} else if ( isLocalDirectory(current.URI) ) {
|
|
115 |
} else if ( vfs.isLocalResource(current.URI) ) {
|
|
84 | 116 |
result = getParentFolder(current.URI); |
85 | 117 |
} |
86 | 118 |
|
... | ... | |
109 | 141 |
} |
110 | 142 |
|
111 | 143 |
// add to cache, only if it is remote directory. No caching for local fs |
112 |
if (isRemoteDirectory(this.URI)) {
|
|
144 |
if ( vfs.isRemoteResource(this.URI) ) {
|
|
113 | 145 |
cache.add(this.URI, this); |
114 | 146 |
} |
115 | 147 |
} |
b/src/pithos/content/groups/groups.js | ||
---|---|---|
1 |
/* Copyright (c) 2006 YourNameHere |
|
2 |
See the file LICENSE.txt for licensing information. */ |
|
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. |
|
3 | 32 |
|
4 | 33 |
connection_obj = null; |
5 | 34 |
mimes = null; |
b/src/pithos/content/lib/sha.js | ||
---|---|---|
1 |
b64pad = "="; |
|
2 |
|
|
3 |
/* |
|
4 |
* Signs a raw data string (d) with a uunencoded key (k) as per |
|
5 |
* GSS requirements. |
|
6 |
*/ |
|
7 |
function gss_sign(k, d) |
|
8 |
{ |
|
9 |
var res= rstr_hmac_sha1(atob(k),d); |
|
10 |
|
|
11 |
return(btoa(res)); |
|
12 |
} |
|
13 |
|
|
14 |
|
|
15 | 1 |
/* |
16 | 2 |
* A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined |
17 | 3 |
* in FIPS 180-1 |
... | ... | |
22 | 8 |
*/ |
23 | 9 |
|
24 | 10 |
/* |
11 |
* NOTICE: For the pithos file manager, the original authors have added function gss_sign, |
|
12 |
* defined at the end of the file. |
|
13 |
*/ |
|
14 |
|
|
15 |
/* |
|
25 | 16 |
* Configurable variables. You may need to tweak these to be compatible with |
26 | 17 |
* the server-side, but the defaults work in most cases. |
27 | 18 |
*/ |
... | ... | |
342 | 333 |
{ |
343 | 334 |
return (num << cnt) | (num >>> (32 - cnt)); |
344 | 335 |
} |
336 |
|
|
337 |
|
|
338 |
/* |
|
339 |
* Signs a raw data string (d) with a uunencoded key (k) as per |
|
340 |
* GSS requirements. |
|
341 |
*/ |
|
342 |
function gss_sign(k, d) |
|
343 |
{ |
|
344 |
var res= rstr_hmac_sha1(atob(k),d); |
|
345 |
|
|
346 |
return(btoa(res)); |
|
347 |
} |
|
348 |
|
b/src/pithos/content/localfile.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. |
|
1 | 32 |
|
2 | 33 |
function load_local_directory(path) { |
3 | 34 |
var dir_obj = new Object(); |
b/src/pithos/content/mimes.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 |
mimes = null; |
2 | 34 |
|
3 | 35 |
function Mimes() { |
b/src/pithos/content/moz.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 |
// Provides a handful of utilities related to Mozilla internal API |
2 | 34 |
|
3 | 35 |
function Mozilla() { |
... | ... | |
27 | 59 |
this.mainWindowBrowser = this.mainWindow.getBrowser(); |
28 | 60 |
|
29 | 61 |
this.newBrowserTab = function(label, url, activate) { |
30 |
var browser = this.mainWindowBrowser |
|
62 |
var browser = this.mainWindowBrowser;
|
|
31 | 63 |
var tab = browser.addTab(url); |
32 | 64 |
tab.label = label; |
33 | 65 |
if (activate) { |
34 | 66 |
browser.selectedTab = tab; |
35 | 67 |
//browser.focus(); |
36 | 68 |
} |
69 |
setTimeout( function() { |
|
70 |
browser.setIcon(tab, "chrome://pithos/skin/pithos.png"); |
|
71 |
}, 500); |
|
37 | 72 |
return tab; |
38 | 73 |
} |
39 | 74 |
|
... | ... | |
51 | 86 |
|
52 | 87 |
this.findCookieByHostAndName = function(host, name) { |
53 | 88 |
var menum = this.getCookieManager().enumerator; |
89 |
|
|
54 | 90 |
while (menum.hasMoreElements()) { |
55 | 91 |
var cookie = menum.getNext().QueryInterface(Components.interfaces.nsICookie); |
56 | 92 |
if ( (cookie.host == host) && (cookie.name == name) ) { |
b/src/pithos/content/operations.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 |
//////////////////////////////////// CREATE FOLDER ////////////////////////////////////////////////////////////// |
2 | 34 |
|
3 | 35 |
function create_folder_event() { |
4 | 36 |
var new_directory = window.prompt("Enter the directory name:", ""); |
5 | 37 |
var source_directory = pithos_object.getSourceCurrentDirectory(); |
6 | 38 |
if (new_directory == null) { |
7 |
alert('Directory creation canceled');
|
|
39 |
promptAlert('Directory creation canceled');
|
|
8 | 40 |
return; |
9 | 41 |
} else { |
10 | 42 |
if( create_folder(source_directory, new_directory) ) { |
11 |
alert(source_directory + new_directory + ' - created');
|
|
43 |
promptAlert(source_directory + new_directory + ' - created');
|
|
12 | 44 |
pithos_object.refreshLists(); |
13 | 45 |
} else { |
14 |
alert(source_directory + new_directory + ' - Directory creation failed');
|
|
46 |
promptAlert(source_directory + new_directory + ' - Directory creation failed');
|
|
15 | 47 |
} |
16 | 48 |
} |
17 | 49 |
} |
18 | 50 |
|
19 | 51 |
function create_folder(uri, new_directory) { |
20 |
if ( isRemoteDirectory(uri) ) {
|
|
52 |
if ( vfs.isRemoteResource(uri) ) {
|
|
21 | 53 |
var req = connection_obj.rest_request_post(uri, '?new=' + encodeURIComponent(new_directory), ''); |
22 | 54 |
return (connection_obj.success(req.status)); |
23 |
} else if ( isLocalDirectory(uri) ) {
|
|
55 |
} else if ( vfs.isLocalResource(uri) ) {
|
|
24 | 56 |
try { |
25 | 57 |
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); |
26 | 58 |
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); |
... | ... | |
47 | 79 |
var copied = 0; |
48 | 80 |
|
49 | 81 |
if (sources.length == 0) { |
50 |
alert('No Files/Folders are selected');
|
|
82 |
promptAlert('No Files/Folders are selected');
|
|
51 | 83 |
return; |
52 | 84 |
} |
53 | 85 |
|
54 | 86 |
if ( sources.length > 1 ) { |
55 |
alert('Copy ' + sources.length + ' items to ' + destination);
|
|
87 |
promptAlert('Copy ' + sources.length + ' items to ' + destination);
|
|
56 | 88 |
} else if (sources.length == 1) { |
57 |
alert('Copy ' + sources[0] + ' to ' + destination);
|
|
89 |
promptAlert('Copy ' + sources[0] + ' to ' + destination);
|
|
58 | 90 |
} |
59 | 91 |
|
60 | 92 |
for ( i = 0; i < sources.length; i++ ) { |
61 | 93 |
if ( vfs.isDirectory(sources[i]) ) { |
62 |
alert('Copy of directories is not supported!'); |
|
63 |
continue; |
|
64 |
} |
|
65 |
|
|
66 |
if ( !copy(sources[i], destination) ) { |
|
67 |
alert('Could not copy - ' + sources[i] + '. Copy canceled!'); |
|
68 |
return; |
|
69 |
} else { |
|
70 |
copied++; |
|
94 |
promptAlert('Copy of directories is not supported! Operation Canceled.'); |
|
95 |
return; |
|
71 | 96 |
} |
72 | 97 |
} |
98 |
|
|
99 |
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); |
|
100 |
window.openDialog("dialogs/operation_dialog.xul", "Copy Files", "chrome,resizable,centerscreen,window", "copy", sources, destination); |
|
101 |
|
|
73 | 102 |
pithos_object.refreshLists(); |
74 |
alert('Copied ' + copied + ' file(s) (total: ' + sources.length + ')'); |
|
75 | 103 |
} |
76 | 104 |
|
77 | 105 |
function copy(source, destination) { |
... | ... | |
87 | 115 |
|
88 | 116 |
return connection_obj.success(req.status); |
89 | 117 |
} else if ( vfs.isLocalResource(source) && vfs.isRemoteResource(destination) ) { |
90 |
var req = connection_obj.rest_request_put_upload(source, destination + encodeURIComponent(source_metadata.name), data, mimes.getByExtension(source_metadata.name));
|
|
118 |
var req = connection_obj.rest_request_put_upload(source, destination + source_metadata.name, data, mimes.getByExtension(source_metadata.name));
|
|
91 | 119 |
|
92 | 120 |
return connection_obj.success(req.status); |
93 | 121 |
} else if ( vfs.isRemoteResource(source) && vfs.isLocalResource(destination) ) { |
... | ... | |
127 | 155 |
function move_event() { |
128 | 156 |
var sources = pithos_object.getSelectedResources(); |
129 | 157 |
var destination = pithos_object.getDestinationCurrentDirectory(); |
130 |
var moved = 0; |
|
131 | 158 |
|
132 | 159 |
if (sources.length == 0) { |
133 |
alert('No Files/Folders are selected');
|
|
160 |
promptAlert('No Files/Folders are selected');
|
|
134 | 161 |
return; |
135 | 162 |
} |
136 | 163 |
|
137 | 164 |
for ( i = 0; i < sources.length; i++ ) { |
138 | 165 |
if ( vfs.isDirectory(sources[i]) ) { |
139 |
alert('Moving directories is not supported!');
|
|
166 |
promptAlert('Moving directories is not supported!');
|
|
140 | 167 |
continue; |
141 | 168 |
} |
142 | 169 |
|
143 |
if ( !move(sources[i], destination) ) { |
|
144 |
alert('Move failed (' + sources[i] + ')'); |
|
145 |
return; |
|
146 |
} else { |
|
147 |
moved++; |
|
148 |
} |
|
149 | 170 |
} |
171 |
|
|
172 |
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); |
|
173 |
window.openDialog("dialogs/operation_dialog.xul", "Move Files", "chrome,resizable,centerscreen,window", "move", sources, destination); |
|
150 | 174 |
|
151 | 175 |
pithos_object.refreshLists(); |
152 |
alert('Moved ' + moved + ' file(s) (total: ' + sources.length + ')'); |
|
153 | 176 |
} |
154 | 177 |
|
155 | 178 |
function move(source, destination) { |
... | ... | |
184 | 207 |
|
185 | 208 |
////////////////////////////////////////////////////// DELETE ///////////////////////////////////////////////////////////////////// |
186 | 209 |
|
210 |
function delete_all_async(uris) { |
|
211 |
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); |
|
212 |
window.openDialog("dialogs/operation_dialog.xul", "Delete Files", "chrome,resizable,centerscreen,window", "delete_all", uris); |
|
213 |
pithos_object.refreshLists(); |
|
214 |
} |
|
215 |
|
|
187 | 216 |
function delete_context_menu(uri) { |
188 | 217 |
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); |
189 | 218 |
var prompt = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService); |
190 | 219 |
var result = prompt.confirm(window, "Confirm action", "Delete " + uri + "?"); |
191 | 220 |
if ( result ) { |
192 | 221 |
if ( !delete_resource(uri) ) { |
193 |
alert('Cannot delete ' + uri);
|
|
222 |
promptAlert('Cannot delete ' + uri);
|
|
194 | 223 |
return; |
195 | 224 |
} |
196 | 225 |
} else { |
197 |
alert('Action canceled');
|
|
226 |
promptAlert('Action canceled');
|
|
198 | 227 |
return; |
199 | 228 |
} |
200 | 229 |
pithos_object.refreshLists(); |
... | ... | |
204 | 233 |
var resources = pithos_object.getSelectedResources(); |
205 | 234 |
|
206 | 235 |
if (resources.length == 0) { |
207 |
alert('No File/Directory is selected');
|
|
236 |
promptAlert('No File/Directory is selected');
|
|
208 | 237 |
return; |
209 | 238 |
} |
210 | 239 |
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); |
... | ... | |
217 | 246 |
if (!b) { |
218 | 247 |
b = prompt.confirm(window, "Failed!", "Deletion of " + resources[i] + " failed. Continue?"); |
219 | 248 |
if (!b) { |
220 |
alert('Action canceled');
|
|
249 |
promptAlert('Action canceled');
|
|
221 | 250 |
return; |
222 | 251 |
} |
223 | 252 |
} |
224 | 253 |
} |
225 | 254 |
} else { |
226 |
alert('Action canceled');
|
|
255 |
promptAlert('Action canceled');
|
|
227 | 256 |
return; |
228 | 257 |
} |
229 |
alert('Removed ' + resources.length + ' items.'); |
|
258 |
promptAlert('Removed ' + resources.length + ' items.'); |
|
259 |
pithos_object.refreshLists(); |
|
260 |
} |
|
261 |
|
|
262 |
function delete_context_menu_trash(uri) { |
|
263 |
if(promptBox('Realy delete ' + uri)) { |
|
264 |
if ( delete_resource(uri) ) { |
|
265 |
promptAlert(uri + ' purged'); |
|
266 |
} |
|
267 |
} else { |
|
268 |
promptAlert('Purge canceled'); |
|
269 |
} |
|
230 | 270 |
pithos_object.refreshLists(); |
231 | 271 |
} |
232 | 272 |
|
233 | 273 |
function delete_resource(uri) { |
234 |
if ( isRemoteDirectory(uri) ) {
|
|
274 |
if ( vfs.isRemoteResource(uri) ) {
|
|
235 | 275 |
var req = connection_obj.rest_request_delete(uri, '?trash=', ''); |
236 | 276 |
return connection_obj.success(req.status); |
237 |
} else if ( isLocalDirectory(uri) ) {
|
|
277 |
} else if ( vfs.isLocalResource(uri) ) {
|
|
238 | 278 |
try { |
239 | 279 |
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); |
240 | 280 |
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); |
... | ... | |
260 | 300 |
var result = prompt.confirm(window, "Confirm action", "Delete " + uri + "?"); |
261 | 301 |
if ( result ) { |
262 | 302 |
if ( !movetotrash_resource(uri) ) { |
263 |
alert('Cannot delete ' + uri);
|
|
303 |
promptAlert('Cannot delete ' + uri);
|
|
264 | 304 |
return; |
265 | 305 |
} |
266 | 306 |
} else { |
267 |
alert('Action canceled');
|
|
307 |
promptAlert('Action canceled');
|
|
268 | 308 |
return; |
269 | 309 |
} |
270 | 310 |
pithos_object.refreshLists(); |
271 | 311 |
} |
272 | 312 |
|
273 | 313 |
function movetotrash_resource(uri) { |
274 |
if ( isRemoteDirectory(uri) ) {
|
|
314 |
if ( vfs.isRemoteResource(uri) ) {
|
|
275 | 315 |
var req = connection_obj.rest_request_post(uri, '?trash=', ''); |
276 | 316 |
return connection_obj.success(req.status); |
277 |
} else if ( isLocalDirectory(uri) ) {
|
|
317 |
} else if ( vfs.isLocalResource(uri) ) {
|
|
278 | 318 |
try { |
279 | 319 |
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); |
280 | 320 |
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); |
... | ... | |
308 | 348 |
// Create a parameter list |
309 | 349 |
var params = { inp: source, out: null }; |
310 | 350 |
|
311 |
window.openDialog("share/addshare.xul", "Share item", "chrome,dialog,modal,resizable",params);
|
|
351 |
window.openDialog("share/addshare.xul", "Share item", "chrome,dialog,resizable,centerscreen",params);
|
|
312 | 352 |
connection_obj.get_shared_data(); |
313 | 353 |
pithos_object.refreshLists(); |
314 | 354 |
} |
... | ... | |
348 | 388 |
connection_obj.get_shared_data(); |
349 | 389 |
pithos_object.refreshLists(); |
350 | 390 |
} else { |
351 |
alert('Unshare failed');
|
|
391 |
promptAlert('Unshare failed');
|
|
352 | 392 |
} |
353 | 393 |
} else { |
354 |
alert('Unshare process canceled');
|
|
394 |
promptAlert('Unshare process canceled');
|
|
355 | 395 |
} |
356 | 396 |
} |
357 | 397 |
|
... | ... | |
397 | 437 |
var new_name = window.prompt("Enter the new name:", ""); |
398 | 438 |
if ( new_name != null ) { |
399 | 439 |
if ( !rename_resource(uri, new_name) ) { |
400 |
alert('Cannot rename ' + uri + ' to ' + new_name);
|
|
440 |
promptAlert('Cannot rename ' + uri + ' to ' + new_name);
|
|
401 | 441 |
return; |
402 | 442 |
} |
403 | 443 |
} else { |
404 |
alert('Action canceled');
|
|
444 |
promptAlert('Action canceled');
|
|
405 | 445 |
} |
406 | 446 |
pithos_object.refreshLists(); |
407 | 447 |
} |
408 | 448 |
|
409 | 449 |
function rename_resource(uri, new_name) { |
410 |
if ( isRemoteDirectory(uri) ) {
|
|
450 |
if ( vfs.isRemoteResource(uri) ) {
|
|
411 | 451 |
var update = new Object(); |
412 | 452 |
if ( vfs.isFile(uri) ) { |
413 | 453 |
update.name = new_name; |
... | ... | |
416 | 456 |
} |
417 | 457 |
var req = connection_obj.rest_request_post(uri, '?update=', jsonToString(update)); |
418 | 458 |
return (connection_obj.success(req.status)); |
419 |
} else if ( isLocalDirectory(uri) ) {
|
|
459 |
} else if ( vfs.isLocalResource(uri) ) {
|
|
420 | 460 |
try { |
421 | 461 |
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); |
422 | 462 |
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); |
... | ... | |
459 | 499 |
|
460 | 500 |
function enable_version_event(uri) { |
461 | 501 |
if ( vfs.isLocalResource(uri) ) { |
462 |
alert('Cannot enable versioning in local files');
|
|
502 |
promptAlert('Cannot enable versioning in local files');
|
|
463 | 503 |
return; |
464 | 504 |
} |
465 | 505 |
if ( enable_version_resource(uri) ) { |
466 |
alert('File versioning is enabled');
|
|
506 |
promptAlert('File versioning is enabled');
|
|
467 | 507 |
} else { |
468 |
alert('Could not enable file versioning for ' + uri);
|
|
508 |
promptAlert('Could not enable file versioning for ' + uri);
|
|
469 | 509 |
} |
470 | 510 |
} |
471 | 511 |
|
... | ... | |
482 | 522 |
} |
483 | 523 |
|
484 | 524 |
function download_version_event(uri, current_version) { |
485 |
var version = window.prompt("Download version:", current_version); |
|
486 |
if (version != null) { |
|
487 |
if ( (new Number(version) >= 1) && (new Number(version) <= current_version) ) { |
|
488 |
var local_url = connection_obj.create_request_get(uri) + '&version=' + version; |
|
525 |
//var version = window.prompt("Download version:", current_version); |
|
526 |
var versions = new Array(); |
|
527 |
var outChoice = new Object(); |
|
528 |
|
|
529 |
for ( i = 0; i < current_version; i++ ) { |
|
530 |
versions.push(i + 1); |
|
531 |
} |
|
532 |
|
|
533 |
if (promptSelect('Open Resource', 'Download version:', versions, outChoice)) { |
|
534 |
var version_number = new Number(versions[outChoice.value]); |
|
535 |
if ( (version_number >= 1) && (version_number <= current_version) ) { |
|
536 |
var local_url = connection_obj.create_request_get(uri) + '&version=' + version_number; |
|
489 | 537 |
window.open(local_url); |
490 | 538 |
} else { |
491 |
alert('Invalid version number (' + version + '). Available versions: 1 ... ' + current_version);
|
|
539 |
promptAlert('Invalid version number (' + version_number + '). Available versions: 1 ... ' + current_version);
|
|
492 | 540 |
} |
493 | 541 |
} else { |
494 |
alert('Action canceled');
|
|
542 |
promptAlert('Action canceled');
|
|
495 | 543 |
} |
496 | 544 |
} |
497 | 545 |
|
498 |
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
546 |
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
547 |
|
|
548 |
////////////////////////////////////////////////// UNDELETE /////////////////////////////////////////////////////////////////////////////// |
|
549 |
|
|
550 |
function restore_context_menu_trash(uri) { |
|
551 |
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); |
|
552 |
|
|
553 |
var theuri = uri; |
|
554 |
var theobj = vfs.getResourceMetadata(theuri); |
|
555 |
|
|
556 |
// Set the metadata delete property to false (i.e. not deleted) |
|
557 |
theobj.deleted = false; |
|
558 |
|
|
559 |
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService); |
|
560 |
var theitem_with_path = ''; |
|
561 |
|
|
562 |
if (theobj.hasOwnProperty('directoryName')) { |
|
563 |
theitem_with_path = theobj.parentFolder + '/' + theobj.directoryName; |
|
564 |
theitem_with_path = theitem_with_path.replace(connection_obj.user_homepage().fileroot, ""); |
|
565 |
} else { |
|
566 |
theitem_with_path = theobj.path + theobj.name; |
|
567 |
} |
|
568 |
|
|
569 |
if (prompts.confirm(window, "Confirm action", "Are you sure you want to restore " + theitem_with_path + ' ?')) { |
|
570 |
// trim the trailing slash ... |
|
571 |
theuri = theuri.replace(/\/$/,''); |
|
572 |
if (restore_resource(theuri)) { |
|
573 |
promptAlert(theuri + ' succesfully restored'); |
|
574 |
pithos_object.refreshLists(); |
|
575 |
} else { |
|
576 |
promptAlert('Restoration of ' + theuri + ' failed'); |
|
577 |
} |
|
578 |
} |
|
579 |
} |
|
580 |
|
|
581 |
function restore_resource(uri) { |
|
582 |
var retcode = connection_obj.rest_request_post(uri,'?restore=', ''); |
|
583 |
return connection_obj.success(retcode.status); |
|
584 |
} |
|
585 |
|
|
586 |
|
|
587 |
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
b/src/pithos/content/overlay/overlay.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 |
var pithos = { |
2 | 34 |
onLoad: function() { |
3 | 35 |
// initialization code |
b/src/pithos/content/overlay/overlay.xul | ||
---|---|---|
11 | 11 |
</stringbundleset> |
12 | 12 |
|
13 | 13 |
<menupopup id="menu_ToolsPopup"> |
14 |
<menuitem id="pithos-hello" label="&pithos.label;" oncommand="pithos.onMenuItemCommand(event);"/>
|
|
14 |
<menuitem id="pithos-file-manager" label="&pithos.label;" oncommand="pithos.onMenuItemCommand(event);"/>
|
|
15 | 15 |
</menupopup> |
16 | 16 |
|
17 | 17 |
<!-- <popup id="contentAreaContextMenu"> |
b/src/pithos/content/pithos.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 |
// Basic UI functions |
2 | 34 |
|
3 | 35 |
// event to quit toolbar button |
... | ... | |
6 | 38 |
window.location.replace('https://pithos.grnet.gr/Shibboleth.sso/Logout'); |
7 | 39 |
} |
8 | 40 |
|
9 |
function open_trash() { |
|
10 |
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); |
|
11 |
window.openDialog("trash/trash.xul", "Trash", "chrome,modal,dialog,resizable,centerscreen"); |
|
12 |
pithos_object.refreshLists(); |
|
13 |
} |
|
14 |
|
|
15 | 41 |
function open_groups() { |
16 | 42 |
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); |
17 |
window.openDialog("groups/groups.xul", "Groups", "chrome,modal,dialog,resizable,centerscreen");
|
|
43 |
window.openDialog("groups/groups.xul", "Groups", "chrome,dialog,resizable,centerscreen"); |
|
18 | 44 |
pithos_object.refreshLists(); |
19 | 45 |
} |
20 | 46 |
|
... | ... | |
57 | 83 |
for (var fldr in dir_obj.folders) { |
58 | 84 |
this.addFolder(dir_obj.folders[fldr]); |
59 | 85 |
} |
60 |
|
|
86 |
|
|
61 | 87 |
for (var fl in dir_obj.files) { |
62 |
if (!dir_obj.files[fl].deleted) { |
|
88 |
// trash exception |
|
89 |
if ( dir_obj.URI == connection_obj.user_homepage().trash) { |
|
90 |
this.addFile(dir_obj.files[fl]); |
|
91 |
} else if(!dir_obj.files[fl].deleted) { |
|
63 | 92 |
this.addFile(dir_obj.files[fl]); |
64 | 93 |
} |
65 | 94 |
} |
... | ... | |
145 | 174 |
} |
146 | 175 |
|
147 | 176 |
addSeparator(); |
148 |
|
|
149 |
if ( isRemoteDirectory(selection) ) { |
|
150 |
if ( connection_obj.isShared(selection) ) { |
|
151 |
addItem('modify shares', "share_event('" + selection + "');"); |
|
152 |
addItem('unshare', "unshare_event('" + selection + "');"); |
|
153 |
} else { |
|
154 |
addItem('share', "share_event('" + selection + "');"); |
|
155 |
} |
|
156 |
if ( vfs.isFile(selection) ) { |
|
157 |
addItem('modify tags', "modifytags_event('" + selection + "');"); |
|
158 |
if ( !resource.versioned ) { |
|
159 |
addItem('enable versioning', "enable_version_event('" + selection + "');"); |
|
177 |
|
|
178 |
if ( pithos_object.getSourceCurrentDirectory() == connection_obj.user_homepage().trash ) { |
|
179 |
addItem('Undelete', "restore_context_menu_trash('" + selection + "')"); |
|
180 |
addItem('Purge', "delete_context_menu_trash('" + selection + "')"); |
|
181 |
addItem('Delete All', 'delete_all_async(pithos_object.getAllResources())'); |
|
182 |
} else { |
|
183 |
if ( vfs.isRemoteResource(selection) ) { |
|
184 |
if ( connection_obj.isShared(selection) ) { |
|
185 |
addItem('Modify shares', "share_event('" + selection + "');"); |
|
186 |
addItem('Unshare', "unshare_event('" + selection + "');"); |
|
160 | 187 |
} else { |
161 |
addItem('open version', "download_version_event('" + selection + "', " + resource.version + ");");
|
|
188 |
addItem('Share', "share_event('" + selection + "');");
|
|
162 | 189 |
} |
163 |
} |
|
164 |
} |
|
165 |
|
|
166 |
addItem('rename', "rename_context_menu('" + selection + "');"); |
|
167 |
if ( vfs.isRemoteResource(selection) ) { |
|
168 |
addItem('move to trash', "movetotrash_context_menu('" + selection + "');"); |
|
190 |
if ( vfs.isFile(selection) ) { |
|
191 |
addItem('Modify tags', "modifytags_event('" + selection + "');"); |
|
192 |
if ( !resource.versioned ) { |
|
193 |
addItem('Enable versioning', "enable_version_event('" + selection + "');"); |
|
194 |
} else { |
|
195 |
addItem('Open version', "download_version_event('" + selection + "', " + resource.version + ");"); |
|
196 |
} |
|
197 |
} |
|
198 |
} |
|
199 |
|
|
200 |
addItem('Rename', "rename_context_menu('" + selection + "');"); |
|
201 |
if ( vfs.isRemoteResource(selection) ) { |
|
202 |
addItem('Move to trash', "movetotrash_context_menu('" + selection + "');"); |
|
203 |
} |
|
204 |
addItem('Delete', "delete_context_menu('" + selection + "');"); |
|
169 | 205 |
} |
170 |
addItem('delete', "delete_context_menu('" + selection + "');"); |
|
171 |
|
|
172 |
addSeparator(); |
|
173 |
|
|
174 |
if ( vfs.isLocalResource(selection) && vfs.isFile(selection) ) { |
|
175 |
addItem('launch', "launch_local_resource('" + selection + "');"); |
|
176 |
} |
|
177 |
addItem('properties', "show_properties('" + selection + "');"); |
|
206 |
|
|
207 |
addSeparator(); |
|
208 |
|
|
209 |
if ( vfs.isLocalResource(selection) && vfs.isFile(selection) ) { |
|
210 |
addItem('Launch', "launch_local_resource('" + selection + "');"); |
|
211 |
} |
|
212 |
addItem('Properties', "show_properties('" + selection + "');"); |
|
178 | 213 |
|
179 | 214 |
// helper functions |
180 | 215 |
function addSeparator() { |
... | ... | |
220 | 255 |
} else { |
221 | 256 |
pithos_object.setTreeFocus('tree-files-left'); |
222 | 257 |
} |
223 |
} else if ( event.keyCode == 13 ) { // VK_ENTER (?)
|
|
258 |
} else if ( event.keyCode == 13 ) { // VK_ENTER |
|
224 | 259 |
if ( tree_id == 'tree-files-left' ) { |
225 | 260 |
pithos_object.navigateLeftTree(); |
226 | 261 |
} else { |
b/src/pithos/content/pithos.xul | ||
---|---|---|
9 | 9 |
<script type="application/x-javascript" src="lib/json2.js" /> |
10 | 10 |
<script type="application/x-javascript" src="lib/sha.js" /> |
11 | 11 |
<!-- Load our libraries --> |
12 |
<script type="application/x-javascript" src="ui.js" /> |
|
12 | 13 |
<script type="application/x-javascript" src="dragndrop.js" /> |
13 | 14 |
<script type="application/x-javascript" src="search.js" /> |
14 | 15 |
<script type="application/x-javascript" src="moz.js" /> |
... | ... | |
45 | 46 |
<!-- <toolbarbutton id="toolbarbutton-setings" label="Settings" image="../skin/settingsgray.png" /> --> |
46 | 47 |
<toolbarbutton id="toolbarbutton-group" label="Groups" image="../skin/groupsgray.png" onclick="open_groups()"/> |
47 | 48 |
<!-- <toolbarbutton id="toolbarbutton-shared" label="Shared" image="../skin/gss/folder_blue.png" onclick="open_shared()" /> --> |
48 |
<toolbarbutton id="toolbarbutton-trash" label="Trash" image="../skin/gss/trashcan_empty.png" onclick="open_trash()" />
|
|
49 |
<!-- <toolbarbutton id="toolbarbutton-trash" label="Trash" image="../skin/gss/trashcan_empty.png" onclick="open_trash()" /> -->
|
|
49 | 50 |
<spacer flex="1" /> |
50 | 51 |
<image src="../skin/pithos-grnet-full.png" width="200" height="30" /> |
51 | 52 |
</toolbar> |
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. |
Also available in: Unified diff