[eGroupWare-svn] r55936 - in /trunk: admin/inc/ admin/templates/default/ egroupware/api/setup/ egroupware/api/src/ mail/inc/ mail/js/ mail/lang/

[email protected] Fri, 29 Apr 2016 11:23:05 -0000
Newsgroups gmane.comp.web.egroupware.cvs
Message-ID <[email protected]>
Author: leithoff
Date: Fri Apr 29 13:23:05 2016
New Revision: 55936

URL: http://svn.stylite.de/viewvc/egroupware?rev=55936&view=rev
Log:
* Mail: allow to define an existing folder as archive folder and allow to move messages to the specified folder with either right-click action or EGW-shortcut

Modified:
    trunk/admin/inc/class.admin_mail.inc.php
    trunk/admin/templates/default/mailaccount.xet
    trunk/egroupware/api/setup/setup.inc.php
    trunk/egroupware/api/setup/tables_current.inc.php
    trunk/egroupware/api/setup/tables_update.inc.php
    trunk/egroupware/api/src/Mail.php
    trunk/mail/inc/class.mail_tree.inc.php
    trunk/mail/inc/class.mail_ui.inc.php
    trunk/mail/js/app.js
    trunk/mail/lang/egw_de.lang
    trunk/mail/lang/egw_en.lang

Modified: trunk/admin/inc/class.admin_mail.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/admin/inc/class.admin_mail.inc.php?rev=55936&r1=55935&r2=55936&view=diff
==============================================================================
--- trunk/admin/inc/class.admin_mail.inc.php (original)
+++ trunk/admin/inc/class.admin_mail.inc.php Fri Apr 29 13:23:05 2016
@@ -374,7 +374,7 @@
 			//_debug_array($content);
 			$sel_options['acc_folder_sent'] = $sel_options['acc_folder_trash'] =
 				$sel_options['acc_folder_draft'] = $sel_options['acc_folder_template'] =
-					$sel_options['acc_folder_junk'] = self::mailboxes($imap, $content);
+					$sel_options['acc_folder_junk'] = $sel_options['acc_folder_archive'] = self::mailboxes($imap, $content);
 		}
 		catch(Exception $e) {
 			$content['msg'] = $e->getMessage();
@@ -419,6 +419,7 @@
 			'acc_folder_draft' => array('\\drafts', 'drafts'),
 			'acc_folder_template' => array('', 'templates'),
 			'acc_folder_junk'  => array('\\junk', 'junk', 'spam'),
+			'acc_folder_archive' => array('', 'archive'),
 		) as $name => $common_names)
 		{
 			// first check special-use attributes

Modified: trunk/admin/templates/default/mailaccount.xet
URL: http://svn.stylite.de/viewvc/egroupware/trunk/admin/templates/default/mailaccount.xet?rev=55936&r1=55935&r2=55936&view=diff
==============================================================================
--- trunk/admin/templates/default/mailaccount.xet (original)
+++ trunk/admin/templates/default/mailaccount.xet Fri Apr 29 13:23:05 2016
@@ -118,7 +118,7 @@
 			</rows>
 		</grid>
 	</template>
-	<template id="admin.mailaccount.folder" template="" lang="" group="0" version="1.9.001">
+	<template id="admin.mailaccount.folder" template="" lang="" group="0" version="1.9.002">
 		<grid width="100%">
 			<columns>
 				<column width="115"/>
@@ -146,7 +146,11 @@
 					<taglist id="acc_folder_junk" empty_label="Select one ..." maxSelection="1" autocomplete_url=""/>
 				</row>
 				<row>
-					<description for="acc_folder_junk" value="Notify about new mail in this folders"/>
+					<description for="acc_folder_archive" value="Archive folder"/>
+					<taglist id="acc_folder_archive" empty_label="Select one ..." maxSelection="1" autocomplete_url=""/>
+				</row>
+				<row>
+					<description for="notify_folders" value="Notify about new mail in this folders"/>
 					<vbox>
 						<taglist id="notify_folders" empty_label="Select one ..." autocomplete_url="" onchange="app.admin.change_folders"/>
 						<checkbox id="notify_save_default" label="save as default"/>

Modified: trunk/egroupware/api/setup/setup.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/setup/setup.inc.php?rev=55936&r1=55935&r2=55936&view=diff
==============================================================================
--- trunk/egroupware/api/setup/setup.inc.php (original)
+++ trunk/egroupware/api/setup/setup.inc.php Fri Apr 29 13:23:05 2016
@@ -12,7 +12,7 @@
 /* Basic information about this app */
 $setup_info['api']['name']      = 'api';
 $setup_info['api']['title']     = 'EGroupware API';
-$setup_info['api']['version']   = '16.1';
+$setup_info['api']['version']   = '16.1.001';
 $setup_info['api']['versions']['current_header'] = '1.29';
 $setup_info['api']['enable']    = 3;
 $setup_info['api']['app_order'] = 1;

Modified: trunk/egroupware/api/setup/tables_current.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/setup/tables_current.inc.php?rev=55936&r1=55935&r2=55936&view=diff
==============================================================================
--- trunk/egroupware/api/setup/tables_current.inc.php (original)
+++ trunk/egroupware/api/setup/tables_current.inc.php Fri Apr 29 13:23:05 2016
@@ -432,6 +432,7 @@
 			'acc_folder_trash' => array('type' => 'varchar','precision' => '128','comment' => 'trash folder'),
 			'acc_folder_draft' => array('type' => 'varchar','precision' => '128','comment' => 'draft folder'),
 			'acc_folder_template' => array('type' => 'varchar','precision' => '128','comment' => 'template folder'),
+			'acc_folder_archive' => array('type' => 'varchar','precision' => '128','comment' => 'archive folder'),
 			'acc_smtp_host' => array('type' => 'varchar','precision' => '128','comment' => 'smtp hostname'),
 			'acc_smtp_ssl' => array('type' => 'int','precision' => '1','nullable' => False,'default' => '0','comment' => '0=none, 1=starttls, 2=tls, 3=ssl, &8=validate certificate'),
 			'acc_smtp_port' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '25','comment' => 'smtp port'),

Modified: trunk/egroupware/api/setup/tables_update.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/setup/tables_update.inc.php?rev=55936&r1=55935&r2=55936&view=diff
==============================================================================
--- trunk/egroupware/api/setup/tables_update.inc.php (original)
+++ trunk/egroupware/api/setup/tables_update.inc.php Fri Apr 29 13:23:05 2016
@@ -49,4 +49,15 @@
 	}
 
 	return $GLOBALS['setup_info']['api']['currentver'] = '16.1';
-}
+}
+
+function api_upgrade16_1()
+{
+        $GLOBALS['egw_setup']->oProc->AddColumn('egw_ea_accounts','acc_folder_archive', array(
+		'type' => 'varchar',
+		'precision' => '128',
+		'comment' => 'archive folder'
+	));
+
+	return $GLOBALS['setup_info']['api']['currentver'] = '16.1.001';
+}

Modified: trunk/egroupware/api/src/Mail.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Mail.php?rev=55936&r1=55935&r2=55936&view=diff
==============================================================================
--- trunk/egroupware/api/src/Mail.php (original)
+++ trunk/egroupware/api/src/Mail.php Fri Apr 29 13:23:05 2016
@@ -1058,6 +1058,7 @@
 		//if (!empty($this->icServer->acc_folder_template) && !isset($_specialUseFolders[$this->icServer->ImapServerId][$this->icServer->acc_folder_template]))
 			$_specialUseFolders[$this->icServer->ImapServerId][$this->icServer->acc_folder_template]='Templates';
 		$_specialUseFolders[$this->icServer->ImapServerId][$this->icServer->acc_folder_junk]='Junk';
+		$_specialUseFolders[$this->icServer->ImapServerId][$this->icServer->acc_folder_archive]='Archive';
 		//error_log(__METHOD__.' ('.__LINE__.') '.array2string($_specialUseFolders));//.'<->'.array2string($this->icServer));
 		self::$specialUseFolders = $_specialUseFolders[$this->icServer->ImapServerId];
 		Cache::setCache(Cache::INSTANCE,'email','specialUseFolders'.trim($GLOBALS['egw_info']['user']['account_id']),$_specialUseFolders, 60*60*24*5);
@@ -3303,6 +3304,7 @@
 			'Sent'     => array('profileKey'=>'acc_folder_sent','autoFolderName'=>'Sent'),
 			'Junk'     => array('profileKey'=>'acc_folder_junk','autoFolderName'=>'Junk'),
 			'Outbox'   => array('profileKey'=>'acc_folder_outbox','autoFolderName'=>'Outbox'),
+			'Archive'   => array('profileKey'=>'acc_folder_archive','autoFolderName'=>'Archive'),
 		);
 		if ($_type == 'Templates') $_type = 'Template';	// for some reason self::$autofolders uses 'Templates'!
 		$created = false;
@@ -3324,8 +3326,17 @@
 			if ($_type != 'Outbox') error_log(__METHOD__.' ('.__LINE__.') '.' Failed to retrieve Folder'.$_folderName." for ".array2string($types[$_type]).":".$e->getMessage());
 			$_folderName = false;
 		}
+		// do not try to autocreate configured Archive-Folder. Return false if configured folder does not exist
+		if ($_type == 'Archive') {
+			if ($_folderName && $_checkexistance && strtolower($_folderName) !='none' && !$this->folderExists($_folderName,true)) {
+				return false;
+			} else {
+				return $_folderName;
+			}
+
+		}
 		// does the folder exist??? (is configured/preset, but non-existent)
-		if ($_folderName && $_checkexistance && $_folderName !='none' && !$this->folderExists($_folderName,true)) {
+		if ($_folderName && $_checkexistance && strtolower($_folderName) !='none' && !$this->folderExists($_folderName,true)) {
 			try
 			{
 				$error = null;
@@ -3391,20 +3402,20 @@
 	}
 
 	/**
+	 * getJunkFolder wrapper for _getSpecialUseFolder Type Junk
+	 * @param boolean $_checkexistance trigger check for existance
+	 * @return mixed string or false
+	 */
+	function getJunkFolder($_checkexistance=TRUE)
+	{
+		return $this->_getSpecialUseFolder('Junk', $_checkexistance);
+	}
+
+	/**
 	 * getDraftFolder wrapper for _getSpecialUseFolder Type Drafts
 	 * @param boolean $_checkexistance trigger check for existance
 	 * @return mixed string or false
 	 */
-	function getJunkFolder($_checkexistance=TRUE)
-	{
-		return $this->_getSpecialUseFolder('Junk', $_checkexistance);
-	}
-
-	/**
-	 * getDraftFolder wrapper for _getSpecialUseFolder Type Drafts
-	 * @param boolean $_checkexistance trigger check for existance
-	 * @return mixed string or false
-	 */
 	function getDraftFolder($_checkexistance=TRUE)
 	{
 		return $this->_getSpecialUseFolder('Drafts', $_checkexistance);
@@ -3448,6 +3459,16 @@
 	function getOutboxFolder($_checkexistance=TRUE)
 	{
 		return $this->_getSpecialUseFolder('Outbox', $_checkexistance);
+	}
+
+	/**
+	 * getArchiveFolder wrapper for _getSpecialUseFolder Type Archive
+	 * @param boolean $_checkexistance trigger check for existance . We do no autocreation for configured Archive folder
+	 * @return mixed string or false
+	 */
+	function getArchiveFolder($_checkexistance=TRUE)
+	{
+		return $this->_getSpecialUseFolder('Archive', $_checkexistance);
 	}
 
 	/**

Modified: trunk/mail/inc/class.mail_tree.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/mail/inc/class.mail_tree.inc.php?rev=55936&r1=55935&r2=55936&view=diff
==============================================================================
--- trunk/mail/inc/class.mail_tree.inc.php (original)
+++ trunk/mail/inc/class.mail_tree.inc.php Fri Apr 29 13:23:05 2016
@@ -472,7 +472,8 @@
 							// mark on account if Sieve is enabled
 							'data' => array(
 										'sieve' => $accObj->imapServer()->acc_sieve_enabled,
-										'spamfolder'=> $accObj->imapServer()->acc_folder_junk?true:false
+										'spamfolder'=> $accObj->imapServer()->acc_folder_junk&&(strtolower($accObj->imapServer()->acc_folder_junk)!='none')?true:false,
+										'archivefolder'=> $accObj->imapServer()->acc_folder_archive&&(strtolower($accObj->imapServer()->acc_folder_archive)!='none')?true:false
 									),
 							Tree::NOCHECKBOX  => $_noCheckbox
 			);

Modified: trunk/mail/inc/class.mail_ui.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/mail/inc/class.mail_ui.inc.php?rev=55936&r1=55935&r2=55936&view=diff
==============================================================================
--- trunk/mail/inc/class.mail_ui.inc.php (original)
+++ trunk/mail/inc/class.mail_ui.inc.php Fri Apr 29 13:23:05 2016
@@ -853,6 +853,8 @@
 		// todo: real hierarchical folder list
 		$lastFolderUsedForMove = null;
 		$moveactions = array();
+		$archiveFolder = $this->mail_bo->getArchiveFolder();
+		$currentArchiveActionKey = 'move_'.$this->mail_bo->profileID.self::$delimiter.$archiveFolder;
 		$lastFoldersUsedForMoveCont = egw_cache::getCache(egw_cache::INSTANCE,'email','lastFolderUsedForMove'.trim($GLOBALS['egw_info']['user']['account_id']),null,array(),$expiration=60*60*1);
 		//error_log(__METHOD__.__LINE__." StoredFolders->".array2string($lastFoldersUsedForMoveCont));
 		//error_log(__METHOD__.__LINE__.' ProfileId:'.$this->mail_bo->profileID." StoredFolders->(".count($lastFoldersUsedForMoveCont[$this->mail_bo->profileID]).") ".array2string($lastFoldersUsedForMoveCont[$this->mail_bo->profileID]));
@@ -884,7 +886,8 @@
 					if ($_folder!=$i)
 					{
 						$moveaction .= $lastFolderUsedForMoveCont;
-
+						//error_log(__METHOD__.__LINE__.'#'.$moveaction);
+						//error_log(__METHOD__.__LINE__.'#'.$currentArchiveActionKey);
 						if ($this->mail_bo->folderExists($i)) // only 10 entries per mailaccount.Control this on setting the buffered folders
 						{
 							$fS['profileID'] = $this->mail_bo->profileID;
@@ -1008,13 +1011,31 @@
 				array(
 					'caption' => lang('Move selected to'),
 					'icon' => 'move',
-					'group' => $group++,
+					'group' => $group,
 					'children' => $children,
 					)
 				)
 			);
 
-		}
+		} else {
+			$group++;
+		}
+		
+		//error_log(__METHOD__.__LINE__.$archiveFolder);
+		$actions = array_merge($actions,
+			array(
+				'move2'.$this->mail_bo->profileID.self::$delimiter.$archiveFolder => array( //toarchive
+					'caption' => 'Move to archive',
+					'hint' => 'move selected mails to archive',
+					'icon' => 'move',
+					'group' => $group++,
+					'enabled' => 'javaScript:app.mail.archivefolder_enabled',
+					//'hideOnDisabled' => true, // does not work as expected on message-list
+					'onExecute' => 'javaScript:app.mail.mail_move2folder',
+					'shortcut' => egw_keymanager::shortcut(egw_keymanager::A, true, true),
+					'allowOnMultiple' => true,
+					'toolbarDefault' => false
+				)));
 
 		$actions = array_merge($actions,
 			array(
@@ -4736,8 +4757,11 @@
 		list($targetProfileID,$targetFolder) = explode(self::$delimiter,$_folderName,2);
 		$lastFoldersUsedForMoveCont = egw_cache::getCache(egw_cache::INSTANCE,'email','lastFolderUsedForMove'.trim($GLOBALS['egw_info']['user']['account_id']),null,array(),$expiration=60*60*1);
 		$changeFolderActions = false;
+		//error_log(__METHOD__.__LINE__."#"."$targetProfileID,$targetFolder");
+		//error_log(__METHOD__.__LINE__.array2string($lastFoldersUsedForMoveCont));
 		if (!isset($lastFoldersUsedForMoveCont[$targetProfileID][$targetFolder]))
 		{
+			//error_log(__METHOD__.__LINE__.array2string($lastFoldersUsedForMoveCont[$targetProfileID][$targetFolder]));
 			if ($lastFoldersUsedForMoveCont[$targetProfileID] && count($lastFoldersUsedForMoveCont[$targetProfileID])>3)
 			{
 				$keys = array_keys($lastFoldersUsedForMoveCont[$targetProfileID]);
@@ -4748,6 +4772,7 @@
 				}
 				//error_log(__METHOD__.__LINE__.array2string($lastFoldersUsedForMoveCont[$targetProfileID]));
 			}
+			//error_log(__METHOD__.__LINE__."#"."$targetProfileID,$targetFolder = $_folderName");
 			$lastFoldersUsedForMoveCont[$targetProfileID][$targetFolder]=$_folderName;
 			$changeFolderActions = true;
 		}
@@ -4896,6 +4921,7 @@
 			}
 			if ($changeFolderActions == true)
 			{
+				//error_log(__METHOD__.__LINE__.array2string($lastFoldersUsedForMoveCont));
 				egw_cache::setCache(egw_cache::INSTANCE,'email','lastFolderUsedForMove'.trim($GLOBALS['egw_info']['user']['account_id']),$lastFoldersUsedForMoveCont, $expiration=60*60*1);
 				$actionsnew = self::get_actions();
 				$actionsnew = etemplate_widget_nextmatch::egw_actions($actionsnew);

Modified: trunk/mail/js/app.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/mail/js/app.js?rev=55936&r1=55935&r2=55936&view=diff
==============================================================================
--- trunk/mail/js/app.js (original)
+++ trunk/mail/js/app.js Fri Apr 29 13:23:05 2016
@@ -1387,9 +1387,27 @@
 
 
 	/**
+	 * Check if archiveFolder is enabled on that account
+	 *
+	 * ArchiveFolder enabled is stored as data { archivefolder: true/false } on account node.
+	 *
+	 * @param {object} _action
+	 * @param {object} _senders the representation of the tree leaf to be manipulated
+	 * @param {object} _currentNode
+	 */
+	archivefolder_enabled: function(_action,_senders,_currentNode)
+	{
+		var ftree = this.et2.getWidgetById(this.nm_index+'[foldertree]');
+		var acc_id = _senders[0].id.split('::')[2]; // this is operating on mails
+		var node = ftree ? ftree.getNode(acc_id) : null;
+
+		return node && node.data && node.data.archivefolder;
+	},
+
+	/**
 	 * Check if Sieve is enabled on that account
 	 *
-	 * Sieve enabled is stored as data { acl: true/false } on account node.
+	 * Sieve enabled is stored as data { sieve: true/false } on account node.
 	 *
 	 * @param {object} _action
 	 * @param {object} _senders the representation of the tree leaf to be manipulated

Modified: trunk/mail/lang/egw_de.lang
URL: http://svn.stylite.de/viewvc/egroupware/trunk/mail/lang/egw_de.lang?rev=55936&r1=55935&r2=55936&view=diff
==============================================================================
--- trunk/mail/lang/egw_de.lang (original)
+++ trunk/mail/lang/egw_de.lang Fri Apr 29 13:23:05 2016
@@ -42,6 +42,7 @@
 append	mail	de	hinzufügen
 appended after reply before sending	mail	de	Einfügen nach dem zitierten Text im Zuge des Versendens
 application mail expected but got: %1	mail	de	Anwendung Mail erwarted, aber %1 erhalten!
+archive folder	mail	de	Archivordner
 are you sure you want to delete all selected folders?	mail	de	Sollen alle selektierten Ordner gelöcht werden?
 are you sure you want to move folder %1 to folder %2?	mail	de	Soll der Ordner %1 in den Ordner %2 verschoben werden?
 arrival	mail	de	Empfangsdatum
@@ -290,7 +291,9 @@
 message send successfully.	mail	de	Nachricht wurde erfolgreich versendet.
 miscellaneous	mail	de	Verschiedenes
 move folder	mail	de	Ordner verschieben
+move selected mails to archive	mail	de	Verschiebe ausgewählte Nachrichten in den konfigurierten Archiv Ordner
 move selected to	mail	de	Verschiebe ausgewählte nach
+move to archive	mail	de	Verschiebe in den Archivordner
 move to	mail	de	verschieben
 move to trash	mail	de	in den Papierkorb verschieben
 moved %1 message(s) from %2 to %3	mail	de	%1 Nachrichten wurden von %2 nach %3 verschoben

Modified: trunk/mail/lang/egw_en.lang
URL: http://svn.stylite.de/viewvc/egroupware/trunk/mail/lang/egw_en.lang?rev=55936&r1=55935&r2=55936&view=diff
==============================================================================
--- trunk/mail/lang/egw_en.lang (original)
+++ trunk/mail/lang/egw_en.lang Fri Apr 29 13:23:05 2016
@@ -42,6 +42,7 @@
 append	mail	en	append
 appended after reply before sending	mail	en	Appended after reply before sending
 application mail expected but got: %1	mail	en	Application mail expected but got: %1
+archive folder	mail	en	Archive folder
 are you sure you want to delete all selected folders?	mail	en	Are you sure you want to delete all selected folders?
 are you sure you want to move folder %1 to folder %2?	mail	en	Are you sure you want to move folder %1 to folder %2?
 arrival	mail	en	Recieved
@@ -290,7 +291,9 @@
 message send successfully.	mail	en	Message send successfully.
 miscellaneous	mail	en	Miscellaneous
 move folder	mail	en	Move Folder
+move selected mails to archive	mail	en	Move selected mails to archive
 move selected to	mail	en	Move selected to
+move to archive	mail	en	Move to archive folder
 move to	mail	en	Move to
 move to trash	mail	en	move to trash
 moved %1 message(s) from %2 to %3	mail	en	moved %1 message(s) from %2 to %3
@@ -320,7 +323,7 @@
 non	mail	en	Non
 none, create all	mail	en	none, create all
 nothing to change.	mail	en	Nothing to change.
-notify about new mail in this folders	mail	en	Notify about new mail in this folders
+notify about new mail in this folders	mail	en	Notify about new mail in these folders
 notify when new mails arrive in these folders	mail	en	notify when new mails arrive in these folders
 on	mail	en	on
 one address is not valid	mail	en	One address is not valid


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
eGroupWare-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs