public void CreateFeed(int layoutId) { String rssUrl = ctx.Post("Url"); if (strUtil.IsNullOrEmpty(rssUrl)) { errors.Add("rss url can not be empty"); run(AddFeed, layoutId); return; } // 获取feed源 FeedSource s = feedService.CreateRss(rssUrl); if (s == null) { errors.Add("create rss error"); run(AddFeed, layoutId); return; } // 创建区块 ContentSection section = ContentValidator.PopulateFeed(layoutId, ctx); String title = ctx.Post("Title"); section.Title = strUtil.HasText(title) ? title : s.Title; section.MoreLink = s.Link; // rss数据源的ID section.ServiceId = 18; // 仅使用单列列表模板 section.TemplateId = 2; sectionService.Insert(section); // 设置参数 int count = ctx.PostInt("Count"); if (count <= 0 || count > 30) { count = 5; } updateFeedParamValues(section, rssUrl, count); echoToParentPart(lang("opok")); }