From eb0c13c9661009fdff4b75115cb2b63b36f573d8 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 5 Nov 2015 12:05:46 +0000 Subject: [PATCH] Replace native prompts in create directory and symlink with et2_dialog.show_prompt --- filemanager/js/app.js | 46 ++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/filemanager/js/app.js b/filemanager/js/app.js index 1f6f0c7a6f..d38433b019 100644 --- a/filemanager/js/app.js +++ b/filemanager/js/app.js @@ -541,28 +541,29 @@ app.classes.filemanager = AppJS.extend( */ createdir: function(action, selected) { - var dir = prompt(this.egw.lang('New directory')); - - if (dir) - { - var path = this.get_path(action && action.parent ? action.parent.data.nextmatch.getInstanceManager().uniqueId : false); - if(action && action instanceof egwAction) + var self = this; + et2_dialog.show_prompt(function(button, dir){ + if (button && dir) { - var paths = this._elems2paths(selected); - if(paths[0]) path = paths[0]; - // check if target is a file --> use it's directory instead - if(selected[0].id || path) + var path = self.get_path(action && action.parent ? action.parent.data.nextmatch.getInstanceManager().uniqueId : false); + if(action && action instanceof egwAction) { - var data = egw.dataGetUIDdata(selected[0].id || 'filemanager::'+path ); - if (data && data.data.mime != 'httpd/unix-directory') + var paths = self._elems2paths(selected); + if(paths[0]) path = paths[0]; + // check if target is a file --> use it's directory instead + if(selected[0].id || path) { - path = this.dirname(path); + var data = egw.dataGetUIDdata(selected[0].id || 'filemanager::'+path ); + if (data && data.data.mime != 'httpd/unix-directory') + { + path = self.dirname(path); + } } } + self._do_action('createdir', dir, true, path); // true=synchronous request + self.change_dir((path == '/' ? '' : path)+'/'+ dir); } - this._do_action('createdir', dir, true, path); // true=synchronous request - this.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() { - var target = prompt(this.egw.lang('Link target')); - - if (target) - { - this._do_action('symlink', target); - } + var self = this; + et2_dialog.show_prompt(function (button, target) { + if (button && target) + { + self._do_action('symlink', target); + } + },this.egw.lang('Link target'), this.egw.lang('Create link')); }, /**