コード例 #1
0
ファイル: PluginHelper.cs プロジェクト: jason1234/CMS
 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;
 }
コード例 #2
0
ファイル: ContentPlugin.cs プロジェクト: jason1234/CMS
        public ActionResult Submit(Site site, ControllerContext controllerContext, SubmissionSetting submissionSetting)
        {
            object model = null;
            Exception exception = null;
            var formValues = new NameValueCollection(controllerContext.HttpContext.Request.Unvalidated().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);
        }