Ejemplo n.º 1
0
        public virtual ActionResult BatchPublish(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[] { true }, User.Identity.Name);
                    }

                }

                entry.SetSuccess();
            }
            catch (Exception e)
            {
                entry.AddException(e);
            }
            return Json(entry);
        }
Ejemplo n.º 2
0
        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");
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
        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);
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
        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);
        }
Ejemplo n.º 15
0
        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();
        }
Ejemplo n.º 16
0
 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);
 }
Ejemplo n.º 17
0
 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);
 }
Ejemplo n.º 18
0
        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);
        }
Ejemplo n.º 19
0
 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);
 }