Changeset 3913 for branches/2.2/filemanager/js/handler.js
- Timestamp:
- 03/25/11 12:36:46 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/filemanager/js/handler.js
r3897 r3913 4 4 { 5 5 var returnVal = data.split('|'); 6 6 7 7 if (returnVal[0] == 'False') 8 8 { … … 10 10 } 11 11 else 12 12 13 13 if (returnVal[0] == 'wpasswd') 14 15 16 17 18 19 20 21 14 { 15 write_error(get_lang('Wrong password')); 16 return; 17 } 18 else 19 write_msg(get_lang('Your operation was successfully executed')); 20 21 toolbar.control('reload'); 22 22 } 23 23 … … 25 25 { 26 26 var returnVal = data.split('|'); 27 27 28 28 if (returnVal[0] == 'NODIR') 29 29 write_error(get_lang('Could not copy file because no destination directory is given')); … … 149 149 } 150 150 151 function rename(data) 152 { 153 if ( data == null ) 154 { 155 var returnVal = new Array ("True",oldValue,oldValue); 156 } 157 else 158 var returnVal = data.split('|'); 159 160 if ( returnVal[0] == "True" ) 161 { 162 if ( returnVal[1] != returnVal[2] ) 163 write_msg(get_lang('Renamed %1 to %2',returnVal[1],returnVal[2])); 164 165 var nameLink = document.createElement('A'); 166 var inputName = document.getElementById('input_'+returnVal[1]); 167 var trFile = inputName.parentNode.parentNode.parentNode; 168 169 nameLink.innerHTML = returnVal[2]; 170 nameLink.href="./index.php?menuaction=filemanager.uifilemanager.view&file=" 171 + base64_encode(returnVal[2])+"&path="+base64_encode(currentPath); 172 nameLink.target = "_blank"; 173 nameLink.id = "name_"+returnVal[2]; 174 175 inputName.parentNode.appendChild(nameLink); 176 inputName.parentNode.removeChild(inputName); 177 trFile.innerHTML = trFile.innerHTML.replace(returnVal[1],returnVal[2]); 178 trFile.id = trFile.id.replace(returnVal[1],returnVal[2]); 179 toolbar.control('reload'); 180 } 181 else 182 { 183 if ( returnVal[1] == "badchar" ) 184 write_error(get_lang('File names cannot contain "%1"',returnVal[2])); 185 else if (returnVal[1] == "slashes") 186 write_error(get_lang('File names cannot contain \\ or /')); 187 else if (returnVal[1] == "editing") 188 write_error(get_lang('This file is being edited right now')); 189 else 190 write_error(get_lang('Could not rename %1 to %2', returnVal[1], returnVal[2])); 191 } 192 151 function rename() 152 { 153 var _handlerRename = function(data) 154 { 155 var _data = unserialize( data ); 156 157 for( var i = 0 ; i < _data.length; i++ ) 158 { 159 if( _data[i]['error'] ) 160 write_msg(_data[i]['error'] ); 161 162 if( _data[i]['true'] ) 163 write_msg(_data[i]['true'] ); 164 } 165 } 166 167 if( arguments.length > 1 ) 168 { 169 var _input = arguments[0]; 170 var _span = arguments[1] ; 171 var _parent = _input.parentNode; 172 173 _input.style.height = ( parseInt(_input.style.height) - 4 ); 174 175 _span.style.className = "fileLink"; 176 _span.innerHTML = _input.value; 177 178 if( _parent != null ) 179 { 180 // Remove Input 181 if( _input != null ) 182 _parent.removeChild( _input ); 183 184 // Add Span 185 if( _span != null ) 186 _parent.appendChild( _span ); 187 188 var url = './index.php?menuaction=filemanager.vfs_functions.rename'; 189 var params = 'file='+base64_encode(_input.id.substr(6))+'&to='+base64_encode(_input.value)+'&path='+base64_encode(currentPath); 190 191 cExecute_( url, _handlerRename , params ); 192 } 193 194 } 193 195 } 194 196 … … 197 199 if (data.indexOf("True") == 0) 198 200 { 199 200 201 returnVal = data.split('|'); 202 var img_lock = document.getElementById('restrict_'+returnVal[1]); 201 203 202 204 if (img_lock.style.backgroundImage.indexOf('button_unlock') > 0) … … 243 245 * response['max_postsize] = diretiva do PHP para POST_MAX_SIZE; 244 246 */ 245 247 246 248 write_msg( get_lang("ERROR: Use the advanced file sending!") ); 247 249 return false; … … 257 259 { 258 260 var _indexOf = response[i]['file'].toUpperCase().indexOf(_inputs[j].value.toUpperCase() ); 259 261 260 262 if( response[i]['file'].toUpperCase() === _inputs[j].value.toUpperCase() && _indexOf > -1 ) 261 263 { 262 264 _inputs[j].parentNode.setAttribute("erroUpload", "true"); 263 265 264 266 var _parent = _inputs[j].parentNode; 265 267 var _div = _parent.firstChild; … … 271 273 _div.style.cursor = "pointer"; 272 274 _div.onclick = function(){this.style.display = 'none';} ; 273 275 274 276 if( response[i]['size_max'] ) 275 277 { 276 278 _div.innerHTML = "<span style='font-weight:bold' >Erro </span>:: Tamanho do arquivo " 277 279 + borkb( response[i]['size'] ) + " - Permitido " + borkb( response[i]['size_max'] ); 278 280 } 279 281 else if( response[i]['badchar'] ) … … 291 293 else if( response[i]['undefined'] ) 292 294 { 293 _div.innerHTML = "<span style='font-weight:bold' > Arquivo Duplicado </span>:: " + response[i]['file'];295 _div.innerHTML = "<span style='font-weight:bold' >Erro </span>:: " + response[i]['undefined']; 294 296 } 295 297 else if( response[i]['filesize'] ) … … 298 300 } 299 301 } 302 else 303 { 304 write_msg( response[i]['undefined'] ); 305 _winBuild( "dwindownewUpload" , "remove" ); 306 } 300 307 } 301 308 } 302 309 } 303 310 304 311 for( var j = 0 ; j < _inputs.length ; j++ ) 305 312 { … … 335 342 336 343 window.handler = new handler; 337 344 338 345 })();
Note: See TracChangeset
for help on using the changeset viewer.