Revision 46:f16f6e0e5b69 src/pithos/content/share/addshareinit.js

b/src/pithos/content/share/addshareinit.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
mimes = null;
3 35
cache = null;
......
81 113
            success = share_resource(uri, permgroup);
82 114
        }
83 115
        if (success != true) {
84
            alert('Unsuccesful updating shares with code '+success);
116
            promptAlert('Unsuccesful updating shares with code '+success);
85 117
        }
86 118
        else {
87
            alert('Succesful in updating shares');
119
            promptAlert('Succesful in updating shares');
88 120
        }
89 121
        window.close();
90 122
    }
......
262 294
        if(ret) {
263 295
            treeobj.refreshTree();
264 296
        } else {
265
            alert('Group already exists');
297
            promptAlert('Group already exists');
266 298
        }
267 299
    }
268 300
}
......
277 309
    input = {value: ""};
278 310
    check = {value: false};
279 311

  
280
    var results = prompts.prompt(window, 'Add user to shares', 'Username:',input,null,check);
312
    var results = prompts.prompt(null, 'Add user to shares', 'Username:',input,null,check);
281 313
    if (results) {
282 314
        // Ok has been clicked
283 315
        
......
339 371
    } else {
340 372
        metadata.readForAll = true;
341 373
    }
342
}
374
}
375

  
376
// This will display a prompt with Ok or Cancel, the result needs to be checked
377
function promptBox(message) {
378
    netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
379
    var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
380
    var result = prompts.confirm(window, "Confirm action", message);
381
    
382
    return result;
383
}
384

  
385
// This is just an alert box, using the prompt xpcom service
386
function promptAlert(message) {
387
    netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
388
    var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
389
    prompts.alert(window, "Information", message);
390
}

Also available in: Unified diff