Exemplo n.º 1
0
        public ActionResult Delete(string id)
        {
            EditModel pm = EditModel.GetById(new Guid(id), true);

            try {
                if (pm.DeleteAll())
                {
                    SuccessMessage(Piranha.Resources.Page.MessageDeleted, true);
                }
                else
                {
                    ErrorMessage(Piranha.Resources.Page.MessageNotDeleted, true);
                }
            } catch (Exception e) {
                ErrorMessage(e.ToString(), true);
            }
            // Get the site page for the deleted page so we position ourselves correctly
            var p = Page.GetSingle("page_parent_id=@0", pm.Page.SiteTreeId);

            if (p != null)
            {
                return(RedirectToAction("index", new { id = p.Id }));
            }
            return(RedirectToAction("index"));
        }
 public ActionResult GetSingle(Guid?id)
 {
     if (id.HasValue)
     {
         return(JsonData(true, EditModel.GetById(api, id.Value)));
     }
     return(JsonData(true, new EditModel()));
 }
Exemplo n.º 3
0
        public ActionResult Edit(string id)
        {
            EditModel pm = EditModel.GetById(new Guid(id));

            ViewBag.Title = Piranha.Resources.Page.EditTitleExisting;

            return(View("Edit", pm));
        }
Exemplo n.º 4
0
        public ActionResult Edit(Guid id)
        {
            var model = EditModel.GetById(api, id);

            ViewBag.Title    = Piranha.Manager.Resources.Post.EditTitle;
            ViewBag.SubTitle = model.Published.HasValue ?
                               ((model.Published.Value > DateTime.Now ? "Schedueled: " : "Published: ") + model.Published.Value.ToString("yyyy-MM-dd")) : "Unpublished";

            return(View(model));
        }
Exemplo n.º 5
0
        public ActionResult Sync(string id)
        {
            var m = EditModel.GetById(new Guid(id));

            try {
                if (m.Sync())
                {
                    if (m.Content.IsImage)
                    {
                        SuccessMessage(Piranha.Resources.Content.MessageImageSynced, true);
                    }
                    else
                    {
                        SuccessMessage(Piranha.Resources.Content.MessageDocumentSynced, true);
                    }
                }
                else
                {
                    if (m.Content.IsImage)
                    {
                        InformationMessage(Piranha.Resources.Content.MessageImageNotSynced, true);
                    }
                    else
                    {
                        InformationMessage(Piranha.Resources.Content.MessageDocumentNotSynced, true);
                    }
                }
            } catch (HttpException e) {
                if (e.GetHttpCode() == 404)
                {
                    if (m.Content.IsImage)
                    {
                        ErrorMessage(Piranha.Resources.Content.MessageImageNotFound, true);
                    }
                    else
                    {
                        ErrorMessage(Piranha.Resources.Content.MessageDocumentNotFound, true);
                    }
                }
                else
                {
                    if (m.Content.IsImage)
                    {
                        ErrorMessage(Piranha.Resources.Content.MessageImageSyncError, true);
                    }
                    else
                    {
                        ErrorMessage(Piranha.Resources.Content.MessageDocumentSyncError, true);
                    }
                }
            }
            return(RedirectToAction("edit", new { id = id, returl = ViewBag.ReturnUrl }));
        }
 public ActionResult Edit(Guid?id = null)
 {
     if (id.HasValue)
     {
         ViewBag.Title = Piranha.Manager.Resources.PostType.EditTitle;
         return(View(EditModel.GetById(api, id.Value)));
     }
     else
     {
         ViewBag.Title = Piranha.Manager.Resources.PostType.AddTitle;
         return(View(new EditModel()));
     }
 }
Exemplo n.º 7
0
 public ActionResult Detach(string id)
 {
     ViewBag.Title = Piranha.Resources.Page.EditTitleExisting;
     if (EditModel.Detach(new Guid(id)))
     {
         SuccessMessage(@Piranha.Resources.Page.MessageDetached);
         return(View(@"~/Areas/Manager/Views/Page/Edit.cshtml", EditModel.GetById(new Guid(id))));
     }
     else
     {
         ErrorMessage(@Piranha.Resources.Page.MessageNotDetached);
         return(View(@"~/Areas/Manager/Views/Page/EditCopy.cshtml", EditModel.GetById(new Guid(id))));
     }
 }
Exemplo n.º 8
0
        public ActionResult Delete(string id)
        {
            EditModel m = EditModel.GetById(new Guid(id));

            if (m.DeleteAll())
            {
                SuccessMessage(Piranha.Resources.Category.MessageDeleted);
            }
            else
            {
                ErrorMessage(Piranha.Resources.Category.MessageNotDeleted);
            }
            return(RedirectToAction("index"));
        }
Exemplo n.º 9
0
        public ActionResult Edit(string id = "")
        {
            EditModel m = new EditModel();

            if (id != "")
            {
                m             = EditModel.GetById(new Guid(id));
                ViewBag.Title = Piranha.Resources.Category.EditTitleExisting;
            }
            else
            {
                ViewBag.Title = Piranha.Resources.Category.EditTitleNew;
            }
            return(View("Edit", m));
        }
Exemplo n.º 10
0
        public ActionResult Delete(string id)
        {
            EditModel pm = EditModel.GetById(new Guid(id));

            if (pm.DeleteAll())
            {
                SuccessMessage(Piranha.Resources.Post.MessageDeleted);
            }
            else
            {
                ErrorMessage(Piranha.Resources.Post.MessageNotDeleted);
            }

            return(Index());
        }
Exemplo n.º 11
0
        public ActionResult Delete(string id)
        {
            EditModel m = EditModel.GetById(new Guid(id));

            if (m.DeleteAll())
            {
                if (m.Content.IsImage)
                {
                    SuccessMessage(Piranha.Resources.Content.MessageImageDeleted, true);
                }
                else if (m.Content.IsFolder)
                {
                    SuccessMessage(Piranha.Resources.Content.MessageFolderDeleted, true);
                }
                else
                {
                    SuccessMessage(Piranha.Resources.Content.MessageDocumentDeleted, true);
                }
            }
            else
            {
                if (m.Content.IsImage)
                {
                    ErrorMessage(Piranha.Resources.Content.MessageImageNotDeleted, true);
                }
                else if (m.Content.IsFolder)
                {
                    ErrorMessage(Piranha.Resources.Content.MessageFolderNotDeleted, true);
                }
                else
                {
                    ErrorMessage(Piranha.Resources.Content.MessageDocumentNotDeleted, true);
                }
            }
            if (!String.IsNullOrEmpty(ViewBag.ReturnUrl))
            {
                return(Redirect(ViewBag.ReturnUrl));
            }
            if (m.Content.ParentId != Guid.Empty)
            {
                return(RedirectToAction("index", new { id = m.Content.ParentId }));
            }
            return(RedirectToAction("index"));
        }
Exemplo n.º 12
0
        public ActionResult Delete(string id)
        {
            EditModel pm = EditModel.GetById(new Guid(id));

            if (pm.DeleteAll())
            {
                SuccessMessage(Piranha.Resources.Post.MessageDeleted, true);
            }
            else
            {
                ErrorMessage(Piranha.Resources.Post.MessageNotDeleted, true);
            }

            if (!String.IsNullOrEmpty(ViewBag.ReturnUrl))
            {
                return(Redirect(ViewBag.ReturnUrl));
            }
            return(RedirectToAction("index"));
        }
Exemplo n.º 13
0
        public ActionResult Delete(string id)
        {
            EditModel pm = EditModel.GetById(new Guid(id), true);

            try {
                if (pm.DeleteAll())
                {
                    SuccessMessage(Piranha.Resources.Page.MessageDeleted);
                }
                else
                {
                    ErrorMessage(Piranha.Resources.Page.MessageNotDeleted);
                }
            } catch (Exception e) {
                ErrorMessage(e.ToString());
            }

            return(Index());
        }
Exemplo n.º 14
0
        public ActionResult Edit(string id = "")
        {
            EditModel m = id != "" ? EditModel.GetById(new Guid(id)) : new EditModel();

            if (m.Category.IsNew)
            {
                ViewBag.Title = Piranha.Resources.Category.EditTitleExisting;
            }
            else
            {
                ViewBag.Title = Piranha.Resources.Category.EditTitleNew;
            }

            // Executes the category edit loaded hook, if registered
            if (Hooks.Manager.Category.Model.OnLoad != null)
            {
                Hooks.Manager.Category.Model.OnLoad(this, WebPages.Manager.GetActiveMenuItem(), m);
            }

            return(View("Edit", m));
        }
Exemplo n.º 15
0
        public ActionResult Edit(string id)
        {
            EditModel m = EditModel.GetById(new Guid(id));

            if (!String.IsNullOrEmpty(Request["action"]))
            {
                if (Request["action"].ToLower() == "attachments")
                {
                    m.Action = EditModel.ActionType.ATTACHMENTS;
                }
            }
            ViewBag.Title = Piranha.Resources.Post.EditTitleExisting;

            // Executes the post edit loaded hook, if registered
            if (WebPages.Hooks.Manager.PostEditModelLoaded != null)
            {
                WebPages.Hooks.Manager.PostEditModelLoaded(this, WebPages.Manager.GetActiveMenuItem(), m);
            }

            return(View(@"~/Areas/Manager/Views/Post/Edit.cshtml", m));
        }
Exemplo n.º 16
0
        public ActionResult Edit(string id)
        {
            EditModel pm = EditModel.GetById(new Guid(id));

            if (!String.IsNullOrEmpty(Request["action"]))
            {
                if (Request["action"].ToLower() == "seo")
                {
                    ViewBag.ReturnUrl = Url.Action("seo", new { @id = pm.Page.SiteTreeInternalId.ToLower() });
                    pm.Action         = EditModel.ActionType.SEO;
                }
                else if (Request["action"].ToLower() == "attachments")
                {
                    pm.Action = EditModel.ActionType.ATTACHMENTS;
                }
            }

            if (!pm.IsSite)
            {
                ViewBag.Title = Piranha.Resources.Page.EditTitleExisting;
            }
            else
            {
                ViewBag.Title = Piranha.Resources.Global.Edit + " " + pm.SiteTree.Name.ToLower();
            }

            // Executes the page edit loaded hook, if registered
            if (Hooks.Manager.Page.Model.OnLoad != null)
            {
                Hooks.Manager.Page.Model.OnLoad(this, WebPages.Manager.GetActiveMenuItem(), pm);
            }

            if (pm.Page.OriginalId != Guid.Empty)
            {
                return(View(@"~/Areas/Manager/Views/Page/EditCopy.cshtml", pm));
            }
            return(View(@"~/Areas/Manager/Views/Page/Edit.cshtml", pm));
        }
Exemplo n.º 17
0
        public ActionResult Delete(string id)
        {
            EditModel m = EditModel.GetById(new Guid(id));

            if (m.DeleteAll())
            {
                if (m.Content.IsImage)
                {
                    SuccessMessage(Piranha.Resources.Content.MessageImageDeleted);
                }
                else if (m.Content.IsFolder)
                {
                    SuccessMessage(Piranha.Resources.Content.MessageFolderDeleted);
                }
                else
                {
                    SuccessMessage(Piranha.Resources.Content.MessageDocumentDeleted);
                }
            }
            else
            {
                if (m.Content.IsImage)
                {
                    ErrorMessage(Piranha.Resources.Content.MessageImageNotDeleted);
                }
                else if (m.Content.IsFolder)
                {
                    ErrorMessage(Piranha.Resources.Content.MessageFolderNotDeleted);
                }
                else
                {
                    ErrorMessage(Piranha.Resources.Content.MessageDocumentNotDeleted);
                }
            }
            return(Index());
        }
Exemplo n.º 18
0
 public ActionResult GetSingle(Guid id)
 {
     return(JsonData(true, EditModel.GetById(api, id)));
 }
Exemplo n.º 19
0
 public ActionResult Edit(string id)
 {
     return(EditInternal(EditModel.GetById(new Guid(id))));
 }