Skip to content

Commit

Permalink
Merge pull request cypht-org#886 from josaphatim/fixed-adding-servers
Browse files Browse the repository at this point in the history
Fix SMTP to/cc/bcc fields loosing their content when they loose focus
  • Loading branch information
kroky committed Feb 8, 2024
2 parents cbd3214 + 84fc6b7 commit 6af16bf
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 21 deletions.
6 changes: 3 additions & 3 deletions modules/feeds/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public function process() {
}
}
else {
Hm_Msgs::add('ERRCound not find a feed at that address');
Hm_Msgs::add('ERRCould not find a feed at that address');
}
}
else {
Expand All @@ -389,7 +389,7 @@ public function process() {
}
}
else {
Hm_Msgs::add(sprintf('ERRCound not add feed: %s', $errstr));
Hm_Msgs::add(sprintf('ERRCould not add feed: %s', $errstr));
}
}
else {
Expand Down Expand Up @@ -535,7 +535,7 @@ protected function output() {
$count = sprintf($this->trans('%d configured'), $count);

return '<div class="feed_server_setup">
<div data-target=".feeds_section" class="server_section border-bottom cursor-pointer px-1 py-2 mt-4 pe-auto">
<div data-target=".feeds_section" class="server_section border-bottom cursor-pointer px-1 py-3 pe-auto">
<a href="#" class="pe-auto">
<i class="bi bi-rss-fill me-3"></i>
<b> '.$this->trans('Feeds').'</b>
Expand Down
2 changes: 1 addition & 1 deletion modules/github/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ protected function output() {
class Hm_Output_github_connect_section extends Hm_Output_Module {
protected function output() {
$details = $this->get('github_connect_details', array());
$res = '<div class="github_connect"><div data-target=".github_connect_section" class="server_section border-bottom cursor-pointer px-1 py-2 mt-4 pe-auto">
$res = '<div class="github_connect"><div data-target=".github_connect_section" class="server_section border-bottom cursor-pointer px-1 py-3 pe-auto">
<a href="#" class="pe-auto">
<i class="bi bi-github me-3"></i>
<b>'.$this->trans('Github Connect').'</b>
Expand Down
2 changes: 1 addition & 1 deletion modules/imap/handler_modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ public function process() {
$this->session->record_unsaved('JMAP server added');
}
else {
Hm_Msgs::add('ERRCound not access supplied URL');
Hm_Msgs::add('ERRCould not access supplied URL');
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions modules/imap/output_modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ protected function output() {
'<label for="enable_sieve_filter" class="form-check-label"> '.$this->trans('Enable Sieve Filters').'</label></div></td></tr>';
}

return '<div class="imap_server_setup"><div data-target=".imap_section" class="server_section border-bottom cursor-pointer px-1 py-2 mt-4">'.
return '<div class="imap_server_setup"><div data-target=".imap_section" class="server_section border-bottom cursor-pointer px-1 py-3">'.
'<a href="#" class="pe-auto"><i class="bi bi-envelope-fill me-3"></i>'.
'<b> '.$this->trans('IMAP Servers').'</b></a>'.
'<div class="server_count">'.$count.'</div></div>
Expand Down Expand Up @@ -609,7 +609,7 @@ protected function output() {

return '
<div class="jmap_server_setup">
<div data-target=".jmap_section" class="server_section border-bottom cursor-pointer px-1 py-2 mt-4 pe-auto">
<div data-target=".jmap_section" class="server_section border-bottom cursor-pointer px-1 py-3 pe-auto">
<a href="#" class="pe-auto">
<i class="bi bi-envelope-fill me-3"></i>
<b>'.$this->trans('JMAP Servers').'</b>
Expand Down
2 changes: 1 addition & 1 deletion modules/nasa/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ protected function output() {
*/
class Hm_Output_nasa_connect_section extends Hm_Output_Module {
protected function output() {
$res = '<div class="nasa_connect"><div data-target=".nasa_connect_section" class="server_section border-bottom cursor-pointer px-1 py-2 mt-4 pe-auto">
$res = '<div class="nasa_connect"><div data-target=".nasa_connect_section" class="server_section border-bottom cursor-pointer px-1 py-3 pe-auto">
<a href="#" class="pe-auto">
<i class="bi bi-key-fill me-3"></i>
<b>'.$this->trans('NASA APIs').'</b>
Expand Down
2 changes: 1 addition & 1 deletion modules/nux/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ protected function output() {
if ($this->get('single_server_mode')) {
return '';
}
return '<div class="nux_add_account"><div data-target=".quick_add_section" class="server_section border-bottom cursor-pointer px-1 py-2 mt-2 pe-auto"><a href="#" class="pe-auto">'.
return '<div class="nux_add_account"><div data-target=".quick_add_section" class="server_section border-bottom cursor-pointer px-1 py-3 pe-auto"><a href="#" class="pe-auto">'.
'<i class="bi bi-check-circle-fill me-3"></i>'.
'<b>'.$this->trans('Add an E-mail Account').'</b></a></div>';
}
Expand Down
9 changes: 6 additions & 3 deletions modules/smtp/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public function process() {
}
else {
$this->session->set('add_form_vals', $form);
Hm_Msgs::add(sprintf('ERRCound not add server: %s', $errstr));
Hm_Msgs::add(sprintf('ERRCould not add server: %s', $errstr));
}
}
}
Expand Down Expand Up @@ -1109,19 +1109,22 @@ protected function output() {
'<input type="hidden" class="compose_draft_id" name="draft_id" value="'.$this->html_safe($draft_id).'" />'.
'<input type="hidden" class="compose_in_reply_to" name="compose_in_reply_to" value="'.$this->html_safe($in_reply_to).'" />'.

'<div class="form-floating mb-3 to_outer position-relative">'.
'<div class="form-floating mb-3 to_outer compose_container position-relative">'.
'<div class="bubbles bubble_dropdown"></div>'.
'<input autocomplete="off" value="'.$this->html_safe($to).'" required name="compose_to" class="compose_to form-control" type="text" placeholder="'.$this->trans('To').' kiki" id="compose_to" />'.
'<label for="compose_to">'.$this->trans('To').'</label>'.
'<a href="#" tabindex="-1" class="toggle_recipients position-absolute top-0 end-0 mt-2 me-2"><i class="bi bi-plus-square-fill fs-3"></i></a>'.
'</div>'.
'<div id="to_contacts"></div>'.
'<div class="recipient_fields">'.
'<div class="form-floating mb-3 compose_container">'.
'<div class="bubbles bubble_dropdown"></div>'.
'<input autocomplete="off" value="'.$this->html_safe($cc).'" name="compose_cc" class="compose_cc form-control" type="text" placeholder="'.$this->trans('Cc').'" id="compose_cc" />'.
'<label for="compose_cc">'.$this->trans('Cc').'</label>'.
'</div>'.
'<div id="cc_contacts"></div>'.
'<div class="form-floating mb-3 compose_container">'.
'<div class="bubbles bubble_dropdown"></div>'.
'<input autocomplete="off" value="'.$this->html_safe($bcc).'" name="compose_bcc" class="compose_bcc form-control" type="text" placeholder="'.$this->trans('Bcc').'" id="compose_bcc" />'.
'<label for="compose_bcc">'.$this->trans('Bcc').'</label>'.
'</div>'.
Expand Down Expand Up @@ -1235,7 +1238,7 @@ protected function output() {
}

return '<div class="smtp_server_setup">
<div data-target=".smtp_section" class="server_section border-bottom cursor-pointer px-1 py-2 mt-4 pe-auto">
<div data-target=".smtp_section" class="server_section border-bottom cursor-pointer px-1 py-3 pe-auto">
<a href="#" class="pe-auto">
<i class="bi bi-file-earmark-text-fill me-3"></i>
<b>'.$this->trans('SMTP Servers').'</b>
Expand Down
10 changes: 5 additions & 5 deletions modules/smtp/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
.progress {background-color: #4323f5; animation: progressBar 1s ease-in-out; animation-fill-mode:both; }
@keyframes progressBar { 0% { width: 0; } 100% { width: 100%; }}
/* .compose_container { padding: 0 10px 0 0; border: 1px solid #ddd; margin-left: 5px; width: 100%; border-radius: 5px; margin-bottom: 10px; } */
.bubbles { display: inline-block; margin-left: 5px; background-color: #fff; cursor: pointer; padding: 5px 0; }
.bubble { font-size: .9rem; border: 1px solid #ddd; border-radius: 4px; padding: 7px 14px; display: inline-block; }
.bubbles { display: inline-block; margin-left: 37px; background-color: #fff; cursor: pointer; z-index: 10; top: 0; }
.bubble { font-size: .9rem; border: 1px solid #ddd; border-radius: 25px; padding: 1px 7px; display: inline-block; }
.bubble:hover { background-color: #eee; }
.bubble:not(:first-child) { margin-left: 5px; }
.bubble_close { font-size: 1.7em; float: right; margin-top: 9px; line-height: 0; margin-left: 7px; }
.bubble_dropdown {position: relative;display: inline-block;}
.bubble_close { font-size: 1.7em; float: right; margin-top: 12px; line-height: 0; margin-left: 7px; }
.bubble_dropdown {position: absolute; display: inline-block; }
.bubble_dropdown-toggle {cursor: pointer;}
.bubble_dropdown-content {display: none;position: absolute;background-color: #f9f9f9;padding: 10px;border: 1px solid #ddd; min-width: 160px; z-index: 1;}
.bubble_dropdown-content {display: none; position: absolute; background-color: #f9f9f9; padding: 10px;border: 1px solid #ddd; min-width: 160px; z-index: 1;}
.bubble_dropdown-content.show {display: block;}
.bubble_dropdown-content ul {list-style-type: none;padding: 0;margin: 0;}
.bubble_dropdown-content ul li span, .bubble_dropdown-content ul li a {display: flex; align-items: center; padding: 8px 4px;text-decoration: none;color: #333;}
Expand Down
2 changes: 1 addition & 1 deletion modules/smtp/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ var text_to_bubbles = function(input) {

var bubble_index = 0;
var append_bubble = function(value, to, id, type, source) {
var bubble = '<div id="bubble_'+bubble_index+'" class="bubble bubble_dropdown-toggle" onclick="toggle_bubble_dropdown(this)" draggable="true" data-id="'+id+'" data-type="'+type+'" data-source="'+source+'" data-value="'+value+'">'+value+'<span class="bubble_close">&times;</span></div>';
var bubble = '<div id="bubble_'+bubble_index+'" class="bubble bubble_dropdown-toggle" onclick="toggle_bubble_dropdown(this)" ondragstart="drag(event)" draggable="true" data-id="'+id+'" data-type="'+type+'" data-source="'+source+'" data-value="'+value+'">'+value+'<span class="bubble_close">&times;</span></div>';
$(to).prev().append(bubble);
bubble_index++;
};
Expand Down
2 changes: 1 addition & 1 deletion modules/wordpress/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ class Hm_Output_wordpress_connect_section extends Hm_Output_Module {
protected function output() {
$details = $this->get('wp_connect_details', array());

$res = '<div class="wordpress_connect"><div data-target=".wordpress_connect_section" class="server_section border-bottom cursor-pointer px-1 py-2 mt-4 pe-auto">
$res = '<div class="wordpress_connect"><div data-target=".wordpress_connect_section" class="server_section border-bottom cursor-pointer px-1 py-3 pe-auto">
<a href="#" class="pe-auto">
<i class="bi bi-wordpress me-3"></i>
<b>'.$this->trans('WordPress.com Connect').'</b>
Expand Down
4 changes: 2 additions & 2 deletions tests/selenium/servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def smtp_add(self):
self.by_id('smtp_notls').click()
self.by_name('submit_smtp_server').click()
self.wait_on_sys_message()
assert self.by_class('sys_messages').text == 'Added SMTP server!' or self.by_class('sys_messages').text == 'Cound not add server: Connection refused'
assert self.by_class('sys_messages').text == 'Added SMTP server!' or self.by_class('sys_messages').text == 'Could not add server: Connection refused'

def smtp_del(self):
self.by_class('delete_smtp_connection').click()
Expand All @@ -52,7 +52,7 @@ def imap_add(self):
self.by_id('imap_notls').click()
self.by_name('submit_imap_server').click()
self.wait_on_sys_message()
assert self.by_class('sys_messages').text == 'Added server!' or self.by_class('sys_messages').text == 'Cound not add server: Connection refused'
assert self.by_class('sys_messages').text == 'Added server!' or self.by_class('sys_messages').text == 'Could not add server: Connection refused'

def imap_confirm(self):
user = self.by_id('imap_user_'+IMAP_ID)
Expand Down

0 comments on commit 6af16bf

Please sign in to comment.