Beispiel #1
0
        public virtual ActionResult New(ArticleViewModel article)
        {
            ArticleHelper.ValidateArticle(article, ModelState);
            if (ModelState.IsValid)
            {
                var newArticle = article.MapTo(new Article
                {
                    UserId     = this.CorePrincipal() != null ? this.CorePrincipal().PrincipalId : (long?)null,
                    CreateDate = DateTime.Now
                });
                if (articleService.Save(newArticle))
                {
                    permissionService.SetupDefaultRolePermissions(OperationsHelper.GetOperations <ArticleOperations>(), typeof(Article), newArticle.Id);
                    Success(HttpContext.Translate("Messages.Success", String.Empty));
                    return(RedirectToAction(WebContentMVC.Article.Show()));
                }
            }
            else
            {
                Error(HttpContext.Translate("Messages.ValidationError", String.Empty));
            }

            article.AllowManage = true;
            return(View("New", article));
        }
Beispiel #2
0
        public virtual ActionResult New(FormViewModel form)
        {
            FormsHelper.ValidateForm(form, ModelState);
            if (ModelState.IsValid)
            {
                var newForm = form.MapTo(new Form {
                    UserId = this.CorePrincipal() != null ? this.CorePrincipal().PrincipalId : (long?)null
                });
                if (formsService.Save(newForm))
                {
                    permissionService.SetupDefaultRolePermissions(OperationsHelper.GetOperations <FormOperations>(), typeof(Form), newForm.Id);
                    Success(HttpContext.Translate("Messages.Success", String.Empty));
                    return(RedirectToAction(FormsMVC.Forms.Edit(newForm.Id)));
                }
            }

            Error(HttpContext.Translate("Messages.ValidationError", String.Empty));

            form.AllowManage = true;
            return(View("New", form));
        }
        public virtual ActionResult New(CategoryViewModel category)
        {
            if (ModelState.IsValid)
            {
                var newCategory = category.MapTo(new WebContentCategory {
                    UserId = this.CorePrincipal() != null ? this.CorePrincipal().PrincipalId : (long?)null
                });
                if (categoryService.Save(newCategory))
                {
                    permissionService.SetupDefaultRolePermissions(OperationsHelper.GetOperations <CategoryOperations>(), typeof(WebContentCategory), newCategory.Id);
                    Success(HttpContext.Translate("Messages.Success", String.Empty));
                    return(RedirectToAction(WebContentMVC.WebContentCategory.Show()));
                }
            }
            else
            {
                Error(HttpContext.Translate("Messages.ValidationError", String.Empty));
            }

            category.AllowManage = true;
            return(View("New", category));
        }
Beispiel #4
0
        public virtual ActionResult FormTabs(long formId, bool activeDetails, bool activeElements, bool activePermissions)
        {
            var form = formsService.Find(formId);

            if (form != null)
            {
                var result          = new List <MenuItemModel>();
                var formPermissions = permissionService.GetAccess(OperationsHelper.GetOperations <FormOperations>(), this.CorePrincipal(), typeof(Form), form.Id, IsFormOwner(form));
                if (formPermissions.ContainsKey((int)FormOperations.View) && formPermissions[(int)FormOperations.View])
                {
                    result.Add(new MenuItemModel
                    {
                        Title    = HttpContext.Translate("Tabs.Details", "Forms.Controllers"),
                        IsActive = activeDetails,
                        Url      = Url.Action("Edit", "Forms", new { formId = form.Id, Area = "Forms" })
                    });

                    result.Add(new MenuItemModel
                    {
                        Title    = HttpContext.Translate("Tabs.FormElements", "Forms.Controllers"),
                        IsActive = activeElements,
                        Url      = Url.Action("ShowFormElements", "Forms", new { formId = form.Id, Area = "Forms" })
                    });
                }
                if (formPermissions.ContainsKey((int)FormOperations.Permissions) && formPermissions[(int)FormOperations.Permissions])
                {
                    result.Add(new MenuItemModel
                    {
                        Title    = HttpContext.Translate("Tabs.Permissions", "Forms.Controllers"),
                        IsActive = activePermissions,
                        Url      = Url.Action("ShowPermissions", "Forms", new { formId = form.Id, Area = "Forms" })
                    });
                }

                return(PartialView("FormTabs", result));
            }

            return(Content(String.Empty));
        }
Beispiel #5
0
 public Plugin()
 {
     PermissionTitle = "Modules";
     Operations      = OperationsHelper.GetOperations <BaseEntityOperations>();
 }
 private LanguagesPlugin()
 {
     PermissionTitle = Title;
     Operations      = OperationsHelper.GetOperations <LanguagesPluginOperations>();
 }
Beispiel #7
0
 private FormsPlugin()
 {
     PermissionTitle = Title;
     Operations      = OperationsHelper.GetOperations <FormsPluginOperations>();
 }
 protected BaseWidget()
 {
     Operations = OperationsHelper.GetOperations <BaseWidgetOperations>();
 }
 private ProfilesPlugin()
 {
     PermissionTitle = Title;
     Operations      = OperationsHelper.GetOperations <ProfilesPluginOperations>();
 }
Beispiel #10
0
 private FormsBuilderWidget()
 {
     Operations = OperationsHelper.GetOperations <FormsBuilderWidgetOperations>();
 }
Beispiel #11
0
 private LanguageSelectorWidget()
 {
     Operations = OperationsHelper.GetOperations <LanguageSelectorWidgetOperations>();
 }