Skip to content

Commit

Permalink
Merge pull request #903 from IrAlfred/Add-remark-field-to-remember-wh…
Browse files Browse the repository at this point in the history
…y-you-added-a-profile

[ENH]Add a remark field to remember why you added a profile
  • Loading branch information
Shadow243 authored Feb 29, 2024
2 parents 2240fe2 + 1d2447b commit d64699b
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions language/az.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@
'Reply-to' => 'Cavab vermək',
'SMTP Server' => 'SMTP Server',
'Signature' => 'İmza',
'Remark' => 'Qeyd',
'Edit' => 'Düzəliş',
'No' => 'Xeyr',
'Yes' => 'Bəli',
Expand Down
1 change: 1 addition & 0 deletions language/de.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
'Reply-to' => 'Antwort an',
'SMTP Server' => 'SMTP Server',
'Signature' => 'Signaturen',
'Remark' => 'Anmerkung',
'Edit' => 'Editieren',
'No' => 'Nein',
'Yes' => 'Ja',
Expand Down
1 change: 1 addition & 0 deletions language/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
'Reply-to' => false,
'SMTP Server' => false,
'Signature' => false,
'Remark' => false,
'Edit' => false,
'No' => false,
'Yes' => false,
Expand Down
1 change: 1 addition & 0 deletions language/es.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
'Reply-to' => 'Dirección de respuesta',
'SMTP Server' => 'Servidor SMTP',
'Signature' => 'Firma',
'Remark' => 'Observación',
'Edit' => 'Cambiar',
'No' => 'No',
'Yes' => '',
Expand Down
1 change: 1 addition & 0 deletions language/et.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
'Reply-to' => 'Vastus saabub siia',
'SMTP Server' => 'SMTP server',
'Signature' => 'Allkiri',
'Remark' => 'Märkus',
'Edit' => 'Muuda',
'No' => 'Ei',
'Yes' => 'Jah',
Expand Down
1 change: 1 addition & 0 deletions language/fa.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@
"Reply-to"=>"پاسخ دادن به",
"SMTP Server"=>"سرور SMTP",
"Signature"=>"امضا",
"Remark"=>"تذکر دهید",
"Edit"=>"ویرایش کنید",
"No"=>"نه",
"Yes"=>"آره",
Expand Down
1 change: 1 addition & 0 deletions language/fr.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
'Reply-to' => 'Adresse de réponse',
'SMTP Server' => 'Serveur SMTP',
'Signature' => 'Signature',
'Remark' => 'Remarque',
'Edit' => 'Modifier',
'No' => 'Non',
'Yes' => 'Oui',
Expand Down
1 change: 1 addition & 0 deletions language/hu.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
'Reply-to' => 'Válaszcím',
'SMTP Server' => 'SMTP kiszolgáló',
'Signature' => 'Aláírás',
'Remark' => 'Megjegyzés',
'Edit' => 'Szerkeszt',
'No' => 'Nem',
'Yes' => 'Igen',
Expand Down
1 change: 1 addition & 0 deletions language/id.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@
'Reply-to' => 'Balas-ke',
'SMTP Server' => 'Server SMTP',
'Signature' => 'Tanda tangan (sig)',
'Remark' => 'Komentar',
'Edit' => 'Sunting',
'No' => 'Tidak',
'Yes' => 'Ya',
Expand Down
1 change: 1 addition & 0 deletions language/it.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
'Reply-to' => 'Rispondi a',
'SMTP Server' => 'Server SMTP',
'Signature' => 'Firma',
'Remark' => 'Osservazione',
'Edit' => 'Modifica',
'No' => 'No',
'Yes' => '',
Expand Down
1 change: 1 addition & 0 deletions language/ja.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
'Reply-to' => '返信先',
'SMTP Server' => 'SMTPサーバー',
'Signature' => '署名',
'Remark' => '述べる',
'Edit' => '編集する',
'No' => 'いいえ',
'Yes' => 'はい',
Expand Down
1 change: 1 addition & 0 deletions language/nl.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
'Reply-to' => 'Beantwoord-aan',
'SMTP Server' => 'SMTP Server',
'Signature' => 'Handtekening',
'Remark' => 'Opmerking',
'Edit' => 'Aanpassen',
'No' => 'Nee',
'Yes' => 'Ja',
Expand Down
4 changes: 3 additions & 1 deletion modules/profiles/hm-profiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public static function createDefault($hmod) {
'replyto' => $reply_to,
'smtp_id' => $smtp_server['id'],
'sig' => '',
'rmk' => '',
'type' => 'imap',
'autocreate' => true,
'user' => $imap_server['user'],
Expand All @@ -89,7 +90,7 @@ public static function loadLegacy($hmod) {
foreach (Hm_IMAP_List::dump() as $id => $server) {
$profile = $hmod->user_config->get('profile_imap_'.$server['server'].'_'.$server['user'], array(
'profile_default' => false, 'profile_name' => '', 'profile_address' => '',
'profile_replyto' => '', 'profile_smtp' => '', 'profile_sig' => ''));
'profile_replyto' => '', 'profile_smtp' => '', 'profile_sig' => '', 'profile_rmk' => ''));
if (! $profile['profile_name']) {
continue;
}
Expand All @@ -100,6 +101,7 @@ public static function loadLegacy($hmod) {
'replyto' => $profile['profile_replyto'],
'smtp_id' => $profile['profile_smtp'],
'sig' => $profile['profile_sig'],
'rmk' => $profile['profile_rmk'],
'type' => 'imap',
'user' => $server['user'],
'server' => $server['server'],
Expand Down
16 changes: 14 additions & 2 deletions modules/profiles/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,13 @@ public function process() {
return;
}
list($success, $form) = $this->process_form(array('profile_id', 'profile_address',
'profile_smtp', 'profile_replyto', 'profile_name', 'profile_imap'));
'profile_smtp', 'profile_replyto', 'profile_name', 'profile_imap', 'profile_rmk'));
if (!$success) {
return;
}
$default = false;
$sig = '';
$rmk = '';
$user = false;
$server = false;

Expand All @@ -108,13 +109,17 @@ public function process() {
if (array_key_exists('profile_sig', $this->request->post)) {
$sig = $this->request->post['profile_sig'];
}
if (array_key_exists('profile_rmk', $this->request->post)) {
$rmk = $this->request->post['profile_rmk'];
}
if (array_key_exists('profile_default', $this->request->post)) {
$default = true;
}

$profile = array(
'name' => html_entity_decode($form['profile_name'], ENT_QUOTES),
'sig' => $sig,
'rmk' => $rmk,
'smtp_id' => $form['profile_smtp'],
'replyto' => $form['profile_replyto'],
'default' => $default,
Expand Down Expand Up @@ -162,7 +167,7 @@ protected function output() {
}
if ($new_id !== -1) {
$res .= profile_form(array('default' => '', 'name' => '', 'address' => '', 'replyto' => '',
'smtp_id' => '', 'sig' => '', 'user' => '', 'server' => ''), $new_id, $smtp_servers,
'smtp_id' => '', 'sig' => '', 'user' => '', 'server' => '', 'rmk' => ''), $new_id, $smtp_servers,
$imap_servers, $this);
}
$res .= '</div>';
Expand Down Expand Up @@ -251,6 +256,7 @@ protected function output() {
'<th class="d-none d-sm-table-cell">'.$this->trans('Reply-to').'</th>'.
'<th class="d-none d-sm-table-cell">'.$this->trans('SMTP Server').'</th>'.
'<th class="d-none d-sm-table-cell">'.$this->trans('Signature').'</th>'.
'<th class="d-none d-sm-table-cell">'.$this->trans('Remark').'</th>'.
'<th class="d-none d-sm-table-cell">'.$this->trans('Default').'</th>'.
'<th></th></tr>';

Expand All @@ -267,6 +273,7 @@ protected function output() {
'<td class="d-none d-sm-table-cell">'.$this->html_safe($profile['replyto']).'</td>'.
'<td class="d-none d-sm-table-cell">'.$this->html_safe($smtp).'</td>'.
'<td class="d-none d-sm-table-cell">'.(strlen($profile['sig']) > 0 ? $this->trans('Yes') : $this->trans('No')).'</td>'.
'<td class="d-none d-sm-table-cell">'.(strlen($profile['rmk']) > 0 ? $this->trans('Yes') : $this->trans('No')).'</td>'.
'<td class="d-none d-sm-table-cell">'.($profile['default'] ? $this->trans('Yes') : $this->trans('No')).'</td>'.
'<td class="text-right"><a href="?page=profiles&amp;profile_id='.$this->html_safe($profile['id']).'" title="'.$this->trans('Edit').'">'.
'<i class="bi bi-gear-fill"></i></a></td>'.
Expand Down Expand Up @@ -347,6 +354,11 @@ function profile_form($form_vals, $id, $smtp_servers, $imap_servers, $out_mod) {
$res .= '<textarea cols="80" rows="4" name="profile_sig" class="form-control" style="min-height : 120px" placeholder="'.$out_mod->trans('Signature').'">'.$out_mod->html_safe($form_vals['sig']).'</textarea>';
$res .= '<label>'.$out_mod->trans('Signature').'</label></div>';

// Remark
$res .= '<div class="form-floating mb-3">';
$res .= '<textarea cols="80" rows="4" name="profile_rmk" class="form-control" style="min-height : 120px" placeholder="'.$out_mod->trans('Remark').'">'.$out_mod->html_safe($form_vals['rmk']).'</textarea>';
$res .= '<label>'.$out_mod->trans('Remark').'</label></div>';

// Set as default
$res .= '<div class="form-check mb-3">';
$res .= '<input type="checkbox" class="form-check-input" '.($form_vals['default'] ? 'checked="checked"' : '').' name="profile_default">';
Expand Down
1 change: 1 addition & 0 deletions modules/profiles/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
'profile_default' => FILTER_VALIDATE_INT,
'profile_address' => FILTER_DEFAULT,
'profile_sig' => FILTER_UNSAFE_RAW,
'profile_rmk' => FILTER_UNSAFE_RAW,
'profile_delete' => FILTER_DEFAULT
),
'allowed_get' => array(
Expand Down

0 comments on commit d64699b

Please sign in to comment.