public override ActionResult Create(Layout model) { JsonResultEntry resultEntry = new JsonResultEntry() { Success = true }; try { if (ModelState.IsValid) { model.UserName = User.Identity.Name; Add(model); } resultEntry.SetSuccess(); var pageRedirect = Request.Form["pageRedirect"]; resultEntry.SetSuccess().RedirectUrl = pageRedirect.ToLower() == "false" ? Url.Action("Edit", ControllerContext.RequestContext.AllRouteValues().Merge("Name", model.Name)) : Url.Action("Index", this.ControllerContext.RequestContext.AllRouteValues()); } catch (Exception e) { resultEntry.SetFailed().AddException(e); } resultEntry.AddModelState(ViewData.ModelState); return(Json(resultEntry)); //return base.Create(model); }
public override ActionResult Edit(Layout newModel, string old_key) { JsonResultEntry resultEntry = new JsonResultEntry() { Success = true }; try { if (ModelState.IsValid) { newModel.UserName = User.Identity.Name; Update(newModel, old_key); resultEntry.SetSuccess(); //resultEntry.RedirectUrl = this.Url.Action("Index", this.ControllerContext.RequestContext.AllRouteValues()); var pageRedirect = Request.Form["pageRedirect"]; resultEntry.AddMessage("The item has been saved.".Localize()).SetSuccess().RedirectUrl = string.Equals(pageRedirect, "true", StringComparison.OrdinalIgnoreCase) ? this.Url.Action("Index", this.ControllerContext.RequestContext.AllRouteValues()) : null; } } catch (Exception e) { resultEntry.SetFailed().AddException(e); } resultEntry.AddModelState(ViewData.ModelState); return(Json(resultEntry)); }
public virtual ActionResult Copy(string folderName, string parentFolder, string[] docArr, string[] folderArr) { JsonResultEntry entry = new JsonResultEntry(); try { TextFolder textFolder = new TextFolder(Repository, folderName).AsActual(); var schema = textFolder.GetSchema().AsActual(); if (docArr != null) { foreach (var doc in docArr) { if (string.IsNullOrEmpty(doc)) { continue; } ServiceFactory.TextContentManager.Copy(textFolder.GetSchema(), doc); } } entry.ReloadPage = true; entry.SetSuccess(); } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult Delete(string[] model) { var entry = new JsonResultEntry(); try { foreach (var f in model) { if (string.IsNullOrEmpty(f)) { continue; } var folderPathArr = FolderHelper.SplitFullName(f); Manager.Remove(Repository, new TextFolder(Repository, folderPathArr)); } entry.SetSuccess(); } catch (Exception e) { entry.SetFailed().AddException(e); } return(Json(entry)); //return RedirectToIndex(); }
public virtual ActionResult Rebroadcast(string folderName, string parentFolder, string[] docArr, string[] folderArr) { JsonResultEntry entry = new JsonResultEntry(); try { TextFolder textFolder = new TextFolder(Repository, folderName).AsActual(); if (docArr != null) { foreach (var doc in docArr) { if (string.IsNullOrEmpty(doc)) { continue; } var textContent = textFolder.CreateQuery().WhereEquals("UUID", doc).FirstOrDefault(); if (textContent != null) { Kooboo.CMS.Content.EventBus.Content.ContentEvent.Fire(ContentAction.Add, textContent); } } } entry.SetSuccess(); } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult Delete(AssemblyFile[] model) { var entry = new JsonResultEntry(); try { if (model != null) { foreach (var fileName in model) { if (!string.IsNullOrEmpty(fileName.FileName)) { AssemblyManager.Delete(Site, fileName.FileName); } } } entry.SetSuccess(); } catch (Exception e) { entry.SetFailed().AddException(e); } return(Json(entry)); //return RedirectToAction("Index"); }
public virtual ActionResult BatchUnpublish(string folderName, string parentFolder, string[] docArr) { JsonResultEntry entry = new JsonResultEntry(); try { TextFolder textFolder = new TextFolder(Repository, folderName).AsActual(); var schema = textFolder.GetSchema().AsActual(); if (docArr != null) { foreach (var doc in docArr) { if (string.IsNullOrEmpty(doc)) { continue; } ServiceFactory.TextContentManager.Update(Repository, schema, doc, new string[] { "Published" }, new object[] { false }, User.Identity.Name); } } entry.SetSuccess(); } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult MovePage(CopyPageModel model, string fullName, string parentPage) { JsonResultEntry entry = new JsonResultEntry(); try { Manager.Move(Site, fullName, parentPage, model.CreateRedirect); entry.SetSuccess(); } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
/// <summary> /// Sorts the pages. /// </summary> /// <param name="fullName">The full name. The parent page name</param> /// <param name="pageNames">The page names order</param> /// <returns></returns> public virtual ActionResult SortPages(string fullName, string[] pageNames) { JsonResultEntry entry = new JsonResultEntry(); try { Manager.SortPages(Site, fullName, pageNames); entry.SetSuccess(); } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult RevertTo(string folderName, string schemaName, string uuid, int version) { var entry = new JsonResultEntry(); try { ServiceFactory.TextContentManager.RevertTo(Repository, folderName, schemaName, uuid, version, User.Identity.Name); entry.SetSuccess().AddMessage("Revert successfully."); } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult Create(SearchSetting model) { var entry = new JsonResultEntry(); try { model.Repository = Repository; Provider.Add(model); entry.SetSuccess(); } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult Delete(Workflow[] model) { var entry = new JsonResultEntry(); try { Manager.Delete(model, Repository); entry.SetSuccess(); } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult Copy(string sourceName, string destName) { var entry = new JsonResultEntry(); try { Manager.Copy(Site, sourceName, destName); entry.RedirectUrl = this.GetReturnUrl(); entry.SetSuccess(); } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult Process(string workflowName, string roleName, string name, bool passed, string comment) { JsonResultEntry entry = new JsonResultEntry(); try { Manager.ProcessPendingWorkflowItem(Repository, workflowName, roleName, name, User.Identity.Name, passed, comment); entry.SetSuccess(); } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult Revert(string name, int version) { var entry = new JsonResultEntry(); var htmlBlock = new HtmlBlock(Site, name); try { Manager.VersiongLogger.Revert(htmlBlock, version); entry.SetSuccess().AddMessage("Revert Successfully.".Localize()); } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult Revert(string fullName, int version) { var entry = new JsonResultEntry(); var page = new Page(Site, fullName); try { Manager.VersiongLogger.Revert(page, version); entry.SetSuccess().AddMessage("Revert Successfully."); } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult CopyPage(string sourcePage, string parentPage, string name) { JsonResultEntry entry = new JsonResultEntry(); var destPage = PageHelper.CombineFullName(new string[] { parentPage, name }); try { Manager.Copy(Site, sourcePage, destPage); entry.SetSuccess(); } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult Publish(string uuid, string folderName, bool published) { var folder = FolderManager.Get(Repository, folderName); JsonResultEntry entry = new JsonResultEntry(); try { ContentManager.Update(folder, uuid, new string[] { "Published" }, new object[] { published }); entry.SetSuccess(); } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult Copy(string sourceName, string destName) { var entry = new JsonResultEntry(); try { Manager.Copy(Repository, sourceName, destName); entry.RedirectUrl = Url.Action("Index", ControllerContext.RequestContext.AllRouteValues()); entry.ReloadPage = true; entry.SetSuccess(); } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult Delete(string folderName, string parentFolder, string[] docArr, string[] folderArr) { JsonResultEntry entry = new JsonResultEntry(); try { TextFolder textFolder = new TextFolder(Repository, folderName).AsActual(); var schema = textFolder.GetSchema().AsActual(); if (docArr != null) { foreach (var doc in docArr) { if (string.IsNullOrEmpty(doc)) { continue; } ServiceFactory.TextContentManager.Delete(Repository, textFolder, doc); } } if (folderArr != null) { foreach (var f in folderArr) { if (string.IsNullOrEmpty(f)) { continue; } var folderPathArr = FolderHelper.SplitFullName(f); ServiceFactory.TextFolderManager.Remove(Repository, new TextFolder(Repository, folderPathArr)); } } entry.SetSuccess(); } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult Delete(T[] model) { var entry = new JsonResultEntry(); try { foreach (var t in model) { Remove(t); } entry.SetSuccess(); } catch (Exception e) { entry.SetFailed().AddException(e); } return(Json(entry)); }
public virtual ActionResult Delete(PagePublishingQueueItem[] model) { var result = new JsonResultEntry(); try { foreach (var item in model) { item.Site = Site; ServiceFactory.PageManager.PagePublishingProvider.Remove(item); } result.SetSuccess(); } catch (Exception e) { result.SetFailed().AddException(e); } return(Json(result)); }
public virtual ActionResult TextFile(string folderName, string fileName, string body) { var entry = new JsonResultEntry(); try { MediaContent content = new MediaContent(Repository.Name, folderName); content.FileName = fileName; var contentPath = new MediaContentPath(content); Kooboo.IO.IOUtility.SaveStringToFile(contentPath.PhysicalPath, body); entry.SetSuccess(); } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult Delete(SendingSetting[] Model) { var entry = new JsonResultEntry(); try { if (Model != null) { foreach (var m in Model) { m.Repository = Repository; Manager.Remove(Repository, m); } } entry.SetSuccess(); } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult Create(SendingSetting sendingSetting) { var entry = new JsonResultEntry(); try { if (ModelState.IsValid) { Manager.Add(Repository, sendingSetting); entry.SetSuccess(); } else { entry.AddModelState(ModelState); } } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult Create(ReceivingSetting model, string repository) { var entry = new JsonResultEntry(); if (ModelState.IsValid) { try { Manager.Add(Repository, model); entry.SetSuccess(); } catch (Exception e) { entry.AddException(e); } } else { entry.AddModelState(ModelState); } return(Json(entry)); }
public virtual ActionResult Delete(string selectedFolders) { var entry = new JsonResultEntry(); try { var folderArr = selectedFolders.Split(','); foreach (var f in folderArr) { if (string.IsNullOrEmpty(f)) { continue; } FolderManager.Remove(Repository, new MediaFolder(Repository, f)); } entry.SetSuccess(); } catch (Exception e) { entry.SetFailed().AddException(e); } return(Json(entry)); }
public virtual ActionResult Edit(SearchSetting model) { var entry = new JsonResultEntry(); try { if (ModelState.IsValid) { model.Repository = Repository; Provider.Update(model, model); entry.SetSuccess(); } else { entry.AddModelState(ModelState).SetFailed(); } } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult Edit(SendingSetting @new) { var entry = new JsonResultEntry(); try { if (ModelState.IsValid) { @new.Repository = Repository; Manager.Update(Repository, @new, @new); entry.SetSuccess(); } else { entry.AddModelState(ModelState); } } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }
public virtual ActionResult Delete(SearchSetting[] model) { var entry = new JsonResultEntry(); try { if (model != null) { foreach (var m in model) { m.Repository = Repository; Provider.Remove(m); } entry.SetSuccess(); } } catch (Exception e) { entry.AddException(e); } return(Json(entry)); }