Пример #1
0
        /// <summary>
        /// Handles the Click event of the save control. Creates/updates a topic
        /// </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 CmdSave_Click(object sender, System.EventArgs e)
        {
            // If we've change the Topic Name we need to create a new topic.
            Topic ti = null;

            ////if (string.IsNullOrWhiteSpace(PageTopic) | PageTopic != WikiMarkup.DecodeTitle(txtPageName.Text.Trim()))
            ////{
            ////    PageTopic = WikiMarkup.DecodeTitle(txtPageName.Text.Trim());
            ////    _Topic.TopicID = 0;
            ////    ti = TopicBo.GetByNameForModule(ModuleId, PageTopic);
            ////}

            this.PageTopic = WikiMarkup.DecodeTitle(this.txtPageName.Text.Trim());

            if (ti == null)
            {
                this.SaveChanges();
                if (this.PageTopic == WikiModuleBase.WikiHomeName)
                {
                    Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabId));
                }

                Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabId, this.PortalSettings, string.Empty, string.Empty, "topic=" + WikiMarkup.EncodeTitle(this.PageTopic)), false);
            }
            else
            {
                this.lblPageCreationError.Text = Localization.GetString("lblPageCreationError", this.LocalResourceFile);
            }
        }
Пример #2
0
        /// <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>
        /// Handles the Load event of the Router_Page 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>
        private void Router_Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                // Load the menu on the left
                string         leftControl    = ControlSharedControlsWikiMenu;
                WikiModuleBase wikiModuleBase = (WikiModuleBase)TemplateControl.LoadControl(leftControl);
                wikiModuleBase.ModuleConfiguration = this.ModuleConfiguration;
                wikiModuleBase.ID = System.IO.Path.GetFileNameWithoutExtension(leftControl);
                this.phWikiMenu.Controls.Add(wikiModuleBase);

                string         controlToLoad = this.GetControlString(Request.QueryString["loc"]);
                WikiModuleBase wikiContent   = (WikiModuleBase)LoadControl(controlToLoad);
                wikiContent.ModuleConfiguration = this.ModuleConfiguration;
                wikiContent.ID = System.IO.Path.GetFileNameWithoutExtension(controlToLoad);
                this.phWikiContent.Controls.Add(wikiContent);

                this.LoadWikiButtonControl(controlToLoad);

                // Print the Topic
                foreach (ModuleAction objAction in this.Actions)
                {
                    if (objAction.CommandName.Equals(ModuleActionType.PrintModule))
                    {
                        objAction.Url += "&topic=" + WikiMarkup.EncodeTitle(this.PageTopic);
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Пример #4
0
        /// <summary>
        /// Shows the topic history list.
        /// </summary>
        private void ShowTopicHistoryList()
        {
            this.lblPageTopic.Text = PageTopic.Replace(WikiModuleBase.WikiHomeName, "Home");

            this.lblDateTime.Text    = "...";
            this.lblPageContent.Text = Localization.GetString("HistoryListHeader", this.RouterResourceFile) + " <br /> " + this.CreateHistoryTable();
            this.BackBtn.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(
                this.TabId,
                this.PortalSettings,
                string.Empty,
                "topic=" + WikiMarkup.EncodeTitle(this.PageTopic));
        }
Пример #5
0
        /// <summary>
        /// Handles the Load event of the Page 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>
        public new void Page_Load(object sender, System.EventArgs e)
        {
            this.LoadLocalization();

            if (this.CanEdit)
            {
                if (this.teContent != null)
                {
                    this.teContent.HtmlEncode = false;
                }

                this.LoadTopic();
                if (string.IsNullOrWhiteSpace(CurrentTopic.Name))
                {
                    if (this.Request.QueryString["topic"] == null)
                    {
                        this.PageTopic    = WikiHomeName.Replace("[L]", string.Empty);
                        CurrentTopic.Name = this.PageTopic;
                    }
                    else
                    {
                        this.PageTopic    = WikiMarkup.DecodeTitle(this.Request.QueryString["topic"].ToString()).Replace("[L]", string.Empty);
                        CurrentTopic.Name = this.PageTopic;
                    }
                }

                this.EditPage();

                // CommentsSec.IsExpanded = FalseB
                if (this.Request.QueryString["add"] != null)
                {
                    this.PageTopic = string.Empty;
                    this.LoadTopic();
                    this.EditPage();
                }
                else
                {
                }

                // Add confirmation to the delete button.
                ClientAPI.AddButtonConfirm(this.DeleteBtn, Localization.GetString("ConfirmDelete", WikiModuleBase.SharedResources));
            }
            else
            {
                // User doesn't have edit rights to this module, load up a message stating so.
                this.lblMessage.Text     = Localization.GetString("NoEditAccess", this.LocalResourceFile);
                this.divWikiEdit.Visible = false;
            }
        }
Пример #6
0
        private void markupBox_TextChanged(object sender, EventArgs e)
        {
            string text = "";

            if (File.Exists(markupBox.Text))
            {
                StreamReader sr = new StreamReader(markupBox.Text);
                text = sr.ReadToEnd();
                sr.Close();
            }
            else
            {
                text = markupBox.Text;
            }

            string noMarkup = WikiMarkup.RemoveIrrelevantMarkup(text);

            noMarkup       = WikiMarkup.ProcessMarkup(noMarkup);
            resultLbl.Text = "Result:  " + noMarkup;
        }
Пример #7
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));
        }
Пример #8
0
        /// <summary>
        /// Sets the display.
        /// </summary>
        private void SetDisplay()
        {
            this.cmdAdd.Visible  = this.CanEdit;
            this.lnkEdit.Visible = false;

            this.txtViewHistory.Visible = false;

            if (!this.ShowOnlyAddTopicControl &&
                (CurrentTopic.TopicID >= 0 || (Request.QueryString["topic"] != null)))
            {
                this.cmdAdd.Visible  = this.CanEdit;
                this.lnkEdit.Visible = this.CanEdit;

                this.txtViewHistory.Visible     = true;
                this.txtViewHistory.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(this.TabId, this.PortalSettings, string.Empty, "loc=TopicHistory", "topic=" + WikiMarkup.EncodeTitle(this.PageTopic));
                this.lnkEdit.NavigateUrl        = DotNetNuke.Common.Globals.NavigateURL(this.TabId, string.Empty, "topic=" + WikiMarkup.EncodeTitle(this.PageTopic) + "&loc=edit");
            }

            this.cmdAdd.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(this.TabId, string.Empty, "&loc=edit&add=true");
        }
Пример #9
0
        /// <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);
        }
Пример #10
0
        ////Protected Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click
        ////    'TODO: none of this is currently working..... not sure why

        #endregion Events

        #region Methods

        /// <summary>
        /// Cancels the changes.
        /// </summary>
        private void CancelChanges()
        {
            // Send back to the Page View.
            if (string.IsNullOrEmpty(this.PageTopic))
            {
                Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabId), false);
            }
            else
            {
                Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabId, this.PortalSettings, string.Empty, string.Empty, "topic=" + WikiMarkup.EncodeTitle(this.PageTopic)), false);
            }
        }
Пример #11
0
        /// <summary>
        /// Displays the index.
        /// </summary>
        private void DisplayIndex()
        {
            this.Session["wiki" + ModuleId.ToString() + "ShowIndex"] = true;
            var topics = GetIndex().ToArray();

            System.Text.StringBuilder tableText = new System.Text.StringBuilder();
            //// Dim TopicTable As String
            Topic t = default(Topic);
            int   i = 0;

            tableText.Append("&nbsp;&nbsp;&nbsp<a class=\"CommandButton\" href=\"");
            tableText.Append(this.HomeURL + "\"><img src=\"");
            tableText.Append(this.DNNWikiModuleRootPath);
            tableText.Append("/Resources/images/Home.gif\" border=\"0\" align=\"middle\" alt=\"" + Localization.GetString("Home", this.LocalResourceFile) + "\" />&nbsp;");
            tableText.Append(Localization.GetString("Home", this.LocalResourceFile));
            tableText.Append("</a><br />");
            if (topics != null)
            {
                if (topics.Count() > 0)
                {
                    for (i = 0; i <= topics.Count() - 1; i++)
                    {
                        t = (Topic)topics[i];
                        if (t.Name != WikiModuleBase.WikiHomeName)
                        {
                            tableText.Append("&nbsp;&nbsp;&nbsp<a class=\"CommandButton\" href=\"");
                            tableText.Append(DotNetNuke.Common.Globals.NavigateURL(this.TabId, this.PortalSettings, string.Empty, "topic=" + WikiMarkup.EncodeTitle(t.Name)));
                            tableText.Append("\"><img src=\"");
                            tableText.Append(this.DNNWikiModuleRootPath);
                            tableText.Append("/Resources/images/Page.gif\" border=\"0\" align=\"middle\"  alt=\"" + WikiMarkup.EncodeTitle(t.Name) + "\" />&nbsp;");
                            tableText.Append(t.Name);
                            tableText.Append("</a><br />");
                        }
                    }
                }
            }

            tableText.Append(string.Empty);
            this.IndexList.Text    = tableText.ToString();
            this.IndexList.Visible = true;
        }