[1846] | 1 | function handler(){ |
---|
| 2 | } |
---|
| 3 | handler.prototype.del = function(data){ |
---|
[1869] | 4 | var returnVal = data.split('|'); |
---|
[1846] | 5 | var deletedFiles = ""; |
---|
| 6 | for (i=0; i < returnVal.length; i++) |
---|
| 7 | if (returnVal[i] == 'False'){ |
---|
| 8 | write_error(get_lang('Could not delete %1',returnVal[i+1])); |
---|
| 9 | return; |
---|
| 10 | }else |
---|
| 11 | { |
---|
| 12 | if (returnVal[i] != ""){ |
---|
| 13 | deletedFiles += ", "+returnVal[i]; |
---|
| 14 | var element = document.getElementById("name_"+returnVal[i]); |
---|
| 15 | var pai = element.parentNode.parentNode; |
---|
| 16 | pai.parentNode.removeChild(pai); |
---|
| 17 | } |
---|
[1869] | 18 | if (i > 3) //to avoid big message |
---|
| 19 | { |
---|
| 20 | deletedFiles = " " +returnVal.length + " " +get_lang("files"); |
---|
| 21 | break; |
---|
| 22 | } |
---|
[1846] | 23 | } |
---|
| 24 | write_msg(get_lang('Deleted %1',deletedFiles.substr(2))); |
---|
| 25 | //Repaint stripes |
---|
| 26 | folderList.drawStripes(); |
---|
| 27 | } |
---|
| 28 | handler.prototype.rename = function(data) { |
---|
| 29 | if (data == null){ |
---|
| 30 | var returnVal = new Array ("True",oldValue,oldValue); |
---|
| 31 | } |
---|
| 32 | else |
---|
[1869] | 33 | var returnVal = data.split('|'); |
---|
[1846] | 34 | if ( returnVal[0] == "True" ){ |
---|
| 35 | if (returnVal[1] != returnVal[2]) write_msg(get_lang('Renamed %1 to %2',returnVal[1],returnVal[2])); |
---|
| 36 | var nameLink = document.createElement('A'); |
---|
| 37 | var inputName = document.getElementById('input_'+returnVal[1]); |
---|
| 38 | nameLink.innerHTML = returnVal[2]; |
---|
| 39 | nameLink.href="./index.php?menuaction=filemanager.uifilemanager.view&file="+base64_encode(returnVal[2])+"&path="+base64_encode(currentPath); |
---|
| 40 | nameLink.target = "_blank"; |
---|
| 41 | nameLink.id = "name_"+returnVal[2]; |
---|
| 42 | |
---|
| 43 | /*Value da checkbox correspondente ao arquivo é atualizada*/ |
---|
| 44 | inputName.parentNode.parentNode.firstChild.firstChild.value = returnVal[2]; |
---|
| 45 | |
---|
| 46 | inputName.parentNode.appendChild(nameLink); |
---|
| 47 | inputName.parentNode.removeChild(inputName); |
---|
| 48 | } |
---|
| 49 | else |
---|
| 50 | { |
---|
[1869] | 51 | if (returnVal[1] == "badchar") |
---|
| 52 | write_error(get_lang('File names cannot contain "%1"',returnVal[2])); |
---|
| 53 | else if (returnVal[1] == "slashes") |
---|
| 54 | write_error(get_lang('File names cannot contain \\ or /')); |
---|
| 55 | else if (returnVal[1] == "editing") |
---|
| 56 | write_error(get_lang('This file is being edited right now')); |
---|
| 57 | else |
---|
| 58 | write_error(get_lang('Could not rename %1 to %2', returnVal[1], returnVal[2])); |
---|
[1846] | 59 | } |
---|
| 60 | |
---|
| 61 | } |
---|
| 62 | handler.prototype.upload = function(data){ |
---|
| 63 | close_window(); |
---|
| 64 | connector.hideProgressBar(); |
---|
| 65 | var response = unserialize(data); |
---|
| 66 | if (response[0] == "Ok") |
---|
| 67 | write_msg(get_lang('All files created sucessfuly')); |
---|
| 68 | else |
---|
| 69 | for (var i=0;i < response.length; i++) |
---|
| 70 | write_error(response[i]); |
---|
| 71 | toolbar.control('reload'); |
---|
| 72 | } |
---|
| 73 | handler.prototype.restricted = function(data){ |
---|
| 74 | if (data.indexOf("True") == 0){ |
---|
[1869] | 75 | returnVal = data.split('|'); |
---|
[1846] | 76 | var img_lock = document.getElementById('restrict_'+returnVal[1]); |
---|
| 77 | if (img_lock.src.indexOf('button_unlock') > 0) |
---|
| 78 | { |
---|
| 79 | img_lock.src = img_lock.src.replace(/button_unlock/g,'button_lock'); |
---|
| 80 | write_msg(get_lang('%1 marked as restricted',returnVal[1])); |
---|
| 81 | } |
---|
| 82 | else |
---|
| 83 | { |
---|
| 84 | img_lock.src = img_lock.src.replace(/button_lock/g,'button_unlock'); |
---|
| 85 | write_msg(get_lang('%1 unmarked as restricted',returnVal[1])); |
---|
| 86 | } |
---|
| 87 | } |
---|
| 88 | else |
---|
| 89 | write_error("Could not mark as restricted"); |
---|
| 90 | } |
---|
[1854] | 91 | handler.prototype.archive = function(data) { |
---|
[1869] | 92 | returnVal = data.split('|'); |
---|
[1865] | 93 | if (returnVal[0] == 'False') |
---|
| 94 | { |
---|
| 95 | write_error(get_lang('It was not possible to execute it')); |
---|
| 96 | } |
---|
| 97 | else |
---|
| 98 | if (returnVal[0] == 'wpasswd') |
---|
| 99 | { |
---|
| 100 | write_error(get_lang('Wrong password')); |
---|
| 101 | return; |
---|
| 102 | } |
---|
| 103 | else |
---|
| 104 | write_msg(get_lang('Your operation was successfully executed')); |
---|
[1854] | 105 | toolbar.control('reload'); |
---|
[1865] | 106 | |
---|
[1854] | 107 | } |
---|
[1869] | 108 | handler.prototype.updateComment = function (data) { |
---|
| 109 | var returnVal = data.split('|'); |
---|
| 110 | if (data.indexOf("True") == 0) |
---|
| 111 | { |
---|
| 112 | write_msg(get_lang('Updated comment for %1',returnVal[1])); |
---|
| 113 | } |
---|
| 114 | else |
---|
| 115 | { |
---|
| 116 | if (returnVal[1] == "badchar") |
---|
| 117 | write_error(get_lang('Comments cannot contain "%1"',returnVal[2])); |
---|
| 118 | else |
---|
| 119 | write_error(get_lang('You have no permission to access this file')); |
---|
| 120 | } |
---|
[1846] | 121 | |
---|
[1869] | 122 | } |
---|
| 123 | |
---|
[1846] | 124 | var handler = new handler(); |
---|