コード例 #1
0
        /// <summary>
        /// Handles the Click event of the Restore control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event
        /// data.</param>
        protected void CmdRestore_Click(object sender, System.EventArgs e)
        {
            if (this.Request.QueryString["ShowHistory"] != null)
            {
                string historyPK        = this.Request.QueryString["ShowHistory"];
                var    topicHistoryItem = TopicHistoryBo.GetItem(int.Parse(historyPK));
                topicHistoryItem.TabID          = this.TabId;
                topicHistoryItem.PortalSettings = this.PortalSettings;
                var topicHistoryBO = new DotNetNuke.Wiki.BusinessObjects.Models.TopicHistory();
                topicHistoryBO.TabID           = this.TabId;
                topicHistoryBO.PortalSettings  = this.PortalSettings;
                topicHistoryBO.Content         = CurrentTopic.Content;
                topicHistoryBO.TopicId         = this.TopicId;
                topicHistoryBO.UpdatedBy       = CurrentTopic.UpdatedBy;
                topicHistoryBO.UpdateDate      = CurrentTopic.UpdateDate;
                topicHistoryBO.Name            = this.PageTopic;
                topicHistoryBO.Title           = CurrentTopic.Title;
                topicHistoryBO.UpdatedByUserID = CurrentTopic.UpdatedByUserID;

                CurrentTopic.Content         = topicHistoryItem.Content;
                CurrentTopic.Name            = topicHistoryItem.Name;
                CurrentTopic.Title           = topicHistoryItem.Title;
                CurrentTopic.Keywords        = topicHistoryItem.Keywords;
                CurrentTopic.Description     = topicHistoryItem.Description;
                CurrentTopic.UpdatedBy       = UserInfo.Username;
                CurrentTopic.UpdateDate      = DateTime.Now;
                CurrentTopic.UpdatedByUserID = this.UserId;
                TopicBo.Update(this.CurrentTopic);
                TopicHistoryBo.Add(topicHistoryBO);

                Response.Redirect(this.HomeURL, true);
            }
        }
コード例 #2
0
        /// <summary>
        /// Shows the old version.
        /// </summary>
        private void ShowOldVersion()
        {
            if (this.CanEdit)
            {
                this.RestoreLbl.Visible = true;
                this.cmdRestore.Visible = true;
            }

            string historyPK = null;

            historyPK = this.Request.QueryString["ShowHistory"];
            var topicHistory = TopicHistoryBo.GetItem(int.Parse(historyPK));

            this.lblPageTopic.Text   = PageTopic.Replace(WikiModuleBase.WikiHomeName, "Home");
            this.lblPageContent.Text = topicHistory.Cache;
            this.lblDateTime.Text    = string.Format(Localization.GetString("HistoryAsOf", this.RouterResourceFile), topicHistory.UpdateDate.ToString(CultureInfo.CurrentCulture));
            this.BackBtn.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(
                this.TabId,
                this.PortalSettings,
                string.Empty,
                "loc=TopicHistory",
                "topic=" + WikiMarkup.EncodeTitle(this.PageTopic));
        }