DNNCommunity / DNN.Faq

DNN FAQ is a basic module used for displaying frequently asked questions on your DNN site.
https://dnncommunity.github.io/DNN.Faq/
MIT License
17 stars 20 forks source link

DNN FAQ change category names #5

Closed cpaterra closed 7 years ago

cpaterra commented 8 years ago

Once a category is created the name cannot be changed.

In Dnn 8.0 install the DNN FAQ extension from Host --> Extensions --> Available Extensions Add the FAQ module to a page. Create a new category. There is no option to rename the category created.

Expected Result: An option to rename a created category.

dnndiva commented 8 years ago

On DNN 07.03.04 (45) as well as on Evoq Engage 08.01.00 (492) the list of previously entered categories do not show at all, and because of that (I assume) cannot be edited, deleted or re-rordered. Tested on Firefox and Chrome.

swkuhn commented 8 years ago

The category tree view doesn't like the nullable int for FaqCategoryParentId. I downloaded the source for 5.1.1, and put a hack in bindData that allowed it to work for me. I defined a similar catInfo class with FaqCategoryParentId defined as int instead of int?. Loop thorugh the iList returned from ListCategoriesHierarchical, newing my class, filling in the data and setting FaqCategoryParentId to Null.NullInt when its null. And then assign my new list as the DataSource. Ugly but works until the real fix is released.

The redinfined code section is {code} public class catInfo { public int FaqCategoryParentId { get; set; } public int FaqCategoryId { get; set; } public int ModuleId { get; set; } public string FaqCategoryName { get; set; } public string FaqCategoryDescription { get; set; } public int Level { get; set; } public int ViewOrder { get; set; }

        public catInfo()
        {

        }
    }

    #region Private Methods

    private void BindData()
    {
        FAQsController FAQsController = new FAQsController();
        IEnumerable<CategoryInfo> cats = FAQsController.ListCategoriesHierarchical(ModuleId, false);
        ArrayList lst = new ArrayList();
        foreach (CategoryInfo cat in cats)
        {
            catInfo cinfo = new catInfo()
            {
                FaqCategoryParentId = cat.FaqCategoryParentId.HasValue ? cat.FaqCategoryParentId.Value : -1,
                FaqCategoryId = cat.FaqCategoryId,
                ModuleId = cat.ModuleId,
                FaqCategoryName = cat.FaqCategoryName,
                FaqCategoryDescription = cat.FaqCategoryDescription,
                Level = cat.Level,
                ViewOrder = cat.ViewOrder
            };
            lst.Add(cinfo);
        }

        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;
    }

{code}

EPTamminga commented 8 years ago

@swkuhn Can you create a pull request with a bug fix?

swkuhn commented 8 years ago

yes.  We are doing a production release  middle of night tomorrow,  will be after that.

Scott

-------- Original message --------
From: Ernst Peter Tamminga notifications@github.com
Date:03/09/2016 9:14 PM (GMT-06:00)
To: "DNNCommunity/DNN.Faq" DNN.Faq@noreply.github.com
Cc: swkuhn swkuhn@gmail.com
Subject: Re: [DNN.Faq] DNN FAQ change category names (#5)
@swkuhn Can you create a pull request with a bug fix? — Reply to this email directly or view it on GitHub.
swkuhn commented 8 years ago

pull request created.

EPTamminga commented 8 years ago

Great! I will review and merge when I am back home from holiday.

EPTamminga commented 7 years ago

Merged