コード例 #1
0
 public static string GetGetLoadingChannelsParameters(int siteId, ELoadingType loadingType, NameValueCollection additional)
 {
     return(TranslateUtils.NameValueCollectionToString(new NameValueCollection
     {
         { "siteID", siteId.ToString() },
         { "loadingType", ELoadingTypeUtils.GetValue(loadingType) },
         { "additional", TranslateUtils.EncryptStringBySecretKey(TranslateUtils.NameValueCollectionToString(additional)) }
     }));
 }
コード例 #2
0
ファイル: ELoadingType.cs プロジェクト: stonezhu870/cms-1
 public static string GetValue(ELoadingType type)
 {
     if (type == ELoadingType.ContentTree)
     {
         return("ContentTree");
     }
     else if (type == ELoadingType.Channel)
     {
         return("Channel");
     }
     else if (type == ELoadingType.ChannelSelect)
     {
         return("ChannelSelect");
     }
     else if (type == ELoadingType.SiteAnalysis)
     {
         return("SiteAnalysis");
     }
     else if (type == ELoadingType.TemplateFilePathRule)
     {
         return("TemplateFilePathRule");
     }
     else if (type == ELoadingType.ConfigurationCreateDetails)
     {
         return("ConfigurationCreateDetails");
     }
     else if (type == ELoadingType.ConfigurationCrossSiteTrans)
     {
         return("ConfigurationCrossSiteTrans");
     }
     else if (type == ELoadingType.ConfigurationSignin)
     {
         return("ConfigurationSignin");
     }
     else if (type == ELoadingType.GovPublicChannelAdd)
     {
         return("GovPublicChannelAdd");
     }
     else if (type == ELoadingType.GovPublicChannelTree)
     {
         return("GovPublicChannelTree");
     }
     else if (type == ELoadingType.GovPublicChannel)
     {
         return("GovPublicChannel");
     }
     else if (type == ELoadingType.GovInteractChannel)
     {
         return("GovInteractChannel");
     }
     else
     {
         throw new Exception();
     }
 }
コード例 #3
0
 public static bool Equals(ELoadingType type, string typeStr)
 {
     if (string.IsNullOrEmpty(typeStr))
     {
         return(false);
     }
     if (string.Equals(GetValue(type).ToLower(), typeStr.ToLower()))
     {
         return(true);
     }
     return(false);
 }
コード例 #4
0
    //不管从哪种情况进入加载界面,都从这里离开
    public override void LeaveMovie()
    {
        switch (curLoadingTyep)
        {
        case ELoadingType.ELW_Default:
            LeaveByDefault();
            break;

        case ELoadingType.ELW_MOBA:
            LeaveByMOBA();
            break;
        }
        curLoadingTyep = ELoadingType.ELW_None;
        base.LeaveMovie();
    }
コード例 #5
0
    public void EnterMovie(ELoadingType type)
    {
        curLoadingTyep = type;
        switch (curLoadingTyep)
        {
        case ELoadingType.ELW_Default:
            EnterByDefault();
            break;

        case ELoadingType.ELW_MOBA:
            EnterByMOBA();
            break;
        }
        base.EnterMovie();
    }
コード例 #6
0
        public static string GetChannelRowHtml(SiteInfo siteInfo, ChannelInfo nodeInfo, bool enabled, ELoadingType loadingType, NameValueCollection additional, PermissionsImpl permissionsImpl)
        {
            var nodeTreeItem = ChannelTreeItem.CreateInstance(siteInfo, nodeInfo, enabled, permissionsImpl);
            var adminId      = permissionsImpl.GetAdminId(siteInfo.Id, nodeInfo.Id);
            var title        = nodeTreeItem.GetItemHtml(loadingType, PageChannel.GetRedirectUrl(siteInfo.Id, nodeInfo.Id), adminId, additional);

            var rowHtml = string.Empty;

            if (loadingType == ELoadingType.ContentTree)
            {
                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td nowrap>{title}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.Channel)
            {
                var upLink       = string.Empty;
                var downLink     = string.Empty;
                var editUrl      = string.Empty;
                var checkBoxHtml = string.Empty;

                if (enabled)
                {
                    if (permissionsImpl.HasChannelPermissions(nodeInfo.SiteId, nodeInfo.Id, ConfigManager.ChannelPermissions.ChannelEdit))
                    {
                        editUrl = $@"<a href=""{PageChannelEdit.GetRedirectUrl(nodeInfo.SiteId, nodeInfo.Id, PageChannel.GetRedirectUrl(nodeInfo.SiteId, nodeInfo.Id))}"" onclick=""event.stopPropagation()"">编辑</a>";
                        upLink  =
                            $@"<a href=""{PageUtils.GetCmsUrl(nodeInfo.SiteId, nameof(PageChannel), new NameValueCollection
                            {
                                {"Subtract", true.ToString()},
                                {"channelId", nodeInfo.Id.ToString()}
                            })}"" onclick=""event.stopPropagation()""><img src=""../Pic/icon/up.gif"" border=""0"" alt=""上升"" /></a>";
                        downLink =
                            $@"<a href=""{PageUtils.GetCmsUrl(nodeInfo.SiteId, nameof(PageChannel), new NameValueCollection
                            {
                                {"Add", true.ToString()},
                                {"channelId", nodeInfo.Id.ToString()}
                            })}"" onclick=""event.stopPropagation()""><img src=""../Pic/icon/down.gif"" border=""0"" alt=""下降"" /></a>";
                    }
                    checkBoxHtml = $@"<input type=""checkbox"" name=""ChannelIDCollection"" value=""{nodeInfo.Id}"" onclick=""checkboxClick(this)"" />";
                }

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"" onclick=""activeRow(this);return false;"">
    <td>{title}</td>
    <td class=""text-nowrap"">{nodeInfo.GroupNameCollection}</td>
    <td class=""text-nowrap"">{nodeInfo.IndexName}</td>
    <td class=""text-center"">{upLink}</td>
    <td class=""text-center"">{downLink}</td>
    <td class=""text-center"">{editUrl}</td>
    <td class=""text-center"">{checkBoxHtml}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.SiteAnalysis)
            {
                var startDate = TranslateUtils.ToDateTime(additional["StartDate"]);
                var endDate   = TranslateUtils.ToDateTime(additional["EndDate"]);

                var tableName     = ChannelManager.GetTableName(siteInfo, nodeInfo);
                var num           = DataProvider.ContentDao.GetCountOfContentAdd(tableName, siteInfo.Id, nodeInfo.Id, EScopeType.All, startDate, endDate, string.Empty, ETriState.All);
                var contentAddNum = num == 0 ? "0" : $"<strong>{num}</strong>";

                num = DataProvider.ContentDao.GetCountOfContentUpdate(tableName, siteInfo.Id, nodeInfo.Id, EScopeType.All, startDate, endDate, string.Empty);
                var contentUpdateNum = num == 0 ? "0" : $"<strong>{num}</strong>";

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
	<td class=""text-center"">{contentAddNum}</td>
	<td class=""text-center"">{contentUpdateNum}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.TemplateFilePathRule)
            {
                var editLink = string.Empty;

                if (enabled)
                {
                    var showPopWinString = ModalTemplateFilePathRule.GetOpenWindowString(nodeInfo.SiteId, nodeInfo.Id);
                    editLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">更改</a>";
                }
                var filePath = PageUtility.GetInputChannelUrl(siteInfo, nodeInfo, false);

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
	<td>{filePath}</td>
	<td class=""text-center"">{editLink}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.ConfigurationCreateDetails)
            {
                var editChannelLink = string.Empty;

                var nodeNames = string.Empty;

                if (enabled)
                {
                    var showPopWinString = ModalConfigurationCreateChannel.GetOpenWindowString(nodeInfo.SiteId, nodeInfo.Id);
                    editChannelLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">触发栏目</a>";
                }

                var nodeNameBuilder = new StringBuilder();
                var channelIdList   = TranslateUtils.StringCollectionToIntList(nodeInfo.Additional.CreateChannelIdsIfContentChanged);
                foreach (var theChannelId in channelIdList)
                {
                    var theNodeInfo = ChannelManager.GetChannelInfo(siteInfo.Id, theChannelId);
                    if (theNodeInfo != null)
                    {
                        nodeNameBuilder.Append(theNodeInfo.ChannelName).Append(",");
                    }
                }
                if (nodeNameBuilder.Length > 0)
                {
                    nodeNameBuilder.Length--;
                    nodeNames = nodeNameBuilder.ToString();
                }

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
	<td>{nodeNames}</td>
	<td class=""text-center"">{editChannelLink}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.ConfigurationCrossSiteTrans)
            {
                var editLink = string.Empty;

                if (enabled)
                {
                    var showPopWinString = ModalCrossSiteTransEdit.GetOpenWindowString(nodeInfo.SiteId, nodeInfo.Id);
                    editLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">更改</a>";
                }

                var contribute = CrossSiteTransUtility.GetDescription(nodeInfo.SiteId, nodeInfo);

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
	<td>{contribute}</td>
	<td class=""text-center"">{editLink}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.ChannelClickSelect)
            {
                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
</tr>
";
            }

            return(rowHtml);
        }
コード例 #7
0
 public static string GetScript(PublishmentSystemInfo publishmentSystemInfo, ELoadingType loadingType, NameValueCollection additional)
 {
     return(NodeTreeItem.GetScript(publishmentSystemInfo, loadingType, additional));
 }
コード例 #8
0
        public static string GetChannelRowHtml(PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo, bool enabled, ELoadingType loadingType, NameValueCollection additional, string administratorName)
        {
            var nodeTreeItem = NodeTreeItem.CreateInstance(nodeInfo, enabled, administratorName);
            var title        = nodeTreeItem.GetItemHtml(loadingType, PageChannel.GetRedirectUrl(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId), additional);

            var rowHtml = string.Empty;

            if (loadingType == ELoadingType.ContentTree)
            {
                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td align=""left"" nowrap>
		{title}
	</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.Channel)
            {
                var upLink       = string.Empty;
                var downLink     = string.Empty;
                var editUrl      = string.Empty;
                var checkBoxHtml = string.Empty;

                if (enabled)
                {
                    if (AdminUtility.HasChannelPermissions(administratorName, nodeInfo.PublishmentSystemId, nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ChannelEdit))
                    {
                        var urlEdit = PageChannelEdit.GetRedirectUrl(nodeInfo.PublishmentSystemId, nodeInfo.NodeId, PageChannel.GetRedirectUrl(nodeInfo.PublishmentSystemId, nodeInfo.NodeId));
                        editUrl = $"<a href=\"{urlEdit}\">编辑</a>";
                        var urlSubtract = PageUtils.GetCmsUrl(nameof(PageChannel), new NameValueCollection
                        {
                            { "PublishmentSystemID", nodeInfo.PublishmentSystemId.ToString() },
                            { "Subtract", true.ToString() },
                            { "NodeID", nodeInfo.NodeId.ToString() }
                        });
                        upLink =
                            $@"<a href=""{urlSubtract}""><img src=""../Pic/icon/up.gif"" border=""0"" alt=""上升"" /></a>";
                        var urlAdd = PageUtils.GetCmsUrl(nameof(PageChannel), new NameValueCollection
                        {
                            { "PublishmentSystemID", nodeInfo.PublishmentSystemId.ToString() },
                            { "Add", true.ToString() },
                            { "NodeID", nodeInfo.NodeId.ToString() }
                        });
                        downLink =
                            $@"<a href=""{urlAdd}""><img src=""../Pic/icon/down.gif"" border=""0"" alt=""下降"" /></a>";
                    }
                    checkBoxHtml = $"<input type='checkbox' name='ChannelIDCollection' value='{nodeInfo.NodeId}' />";
                }

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
    <td>{title}</td>
    <td>{nodeInfo.NodeGroupNameCollection}</td>
    <td><nobr>{nodeInfo.NodeIndexName}</nobr></td>
    <td class=""center"">
	    {upLink}
    </td>
    <td class=""center"">
	    {downLink}
    </td>
    <td class=""center"">
	    {editUrl}
    </td>
    <td class=""center"">
	    {checkBoxHtml}
    </td>
</tr>
";
            }
            else if (loadingType == ELoadingType.SiteAnalysis)
            {
                var contentAddNum    = string.Empty;
                var contentUpdateNum = string.Empty;

                var startDate = TranslateUtils.ToDateTime(additional["StartDate"]);
                var endDate   = TranslateUtils.ToDateTime(additional["EndDate"]);

                var tableName = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo);
                var num       = DataProvider.ContentDao.GetCountOfContentAdd(tableName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, startDate, endDate, string.Empty);
                contentAddNum = (num == 0) ? "0" : $"<strong>{num}</strong>";

                num = DataProvider.ContentDao.GetCountOfContentUpdate(tableName, publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId, startDate, endDate, string.Empty);
                contentUpdateNum = (num == 0) ? "0" : $"<strong>{num}</strong>";

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>
		<nobr>{title}</nobr>
	</td>
	<td>
		{contentAddNum}
	</td>
	<td>
		{contentUpdateNum}
	</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.TemplateFilePathRule)
            {
                var editLink = string.Empty;

                var filePath = string.Empty;

                if (enabled)
                {
                    var showPopWinString = ModalTemplateFilePathRule.GetOpenWindowString(nodeInfo.PublishmentSystemId, nodeInfo.NodeId);
                    editLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">更改</a>";
                }
                filePath = PageUtility.GetInputChannelUrl(publishmentSystemInfo, nodeInfo);

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>
		<nobr>{title}</nobr>
	</td>
	<td>
		<nobr>{filePath}</nobr>
	</td>
	<td class=""center"">
		{editLink}
	</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.ConfigurationCreateDetails)
            {
                var editChannelLink = string.Empty;

                var nodeNames = string.Empty;

                if (enabled)
                {
                    var showPopWinString = ModalConfigurationCreateChannel.GetOpenWindowString(nodeInfo.PublishmentSystemId, nodeInfo.NodeId);
                    editChannelLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">触发栏目</a>";
                }

                if (nodeInfo.Additional.Attributes.Count > 0)
                {
                    var nodeNameBuilder = new StringBuilder();
                    var nodeIDArrayList = TranslateUtils.StringCollectionToIntList(nodeInfo.Additional.CreateChannelIDsIfContentChanged);
                    foreach (int theNodeID in nodeIDArrayList)
                    {
                        var theNodeInfo = NodeManager.GetNodeInfo(publishmentSystemInfo.PublishmentSystemId, theNodeID);
                        if (theNodeInfo != null)
                        {
                            nodeNameBuilder.Append(theNodeInfo.NodeName).Append(",");
                        }
                    }
                    if (nodeNameBuilder.Length > 0)
                    {
                        nodeNameBuilder.Length--;
                        nodeNames = nodeNameBuilder.ToString();
                    }
                }

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>
		<nobr>{title}</nobr>
	</td>
	<td>
		{nodeNames}
	</td>
	<td class=""center"">
		{editChannelLink}
	</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.ConfigurationCrossSiteTrans)
            {
                var editLink = string.Empty;

                var contribute = string.Empty;

                if (enabled)
                {
                    var showPopWinString = ModalCrossSiteTransEdit.GetOpenWindowString(nodeInfo.PublishmentSystemId, nodeInfo.NodeId);
                    editLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">更改</a>";
                }

                contribute = CrossSiteTransUtility.GetDescription(nodeInfo.PublishmentSystemId, nodeInfo);

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
	<td>{contribute}</td>
	<td class=""center"" width=""50"">{editLink}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.ConfigurationSignin)
            {
                var editLink = string.Empty;

                if (enabled)
                {
                    var showPopWinString = ModalConfigurationSignin.GetOpenWindowString(nodeInfo.PublishmentSystemId, nodeInfo.NodeId);
                    editLink = $"<a href=\"javascript:;\" onclick=\"{showPopWinString}\">更改</a>";
                }

                //string contribute = CrossSiteTransUtility.GetDescription(nodeInfo.PublishmentSystemID, nodeInfo);
                var isSign   = "";
                var SignUser = "";
                if (nodeInfo.Additional.IsSignin)
                {
                    isSign = "是";
                }
                else
                {
                    isSign = "否";
                }
                //if (!string.IsNullOrEmpty(nodeInfo.Additional.SigninUserGroupCollection))
                //{
                //    ArrayList groupIDlist = TranslateUtils.StringCollectionToIntList(nodeInfo.Additional.SigninUserGroupCollection);
                //    UserGroupInfo userGroupInfo = null;
                //    foreach (int groupID in groupIDlist)
                //    {
                //        userGroupInfo = DataProvider.UserGroupDAO.GetUserGroupMessage(groupID);
                //        SignUser += userGroupInfo.GroupName + ',';
                //    }
                //    SignUser = SignUser.TrimEnd(',');
                //}
                //else
                //{
                SignUser = nodeInfo.Additional.SigninUserNameCollection;
                //}

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td>{title}</td>
    <td>{SignUser}</td>
	<td class=""center"">{isSign}</td>
	<td class=""center"">{editLink}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.ChannelSelect || loadingType == ELoadingType.GovPublicChannelAdd || loadingType == ELoadingType.GovPublicChannelTree)
            {
                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td nowrap>{title}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.GovPublicChannel)
            {
                var editUrl      = string.Empty;
                var upLink       = string.Empty;
                var downLink     = string.Empty;
                var checkBoxHtml = string.Empty;

                if (!EContentModelTypeUtils.Equals(EContentModelType.GovPublic, nodeInfo.ContentModelId))
                {
                    enabled = false;
                }

                if (enabled)
                {
                    editUrl =
                        $@"<a href=""javascript:;"" onclick=""{ModalGovPublicChannelAdd
                            .GetOpenWindowStringToEdit(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId,
                                string.Empty)}"">编辑</a>";

                    var urlUp = PageUtils.GetWcmUrl(nameof(PageGovPublicChannel), new NameValueCollection
                    {
                        { "PublishmentSystemID", nodeInfo.PublishmentSystemId.ToString() },
                        { "NodeID", nodeInfo.NodeId.ToString() },
                        { "Subtract", true.ToString() }
                    });
                    upLink = $@"<a href=""{urlUp}""><img src=""../Pic/icon/up.gif"" border=""0"" alt=""上升"" /></a>";

                    var urlDown = PageUtils.GetWcmUrl(nameof(PageGovPublicChannel), new NameValueCollection
                    {
                        { "PublishmentSystemID", nodeInfo.PublishmentSystemId.ToString() },
                        { "NodeID", nodeInfo.NodeId.ToString() },
                        { "Add", true.ToString() }
                    });
                    downLink =
                        $@"<a href=""{urlDown}""><img src=""../Pic/icon/down.gif"" border=""0"" alt=""下降"" /></a>";

                    checkBoxHtml = $"<input type='checkbox' name='ChannelIDCollection' value='{nodeInfo.NodeId}' />";
                }

                var channelCode = DataProvider.GovPublicChannelDao.GetCode(nodeInfo.NodeId);

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
    <td>{title}</td>
    <td>{channelCode}</td>
    <td class=""center"">{upLink}</td>
    <td class=""center"">{downLink}</td>
    <td class=""center"">{editUrl}</td>
    <td class=""center"">{checkBoxHtml}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.GovInteractChannel)
            {
                var editUrl      = string.Empty;
                var upLink       = string.Empty;
                var downLink     = string.Empty;
                var styleAddUrl  = string.Empty;
                var checkBoxHtml = string.Empty;

                if (enabled)
                {
                    var applyStyleId = DataProvider.GovInteractChannelDao.GetApplyStyleId(nodeInfo.PublishmentSystemId, nodeInfo.NodeId);
                    editUrl =
                        $@"<a href=""javascript:;"" onclick=""{ModalGovInteractChannelAdd
                            .GetOpenWindowStringToEdit(publishmentSystemInfo.PublishmentSystemId, nodeInfo.NodeId,
                                string.Empty)}"">编辑</a>";

                    var urlUp = PageUtils.GetWcmUrl(nameof(PageGovInteractChannel), new NameValueCollection
                    {
                        { "PublishmentSystemID", nodeInfo.PublishmentSystemId.ToString() },
                        { "NodeID", nodeInfo.NodeId.ToString() },
                        { "Subtract", true.ToString() }
                    });
                    upLink = $@"<a href=""{urlUp}""><img src=""../Pic/icon/up.gif"" border=""0"" alt=""上升"" /></a>";

                    var urlDown = PageUtils.GetWcmUrl(nameof(PageGovInteractChannel), new NameValueCollection
                    {
                        { "PublishmentSystemID", nodeInfo.PublishmentSystemId.ToString() },
                        { "NodeID", nodeInfo.NodeId.ToString() },
                        { "Add", true.ToString() }
                    });
                    downLink =
                        $@"<a href=""{urlDown}""><img src=""../Pic/icon/down.gif"" border=""0"" alt=""下降"" /></a>";

                    styleAddUrl =
                        $@"<a href=""javascript:;"" onclick=""{ModalTagStyleGovInteractApplyAdd.GetOpenWindowStringToEdit(publishmentSystemInfo.PublishmentSystemId, applyStyleId)}"">提交设置</a>";
                    checkBoxHtml = $"<input type='checkbox' name='ChannelIDCollection' value='{nodeInfo.NodeId}' />";
                }

                var summary = DataProvider.GovInteractChannelDao.GetSummary(nodeInfo.NodeId);

                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
    <td>{title}</td>
    <td>{summary}</td>
    <td class=""center"">{upLink}</td>
    <td class=""center"">{downLink}</td>
    <td class=""center"">{styleAddUrl}</td>
    <td class=""center"">{editUrl}</td>
    <td class=""center"">{checkBoxHtml}</td>
</tr>
";
            }
            else if (loadingType == ELoadingType.GovPublicChannelAdd || loadingType == ELoadingType.GovPublicChannelTree)
            {
                rowHtml = $@"
<tr treeItemLevel=""{nodeInfo.ParentsCount + 1}"">
	<td nowrap>{title}</td>
</tr>
";
            }

            return(rowHtml);
        }
コード例 #9
0
        public string GetItemHtml(ELoadingType loadingType, string returnUrl, NameValueCollection additional)
        {
            var htmlBuilder  = new StringBuilder();
            var parentsCount = _channelInfo.ParentsCount;

            for (var i = 0; i < parentsCount; i++)
            {
                htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconEmptyUrl}"" />");
            }

            if (_channelInfo.ChildrenCount > 0)
            {
                htmlBuilder.Append(
                    _channelInfo.SiteId == _channelInfo.Id
                        ? $@"<img align=""absmiddle"" style=""cursor:pointer; margin-top: -5px; margin-right: 2px;"" onClick=""event.stopPropagation();displayChildren(this);"" isAjax=""false"" isOpen=""true"" id=""{_channelInfo
                            .Id}"" src=""{_iconMinusUrl}"" />"
                        : $@"<img align=""absmiddle"" style=""cursor:pointer; margin-top: -5px; margin-right: 2px;"" onClick=""event.stopPropagation();displayChildren(this);"" isAjax=""true"" isOpen=""false"" id=""{_channelInfo
                            .Id}"" src=""{_iconPlusUrl}"" />");
            }
            else
            {
                htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconEmptyUrl}"" />");
            }

            var contentModelIconHtml = $@"<i class=""{_contentModelIconClass}""></i>";

            if (_channelInfo.Id > 0)
            {
                contentModelIconHtml = $@"<a href=""{PageRedirect.GetRedirectUrlToChannel(_channelInfo.SiteId, _channelInfo.Id)}"" target=""_blank"" title=""浏览页面"" onclick=""event.stopPropagation()"">{contentModelIconHtml}</a>";
            }

            htmlBuilder.Append(contentModelIconHtml);
            htmlBuilder.Append("&nbsp;");

            if (_enabled)
            {
                if (loadingType == ELoadingType.ContentTree)
                {
                    var linkUrl = PageContent.GetRedirectUrl(_channelInfo.SiteId, _channelInfo.Id);
                    if (!string.IsNullOrEmpty(additional?["linkUrl"]))
                    {
                        linkUrl = PageUtils.AddQueryStringIfNotExists(additional["linkUrl"], new NameValueCollection
                        {
                            ["channelId"] = _channelInfo.Id.ToString()
                        });
                    }

                    linkUrl = PageUtils.GetLoadingUrl(linkUrl);

                    htmlBuilder.Append(
                        $"<a href='{linkUrl}' isLink='true' onclick='fontWeightLink(this)' target='content'>{_channelInfo.ChannelName}</a>");
                }
                else if (loadingType == ELoadingType.ChannelSelect)
                {
                    var linkUrl = ModalChannelSelect.GetRedirectUrl(_channelInfo.SiteId, _channelInfo.Id);
                    if (additional != null)
                    {
                        if (!string.IsNullOrEmpty(additional["linkUrl"]))
                        {
                            linkUrl = additional["linkUrl"] + _channelInfo.Id;
                        }
                        else
                        {
                            foreach (string key in additional.Keys)
                            {
                                linkUrl += $"&{key}={additional[key]}";
                            }
                        }
                    }
                    htmlBuilder.Append($"<a href='{linkUrl}'>{_channelInfo.ChannelName}</a>");
                }
                else
                {
                    if (_permissionManager.HasChannelPermissions(_channelInfo.SiteId, _channelInfo.Id, ConfigManager.ChannelPermissions.ChannelEdit))
                    {
                        var onClickUrl = ModalChannelEdit.GetOpenWindowString(_channelInfo.SiteId, _channelInfo.Id, returnUrl);
                        htmlBuilder.Append(
                            $@"<a href=""javascript:;;"" onClick=""{onClickUrl}"" title=""快速编辑栏目"">{_channelInfo.ChannelName}</a>");
                    }
                    else
                    {
                        htmlBuilder.Append($@"<a href=""javascript:;"">{_channelInfo.ChannelName}</a>");
                    }
                }
            }
            else
            {
                htmlBuilder.Append($"<span>{_channelInfo.ChannelName}</span>");
            }

            if (_channelInfo.SiteId != 0)
            {
                htmlBuilder.Append("&nbsp;");

                htmlBuilder.Append(ChannelManager.GetNodeTreeLastImageHtml(_siteInfo, _channelInfo));

                if (_channelInfo.ContentNum < 0)
                {
                    return(htmlBuilder.ToString());
                }

                htmlBuilder.Append(
                    $@"<span style=""font-size:8pt;font-family:arial"" class=""gray"">({_channelInfo.ContentNum})</span>");
            }

            return(htmlBuilder.ToString());
        }
コード例 #10
0
 /// <summary>
 /// 显示loading界面回调
 /// </summary>
 /// <param name="eLoadingType"></param>
 /// <param name="bVisible"></param>
 private void SetLoadingVisible(ELoadingType eLoadingType, bool bVisible)
 {
     this.m_aWhenLoadingShowUI?.Invoke(eLoadingType, bVisible);
 }
コード例 #11
0
        public string GetItemHtml(ELoadingType loadingType, string returnUrl, NameValueCollection additional)
        {
            var htmlBuilder  = new StringBuilder();
            var parentsCount = _nodeInfo.ParentsCount;

            if (loadingType == ELoadingType.GovPublicChannelAdd || loadingType == ELoadingType.GovPublicChannelTree)
            {
                parentsCount = parentsCount - 1;
            }
            else if (loadingType == ELoadingType.GovPublicChannel || loadingType == ELoadingType.GovInteractChannel)
            {
                parentsCount = parentsCount - 2;
            }
            for (var i = 0; i < parentsCount; i++)
            {
                htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconEmptyUrl}"" />");
            }

            if (_nodeInfo.ChildrenCount > 0)
            {
                if (_nodeInfo.PublishmentSystemId == _nodeInfo.NodeId)
                {
                    htmlBuilder.Append(
                        $@"<img align=""absmiddle"" style=""cursor:pointer"" onClick=""displayChildren(this);"" isAjax=""false"" isOpen=""true"" id=""{_nodeInfo.NodeId}"" src=""{_iconMinusUrl}"" />");
                }
                else
                {
                    htmlBuilder.Append(
                        $@"<img align=""absmiddle"" style=""cursor:pointer"" onClick=""displayChildren(this);"" isAjax=""true"" isOpen=""false"" id=""{_nodeInfo.NodeId}"" src=""{_iconPlusUrl}"" />");
                }
            }
            else
            {
                htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconEmptyUrl}"" />");
            }

            if (!string.IsNullOrEmpty(_iconFolderUrl))
            {
                if (_nodeInfo.NodeId > 0)
                {
                    htmlBuilder.Append(
                        $@"<a href=""{PageActions.GetRedirectUrl(_nodeInfo.PublishmentSystemId, _nodeInfo.NodeId)}"" target=""_blank"" title=""浏览页面""><img align=""absmiddle"" border=""0"" src=""{_iconFolderUrl}"" /></a>");
                }
                else
                {
                    htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconFolderUrl}"" />");
                }
            }

            htmlBuilder.Append("&nbsp;");

            if (_enabled)
            {
                if (loadingType == ELoadingType.ContentTree)
                {
                    var linkUrl = PageContent.GetRedirectUrl(_nodeInfo.PublishmentSystemId, _nodeInfo.NodeId);

                    htmlBuilder.Append(
                        $"<a href='{linkUrl}' isLink='true' onclick='fontWeightLink(this)' target='content'>{_nodeInfo.NodeName}</a>");
                }
                else if (loadingType == ELoadingType.ChannelSelect)
                {
                    var linkUrl = ModalChannelSelect.GetRedirectUrl(_nodeInfo.PublishmentSystemId, _nodeInfo.NodeId);
                    if (additional != null)
                    {
                        if (!string.IsNullOrEmpty(additional["linkUrl"]))
                        {
                            linkUrl = additional["linkUrl"] + _nodeInfo.NodeId;
                        }
                        else
                        {
                            foreach (string key in additional.Keys)
                            {
                                linkUrl += $"&{key}={additional[key]}";
                            }
                        }
                    }
                    htmlBuilder.Append($"<a href='{linkUrl}'>{_nodeInfo.NodeName}</a>");
                }
                else if (loadingType == ELoadingType.GovPublicChannelAdd)
                {
                    if (EContentModelTypeUtils.Equals(_nodeInfo.ContentModelId, EContentModelType.GovPublic))
                    {
                        htmlBuilder.Append($@"<a href=""{ModalGovPublicCategoryChannelSelect.GetRedirectUrl(_nodeInfo.PublishmentSystemId, _nodeInfo.NodeId)}"">{_nodeInfo.NodeName}</a>");
                    }
                    else
                    {
                        htmlBuilder.Append(_nodeInfo.NodeName);
                    }
                }
                else if (loadingType == ELoadingType.GovPublicChannelTree)
                {
                    var linkUrl = PageContent.GetRedirectUrl(_nodeInfo.PublishmentSystemId, _nodeInfo.NodeId);

                    htmlBuilder.Append(
                        $"<a href='{linkUrl}' isLink='true' onclick='fontWeightLink(this)' target='content'>{_nodeInfo.NodeName}</a>");
                }
                else
                {
                    if (AdminUtility.HasChannelPermissions(_administratorName, _nodeInfo.PublishmentSystemId, _nodeInfo.NodeId, AppManager.Cms.Permission.Channel.ChannelEdit))
                    {
                        var onClickUrl = ModalChannelEdit.GetOpenWindowString(_nodeInfo.PublishmentSystemId, _nodeInfo.NodeId, returnUrl);
                        htmlBuilder.Append(
                            $@"<a href=""javascript:;;"" onClick=""{onClickUrl}"" title=""快速编辑栏目"">{_nodeInfo.NodeName}</a>");
                    }
                    else
                    {
                        htmlBuilder.Append($@"<a href=""javascript:;;"">{_nodeInfo.NodeName}</a>");
                    }
                }
            }
            else
            {
                htmlBuilder.Append(_nodeInfo.NodeName);
            }

            if (_nodeInfo.PublishmentSystemId != 0)
            {
                var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(_nodeInfo.PublishmentSystemId);

                htmlBuilder.Append("&nbsp;");

                htmlBuilder.Append(NodeManager.GetNodeTreeLastImageHtml(publishmentSystemInfo, _nodeInfo));

                if (_nodeInfo.ContentNum >= 0)
                {
                    htmlBuilder.Append("&nbsp;");
                    htmlBuilder.Append(
                        $@"<span style=""font-size:8pt;font-family:arial"" class=""gray"">({_nodeInfo.ContentNum})</span>");
                }
            }

            return(htmlBuilder.ToString());
        }
コード例 #12
0
        public static string GetScript(PublishmentSystemInfo publishmentSystemInfo, ELoadingType loadingType, NameValueCollection additional)
        {
            var script = @"
<script language=""JavaScript"">
function getTreeLevel(e) {
	var length = 0;
	if (!isNull(e)){
		if (e.tagName == 'TR') {
			length = parseInt(e.getAttribute('treeItemLevel'));
		}
	}
	return length;
}

function getTrElement(element){
	if (isNull(element)) return;
	for (element = element.parentNode;;){
		if (element != null && element.tagName == 'TR'){
			break;
		}else{
			element = element.parentNode;
		} 
	}
	return element;
}

function getImgClickableElementByTr(element){
	if (isNull(element) || element.tagName != 'TR') return;
	var img = null;
	if (!isNull(element.childNodes)){
		var imgCol = element.getElementsByTagName('IMG');
		if (!isNull(imgCol)){
			for (x=0;x<imgCol.length;x++){
				if (!isNull(imgCol.item(x).getAttribute('isOpen'))){
					img = imgCol.item(x);
					break;
				}
			}
		}
	}
	return img;
}

var weightedLink = null;

function fontWeightLink(element){
    if (weightedLink != null)
    {
        weightedLink.style.fontWeight = 'normal';
    }
    element.style.fontWeight = 'bold';
    weightedLink = element;
}

var completedNodeID = null;
function displayChildren(img){
	if (isNull(img)) return;

	var tr = getTrElement(img);

    var isToOpen = img.getAttribute('isOpen') == 'false';
    var isByAjax = img.getAttribute('isAjax') == 'true';
    var nodeID = img.getAttribute('id');

	if (!isNull(img) && img.getAttribute('isOpen') != null){
		if (img.getAttribute('isOpen') == 'false'){
			img.setAttribute('isOpen', 'true');
            img.setAttribute('src', '{iconMinusUrl}');
		}else{
            img.setAttribute('isOpen', 'false');
            img.setAttribute('src', '{iconPlusUrl}');
		}
	}

    if (isToOpen && isByAjax)
    {
        var div = document.createElement('div');
        div.innerHTML = ""<img align='absmiddle' border='0' src='{iconLoadingUrl}' /> 加载中,请稍候..."";
        img.parentNode.appendChild(div);
        $(div).addClass('loading');
        loadingChannels(tr, img, div, nodeID);
    }
    else
    {
        var level = getTreeLevel(tr);
        
	    var collection = new Array();
	    var index = 0;

	    for ( var e = tr.nextSibling; !isNull(e) ; e = e.nextSibling) {
		    if (!isNull(e) && !isNull(e.tagName) && e.tagName == 'TR'){
		        var currentLevel = getTreeLevel(e);
		        if (currentLevel <= level) break;
		        if(e.style.display == '') {
			        e.style.display = 'none';
		        }else{
			        if (currentLevel != level + 1) continue;
			        e.style.display = '';
			        var imgClickable = getImgClickableElementByTr(e);
			        if (!isNull(imgClickable)){
				        if (!isNull(imgClickable.getAttribute('isOpen')) && imgClickable.getAttribute('isOpen') =='true'){
					        imgClickable.setAttribute('isOpen', 'false');
                            imgClickable.setAttribute('src', '{iconPlusUrl}');
					        collection[index] = imgClickable;
					        index++;
				        }
			        }
		        }
            }
	    }
        
	    if (index > 0){
		    for (i=0;i<=index;i++){
			    displayChildren(collection[i]);
		    }
	    }
    }
}
";

            script += $@"
function loadingChannels(tr, img, div, nodeID){{
    var url = '{AjaxOtherService.GetGetLoadingChannelsUrl()}';
    var pars = '{AjaxOtherService.GetGetLoadingChannelsParameters(publishmentSystemInfo.PublishmentSystemId, loadingType, additional)}&parentID=' + nodeID;

    jQuery.post(url, pars, function(data, textStatus)
    {{
        $($.parseHTML(data)).insertAfter($(tr));
        img.setAttribute('isAjax', 'false');
        img.parentNode.removeChild(div);
    }});
    completedNodeID = nodeID;
}}

function loadingChannelsOnLoad(paths){{
    if (paths && paths.length > 0){{
        var nodeIDs = paths.split(',');
        var nodeID = nodeIDs[0];
        var img = $('#' + nodeID);
        if (img.attr('isOpen') == 'false'){{
            displayChildren(img[0]);
            if (completedNodeID && completedNodeID == nodeID){{
                if (paths.indexOf(',') != -1){{
paths = paths.substring(paths.indexOf(',') + 1);
                    setTimeout(""loadingChannelsOnLoad('"" + paths + ""')"", 1000);
                }}
            }} 
        }}
    }}
}}
</script>
";

            var item = new NodeTreeItem();

            script = script.Replace("{iconEmptyUrl}", item._iconEmptyUrl);
            script = script.Replace("{iconFolderUrl}", item._iconFolderUrl);
            script = script.Replace("{iconMinusUrl}", item._iconMinusUrl);
            script = script.Replace("{iconOpenedFolderUrl}", item._iconOpenedFolderUrl);
            script = script.Replace("{iconPlusUrl}", item._iconPlusUrl);

            script = script.Replace("{iconLoadingUrl}", SiteServerAssets.GetIconUrl("loading.gif"));
            return(script);
        }
コード例 #13
0
ファイル: ChannelLoading.cs プロジェクト: zhongqi013/cms
 public static string GetScript(SiteInfo siteInfo, ELoadingType loadingType, NameValueCollection additional)
 {
     return(NodeTreeItem.GetScript(siteInfo, loadingType, additional));
 }
コード例 #14
0
        /// <summary>
        /// Create a template game object.
        /// </summary>
        public static GameObject CreateTemplate()
        {
            GameObject obj = new GameObject(PREFAB_NAME);

            RectTransform obj_rect = obj.AddComponent <RectTransform>();

            MyUtilities.Anchor(ref obj_rect, MyUtilities.EAnchorPreset.DualStretch, MyUtilities.EAnchorPivot.MiddleCenter, Vector2.zero, Vector2.zero);

            int countWaitingPopupID = Enum.GetNames(typeof(ELoadingType)).Length;

            for (int i = 0; i < countWaitingPopupID; i++)
            {
                ELoadingType type = (ELoadingType)Enum.GetValues(typeof(ELoadingType)).GetValue(i);
                if (type == ELoadingType.None)
                {
                    continue;
                }

                GameObject child = new GameObject(type.ToString());
                child.transform.SetParent(obj.transform, false);
                child.SetActive(false);

                RectTransform child_rect = child.AddComponent <RectTransform>();
                MyUtilities.Anchor(ref child_rect, MyUtilities.EAnchorPreset.DualStretch, MyUtilities.EAnchorPivot.MiddleCenter, Vector2.zero, Vector2.zero);

                if (type == ELoadingType.Simple)
                {
                    GameObject imageBG = new GameObject("ImageBackground");
                    imageBG.transform.SetParent(child.transform, false);

                    RectTransform background_rect = imageBG.AddComponent <RectTransform>();
                    MyUtilities.Anchor(ref background_rect, MyUtilities.EAnchorPreset.MiddleCenter, MyUtilities.EAnchorPivot.MiddleCenter, 200, 200, 0, 0);

                    Image background_image = imageBG.AddComponent <Image>();
                    background_image.raycastTarget = false;
                    background_image.color         = Color.black;

                    GameObject image = new GameObject("Image");
                    image.transform.SetParent(child.transform, false);

                    RectTransform image_rect = image.AddComponent <RectTransform>();
                    MyUtilities.Anchor(ref image_rect, MyUtilities.EAnchorPreset.MiddleCenter, MyUtilities.EAnchorPivot.MiddleCenter, 200, 200, 0, 0);

                    Image image_image = image.AddComponent <Image>();
                    image_image.raycastTarget = false;
                    image_image.color         = Color.white;

#if UNITY_EDITOR
                    string[] paths = new string[] { "Assets/MyClasses", "Assets/Core/MyClasses", "Assets/Plugin/MyClasses", "Assets/Plugins/MyClasses", "Assets/Framework/MyClasses", "Assets/Frameworks/MyClasses" };
                    for (int j = 0; j < paths.Length; j++)
                    {
                        if (System.IO.File.Exists(paths[j] + "/Sources/Animations/my_animator_loading_indicator_circle.controller"))
                        {
                            Animator root_animator = child.AddComponent <Animator>();
                            root_animator.runtimeAnimatorController = (RuntimeAnimatorController)UnityEditor.AssetDatabase.LoadAssetAtPath(paths[j] + "/Sources/Animations/my_animator_loading_indicator_circle.controller", typeof(RuntimeAnimatorController));
                            if (System.IO.File.Exists(paths[j] + "/Sources/Images/my_loading_indicator_circle_bg.png"))
                            {
                                background_image.sprite = (Sprite)UnityEditor.AssetDatabase.LoadAssetAtPath(paths[j] + "/Sources/Images/my_loading_indicator_circle_bg.png", typeof(Sprite));
                            }
                            if (System.IO.File.Exists(paths[j] + "/Sources/Images/my_loading_indicator_circle.png"))
                            {
                                image_image.sprite = (Sprite)UnityEditor.AssetDatabase.LoadAssetAtPath(paths[j] + "/Sources/Images/my_loading_indicator_circle.png", typeof(Sprite));
                            }
                            Debug.LogError("[" + typeof(MyUGUILoadingIndicator).Name + "] CreateTemplate(): please setup \"my_animator_loading_indicator_circle\" controller.");
                            Debug.LogError("[" + typeof(MyUGUILoadingIndicator).Name + "] CreateTemplate(): mapping \"my_animation_loading_indicator_circle\" motion for \"Circle\" state.");
                            break;
                        }
                    }
#endif
                }
                else if (type == ELoadingType.Tips)
                {
                    GameObject loading = new GameObject("Loading");
                    loading.transform.SetParent(child.transform, false);

                    RectTransform loadingd_rect = loading.AddComponent <RectTransform>();
                    MyUtilities.Anchor(ref loadingd_rect, MyUtilities.EAnchorPreset.MiddleCenter, MyUtilities.EAnchorPivot.MiddleCenter, 200, 200, 0, 150);

                    GameObject imageBG = new GameObject("ImageBackground");
                    imageBG.transform.SetParent(loading.transform, false);

                    RectTransform background_rect = imageBG.AddComponent <RectTransform>();
                    MyUtilities.Anchor(ref background_rect, MyUtilities.EAnchorPreset.MiddleCenter, MyUtilities.EAnchorPivot.MiddleCenter, 200, 200, 0, 0);

                    Image background_image = imageBG.AddComponent <Image>();
                    background_image.raycastTarget = false;
                    background_image.color         = Color.black;

                    GameObject image = new GameObject("Image");
                    image.transform.SetParent(loading.transform, false);

                    RectTransform image_rect = image.AddComponent <RectTransform>();
                    MyUtilities.Anchor(ref image_rect, MyUtilities.EAnchorPreset.MiddleCenter, MyUtilities.EAnchorPivot.MiddleCenter, 200, 200, 0, 0);

                    Image image_image = image.AddComponent <Image>();
                    image_image.raycastTarget = false;
                    image_image.color         = Color.white;

#if UNITY_EDITOR
                    string[] paths = new string[] { "Assets/MyClasses", "Assets/Core/MyClasses", "Assets/Plugin/MyClasses", "Assets/Plugins/MyClasses", "Assets/Framework/MyClasses", "Assets/Frameworks/MyClasses" };
                    for (int j = 0; j < paths.Length; j++)
                    {
                        if (System.IO.File.Exists(paths[j] + "/Animations/my_animator_loading_indicator_circle.controller"))
                        {
                            Animator root_animator = loading.AddComponent <Animator>();
                            root_animator.runtimeAnimatorController = (RuntimeAnimatorController)UnityEditor.AssetDatabase.LoadAssetAtPath(paths[j] + "/Animations/my_animator_loading_indicator_circle.controller", typeof(RuntimeAnimatorController));
                            if (System.IO.File.Exists(paths[j] + "/Images/my_loading_indicator_circle_bg.png"))
                            {
                                background_image.sprite = (Sprite)UnityEditor.AssetDatabase.LoadAssetAtPath(paths[j] + "/Images/my_loading_indicator_circle_bg.png", typeof(Sprite));
                            }
                            if (System.IO.File.Exists(paths[j] + "/Images/my_loading_indicator_circle.png"))
                            {
                                image_image.sprite = (Sprite)UnityEditor.AssetDatabase.LoadAssetAtPath(paths[j] + "/Images/my_loading_indicator_circle.png", typeof(Sprite));
                            }
                            break;
                        }
                    }
#endif

                    GameObject description = new GameObject("Description");
                    description.transform.SetParent(child.transform, false);

                    RectTransform description_rect = description.AddComponent <RectTransform>();
                    MyUtilities.Anchor(ref description_rect, MyUtilities.EAnchorPreset.HorizontalStretchMiddle, MyUtilities.EAnchorPivot.MiddleCenter, new Vector2(50, -50), new Vector2(-50, 50));

                    Text description_text = description.AddComponent <Text>();
                    description_text.text               = "description";
                    description_text.color              = Color.white;
                    description_text.font               = Resources.GetBuiltinResource <Font>("Arial.ttf");
                    description_text.fontSize           = 40;
                    description_text.alignment          = TextAnchor.MiddleCenter;
                    description_text.horizontalOverflow = HorizontalWrapMode.Wrap;
                    description_text.verticalOverflow   = VerticalWrapMode.Overflow;
                    description_text.raycastTarget      = false;

                    GameObject cancel = new GameObject("ButtonCancel");
                    cancel.transform.SetParent(child.transform, false);

                    RectTransform cancel_rect = cancel.AddComponent <RectTransform>();
                    MyUtilities.Anchor(ref cancel_rect, MyUtilities.EAnchorPreset.MiddleCenter, MyUtilities.EAnchorPivot.MiddleCenter, 240, 80, 0, -120);

                    cancel.AddComponent <Image>();
                    cancel.AddComponent <MyUGUIButton>();

                    GameObject cancel_text = new GameObject("Text");
                    cancel_text.transform.SetParent(cancel.transform, false);

                    RectTransform cancel_text_rect = cancel_text.AddComponent <RectTransform>();
                    MyUtilities.Anchor(ref cancel_text_rect, MyUtilities.EAnchorPreset.DualStretch, MyUtilities.EAnchorPivot.MiddleCenter, Vector2.zero, Vector2.zero);

                    Text cancel_text_text = cancel_text.AddComponent <Text>();
                    cancel_text_text.text               = "Cancel";
                    cancel_text_text.color              = Color.black;
                    cancel_text_text.font               = Resources.GetBuiltinResource <Font>("Arial.ttf");
                    cancel_text_text.fontSize           = 40;
                    cancel_text_text.supportRichText    = false;
                    cancel_text_text.alignment          = TextAnchor.MiddleCenter;
                    cancel_text_text.horizontalOverflow = HorizontalWrapMode.Wrap;
                    cancel_text_text.verticalOverflow   = VerticalWrapMode.Overflow;
                    cancel_text_text.raycastTarget      = false;

                    GameObject tips = new GameObject("Tips");
                    tips.transform.SetParent(child.transform, false);

                    RectTransform tips_rect = tips.AddComponent <RectTransform>();
                    MyUtilities.Anchor(ref tips_rect, MyUtilities.EAnchorPreset.HorizontalStretchBottom, MyUtilities.EAnchorPivot.BottomCenter, new Vector2(50, 0), new Vector2(-50, 100));

                    Text tips_text = tips.AddComponent <Text>();
                    tips_text.text               = "tips";
                    tips_text.color              = Color.white;
                    tips_text.font               = Resources.GetBuiltinResource <Font>("Arial.ttf");
                    tips_text.fontSize           = 40;
                    tips_text.alignment          = TextAnchor.MiddleCenter;
                    tips_text.horizontalOverflow = HorizontalWrapMode.Wrap;
                    tips_text.verticalOverflow   = VerticalWrapMode.Overflow;
                    tips_text.raycastTarget      = false;
                }
            }

            return(obj);
        }
コード例 #15
0
 public static string GetScript(SiteInfo siteInfo, string contentModelPluginId, ELoadingType loadingType, NameValueCollection additional)
 {
     return(ChannelTreeItem.GetScript(siteInfo, loadingType, contentModelPluginId, additional));
 }
コード例 #16
0
 /// <summary>
 /// 改变游戏状态
 /// </summary>
 /// <param name="eGameState"></param>
 /// <param name="loadingStyle"></param>
 public void ChangeGameState(string eGameState, ELoadingType loadingStyle)
 {
     this.ChangeGameState(eGameState, loadingStyle, null);
 }
コード例 #17
0
        public static string GetScript(SiteInfo siteInfo, ELoadingType loadingType, string contentModelPluginId, NameValueCollection additional)
        {
            var script = @"
<script language=""JavaScript"">
function getTreeLevel(e) {
	var length = 0;
	if (e){
		if (e.tagName == 'TR') {
			length = parseInt(e.getAttribute('treeItemLevel'));
		}
	}
	return length;
}

function getTrElement(element){
	if (!element) return;
	for (element = element.parentNode;;){
		if (element != null && element.tagName == 'TR'){
			break;
		}else{
			element = element.parentNode;
		} 
	}
	return element;
}

function getImgClickableElementByTr(element){
	if (!element || element.tagName != 'TR') return;
	var img = null;
	if (element.childNodes){
		var imgCol = element.getElementsByTagName('IMG');
		if (imgCol){
			for (x=0;x<imgCol.length;x++){
				if (imgCol.item(x).getAttribute('isOpen')){
					img = imgCol.item(x);
					break;
				}
			}
		}
	}
	return img;
}

var activeTrElement = null;
function fontWeightLink(element){
    if (activeTrElement)
    {
        activeTrElement.setAttribute('class', '');
    }
    activeTrElement = getTrElement(element);
    if (activeTrElement) {
        activeTrElement.setAttribute('class', 'table-active');
    }
}

function unSelectRow(tr) {
    tr = $(tr);
    var cb = tr.find('input:checkbox:first');
    if (cb.length  === 0) return;
    var checked = cb.is(':checked');
    cb[0].checked = false;
    tr.removeClass('table-active');
}

var completedChannelId = null;
function displayChildren(img){
	if (!img) return;

	var tr = getTrElement(img);

    var isToOpen = img.getAttribute('isOpen') == 'false';
    var isByAjax = img.getAttribute('isAjax') == 'true';
    var channelId = img.getAttribute('id');

	if (img && img.getAttribute('isOpen') != null){
		if (img.getAttribute('isOpen') == 'false'){
			img.setAttribute('isOpen', 'true');
            img.setAttribute('src', '{iconMinusUrl}');
		}else{
            img.setAttribute('isOpen', 'false');
            img.setAttribute('src', '{iconPlusUrl}');
		}
	}

    if (isToOpen && isByAjax)
    {
        var div = document.createElement('div');
        div.innerHTML = ""<img align='absmiddle' width='30' height='12' border='0' src='{iconLoadingUrl}' />"";
        img.parentNode.appendChild(div);
        $(div).addClass('loading');
        loadingChannels(tr, img, div, channelId);
    }
    else
    {
        var level = getTreeLevel(tr);
        
	    var collection = new Array();
	    var index = 0;

	    for ( var e = tr.nextSibling; e != null ; e = e.nextSibling) {
		    if (e && e.tagName && e.tagName == 'TR'){
		        var currentLevel = getTreeLevel(e);
		        if (currentLevel <= level) break;
		        if(e.style.display == '') {
			        e.style.display = 'none';
                    unSelectRow(e);
		        }else{
			        if (currentLevel != level + 1) continue;
			        e.style.display = '';
			        var imgClickable = getImgClickableElementByTr(e);
			        if (imgClickable){
				        if (imgClickable.getAttribute('isOpen') && imgClickable.getAttribute('isOpen') =='true'){
					        imgClickable.setAttribute('isOpen', 'false');
                            imgClickable.setAttribute('src', '{iconPlusUrl}');
					        collection[index] = imgClickable;
					        index++;
				        }
			        }
		        }
            }
	    }
        
	    if (index > 0){
		    for (i=0;i<=index;i++){
			    displayChildren(collection[i]);
		    }
	    }
    }
}
";

            script += $@"
function loadingChannels(tr, img, div, channelId){{
    var url = '{AjaxOtherService.GetGetLoadingChannelsUrl()}';
    var pars = '{AjaxOtherService.GetGetLoadingChannelsParameters(siteInfo.Id, contentModelPluginId, loadingType, additional)}&parentID=' + channelId;

    jQuery.post(url, pars, function(data, textStatus)
    {{
        $($.parseHTML(data)).insertAfter($(tr));
        img.setAttribute('isAjax', 'false');
        img.parentNode.removeChild(div);
    }});
    completedChannelId = channelId;
}}

function loadingChannelsOnLoad(paths){{
    if (paths && paths.length > 0){{
        var channelIds = paths.split(',');
        var channelId = channelIds[0];
        var img = $('#' + channelId);
        if (img.attr('isOpen') == 'false'){{
            displayChildren(img[0]);
            if (completedChannelId && completedChannelId == channelId){{
                if (paths.indexOf(',') != -1){{
paths = paths.substring(paths.indexOf(',') + 1);
                    setTimeout(""loadingChannelsOnLoad('"" + paths + ""')"", 1000);
                }}
            }} 
        }}
    }}
}}
</script>
";

            var treeDirectoryUrl = SiteServerAssets.GetIconUrl("tree");

            script = script.Replace("{iconEmptyUrl}", PageUtils.Combine(treeDirectoryUrl, "empty.gif"));
            script = script.Replace("{iconMinusUrl}", PageUtils.Combine(treeDirectoryUrl, "minus.png"));
            script = script.Replace("{iconPlusUrl}", PageUtils.Combine(treeDirectoryUrl, "plus.png"));
            script = script.Replace("{iconLoadingUrl}", SiteServerAssets.GetUrl("layer/skin/default/xubox_loading0.gif"));
            return(script);
        }
コード例 #18
0
 public static bool Equals(string typeStr, ELoadingType type)
 {
     return(Equals(type, typeStr));
 }
コード例 #19
0
        public string GetItemHtml(ELoadingType loadingType, string returnUrl, NameValueCollection additional)
        {
            var htmlBuilder  = new StringBuilder();
            var parentsCount = _channelInfo.ParentsCount;

            for (var i = 0; i < parentsCount; i++)
            {
                htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconEmptyUrl}"" />");
            }

            if (_channelInfo.ChildrenCount > 0)
            {
                htmlBuilder.Append(
                    _channelInfo.SiteId == _channelInfo.Id
                        ? $@"<img align=""absmiddle"" style=""cursor:pointer"" onClick=""displayChildren(this);"" isAjax=""false"" isOpen=""true"" id=""{_channelInfo
                            .Id}"" src=""{_iconMinusUrl}"" />"
                        : $@"<img align=""absmiddle"" style=""cursor:pointer"" onClick=""displayChildren(this);"" isAjax=""true"" isOpen=""false"" id=""{_channelInfo
                            .Id}"" src=""{_iconPlusUrl}"" />");
            }
            else
            {
                htmlBuilder.Append($@"<img align=""absmiddle"" src=""{_iconEmptyUrl}"" />");
            }

            if (!string.IsNullOrEmpty(_iconFolderUrl))
            {
                htmlBuilder.Append(
                    _channelInfo.Id > 0
                        ? $@"<a href=""{PageRedirect.GetRedirectUrlToChannel(_channelInfo.SiteId, _channelInfo.Id)}"" target=""_blank"" title=""浏览页面""><img align=""absmiddle"" border=""0"" src=""{_iconFolderUrl}"" style=""max-height: 22px; max-width: 22px"" /></a>"
                        : $@"<img align=""absmiddle"" src=""{_iconFolderUrl}"" style=""max-height: 22px; max-width: 22px"" />");
            }

            htmlBuilder.Append("&nbsp;");

            if (_enabled)
            {
                if (loadingType == ELoadingType.ContentTree)
                {
                    var linkUrl = PageContent.GetRedirectUrl(_channelInfo.SiteId, _channelInfo.Id);

                    htmlBuilder.Append(
                        $"<a href='{linkUrl}' isLink='true' onclick='fontWeightLink(this)' target='content'>{_channelInfo.ChannelName}</a>");
                }
                else if (loadingType == ELoadingType.ChannelSelect)
                {
                    var linkUrl = ModalChannelSelect.GetRedirectUrl(_channelInfo.SiteId, _channelInfo.Id);
                    if (additional != null)
                    {
                        if (!string.IsNullOrEmpty(additional["linkUrl"]))
                        {
                            linkUrl = additional["linkUrl"] + _channelInfo.Id;
                        }
                        else
                        {
                            foreach (string key in additional.Keys)
                            {
                                linkUrl += $"&{key}={additional[key]}";
                            }
                        }
                    }
                    htmlBuilder.Append($"<a href='{linkUrl}'>{_channelInfo.ChannelName}</a>");
                }
                else
                {
                    if (AdminUtility.HasChannelPermissions(_administratorName, _channelInfo.SiteId, _channelInfo.Id, ConfigManager.Permissions.Channel.ChannelEdit))
                    {
                        var onClickUrl = ModalChannelEdit.GetOpenWindowString(_channelInfo.SiteId, _channelInfo.Id, returnUrl);
                        htmlBuilder.Append(
                            $@"<a href=""javascript:;;"" onClick=""{onClickUrl}"" title=""快速编辑栏目"">{_channelInfo.ChannelName}</a>");
                    }
                    else
                    {
                        htmlBuilder.Append($@"<a href=""javascript:;;"">{_channelInfo.ChannelName}</a>");
                    }
                }
            }
            else
            {
                htmlBuilder.Append(_channelInfo.ChannelName);
            }

            if (_channelInfo.SiteId != 0)
            {
                htmlBuilder.Append("&nbsp;");

                htmlBuilder.Append(ChannelManager.GetNodeTreeLastImageHtml(_siteInfo, _channelInfo));

                if (_channelInfo.ContentNum < 0)
                {
                    return(htmlBuilder.ToString());
                }

                htmlBuilder.Append(
                    $@"<span style=""font-size:8pt;font-family:arial"" class=""gray"">({_channelInfo.ContentNum})</span>");
            }

            return(htmlBuilder.ToString());
        }