NSArray *bcc;
NSString *subject;
NSString *text;
+ NSArray *fromEMails;
+ NSString *from;
SOGoMailFolder *sentFolder;
}
#include <SoObjects/Mailer/SOGoMailFolder.h>
#include <SoObjects/Mailer/SOGoMailAccount.h>
#include <SoObjects/SOGo/WOContext+Agenor.h>
+#include <SoObjects/SOGo/AgenorUserManager.h>
#include <NGMail/NGMimeMessage.h>
#include <NGMail/NGMimeMessageGenerator.h>
#include "common.h"
- (void)dealloc {
[self->sentFolder release];
+ [self->fromEMails release];
+ [self->from release];
[self->text release];
[self->subject release];
[self->to release];
/* accessors */
-- (void)setFrom:(NSString *)_ignore {
+- (void)setFrom:(NSString *)_value {
+ ASSIGNCOPY(self->from, _value);
}
- (NSString *)from {
- return [self emailForUser];
+ if (![self->from isNotNull])
+ return [self emailForUser];
+ return self->from;
}
+
- (void)setReplyTo:(NSString *)_ignore {
}
- (NSString *)replyTo {
return [self->bcc isNotNull] ? self->bcc : [NSArray array];
}
+/* from addresses */
+
+- (NSArray *)fromEMails {
+ NSString *primary, *uid;
+ NSArray *shares;
+
+ if (self->fromEMails != nil)
+ return self->fromEMails;
+
+ uid = [[self user] login];
+ primary = [self emailForUser];
+ if (![[self context] isAccessFromIntranet]) {
+ self->fromEMails = [[NSArray alloc] initWithObjects:&primary count:1];
+ return self->fromEMails;
+ }
+
+ shares =
+ [[AgenorUserManager sharedUserManager] getSharedMailboxEMailsForUID:uid];
+ if ([shares count] == 0)
+ self->fromEMails = [[NSArray alloc] initWithObjects:&primary count:1];
+ else {
+ id tmp;
+
+ tmp = [[NSArray alloc] initWithObjects:&primary count:1];
+ self->fromEMails = [[tmp arrayByAddingObjectsFromArray:shares] copy];
+ [tmp release]; tmp = nil;
+ }
+ return self->fromEMails;
+}
+
/* title */
- (NSString *)panelTitle {
>
<div id="compose_panel">
-<!-- we don't support multiple accounts ...
- <div id="compose_fromline">
- From:
- [always a popup on Thunderbird]
- <select name="totype_00" style="width: 90%;">
- <option value="to" selected="selected">xxx@yyy.com</option>
- </select>
- </div>
--->
-
<var:if condition="showInternetMarker">
<div id="compose_internetmarker">
<var:string
/>
</div>
+ <!-- moved below to selection to make it look better -->
+ <div id="compose_fromline">
+ <table border="0" width="100%">
+ <tr>
+ <td class="compose_label" width="20%">
+ <var:string label:value="From" />:
+ </td>
+ <td width="80%">
+ <var:popup const:name="from" list="fromEMails" item="item"
+ selection="from"
+ const:style="width: 100%; font-size: 8pt;"
+ />
+ </td>
+ </tr>
+ </table>
+ </div>
+
<div id="compose_subject">
<table border="0" width="100%">
<tr>
- <td class="compose_label" width="15%">
+ <td class="compose_label" width="20%">
<var:string label:value="Subject" />:
</td>
- <td width="85%"><input name="subject"
+ <td width="80%"><input name="subject"
id="compose_subject_input" type="text"
var:value="subject" /></td>
</tr>