/
UIxMailEditor.wox
356 lines (339 loc) · 16.9 KB
/
UIxMailEditor.wox
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
<?xml version="1.0" standalone="yes"?>
<container
xmlns="http://www.w3.org/1999/xhtml"
xmlns:var="http://www.skyrix.com/od/binding"
xmlns:const="http://www.skyrix.com/od/constant"
xmlns:label="OGo:label">
<md-dialog id="mailEditor" class="sg-mail-editor"
flex="{{ editor.isFullscreen? 100 : 60 }}"
flex-sm="{{ editor.isFullscreen? 100 : 90 }}"
flex-xs="100"
nv-file-drop="nv-file-drop"
nv-file-over="nv-file-over"
over-class="sg-over-dropzone"
uploader="editor.uploader"
var:sg-labels="framework">
<form name="messageForm">
<md-toolbar>
<div class="md-toolbar-tools">
<!-- expand dialog -->
<md-button ng-click="editor.toggleFullscreen($event)"
class="md-icon-button hide show-gt-xs"
aria-hidden="true"
ng-if="!isPopup">
<md-icon>{{ editor.isFullscreen ? 'fullscreen_exit' : 'fullscreen' }}</md-icon>
</md-button>
<!-- from -->
<sg-avatar-image class="hide-xs"
sg-email="editor.message.editable.from"
size="32">person</sg-avatar-image>
<md-input-container class="sg-no-wrap">
<label><var:string label:value="From"/></label>
<md-select name="from"
ng-model="editor.message.editable.from">
<md-option ng-value="identity" ng-repeat="identity in editor.identities track by $index">{{identity}}</md-option>
</md-select>
</md-input-container>
<div flex="flex"><!-- spacer --></div>
<md-button class="sg-icon-button" ng-click="editor.send()"
ng-disabled="!(editor.message.editable.to.length > 0 || editor.message.editable.cc.length > 0 || editor.message.editable.bcc.length > 0) || editor.uploader.isUploading || messageForm.$invalid || messageForm.$submitted"
sg-ripple-click="mailEditor">
<md-icon>send</md-icon>
</md-button>
<md-button class="sg-icon-button" ng-click="editor.save()">
<md-icon>save</md-icon>
</md-button>
<md-button class="sg-icon-button" ng-click="editor.cancel()">
<md-icon>close</md-icon>
</md-button>
</div>
</md-toolbar>
<div class="sg-dropzone">
<div layout="column" layout-align="center center" layout-fill="layout-fill">
<md-icon>file_upload</md-icon>
</div>
</div>
<md-dialog-content>
<header class="sg-padded">
<div class="msg-header-content">
<!-- to -->
<div class="pseudo-input-container">
<label class="pseudo-input-label">
<var:string label:value="To"/>
</label>
<md-chips ng-model="editor.message.editable.to"
md-separator-keys="editor.recipientSeparatorKeys"
md-transform-chip="editor.addRecipient($chip, 'to')"
md-add-on-blur="true"
md-autofocus="editor.isNew()"
md-autocomplete-snap="width">
<md-autocomplete
md-menu-class="md-2-line"
md-search-text="editor.autocomplete.to.searchText"
md-selected-item="editor.autocomplete.to.selected"
md-items="user in editor.contactFilter(editor.autocomplete.to.searchText)"
var:md-min-length="minimumSearchLength"
md-delay="150"
md-no-cache="true"
label:placeholder="Add a recipient">
<md-item-template>
<div class="sg-tile-content">
<div class="sg-md-subhead">
<div md-highlight-text="editor.autocomplete.to.searchText"
md-highlight-flags="gi">{{ user.$shortFormat(editor.autocomplete.to.searchText) }}</div>
</div>
<div class="sg-md-body"
md-colors="::{color: 'default-background-500'}">{{ user.containername }}</div>
</div>
</md-item-template>
</md-autocomplete>
<md-chip-template>
<div class="sg-tile-content">
{{$chip}}
<md-button class="sg-tile-btn" md-colors="::{ color: 'accent-600'}" ng-if="$chip.isExpandable" ng-click="editor.expandGroup($chip, 'to')">
<md-icon md-colors="::{ color: 'accent-600'}">add_box</md-icon><span ng-bind="$chip.members.length"></span>
</md-button>
</div>
</md-chip-template>
</md-chips>
</div>
<!-- cc -->
<div class="pseudo-input-container ng-hide" ng-hide="editor.hideCc">
<label class="pseudo-input-label">
<var:string label:value="Cc"/>
</label>
<md-chips ng-model="editor.message.editable.cc"
md-separator-keys="editor.recipientSeparatorKeys"
md-transform-chip="editor.addRecipient($chip, 'cc')"
md-add-on-blur="true"
md-autocomplete-snap="width">
<md-autocomplete
md-menu-class="md-2-line"
md-search-text="editor.autocomplete.cc.searchText"
md-selected-item="editor.autocomplete.cc.selected"
md-items="user in editor.contactFilter(editor.autocomplete.cc.searchText)"
var:md-min-length="minimumSearchLength"
md-delay="150"
md-no-cache="true"
label:placeholder="Add a recipient">
<md-item-template>
<div class="sg-tile-content">
<div class="sg-md-subhead">
<div md-highlight-text="editor.autocomplete.cc.searchText"
md-highlight-flags="gi">{{ user.$shortFormat(editor.autocomplete.cc.searchText) }}</div>
</div>
<div class="sg-md-body"
md-colors="::{color: 'default-background-500'}">{{ user.containername }}</div>
</div>
</md-item-template>
</md-autocomplete>
<md-chip-template>
<div class="sg-tile-content">
{{$chip}}
<md-button class="sg-tile-btn" md-colors="::{ color: 'accent-600'}" ng-if="$chip.isExpandable" ng-click="editor.expandGroup($chip, 'cc')">
<md-icon md-colors="::{ color: 'accent-600'}">add_box</md-icon><span ng-bind="$chip.members.length"></span>
</md-button>
</div>
</md-chip-template>
</md-chips>
</div>
<!-- bcc -->
<div class="pseudo-input-container ng-hide" ng-hide="editor.hideBcc">
<label class="pseudo-input-label">
<var:string label:value="Bcc"/>
</label>
<md-chips ng-model="editor.message.editable.bcc"
md-separator-keys="editor.recipientSeparatorKeys"
md-transform-chip="editor.addRecipient($chip, 'bcc')"
md-add-on-blur="true"
md-autocomplete-snap="width">
<md-autocomplete
md-menu-class="md-2-line"
md-selected-item="editor.autocomplete.bcc.selected"
md-search-text="editor.autocomplete.bcc.searchText"
md-items="user in editor.contactFilter(editor.autocomplete.bcc.searchText)"
var:md-min-length="minimumSearchLength"
md-delay="150"
md-no-cache="true"
label:placeholder="Add a recipient">
<md-item-template>
<div class="sg-tile-content">
<div class="sg-md-subhead">
<div md-highlight-text="editor.autocomplete.bcc.searchText"
md-highlight-flags="gi">{{ user.$shortFormat(editor.autocomplete.bcc.searchText) }}</div>
</div>
<div class="sg-md-body"
md-colors="::{color: 'default-background-500'}">{{ user.containername }}</div>
</div>
</md-item-template>
</md-autocomplete>
<md-chip-template>
<div class="sg-tile-content">
{{$chip}}
<md-button class="sg-tile-btn" md-colors="::{ color: 'accent-600'}" ng-if="$chip.isExpandable" ng-click="editor.expandGroup($chip, 'bcc')">
<md-icon md-colors="::{ color: 'accent-600'}">add_box</md-icon><span ng-bind="$chip.members.length"></span>
</md-button>
</div>
</md-chip-template>
</md-chips>
</div>
<!-- subject -->
<md-input-container>
<label>
<var:string label:value="Subject"/>
</label>
<input type="text" name="subject" ng-model="editor.message.editable.subject" ng-required="true"/>
<div ng-messages="messageForm.subject.$error">
<div ng-message="required"><var:string label:value="Please specify a subject."/></div>
</div>
</md-input-container>
</div>
<!-- toolbar to show cc/bcc/attachment fields -->
<div class="msg-header-buttons" layout="column" layout-align="start end">
<md-button class="sg-icon-button " ng-show="editor.hideCc" ng-click="editor.hideCc = false">Cc</md-button>
<md-button class="sg-icon-button " ng-show="editor.hideBcc" ng-click="editor.hideBcc = false">Bcc</md-button>
<md-menu>
<md-button label:aria-label="More mail options" class="sg-icon-button" ng-click="$mdMenu.open($event)">
<md-icon>more_vert</md-icon>
</md-button>
<md-menu-content width="4">
<md-menu-item>
<sg-checkmark ng-model="editor.message.editable.receipt">
<var:string label:value="Return Receipt"/>
</sg-checkmark>
</md-menu-item>
<md-menu-item>
<md-button class="md-primary" ng-disabled="true" ng-bind="::'Security' | loc"><!-- Security --></md-button>
</md-menu-item>
<md-menu-item>
<sg-checkmark ng-model="editor.message.editable.sign">
<var:string label:value="Sign"/>
</sg-checkmark>
</md-menu-item>
<md-menu-item>
<sg-checkmark ng-model="editor.message.editable.encrypt">
<var:string label:value="Encrypt"/>
</sg-checkmark>
</md-menu-item>
<md-menu-item>
<md-button class="md-primary" ng-disabled="true"><var:string label:value="Priority"/></md-button>
</md-menu-item>
<md-menu-item>
<md-button ng-click="editor.message.editable.priority = 1">
<md-icon>{{ editor.message.editable.priority == 1 ? 'check' : null }}</md-icon>
<var:string label:value="highest"/>
</md-button>
</md-menu-item>
<md-menu-item>
<md-button ng-click="editor.message.editable.priority = 2">
<md-icon>{{ editor.message.editable.priority == 2 ? 'check' : null }}</md-icon>
<var:string label:value="high"/>
</md-button>
</md-menu-item>
<md-menu-item>
<md-button ng-click="editor.message.editable.priority = 3">
<md-icon>{{ (!editor.message.editable.priority || editor.message.editable.priority == 3) ? 'check' : null }}</md-icon>
<var:string label:value="normal"/>
</md-button>
</md-menu-item>
<md-menu-item>
<md-button ng-click="editor.message.editable.priority = 4">
<md-icon>{{ editor.message.editable.priority == 4 ? 'check' : null }}</md-icon>
<var:string label:value="low"/>
</md-button>
</md-menu-item>
<md-menu-item>
<md-button ng-click="editor.message.editable.priority = 5">
<md-icon>{{ editor.message.editable.priority == 5 ? 'check' : null }}</md-icon>
<var:string label:value="lowest"/>
</md-button>
</md-menu-item>
</md-menu-content>
</md-menu>
</div>
</header>
<!-- MESSAGE CONTENT -->
<md-input-container class="md-block sg-mail-editor-content">
<textarea name="content" var:class="editorClass"
rows="9"
ck-locale="editor.localeCode"
ck-margin="16px"
ck-focus="editor.onHTMLFocus($event)"
ng-model="editor.message.editable.text"
ng-focus="editor.onTextFocus($event)"
md-autofocus="::!editor.isNew()"
md-no-resize="md-no-resize"
md-no-autogrow="md-no-autogrow"
sg-autogrow="!isPopup"
md-detect-hidden="md-detect-hidden" />
</md-input-container>
</md-dialog-content>
<!-- ATTACHMENTS -->
<md-dialog-actions class="sg-mail-editor-attachments"
layout="row" layout-align="space-between start">
<!-- Attachments -->
<md-chips ng-model="editor.uploader.queue"
class="md-flex sg-readonly" readonly="true">
<md-chip-template>
<span class="sg-chip-progress" ng-show="$chip.isUploading">
<span class="md-default-theme md-warn md-bg"
ng-style="{ width: $chip.progress + '%'}"><!-- progress --></span>
</span>
<a ng-href="{{$chip.inlineUrl}}" target="_new">{{$chip.file.name}}</a>
<button class="md-icon-button md-chip-remove"
ng-click="editor.removeAttachment($chip, 'fileInput')">
<md-icon ng-class="{ 'md-warn': $chip.isUploading }">close</md-icon>
</button>
</md-chip-template>
</md-chips>
<div class="msg-header-buttons">
<label class="md-button md-icon-button" for="fileInput">
<md-icon>attach_file</md-icon>
<!-- <span><var:string label:value="Attach"/></span> -->
</label>
<input id="fileInput" class="ng-hide" name="fileInput" type="file" multiple="multiple"
nv-file-select="nv-file-select"
uploader="editor.uploader"/>
<!--
Disable multiple until this issue is resolved:
https://github.com/nervgh/angular-file-upload/issues/525
-->
<!-- multiple="multiple" -->
</div>
</md-dialog-actions>
</form>
<sg-ripple class="md-default-theme md-accent md-bg"
ng-class="{ 'md-warn': editor.sendState == 'error' }"><!-- ripple background --></sg-ripple>
<sg-ripple-content class="md-default-theme md-accent md-hue-1 md-fg md-flex ng-hide"
layout="column" layout-align="center center" layout-fill="layout-fill"
ng-switch="editor.sendState">
<!-- Sending -->
<div layout="column" layout-align="center center"
ng-switch-when="sending">
<md-progress-circular class="md-hue-1"
md-mode="indeterminate"
md-diameter="48"><!-- mailbox loading progress --></md-progress-circular>
<div class="md-padding">
<var:string label:value="Sending"/>
</div>
</div>
<!-- Sent -->
<div layout="column" layout-align="center center"
ng-switch-when="sent">
<md-icon class="md-accent md-hue-1 sg-icon--large">done</md-icon>
<div class="md-default-theme md-accent md-hue-1 md-fg md-padding">
<var:string label:value="Sent"/>
</div>
</div>
<!-- Error -->
<div layout="column" layout-align="center center"
ng-switch-when="error">
<md-icon class="md-accent md-hue-1 sg-icon--large">error</md-icon>
<div class="md-padding">
{{editor.errorMessage}}
</div>
<md-button sg-ripple-click="mailEditor"><var:string label:value="Close"/></md-button>
</div>
</sg-ripple-content>
</md-dialog>
</container>