From 1f438436e13e5f055215ee3faa43fde09d98f5c4 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Tue, 10 Dec 2013 15:59:54 +0000 Subject: [PATCH] stuff of the day: label/remove all sorted to meet birgits requirements; distinct display schema for listview to send/draft/template folders (address column); some translations for upcomming folder delition for folders with subfolders --- mail/inc/class.mail_bo.inc.php | 5 ++ mail/inc/class.mail_ui.inc.php | 91 +++++++++++++++++++------------- mail/js/app.js | 2 +- mail/lang/egw_en.lang | 6 +++ mail/templates/default/index.xet | 3 ++ 5 files changed, 69 insertions(+), 38 deletions(-) diff --git a/mail/inc/class.mail_bo.inc.php b/mail/inc/class.mail_bo.inc.php index 3d751f0202..08792ada96 100644 --- a/mail/inc/class.mail_bo.inc.php +++ b/mail/inc/class.mail_bo.inc.php @@ -590,6 +590,7 @@ class mail_bo $mailbox=null; if($this->folderExists($this->sessionData['mailbox'])) $mailbox = $this->sessionData['mailbox']; if (empty($mailbox)) $mailbox = $this->icServer->getCurrentMailbox(); +/* if (isset(emailadmin_imap::$supports_keywords[$_icServerID])) { $this->icServer->openMailbox($mailbox); @@ -598,6 +599,10 @@ class mail_bo { $this->icServer->examineMailbox($mailbox); } +*/ + // the above should detect if there is a known information about supporting KEYWORDS + // but does not work as expected :-( + $this->icServer->examineMailbox($mailbox); //error_log(__METHOD__." using existing Connection ProfileID:".$_icServerID.' Status:'.print_r($this->icServer->_connected,true)); //error_log(__METHOD__.__LINE__."->open connection for Server with profileID:".$_icServerID.function_backtrace()); diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 449838643b..e1be9ffb23 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -187,11 +187,11 @@ class mail_ui $starttime = microtime (true); $this->mail_bo->restoreSessionData(); $sessionFolder = $this->mail_bo->sessionData['mailbox']; - $toSchema = false;//decides to select list schema with column to selected (if false fromaddress is default) + //$toSchema = false;//decides to select list schema with column to selected (if false fromaddress is default) if ($this->mail_bo->folderExists($sessionFolder)) { $this->mail_bo->reopen($sessionFolder); // needed to fetch full set of capabilities - $toSchema = $this->mail_bo->isDraftFolder($sessionFolder)||$this->mail_bo->isSentFolder($sessionFolder)||$this->mail_bo->isTemplateFolder($sessionFolder); + //$toSchema = $this->mail_bo->isDraftFolder($sessionFolder)||$this->mail_bo->isSentFolder($sessionFolder)||$this->mail_bo->isTemplateFolder($sessionFolder); } //error_log(__METHOD__.__LINE__.' SessionFolder:'.$sessionFolder.' isToSchema:'.$toSchema); //_debug_array($content); @@ -213,7 +213,8 @@ class mail_ui 'start' => 0, // IO position in list 'order' => 'date', // IO name of the column to sort after (optional for the sortheaders) 'sort' => 'DESC', // IO direction of the sort: 'ASC' or 'DESC' - 'default_cols' => 'status,attachments,subject,'.($toSchema?'toaddress':'fromaddress').',date,size', // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns + //'default_cols' => 'status,attachments,subject,'.($toSchema?'toaddress':'fromaddress').',date,size', // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns + 'default_cols' => 'status,attachments,subject,address,date,size', // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns 'csv_fields' => false, // I false=disable csv export, true or unset=enable it with auto-detected fieldnames, //or array with name=>label or name=>array('label'=>label,'type'=>type) pairs (type is a eT widget-type) 'actions' => self::get_actions(), @@ -223,7 +224,8 @@ class mail_ui //$content[self::$nm_index]['path'] = self::get_home_dir(); } } - $content[self::$nm_index]['default_cols'] = 'status,attachments,subject,'.($toSchema?'toaddress':'fromaddress').',date,size'; // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns + //$content[self::$nm_index]['default_cols'] = 'status,attachments,subject,'.($toSchema?'toaddress':'fromaddress').',date,size'; // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns + $content[self::$nm_index]['default_cols'] = 'status,attachments,subject,address,date,size'; // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns $content[self::$nm_index]['csv_fields'] = false; if ($msg) { @@ -948,36 +950,6 @@ class mail_ui 'icon' => 'tag_message', 'group' => ++$group, 'children' => array( - 'label1' => array( - 'caption' => "".lang('urgent')."", - 'icon' => 'mail_label1', - 'onExecute' => 'javaScript:app.mail.mail_flag', - 'shortcut' => egw_keymanager::shortcut(egw_keymanager::_1, true, true), - ), - 'label2' => array( - 'caption' => "".lang('job')."", - 'icon' => 'mail_label2', - 'onExecute' => 'javaScript:app.mail.mail_flag', - 'shortcut' => egw_keymanager::shortcut(egw_keymanager::_2, true, true), - ), - 'label3' => array( - 'caption' => "".lang('personal')."", - 'icon' => 'mail_label3', - 'onExecute' => 'javaScript:app.mail.mail_flag', - 'shortcut' => egw_keymanager::shortcut(egw_keymanager::_3, true, true), - ), - 'label4' => array( - 'caption' => "".lang('to do')."", - 'icon' => 'mail_label4', - 'onExecute' => 'javaScript:app.mail.mail_flag', - 'shortcut' => egw_keymanager::shortcut(egw_keymanager::_4, true, true), - ), - 'label5' => array( - 'caption' => "".lang('later')."", - 'icon' => 'mail_label5', - 'onExecute' => 'javaScript:app.mail.mail_flag', - 'shortcut' => egw_keymanager::shortcut(egw_keymanager::_5, true, true), - ), 'unlabel' => array( 'group' => ++$group, 'caption' => "".lang('remove all')."", @@ -985,6 +957,41 @@ class mail_ui 'onExecute' => 'javaScript:app.mail.mail_flag', 'shortcut' => egw_keymanager::shortcut(egw_keymanager::_0, true, true), ), + 'label1' => array( + 'group' => ++$group, + 'caption' => "".lang('urgent')."", + 'icon' => 'mail_label1', + 'onExecute' => 'javaScript:app.mail.mail_flag', + 'shortcut' => egw_keymanager::shortcut(egw_keymanager::_1, true, true), + ), + 'label2' => array( + 'group' => $group, + 'caption' => "".lang('job')."", + 'icon' => 'mail_label2', + 'onExecute' => 'javaScript:app.mail.mail_flag', + 'shortcut' => egw_keymanager::shortcut(egw_keymanager::_2, true, true), + ), + 'label3' => array( + 'group' => $group, + 'caption' => "".lang('personal')."", + 'icon' => 'mail_label3', + 'onExecute' => 'javaScript:app.mail.mail_flag', + 'shortcut' => egw_keymanager::shortcut(egw_keymanager::_3, true, true), + ), + 'label4' => array( + 'group' => $group, + 'caption' => "".lang('to do')."", + 'icon' => 'mail_label4', + 'onExecute' => 'javaScript:app.mail.mail_flag', + 'shortcut' => egw_keymanager::shortcut(egw_keymanager::_4, true, true), + ), + 'label5' => array( + 'group' => $group, + 'caption' => "".lang('later')."", + 'icon' => 'mail_label5', + 'onExecute' => 'javaScript:app.mail.mail_flag', + 'shortcut' => egw_keymanager::shortcut(egw_keymanager::_5, true, true), + ), ), ), // modified icons from http://creativecommons.org/licenses/by-sa/3.0/ @@ -1146,11 +1153,17 @@ unset($query['actions']); //save selected Folder to sessionData (mailbox)->currentFolder if (isset($query['selectedFolder'])) $this->mail_bo->sessionData['mailbox']=$_folderName; $this->mail_bo->saveSessionData(); + $toSchema = false;//decides to select list schema with column to selected (if false fromaddress is default) + if ($this->mail_bo->folderExists($_folderName)) + { + $toSchema = $this->mail_bo->isDraftFolder($_folderName)||$this->mail_bo->isSentFolder($_folderName)||$this->mail_bo->isTemplateFolder($_folderName); + } $rowsFetched['messages'] = null; $offset = $query['start']+1; // we always start with 1 $maxMessages = $query['num_rows']; - $sort = $query['order']; + //error_log(__METHOD__.__LINE__.$query['order']); + $sort = ($query['order']=='address'?($toSchema?'toaddress':'fromaddress'):$query['order']); if (!empty($query['search'])) { //([filterName] => Schnellsuche[type] => quick[string] => ebay[status] => any @@ -1236,9 +1249,9 @@ unset($query['actions']); if (empty($rowsFetched['messages'])) $rowsFetched['messages'] = $rowsFetched['rowsFetched']; //error_log(__METHOD__.__LINE__.' Rows fetched:'.$rowsFetched.' Data:'.array2string($sortResult)); - $cols = array('row_id','uid','status','attachments','subject','toaddress','fromaddress','ccaddress','additionaltoaddress','date','size','modified'); + $cols = array('row_id','uid','status','attachments','subject','address','toaddress','fromaddress','ccaddress','additionaltoaddress','date','size','modified'); if ($GLOBALS['egw_info']['user']['preferences']['common']['select_mode']=='EGW_SELECTMODE_TOGGLE') unset($cols[0]); - $rows = $this->header2gridelements($sortResult['header'],$cols, $_folderName, $folderType,$previewMessage); + $rows = $this->header2gridelements($sortResult['header'],$cols, $_folderName, $folderType=$toSchema,$previewMessage); //error_log(__METHOD__.__LINE__.array2string($rows)); $endtime = microtime(true) - $starttime; //error_log(__METHOD__.__LINE__. " time used: ".$endtime.' for Folder:'.$_folderName.' Start:'.$query['start'].' NumRows:'.$query['num_rows']); @@ -1560,6 +1573,7 @@ unset($query['actions']); $data['attachmentsPresent'] = $imageTag; $data['attachmentsBlock'] = $imageHTMLBlock; $data['toolbaractions'] = json_encode($actionsenabled); + $data['address'] = ($_folderType?$data["toaddress"]:$data["fromaddress"]); $rv[] = $data; //error_log(__METHOD__.__LINE__.array2string($result)); } @@ -3330,6 +3344,9 @@ blockquote[type=cite] { */ function ajax_deleteFolder($_folderName) { + //lang("Do you really want to DELETE Folder %1 ?",OldFolderName); + //lang("All subfolders will be deleted too, and all messages in all affected folders will be lost"); + //lang("All messages in the folder will be lost"); //error_log(__METHOD__.__LINE__.' OldFolderName:'.array2string($_folderName)); $success = false; if ($_folderName) diff --git a/mail/js/app.js b/mail/js/app.js index 400c9eacb6..498dfc1f90 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -1861,7 +1861,7 @@ app.classes.mail = AppJS.extend( OldFolderName = OldFolderName.trim(); OldFolderName = OldFolderName.replace(/\([0-9]*\)/g,'').trim(); //console.log(OldFolderName); - reallyDelete = confirm(this.egw.lang("Do you really want to DELETE Folder %1 ? \r\nAll messages in the folder will be lost",OldFolderName)); + reallyDelete = confirm(this.egw.lang("Do you really want to DELETE Folder %1 ?",OldFolderName)+" \r\n"+(ftree.hasChildren(_senders[0].iface.id)?this.egw.lang("All subfolders will be deleted too, and all messages in all affected folders will be lost"):this.egw.lang("All messages in the folder will be lost"))); if (reallyDelete) { app.mail.app_refresh(this.egw.lang("Deleting Folder %1",OldFolderName, 'mail')); diff --git a/mail/lang/egw_en.lang b/mail/lang/egw_en.lang index fe1736cbdd..bbff601c6a 100644 --- a/mail/lang/egw_en.lang +++ b/mail/lang/egw_en.lang @@ -10,7 +10,9 @@ activating by date requires a start- and end-date! mail en Activating by date re add to addressbook mail en add to addressbook all adresses: mail en All Adresses: all available info admin en all available info +all messages in the folder will be lost mail en All messages in the folder will be lost all of mail en all of +all subfolders will be deleted too, and all messages in all affected folders will be lost mail en All subfolders will be deleted too, and all messages in all affected folders will be lost allow external images mail en Allow external images allow images from external sources in html emails mail en allow images from external sources in html emails allways a new window mail en allways a new window @@ -54,6 +56,7 @@ display only when no plain text is available mail en display only when no plain displaying html messages is disabled mail en displaying html messages is disabled displaying plain messages is disabled mail en displaying plain messages is disabled do not auto create folders mail en do not auto create folders +do you really want to delete folder %1 ? mail en Do you really want to DELETE Folder %1 ? do you want to be asked for confirmation before attaching selected messages to new mail? mail en Do you want to be asked for confirmation before attaching selected messages to new mail? do you want to be asked for confirmation before moving selected messages to another folder? mail en Do you want to be asked for confirmation before moving selected messages to another folder? do you want to prevent the editing/setup for forwarding of mails via settings (, even if sieve is enabled)? mail en Do you want to prevent the editing/setup for forwarding of mails via settings (, even if SIEVE is enabled)? @@ -150,13 +153,16 @@ new message type mail en New message type no (valid) send folder set in preferences mail en No (valid) Send Folder set in preferences no action defined! mail en No action defined! no address to/cc/bcc supplied, and no folder to save message to provided. mail en No Address TO/CC/BCC supplied, and no folder to save message to provided. +no adress, to send this mail to, supplied mail en no adress, to send this mail to, supplied no folder destination supplied, and no folder to save message or other measure to store the mail (save to infolog/tracker) provided, but required. mail en No Folder destination supplied, and no folder to save message or other measure to store the mail (save to infolog/tracker) provided, but required. no folders mail en no folders +no message body supplied mail en no message body supplied no plain text part found mail en no plain text part found no recipient address given! mail en No recipient address given! no send folder set in preferences mail en No Send Folder set in preferences no signature mail en no signature no subject given! mail en No subject given! +no subject supplied mail en no subject supplied none, create all mail en none, create all notify when new mails arrive in these folders mail en notify when new mails arrive in these folders on mail en on diff --git a/mail/templates/default/index.xet b/mail/templates/default/index.xet index b40e855808..2c61a2e2bb 100644 --- a/mail/templates/default/index.xet +++ b/mail/templates/default/index.xet @@ -11,6 +11,7 @@ + @@ -20,6 +21,7 @@ + @@ -30,6 +32,7 @@ +