Skip to content

Commit

Permalink
Refact filter_expanded_folder_data output
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadow243 committed Oct 18, 2024
1 parent 1c7adc0 commit 24d87bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
7 changes: 7 additions & 0 deletions modules/imap/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,14 @@ function format_imap_folder_section($folders, $id, $output_mod, $with_input = fa
if ($manage) {
$results .= '<li class="manage_folders_li"><i class="bi bi-gear-wide me-1"></i><a class="manage_folder_link" href="'.$manage.'">'.$output_mod->trans('Manage Folders').'</a></li>';
}
$f = $output_mod->get('folder', '');
$quota = $output_mod->get('quota');
$quota_max = $output_mod->get('quota_max');
if (!$f && $quota) {
$results .= '<li class="quota_info"><div class="progress bg-secondary border"><div class="progress-bar bg-light" style="width:'.$quota.'%"></div></div>'.$quota.'% used on '.$quota_max.' MB</li>';
}

$results .= '</ul>';
return $results;
}}

Expand Down
10 changes: 1 addition & 9 deletions modules/imap/output_modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -774,19 +774,11 @@ class Hm_Output_filter_expanded_folder_data extends Hm_Output_Module {
* Build the HTML for a list of subfolders. The page cache is used to pass this to the folder list.
*/
protected function output() {
$res = '';
$folder_data = $this->get('imap_expanded_folder_data', array());
$with_input = $this->get('with_input', false);
$folder = $this->get('folder', '');
$can_share_folders = $this->get('can_share_folders', false);
if (!empty($folder_data)) {
$res .= format_imap_folder_section($folder_data, $this->get('imap_expanded_folder_id'), $this, $with_input, $can_share_folders);
$quota = $this->get('quota');
$quota_max = $this->get('quota_max');
if (!$folder && $quota) {
$res .= '<li class="quota_info"><div class="progress bg-secondary border"><div class="progress-bar bg-light" style="width:'.$quota.'%"></div></div>'.$quota.'% used on '.$quota_max.' MB</li>';
}
$res .= '</ul>';
$res = format_imap_folder_section($folder_data, $this->get('imap_expanded_folder_id'), $this, $with_input, $can_share_folders);
$this->out('imap_expanded_folder_formatted', $res);
}
}
Expand Down

0 comments on commit 24d87bd

Please sign in to comment.