file_exists($abs_new)) { ext_Result::sendResult('rename', false, ext_TextEncoding::toUTF8($newitemname).": ".$GLOBALS["error_msg"]["itemdoesexist"]); } $perms_old = $GLOBALS['ext_File']->fileperms( $abs_old ); $ok=$GLOBALS['ext_File']->rename( get_abs_item($dir,$item), get_abs_item($dir,$newitemname) ); if( ext_isFTPMode()) { $abs_new = get_item_info($dir,$newitemname); } $GLOBALS['ext_File']->chmod( $abs_new, $perms_old ); if($ok===false || PEAR::isError($ok)) { ext_Result::sendResult('rename', false, 'Could not rename '.$dir.'/'.$item.' to '.$newitemname); } $msg = sprintf( $GLOBALS['messages']['success_rename_file'], $item, $newitemname ); ext_Result::sendResult('rename', true, $msg ); } $is_dir = get_is_dir(ext_isFTPMode() ? get_item_info($dir,$item) : get_abs_item($dir,$item)); ?> { "xtype": "form", "width": "350", "height": "150", "id": "simpleform", "labelWidth": 125, "url":"", "dialogtitle": "", "frame": true, "items": [{ "xtype": "textfield", "fieldLabel": "", "name": "newitemname", "id": "newitemname", "value": "", "width":175, "allowBlank":false } ], "listeners": { "afterrender": { fn: function( form ) { form.findById("newitemname").focus(true); } } }, "buttons": [{ "text": "", "handler": function() { statusBarMessage( 'Please wait...', true ); form = Ext.getCmp("simpleform").getForm(); form.submit({ //reset: true, reset: false, success: function(form, action) { if( dirTree.getSelectionModel().getSelectedNode() ) { parentDir = dirTree.getSelectionModel().getSelectedNode().parentNode;parentDir.reload();parentDir.select(); } datastore.reload(); statusBarMessage( action.result.message, false, true ); Ext.getCmp("dialog").destroy(); }, failure: function(form, action) { if( !action.result ) return; Ext.MessageBox.alert('Error!', action.result.error); statusBarMessage( action.result.error, false, false ); }, scope: form, // add some vars to the request, similar to hidden fields params: { option: 'com_extplorer', action: 'rename', dir: '', item: '', confirm: 'true', token: "" } }); } },{ "text": "", "handler": function() { Ext.getCmp("dialog").destroy(); } }] }