Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions program/actions/settings/folder_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,16 @@ public static function folder_form($attrib)
'label' => $rcmail->gettext('parentfolder'),
'value' => $select->show($selected),
];

$upBtn = new html_button(['id' => 'move-folder-up', 'class' => 'move-folder-up']);
$downBtn = new html_button(['id' => 'move-folder-down', 'class' => 'move-folder-down']);
$form['props']['fieldsets']['location']['content']['order'] = [
'label' => $rcmail->gettext('reorder_folder'),
'value' => html::div([], [
$upBtn->show($rcmail->gettext('reorder_folder_up')),
$downBtn->show($rcmail->gettext('reorder_folder_down')),
]),
];
}

// Settings
Expand Down
22 changes: 22 additions & 0 deletions program/actions/settings/folder_reorder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

class rcmail_action_settings_folder_reorder extends rcmail_action_settings_folders
{
protected static $mode = self::MODE_AJAX;

/**
* Request handler.
*
* @param array $args Arguments from the previous step(s)
*/
#[\Override]
public function run($args = [])
{
$rcmail = rcmail::get_instance();
$list = array_flip(rcube_utils::get_input_value('folderorder', rcube_utils::INPUT_POST, true));
$rcmail->user->save_prefs(['folder_order' => $list]);

$rcmail->output->show_message('successfullysaved', 'confirmation');
$rcmail->output->send();
}
}
5 changes: 5 additions & 0 deletions program/actions/settings/folders.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function run($args = [])
$storage = $rcmail->get_storage();

$rcmail->output->set_pagetitle($rcmail->gettext('folders'));
$rcmail->output->set_env('folder_ordered_manually', !empty($rcmail->user->get_prefs()['folder_order']));
$rcmail->output->set_env('prefix_ns', $storage->get_namespace('prefix'));
$rcmail->output->set_env('quota', (bool) $storage->get_capability('QUOTA'));
$rcmail->output->include_script('treelist.js');
Expand Down Expand Up @@ -262,6 +263,10 @@ public static function folder_tree_element($folders, &$key, &$js_folders)
'id' => $idx,
'class' => trim($data['class'] . ' mailbox'),
];
// Only allow reordering of non-protected folders.
if ($data['protected']) {
$attribs['class'] .= ' protected';
}

if (!isset($data['level'])) {
$data['level'] = 0;
Expand Down
Loading
Loading