public virtual ActionResult Install(InstallModuleModel installModel, string @return) { var data = new JsonResultData(ModelState); if (ModelState.IsValid) { data.RunWithTry((resultData) => { var moduleFile = this.Request.Files["ModuleFile"]; StringBuilder log = new StringBuilder(); var moduleName = System.IO.Path.GetFileNameWithoutExtension(moduleFile.FileName); var moduleInfo = Manager.Install(moduleName, moduleFile.InputStream, ref log); if (moduleInfo == null && log.Length != 0) { data.Success = false; data.AddMessage(log.ToString()); } else { if (!string.IsNullOrEmpty(moduleInfo.InstallingTemplate)) { data.RedirectUrl = Url.Action("OnInstalling", ControllerContext.RequestContext.AllRouteValues().Merge("ModuleName", moduleInfo.ModuleName)); } else { 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 ResetAll(string repositoryName) { var data = new JsonResultData(ModelState); if (ModelState.IsValid) { data.RunWithTry((resultData) => { var repository = Kooboo.CMS.Content.Services.ServiceFactory.RepositoryManager.Get(repositoryName); var count = _service.ResetSchema(repository); data.AddMessage(String.Format("Reset {0} Schemas", count)); }); } return Json(data); }
public virtual ActionResult ResetSpecified(Schema[] model, string repositoryName) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { if (model != null) { var repository = Kooboo.CMS.Content.Services.ServiceFactory.RepositoryManager.Get(repositoryName); var count = _service.ResetSchema(repository, model); data.AddMessage(String.Format("Reset {0} Schemas", count)); } }); return Json(data); }
public override ActionResult Edit(CMS.Sites.Models.View newModel, string old_key, string @return) { var data = new JsonResultData(ModelState); if (ModelState.IsValid) { data.RunWithTry((resultData) => { newModel.UserName = User.Identity.Name; Update(newModel, old_key); data.AddMessage("The item has been saved.".Localize()); }); } return(Json(data)); }
public ActionResult Index(string siteName, ModuleInfo_Metadata moduleInfo) { JsonResultData resultEntry = new JsonResultData(ModelState); try { if (ModelState.IsValid) { ModuleInfo.SaveModuleSetting(ModuleName, siteName, moduleInfo.Settings); resultEntry.AddMessage("Module setting has been changed.".Localize()); } } catch (Exception e) { resultEntry.AddException(e); } return(Json(resultEntry)); }
public virtual ActionResult ResetTemplates(Schema[] model) { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { if (model != null) { foreach (var item in model) { ResetForm(item); } data.AddMessage("The templates have been reset.".Localize()); } }); return(Json(data)); }
public virtual ActionResult ClearCache() { var data = new JsonResultData(ModelState); data.RunWithTry((resultData) => { Site.ClearCache(); var repository = Site.GetRepository(); if (repository != null) { repository.ClearCache(); } CacheManagerFactory.DefaultCacheManager.ClearGlobalObjectCache(); data.AddMessage("The site cache has been cleared.".Localize()); }); return(Json(data)); }