Beispiel #1
0
        private string RenderAllFunctionBindMenu()
        {
            var htmlTreeView = Null.NullString;

            var allMenus = MenuBL.GetAllMenu();

            foreach (var menu in allMenus)
            {
                var lstFunctionsOnMenu = this._lstRootFunctionInGroup.Where(o => o.MenuId == menu.Id).ToList();
                if (lstFunctionsOnMenu.Count == 0)
                {
                    htmlTreeView += "<li class='menu-li-funtions'>";
                    htmlTreeView += "<input type='checkbox' data-typemenu='TRUE' onclick='checkInMenu(this)' /> ";
                    htmlTreeView += "<span onclick='checkFollowMenu(this);'>" + menu.Name + "</span>";
                    htmlTreeView += "</li>";
                }
                else
                {
                    var checkMenuAddedToGroup = Null.NullString;
                    if (lstFunctionsOnMenu.All(o => o.IsFunctionAddedToGroup()))
                    {
                        checkMenuAddedToGroup = "checked";
                    }

                    htmlTreeView += "<ul class='ul-functions'>";
                    htmlTreeView += "<li>";
                    htmlTreeView += "<span class='expand-collapse' onclick='showHideContent(this);'>-</span>";
                    htmlTreeView += "<span class='dotted-letter'>-----</span>";
                    htmlTreeView += "<input type='checkbox' data-typemenu='TRUE' " + checkMenuAddedToGroup + " onclick='checkInMenu(this);' />";
                    htmlTreeView += "<span class='name-fn-mns' onclick='checkFollowMenu(this);'>" + menu.Name + "</span>";
                    htmlTreeView += "<ul data-fninner='TRUE'>";
                    htmlTreeView += this.RenderFunctionsInGroupToHtmlTreeView(lstFunctionsOnMenu, 0);
                    htmlTreeView += "</ul>";
                    htmlTreeView += "</li>";
                    htmlTreeView += "</ul>";
                }
            }

            return(htmlTreeView);
        }
Beispiel #2
0
        /// <summary>
        /// BuildUserHtmlMenu, 2018.08.30 HungTD: load danh muc wiki
        /// </summary>
        /// <param name="lstFunctionDisplayInMenu"></param>
        /// <param name="parentFunctionId"></param>
        /// <param name="language"></param>
        /// <returns></returns>
        private string BuildUserHtmlMenu(List <FunctionInfo> lstFunctionDisplayInMenu, int parentFunctionId, string language)
        {
            var userHtmlMenu = string.Empty;

            try
            {
                #region Load menu khai báo ở function và menu

                var lstFunctionOnMenu = lstFunctionDisplayInMenu.Where(o => o.MenuId != 0).ToList();
                if (lstFunctionOnMenu.Any())
                {
                    foreach (var menu in MenuBL.GetAllMenu())
                    {
                        var lstFunctionsInGroupMenu = lstFunctionOnMenu.Where(o => o.MenuId == menu.Id).ToList();
                        if (lstFunctionsInGroupMenu.Any())
                        {
                            string displayName = menu.DisplayName;
                            if (language == Language.LangEN)
                            {
                                displayName = menu.DisplayName_Eng;
                            }
                            userHtmlMenu += "<li class='group-menu' onclick='javascript:;'>" + displayName
                                            + "<ul class='ul-group-menu collapsed' style='display:none;'>"
                                            + this.BuildFunctionOnMenu(lstFunctionsInGroupMenu, parentFunctionId, language)
                                            + "</ul></li>";
                        }
                    }
                }

                var lstFunctionHaveNoGroup = lstFunctionDisplayInMenu.Where(o => o.MenuId == 0).ToList();
                userHtmlMenu += this.BuildFunctionOnMenu(lstFunctionHaveNoGroup, parentFunctionId, language);


                #endregion

                #region Load menu wiki
                //int _lastmenuid = _userHtmlMenuId;
                //string _wikistyle = "", _wikihref = "", _javafunc = "", _wikilink = "";
                //string _menuName = "Quản lý Wiki";
                //string _urlLang = "/vi-vn";

                //if (language == Language.LangEN)
                //{
                //    _menuName = "Wiki manage";
                //    _urlLang = "/en-gb";
                //}

                //_javafunc = " onclick='gotoTask(this)'>";

                //userHtmlMenu += " <li  class='group-menu' onclick='javascript:;' >" + "  <span data-menu='item-main-menu'><i class='fas fa-cog fa-fw'></i> " + _menuName + " </span>  "
                //                            + " <ul class='ul-group-menu collapsed' style='display:none;'>";
                //_lastmenuid++;
                //_wikihref = _urlLang + "/wiki-manage/wiki-doc/list/1";
                //_wikilink = _urlLang + "/wiki-manage/wiki-doc/list/";
                //_wikilink = "data-link='" + _wikilink + "' ";
                //_wikihref = "data-url='" + _wikihref + "' ";
                //// quản lý bài viết
                //userHtmlMenu += "<li id='li-menu-" + _lastmenuid  + "' "
                //           + _wikihref
                //           + _wikilink
                //           + "data-id='" + _lastmenuid + "' "
                //            + _javafunc + "<span class='menu-text'>" + (language == Language.LangEN ? "Wiki manage by status" : "Quản lý bài viết")
                //           + "</span></li>";
                //// quản lý danh mục chủ đề
                //_lastmenuid++;
                //_wikihref = _urlLang + "/wiki-manage/wiki-doc/catalogue-list";
                //_wikihref = "data-url='" + _wikihref + "' ";
                //userHtmlMenu += "<li id='li-menu-" + _lastmenuid  + "' "
                //          + _wikihref
                //          + "data-id='" + _lastmenuid + "' "
                //           + _javafunc + "<span class='menu-text'>" + (language == Language.LangEN ? "Catalogue manage" : "Quản lý chủ đề")
                //          + "</span></li>";

                //userHtmlMenu += "  </ul></li>  ";


                //WikiCatalogue_BL _CatalogueBL = new WikiCatalogue_BL();
                //List<WikiCatalogues_Info> _ListCata = new List<WikiCatalogues_Info>();
                //_ListCata = _CatalogueBL.Portal_CataGetAll();

                //_menuName = "Thư viện dữ liệu";
                //if (language == Language.LangEN)
                //{
                //    _menuName = "Wiki data";
                //    _urlLang = "/en-gb";
                //}
                //userHtmlMenu += "<li class='group-menu' onclick='javascript:;'>" + "<span data-menu='item-main-menu'><i class='fas fa-cog fa-fw'></i> " + _menuName + " </span>"
                //                               + "<ul class='ul-group-menu collapsed' style='display:none;'>";
                //foreach (var item in _ListCata)
                //{
                //    _lastmenuid++;
                //    _wikistyle = ""; _wikihref = ""; _javafunc = "";
                //    if (item.CATA_LEVEL == 1)
                //    {
                //        _wikistyle = "style='margin-left:10px;'";

                //    }
                //    _wikihref = _urlLang + "/wiki-view/doc-view/" + item.ID + "/0";
                //    _wikihref = "data-url='" + _wikihref + "' ";
                //    _javafunc = "   >";

                //    userHtmlMenu +=  "<li id='li-menu-" + _lastmenuid + "' " + _wikistyle
                //            + _wikihref
                //            + "data-id='" + _lastmenuid + "' "
                //             + _javafunc + "<span class='menu-text'>" + " <a target='_blank' href = '/wiki-view/doc-view/" + item.ID + "/0' >" +
                //               (language == Language.LangEN?item.NAME_ENG:item.NAME)
                //              + " </a> "
                //            + "</span></li>  ";

                //}
                //userHtmlMenu += "</ul></li>";

                #endregion
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(userHtmlMenu);
        }