diff --git a/DotNetNuke.FAQs.csproj b/DotNetNuke.FAQs.csproj index 65d0ca3..a7ae09a 100644 --- a/DotNetNuke.FAQs.csproj +++ b/DotNetNuke.FAQs.csproj @@ -59,10 +59,6 @@ packages\DotNetNuke.Web.9.4.0\lib\net45\DotNetNuke.Web.dll False - - packages\DotNetNuke.Web.Deprecated.9.4.0\lib\net45\DotNetNuke.Web.Deprecated.dll - False - packages\DotNetNuke.Web.9.4.0\lib\net45\DotNetNuke.WebUtility.dll False @@ -105,10 +101,6 @@ - - packages\DotNetNuke.Web.Deprecated.9.4.0\lib\net45\Telerik.Web.UI.dll - False - diff --git a/EditFAQs.ascx b/EditFAQs.ascx index e271b84..e1dc6b4 100644 --- a/EditFAQs.ascx +++ b/EditFAQs.ascx @@ -3,7 +3,6 @@ <%@ Register TagPrefix="Portal" TagName="Audit" Src="~/controls/ModuleAuditControl.ascx" %> <%@ Register TagPrefix="dnn" TagName="TextEditor" Src="~/controls/TextEditor.ascx" %> <%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.UI.WebControls" Assembly="DotNetNuke.Web" %> -<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.UI.WebControls" Assembly="DotNetNuke.Web.Deprecated" %>
@@ -32,12 +31,12 @@
-   +  
-   +  
@@ -52,3 +51,10 @@
+ + \ No newline at end of file diff --git a/EditFAQs.ascx.cs b/EditFAQs.ascx.cs index b2d95fc..2f668c7 100644 --- a/EditFAQs.ascx.cs +++ b/EditFAQs.ascx.cs @@ -99,10 +99,14 @@ private void PopulateCategoriesDropDown() /// The instance containing the event data. protected void Page_Load(System.Object sender, System.EventArgs e) { + if (this.Page.ClientScript.IsClientScriptBlockRegistered("pikaday.min.js") == false) + { + this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Moment.js", ""); + this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "AjaxFaq.js", ""); + } if (Page.IsPostBack == false) { - cmdDelete.Attributes.Add("onClick", "javascript:return confirm(\'" + Localization.GetString("DeleteItem") + "\');"); FAQsController FAQsController = new FAQsController(); @@ -123,8 +127,8 @@ protected void Page_Load(System.Object sender, System.EventArgs e) } chkFaqHide.Checked = FaqItem.FaqHide; - datepickerPublishDate.SelectedDate = FaqItem.PublishDate; - datepickerExpireDate.SelectedDate = FaqItem.ExpireDate; + datepickerPublishDate.Text = FaqItem.PublishDate.ToString(); + datepickerExpireDate.Text = FaqItem.ExpireDate.ToString(); teAnswerField.Text = FaqItem.Answer; txtQuestionField.Text = FaqItem.Question; UserInfo user = UserController.GetUserById(PortalId, Convert.ToInt32(FaqItem.CreatedByUser)); @@ -182,8 +186,8 @@ protected void cmdUpdate_Click(System.Object sender, System.EventArgs e) faq = faqsController.GetFAQ(FaqId); faq.CategoryId = newCatID; faq.FaqHide = chkFaqHide.Checked; - faq.PublishDate = datepickerPublishDate.SelectedDate; - faq.ExpireDate = datepickerExpireDate.SelectedDate; + faq.PublishDate = !string.IsNullOrEmpty(datepickerPublishDate.Text) ? Convert.ToDateTime(datepickerPublishDate.Text) : (DateTime?)null; + faq.ExpireDate = !string.IsNullOrEmpty(datepickerExpireDate.Text) ? Convert.ToDateTime(datepickerExpireDate.Text) : (DateTime?)null; faq.Question = question; faq.Answer = answer; faq.DateModified = DateTime.Now; @@ -192,20 +196,20 @@ protected void cmdUpdate_Click(System.Object sender, System.EventArgs e) else { faq = new FAQsInfo - { - ItemID = FaqId, - CategoryId = newCatID, - FaqHide = chkFaqHide.Checked, - PublishDate = datepickerPublishDate.SelectedDate, - ExpireDate = datepickerExpireDate.SelectedDate, - Question = question, - Answer = answer, - CreatedByUser = UserId.ToString(), - ViewCount = 0, - DateModified = DateTime.Now, - ModuleID = ModuleId, - CreatedDate = DateTime.Now - }; + { + ItemID = FaqId, + CategoryId = newCatID, + FaqHide = chkFaqHide.Checked, + PublishDate = !string.IsNullOrEmpty(datepickerPublishDate.Text) ? Convert.ToDateTime(datepickerPublishDate.Text) : (DateTime?)null, + ExpireDate = !string.IsNullOrEmpty(datepickerExpireDate.Text) ? Convert.ToDateTime(datepickerExpireDate.Text) : (DateTime?)null, + Question = question, + Answer = answer, + CreatedByUser = UserId.ToString(), + ViewCount = 0, + DateModified = DateTime.Now, + ModuleID = ModuleId, + CreatedDate = DateTime.Now + }; faqsController.AddFAQ(faq); } Response.Redirect(Globals.NavigateURL(), true); diff --git a/EditFAQs.ascx.designer.cs b/EditFAQs.ascx.designer.cs index ac02054..804c443 100644 --- a/EditFAQs.ascx.designer.cs +++ b/EditFAQs.ascx.designer.cs @@ -7,11 +7,13 @@ // //------------------------------------------------------------------------------ -namespace DotNetNuke.Modules.FAQs { - - - public partial class EditFAQs { - +namespace DotNetNuke.Modules.FAQs +{ + + + public partial class EditFAQs + { + /// /// plQuestionField control. /// @@ -20,7 +22,7 @@ public partial class EditFAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl plQuestionField; - + /// /// valRequiredTitle control. /// @@ -29,7 +31,7 @@ public partial class EditFAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequiredTitle; - + /// /// plAnswerField control. /// @@ -38,7 +40,7 @@ public partial class EditFAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl plAnswerField; - + /// /// plCategoryField control. /// @@ -47,7 +49,7 @@ public partial class EditFAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl plCategoryField; - + /// /// drpCategory control. /// @@ -56,7 +58,7 @@ public partial class EditFAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList drpCategory; - + /// /// plFaqHide control. /// @@ -65,7 +67,7 @@ public partial class EditFAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl plFaqHide; - + /// /// chkFaqHide control. /// @@ -74,7 +76,7 @@ public partial class EditFAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox chkFaqHide; - + /// /// plPublishDate control. /// @@ -83,7 +85,7 @@ public partial class EditFAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl plPublishDate; - + /// /// datepickerPublishDate control. /// @@ -91,8 +93,8 @@ public partial class EditFAQs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::DotNetNuke.Web.UI.WebControls.DnnDatePicker datepickerPublishDate; - + protected global::System.Web.UI.WebControls.TextBox datepickerPublishDate; + /// /// valPublishDate control. /// @@ -101,7 +103,7 @@ public partial class EditFAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CompareValidator valPublishDate; - + /// /// plExpireDate control. /// @@ -110,7 +112,7 @@ public partial class EditFAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl plExpireDate; - + /// /// datepickerExpireDate control. /// @@ -118,8 +120,8 @@ public partial class EditFAQs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::DotNetNuke.Web.UI.WebControls.DnnDatePicker datepickerExpireDate; - + protected global::System.Web.UI.WebControls.TextBox datepickerExpireDate; + /// /// valExpireDate control. /// @@ -128,7 +130,7 @@ public partial class EditFAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CompareValidator valExpireDate; - + /// /// val2ExpireDate control. /// @@ -137,7 +139,7 @@ public partial class EditFAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CompareValidator val2ExpireDate; - + /// /// cmdUpdate control. /// @@ -146,7 +148,7 @@ public partial class EditFAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton cmdUpdate; - + /// /// cmdCancel control. /// @@ -155,7 +157,7 @@ public partial class EditFAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton cmdCancel; - + /// /// cmdDelete control. /// diff --git a/FAQs.ascx b/FAQs.ascx index 5b4daaf..f98f6eb 100644 --- a/FAQs.ascx +++ b/FAQs.ascx @@ -1,7 +1,5 @@ <%@ Control Language="C#" Inherits="DotNetNuke.Modules.FAQs.FAQs" AutoEventWireup="True" CodeBehind="FAQs.ascx.cs" %> -<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> <%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.UI.WebControls" Assembly="DotNetNuke.Web" %> -<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.UI.WebControls" Assembly="DotNetNuke.Web.Deprecated" %> <%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>
@@ -9,23 +7,9 @@
- -
- - - - - -
-
- - - - - +
diff --git a/FAQs.ascx.cs b/FAQs.ascx.cs index a92bc85..b902651 100644 --- a/FAQs.ascx.cs +++ b/FAQs.ascx.cs @@ -30,8 +30,6 @@ using DotNetNuke.Entities.Modules.Actions; using DotNetNuke.Entities.Modules; using DotNetNuke.Services.Localization; -using Telerik.Web.UI; -using DotNetNuke.Web.UI.WebControls; namespace DotNetNuke.Modules.FAQs { @@ -304,6 +302,23 @@ public int RequestFaqId #region Private Methods + private void PopulateTreeView(List list, int ParentId, TreeNodeCollection treeNode) + { + foreach (var row in list.Where(x => x.FaqCategoryParentId == ParentId)) + { + TreeNode child = new TreeNode + { + Text = row.FaqCategoryName, + Value = row.FaqCategoryId.ToString() + }; + + treeNode.Add(child); + var dtChild = list.Where(x => x.FaqCategoryParentId == ParentId).ToList(); + if (dtChild.Count > 0) + PopulateTreeView(list, row.FaqCategoryId, child.ChildNodes); + } + } + /// /// Binds the (filtered) faq data. /// @@ -401,18 +416,6 @@ private void BindCategories() switch (ShowCategoryType) { case 0: - if (noCat) - categories.Add(emptyCategory); - foreach (CategoryInfo cat in cats) - { - categories.Add(cat); - } - listCategories.DataSource = categories; - listCategories.DataBind(); - mvShowCategoryType.SetActiveView(vShowCategoryTypeList); - pnlShowCategoryTypeDropdown.Visible = false; - break; - case 1: categories.Add(allCategories); if (noCat) @@ -424,18 +427,14 @@ private void BindCategories() // treeCategories fails with int? FaqCategoryParentId // define a temp class that has no nullables // set null ints to Null.NullInt - ArrayList lst = new ArrayList(); + var lst = new List(); foreach (CategoryInfo cat in categories) { lst.Add(cat.ToTreeNode()); } - treeCategories.DataTextField = "FaqCategoryName"; - treeCategories.DataFieldID = "FaqCategoryId"; - treeCategories.DataFieldParentID = "FaqCategoryParentId"; - treeCategories.DataSource = lst; - treeCategories.DataBind(); - if (!IsPostBack) - treeCategories.Nodes[0].Selected = true; + + PopulateTreeView(lst, 0, treeCategories.Nodes); + mvShowCategoryType.SetActiveView(vShowCategoryTypeTree); pnlShowCategoryTypeDropdown.Visible = false; break; @@ -482,36 +481,6 @@ private bool MatchElement(FAQsInfo fData) switch (ShowCategoryType) { case 0: - //Filter on the checked items - foreach (RadListBoxItem item in listCategories.Items) - { - - //Get the checkbox in the Control - CheckBox chkCategory = (CheckBox)(item.FindControl("chkCategory")); - - //If checked the faq module is being filtered on one or more category's - if (chkCategory.Checked) - { - - //Set Checked Flag - noneChecked = false; - - //Get the filtered category - string checkedCategoryName = chkCategory.Text; - - //Get the elements that match the catagory - var matchedCat = (from c in cats where c.FaqCategoryId == fData.CategoryId select c).SingleOrDefault(); - categoryName = (matchedCat != null ? matchedCat.FaqCategoryName : ""); - - if ((categoryName == checkedCategoryName) || - (fData.CategoryId == null && checkedCategoryName == Localization.GetString("EmptyCategory", LocalResourceFile))) - { - match = true; - break; - } - } - } - break; case 1: if (treeCategories.SelectedNode != null) { @@ -816,39 +785,6 @@ protected void chkCategory_CheckedChanged(object sender, EventArgs e) BindData(); } - /// - /// Handles the ItemDataBound event of the listCategories control (adds Tooltip) - /// - /// The source of the event. - /// instance containing the event data. - protected void listCategories_ItemDataBound(object sender, RadListBoxItemEventArgs e) - { - if (ShowToolTips) - e.Item.ToolTip = (string)DataBinder.Eval(e.Item.DataItem, "FaqCategoryDescription"); - } - - /// - /// Handles the NodeClick event of the treeCategories control (rebinds data) - /// - /// The source of the event. - /// instance containing the event data. - protected void treeCategories_NodeClick(object sender, EventArgs e) - { - //Rebind Data - BindData(); - } - - /// - /// Handles the NodeDataBound event of the treeCategories control (adds Tooltip) - /// - /// The source of the event. - /// instance containing the event data. - protected void treeCategories_NodeDataBound(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e) - { - if (ShowToolTips) - e.Node.ToolTip = (string)DataBinder.Eval(e.Node.DataItem, "FaqCategoryDescription"); - } - protected void drpCategories_SelectedIndexChanged(object sender, EventArgs e) { //Rebind Data @@ -865,6 +801,10 @@ protected void drpSort_SelectedIndexChanged(object sender, EventArgs e) #endregion + protected void treeCategories_SelectedNodeChanged(object sender, EventArgs e) + { + BindData(); + } } } diff --git a/FAQs.ascx.designer.cs b/FAQs.ascx.designer.cs index 162a664..e63bd91 100644 --- a/FAQs.ascx.designer.cs +++ b/FAQs.ascx.designer.cs @@ -7,11 +7,13 @@ // //------------------------------------------------------------------------------ -namespace DotNetNuke.Modules.FAQs { - - - public partial class FAQs { - +namespace DotNetNuke.Modules.FAQs +{ + + + public partial class FAQs + { + /// /// pnlShowCategories control. /// @@ -20,7 +22,7 @@ public partial class FAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Panel pnlShowCategories; - + /// /// mvShowCategoryType control. /// @@ -29,25 +31,7 @@ public partial class FAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.MultiView mvShowCategoryType; - - /// - /// vShowCategoryTypeList control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.View vShowCategoryTypeList; - - /// - /// listCategories control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::DotNetNuke.Web.UI.WebControls.DnnListBox listCategories; - + /// /// vShowCategoryTypeTree control. /// @@ -56,7 +40,7 @@ public partial class FAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.View vShowCategoryTypeTree; - + /// /// treeCategories control. /// @@ -64,8 +48,8 @@ public partial class FAQs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::DotNetNuke.Web.UI.WebControls.DnnTreeView treeCategories; - + protected global::System.Web.UI.WebControls.TreeView treeCategories; + /// /// pnlSortbox control. /// @@ -74,7 +58,7 @@ public partial class FAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Panel pnlSortbox; - + /// /// lblSort control. /// @@ -83,7 +67,7 @@ public partial class FAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl lblSort; - + /// /// drpSort control. /// @@ -92,7 +76,7 @@ public partial class FAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList drpSort; - + /// /// pnlShowCategoryTypeDropdown control. /// @@ -101,7 +85,7 @@ public partial class FAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Panel pnlShowCategoryTypeDropdown; - + /// /// lblSelectCategory control. /// @@ -110,7 +94,7 @@ public partial class FAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl lblSelectCategory; - + /// /// drpCategories control. /// @@ -119,7 +103,7 @@ public partial class FAQs { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList drpCategories; - + /// /// lstFAQs control. /// diff --git a/FAQsCategories.ascx b/FAQsCategories.ascx index ee511b4..a219636 100644 --- a/FAQsCategories.ascx +++ b/FAQsCategories.ascx @@ -1,15 +1,9 @@ <%@ Control Language="C#" Inherits="DotNetNuke.Modules.FAQs.FAQsCategories" AutoEventWireup="true" CodeBehind="FAQsCategories.ascx.cs" %> <%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %> <%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.UI.WebControls" Assembly="DotNetNuke.Web" %> -<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.UI.WebControls" Assembly="DotNetNuke.Web.Deprecated" %> -<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
- - - - - +
  • diff --git a/FAQsCategories.ascx.cs b/FAQsCategories.ascx.cs index 6c58ea0..0f4666c 100644 --- a/FAQsCategories.ascx.cs +++ b/FAQsCategories.ascx.cs @@ -19,17 +19,15 @@ // using System; -using System.Collections; using System.Collections.Generic; using System.Web.UI; using System.Web.UI.WebControls; using DotNetNuke.Common; -using DotNetNuke.Entities.Icons; using DotNetNuke.Entities.Modules; using DotNetNuke.Services.Exceptions; using DotNetNuke.Services.Localization; using DotNetNuke.Security; -using Telerik.Web.UI; +using System.Linq; namespace DotNetNuke.Modules.FAQs { @@ -64,7 +62,6 @@ protected void cmdAddNew_Click(Object sender, EventArgs e) txtCategoryDescription.Text = ""; txtCategoryName.Text = ""; PopulateCategoriesDropDown(-1); - treeCategories.UnselectAllNodes(); cmdDelete.Visible = false; } @@ -102,7 +99,7 @@ protected void cmdUpdate_Click(Object sender, EventArgs e) try { - RadTreeNode node = treeCategories.SelectedNode; + TreeNode node = treeCategories.SelectedNode; if (node != null) { categoryItem.FaqCategoryId = Convert.ToInt32(node.Value); @@ -134,7 +131,7 @@ protected void cmdDelete_Click(Object sender, EventArgs e) FAQsController faqsController = new FAQsController(); try { - RadTreeNode node = treeCategories.SelectedNode; + TreeNode node = treeCategories.SelectedNode; if (node != null) { int faqCategoryId = Convert.ToInt32(node.Value); @@ -158,85 +155,27 @@ protected void cmdCancel_Click(System.Object sender, System.EventArgs e) panelAddEdit.Visible = false; } - /// - /// Handles the NodeDataBound event of the treeCategories control (adds Tooltip) - /// - /// The source of the event. - /// instance containing the event data. - protected void treeCategories_NodeDataBound(object sender, RadTreeNodeEventArgs e) - { - e.Node.ToolTip = (string)DataBinder.Eval(e.Node.DataItem, "FaqCategoryDescription"); - e.Node.Value = DataBinder.Eval(e.Node.DataItem, "FaqCategoryId").ToString(); - e.Node.ImageUrl = IconController.IconURL("folder"); - } - - /// - /// Handles the NodeClick event of the treeCategories control - /// - /// The source of the event. - /// instance containing the event data. - protected void treeCategories_NodeClick(object sender, RadTreeNodeEventArgs e) - { - int faqCategoryId = Convert.ToInt32(e.Node.Value); - EditCategory(faqCategoryId); - cmdDelete.Visible = true; - } + #endregion + #region Private Methods - protected void treeCategories_HandleDrop(object sender, RadTreeNodeDragDropEventArgs e) + private void PopulateTreeView(List list, int ParentId, TreeNodeCollection treeNode) { - FAQsController FAQsController = new FAQsController(); - RadTreeNode sourceNode = e.SourceDragNode; - RadTreeNode destNode = e.DestDragNode; - RadTreeViewDropPosition dropPosition = e.DropPosition; - - if (destNode == null || sourceNode == destNode || sourceNode.IsAncestorOf(destNode)) - return; - - int sourceFaqCategoryId = Convert.ToInt32(sourceNode.Value); - CategoryInfo sourceCategory = FAQsController.GetCategory(sourceFaqCategoryId); - - int destFaqCategoryId = Convert.ToInt32(destNode.Value); - CategoryInfo destCategory = FAQsController.GetCategory(destFaqCategoryId); - - switch (dropPosition) + foreach (var row in list.Where(x => x.FaqCategoryParentId == ParentId)) { - case RadTreeViewDropPosition.Over: // child - // Change Treeview - sourceNode.Owner.Nodes.Remove(sourceNode); - destNode.Nodes.Add(sourceNode); - - // Change the ParentId of Source in database - sourceCategory.FaqCategoryParentId = destCategory.FaqCategoryId; - sourceCategory.ViewOrder = 999; - FAQsController.UpdateCategory(sourceCategory); - break; - - case RadTreeViewDropPosition.Above: // sibling - above - sourceNode.Owner.Nodes.Remove(sourceNode); - destNode.InsertBefore(sourceNode); - sourceCategory.FaqCategoryParentId = destCategory.FaqCategoryParentId; - sourceCategory.ViewOrder = destCategory.ViewOrder - 1; - FAQsController.UpdateCategory(sourceCategory); - - break; - - case RadTreeViewDropPosition.Below: // sibling - below - sourceNode.Owner.Nodes.Remove(sourceNode); - destNode.InsertAfter(sourceNode); - sourceCategory.FaqCategoryParentId = destCategory.FaqCategoryParentId; - sourceCategory.ViewOrder = destCategory.ViewOrder + 1; - FAQsController.UpdateCategory(sourceCategory); - break; + TreeNode child = new TreeNode + { + Text = row.FaqCategoryName, + Value = row.FaqCategoryId.ToString() + }; + + treeNode.Add(child); + var dtChild = list.Where(x => x.FaqCategoryParentId == ParentId).ToList(); + if (dtChild.Count > 0) + PopulateTreeView(list, row.FaqCategoryId, child.ChildNodes); } - FAQsController.ReorderCategory(sourceCategory.FaqCategoryParentId, ModuleId); - panelAddEdit.Visible = false; } - #endregion - - #region Private Methods - private void BindData() { FAQsController FAQsController = new FAQsController(); @@ -250,14 +189,7 @@ private void BindData() lst.Add(cat.ToTreeNode()); } - treeCategories.Nodes.Clear(); - treeCategories.DataTextField = "FaqCategoryName"; - treeCategories.DataFieldID = "FaqCategoryId"; - treeCategories.DataFieldParentID = "FaqCategoryParentId"; - treeCategories.DataSource = lst; - treeCategories.DataBind(); - if (!IsPostBack && treeCategories.Nodes.Count > 0) - treeCategories.Nodes[0].Selected = true; + PopulateTreeView(lst, 0, treeCategories.Nodes); } private void EditCategory(int faqCategoryId) { @@ -286,5 +218,12 @@ private void PopulateCategoriesDropDown(int faqCategoryId) } } #endregion + + protected void treeCategories_SelectedNodeChanged(object sender, EventArgs e) + { + int faqCategoryId = Convert.ToInt32(treeCategories.SelectedNode.Value); + EditCategory(faqCategoryId); + cmdDelete.Visible = true; + } } } diff --git a/FAQsCategories.ascx.designer.cs b/FAQsCategories.ascx.designer.cs index 29af622..4b0020e 100644 --- a/FAQsCategories.ascx.designer.cs +++ b/FAQsCategories.ascx.designer.cs @@ -7,11 +7,13 @@ // //------------------------------------------------------------------------------ -namespace DotNetNuke.Modules.FAQs { - - - public partial class FAQsCategories { - +namespace DotNetNuke.Modules.FAQs +{ + + + public partial class FAQsCategories + { + /// /// treeCategories control. /// @@ -19,8 +21,8 @@ public partial class FAQsCategories { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::DotNetNuke.Web.UI.WebControls.DnnTreeView treeCategories; - + protected global::System.Web.UI.WebControls.TreeView treeCategories; + /// /// cmdAddNew control. /// @@ -29,7 +31,7 @@ public partial class FAQsCategories { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton cmdAddNew; - + /// /// cmdGoBack control. /// @@ -38,7 +40,7 @@ public partial class FAQsCategories { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton cmdGoBack; - + /// /// panelAddEdit control. /// @@ -47,7 +49,7 @@ public partial class FAQsCategories { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Panel panelAddEdit; - + /// /// rowFaqCategoryParentId control. /// @@ -56,7 +58,7 @@ public partial class FAQsCategories { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl rowFaqCategoryParentId; - + /// /// plParentCategoryField control. /// @@ -65,7 +67,7 @@ public partial class FAQsCategories { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl plParentCategoryField; - + /// /// drpParentCategory control. /// @@ -74,7 +76,7 @@ public partial class FAQsCategories { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList drpParentCategory; - + /// /// plCategoryName control. /// @@ -83,7 +85,7 @@ public partial class FAQsCategories { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl plCategoryName; - + /// /// txtCategoryName control. /// @@ -92,7 +94,7 @@ public partial class FAQsCategories { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtCategoryName; - + /// /// rqdCategoryName control. /// @@ -101,7 +103,7 @@ public partial class FAQsCategories { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rqdCategoryName; - + /// /// plCategoryDescription control. /// @@ -110,7 +112,7 @@ public partial class FAQsCategories { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UserControl plCategoryDescription; - + /// /// txtCategoryDescription control. /// @@ -119,7 +121,7 @@ public partial class FAQsCategories { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtCategoryDescription; - + /// /// rqdCategoryDescription control. /// @@ -128,7 +130,7 @@ public partial class FAQsCategories { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RequiredFieldValidator rqdCategoryDescription; - + /// /// cmdUpdate control. /// @@ -137,7 +139,7 @@ public partial class FAQsCategories { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton cmdUpdate; - + /// /// cmdCancel control. /// @@ -146,7 +148,7 @@ public partial class FAQsCategories { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton cmdCancel; - + /// /// cmdDelete control. /// diff --git a/Installation/DNN_FAQs.dnn b/Installation/DNN_FAQs.dnn index 4b217a2..a34e551 100644 --- a/Installation/DNN_FAQs.dnn +++ b/Installation/DNN_FAQs.dnn @@ -1,6 +1,6 @@ - + FAQs FAQs allow you to manage a list of Frequently Asked Questions and their corresponding Answers. DesktopModules\FAQs\DNN_FAQs.png diff --git a/Settings.ascx b/Settings.ascx index 69d8ee9..3dc66c0 100644 --- a/Settings.ascx +++ b/Settings.ascx @@ -20,7 +20,6 @@ - List with checkboxes Treeview Dropdown diff --git a/module.css b/module.css index e96afad..8fcca1d 100644 --- a/module.css +++ b/module.css @@ -1,2 +1,15 @@ - .dnnFAQs .categoryList{padding:0 20px 0 5px}.dnnFAQs .categoryList label{vertical-align:middle;white-space:nowrap;padding:2px 10px 2px 2px}.dnnFAQs .categoryList input[type=checkbox]{vertical-align:middle}.dnnFAQs .categoryList ul li{list-style-type:none;padding:5px 10px 5px 5px} +/** + * Minified by jsDelivr using clean-css v4.2.3. + * Original file: /npm/pikaday@1.8.2/css/pikaday.css + * + * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files + */ +@charset "UTF-8";/*! + * Pikaday + * Copyright © 2014 David Bushell | BSD & MIT license | https://dbushell.com/ + */ +.pika-single{z-index:9999;display:block;position:relative;color:#333;background:#fff;border:1px solid #ccc;border-bottom-color:#bbb;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}.pika-single:after,.pika-single:before{content:" ";display:table}.pika-single:after{clear:both}.pika-single.is-hidden{display:none}.pika-single.is-bound{position:absolute;box-shadow:0 5px 15px -5px rgba(0,0,0,.5)}.pika-lendar{float:left;width:240px;margin:8px}.pika-title{position:relative;text-align:center}.pika-label{display:inline-block;position:relative;z-index:9999;overflow:hidden;margin:0;padding:5px 3px;font-size:14px;line-height:20px;font-weight:700;background-color:#fff}.pika-title select{cursor:pointer;position:absolute;z-index:9998;margin:0;left:0;top:5px;opacity:0}.pika-next,.pika-prev{display:block;cursor:pointer;position:relative;outline:0;border:0;padding:0;width:20px;height:30px;text-indent:20px;white-space:nowrap;overflow:hidden;background-color:transparent;background-position:center center;background-repeat:no-repeat;background-size:75% 75%;opacity:.5}.pika-next:hover,.pika-prev:hover{opacity:1}.is-rtl .pika-next,.pika-prev{float:left;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAAUklEQVR42u3VMQoAIBADQf8Pgj+OD9hG2CtONJB2ymQkKe0HbwAP0xucDiQWARITIDEBEnMgMQ8S8+AqBIl6kKgHiXqQqAeJepBo/z38J/U0uAHlaBkBl9I4GwAAAABJRU5ErkJggg==)}.is-rtl .pika-prev,.pika-next{float:right;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAYAAAAsEj5rAAAAU0lEQVR42u3VOwoAMAgE0dwfAnNjU26bYkBCFGwfiL9VVWoO+BJ4Gf3gtsEKKoFBNTCoCAYVwaAiGNQGMUHMkjGbgjk2mIONuXo0nC8XnCf1JXgArVIZAQh5TKYAAAAASUVORK5CYII=)}.pika-next.is-disabled,.pika-prev.is-disabled{cursor:default;opacity:.2}.pika-select{display:inline-block}.pika-table{width:100%;border-collapse:collapse;border-spacing:0;border:0}.pika-table td,.pika-table th{width:14.285714285714286%;padding:0}.pika-table th{color:#999;font-size:12px;line-height:25px;font-weight:700;text-align:center}.pika-button{cursor:pointer;display:block;box-sizing:border-box;-moz-box-sizing:border-box;outline:0;border:0;margin:0;width:100%;padding:5px;color:#666;font-size:12px;line-height:15px;text-align:right;background:#f5f5f5;height:initial}.pika-week{font-size:11px;color:#999}.is-today .pika-button{color:#3af;font-weight:700}.has-event .pika-button,.is-selected .pika-button{color:#fff;font-weight:700;background:#3af;box-shadow:inset 0 1px 3px #178fe5;border-radius:3px}.has-event .pika-button{background:#005da9;box-shadow:inset 0 1px 3px #0076c9}.is-disabled .pika-button,.is-inrange .pika-button{background:#d5e9f7}.is-startrange .pika-button{color:#fff;background:#6cb31d;box-shadow:none;border-radius:3px}.is-endrange .pika-button{color:#fff;background:#3af;box-shadow:none;border-radius:3px}.is-disabled .pika-button{pointer-events:none;cursor:default;color:#999;opacity:.3}.is-outside-current-month .pika-button{color:#999;opacity:.3}.is-selection-disabled{pointer-events:none;cursor:default}.pika-button:hover,.pika-row.pick-whole-week:hover .pika-button{color:#fff;background:#ff8000;box-shadow:none;border-radius:3px}.pika-table abbr{border-bottom:none;cursor:help} +/*# sourceMappingURL=/sm/f5b2b65a58973e202bf9caba8a8140353bee225463007290d0795f5addc46118.map */ + +.dnnFAQs .categoryList{padding:0 20px 0 5px}.dnnFAQs .categoryList label{vertical-align:middle;white-space:nowrap;padding:2px 10px 2px 2px}.dnnFAQs .categoryList input[type=checkbox]{vertical-align:middle}.dnnFAQs .categoryList ul li{list-style-type:none;padding:5px 10px 5px 5px} .dnnFAQs .RadListBox{width:auto!important}.dnnFAQs .rlbItem{white-space:nowrap}.dnnFAQs .rlbItem>span{white-space:nowrap!important;padding:3px} \ No newline at end of file diff --git a/packages.config b/packages.config index 112b49e..792b70f 100644 --- a/packages.config +++ b/packages.config @@ -3,7 +3,6 @@ -