Adding RedirectActionForm and WebRequestForm.

--HG--
branch : 1.x
extra : source : 56c92e37525e0618c644b3ad6e57b55e2ef4dd46
This commit is contained in:
Sipke Schoorstra
2013-05-02 21:15:38 +02:00
parent dd61361607
commit bbe2bedf25
3 changed files with 87 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
using Orchard.DisplayManagement;
using Orchard.Forms.Services;
using Orchard.Localization;
namespace Orchard.Workflows.Forms {
public class RedirectActionForm : IFormProvider {
protected dynamic New { get; set; }
public Localizer T { get; set; }
public RedirectActionForm(IShapeFactory shapeFactory) {
New = shapeFactory;
T = NullLocalizer.Instance;
}
public void Describe(DescribeContext context) {
context.Form("ActionRedirect",
shape => New.Form(
Id: "ActionRedirect",
_Url: New.Textbox(
Id: "Url", Name: "Url",
Title: T("Url"),
Description: T("The url to redirect to."),
Classes: new[] { "text large", "tokenized" })
)
);
}
}
}

View File

@@ -0,0 +1,57 @@
using System.Web.Mvc;
using Orchard.DisplayManagement;
using Orchard.Forms.Services;
using Orchard.Localization;
namespace Orchard.Workflows.Forms {
public class WebRequestForm : IFormProvider {
protected dynamic New { get; set; }
public Localizer T { get; set; }
public WebRequestForm(IShapeFactory shapeFactory) {
New = shapeFactory;
T = NullLocalizer.Instance;
}
public void Describe(DescribeContext context) {
context.Form("WebRequestActivity",
shape => {
var form = New.Form(
Id: "WebRequestActivity",
_Url: New.Textbox(
Id: "Url", Name: "Url",
Title: T("Url"),
Description: T("The url to send the request to."),
Classes: new[] {"text large", "tokenized"}),
_Verb: New.SelectList(
Id: "Verb", Name: "Verb",
Title: T("Verb"),
Description: T("The HTTP verb to use.")),
_Headers: New.Textarea(
Id: "Headers", Name: "Headers",
Title: T("Headers"),
Description: T("Enter one line per header=value pair"),
Classes: new[] {"tokenized"}),
_FormFormat: New.SelectList(
Id: "FormFormat", Name: "FormFormat",
Title: T("Form Format"),
Description: T("The serialization format to use for the POST body.")),
_FormValues: New.Textarea(
Id: "FormValues", Name: "FormValues",
Title: T("Form Values"),
Description: T("For KeyValue, enter one line per key=value pair to submit when using the POST verb. For JSON, enter a valid JSON string"),
Classes: new[] {"tokenized"})
);
form._Verb.Add(new SelectListItem { Value = "GET", Text = "GET" });
form._Verb.Add(new SelectListItem { Value = "POST", Text = "POST" });
form._FormFormat.Add(new SelectListItem { Value = "KeyValue", Text = "Key / Value" });
form._FormFormat.Add(new SelectListItem { Value = "Json", Text = "Json" });
return form;
}
);
}
}
}

View File

@@ -140,6 +140,7 @@
<Compile Include="Activities\WebRequestActivity.cs" />
<Compile Include="Activities\WebResponseActivity.cs" />
<Compile Include="Controllers\WorkflowController.cs" />
<Compile Include="Forms\RedirectActionForm.cs" />
<Compile Include="Forms\TimerForms.cs" />
<Compile Include="Forms\BranchForms.cs" />
<Compile Include="Forms\MailForms.cs" />
@@ -151,6 +152,7 @@
<Compile Include="Controllers\AdminController.cs" />
<Compile Include="Drivers\UserTaskDriver.cs" />
<Compile Include="Drivers\WorkflowDriver.cs" />
<Compile Include="Forms\WebRequestForm.cs" />
<Compile Include="Handlers\ContentHandler.cs" />
<Compile Include="Handlers\WorkflowHandler.cs" />
<Compile Include="Models\AwaitingActivityRecord.cs" />