Пример #1
0
        private void InitDdls()
        {
            BllTemplateObjects     = _service.GetAllTemplateObjects(_templateId).OrderBy(x => x.Name);
            BllRestTemplateObjects = _service.GetRestTemplateObjects(_templateId);
            if (_pageId.HasValue)
            {
                BllPageObjects = _service.GetAllPageObjects(_pageId.Value).OrderBy(x => x.Name);
            }

            PageObjects         = HighlightedTAreaToolbarHelper.GenerateObjectListItems(BllPageObjects);
            TemplateObjects     = HighlightedTAreaToolbarHelper.GenerateObjectListItems(BllTemplateObjects);
            RestTemplateObjects = HighlightedTAreaToolbarHelper.GenerateRestObjectListItems(BllRestTemplateObjects);

            if (IsContainer || IsForm)
            {
                var content = _service.ReadContentProperties(_contentId.Value);
                var fields  = ServiceField.CreateAll()
                              .Select(f => new ListItem {
                    Text = f.ColumnName, Value = f.ColumnName
                })
                              .Concat(content.Fields.Select(x => new ListItem {
                    Text = x.Name, Value = x.Name
                }))
                              .ToList();

                fields.Insert(0, new ListItem {
                    Text = TemplateStrings.SelectField, Value = string.Empty
                });
                Fields = fields;
            }
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] ServiceField serviceField)
        {
            if (id != serviceField.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(serviceField);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ServiceFieldExists(serviceField.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(serviceField));
        }
Пример #3
0
 private IEnumerable <ArticleSearchableField> GetArticleSystemFieldList()
 {
     return(ServiceField.CreateAll() // служебные поля
            .Select(f => new ArticleSearchableField
     {
         ID = f.ID.ToString(),
         Name = f.Name,
         ColumnName = f.ColumnName,
         ArticleFieldSearchType = f.ArticleFieldSearchType
     }));
 }
Пример #4
0
        public async Task <IActionResult> Create([Bind("Id,Name")] ServiceField serviceField)
        {
            if (ModelState.IsValid)
            {
                _context.Add(serviceField);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(serviceField));
        }
Пример #5
0
        public JsonResult GetFieldsByContentId([FromBody] int contentId)
        {
            var content  = _pageTemplateService.GetContentById(contentId);
            var statuses = _pageTemplateService.GetStatusIdsByContentId(contentId, out var hasWorkflow);

            return(Json(new
            {
                success = true,
                fields = string.Join(",", ServiceField.CreateAll()
                                     .Select(f => f.ColumnName).Concat(content.Fields.Select(x => x.Name))),
                statuses,
                hasWorkflow
            }));
        }
Пример #6
0
        public JsonResult GetFieldsByContentId(int contentId)
        {
            var content  = _pageTemplateService.GetContentById(contentId);
            var statuses = _pageTemplateService.GetStatusIdsByContentId(contentId, out var hasWorkflow);

            return(new JsonResult
            {
                Data = new
                {
                    success = true,
                    fields = string.Join(",", ServiceField.CreateAll().Select(f => f.ColumnName).Concat(content.Fields.Select(x => x.Name))),
                    statuses,
                    hasWorkflow
                },
                JsonRequestBehavior = JsonRequestBehavior.DenyGet
            });
        }