public virtual ActionResult Copy(CopyModel copyModel, string @return) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { Manager.Copy(Repository, copyModel.UUID, copyModel.DestinationName); data.RedirectUrl = @return; }); return(Json(data)); }
public virtual ActionResult Index(string body) { JsonResultData data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { Robots_Txt robot_txt = new Robots_Txt(Site); robot_txt.Save(body); data.AddMessage("The robots.txt has been saved.".Localize()); }); return(Json(data)); }
public virtual ActionResult Delete(Workflow[] model) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { Manager.Delete(model, Repository); resultData.ReloadPage = true; }); return(Json(data)); }
public virtual ActionResult CreateEx(Page model, bool?setPublished, string @return, string PageOrders) { var data = new JsonResultData() { RedirectUrl = @return }; if (ModelState.IsValid) { data.RunWithTry((resultData) => { var parentPage = ControllerContext.RequestContext.GetRequestValue("parentPage"); Page parent = null; if (!string.IsNullOrWhiteSpace(parentPage)) { parent = PageHelper.Parse(Site, parentPage); } model.Parent = parent; SavePosition(model); model.UserName = User.Identity.Name; if (setPublished.HasValue && setPublished.Value == true) { model.Published = true; } else { model.Published = false; } Manager.Add(Site, parentPage, model); if (!string.IsNullOrEmpty(PageOrders)) { var pageOrders = PageOrders.Split(new[] { "|" }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < pageOrders.Length - 1; i++) { if (pageOrders[i] == "!NEWPAGE!") { pageOrders[i] = model.FullName; } } Manager.SortPages(Site, parent == null ? "" : parent.FullName, pageOrders); } resultData.RedirectUrl = @return; }); } return(Json(data)); }
public virtual ActionResult Import(bool @override, string @return) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { var file = Request.Files[0]; Manager.Import(Repository, file.InputStream, @override); data.RedirectUrl = @return; }); return(Json(data)); }
public virtual ActionResult Unlocalize(T o, string @return) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { Remove(o); resultData.ReloadPage = true; }); return(Json(data)); }
public virtual ActionResult Revert(string uuid, int version, string @return) { var data = new JsonResultData(ModelState); var htmlBlock = new HtmlBlock(Site, uuid); data.RunWithTry((resultData) => { VersionManager.Revert <HtmlBlock>(htmlBlock, version); data.RedirectUrl = @return; }); return(Json(data)); }
public override ActionResult Unlocalize(Page o, string @return) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { o.Site = Site; Manager.Unlocalize(o); resultData.RedirectUrl = @return; }); return(Json(data)); }
public virtual ActionResult CreateFolder(string folderPath, string folderName, string @return) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { FileManager.AddDirectory(Site, folderPath, folderName); data.ReloadPage = true; }); return(Json(data)); }
public ActionResult PublishTextContent(CreateTextContentPublishingQueueViewModel model, string @return) { var resultEntry = new JsonResultData(ModelState); if (ModelState.IsValid) { if (model.Schedule && !model.UtcTimeToPublish.HasValue && !model.UtcTimeToUnpublish.HasValue) { resultEntry.AddErrorMessage("UtcTimeToPublish and UtcTimeToUnpublish can not be both empty".Localize()); } else if (model.Schedule) { TextFolder textFolder = new TextFolder(Repository.Current, model.LocalFolderId).AsActual(); for (int i = 0, j = model.TextContents.Length; i < j; i++) { var content = textFolder.CreateQuery().WhereEquals("UUID", model.TextContents[i]).FirstOrDefault(); var queue = new LocalPublishingQueue(Site, Kooboo.UniqueIdGenerator.GetInstance().GetBase32UniqueId(10)) { PublishingObject = PublishingObject.TextContent, UserId = User.Identity.Name, UtcCreationDate = DateTime.UtcNow, ObjectUUID = content.IntegrateId, ObjectTitle = model.ObjectTitles[i], Status = QueueStatus.Pending }; if (model.UtcTimeToPublish.HasValue) { queue.UtcTimeToPublish = model.UtcTimeToPublish.Value.ToUniversalTime(); } if (model.UtcTimeToUnpublish.HasValue) { queue.UtcTimeToUnpublish = model.UtcTimeToUnpublish.Value.ToUniversalTime(); } resultEntry.RunWithTry((data) => { _manager.Add(queue); }); } resultEntry.RedirectUrl = @return; } else { TextFolder textFolder = new TextFolder(Repository.Current, model.LocalFolderId).AsActual(); foreach (string uuid in model.TextContents) { Kooboo.CMS.Content.Services.ServiceFactory.TextContentManager.Update(textFolder, uuid, "Published", true, User.Identity.Name); } resultEntry.RedirectUrl = @return; } } return(Json(resultEntry)); }
/// <summary> /// Renames the specified folder name. /// </summary> /// <param name="folderName">Name of the folder.</param> /// <param name="uuid">The UUID.</param> /// <param name="name">The name.</param> /// <returns></returns> public virtual ActionResult RenameFile(string folderName, string uuid, string name, string @return) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { ServiceFactory.MediaContentManager.Move(Repository, folderName, uuid, folderName, name); resultData.RedirectUrl = @return; }); return(Json(data)); }
public virtual ActionResult Publish(string uuid, string folderName, bool published) { var folder = FolderManager.Get(Repository, folderName); var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { ContentManager.Update(folder, uuid, new string[] { "Published" }, new object[] { published }); }); return(Json(data)); }
public ActionResult PublishPage(RemotePagePublishingModel model, string @return) { var resultEntry = new JsonResultData(ModelState); if (ModelState.IsValid) { if (model.Schedule && !model.UtcTimeToPublish.HasValue && !model.UtcTimeToUnpublish.HasValue) { resultEntry.AddErrorMessage("UtcTimeToPublish and UtcTimeToUnpublish can not be both empty."); } else { foreach (string uuid in model.Pages) { foreach (string endpoint in model.RemoteEndPoints) { var queue = new RemotePublishingQueue() { PublishingObject = PublishingObject.Page, SiteName = Site.Name, UserId = User.Identity.Name, UtcCreationDate = DateTime.UtcNow, RemoteEndpoint = endpoint, ObjectUUID = uuid, ObjectTitle = uuid, Status = QueueStatus.Pending }; if (model.Schedule) { if (model.UtcTimeToPublish.HasValue) { queue.UtcTimeToPublish = model.UtcTimeToPublish.Value.ToUniversalTime(); } if (model.UtcTimeToUnpublish.HasValue) { queue.UtcTimeToUnpublish = model.UtcTimeToUnpublish.Value.ToUniversalTime(); } } else { queue.UtcTimeToPublish = DateTime.UtcNow; } resultEntry.RunWithTry((data) => { _manager.Add(queue); }); } } resultEntry.RedirectUrl = @return; } } return(Json(resultEntry)); }
public ActionResult PublishPage(LocalPagePublishingModel model, string @return) { var resultEntry = new JsonResultData(ModelState); if (ModelState.IsValid) { if (model.Schedule && !model.UtcTimeToPublish.HasValue && !model.UtcTimeToUnpublish.HasValue) { resultEntry.AddErrorMessage("UtcTimeToPublish and UtcTimeToUnpublish can not be both empty".Localize()); } else if (model.Schedule) { foreach (string uuid in model.Pages) { var queue = new LocalPublishingQueue() { PublishingObject = PublishingObject.Page, SiteName = Site.Name, UserId = User.Identity.Name, UtcCreationDate = DateTime.UtcNow, ObjectUUID = uuid, ObjectTitle = uuid, Status = QueueStatus.Pending }; if (model.UtcTimeToPublish.HasValue) { queue.UtcTimeToPublish = model.UtcTimeToPublish.Value.ToUniversalTime(); } if (model.UtcTimeToUnpublish.HasValue) { queue.UtcTimeToUnpublish = model.UtcTimeToUnpublish.Value.ToUniversalTime(); } resultEntry.RunWithTry((data) => { _manager.Add(queue); }); } resultEntry.RedirectUrl = @return; } else { foreach (string uuid in model.Pages) { var page = new Page(Site, uuid); Kooboo.CMS.Sites.Services.ServiceFactory.PageManager.Publish(page, false, false, false, DateTime.UtcNow, DateTime.UtcNow, User.Identity.Name); } resultEntry.RedirectUrl = @return; } } return(Json(resultEntry)); }
public virtual ActionResult Revert(string uuid, int version, string @return) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { var page = new Page(Site, uuid); Manager.VersiongLogger.Revert(page, version, User.Identity.Name); resultData.RedirectUrl = @return; }); return(Json(data)); }
public virtual ActionResult Revert(View view, int version, string @return) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { view.Site = Site; VersionManager.Revert <View>(view, version); resultData.RedirectUrl = @return; }); return(Json(data)); }
public virtual ActionResult SaveFile(string siteName, string filePath, string fileContent, bool?_draft_) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { // save content filePath = Server.MapPath(filePath); System.IO.File.WriteAllText(filePath, fileContent, System.Text.Encoding.UTF8); ThemeManager.FlushWebResourceCache(Site, null); }); return(Json(data)); }
public virtual ActionResult Delete1(Page model, string @return) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { Remove(model); data.RedirectUrl = @return; }); return(Json(data)); }
public virtual ActionResult Revert(string uuid, int version, string @return) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { var layout = new Layout(Site, uuid); Kooboo.CMS.Sites.Versioning.VersionManager.Revert(layout, version, User.Identity.Name); resultData.RedirectUrl = @return; }); return(Json(data, JsonRequestBehavior.AllowGet)); }
public virtual ActionResult Create(CreateUserModel model, string @return) { var data = new JsonResultData(ModelState); if (ModelState.IsValid) { data.RunWithTry((resultData) => { UserManager.Add(model.ToUser()); data.RedirectUrl = @return; }); } return(Json(data)); }
public virtual ActionResult ResetPassword(ResetPasswordModel password, string @return) { var data = new JsonResultData(ModelState); if (ModelState.IsValid) { data.RunWithTry((resultData) => { UserManager.ChangePassword(password.UserName, password.NewPassword); data.RedirectUrl = @return; }); } return(Json(data)); }
public virtual ActionResult Delete(User[] model) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { foreach (var user in model) { UserManager.Delete(user.UserName); } resultData.ReloadPage = true; }); return(Json(data)); }
public virtual ActionResult Localize(HtmlBlock[] model) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { foreach (var item in model) { Manager.Localize(item.UUID, Site); } data.ReloadPage = true; }); return(Json(data)); }
public virtual ActionResult Import(bool @override, string @return) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { if (Request.Files.Count > 0 && Request.Files[0].ContentLength > 0) { Manager.Provider.Import(Site, Request.Files[0].InputStream, @override); } data.RedirectUrl = @return; }); return(Json(data, "text/plain", System.Text.Encoding.UTF8)); }
public virtual ActionResult EditTemplate(string uuid, FormType formType, string body, string @return) { var data = new JsonResultData(ModelState); if (ModelState.IsValid) { data.RunWithTry((resultData) => { Manager.SaveForm(Repository, uuid, body, formType); resultData.RedirectUrl = @return; }); } return(Json(data)); }
public virtual ActionResult RevertTo(string folderName, string schemaName, string uuid, Kooboo.CMS.Content.Versioning.VersionInfo[] model, string @return) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { if (model.Length == 1) { TextContentManager.RevertTo(Repository, folderName, schemaName, uuid, model[0].Version, User.Identity.Name); resultData.RedirectUrl = @return; } }); return(Json(data)); }
public virtual ActionResult Settings(Site model) { JsonResultData data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { if (ModelState.IsValid) { var site = Site.AsActual(); //if (isNew) //{ // CreateRepository(model.Repository); //} site.DisplayName = model.DisplayName; site.Culture = model.Culture; site.Domains = model.Domains; site.SitePath = model.SitePath; site.Mode = model.Mode; site.Repository = model.Repository; site.Theme = model.Theme; site.Version = model.Version; site.InlineEditing = model.InlineEditing; site.ShowSitemap = model.ShowSitemap; site.Smtp = model.Smtp; site.Security = model.Security; site.ResourceDomain = model.ResourceDomain; if (site.Smtp != null && site.Smtp.To != null) { site.Smtp.To = site.Smtp.To.Where(it => !string.IsNullOrEmpty(it)).ToArray(); } site.CustomFields = model.CustomFields; site.EnableVersioning = model.EnableVersioning; site.EnableJquery = model.EnableJquery; site.EnableStyleEdting = model.EnableStyleEdting; site.TimeZoneId = model.TimeZoneId; site.HtmlMeta = model.HtmlMeta; site.Membership = model.Membership; site.SSLDetection = model.SSLDetection; site.UserAgent = model.UserAgent; ServiceFactory.SiteManager.Update(site); resultData.AddMessage("Site setting has been changed.".Localize()); } }); return(Json(data)); }
public virtual ActionResult UpdateContent(string schema, string uuid, string fieldName, string value) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { var schemaObject = new Schema(Repository.Current, schema).AsActual(); var fieldValue = Binder.ConvertToColumnType(schemaObject, fieldName, value); Kooboo.CMS.Content.Services.ServiceFactory.TextContentManager.Update(Repository.Current, schemaObject, uuid, fieldName, fieldValue, User.Identity.Name); }); return(Json(data)); }
public ActionResult Import(string name, string @return) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { if (Request.Files.Count > 0 && Request.Files[0].ContentLength > 0) { _provider.Import(name, Request.Files[0].InputStream); } data.RedirectUrl = @return; }); return(Json(data, "text/plain", System.Text.Encoding.UTF8)); }
public virtual ActionResult Edit(Kooboo.CMS.Membership.Models.Membership model, string @return) { JsonResultData data = new JsonResultData(ModelState); if (ModelState.IsValid) { data.RunWithTry((resultData) => { _manager.Update(model, model); resultData.RedirectUrl = @return; }); } return(Json(data)); }