예제 #1
0
파일: Edit.ascx.cs 프로젝트: hnjm/DNN.Wiki
        /// <summary>
        /// Posts the topic to DNN journal.
        /// </summary>
        /// <param name="crudOperation">The crud operation.</param>
        private void PostTopicToDNNJournal(SharedEnum.CrudOperation crudOperation)
        {
            string summary = string.Empty;

            SharedEnum.DNNJournalType journalType;

            // depending on the Crud operation, sets the summary and JournalType
            if (crudOperation == SharedEnum.CrudOperation.Insert)
            {
                summary =
                    Localization.GetString("JournalInsertTopicSummary", this.LocalResourceFile);
                journalType = SharedEnum.DNNJournalType.Wiki_Add;
            }
            else
            {
                summary =
                    Localization.GetString("JournalUpdateTopicSummary", this.LocalResourceFile);
                journalType = SharedEnum.DNNJournalType.Wiki_Update;
            }

            // post the topic
            DNNUtils.PostTopicCommentToJournal(
                summary.Replace("[TopicName]", this.PageTopic),
                this.PageTopic,
                string.Empty,
                DotNetNuke.Common.Globals.NavigateURL(this.TabId, this.PortalSettings, string.Empty, "topic=" + WikiMarkup.EncodeTitle(this.PageTopic)),
                this.TabId,
                this.PageTopic,
                journalType);
        }
예제 #2
0
파일: Edit.ascx.cs 프로젝트: hnjm/DNN.Wiki
        /// <summary>
        /// Saves the and continue.
        /// </summary>
        private void SaveAndContinue()
        {
            SharedEnum.CrudOperation crudOperation = SharedEnum.CrudOperation.Insert;
            try
            {
                DotNetNuke.Security.PortalSecurity objSec = new DotNetNuke.Security.PortalSecurity();
                this.SaveTopic(
                    HttpUtility.HtmlDecode(
                        objSec.InputFilter(objSec.InputFilter(this.teContent.Text, PortalSecurity.FilterFlag.NoMarkup), PortalSecurity.FilterFlag.NoScripting)),
                    this.AllowDiscuss.Checked,
                    this.AllowRating.Checked,
                    objSec.InputFilter(WikiMarkup.DecodeTitle(this.txtTitle.Text.Trim()), PortalSecurity.FilterFlag.NoMarkup),
                    objSec.InputFilter(this.txtDescription.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup),
                    objSec.InputFilter(this.txtKeywords.Text.Trim(), PortalSecurity.FilterFlag.NoMarkup),
                    out crudOperation);
            }
            catch (TopicValidationException exc)
            {
                switch (exc.CrudError)
                {
                case DotNetNuke.Wiki.BusinessObjects.TopicBO.TopicError.DUPLICATENAME:
                    this.Messages.ShowWarning(Localization.GetString("WarningDUPLICATENAME", this.LocalResourceFile));
                    break;

                default:
                    throw exc;
                }
            }

            this.PostTopicToDNNJournal(crudOperation);
        }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="_AbstractValidationException{E}"/> class.
 /// </summary>
 /// <param name="crudOperation">The crud operation.</param>
 /// <param name="crudError">The crud error.</param>
 public _AbstractValidationException(SharedEnum.CrudOperation crudOperation, E crudError)
     : base(string.Empty)
 {
     this.crudOperationEnum = crudOperation;
     this.crudException     = crudError;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TopicHistoryValidationException"/> class.
 /// </summary>
 /// <param name="crudOperation">The crud operation.</param>
 /// <param name="crudError">The crud error.</param>
 public TopicHistoryValidationException(SharedEnum.CrudOperation crudOperation, TopicHistoryBO.TopicHistoryError crudError)
     : base(crudOperation, crudError)
 {
 }
예제 #5
0
 /// <summary>
 /// Entity_s the evaluate SQL exception.
 /// </summary>
 /// <param name="exc">The exception.</param>
 /// <param name="crudOperation">The crud operation.</param>
 /// <exception cref="System.NotImplementedException">SQL Exception</exception>
 internal override void Entity_EvaluateSqlException(
     SqlException exc,
     SharedEnum.CrudOperation crudOperation)
 {
     throw new System.NotImplementedException();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CommentParentValidationException"/> class.
 /// </summary>
 /// <param name="crudOperation">The crud operation.</param>
 /// <param name="crudError">The crud error.</param>
 public CommentParentValidationException(SharedEnum.CrudOperation crudOperation, CommentParentBO.CommentParentError crudError)
     : base(crudOperation, crudError)
 {
 }
예제 #7
0
 /// <summary>
 /// Method called when a SQL operation happens after a crud operation
 /// </summary>
 /// <param name="exc">The SQL Exception</param>
 /// <param name="crudOperation">The crud operation.</param>
 internal abstract void Entity_EvaluateSqlException(SqlException exc, SharedEnum.CrudOperation crudOperation);
예제 #8
0
        /// <summary>
        /// Saves the topic.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <param name="allowDiscuss">if set to <c>true</c> [allow discuss].</param>
        /// <param name="allowRating">if set to <c>true</c> [allow rating].</param>
        /// <param name="title">The title.</param>
        /// <param name="description">The description.</param>
        /// <param name="keywords">The keywords.</param>
        /// <param name="out_crudOperation">The crud operation performed, only update or
        /// insert</param>
        protected void SaveTopic(
            string content,
            bool allowDiscuss,
            bool allowRating,
            string title,
            string description,
            string keywords,
            out SharedEnum.CrudOperation out_crudOperation)
        {
            TopicHistory topicHistory = new TopicHistory();

            topicHistory.TabID          = this.TabId;
            topicHistory.PortalSettings = this.PortalSettings;
            if (this.mTopicObject.TopicID != 0)
            {
                if (!content.Equals(this.mTopicObject.Content) | !title.Equals(this.mTopicObject.Title) | !description.Equals(this.mTopicObject.Description) | !keywords.Equals(this.mTopicObject.Keywords))
                {
                    topicHistory.Name            = this.mTopicObject.Name;
                    topicHistory.TopicId         = this.mTopicObject.TopicID;
                    topicHistory.Content         = this.mTopicObject.Content;
                    topicHistory.UpdatedBy       = this.mTopicObject.UpdatedBy;
                    topicHistory.UpdateDate      = DateTime.Now;
                    topicHistory.UpdatedByUserID = this.mTopicObject.UpdatedByUserID;
                    topicHistory.Title           = this.mTopicObject.Title;
                    topicHistory.Description     = this.mTopicObject.Description;
                    topicHistory.Keywords        = this.mTopicObject.Keywords;

                    this.mTopicObject.UpdateDate = DateTime.Now;
                    if (UserInfo.UserID == -1)
                    {
                        this.mTopicObject.UpdatedBy = Localization.GetString("Anonymous", this.RouterResourceFile);
                    }
                    else
                    {
                        this.mTopicObject.UpdatedBy = UserInfo.Username;
                    }

                    this.mTopicObject.UpdatedByUserID = this.UserId;
                    this.mTopicObject.Content         = content;
                    this.mTopicObject.Title           = title;
                    this.mTopicObject.Description     = description;
                    this.mTopicObject.Keywords        = keywords;

                    this.TopicHistoryBo.Add(topicHistory);
                }

                this.mTopicObject.Name             = this.mPageTopicValue;
                this.mTopicObject.Title            = title;
                this.mTopicObject.Description      = description;
                this.mTopicObject.Keywords         = keywords;
                this.mTopicObject.AllowDiscussions = allowDiscuss;
                this.mTopicObject.AllowRatings     = allowRating;
                this.mTopicObject.Content          = content;

                this.TopicBo.Update(this.mTopicObject);
                out_crudOperation = SharedEnum.CrudOperation.Update;
            }
            else
            {
                this.mTopicObject                = new Topic();
                this.mTopicObject.TabID          = this.TabId;
                this.mTopicObject.PortalSettings = this.PortalSettings;
                this.mTopicObject.Content        = content;
                this.mTopicObject.Name           = this.mPageTopicValue;
                this.mTopicObject.ModuleId       = this.ModuleId;
                if (UserInfo.UserID == -1)
                {
                    this.mTopicObject.UpdatedBy = Localization.GetString("Anonymous", this.RouterResourceFile);
                }
                else
                {
                    this.mTopicObject.UpdatedBy = UserInfo.Username;
                }

                this.mTopicObject.UpdatedByUserID  = this.UserId;
                this.mTopicObject.UpdateDate       = DateTime.Now;
                this.mTopicObject.AllowDiscussions = allowDiscuss;
                this.mTopicObject.AllowRatings     = allowRating;
                this.mTopicObject.Title            = title;
                this.mTopicObject.Description      = description;
                this.mTopicObject.Keywords         = keywords;

                this.mTopicObject = this.TopicBo.Add(this.mTopicObject);

                this.mTopicIdValue = this.mTopicObject.TopicID;
                out_crudOperation  = SharedEnum.CrudOperation.Insert;
            }
        }
예제 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SettingValidationException"/> class.
 /// </summary>
 /// <param name="crudOperation">The crud operation.</param>
 /// <param name="crudError">The crud error.</param>
 public SettingValidationException(SharedEnum.CrudOperation crudOperation, SettingBO.SettingError crudError)
     : base(crudOperation, crudError)
 {
 }
예제 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TopicValidationException"/> class.
 /// </summary>
 /// <param name="crudOperation">The crud operation.</param>
 /// <param name="crudError">The crud error.</param>
 public TopicValidationException(SharedEnum.CrudOperation crudOperation, TopicBO.TopicError crudError)
     : base(crudOperation, crudError)
 {
 }