Browse Source

Add prefix to every properties for grouping them

pull/340/head
seamys 8 years ago
parent
commit
807138266b
  1. 36
      extensions/Squidex.Extensions/Actions/Email/EmailAction.cs
  2. 48
      extensions/Squidex.Extensions/Actions/Email/EmailActionHandler.cs
  3. 1
      src/Squidex/AppServices.cs
  4. 56
      src/Squidex/app/features/rules/pages/rules/actions/email-action.component.html
  5. 36
      src/Squidex/app/features/rules/pages/rules/actions/email-action.component.ts
  6. 12
      src/Squidex/appsettings.json

36
extensions/Squidex.Extensions/Actions/Email/EmailAction.cs

@ -20,39 +20,39 @@ namespace Squidex.Extensions.Actions.Email
public class EmailAction : RuleAction public class EmailAction : RuleAction
{ {
[Required] [Required]
[Display(Name = "Host", Description = "The Name or IP address of the host used for SMTP transactions.")] [Display(Name = "ServerHost", Description = "The Name or IP address of the host used for SMTP transactions.")]
public string Host { get; set; } public string ServerHost { get; set; }
[Required] [Required]
[Display(Name = "Port", Description = "The port to be used on host.")] [Display(Name = "ServerPort", Description = "The port to be used on host.")]
public int Port { get; set; } public int ServerPort { get; set; }
[Required] [Required]
[Display(Name = "EnableSsl", Description = "Specify whether the smtp client uses Secure Sockets Layer (SSL) to encrypt the connection.")] [Display(Name = "ServerUseSsl", Description = "Specify whether the smtp client uses Secure Sockets Layer (SSL) to encrypt the connection.")]
public bool EnableSsl { get; set; } public bool ServerUseSsl { get; set; }
[Required] [Required]
[Display(Name = "Username", Description = "The username used to authenticate the sender.")] [Display(Name = "ServerUsername", Description = "The username used to authenticate the sender.")]
public string Username { get; set; } public string ServerUsername { get; set; }
[Required] [Required]
[Display(Name = "Password", Description = "The password used to authenticate the sender.")] [Display(Name = "ServerPassword", Description = "The password used to authenticate the sender.")]
public string Password { get; set; } public string ServerPassword { get; set; }
[Required] [Required]
[Display(Name = "From", Description = "The email is sent from?")] [Display(Name = "MessageFrom", Description = "The email sending address.")]
public string From { get; set; } public string MessageFrom { get; set; }
[Required] [Required]
[Display(Name = "To", Description = "The email will be sent to?")] [Display(Name = "MessageTo", Description = "The email message will be sent to.")]
public string To { get; set; } public string MessageTo { get; set; }
[Required] [Required]
[Display(Name = "Subject", Description = "The subject line for this e-mail message.")] [Display(Name = "MessageSubject", Description = "The subject line for this email message.")]
public string Subject { get; set; } public string MessageSubject { get; set; }
[Required] [Required]
[Display(Name = "Body", Description = "The message body.")] [Display(Name = "MessageBody", Description = "The message body.")]
public string Body { get; set; } public string MessageBody { get; set; }
} }
} }

48
extensions/Squidex.Extensions/Actions/Email/EmailActionHandler.cs

@ -31,15 +31,15 @@ namespace Squidex.Extensions.Actions.Email
{ {
var ruleJob = new EmailJob var ruleJob = new EmailJob
{ {
Host = action.Host, ServerHost = action.ServerHost,
EnableSsl = action.EnableSsl, ServerUseSsl = action.ServerUseSsl,
Password = action.Password, ServerPassword = action.ServerPassword,
Port = action.Port, ServerPort = action.ServerPort,
Username = Format(action.Username, @event), ServerUsername = Format(action.ServerUsername, @event),
From = Format(action.From, @event), MessageFrom = Format(action.MessageFrom, @event),
To = Format(action.To, @event), MessageTo = Format(action.MessageTo, @event),
Subject = Format(action.Subject, @event), MessageSubject = Format(action.MessageSubject, @event),
Body = Format(action.Body, @event) MessageBody = Format(action.MessageBody, @event)
}; };
return (Description, ruleJob); return (Description, ruleJob);
@ -47,15 +47,15 @@ namespace Squidex.Extensions.Actions.Email
protected override async Task<(string Dump, Exception Exception)> ExecuteJobAsync(EmailJob job) protected override async Task<(string Dump, Exception Exception)> ExecuteJobAsync(EmailJob job)
{ {
using (var client = new SmtpClient(job.Host, job.Port)) using (var client = new SmtpClient(job.ServerHost, job.ServerPort))
{ {
client.EnableSsl = job.EnableSsl; client.EnableSsl = job.ServerUseSsl;
client.Credentials = new NetworkCredential(job.Username, job.Password); client.Credentials = new NetworkCredential(job.ServerUsername, job.ServerPassword);
using (var message = new MailMessage(job.From, job.To)) using (var message = new MailMessage(job.MessageFrom, job.MessageTo))
{ {
message.Subject = job.Subject; message.Subject = job.MessageSubject;
message.Body = job.Body; message.Body = job.MessageBody;
await client.SendMailAsync(message); await client.SendMailAsync(message);
} }
} }
@ -66,22 +66,22 @@ namespace Squidex.Extensions.Actions.Email
public class EmailJob public class EmailJob
{ {
public string Host { get; set; } public string ServerHost { get; set; }
public int Port { get; set; } public int ServerPort { get; set; }
public string Username { get; set; } public string ServerUsername { get; set; }
public string Password { get; set; } public string ServerPassword { get; set; }
public bool EnableSsl { get; set; } public bool ServerUseSsl { get; set; }
public string From { get; set; } public string MessageFrom { get; set; }
public string To { get; set; } public string MessageTo { get; set; }
public string Subject { get; set; } public string MessageSubject { get; set; }
public string Body { get; set; } public string MessageBody { get; set; }
} }
} }

1
src/Squidex/AppServices.cs

@ -16,7 +16,6 @@ using Squidex.Config.Domain;
using Squidex.Config.Web; using Squidex.Config.Web;
using Squidex.Domain.Apps.Entities.Assets; using Squidex.Domain.Apps.Entities.Assets;
using Squidex.Domain.Apps.Entities.Contents; using Squidex.Domain.Apps.Entities.Contents;
using Squidex.Extensions.Actions.Email;
using Squidex.Extensions.Actions.Twitter; using Squidex.Extensions.Actions.Twitter;
using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Diagnostics; using Squidex.Infrastructure.Diagnostics;

56
src/Squidex/app/features/rules/pages/rules/actions/email-action.component.html

@ -1,11 +1,11 @@
<div [formGroup]="actionForm" class="form-horizontal"> <div [formGroup]="actionForm" class="form-horizontal">
<div class="form-group row"> <div class="form-group row">
<label class="col-3 col-form-label" for="host">Host</label> <label class="col-3 col-form-label" for="serverHost">ServerHost</label>
<div class="col-9"> <div class="col-9">
<sqx-control-errors for="from" [submitted]="actionFormSubmitted"></sqx-control-errors> <sqx-control-errors for="from" [submitted]="actionFormSubmitted"></sqx-control-errors>
<input type="text" class="form-control" id="host" formControlName="host" /> <input type="text" class="form-control" id="serverHost" formControlName="serverHost" />
<small class="form-text text-muted"> <small class="form-text text-muted">
The Name or IP address of the host used for SMTP transactions. The Name or IP address of the host used for SMTP transactions.
@ -14,12 +14,12 @@
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label class="col-3 col-form-label" for="port">Port</label> <label class="col-3 col-form-label" for="serverPort">ServerPort</label>
<div class="col-9"> <div class="col-9">
<sqx-control-errors for="port" [submitted]="actionFormSubmitted"></sqx-control-errors> <sqx-control-errors for="serverPort" [submitted]="actionFormSubmitted"></sqx-control-errors>
<input type="text" class="form-control" id="port" formControlName="port" /> <input type="text" class="form-control" id="serverPort" formControlName="serverPort" />
<small class="form-text text-muted"> <small class="form-text text-muted">
The port to be used on host. The port to be used on host.
@ -30,9 +30,9 @@
<div class="form-group row"> <div class="form-group row">
<div class="col-9 offset-3"> <div class="col-9 offset-3">
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="checkbox" id="enableSsl" formControlName="enableSsl" /> <input class="form-check-input" type="checkbox" id="serverUseSsl" formControlName="serverUseSsl" />
<label class="form-check-label" for="enableSsl"> <label class="form-check-label" for="serverUseSsl">
EnableSsl ServerUseSsl
</label> </label>
</div> </div>
<small class="form-text text-muted"> <small class="form-text text-muted">
@ -42,26 +42,26 @@
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label class="col-3 col-form-label" for="username">Username</label> <label class="col-3 col-form-label" for="serverUsername">ServerUsername</label>
<div class="col-9"> <div class="col-9">
<sqx-control-errors for="port" [submitted]="actionFormSubmitted"></sqx-control-errors> <sqx-control-errors for="serverUsername" [submitted]="actionFormSubmitted"></sqx-control-errors>
<input type="text" class="form-control" id="username" formControlName="username" /> <input type="text" class="form-control" id="serverUsername" formControlName="serverUsername" />
<small class="form-text text-muted"> <small class="form-text text-muted">
The username used to authenticate the sender. The username used to authenticate the sender. Read the <a routerLink="help">help</a> section for information about advanced formatting.
</small> </small>
</div> </div>
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label class="col-3 col-form-label" for="password">Password</label> <label class="col-3 col-form-label" for="serverPassword">ServerPassword</label>
<div class="col-9"> <div class="col-9">
<sqx-control-errors for="password" [submitted]="actionFormSubmitted"></sqx-control-errors> <sqx-control-errors for="password" [submitted]="actionFormSubmitted"></sqx-control-errors>
<input type="password" class="form-control" id="password" formControlName="password" /> <input type="password" class="form-control" id="serverPassword" formControlName="serverPassword" />
<small class="form-text text-muted"> <small class="form-text text-muted">
The password used to authenticate the sender. The password used to authenticate the sender.
@ -70,58 +70,58 @@
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label class="col-3 col-form-label" for="from">From</label> <label class="col-3 col-form-label" for="messageFrom">MessageFrom</label>
<div class="col-9"> <div class="col-9">
<sqx-control-errors for="from" [submitted]="actionFormSubmitted"></sqx-control-errors> <sqx-control-errors for="messageFrom" [submitted]="actionFormSubmitted"></sqx-control-errors>
<input type="text" class="form-control" id="from" formControlName="from" /> <input type="text" class="form-control" id="messageFrom" formControlName="messageFrom" />
<small class="form-text text-muted"> <small class="form-text text-muted">
The email is sent from? The email sending address. Read the <a routerLink="help">help</a> section for information about advanced formatting.
</small> </small>
</div> </div>
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label class="col-3 col-form-label" for="to">To</label> <label class="col-3 col-form-label" for="messageTo">MessageTo</label>
<div class="col-9"> <div class="col-9">
<sqx-control-errors for="to" [submitted]="actionFormSubmitted"></sqx-control-errors> <sqx-control-errors for="messageTo" [submitted]="actionFormSubmitted"></sqx-control-errors>
<input type="text" class="form-control" id="to" formControlName="to" /> <input type="text" class="form-control" id="messageTo" formControlName="messageTo" />
<small class="form-text text-muted"> <small class="form-text text-muted">
The email will be sent to? The email message will be sent to. Read the <a routerLink="help">help</a> section for information about advanced formatting.
</small> </small>
</div> </div>
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label class="col-3 col-form-label" for="subject">Subject</label> <label class="col-3 col-form-label" for="messageSubject">MessageSubject</label>
<div class="col-9"> <div class="col-9">
<sqx-control-errors for="subject" [submitted]="actionFormSubmitted"></sqx-control-errors> <sqx-control-errors for="subject" [submitted]="actionFormSubmitted"></sqx-control-errors>
<input type="text" class="form-control" id="subject" formControlName="subject" /> <input type="text" class="form-control" id="messageSubject" formControlName="messageSubject" />
<small class="form-text text-muted"> <small class="form-text text-muted">
The subject line for this e-mail message. The subject line for this email message. Read the <a routerLink="help">help</a> section for information about advanced formatting.
</small> </small>
</div> </div>
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label class="col-3 col-form-label" for="body">Body</label> <label class="col-3 col-form-label" for="messageBody">MessageBody</label>
<div class="col-9"> <div class="col-9">
<sqx-control-errors for="body" [submitted]="actionFormSubmitted"></sqx-control-errors> <sqx-control-errors for="body" [submitted]="actionFormSubmitted"></sqx-control-errors>
<textarea class="form-control" id="body" formControlName="body"></textarea> <textarea class="form-control" id="messageBody" formControlName="messageBody"></textarea>
<small class="form-text text-muted"> <small class="form-text text-muted">
The message body The message body. Read the <a routerLink="help">help</a> section for information about advanced formatting.
</small> </small>
</div> </div>
</div> </div>

36
src/Squidex/app/features/rules/pages/rules/actions/email-action.component.ts

@ -24,47 +24,47 @@ export class EmailActionComponent implements OnInit {
public actionFormSubmitted = false; public actionFormSubmitted = false;
public ngOnInit() { public ngOnInit() {
this.actionForm.setControl('host', this.actionForm.setControl('serverHost',
new FormControl(this.action.host || 'smtp.gmail.com', [ new FormControl(this.action.serverHost || 'smtp.gmail.com', [
Validators.required Validators.required
])); ]));
this.actionForm.setControl('port', this.actionForm.setControl('serverPort',
new FormControl(this.action.port || 465, [ new FormControl(this.action.serverPort || 465, [
Validators.required, Validators.required,
Validators.pattern(/\d{2,6}/) Validators.pattern(/\d{2,6}/)
])); ]));
this.actionForm.setControl('enableSsl', this.actionForm.setControl('serverUseSsl',
new FormControl(this.action.enableSsl || true)); new FormControl(this.action.serverUseSsl || true));
this.actionForm.setControl('username', this.actionForm.setControl('serverUsername',
new FormControl(this.action.username || '', [ new FormControl(this.action.serverUsername || '', [
Validators.required Validators.required
])); ]));
this.actionForm.setControl('password', this.actionForm.setControl('serverPassword',
new FormControl(this.action.password || '', [ new FormControl(this.action.serverPassword || '', [
Validators.required Validators.required
])); ]));
this.actionForm.setControl('from', this.actionForm.setControl('messageFrom',
new FormControl(this.action.from || '', [ new FormControl(this.action.messageFrom || '', [
Validators.required Validators.required
])); ]));
this.actionForm.setControl('to', this.actionForm.setControl('messageTo',
new FormControl(this.action.to || '', [ new FormControl(this.action.messageTo || '', [
Validators.required Validators.required
])); ]));
this.actionForm.setControl('subject', this.actionForm.setControl('messageSubject',
new FormControl(this.action.subject || '', [ new FormControl(this.action.messageSubject || '', [
Validators.required Validators.required
])); ]));
this.actionForm.setControl('body', this.actionForm.setControl('messageBody',
new FormControl(this.action.body || '', [ new FormControl(this.action.messageBody || '', [
Validators.required Validators.required
])); ]));
} }

12
src/Squidex/appsettings.json

@ -68,8 +68,8 @@
/* /*
* The maximum number of megabyte that the process can consume until it is marked as not healthy. * The maximum number of megabyte that the process can consume until it is marked as not healthy.
*/ */
"threshold": 4096 "threshold": 4096
} }
}, },
"contentsController": { "contentsController": {
@ -78,13 +78,13 @@
* *
* Nginx Has problems with long headers. It might make sense to disable this feature if you do not use a CDN. * Nginx Has problems with long headers. It might make sense to disable this feature if you do not use a CDN.
*/ */
"enableSurrogateKeys": true, "enableSurrogateKeys": true,
/* /*
* Restrict the surrogate keys to results that have less than 200 items. * Restrict the surrogate keys to results that have less than 200 items.
*/ */
"maxItemsForSurrogateKeys": 200 "maxItemsForSurrogateKeys": 200
}, },
"content": { "content": {
/* /*

Loading…
Cancel
Save