From c6406eb1a9c0ea1f0d523af74fe16bad8f885dc9 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 11 Jun 2013 10:59:46 +0200 Subject: Improved main preferences page performance by skipping form generation when sections list is being build, CS fixes --- program/steps/settings/func.inc | 1980 ++++++++++++++++++++++----------------- 1 file changed, 1103 insertions(+), 877 deletions(-) diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index cbe3bc954..3ee098ca8 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -19,949 +19,1175 @@ +-----------------------------------------------------------------------+ */ -if (!$OUTPUT->ajax_call) - $OUTPUT->set_pagetitle(rcube_label('preferences')); - +if (!$OUTPUT->ajax_call) { + $OUTPUT->set_pagetitle(rcube_label('preferences')); +} // similar function as /steps/settings/identities.inc::rcmail_identity_frame() function rcmail_preferences_frame($attrib) { - global $OUTPUT; + global $OUTPUT; - if (!$attrib['id']) - $attrib['id'] = 'rcmprefsframe'; + if (!$attrib['id']) { + $attrib['id'] = 'rcmprefsframe'; + } - return $OUTPUT->frame($attrib, true); + return $OUTPUT->frame($attrib, true); } function rcmail_sections_list($attrib) { - global $RCMAIL; + global $RCMAIL; - // add id to message list table if not specified - if (!strlen($attrib['id'])) - $attrib['id'] = 'rcmsectionslist'; + // add id to message list table if not specified + if (!strlen($attrib['id'])) { + $attrib['id'] = 'rcmsectionslist'; + } - list($list, $cols) = rcmail_user_prefs(); + list($list, $cols) = rcmail_user_prefs(); - // create XHTML table - $out = rcube_table_output($attrib, $list, $cols, 'id'); + // create XHTML table + $out = rcube_table_output($attrib, $list, $cols, 'id'); - // set client env - $RCMAIL->output->add_gui_object('sectionslist', $attrib['id']); - $RCMAIL->output->include_script('list.js'); + // set client env + $RCMAIL->output->add_gui_object('sectionslist', $attrib['id']); + $RCMAIL->output->include_script('list.js'); - return $out; + return $out; } function rcmail_identities_list($attrib) { - global $OUTPUT, $RCMAIL; + global $OUTPUT, $RCMAIL; - // add id to message list table if not specified - if (!strlen($attrib['id'])) - $attrib['id'] = 'rcmIdentitiesList'; + // add id to message list table if not specified + if (!strlen($attrib['id'])) { + $attrib['id'] = 'rcmIdentitiesList'; + } - // get identities list and define 'mail' column - $list = $RCMAIL->user->list_identities(); - foreach ($list as $idx => $row) - $list[$idx]['mail'] = trim($row['name'] . ' <' . rcube_idn_to_utf8($row['email']) .'>'); + // get identities list and define 'mail' column + $list = $RCMAIL->user->list_identities(); + foreach ($list as $idx => $row) { + $list[$idx]['mail'] = trim($row['name'] . ' <' . rcube_idn_to_utf8($row['email']) .'>'); + } - // get all identites from DB and define list of cols to be displayed - $plugin = $RCMAIL->plugins->exec_hook('identities_list', array( - 'list' => $list, - 'cols' => array('mail'))); + // get all identites from DB and define list of cols to be displayed + $plugin = $RCMAIL->plugins->exec_hook('identities_list', array( + 'list' => $list, + 'cols' => array('mail') + )); - // @TODO: use