예제 #1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID");
            returnUrl = StringUtils.ValueFromUrl(Body.GetQueryString("ReturnUrl"));

            if (!HasChannelPermissions(PublishmentSystemId, AppManager.Cms.Permission.Channel.ContentDelete))
            {
                IsDeleteAfterTranslate.Visible = false;
            }

            if (!IsPostBack)
            {
                BreadCrumb(AppManager.Cms.LeftMenu.IdContent, "批量转移", string.Empty);

                phReturn.Visible = !string.IsNullOrEmpty(returnUrl);
                ETranslateTypeUtils.AddListItems(TranslateType);
                if (Body.IsQueryExists("ChannelIDCollection"))
                {
                    ControlUtils.SelectListItems(TranslateType, ETranslateTypeUtils.GetValue(ETranslateType.All));
                }
                else
                {
                    ControlUtils.SelectListItems(TranslateType, ETranslateTypeUtils.GetValue(ETranslateType.Content));
                }

                IsDeleteAfterTranslate.Items[0].Value = true.ToString();
                IsDeleteAfterTranslate.Items[1].Value = false.ToString();

                var publishmentSystemIDList = ProductPermissionsManager.Current.PublishmentSystemIdList;
                foreach (var psID in publishmentSystemIDList)
                {
                    var psInfo   = PublishmentSystemManager.GetPublishmentSystemInfo(psID);
                    var listitem = new ListItem(psInfo.PublishmentSystemName, psID.ToString());
                    if (psID == PublishmentSystemId)
                    {
                        listitem.Selected = true;
                    }
                    PublishmentSystemIDDropDownList.Items.Add(listitem);
                }

                var nodeIDStrArrayList = new List <string>();
                if (Body.IsQueryExists("ChannelIDCollection"))
                {
                    nodeIDStrArrayList = TranslateUtils.StringCollectionToStringList(Body.GetQueryString("ChannelIDCollection"));
                }

                var nodeIdList = DataProvider.NodeDao.GetNodeIdListByPublishmentSystemId(PublishmentSystemId);
                var nodeCount  = nodeIdList.Count;
                isLastNodeArray = new bool[nodeCount];
                foreach (int theNodeID in nodeIdList)
                {
                    var enabled = IsOwningNodeId(theNodeID);
                    if (!enabled)
                    {
                        if (!IsHasChildOwningNodeId(theNodeID))
                        {
                            continue;
                        }
                    }
                    var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, theNodeID);

                    var value = enabled ? nodeInfo.NodeId.ToString() : string.Empty;
                    value = (nodeInfo.Additional.IsContentAddable) ? value : string.Empty;

                    var text     = GetTitle(nodeInfo);
                    var listItem = new ListItem(text, value);
                    if (nodeIDStrArrayList.Contains(value))
                    {
                        listItem.Selected = true;
                    }
                    NodeIDFrom.Items.Add(listItem);
                    listItem = new ListItem(text, value);
                    NodeIDTo.Items.Add(listItem);
                }
            }
        }
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId");
            ReturnUrl = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("ReturnUrl"));

            if (!HasChannelPermissions(SiteId, ConfigManager.ChannelPermissions.ContentDelete))
            {
                RblIsDeleteAfterTranslate.Visible = false;
            }

            if (IsPostBack)
            {
                return;
            }

            PhReturn.Visible = !string.IsNullOrEmpty(ReturnUrl);
            ETranslateTypeUtils.AddListItems(DdlTranslateType);
            ControlUtils.SelectSingleItem(DdlTranslateType,
                                          AuthRequest.IsQueryExists("ChannelIDCollection")
                    ? ETranslateTypeUtils.GetValue(ETranslateType.All)
                    : ETranslateTypeUtils.GetValue(ETranslateType.Content));

            var siteIdList = AuthRequest.AdminPermissionsImpl.GetSiteIdList();

            foreach (var psId in siteIdList)
            {
                var psInfo   = SiteManager.GetSiteInfo(psId);
                var listitem = new ListItem(psInfo.SiteName, psId.ToString());
                if (psId == SiteId)
                {
                    listitem.Selected = true;
                }
                DdlSiteId.Items.Add(listitem);
            }

            var channelIdStrList = new List <string>();

            if (AuthRequest.IsQueryExists("ChannelIDCollection"))
            {
                channelIdStrList = TranslateUtils.StringCollectionToStringList(AuthRequest.GetQueryString("ChannelIDCollection"));
            }

            var channelIdList = ChannelManager.GetChannelIdList(SiteId);
            var nodeCount     = channelIdList.Count;

            _isLastNodeArray = new bool[nodeCount];
            foreach (var theChannelId in channelIdList)
            {
                var enabled = IsOwningChannelId(theChannelId);
                if (!enabled)
                {
                    if (!IsDescendantOwningChannelId(theChannelId))
                    {
                        continue;
                    }
                }
                var nodeInfo = ChannelManager.GetChannelInfo(SiteId, theChannelId);

                var value = enabled ? nodeInfo.Id.ToString() : string.Empty;
                value = nodeInfo.Additional.IsContentAddable ? value : string.Empty;

                var text     = GetTitle(nodeInfo);
                var listItem = new ListItem(text, value);
                if (channelIdStrList.Contains(value))
                {
                    listItem.Selected = true;
                }
                LbChannelIdFrom.Items.Add(listItem);
                listItem = new ListItem(text, value);
                DdlChannelIdTo.Items.Add(listItem);
            }
        }