Ejemplo n.º 1
0
        private void RenderMenuTree(HtmlTextWriter output)
        {
            IUserStatusEntity curUserStatus = Page.Items[SQA.CURRENT_USER_STATUS] as IUserStatusEntity;

            IList <int> roleList = null;

            if (curUserStatus != null && curUserStatus.hasRoleEx)
            {
                roleList = RoleData.GetRoleExList(user.id);
            }

            if (roleList == null)
            {
                roleList = new List <int>();
            }
            roleList.Insert(0, user.roleid);

            foreach (int roleid in roleList)
            {
                //TODO:CACHE
                IList <AppEntity> list = Role.ActionList(roleid);

                output.Write("<div class=\"f14 fb pl10 mt-title clear\">" + Role.GetDisplayName(roleid) + "</div><div class=\"mt-item-list\">");

                foreach (AppEntity action in list)
                {
                    string text   = action.name;
                    string link   = action.url;
                    string icon   = action.icon;
                    string optext = (action.opname == null) ? "" : action.opname;
                    string oplink = (action.opurl == null) ? "" : action.opurl;
                    output.Write("<div><a class=\"main\" href=\"" + link + "\" style=\"background-image:url('/i/app/" + icon + "');\">" + text + "</a><a class=\"action\" href=\"" + oplink + "\">" + optext + "</a></div>");
                }
                output.Write("</div>");
            }
        }