Ejemplo n.º 1
0
        /// <summary>
        /// Creates the markup for the current TabCollection
        /// </summary>
        /// <returns></returns>
        protected void BuildNavigationTree(StringBuilder builder, TabCollection tc, int parentsCount, bool isDisplay)
        {
            if (tc?.Tabs == null)
            {
                return;
            }

            foreach (var parent in tc.Tabs)
            {
                if (!TabManager.IsValid(parent, PermissionList))
                {
                    continue;
                }

                var linkUrl = FormatLink(parent);
                if (!string.IsNullOrEmpty(linkUrl) && !StringUtils.EqualsIgnoreCase(linkUrl, PageUtils.UnclickedUrl))
                {
                    linkUrl = PageUtils.GetLoadingUrl(linkUrl);
                }
                var hasChildren = parent.Children != null && parent.Children.Length > 0;
                var openWindow  = !hasChildren && StringUtils.EndsWithIgnoreCase(parent.Href, "main.aspx");

                var item = NavigationTreeItem.CreateNavigationBarItem(isDisplay, parent.Selected, parentsCount, hasChildren, openWindow, parent.Text, linkUrl, parent.Target, parent.Enabled, parent.IconUrl);

                builder.Append(item.GetTrHtml());
                if (parent.Children != null && parent.Children.Length > 0)
                {
                    var tc2 = NodeNaviTabManager.GetTabCollection(parent, PublishmentSystemId);
                    BuildNavigationTree(builder, tc2, parentsCount + 1, parent.Selected);
                }
            }
        }
Ejemplo n.º 2
0
//        protected void GetCmsMenu(StringBuilder builder,ECmsType type,bool isOpen )
//        {
//            string title = $@"
//<tr style='display:' treeItemLevel='1'>
//  <td nowrap>
//	<img align=""absmiddle"" style=""cursor: pointer; "" onClick=""displayChildren(this); "" isOpen=""{isOpen}"" src=""/siteserver/assets/icons/tree/{(isOpen? "minus.png":"plus.png")}""/>
//    <img align=""absmiddle"" src=""/siteserver/assets/icons/menu/content.png""/>&nbsp;
//    {ECmsTypeUtils.GetText(type)}
//  </td >
//</tr > ";

//            builder.Append(title);
//            var _publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(PublishmentSystemId);
//            try
//            {
//                var nodeIdList = DataProvider.NodeDao.GetNodeIdListByLevel(1, ECmsTypeUtils.GetDBType(type));
//                foreach (var nodeId in nodeIdList)
//                {
//                    var nodeInfo = NodeManager.GetNodeInfo(1, nodeId);
//                    if (nodeInfo != null)
//                    {
//                        builder.Append(GetChannelHtml(nodeInfo.PublishmentSystemId, nodeInfo.NodeId, nodeInfo.NodeName,isOpen));
//                    }
//                }

//            }
//            catch (Exception ex)
//            {
//                PageUtils.RedirectToErrorPage(ex.Message);
//            }

//        }
//        protected string GetChannelHtml(int publishmentId,int nodeId,string menuText,bool isDisplay)
//        {
//            string menuTemplete = $@"
//<tr style='{(isDisplay ? "display:" : "display: none")}' treeItemLevel='2'>
//     <td nowrap>
//         <img align = ""absmiddle"" src = ""/siteserver/assets/icons/tree/empty.gif"" />
//         <img align = ""absmiddle"" src = ""/siteserver/assets/icons/tree/empty.gif"" />
//         <img align = ""absmiddle"" src = ""/siteserver/assets/icons/menu/itemContainer.png"" /> &nbsp;
//         <a href='/siteserver/cms/pagecontent.aspx?PublishmentSystemID={publishmentId}&NodeID={nodeId}'  target = 'right' onclick = 'openFolderByA(this);' isTreeLink = 'true' >{menuText} </a> &nbsp;
//         </td >
//</tr > ";
//            return menuTemplete;
//        }
        /// <summary>
        /// Creates the markup for the current TabCollection
        /// </summary>
        /// <returns></returns>
        protected void BuildNavigationTree(StringBuilder builder, TabCollection tc, int parentsCount, bool isDisplay)
        {
            if (tc?.Tabs == null)
            {
                return;
            }

            foreach (var parent in tc.Tabs)
            {
                //    var nodeInfo = NodeManager.GetNodeInfo(1,nodeId);//子站继承主站栏目
                //    var enabled = AdminUtility.IsOwningNodeIdAll(body.AdministratorName, nodeInfo.NodeId);//管理员拥有权限的栏目
                //}
                //
                //if (!TabManager.IsValid(parent, PermissionList)) continue;
                if (parent.MenuType != null && parent.MenuType.Equals("cmsItem", StringComparison.OrdinalIgnoreCase))
                {
                    if (!AdminUtility.IsOwningNodeIdByPublishmentSystem(UserName, parent.NodeId))
                    {
                        continue;
                    }
                }
                //if ((parent.MenuType != null && parent.MenuType.Equals("cms", StringComparison.OrdinalIgnoreCase) && !CmsHasChildrenPerminssion(parent))) continue;
                if (!HasFirstRootMenu(parent))
                {
                    continue;
                }

                var linkUrl = FormatLink(parent);

                if (!string.IsNullOrEmpty(linkUrl) && !StringUtils.EqualsIgnoreCase(linkUrl, PageUtils.UnclickedUrl))
                {
                    linkUrl = PageUtils.GetLoadingUrl(linkUrl);
                }
                if (parent.MenuType != null && parent.MenuType.Equals("cmsItem", StringComparison.OrdinalIgnoreCase))
                {
                    linkUrl = PageUtils.GetAdminDirectoryUrl(parent.Href);
                }
                var hasChildren = parent.Children != null && parent.Children.Length > 0;
                var openWindow  = !hasChildren && StringUtils.EndsWithIgnoreCase(parent.Href, "main.aspx");

                var item = NavigationTreeItem.CreateNavigationBarItem(isDisplay, parent.Selected, parentsCount, hasChildren, openWindow, parent.Text, linkUrl, parent.Target, parent.Enabled, parent.IconUrl);

                builder.Append(item.GetTrHtml());
                if (parent.Children != null && parent.Children.Length > 0)
                {
                    var tc2 = NodeNaviTabManager.GetTabCollection(parent, PublishmentSystemId);
                    BuildNavigationTree(builder, tc2, parentsCount + 1, parent.Selected);
                }
            }
        }
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID");

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdFunction, AppManager.Cms.LeftMenu.Function.IdTracking, "栏目流量统计", AppManager.Cms.Permission.WebSite.Tracking);

                StartDate.Text = string.Empty;
                EndDate.Now    = true;

                ClientScriptRegisterClientScriptBlock("NodeTreeScript", NavigationTreeItem.GetNodeTreeScript());

                BindGrid();
            }
        }
Ejemplo n.º 4
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            LtlUserName.Text = AdminManager.GetDisplayName(Body.AdministratorName, true);

            _menuId      = Body.GetQueryString("menuID");
            _permissions = PermissionsManager.GetPermissions(Body.AdministratorName);

            if (string.IsNullOrEmpty(_menuId))
            {
                var publishmentSystemId = PublishmentSystemId;

                if (publishmentSystemId == 0)
                {
                    publishmentSystemId = Body.AdministratorInfo.PublishmentSystemId;
                }

                var publishmentSystemIdList = ProductPermissionsManager.Current.PublishmentSystemIdList;

                //站点要判断是否存在,是否有权限,update by sessionliang 20160104
                if (publishmentSystemId == 0 || !PublishmentSystemManager.IsExists(publishmentSystemId) || !publishmentSystemIdList.Contains(publishmentSystemId))
                {
                    //ArrayList publishmentSystemIDArrayList = PublishmentSystemManager.GetPublishmentSystemIDArrayListOrderByLevel();
                    // List<int> publishmentSystemIDList = ProductPermissionsManager.Current.PublishmentSystemIDList;
                    if (publishmentSystemIdList != null && publishmentSystemIdList.Count > 0)
                    {
                        publishmentSystemId = publishmentSystemIdList[0];
                    }
                }

                _publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);

                if (_publishmentSystemInfo != null && _publishmentSystemInfo.PublishmentSystemId > 0)
                {
                    if (PublishmentSystemId == 0)
                    {
                        PageUtils.Redirect(GetRedirectUrl(_publishmentSystemInfo.PublishmentSystemId, string.Empty));
                        return;
                    }

                    var showPublishmentSystem = false;

                    var permissionList = new List <string>();
                    if (ProductPermissionsManager.Current.WebsitePermissionDict.ContainsKey(_publishmentSystemInfo.PublishmentSystemId))
                    {
                        var websitePermissionList = ProductPermissionsManager.Current.WebsitePermissionDict[_publishmentSystemInfo.PublishmentSystemId];
                        if (websitePermissionList != null)
                        {
                            showPublishmentSystem = true;
                            permissionList.AddRange(websitePermissionList);
                        }
                    }

                    ICollection nodeIdCollection = ProductPermissionsManager.Current.ChannelPermissionDict.Keys;
                    foreach (int nodeId in nodeIdCollection)
                    {
                        if (ChannelUtility.IsAncestorOrSelf(_publishmentSystemInfo.PublishmentSystemId, _publishmentSystemInfo.PublishmentSystemId, nodeId))
                        {
                            showPublishmentSystem = true;
                            var list = ProductPermissionsManager.Current.ChannelPermissionDict[nodeId];
                            permissionList.AddRange(list);
                        }
                    }

                    var publishmentSystemIdHashtable = new Hashtable();
                    if (publishmentSystemIdList != null)
                    {
                        foreach (var thePublishmentSystemId in publishmentSystemIdList)
                        {
                            publishmentSystemIdHashtable.Add(thePublishmentSystemId, thePublishmentSystemId);
                        }
                    }

                    if (!publishmentSystemIdHashtable.Contains(PublishmentSystemId))
                    {
                        showPublishmentSystem = false;
                    }

                    if (!showPublishmentSystem)
                    {
                        PageUtils.RedirectToErrorPage("您没有此发布系统的操作权限!");
                        return;
                    }

                    var appId = EPublishmentSystemTypeUtils.GetValue(_publishmentSystemInfo.PublishmentSystemType);

                    NtLeftMenuSite.FileName            = $"~/SiteFiles/Configuration/Menus/{appId}/Management.config";
                    NtLeftMenuSite.PublishmentSystemId = _publishmentSystemInfo.PublishmentSystemId;
                    NtLeftMenuSite.PermissionList      = permissionList;

                    ClientScriptRegisterClientScriptBlock("NodeTreeScript", NodeNaviTreeItem.GetNavigationBarScript());
                }
                else
                {
                    if (_permissions.IsSystemAdministrator)
                    {
                        PageUtils.Redirect(PageAppAdd.GetRedirectUrl());
                        return;
                    }
                }
            }
            else if (!string.IsNullOrEmpty(_menuId))
            {
                var permissionList = new List <string>();
                if (ProductPermissionsManager.Current.WebsitePermissionDict.ContainsKey(PublishmentSystemId))
                {
                    var websitePermissionList = ProductPermissionsManager.Current.WebsitePermissionDict[PublishmentSystemId];
                    if (websitePermissionList != null)
                    {
                        permissionList.AddRange(websitePermissionList);
                    }
                }

                permissionList.AddRange(_permissions.PermissionList);
                NtLeftMenuSystem.FileName       = $"~/SiteFiles/Configuration/Menus/{_menuId}.config";
                NtLeftMenuSystem.PermissionList = permissionList;

                ClientScriptRegisterClientScriptBlock("NodeTreeScript", NavigationTreeItem.GetNavigationBarScript());
            }

            var topMenuList = new List <int> {
                1, 2
            };

            //cms超管和有权限的管理员
            if (_permissions.IsConsoleAdministrator || _permissions.PermissionList.Count > 0)
            {
                topMenuList.Add(3);
            }
            RptTopMenu.DataSource     = topMenuList;
            RptTopMenu.ItemDataBound += RptTopMenu_ItemDataBound;
            RptTopMenu.DataBind();

            //update at 20141106,避免空引用异常
            if (_publishmentSystemInfo != null && _publishmentSystemInfo.PublishmentSystemId > 0)
            {
                BaiRongDataProvider.AdministratorDao.UpdatePublishmentSystemId(Body.AdministratorName, _publishmentSystemInfo.PublishmentSystemId);
            }
        }