From 88577119d7d44d1fb5f3c94f12435683c5507f03 Mon Sep 17 00:00:00 2001 From: Mildred Ki'Lya Date: Wed, 4 Mar 2020 13:05:26 +0100 Subject: [PATCH] Add new archival types to keep the folder structure Add archival type folderyear and foldermonth to keep the original folder structure after a YYYY or a YYYY/MM prefix. --- plugins/archive/archive.php | 13 +++++++++++++ plugins/archive/localization/en_CA.inc | 2 ++ plugins/archive/localization/en_GB.inc | 2 ++ plugins/archive/localization/en_US.inc | 2 ++ plugins/archive/localization/fr_FR.inc | 2 ++ 5 files changed, 21 insertions(+) diff --git a/plugins/archive/archive.php b/plugins/archive/archive.php index ecd88f713..661ab5427 100644 --- a/plugins/archive/archive.php +++ b/plugins/archive/archive.php @@ -199,6 +199,17 @@ class archive extends rcube_plugin case 'sender': $subfolder = $this->sender_subfolder($message->get('from')); break; + + case 'folderyear': + $subfolder = $rcmail->format_date($message->timestamp, 'Y') + . $delimiter . $mbox; + break; + + case 'foldermonth': + $subfolder = $rcmail->format_date($message->timestamp, 'Y') + . $delimiter . $rcmail->format_date($message->timestamp, 'm') + . $delimiter . $mbox; + break; } // compose full folder path @@ -414,6 +425,8 @@ class archive extends rcube_plugin $archive_type->add($this->gettext('archivetypetbmonth'), 'tbmonth'); $archive_type->add($this->gettext('archivetypesender'), 'sender'); $archive_type->add($this->gettext('archivetypefolder'), 'folder'); + $archive_type->add($this->gettext('archivetypefolderyear'), 'folderyear'); + $archive_type->add($this->gettext('archivetypefoldermonth'), 'foldermonth'); $args['blocks']['archive'] = array( 'name' => rcube::Q($this->gettext('settingstitle')), diff --git a/plugins/archive/localization/en_CA.inc b/plugins/archive/localization/en_CA.inc index 3a8461f62..5a083d797 100644 --- a/plugins/archive/localization/en_CA.inc +++ b/plugins/archive/localization/en_CA.inc @@ -24,6 +24,8 @@ $labels['settingstitle'] = 'Archive'; $labels['archivetype'] = 'Divide archive by'; $labels['archivetypeyear'] = 'Year (e.g. Archive/2012)'; $labels['archivetypemonth'] = 'Month (e.g. Archive/2012/06)'; +$labels['archivetypefolderyear'] = 'Year then original folder (e.g. Archives/...)'; +$labels['archivetypefoldermonth'] = 'Month then original folder (e.g. Archives/2012/...)'; $labels['archivetypefolder'] = 'Original folder'; $labels['archivetypesender'] = 'Sender email'; $labels['unkownsender'] = 'unknown'; diff --git a/plugins/archive/localization/en_GB.inc b/plugins/archive/localization/en_GB.inc index 0a629bf44..32d6de70a 100644 --- a/plugins/archive/localization/en_GB.inc +++ b/plugins/archive/localization/en_GB.inc @@ -26,6 +26,8 @@ $labels['archivetypeyear'] = 'Year (e.g. Archive/2012)'; $labels['archivetypemonth'] = 'Month (e.g. Archive/2012/06)'; $labels['archivetypetbmonth'] = 'Month - Thunderbird compatible (e.g. Archive/2012/2012-06)'; $labels['archivetypefolder'] = 'Original folder'; +$labels['archivetypefolderyear'] = 'Year then original folder (e.g. Archives/...)'; +$labels['archivetypefoldermonth'] = 'Month then original folder (e.g. Archives/2012/...)'; $labels['archivetypesender'] = 'Sender email'; $labels['unkownsender'] = 'unknown'; $labels['readonarchive'] = 'Mark the message as read on archive'; diff --git a/plugins/archive/localization/en_US.inc b/plugins/archive/localization/en_US.inc index 1ef8692f9..0334f814d 100644 --- a/plugins/archive/localization/en_US.inc +++ b/plugins/archive/localization/en_US.inc @@ -27,6 +27,8 @@ $labels['archivetypeyear'] = 'Year (e.g. Archive/2012)'; $labels['archivetypemonth'] = 'Month (e.g. Archive/2012/06)'; $labels['archivetypetbmonth'] = 'Month - Thunderbird compatible (e.g. Archive/2012/2012-06)'; $labels['archivetypefolder'] = 'Original folder'; +$labels['archivetypefolderyear'] = 'Year then original folder (e.g. Archives/...)'; +$labels['archivetypefoldermonth'] = 'Month then original folder (e.g. Archives/2012/...)'; $labels['archivetypesender'] = 'Sender email'; $labels['unkownsender'] = 'unknown'; $labels['readonarchive'] = 'Mark the message as read on archive'; diff --git a/plugins/archive/localization/fr_FR.inc b/plugins/archive/localization/fr_FR.inc index d0bcb720c..c10af78a6 100644 --- a/plugins/archive/localization/fr_FR.inc +++ b/plugins/archive/localization/fr_FR.inc @@ -26,6 +26,8 @@ $labels['archivetypeyear'] = 'Année (p. ex. Archives/2012)'; $labels['archivetypemonth'] = 'Mois (p. ex. Archives/2012/06)'; $labels['archivetypetbmonth'] = 'Mois – compatible avec Thunderbird (p.ex. Archive/2012/2012-06)'; $labels['archivetypefolder'] = 'Dossier original'; +$labels['archivetypefolderyear'] = 'Année puis dossier original (p. ex. Archives/...)'; +$labels['archivetypefoldermonth'] = 'Mois puis dossier original (p. ex. Archives/2012/...)'; $labels['archivetypesender'] = 'Courriel de l’expéditeur'; $labels['unkownsender'] = 'inconnu'; $labels['readonarchive'] = 'Marquer le courriel comme lu lors de l’archivage';