/// <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); } }
/// <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)); }
/// <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)); }
/// <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"); }
/// <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); } }
/// <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); }
////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); } }
/// <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("  <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) + "\" /> "); 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("  <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) + "\" /> "); tableText.Append(t.Name); tableText.Append("</a><br />"); } } } } tableText.Append(string.Empty); this.IndexList.Text = tableText.ToString(); this.IndexList.Visible = true; }