Replace native prompts in create directory and symlink with et2_dialog.show_prompt

This commit is contained in:
Hadi Nategh 2015-11-05 12:05:46 +00:00
parent 0a70638205
commit eb0c13c966

View File

@ -541,14 +541,14 @@ app.classes.filemanager = AppJS.extend(
*/ */
createdir: function(action, selected) createdir: function(action, selected)
{ {
var dir = prompt(this.egw.lang('New directory')); var self = this;
et2_dialog.show_prompt(function(button, dir){
if (dir) if (button && dir)
{ {
var path = this.get_path(action && action.parent ? action.parent.data.nextmatch.getInstanceManager().uniqueId : false); var path = self.get_path(action && action.parent ? action.parent.data.nextmatch.getInstanceManager().uniqueId : false);
if(action && action instanceof egwAction) if(action && action instanceof egwAction)
{ {
var paths = this._elems2paths(selected); var paths = self._elems2paths(selected);
if(paths[0]) path = paths[0]; if(paths[0]) path = paths[0];
// check if target is a file --> use it's directory instead // check if target is a file --> use it's directory instead
if(selected[0].id || path) if(selected[0].id || path)
@ -556,13 +556,14 @@ app.classes.filemanager = AppJS.extend(
var data = egw.dataGetUIDdata(selected[0].id || 'filemanager::'+path ); var data = egw.dataGetUIDdata(selected[0].id || 'filemanager::'+path );
if (data && data.data.mime != 'httpd/unix-directory') if (data && data.data.mime != 'httpd/unix-directory')
{ {
path = this.dirname(path); path = self.dirname(path);
} }
} }
} }
this._do_action('createdir', dir, true, path); // true=synchronous request self._do_action('createdir', dir, true, path); // true=synchronous request
this.change_dir((path == '/' ? '' : path)+'/'+dir); self.change_dir((path == '/' ? '' : path)+'/'+ dir);
} }
},this.egw.lang('New directory'),this.egw.lang('Create directroy'));
}, },
/** /**
@ -570,12 +571,13 @@ app.classes.filemanager = AppJS.extend(
*/ */
symlink: function() symlink: function()
{ {
var target = prompt(this.egw.lang('Link target')); var self = this;
et2_dialog.show_prompt(function (button, target) {
if (target) if (button && target)
{ {
this._do_action('symlink', target); self._do_action('symlink', target);
} }
},this.egw.lang('Link target'), this.egw.lang('Create link'));
}, },
/** /**