Add "Rename" button, remove edit icon from the list
This commit is contained in:
parent
83cbf1db33
commit
45430717d5
5 changed files with 29 additions and 34 deletions
|
@ -102,7 +102,7 @@ window.rcmail && window.files_api && rcmail.addEventListener('init', function()
|
|||
}
|
||||
|
||||
// "one file only" commands
|
||||
rcmail.env.file_commands = ['files-get'];
|
||||
rcmail.env.file_commands = ['files-get', 'files-rename'];
|
||||
// "one or more file" commands
|
||||
rcmail.env.file_commands_all = ['files-delete', 'files-move', 'files-copy'];
|
||||
|
||||
|
@ -504,10 +504,10 @@ function kolab_files_folder_mount_dialog()
|
|||
});
|
||||
};
|
||||
|
||||
// file edition dialog
|
||||
function kolab_files_file_edit_dialog(file)
|
||||
// file rename dialog
|
||||
function kolab_files_file_rename_dialog(file)
|
||||
{
|
||||
var dialog = $('#files-file-edit-dialog'),
|
||||
var dialog = $('#files-file-rename-dialog'),
|
||||
buttons = {}, name = file_api.file_name(file)
|
||||
input = $('input[name="name"]', dialog).val(name);
|
||||
|
||||
|
@ -519,9 +519,9 @@ function kolab_files_file_edit_dialog(file)
|
|||
|
||||
name = folder + file_api.env.directory_separator + name;
|
||||
|
||||
// @TODO: now we only update filename
|
||||
if (name != file)
|
||||
file_api.file_rename(file, name);
|
||||
|
||||
kolab_dialog_close(this);
|
||||
};
|
||||
buttons[rcmail.gettext('kolab_files.cancel')] = function () {
|
||||
|
@ -533,7 +533,7 @@ function kolab_files_file_edit_dialog(file)
|
|||
|
||||
// show dialog window
|
||||
kolab_dialog_show(dialog, {
|
||||
title: rcmail.gettext('kolab_files.fileedit'),
|
||||
title: rcmail.gettext('kolab_files.renamefile'),
|
||||
buttons: buttons,
|
||||
button_classes: ['mainaction']
|
||||
});
|
||||
|
@ -829,7 +829,7 @@ function kolab_files_list_select(list)
|
|||
rcmail.env.viewer = file_api.file_type_supported(type, rcmail.env.files_caps);
|
||||
|
||||
if (!file_api.is_writable(file.replace(/\/[^/]+$/, '')))
|
||||
rcmail.enable_command('files-delete', false);
|
||||
rcmail.enable_command('files-delete', 'files-rename', false);
|
||||
}
|
||||
else
|
||||
rcmail.env.viewer = 0;
|
||||
|
@ -1239,6 +1239,12 @@ rcube_webmail.prototype.files_create = function()
|
|||
kolab_files_file_create_dialog();
|
||||
};
|
||||
|
||||
rcube_webmail.prototype.files_rename = function()
|
||||
{
|
||||
var files = kolab_files_selected();
|
||||
kolab_files_file_rename_dialog(files[0]);
|
||||
};
|
||||
|
||||
rcube_webmail.prototype.folder_create = function()
|
||||
{
|
||||
kolab_files_folder_create_dialog();
|
||||
|
@ -2155,10 +2161,6 @@ function kolab_files_ui()
|
|||
.html(row)
|
||||
.attr({id: 'rcmrow' + index, 'data-file': file, 'data-type': data.type});
|
||||
|
||||
$('td.options > span', row).click(function(e) {
|
||||
kolab_files_file_edit_dialog(file);
|
||||
});
|
||||
|
||||
// collection (or search) lists files from all folders
|
||||
// display file name with full path as title
|
||||
if (!this.env.folder)
|
||||
|
|
|
@ -142,7 +142,7 @@ class kolab_files_engine
|
|||
'folder-mount-form' => array($this, 'folder_mount_form'),
|
||||
'folder-auth-options'=> array($this, 'folder_auth_options'),
|
||||
'file-search-form' => array($this, 'file_search_form'),
|
||||
'file-edit-form' => array($this, 'file_edit_form'),
|
||||
'file-rename-form' => array($this, 'file_rename_form'),
|
||||
'file-create-form' => array($this, 'file_create_form'),
|
||||
'filelist' => array($this, 'file_list'),
|
||||
'filequotadisplay' => array($this, 'quota_display'),
|
||||
|
@ -329,19 +329,19 @@ class kolab_files_engine
|
|||
}
|
||||
|
||||
/**
|
||||
* Template object for file_edit form
|
||||
* Template object for file_rename form
|
||||
*/
|
||||
public function file_edit_form($attrib)
|
||||
public function file_rename_form($attrib)
|
||||
{
|
||||
$attrib['name'] = 'file-edit-form';
|
||||
$attrib['name'] = 'file-rename-form';
|
||||
if (empty($attrib['id'])) {
|
||||
$attrib['id'] = 'file-edit-form';
|
||||
$attrib['id'] = 'file-rename-form';
|
||||
}
|
||||
|
||||
$input_name = new html_inputfield(array('id' => 'file-edit-name', 'name' => 'name', 'size' => 30));
|
||||
$input_name = new html_inputfield(array('id' => 'file-rename-name', 'name' => 'name', 'size' => 30));
|
||||
$table = new html_table(array('cols' => 2, 'class' => 'propform'));
|
||||
|
||||
$table->add('title', html::label('file-edit-name', rcube::Q($this->plugin->gettext('filename'))));
|
||||
$table->add('title', html::label('file-rename-name', rcube::Q($this->plugin->gettext('filename'))));
|
||||
$table->add(null, $input_name->show());
|
||||
|
||||
$out = $table->show();
|
||||
|
@ -351,8 +351,8 @@ class kolab_files_engine
|
|||
$out = $this->rc->output->form_tag($attrib, $out);
|
||||
}
|
||||
|
||||
$this->plugin->add_label('save', 'cancel', 'fileupdating', 'fileedit');
|
||||
$this->rc->output->add_gui_object('file-edit-form', $attrib['id']);
|
||||
$this->plugin->add_label('save', 'cancel', 'fileupdating', 'renamefile');
|
||||
$this->rc->output->add_gui_object('file-rename-form', $attrib['id']);
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
|
|
@ -36,14 +36,14 @@ $labels['get'] = 'Download';
|
|||
$labels['getfile'] = 'Download file';
|
||||
$labels['view'] = 'View';
|
||||
$labels['viewfile'] = 'View file';
|
||||
$labels['rename'] = 'Rename file';
|
||||
$labels['rename'] = 'Rename';
|
||||
$labels['deletefile'] = 'Delete file(s)';
|
||||
$labels['edit'] = 'Edit';
|
||||
$labels['editfile'] = 'Edit file';
|
||||
$labels['save'] = 'Save';
|
||||
$labels['savefile'] = 'Save file';
|
||||
$labels['printfile'] = 'Print file';
|
||||
$labels['fileedit'] = 'File properties';
|
||||
$labels['renamefile'] = 'Rename a file';
|
||||
$labels['createfile'] = 'Create a file';
|
||||
$labels['createandedit'] = 'Create and Edit';
|
||||
$labels['documenttitle'] = 'Title:';
|
||||
|
|
|
@ -256,7 +256,6 @@
|
|||
|
||||
.filelist tr > .options {
|
||||
width: 32px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.filelist thead tr th.filename,
|
||||
|
@ -318,13 +317,6 @@
|
|||
border-radius: 4px 0 0 0;
|
||||
}
|
||||
|
||||
.filelist tbody tr td.options:hover span {
|
||||
width: 26px;
|
||||
height: 18px;
|
||||
background: url(../../../../skins/larry/images/buttons.png) -5px -417px no-repeat;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.filelist td.filename {
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
@ -387,7 +379,7 @@
|
|||
|
||||
#files-dialog,
|
||||
#files-compose-dialog,
|
||||
#files-file-edit-dialog,
|
||||
#files-file-rename-dialog,
|
||||
#files-file-create-dialog,
|
||||
#files-folder-mount-dialog,
|
||||
#files-folder-auth-dialog,
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
<roundcube:button command="files-open" type="link" class="button open disabled" classAct="button open" classSel="button open pressed" label="kolab_files.view" title="kolab_files.viewfile" />
|
||||
<roundcube:button command="files-edit" type="link" class="button edit disabled" classAct="button edit" classSel="button edit pressed" label="kolab_files.edit" title="kolab_files.editfile" />
|
||||
<roundcube:button command="files-create" type="link" class="button create disabled" classAct="button create" classSel="button create pressed" label="kolab_files.create" title="kolab_files.createfile" />
|
||||
<roundcube:button command="files-rename" type="link" class="button rename disabled" classAct="button rename" classSel="button rename pressed" label="kolab_files.rename" title="kolab_files.renamefile" />
|
||||
<roundcube:button command="files-delete" type="link" class="button delete disabled" classAct="button delete" classSel="button delete pressed" label="delete" title="kolab_files.deletefile" />
|
||||
</div>
|
||||
|
||||
|
@ -92,9 +93,9 @@
|
|||
<h3 id="aria-label-foldermountform" class="voice"><roundcube:label name="kolab_files.arialabelfoldermountform" /></h3>
|
||||
<roundcube:object name="folder-mount-form" />
|
||||
</div>
|
||||
<div id="files-file-edit-dialog" role="dialog" aria-labelledby="aria-label-fileeditform" aria-hidden="true">
|
||||
<h3 id="aria-label-fileeditform" class="voice"><roundcube:label name="kolab_files.arialabelfileeditform" /></h3>
|
||||
<roundcube:object name="file-edit-form" />
|
||||
<div id="files-file-rename-dialog" role="dialog" aria-labelledby="aria-label-filerenameform" aria-hidden="true">
|
||||
<h3 id="aria-label-filerenameform" class="voice"><roundcube:label name="kolab_files.arialabelfilerenameform" /></h3>
|
||||
<roundcube:object name="file-rename-form" />
|
||||
</div>
|
||||
<div id="files-file-create-dialog" role="dialog" aria-labelledby="aria-label-filecreateform" aria-hidden="true">
|
||||
<h3 id="aria-label-filecreateform" class="voice"><roundcube:label name="kolab_files.arialabelfilecreateform" /></h3>
|
||||
|
|
Loading…
Add table
Reference in a new issue