示例#1
0
        private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.AlternatingItem && e.Item.ItemType != ListItemType.Item)
            {
                return;
            }

            var dict         = (Dictionary <string, string>)e.Item.DataItem;
            var title        = dict["title"];
            var description  = dict["description"];
            var author       = dict["author"];
            var source       = dict["source"];
            var lastEditDate = dict["lastEditDate"];

            var ltlTitle        = (Literal)e.Item.FindControl("ltlTitle");
            var ltlDescription  = (Literal)e.Item.FindControl("ltlDescription");
            var ltlAuthor       = (Literal)e.Item.FindControl("ltlAuthor");
            var ltlLastEditDate = (Literal)e.Item.FindControl("ltlLastEditDate");
            var ltlPreviewUrl   = (Literal)e.Item.FindControl("ltlPreviewUrl");
            var ltlCreateUrl    = (Literal)e.Item.FindControl("ltlCreateUrl");

            var templateUrl = OnlineTemplateManager.GetTemplateUrl(title);

            ltlTitle.Text = $@"<a href=""{templateUrl}"" target=""_blank"">{title}</a>";

            ltlDescription.Text = description;
            ltlAuthor.Text      = author;
            if (!string.IsNullOrEmpty(source) && PageUtils.IsProtocolUrl(source))
            {
                ltlAuthor.Text = $@"<a href=""{source}"" target=""_blank"">{ltlAuthor.Text}</a>";
            }
            ltlLastEditDate.Text = lastEditDate;

            ltlPreviewUrl.Text = $@"<a href=""{templateUrl}"" target=""_blank"">模板详情</a>";

            var urlAdd = PageSiteAdd.GetRedirectUrl(string.Empty, title);

            ltlCreateUrl.Text = $@"<a href=""{urlAdd}"">创建站点</a>";

            //if (_directoryNameLowerList.Contains($"T_{title}".ToLower().Trim()))
            //{
            //    ltlDownloadUrl.Text = "已下载";
            //}
            //else
            //{
            //    var downloadUrl = OnlineTemplateManager.GetDownloadUrl(title);

            //    ltlCreateUrl.Text =
            //        $@"<a href=""javascript:;"" onclick=""{Cms.ModalProgressBar.GetOpenWindowStringWithSiteTemplateDownload($"{downloadUrl}")}"">下载并导入</a>";
            //}
        }
示例#2
0
        private void RptOnlineTemplates_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.AlternatingItem && e.Item.ItemType != ListItemType.Item)
            {
                return;
            }

            var dict         = (Dictionary <string, string>)e.Item.DataItem;
            var title        = dict["title"];
            var description  = dict["description"];
            var author       = dict["author"];
            var source       = dict["source"];
            var lastEditDate = dict["lastEditDate"];

            var ltlChoose       = (Literal)e.Item.FindControl("ltlChoose");
            var ltlTitle        = (Literal)e.Item.FindControl("ltlTitle");
            var ltlDescription  = (Literal)e.Item.FindControl("ltlDescription");
            var ltlAuthor       = (Literal)e.Item.FindControl("ltlAuthor");
            var ltlLastEditDate = (Literal)e.Item.FindControl("ltlLastEditDate");
            var ltlPreviewUrl   = (Literal)e.Item.FindControl("ltlPreviewUrl");

            ltlChoose.Text = $@"<input type=""radio"" name=""choose"" id=""choose_{title}"" onClick=""document.getElementById('{HihOnlineTemplateName.ClientID}').value=this.value;"" {(HihOnlineTemplateName.Value == title ? "checked" : string.Empty)} value=""{title}"" /><label for=""choose_{title}"" class=""m-l-10"">选中</label>";

            var templateUrl = OnlineTemplateManager.GetTemplateUrl(title);

            ltlTitle.Text = $@"<a href=""{templateUrl}"" target=""_blank"">{title}</a>";

            ltlDescription.Text = description;
            ltlAuthor.Text      = author;
            if (!string.IsNullOrEmpty(source) && PageUtils.IsProtocolUrl(source))
            {
                ltlAuthor.Text = $@"<a href=""{source}"" target=""_blank"">{ltlAuthor.Text}</a>";
            }
            ltlLastEditDate.Text = lastEditDate;

            ltlPreviewUrl.Text = $@"<a href=""{templateUrl}"" target=""_blank"">模板详情</a>";
        }
示例#3
0
        public void BtnNext_Click(object sender, EventArgs e)
        {
            if (PhSource.Visible)
            {
                HideAll();

                if (IsSiteTemplate)
                {
                    var siteTemplates = SiteTemplateManager.Instance.GetSiteTemplateSortedList();

                    RptSiteTemplates.DataSource     = siteTemplates.Values;
                    RptSiteTemplates.ItemDataBound += RptSiteTemplates_ItemDataBound;
                    RptSiteTemplates.DataBind();

                    ShowSiteTemplates();
                }
                else if (IsOnlineTemplate)
                {
                    List <Dictionary <string, string> > list;
                    if (OnlineTemplateManager.TryGetOnlineTemplates(out list))
                    {
                        RptOnlineTemplates.DataSource     = list;
                        RptOnlineTemplates.ItemDataBound += RptOnlineTemplates_ItemDataBound;
                        RptOnlineTemplates.DataBind();

                        ShowOnlineTemplates();
                    }
                    else
                    {
                        FailMessage($"在线模板获取失败:页面地址{OnlineTemplateManager.UrlHome}无法访问!");

                        ShowSource();
                    }
                }
                else
                {
                    LtlSource.Text = "创建空站点(不使用站点模板)";

                    ShowSubmit();
                }
            }
            else if (PhSiteTemplates.Visible)
            {
                HideAll();

                var siteTemplateDir = HihSiteTemplateDir.Value;

                if (string.IsNullOrEmpty(siteTemplateDir))
                {
                    FailMessage("请选择需要使用的站点模板");
                    ShowSiteTemplates();
                    return;
                }

                LtlSource.Text = $"使用本地站点模板创建站点({siteTemplateDir})";

                ShowSubmit();
            }
            else if (PhOnlineTemplates.Visible)
            {
                HideAll();

                var onlineTemplateName = HihOnlineTemplateName.Value;

                if (string.IsNullOrEmpty(onlineTemplateName))
                {
                    FailMessage("请选择需要使用的在线站点模板");
                    ShowOnlineTemplates();
                    return;
                }

                LtlSource.Text = $@"使用在线站点模板创建站点(<a href=""{OnlineTemplateManager.GetTemplateUrl(onlineTemplateName)}"" target=""_blank"">{onlineTemplateName}</a>)";

                ShowSubmit();
            }
        }