summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-10-21 11:08:32 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2014-10-21 11:08:32 (GMT)
commit9174727006085404bdabdd1684cd669dc713c111 (patch)
treef96b83185073d1c89eb1a4a3dc097c2dda771eb3
parentffd72032374661f2a43c835ce764dc083ed4febe (diff)
downloadkolab-chwala-9174727006085404bdabdd1684cd669dc713c111.tar.gz
Extend folder edit form with possibility to move folders (#3783)
-rw-r--r--lib/client/file_ui_client_main.php16
-rw-r--r--public_html/js/files_ui.js28
-rw-r--r--public_html/skins/default/style.css12
3 files changed, 44 insertions, 12 deletions
diff --git a/lib/client/file_ui_client_main.php b/lib/client/file_ui_client_main.php
index 3b882f7..ff91b13 100644
--- a/lib/client/file_ui_client_main.php
+++ b/lib/client/file_ui_client_main.php
@@ -112,7 +112,11 @@ class file_ui_client_main extends file_ui
$input_name = new html_inputfield(array(
'type' => 'text',
'name' => 'name',
- 'value' => '',
+ 'id' => 'folder-edit-name-input',
+ ));
+ $parent_select = new html_select(array(
+ 'name' => 'parent',
+ 'id' => 'folder-edit-parent-select',
));
$submit = new html_inputfield(array(
'type' => 'button',
@@ -125,14 +129,18 @@ class file_ui_client_main extends file_ui
'value' => $this->translate('form.cancel'),
));
+ $parent_select->add('---', '');
+
$table = new html_table;
- $table->add(null, $input_name->show());
+ $table->add(null, html::label('folder-edit-name-input', $this->translate('folder.name')) . $input_name->show());
$table->add('buttons', $submit->show() . $cancel->show());
$content = html::tag('fieldset', null,
- html::tag('legend', null,
- $this->translate('folder.edittitle')) . $table->show());
+ html::tag('legend', null, $this->translate('folder.edittitle'))
+ . $table->show()
+ . html::div('', html::label('folder-edit-parent-select', $this->translate('folder.parent')) . $parent_select->show())
+ );
$form = html::tag('form', array(
'id' => 'folder-edit-form',
diff --git a/public_html/js/files_ui.js b/public_html/js/files_ui.js
index 380697c..e369546 100644
--- a/public_html/js/files_ui.js
+++ b/public_html/js/files_ui.js
@@ -587,6 +587,7 @@ function files_ui()
}
this.set_busy(true, 'saving');
+ this.env.folder_rename = folder['new'];
this.request('folder_move', {folder: folder.folder, 'new': folder['new']}, 'folder_rename_response');
};
@@ -1696,13 +1697,27 @@ function files_ui()
// Display folder edit form
this.folder_edit_start = function()
{
- var form = this.form_show('folder-edit'),
- arr = this.env.folder.split(this.env.directory_separator),
+ var opts = [], separator = this.env.directory_separator,
+ form = this.form_show('folder-edit'),
+ select = $('#folder-edit-parent-select'),
+ arr = this.env.folder.split(separator),
name = arr.pop();
- this.env.folder_edit_path = arr.join(this.env.directory_separator);
-
$('input[name="name"]', form).val(name).focus();
+
+ $('option[value!=""]', select).remove();
+
+ $.each(this.env.folders, function(i, v) {
+ var n, arr = i.split(separator),
+ name = arr.pop(), prefix = '', level = '&nbsp;&nbsp;&nbsp;';
+
+ for (n=arr.length; n>0; n--)
+ prefix += level;
+
+ opts.push($('<option>').attr('value', i).html(prefix).append($('<span>').text(name)));
+ });
+
+ select.append(opts).val(arr.join(separator));
};
// Hide folder edit form
@@ -1719,11 +1734,10 @@ function files_ui()
if (!data.name)
return;
- if (this.env.folder_edit_path)
- folder = this.env.folder_edit_path + this.env.directory_separator;
+ if (data.parent)
+ folder = data.parent + this.env.directory_separator;
folder += data.name;
- this.env.folder_rename = folder;
this.folder_edit_stop();
this.command('folder.edit', {folder: this.env.folder, 'new': folder});
diff --git a/public_html/skins/default/style.css b/public_html/skins/default/style.css
index 8169e8a..ab6ebe2 100644
--- a/public_html/skins/default/style.css
+++ b/public_html/skins/default/style.css
@@ -145,6 +145,7 @@ table tbody tr.selected {
background-color: #d6efff;
}
+
/**** Common UI elements ****/
#topmenu {
@@ -875,7 +876,6 @@ table.progressinfo td.value {
}
-
/***** autocomplete list *****/
#autocompletepane
@@ -910,6 +910,7 @@ table.progressinfo td.value {
background-color: #d6efff;
}
+
/***** tabbed interface elements *****/
div.tabsbar
@@ -974,6 +975,7 @@ fieldset.tabbed
border-top: none;
}
+
/***** Dialog windows *****/
#_wModal_bg {
background-color: #000;
@@ -1065,6 +1067,7 @@ fieldset.tabbed
background-color: #0044CC
}
+
/**** Login form elements ****/
#login_form {
@@ -1105,6 +1108,7 @@ fieldset.tabbed
margin-top: 5px;
}
+
/**** Main screen elements ****/
#main {
@@ -1117,6 +1121,12 @@ fieldset.tabbed
text-align: right;
}
+#folder-edit-form label {
+ display: inline-block;
+ width: 100px;
+}
+
+
/***** tree indicators *****/
td span.branch span