Skip to content

Commit

Permalink
Setting up IMAP special folders when using the quick server setup form.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yannick243 committed May 21, 2024
1 parent 5321ba7 commit d8695d7
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 21 deletions.
2 changes: 2 additions & 0 deletions modules/core/handler_modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,8 @@ public function process() {

Hm_Msgs::add("Server saved");
$this->out('just_saved_credentials', true);
$this->out('nux_server_id', $this->imap_server_id);
$this->out('nux_service_name', $provider);
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions modules/core/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@
'msg_parts' => array(FILTER_UNSAFE_RAW, false),
'page_links' => array(FILTER_UNSAFE_RAW, false),
'folder_status' => array(FILTER_DEFAULT, FILTER_REQUIRE_ARRAY),
'nux_server_id' => array(FILTER_DEFAULT, false),
'nux_service_name' => array(FILTER_DEFAULT, false)
),
'allowed_cookie' => array(
'CYPHTID' => FILTER_DEFAULT,
Expand Down
57 changes: 36 additions & 21 deletions modules/core/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -2188,34 +2188,49 @@ function submitSmtpImapServer() {
Hm_Notices.show(res.router_user_msgs);

if (res.just_saved_credentials) {
$('#srv_setup_stepper_stepper').find('form').trigger('reset');
display_config_step(0);

//Initialize the form
$("#srv_setup_stepper_profile_reply_to").val('');
$("#srv_setup_stepper_profile_signature").val('');
$("#srv_setup_stepper_profile_name").val('');
$("#srv_setup_stepper_email").val('');
$("#srv_setup_stepper_password").val('');
$("#srv_setup_stepper_profile_is_default").prop('checked', true);
$("#srv_setup_stepper_is_sender").prop('checked', true);
$("#srv_setup_stepper_is_receiver").prop('checked', true);
$("#srv_setup_stepper_enable_sieve").prop('checked', false);
$("#srv_setup_stepper_only_jmap").prop('checked', false);
$('#step_config-imap_bloc').show();
$('#step_config-smtp_bloc').show();
$('#srv_setup_stepper_profile_bloc').show();

Hm_Utils.set_unsaved_changes(1);
Hm_Folders.reload_folders(true);
location.reload();
if (res.nux_server_id) {
Hm_Ajax.request(
[{'name': 'hm_ajax_hook', 'value': 'ajax_imap_accept_special_folders'},
{'name': 'imap_server_id', value: res.nux_server_id},
{'name': 'imap_service_name', value: res.nux_service_name}],
function () {
resetQuickSetupForm();
}
);
} else {
resetQuickSetupForm();
}
}
}, null, null, function (res) {
$('#srv_setup_stepper_form_loader').addClass('hide');
$('.step_config-actions').removeClass('hide');
});
}

function resetQuickSetupForm() {
$('#srv_setup_stepper_stepper').find('form').trigger('reset');
display_config_step(0);

//Initialize the form
$("#srv_setup_stepper_profile_reply_to").val('');
$("#srv_setup_stepper_profile_signature").val('');
$("#srv_setup_stepper_profile_name").val('');
$("#srv_setup_stepper_email").val('');
$("#srv_setup_stepper_password").val('');
$("#srv_setup_stepper_profile_is_default").prop('checked', true);
$("#srv_setup_stepper_is_sender").prop('checked', true);
$("#srv_setup_stepper_is_receiver").prop('checked', true);
$("#srv_setup_stepper_enable_sieve").prop('checked', false);
$("#srv_setup_stepper_only_jmap").prop('checked', false);
$('#step_config-imap_bloc').show();
$('#step_config-smtp_bloc').show();
$('#srv_setup_stepper_profile_bloc').show();

Hm_Utils.set_unsaved_changes(1);
Hm_Folders.reload_folders(true);
location.reload();
}

function handleCreateProfileCheckboxChange(checkbox) {
if(checkbox.checked) {
$('#srv_setup_stepper_profile_bloc').show();
Expand Down

0 comments on commit d8695d7

Please sign in to comment.