Beispiel #1
0
        /// <summary>
        /// Saves the edit model.
        /// </summary>
        public bool SaveAll()
        {
            using (IDbTransaction tx = Database.OpenConnection().BeginTransaction()) {
                try {
                    if (Permalink.IsNew)
                    {
                        Permalink.Name = Permalink.Generate(Category.Name);
                    }
                    Permalink.Save(tx);
                    Category.Save(tx);
                    foreach (var ext in Extensions)
                    {
                        // Call OnSave
                        ext.Body.OnManagerSave(Category);

                        ext.ParentId = Category.Id;
                        ext.Save(tx);
                    }
                    tx.Commit();
                } catch { tx.Rollback(); throw; }
            }
            Refresh();

            return(true);
        }
Beispiel #2
0
        public ActionResult Post(PostEditModel m)
        {
            ViewBag.Title = Piranha.Resources.Template.EditPostTitleNew;

            if (ModelState.IsValid)
            {
                try {
                    if (m.SaveAll())
                    {
                        ModelState.Clear();
                        ViewBag.Title = Piranha.Resources.Template.EditPostTitleExisting;
                        SuccessMessage(Piranha.Resources.Template.MessagePostSaved);
                    }
                    else
                    {
                        ErrorMessage(Piranha.Resources.Template.MessagePostNotSaved);
                    }
                } catch (DuplicatePermalinkException) {
                    // Manually set the duplicate error.
                    ModelState.AddModelError("Permalink", @Piranha.Resources.Global.PermalinkDuplicate);
                    // If this is the default permalink, remove the model state so it will be shown.
                    if (Permalink.Generate(m.Template.Name) == m.Permalink.Name)
                    {
                        ModelState.Remove("Permalink.Name");
                    }
                } catch (Exception e) {
                    ErrorMessage(e.ToString());
                }
            }
            return(View("PostEdit", m));
        }
Beispiel #3
0
        /// <summary>
        /// Saves the model.
        /// </summary>
        /// <returns>Whether the operation succeeded or not</returns>
        public bool SaveAll()
        {
            // Ensure correct naming convention for properties
            for (var n = 0; n < Template.Properties.Count; n++)
            {
                Template.Properties[n] = Template.Properties[n].Replace(" ", "_").Trim();
            }

            using (var tx = Database.OpenTransaction()) {
                // Permalink
                if (Permalink.IsNew && String.IsNullOrEmpty(Permalink.Name))
                {
                    Permalink.Name = Permalink.Generate(Template.Name);
                }
                Permalink.Save(tx);
                Template.Save(tx);

                // Clear all implementing posts from the cache
                var posts = Post.Get("post_template_id = @0", tx, Template.Id);
                foreach (var post in posts)
                {
                    post.InvalidateRecord(post);
                }

                tx.Commit();

                return(true);
            }
        }
Beispiel #4
0
	////TODO: Throw some kind of exception on failure.
	/// <summary>
	/// Save a post from Windows Live Writer to the database.
	/// </summary>
	/// <param name="blogid">The blog identifier string.</param>
	/// <param name="p">The post content and metadata</param>
	/// <param name="publish">Whether this is published or not. Currently 
	/// this flag is not supported by the views.</param>
	/// <returns>The post id number.</returns>
	public string SavePost(string blogid, Post p, bool publish)
	{
		SeqPost sp = new SeqPost();
		sp.BlogId = blogid;
		sp.Title = p.title;
		sp.Description = p.description;
		sp.ExtendedText = p.mt_text_more;
		sp.Excerpt = p.mt_excerpt;
		/* SQLServer can not deal with year < 1753, but dateCreated can be
		   year 1 when WLW2011 post date is not set. For practical 
		   purposes we use 1970 as the minimum date. */
		if (p.dateCreated.Year < 1970)
		   sp.CreateDate = DateTime.Now.ToUniversalTime();
		else
		   sp.CreateDate = p.dateCreated;

		sp.ModifiedDate = DateTime.Now.ToUniversalTime();
		sp.Published = publish;
		sp.Permalink = Permalink.Generate(sp.Title);
		UpdateCategories(p.categories.Length>0 ? p.categories[0] : "",sp);
		UpdateTags(p.mt_keywords, sp);
		db.SeqPosts.AddObject(sp);
		db.SaveChanges();
		return sp.PostId.ToString();
	}
Beispiel #5
0
        /// <summary>
        /// Saves the model.
        /// </summary>
        /// <returns>Whether the operation succeeded or not</returns>
        public bool SaveAll()
        {
            using (var tx = Database.OpenTransaction()) {
                // Permalink
                if (Permalink.IsNew && String.IsNullOrEmpty(Permalink.Name))
                {
                    Permalink.Name = Permalink.Generate(Template.Name);
                }
                Permalink.Save(tx);
                Template.Save(tx);

                tx.Commit();

                return(true);
            }
        }
Beispiel #6
0
        /// <summary>
        /// Saves the edit model.
        /// </summary>
        public bool SaveAll()
        {
            using (IDbTransaction tx = Database.OpenConnection().BeginTransaction()) {
                try {
                    if (Permalink.IsNew)
                    {
                        Permalink.Name = Permalink.Generate(Category.Name);
                    }
                    Permalink.Save(tx);
                    Category.Save(tx);
                    tx.Commit();
                } catch { tx.Rollback(); throw; }
            }
            Refresh();

            return(true);
        }
Beispiel #7
0
        public ActionResult Edit(bool draft, EditModel pm)
        {
            if (ModelState.IsValid)
            {
                try {
                    if (pm.SaveAll(draft))
                    {
                        ModelState.Clear();
                        if (!draft)
                        {
                            SuccessMessage(Piranha.Resources.Page.MessagePublished);
                        }
                        else
                        {
                            SuccessMessage(Piranha.Resources.Page.MessageSaved);
                        }
                    }
                    else
                    {
                        ErrorMessage(Piranha.Resources.Page.MessageNotSaved);
                    }
                } catch (DuplicatePermalinkException e) {
                    // Manually set the duplicate error.
                    ModelState.AddModelError("Permalink", @Piranha.Resources.Global.PermalinkDuplicate);
                    // If this is the default permalink, remove the model state so it will be shown.
                    if (Permalink.Generate(pm.Page.Title) == pm.Permalink.Name)
                    {
                        ModelState.Remove("Permalink.Name");
                    }
                } catch (Exception e) {
                    ErrorMessage(e.ToString());
                }
            }
            pm.Refresh();

            if (pm.Page.IsNew)
            {
                ViewBag.Title = Piranha.Resources.Page.EditTitleNew + pm.Template.Name.ToLower();
            }
            else
            {
                ViewBag.Title = Piranha.Resources.Page.EditTitleExisting;
            }

            return(View("Edit", pm));
        }
Beispiel #8
0
		/// <summary>
		/// Saves the model.
		/// </summary>
		/// <returns>Whether the operation succeeded or not</returns>
		public bool SaveAll() {
			using (var tx = Database.OpenTransaction()) {
				// Permalink
				if (Permalink.IsNew && String.IsNullOrEmpty(Permalink.Name))
					Permalink.Name = Permalink.Generate(Template.Name);
				Permalink.Save(tx);
				Template.Save(tx);

				// Clear all implementing posts from the cache
				var posts = Post.Get("post_template_id = @0", tx, Template.Id);
				foreach (var post in posts)
					post.InvalidateRecord(post);

				tx.Commit();

				return true;
			}
		}
Beispiel #9
0
	public bool UpdatePost(Post p, bool publish) 
	{
		SeqPost sp = GetPost(Convert.ToInt32(p.postid)).SingleOrDefault<SeqPost>();
		string oldCatName = sp.SeqCategory.Name;
		sp.Title = p.title;
		sp.Description = p.description;
		sp.ExtendedText = p.mt_text_more;
		sp.Excerpt = p.mt_excerpt;
		/* Should this be set to p.CreateDate instead? */
		sp.ModifiedDate = DateTime.Now.ToUniversalTime();
		sp.Published = publish;
		sp.Permalink = Permalink.Generate(sp.Title);
		UpdateCategories(p.categories.Length > 0 ? p.categories[0] : "",sp);
		/*UpdateBooks(sp,oldcat,newcat) run in UpdateCategories due to the
		   possibility of recategorization of a post. */
	   UpdateTags(p.mt_keywords, sp);
		db.SaveChanges();
		return true;
	}
Beispiel #10
0
        public ActionResult Edit(bool draft, EditModel pm)
        {
            if (ModelState.IsValid)
            {
                try {
                    // Executes the page edit before save hook, if registered
                    if (Hooks.Manager.Page.Model.OnBeforeSave != null)
                    {
                        Hooks.Manager.Page.Model.OnBeforeSave(this, WebPages.Manager.GetActiveMenuItem(), pm);
                    }

                    if (pm.SaveAll(draft))
                    {
                        // Executes the page edit after save hook, if registered
                        if (Hooks.Manager.Page.Model.OnAfterSave != null)
                        {
                            Hooks.Manager.Page.Model.OnAfterSave(this, WebPages.Manager.GetActiveMenuItem(), pm);
                        }

                        ModelState.Clear();
                        if (!draft)
                        {
                            if (pm.Page.Published == pm.Page.LastPublished)
                            {
                                SuccessMessage(Piranha.Resources.Page.MessagePublished);
                            }
                            else
                            {
                                SuccessMessage(Piranha.Resources.Page.MessageUpdated);
                            }
                        }
                        else
                        {
                            SuccessMessage(Piranha.Resources.Page.MessageSaved);
                        }
                    }
                    else
                    {
                        ErrorMessage(Piranha.Resources.Page.MessageNotSaved);
                    }
                } catch (DuplicatePermalinkException) {
                    // Manually set the duplicate error.
                    ModelState.AddModelError("Permalink", @Piranha.Resources.Global.PermalinkDuplicate);
                    // If this is the default permalink, remove the model state so it will be shown.
                    if (Permalink.Generate(pm.Page.Title) == pm.Permalink.Name)
                    {
                        ModelState.Remove("Permalink.Name");
                    }
                } catch (Exception e) {
                    ErrorMessage(e.ToString());
                }
            }
            pm.Refresh();

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

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

            if (pm.Page.OriginalId != Guid.Empty)
            {
                return(View(@"~/Areas/Manager/Views/Page/EditCopy.cshtml", pm));
            }
            return(View(@"~/Areas/Manager/Views/Page/Edit.cshtml", pm));
        }
Beispiel #11
0
        /// <summary>
        /// Saves the page and all of it's related regions.
        /// </summary>
        /// <param name="publish">If the page should be published</param>
        /// <returns>If the operation succeeded</returns>
        public virtual bool SaveAll(bool draft = true)
        {
            using (IDbTransaction tx = Database.OpenConnection().BeginTransaction()) {
                try {
                    bool permalinkfirst = Page.IsNew;

                    // Save permalink first if the page is new
                    if (permalinkfirst)
                    {
                        if (Permalink.IsNew && String.IsNullOrEmpty(Permalink.Name))
                        {
                            Permalink.Name = Permalink.Generate(!String.IsNullOrEmpty(Page.NavigationTitle) ?
                                                                Page.NavigationTitle : Page.Title);
                            var param = SysParam.GetByName("HIERARCHICAL_PERMALINKS");
                            if (param != null && param.Value == "1" && Page.ParentId != Guid.Empty)
                            {
                                var parent = Page.GetSingle(Page.ParentId, true);
                                Permalink.Name = parent.Permalink + "/" + Permalink.Name;
                            }
                        }
                        Permalink.Save(tx);
                    }

                    // Save page
                    if (draft)
                    {
                        Page.Save(tx);
                    }
                    else
                    {
                        Page.SaveAndPublish(tx);
                    }

                    // Save regions & properties
                    Regions.ForEach(r => {
                        r.IsDraft = r.IsPageDraft = true;

                        // Call OnSave
                        r.Body.OnManagerSave(Page);

                        r.Save(tx);
                        if (!draft)
                        {
                            if (Region.GetScalar("SELECT COUNT(region_id) FROM region WHERE region_id=@0 AND region_draft=0", r.Id) == 0)
                            {
                                r.IsNew = true;
                            }
                            r.IsDraft = r.IsPageDraft = false;
                            r.Save(tx);
                        }
                    });
                    Properties.ForEach(p => {
                        p.IsDraft = true;
                        p.Save(tx);
                        if (!draft)
                        {
                            if (Property.GetScalar("SELECT COUNT(property_id) FROM property WHERE property_id=@0 AND property_draft=0", p.Id) == 0)
                            {
                                p.IsNew = true;
                            }
                            p.IsDraft = false;
                            p.Save(tx);
                        }
                    });

                    // Save extensions
                    foreach (var ext in Extensions)
                    {
                        // Call OnSave
                        ext.Body.OnManagerSave(Page);

                        ext.ParentId = Page.Id;
                        ext.Save(tx);
                        if (!draft)
                        {
                            if (Extension.GetScalar("SELECT COUNT(extension_id) FROM extension WHERE extension_id=@0 AND extension_draft=0", ext.Id) == 0)
                            {
                                ext.IsNew = true;
                            }
                            ext.IsDraft = false;
                            ext.Save(tx);
                        }
                    }

                    // Save permalink last if the page isn't new
                    if (!permalinkfirst)
                    {
                        Permalink.Save(tx);
                    }

                    // Change global last modified
                    if (!draft)
                    {
                        Web.ClientCache.SetSiteLastModified(tx);
                    }

                    // Clear cache for all post regions if we're publishing
                    if (!String.IsNullOrEmpty(Page.Permalink) && !draft)
                    {
                        foreach (var reg in Regions)
                        {
                            if (reg.Body is Extend.Regions.PostRegion)
                            {
                                ((Extend.Regions.PostRegion)reg.Body).ClearCache(Page, reg);
                            }
                        }
                    }

                    tx.Commit();

                    if (IsSite)
                    {
                        using (var db = new DataContext()) {
                            var site = db.SiteTrees.Where(s => s.Id == Page.SiteTreeId).Single();
                            site.MetaTitle       = SiteTree.MetaTitle;
                            site.MetaDescription = SiteTree.MetaDescription;
                            db.SaveChanges();
                        }
                        if (!draft)
                        {
                            PageModel.RemoveSitePageFromCache(Page.SiteTreeId);
                            WebPages.WebPiranha.RegisterDefaultHostNames();
                        }
                    }
                } catch { tx.Rollback(); throw; }
            }
            return(true);
        }
Beispiel #12
0
        public ActionResult Edit(bool draft, EditModel m)
        {
            if (ModelState.IsValid)
            {
                try {
                    if (m.SaveAll(draft))
                    {
                        ModelState.Clear();
                        if (!draft)
                        {
                            if (m.Post.Published == m.Post.LastPublished)
                            {
                                SuccessMessage(Piranha.Resources.Post.MessagePublished, true);
                            }
                            else
                            {
                                SuccessMessage(Piranha.Resources.Post.MessageUpdated, true);
                            }
                        }
                        else
                        {
                            SuccessMessage(Piranha.Resources.Post.MessageSaved, true);
                        }

                        return(RedirectToAction("edit", new { id = m.Post.Id, returl = ViewBag.ReturnUrl }));
                    }
                    else
                    {
                        ErrorMessage(Piranha.Resources.Post.MessageNotSaved);
                    }
                } catch (DuplicatePermalinkException) {
                    // Manually set the duplicate error.
                    ModelState.AddModelError("Permalink", @Piranha.Resources.Global.PermalinkDuplicate);
                    // If this is the default permalink, remove the model state so it will be shown.
                    if (Permalink.Generate(m.Post.Title) == m.Permalink.Name)
                    {
                        ModelState.Remove("Permalink.Name");
                    }
                } catch (Exception e) {
                    ErrorMessage(e.ToString());
                }
            }
            m.Refresh();

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

            if (m.Post.IsNew)
            {
                ViewBag.Title = Piranha.Resources.Post.EditTitleNew + m.Template.Name.ToLower();
            }
            else
            {
                ViewBag.Title = Piranha.Resources.Post.EditTitleExisting;
            }

            return(View(@"~/Areas/Manager/Views/Post/Edit.cshtml", m));
        }
Beispiel #13
0
        /// <summary>
        /// Saves the edit model.
        /// </summary>
        public bool SaveAll(bool draft)
        {
            var context = HttpContext.Current;
            var hasfile = UploadedFile != null || ServerFile != null;

            byte[]    data = null;
            WebClient web  = new WebClient();

            // Check if the original URL has been updated, and if so
            if (!Content.IsNew && !String.IsNullOrEmpty(Content.OriginalUrl))
            {
                var old = Content.GetSingle(Content.Id);
                if (old != null)
                {
                    if (Content.OriginalUrl != old.OriginalUrl)
                    {
                        FileUrl = Content.OriginalUrl;
                    }
                }
            }

            // Download file from web
            if (!hasfile && !String.IsNullOrEmpty(FileUrl))
            {
                data = web.DownloadData(FileUrl);
                Content.OriginalUrl = FileUrl;
                Content.LastSynced  = Convert.ToDateTime(web.ResponseHeaders[HttpResponseHeader.LastModified]);
            }

            var media = new MediaFileContent();

            if (hasfile)
            {
                if (UploadedFile != null)
                {
                    media.Filename    = UploadedFile.FileName;
                    media.ContentType = UploadedFile.ContentType;
                    using (var reader = new BinaryReader(UploadedFile.InputStream)) {
                        media.Body = reader.ReadBytes(Convert.ToInt32(UploadedFile.InputStream.Length));
                    }
                }
                else
                {
                    media.Filename    = ServerFile.Name;
                    media.ContentType = MimeType.Get(ServerFile.Name);
                    using (var stream = ServerFile.OpenRead()) {
                        media.Body = new byte[ServerFile.Length];
                        stream.Read(media.Body, 0, media.Body.Length);
                    }
                }
            }
            else if (data != null)
            {
                media.Filename    = FileUrl.Substring(FileUrl.LastIndexOf('/') + 1);
                media.ContentType = web.ResponseHeaders["Content-Type"];
                media.Body        = data;
            }
            else
            {
                media = null;
            }

            var saved = false;

            if (!Content.IsFolder)
            {
                // Only save permalinks for non-folders
                var filename = !String.IsNullOrEmpty(Content.Filename) ? Content.Filename : (!String.IsNullOrEmpty(media.Filename) ? media.Filename : "");
                if (Permalink.IsNew && String.IsNullOrEmpty(Permalink.Name))
                {
                    Permalink.Name = Permalink.Generate(!Content.IsFolder ? filename : Content.Name, Models.Permalink.PermalinkType.MEDIA);
                }
                try {
                    Permalink.Save();
                } catch (DuplicatePermalinkException) {
                    if (Permalink.IsNew)
                    {
                        Permalink.Name = Content.Id + Permalink.Name.Substring(Permalink.Name.LastIndexOf('.'));
                        Permalink.Save();
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            else
            {
                Content.PermalinkId = Guid.Empty;
            }

            if (draft)
            {
                saved = Content.Save(media);
            }
            else
            {
                saved = Content.SaveAndPublish(media);
            }

            if (saved)
            {
                // Save related information
                Relation.DeleteByDataId(Content.Id);
                List <Relation> relations = new List <Relation>();
                ContentCategories.ForEach(c => relations.Add(new Relation()
                {
                    DataId = Content.Id, RelatedId = c, IsDraft = false, Type = Relation.RelationType.CONTENTCATEGORY
                })
                                          );
                relations.ForEach(r => r.Save());

                // Save extensions
                foreach (var ext in Extensions)
                {
                    // Call OnSave
                    ext.Body.OnManagerSave(Content);

                    ext.ParentId = Content.Id;
                    ext.Save();
                    if (!draft)
                    {
                        if (Extension.GetScalar("SELECT COUNT(extension_id) FROM extension WHERE extension_id=@0 AND extension_draft=0", ext.Id) == 0)
                        {
                            ext.IsNew = true;
                        }
                        ext.IsDraft = false;
                        ext.Save();
                    }
                }
                // Reset file url
                FileUrl = "";

                return(true);
            }
            return(false);
        }
Beispiel #14
0
        /// <summary>
        /// Saves the model.
        /// </summary>
        /// <returns>Weather the action was successful</returns>
        public bool SaveAll(bool draft = true)
        {
            using (IDbTransaction tx = Database.OpenConnection().BeginTransaction()) {
                try {
                    bool permalinkfirst = Post.IsNew;

                    // Save permalink before the post if this is an insert
                    if (permalinkfirst)
                    {
                        // Permalink
                        if (Permalink.IsNew)
                        {
                            Permalink.Name = Permalink.Generate(Post.Title);
                        }
                        Permalink.Save(tx);
                    }

                    // Post
                    if (draft)
                    {
                        Post.Save(tx);
                    }
                    else
                    {
                        Post.SaveAndPublish(tx);
                    }

                    // Save permalink after the post if this is an update
                    if (!permalinkfirst)
                    {
                        Permalink.Save(tx);
                    }
                    // Properties
                    Properties.ForEach(p => {
                        p.IsDraft = true;
                        p.Save(tx);
                        if (!draft)
                        {
                            if (Property.GetScalar("SELECT COUNT(property_id) FROM property WHERE property_id=@0 AND property_draft=0", p.Id) == 0)
                            {
                                p.IsNew = true;
                            }
                            p.IsDraft = false;
                            p.Save(tx);
                        }
                    });

                    // Update categories
                    Relation.DeleteByDataId(Post.Id, tx, true);
                    List <Relation> relations = new List <Relation>();
                    PostCategories.ForEach(pc => relations.Add(new Relation()
                    {
                        DataId = Post.Id, RelatedId = pc, Type = Relation.RelationType.POSTCATEGORY
                    })
                                           );
                    relations.ForEach(r => r.Save(tx));

                    // Publish categories
                    if (!draft)
                    {
                        Relation.DeleteByDataId(Post.Id, tx, false);
                        relations.ForEach(r => {
                            r.IsDraft = false;
                            r.IsNew   = true;
                        });
                        relations.ForEach(r => r.Save(tx));
                    }
                    tx.Commit();
                } catch { tx.Rollback(); throw; }
            }
            return(true);
        }
Beispiel #15
0
        /// <summary>
        /// Saves the page and all of it's related regions.
        /// </summary>
        /// <param name="publish">Weather the page should be published</param>
        /// <returns>Weather the operation succeeded</returns>
        public virtual bool SaveAll(bool draft = true)
        {
            using (IDbTransaction tx = Database.OpenConnection().BeginTransaction()) {
                try {
                    bool permalinkfirst = Page.IsNew;

                    // Save permalink first if the page is new
                    if (permalinkfirst)
                    {
                        if (Permalink.IsNew)
                        {
                            Permalink.Name = Permalink.Generate(!String.IsNullOrEmpty(Page.NavigationTitle) ?
                                                                Page.NavigationTitle : Page.Title);
                        }
                        Permalink.Save(tx);
                    }

                    // Save page
                    if (draft)
                    {
                        Page.Save(tx);
                    }
                    else
                    {
                        Page.SaveAndPublish(tx);
                    }

                    // Save regions & properties
                    Regions.ForEach(r => {
                        r.IsDraft = r.IsPageDraft = true;
                        r.Save(tx);
                        if (!draft)
                        {
                            if (Region.GetScalar("SELECT COUNT(region_id) FROM region WHERE region_id=@0 AND region_draft=0", r.Id) == 0)
                            {
                                r.IsNew = true;
                            }
                            r.IsDraft = r.IsPageDraft = false;
                            r.Save(tx);
                        }
                    });
                    Properties.ForEach(p => {
                        p.IsDraft = true;
                        p.Save(tx);
                        if (!draft)
                        {
                            if (Property.GetScalar("SELECT COUNT(property_id) FROM property WHERE property_id=@0 AND property_draft=0", p.Id) == 0)
                            {
                                p.IsNew = true;
                            }
                            p.IsDraft = false;
                            p.Save(tx);
                        }
                    });

                    // Save permalink last if the page isn't new
                    if (!permalinkfirst)
                    {
                        Permalink.Save(tx);
                    }

                    // Change global last modified
                    if (!draft)
                    {
                        Web.ClientCache.SetSiteLastModified(tx);
                    }

                    tx.Commit();
                } catch { tx.Rollback(); throw; }
            }
            return(true);
        }