public ActionResult Submit(Site site, ControllerContext controllerContext, SubmissionSetting submissionSetting) { object model = null; Exception exception = null; var formValues = new NameValueCollection(controllerContext.HttpContext.Request.Form); try { var repository = site.GetRepository(); var valueProvider = new NameValueCollectionProvider(formValues); formValues = PluginHelper.ApplySubmissionSettings(submissionSetting, formValues); var folderName = formValues["FolderName"]; if (!string.IsNullOrEmpty(folderName)) { var folder = FolderHelper.Parse <TextFolder>(repository, folderName); model = DoPost(repository, folder, controllerContext, formValues); } } catch (Exception e) { exception = e; } return(PluginHelper.ReturnActionResult(controllerContext, model, exception)); }
public static NameValueCollection ApplySubmissionSettings(SubmissionSetting submissionSetting, NameValueCollection formValues) { IFormulaParser formulaParser = Kooboo.CMS.Common.Runtime.EngineContext.Current.Resolve <IFormulaParser>(); var valueProvider = new NameValueCollectionProvider(formValues); if (submissionSetting.Settings != null) { foreach (var item in submissionSetting.Settings) { formValues[item.Key] = formulaParser.Populate(item.Value, valueProvider); } } return(formValues); }