コード例 #1
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId", "ReturnUrl");
            ReturnUrl       = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("ReturnUrl"));
            _deleteContents = AuthRequest.GetQueryBool("DeleteContents");

            if (IsPostBack)
            {
                return;
            }

            var channelIdList = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("ChannelIDCollection"));

            channelIdList.Sort();
            channelIdList.Reverse();
            foreach (var channelId in channelIdList)
            {
                if (channelId == SiteId)
                {
                    continue;
                }
                if (!HasChannelPermissions(channelId, ConfigManager.ChannelPermissions.ChannelDelete))
                {
                    continue;
                }

                var nodeInfo    = ChannelManager.GetChannelInfo(SiteId, channelId);
                var displayName = nodeInfo.ChannelName;
                if (nodeInfo.ContentNum > 0)
                {
                    displayName += $"({nodeInfo.ContentNum})";
                }
                _nodeNameList.Add(displayName);
            }

            if (_nodeNameList.Count == 0)
            {
                BtnDelete.Enabled = false;
            }
            else
            {
                if (_deleteContents)
                {
                    LtlPageTitle.Text = "删除内容";
                    InfoMessage(
                        $"此操作将会删除栏目“{TranslateUtils.ObjectCollectionToString(_nodeNameList)}”下的所有内容,确认吗?");
                }
                else
                {
                    LtlPageTitle.Text = "删除栏目";
                    InfoMessage(
                        $"此操作将会删除栏目“{TranslateUtils.ObjectCollectionToString(_nodeNameList)}”及包含的下级栏目,确认吗?");
                }
            }
        }
コード例 #2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (AuthRequest.IsQueryExists("SiteId") && (AuthRequest.IsQueryExists("Up") || AuthRequest.IsQueryExists("Down")))
            {
                var siteId = AuthRequest.GetQueryInt("SiteId");

                if (AuthRequest.IsQueryExists("Up") && AuthRequest.GetQueryBool("Up"))
                {
                    DataProvider.SiteDao.UpdateTaxisToUp(siteId);
                }
                else
                {
                    DataProvider.SiteDao.UpdateTaxisToDown(siteId);
                }
            }

            if (IsPostBack)
            {
                return;
            }

            VerifyAdministratorPermissions(ConfigManager.SettingsPermissions.Site);

            _hqSiteId = DataProvider.SiteDao.GetIdByIsRoot();

            RptContents.DataSource     = SiteManager.GetSiteIdList();
            RptContents.ItemDataBound += RptContents_ItemDataBound;
            RptContents.DataBind();
        }
コード例 #3
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _channelId       = AuthRequest.GetQueryInt("channelId");
            _isChannel       = AuthRequest.GetQueryBool("IsChannel");
            _textBoxClientId = AuthRequest.GetQueryString("TextBoxClientID");

            if (IsPostBack)
            {
                return;
            }

            LtlRules.Text = GetRulesString();
            if (!string.IsNullOrEmpty(_textBoxClientId))
            {
                TbRule.Text = AuthRequest.GetQueryString(_textBoxClientId);
            }

            InfoMessage(_isChannel
                ? "系统生成栏目页时采取的文件名规则,建议保留{@ChannelId}栏目Id项,否则可能出现重复的文件名称"
                : "系统生成内容页时采取的文件名规则,建议保留{@ContentId}内容Id项,否则可能出现重复的文件名称");
        }
コード例 #4
0
ファイル: ModalChannelSelect.cs プロジェクト: zerojuls/cms-3
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _isProtocol = AuthRequest.GetQueryBool("isProtocol");
            _jsMethod   = AuthRequest.GetQueryString("jsMethod");
            _itemIndex  = AuthRequest.GetQueryInt("itemIndex");

            _additional.Add("isProtocol", _isProtocol.ToString());
            _additional.Add("jsMethod", _jsMethod);
            _additional.Add("itemIndex", _itemIndex.ToString());

            if (!IsPostBack)
            {
                if (AuthRequest.IsQueryExists("channelId"))
                {
                    var channelId = AuthRequest.GetQueryInt("channelId");
                    var nodeNames = ChannelManager.GetChannelNameNavigation(SiteId, channelId);

                    if (!string.IsNullOrEmpty(_jsMethod))
                    {
                        string scripts = $"window.parent.{_jsMethod}({_itemIndex}, '{nodeNames}', {channelId});";
                        LayerUtils.CloseWithoutRefresh(Page, scripts);
                    }
                    else
                    {
                        var pageUrl = PageUtility.GetChannelUrl(SiteInfo, ChannelManager.GetChannelInfo(SiteId, channelId), false);
                        if (_isProtocol)
                        {
                            pageUrl = PageUtils.AddProtocolToUrl(pageUrl);
                        }

                        string scripts = $"window.parent.selectChannel('{nodeNames}', '{channelId}', '{pageUrl}');";
                        LayerUtils.CloseWithoutRefresh(Page, scripts);
                    }
                }
                else
                {
                    var nodeInfo = ChannelManager.GetChannelInfo(SiteId, SiteId);

                    var linkUrl = PageUtils.GetCmsUrl(SiteId, nameof(ModalChannelSelect), new NameValueCollection
                    {
                        { "channelId", nodeInfo.Id.ToString() },
                        { "isProtocol", _isProtocol.ToString() },
                        { "jsMethod", _jsMethod },
                        { "itemIndex", _itemIndex.ToString() }
                    });
                    LtlSite.Text = $"<a href='{linkUrl}'>{nodeInfo.ChannelName}</a>";
                    ClientScriptRegisterClientScriptBlock("NodeTreeScript", ChannelLoading.GetScript(SiteInfo, string.Empty, ELoadingType.ChannelSelect, null));
                    BindGrid();
                }
            }
        }
コード例 #5
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId");

            _relatedIdentity = AuthRequest.GetQueryInt("RelatedIdentity");
            _isList          = AuthRequest.GetQueryBool("IsList");

            var nodeInfo  = ChannelManager.GetChannelInfo(SiteId, _relatedIdentity);
            var tableName = ChannelManager.GetTableName(SiteInfo, nodeInfo);

            _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _relatedIdentity);
            var attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(nodeInfo.Additional.ContentAttributesOfDisplay);

            if (IsPostBack)
            {
                return;
            }

            var styleInfoList = ContentUtility.GetAllTableStyleInfoList(TableStyleManager.GetTableStyleInfoList(tableName, _relatedIdentities));

            foreach (var styleInfo in styleInfoList)
            {
                if (styleInfo.InputType == InputType.TextEditor)
                {
                    continue;
                }

                var listitem = new ListItem($"{styleInfo.DisplayName}({styleInfo.AttributeName})", styleInfo.AttributeName);
                if (styleInfo.AttributeName == ContentAttribute.Title)
                {
                    listitem.Selected = true;
                }
                else
                {
                    if (_isList)
                    {
                        if (attributesOfDisplay.Contains(styleInfo.AttributeName))
                        {
                            listitem.Selected = true;
                        }
                    }
                    else
                    {
                        listitem.Selected = true;
                    }
                }

                CblDisplayAttributes.Items.Add(listitem);
            }
        }
コード例 #6
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId");

            if (AuthRequest.IsQueryExists("isContent"))
            {
                _isContent = AuthRequest.GetQueryBool("isContent");
            }
            if (_isContent)
            {
                BtnAddGroup.Text = " 新建内容组";
                _idsDictionary   = ContentUtility.GetIDsDictionary(Request.QueryString);
            }
            else
            {
                BtnAddGroup.Text    = " 新建栏目组";
                _channelIdArrayList = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("ChannelIDCollection"));
            }
            if (!IsPostBack)
            {
                if (_isContent)
                {
                    var contentGroupNameList = ContentGroupManager.GetGroupNameList(SiteId);
                    foreach (var groupName in contentGroupNameList)
                    {
                        var item = new ListItem(groupName, groupName);
                        CblGroupNameCollection.Items.Add(item);
                    }
                    var showPopWinString = ModalContentGroupAdd.GetOpenWindowString(SiteId);
                    BtnAddGroup.Attributes.Add("onclick", showPopWinString);
                }
                else
                {
                    var nodeGroupNameList = ChannelGroupManager.GetGroupNameList(SiteId);
                    foreach (var groupName in nodeGroupNameList)
                    {
                        var item = new ListItem(groupName, groupName);
                        CblGroupNameCollection.Items.Add(item);
                    }

                    var showPopWinString = ModalNodeGroupAdd.GetOpenWindowString(SiteId);
                    BtnAddGroup.Attributes.Add("onclick", showPopWinString);
                }
            }
        }
コード例 #7
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId");
            _currentRootPath = AuthRequest.GetQueryString("CurrentRootPath");
            if (!string.IsNullOrEmpty(_currentRootPath) && !_currentRootPath.StartsWith("@"))
            {
                _currentRootPath = "@/" + _currentRootPath;
            }
            _textBoxClientId = AuthRequest.GetQueryString("TextBoxClientID");
            _isNeedWaterMark = AuthRequest.GetQueryBool("IsNeedWaterMark", true);
        }
コード例 #8
0
ファイル: PageProgressBar.cs プロジェクト: supadmins/cms-1
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId");

            var userKeyPrefix = AuthRequest.GetQueryString("userKeyPrefix");

            if (AuthRequest.IsQueryExists("createSite"))
            {
                LtlTitle.Text = "新建站点";
                var pars = AjaxCreateService.GetCreateSiteParameters(SiteId, AuthRequest.GetQueryBool("isImportContents"), AuthRequest.GetQueryBool("isImportTableStyles"), AuthRequest.GetQueryString("siteTemplateDir"), AuthRequest.GetQueryString("onlineTemplateName"), AuthRequest.GetQueryBool("isUseTables"), userKeyPrefix);
                LtlRegisterScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxCreateService.GetCreateSiteUrl(), pars, userKeyPrefix, AjaxCreateService.GetCountArrayUrl(), true);
            }
            else if (AuthRequest.IsQueryExists("backup") && AuthRequest.IsQueryExists("backupType"))
            {
                LtlTitle.Text = "数据备份";

                var parameters =
                    AjaxBackupService.GetBackupParameters(SiteId, AuthRequest.GetQueryString("backupType"), userKeyPrefix);
                LtlRegisterScripts.Text = AjaxManager.RegisterWaitingTaskScript(AjaxBackupService.GetBackupUrl(), parameters);
            }
            else if (AuthRequest.IsQueryExists("recovery") && AuthRequest.IsQueryExists("isZip"))
            {
                LtlTitle.Text = "数据恢复";
                var parameters = AjaxBackupService.GetRecoveryParameters(SiteId,
                                                                         AuthRequest.GetQueryBool("isDeleteChannels"), AuthRequest.GetQueryBool("isDeleteTemplates"),
                                                                         AuthRequest.GetQueryBool("isDeleteFiles"), AuthRequest.GetQueryBool("isZip"),
                                                                         PageUtils.UrlEncode(AuthRequest.GetQueryString("path")), AuthRequest.GetQueryBool("isOverride"),
                                                                         AuthRequest.GetQueryBool("isUseTable"), userKeyPrefix);
                LtlRegisterScripts.Text = AjaxManager.RegisterWaitingTaskScript(AjaxBackupService.GetRecoveryUrl(), parameters);
            }
            else if (AuthRequest.IsQueryExists("deleteAllPage") && AuthRequest.IsQueryExists("templateType"))
            {
                DeleteAllPage();
            }
            else if (AuthRequest.IsQueryExists("createIndex"))
            {
                CreateIndex();
            }
        }
コード例 #9
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId");

            TemplateInfo templateInfo = null;

            if (AuthRequest.GetQueryInt("TemplateID") > 0)
            {
                var templateId = AuthRequest.GetQueryInt("TemplateID");
                _isCopy      = AuthRequest.GetQueryBool("IsCopy");
                templateInfo = TemplateManager.GetTemplateInfo(SiteId, templateId);
                if (templateInfo != null)
                {
                    _templateType = templateInfo.TemplateType;
                }
            }
            else
            {
                _templateType = TemplateTypeUtils.GetEnumType(Request.QueryString["TemplateType"]);
            }

            if (_templateType == TemplateType.IndexPageTemplate || _templateType == TemplateType.FileTemplate)
            {
                PhCreatedFileFullName.Visible = true;
            }
            else
            {
                PhCreatedFileFullName.Visible = false;
            }

            if (IsPostBack)
            {
                return;
            }

            VerifySitePermissions(ConfigManager.SitePermissions.Templates);

            LtlTemplateType.Text = TemplateTypeUtils.GetText(_templateType);

            LtlPageTitle.Text = AuthRequest.GetQueryInt("TemplateID") > 0 ? "编辑模板" : "添加模板";

            var isCodeMirror = SiteInfo.Additional.ConfigTemplateIsCodeMirror;

            BtnEditorType.Text   = isCodeMirror ? "采用纯文本编辑模式" : "采用代码编辑模式";
            PhCodeMirror.Visible = isCodeMirror;

            EFileSystemTypeUtils.AddWebPageListItems(DdlCreatedFileExtName);

            ECharsetUtils.AddListItems(DdlCharset);

            if (AuthRequest.GetQueryInt("TemplateID") > 0)
            {
                if (templateInfo == null)
                {
                    return;
                }

                TbContent.Text = TemplateManager.GetTemplateContent(SiteInfo, templateInfo);

                if (_isCopy)
                {
                    TbTemplateName.Text        = templateInfo.TemplateName + "_复件";
                    TbRelatedFileName.Text     = PathUtils.RemoveExtension(templateInfo.RelatedFileName) + "_复件";
                    TbCreatedFileFullName.Text = PathUtils.RemoveExtension(templateInfo.CreatedFileFullName) + "_复件";
                }
                else
                {
                    TbTemplateName.Text        = templateInfo.TemplateName;
                    TbRelatedFileName.Text     = PathUtils.RemoveExtension(templateInfo.RelatedFileName);
                    TbCreatedFileFullName.Text = PathUtils.RemoveExtension(templateInfo.CreatedFileFullName);

                    LtlCommands.Text += $@"
<button class=""btn"" onclick=""{ModalProgressBar.GetOpenWindowStringWithCreateByTemplate(SiteId, templateInfo.Id)}"">生成页面</button>
<button class=""btn"" onclick=""{ModalTemplateRestore.GetOpenWindowString(SiteId, templateInfo.Id, string.Empty)}"">还原历史版本</button>";

                    if (AuthRequest.GetQueryInt("TemplateLogID") > 0)
                    {
                        var templateLogId = AuthRequest.GetQueryInt("TemplateLogID");
                        if (templateLogId > 0)
                        {
                            TbContent.Text = DataProvider.TemplateLogDao.GetTemplateContent(templateLogId);
                            SuccessMessage("已导入历史版本的模板内容,点击确定保存模板");
                        }
                    }
                }

                ControlUtils.SelectSingleItemIgnoreCase(DdlCharset, ECharsetUtils.GetValue(templateInfo.Charset));

                ControlUtils.SelectSingleItem(DdlCreatedFileExtName, GetTemplateFileExtension(templateInfo));
                HihTemplateType.Value = templateInfo.TemplateType.Value;
            }
            else
            {
                TbRelatedFileName.Text     = "T_";
                TbCreatedFileFullName.Text = _templateType == TemplateType.ChannelTemplate ? "index" : "@/";
                ControlUtils.SelectSingleItemIgnoreCase(DdlCharset, SiteInfo.Additional.Charset);
                ControlUtils.SelectSingleItem(DdlCreatedFileExtName, EFileSystemTypeUtils.GetValue(EFileSystemType.Html));
                HihTemplateType.Value = AuthRequest.GetQueryString("TemplateType");
            }
        }
コード例 #10
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId");
            _channelId = AuthRequest.IsQueryExists("channelId") ? AuthRequest.GetQueryInt("channelId") : SiteId;

            _isCheckOnly   = AuthRequest.GetQueryBool("isCheckOnly");
            _isTrashOnly   = AuthRequest.GetQueryBool("isTrashOnly");
            _isWritingOnly = AuthRequest.GetQueryBool("isWritingOnly");
            _isAdminOnly   = AuthRequest.GetQueryBool("isAdminOnly");

            _channelInfo = ChannelManager.GetChannelInfo(SiteId, _channelId);
            var tableName = ChannelManager.GetTableName(SiteInfo, _channelInfo);

            _styleInfoList       = TableStyleManager.GetContentStyleInfoList(SiteInfo, _channelInfo);
            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, _channelId));
            _allStyleInfoList    = ContentUtility.GetAllTableStyleInfoList(_styleInfoList);
            _pluginIds           = PluginContentManager.GetContentPluginIds(_channelInfo);
            _pluginColumns       = PluginContentManager.GetContentColumns(_pluginIds);
            _isEdit = TextUtility.IsEdit(SiteInfo, _channelId, AuthRequest.AdminPermissionsImpl);

            var state      = AuthRequest.IsQueryExists("state") ? AuthRequest.GetQueryInt("state") : CheckManager.LevelInt.All;
            var searchType = AuthRequest.IsQueryExists("searchType") ? AuthRequest.GetQueryString("searchType") : ContentAttribute.Title;
            var dateFrom   = AuthRequest.IsQueryExists("dateFrom") ? AuthRequest.GetQueryString("dateFrom") : string.Empty;
            var dateTo     = AuthRequest.IsQueryExists("dateTo") ? AuthRequest.GetQueryString("dateTo") : string.Empty;
            var keyword    = AuthRequest.IsQueryExists("keyword") ? AuthRequest.GetQueryString("keyword") : string.Empty;

            var checkedLevel = 5;
            var isChecked    = true;

            foreach (var owningChannelId in AuthRequest.AdminPermissionsImpl.ChannelIdList)
            {
                int checkedLevelByChannelId;
                var isCheckedByChannelId = CheckManager.GetUserCheckLevel(AuthRequest.AdminPermissionsImpl, SiteInfo, owningChannelId, out checkedLevelByChannelId);
                if (checkedLevel > checkedLevelByChannelId)
                {
                    checkedLevel = checkedLevelByChannelId;
                }
                if (!isCheckedByChannelId)
                {
                    isChecked = false;
                }
            }

            RptContents.ItemDataBound += RptContents_ItemDataBound;

            var allAttributeNameList = TableColumnManager.GetTableColumnNameList(tableName, DataType.Text);
            var adminId = _isAdminOnly
                ? AuthRequest.AdminId
                : AuthRequest.AdminPermissionsImpl.GetAdminId(SiteInfo.Id, _channelInfo.Id);
            var whereString = DataProvider.ContentDao.GetPagerWhereSqlString(SiteInfo, _channelInfo,
                                                                             searchType, keyword,
                                                                             dateFrom, dateTo, state, _isCheckOnly, false, _isTrashOnly, _isWritingOnly, adminId,
                                                                             AuthRequest.AdminPermissionsImpl,
                                                                             allAttributeNameList);

            PgContents.Param = new PagerParam
            {
                ControlToPaginate = RptContents,
                TableName         = tableName,
                PageSize          = SiteInfo.Additional.PageSize,
                Page              = AuthRequest.GetQueryInt(Pager.QueryNamePage, 1),
                OrderSqlString    = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByIdDesc),
                ReturnColumnNames = TranslateUtils.ObjectCollectionToString(allAttributeNameList),
                WhereSqlString    = whereString,
                TotalCount        = DataProvider.DatabaseDao.GetPageTotalCount(tableName, whereString)
            };

            if (IsPostBack)
            {
                return;
            }

            if (_isTrashOnly)
            {
                if (AuthRequest.IsQueryExists("IsDeleteAll"))
                {
                    //DataProvider.ContentDao.DeleteContentsByTrash(SiteId, _channelId, tableName);

                    var list = DataProvider.ContentDao.GetContentIdListByTrash(SiteId, tableName);
                    foreach (var(contentChannelId, contentId) in list)
                    {
                        ContentUtility.Delete(tableName, SiteInfo, contentChannelId, contentId);
                    }

                    AuthRequest.AddSiteLog(SiteId, "清空回收站");
                    SuccessMessage("成功清空回收站!");
                }
                else if (AuthRequest.IsQueryExists("IsRestore"))
                {
                    var idsDictionary = ContentUtility.GetIDsDictionary(Request.QueryString);
                    foreach (var channelId in idsDictionary.Keys)
                    {
                        var contentIdList = idsDictionary[channelId];
                        DataProvider.ContentDao.UpdateTrashContents(SiteId, channelId, ChannelManager.GetTableName(SiteInfo, channelId), contentIdList);
                    }
                    AuthRequest.AddSiteLog(SiteId, "从回收站还原内容");
                    SuccessMessage("成功还原内容!");
                }
                else if (AuthRequest.IsQueryExists("IsRestoreAll"))
                {
                    DataProvider.ContentDao.UpdateRestoreContentsByTrash(SiteId, _channelId, tableName);
                    AuthRequest.AddSiteLog(SiteId, "从回收站还原所有内容");
                    SuccessMessage("成功还原所有内容!");
                }
            }

            ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, true, true, AuthRequest.AdminPermissionsImpl);

            if (_isCheckOnly)
            {
                CheckManager.LoadContentLevelToCheck(DdlState, SiteInfo, isChecked, checkedLevel);
            }
            else
            {
                CheckManager.LoadContentLevelToList(DdlState, SiteInfo, _isCheckOnly, isChecked, checkedLevel);
            }

            ControlUtils.SelectSingleItem(DdlState, state.ToString());

            foreach (var styleInfo in _allStyleInfoList)
            {
                if (styleInfo.InputType == InputType.TextEditor)
                {
                    continue;
                }

                var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                DdlSearchType.Items.Add(listitem);
            }

            //ETriStateUtils.AddListItems(DdlState, "全部", "已审核", "待审核");

            if (SiteId != _channelId)
            {
                ControlUtils.SelectSingleItem(DdlChannelId, _channelId.ToString());
            }
            //ControlUtils.SelectSingleItem(DdlState, AuthRequest.GetQueryString("State"));
            ControlUtils.SelectSingleItem(DdlSearchType, searchType);
            TbKeyword.Text  = keyword;
            TbDateFrom.Text = dateFrom;
            TbDateTo.Text   = dateTo;

            PgContents.DataBind();

            LtlColumnsHead.Text += TextUtility.GetColumnsHeadHtml(_styleInfoList, _pluginColumns, _attributesOfDisplay);


            BtnSelect.Attributes.Add("onclick", ModalSelectColumns.GetOpenWindowString(SiteId, _channelId));

            if (_isTrashOnly)
            {
                LtlColumnsHead.Text  += @"<th class=""text-center text-nowrap"" width=""150"">删除时间</th>";
                BtnAddToGroup.Visible = BtnTranslate.Visible = BtnCheck.Visible = false;
                PhTrash.Visible       = true;
                if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentDelete))
                {
                    BtnDelete.Visible    = false;
                    BtnDeleteAll.Visible = false;
                }
                else
                {
                    BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, true, PageUrl));
                    BtnDeleteAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.AddQueryString(PageUrl, "IsDeleteAll", "True"), "确实要清空回收站吗?"));
                }
                BtnRestore.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValue(PageUtils.AddQueryString(PageUrl, "IsRestore", "True"), "IDsCollection", "IDsCollection", "请选择需要还原的内容!"));
                BtnRestoreAll.Attributes.Add("onclick", PageUtils.GetRedirectStringWithConfirm(PageUtils.AddQueryString(PageUrl, "IsRestoreAll", "True"), "确实要还原所有内容吗?"));
            }
            else
            {
                LtlColumnsHead.Text += @"<th class=""text-center text-nowrap"" width=""100"">操作</th>";

                BtnAddToGroup.Attributes.Add("onclick", ModalAddToGroup.GetOpenWindowStringToContentForMultiChannels(SiteId));

                if (HasChannelPermissions(SiteId, ConfigManager.ChannelPermissions.ContentCheck))
                {
                    BtnCheck.Attributes.Add("onclick", ModalContentCheck.GetOpenWindowStringForMultiChannels(SiteId, PageUrl));
                    if (_isCheckOnly)
                    {
                        BtnCheck.CssClass = "btn m-r-5 btn-success";
                    }
                }
                else
                {
                    PhCheck.Visible = false;
                }

                if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentTranslate))
                {
                    BtnTranslate.Visible = false;
                }
                else
                {
                    BtnTranslate.Attributes.Add("onclick", PageContentTranslate.GetRedirectClickStringForMultiChannels(SiteId, PageUrl));
                }

                if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentDelete))
                {
                    BtnDelete.Visible = false;
                }
                else
                {
                    BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, false, PageUrl));
                }
            }
        }
コード例 #11
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId", "channelId");

            var channelId = AuthRequest.GetQueryInt("channelId");
            var contentId = AuthRequest.GetQueryInt("id");

            ReturnUrl = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("returnUrl"));
            if (string.IsNullOrEmpty(ReturnUrl))
            {
                ReturnUrl = CmsPages.GetContentsUrl(SiteId, channelId);
            }

            _channelInfo = ChannelManager.GetChannelInfo(SiteId, channelId);
            _tableName   = ChannelManager.GetTableName(SiteInfo, _channelInfo);
            ContentInfo contentInfo = null;

            _styleInfoList = TableStyleManager.GetContentStyleInfoList(SiteInfo, _channelInfo);

            if (!IsPermissions(contentId))
            {
                return;
            }

            if (contentId > 0)
            {
                contentInfo = ContentManager.GetContentInfo(SiteInfo, _channelInfo, contentId);
            }

            var titleFormat = IsPostBack ? Request.Form[ContentAttribute.GetFormatStringAttributeName(ContentAttribute.Title)] : contentInfo?.GetString(ContentAttribute.GetFormatStringAttributeName(ContentAttribute.Title));

            LtlTitleHtml.Text = ContentUtility.GetTitleHtml(titleFormat, AjaxCmsService.GetTitlesUrl(SiteId, _channelInfo.Id));

            AcAttributes.SiteInfo      = SiteInfo;
            AcAttributes.ChannelId     = _channelInfo.Id;
            AcAttributes.ContentId     = contentId;
            AcAttributes.StyleInfoList = _styleInfoList;

            if (!IsPostBack)
            {
                var pageTitle = contentId == 0 ? "添加内容" : "编辑内容";

                LtlPageTitle.Text = pageTitle;

                if (HasChannelPermissions(_channelInfo.Id, ConfigManager.ChannelPermissions.ContentTranslate))
                {
                    PhTranslate.Visible = true;
                    BtnTranslate.Attributes.Add("onclick", ModalChannelMultipleSelect.GetOpenWindowString(SiteId, true));

                    ETranslateContentTypeUtils.AddListItems(DdlTranslateType, true);
                    ControlUtils.SelectSingleItem(DdlTranslateType, ETranslateContentTypeUtils.GetValue(ETranslateContentType.Copy));
                }
                else
                {
                    PhTranslate.Visible = false;
                }

                CblContentAttributes.Items.Add(new ListItem("置顶", ContentAttribute.IsTop));
                CblContentAttributes.Items.Add(new ListItem("推荐", ContentAttribute.IsRecommend));
                CblContentAttributes.Items.Add(new ListItem("热点", ContentAttribute.IsHot));
                CblContentAttributes.Items.Add(new ListItem("醒目", ContentAttribute.IsColor));
                TbAddDate.DateTime = DateTime.Now;
                TbAddDate.Now      = true;

                var contentGroupNameList = ContentGroupManager.GetGroupNameList(SiteId);
                foreach (var groupName in contentGroupNameList)
                {
                    var item = new ListItem(groupName, groupName);
                    CblContentGroups.Items.Add(item);
                }

                BtnContentGroupAdd.Attributes.Add("onclick", ModalContentGroupAdd.GetOpenWindowString(SiteId));

                LtlTags.Text = ContentUtility.GetTagsHtml(AjaxCmsService.GetTagsUrl(SiteId));

                if (HasChannelPermissions(_channelInfo.Id, ConfigManager.ChannelPermissions.ContentCheck))
                {
                    PhStatus.Visible = true;
                    int checkedLevel;
                    var isChecked = CheckManager.GetUserCheckLevel(AuthRequest.AdminPermissionsImpl, SiteInfo, _channelInfo.Id, out checkedLevel);
                    if (AuthRequest.IsQueryExists("contentLevel"))
                    {
                        checkedLevel = TranslateUtils.ToIntWithNagetive(AuthRequest.GetQueryString("contentLevel"));
                        if (checkedLevel != CheckManager.LevelInt.NotChange)
                        {
                            isChecked = checkedLevel >= SiteInfo.Additional.CheckContentLevel;
                        }
                    }

                    CheckManager.LoadContentLevelToEdit(DdlContentLevel, SiteInfo, contentInfo, isChecked, checkedLevel);
                }
                else
                {
                    PhStatus.Visible = false;
                }

                BtnSubmit.Attributes.Add("onclick", InputParserUtils.GetValidateSubmitOnClickScript("myForm", true, "autoCheckKeywords()"));
                //自动检测敏感词
                ClientScriptRegisterStartupScript("autoCheckKeywords", WebUtils.GetAutoCheckKeywordsScript(SiteInfo));

                if (contentId == 0)
                {
                    var attributes = TableStyleManager.GetDefaultAttributes(_styleInfoList);

                    if (AuthRequest.IsQueryExists("isUploadWord"))
                    {
                        var isFirstLineTitle  = AuthRequest.GetQueryBool("isFirstLineTitle");
                        var isFirstLineRemove = AuthRequest.GetQueryBool("isFirstLineRemove");
                        var isClearFormat     = AuthRequest.GetQueryBool("isClearFormat");
                        var isFirstLineIndent = AuthRequest.GetQueryBool("isFirstLineIndent");
                        var isClearFontSize   = AuthRequest.GetQueryBool("isClearFontSize");
                        var isClearFontFamily = AuthRequest.GetQueryBool("isClearFontFamily");
                        var isClearImages     = AuthRequest.GetQueryBool("isClearImages");
                        var contentLevel      = AuthRequest.GetQueryInt("contentLevel");
                        var fileName          = AuthRequest.GetQueryString("fileName");

                        var formCollection = WordUtils.GetWordNameValueCollection(SiteId, isFirstLineTitle, isFirstLineRemove, isClearFormat, isFirstLineIndent, isClearFontSize, isClearFontFamily, isClearImages, fileName);
                        attributes.Load(formCollection);

                        TbTitle.Text = formCollection[ContentAttribute.Title];
                    }

                    AcAttributes.Attributes = attributes;
                }
                else if (contentInfo != null)
                {
                    TbTitle.Text = contentInfo.Title;

                    TbTags.Text = contentInfo.Tags;

                    var list = new List <string>();
                    if (contentInfo.IsTop)
                    {
                        list.Add(ContentAttribute.IsTop);
                    }
                    if (contentInfo.IsRecommend)
                    {
                        list.Add(ContentAttribute.IsRecommend);
                    }
                    if (contentInfo.IsHot)
                    {
                        list.Add(ContentAttribute.IsHot);
                    }
                    if (contentInfo.IsColor)
                    {
                        list.Add(ContentAttribute.IsColor);
                    }
                    ControlUtils.SelectMultiItems(CblContentAttributes, list);
                    TbLinkUrl.Text     = contentInfo.LinkUrl;
                    TbAddDate.DateTime = contentInfo.AddDate;
                    ControlUtils.SelectMultiItems(CblContentGroups, TranslateUtils.StringCollectionToStringList(contentInfo.GroupNameCollection));

                    AcAttributes.Attributes = contentInfo;
                }
            }
            else
            {
                AcAttributes.Attributes = new AttributesImpl(Request.Form);
            }
            //DataBind();
        }
コード例 #12
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("SiteId");
            _channelId = AuthRequest.IsQueryExists("ChannelId") ? AuthRequest.GetQueryInt("ChannelId") : SiteId;

            _isWritingOnly = AuthRequest.GetQueryBool("isWritingOnly");

            var administratorName = string.Empty;

            _isSelfOnly = AuthRequest.GetQueryBool("isSelfOnly");
            if (!_isSelfOnly)
            {
                administratorName = AuthRequest.AdminPermissions.IsViewContentOnlySelf(SiteId, _channelId) ? AuthRequest.AdminName : string.Empty;
            }

            _channelInfo = ChannelManager.GetChannelInfo(SiteId, _channelId);
            var tableName = ChannelManager.GetTableName(SiteInfo, _channelInfo);

            _relatedIdentities   = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId);
            _styleInfoList       = TableStyleManager.GetTableStyleInfoList(tableName, _relatedIdentities);
            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, _channelId));
            _allStyleInfoList    = ContentUtility.GetAllTableStyleInfoList(_styleInfoList);
            _pluginLinks         = PluginContentManager.GetContentLinks(_channelInfo);
            _isEdit = TextUtility.IsEdit(SiteInfo, _channelId, AuthRequest.AdminPermissions);

            var stateType  = AuthRequest.IsQueryExists("state") ? ETriStateUtils.GetEnumType(AuthRequest.GetQueryString("state")) : ETriState.All;
            var searchType = AuthRequest.IsQueryExists("searchType") ? AuthRequest.GetQueryString("searchType") : ContentAttribute.Title;
            var dateFrom   = AuthRequest.IsQueryExists("dateFrom") ? AuthRequest.GetQueryString("dateFrom") : string.Empty;
            var dateTo     = AuthRequest.IsQueryExists("dateTo") ? AuthRequest.GetQueryString("dateTo") : string.Empty;
            var keyword    = AuthRequest.IsQueryExists("keyword") ? AuthRequest.GetQueryString("keyword") : string.Empty;

            RptContents.ItemDataBound += RptContents_ItemDataBound;

            var allLowerAttributeNameList = TableMetadataManager.GetAllLowerAttributeNameListExcludeText(tableName);
            var pagerParam = new PagerParam
            {
                ControlToPaginate = RptContents,
                TableName         = tableName,
                PageSize          = SiteInfo.Additional.PageSize,
                Page              = AuthRequest.GetQueryInt(Pager.QueryNamePage, 1),
                OrderSqlString    = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByIdDesc),
                ReturnColumnNames = TranslateUtils.ObjectCollectionToString(allLowerAttributeNameList)
            };

            var channelIdList = ChannelManager.GetChannelIdList(_channelInfo, EScopeType.All, string.Empty, string.Empty, _channelInfo.ContentModelPluginId);

            var searchChannelIdList = new List <int>();

            if (AuthRequest.AdminPermissions.IsSystemAdministrator)
            {
                searchChannelIdList = channelIdList;
            }
            else
            {
                foreach (var theChannelId in channelIdList)
                {
                    if (AuthRequest.AdminPermissions.OwningChannelIdList.Contains(theChannelId))
                    {
                        searchChannelIdList.Add(theChannelId);
                    }
                }
            }

            pagerParam.WhereSqlString = DataProvider.ContentDao.GetPagerWhereSqlString(allLowerAttributeNameList,
                                                                                       SiteId, _channelInfo, AuthRequest.AdminPermissions.IsSystemAdministrator, searchChannelIdList, searchType, keyword,
                                                                                       dateFrom, dateTo, true, stateType, false, _isWritingOnly, administratorName);
            pagerParam.TotalCount =
                DataProvider.DatabaseDao.GetPageTotalCount(tableName, pagerParam.WhereSqlString);

            PgContents.Param = pagerParam;

            if (!IsPostBack)
            {
                ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, true, true, AuthRequest.AdminPermissions);

                foreach (var styleInfo in _allStyleInfoList)
                {
                    if (styleInfo.InputType == InputType.TextEditor)
                    {
                        continue;
                    }

                    var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                    DdlSearchType.Items.Add(listitem);
                }

                ETriStateUtils.AddListItems(DdlState, "全部", "已审核", "待审核");

                if (SiteId != _channelId)
                {
                    ControlUtils.SelectSingleItem(DdlChannelId, _channelId.ToString());
                }
                ControlUtils.SelectSingleItem(DdlState, AuthRequest.GetQueryString("State"));
                ControlUtils.SelectSingleItem(DdlSearchType, searchType);
                TbKeyword.Text  = keyword;
                TbDateFrom.Text = dateFrom;
                TbDateTo.Text   = dateTo;

                PgContents.DataBind();

                var showPopWinString = ModalAddToGroup.GetOpenWindowStringToContentForMultiChannels(SiteId);
                BtnAddToGroup.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalSelectColumns.GetOpenWindowString(SiteId, _channelId, true);
                BtnSelect.Attributes.Add("onclick", showPopWinString);

                if (HasChannelPermissions(SiteId, ConfigManager.ChannelPermissions.ContentCheck))
                {
                    showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(SiteId, PageUrl);
                    BtnCheck.Attributes.Add("onclick", showPopWinString);
                }
                else
                {
                    PhCheck.Visible = false;
                }

                LtlColumnsHead.Text = TextUtility.GetColumnsHeadHtml(_styleInfoList, _attributesOfDisplay, SiteInfo);
            }

            if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentAdd))
            {
                BtnAddContent.Visible = false;
            }
            if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentTranslate))
            {
                BtnTranslate.Visible = false;
            }
            else
            {
                BtnTranslate.Attributes.Add("onclick", PageContentTranslate.GetRedirectClickStringForMultiChannels(SiteId, PageUrl));
            }

            if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentDelete))
            {
                BtnDelete.Visible = false;
            }
            else
            {
                BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, false, PageUrl));
            }
        }
コード例 #13
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _jsMethod = AuthRequest.GetQueryString("jsMethod");

            PageUtils.CheckRequestParameter("siteId");
            var channelId = AuthRequest.GetQueryInt("channelId");

            if (channelId == 0)
            {
                channelId = SiteId;
            }
            _channelInfo        = ChannelManager.GetChannelInfo(SiteId, channelId);
            _tableName          = ChannelManager.GetTableName(SiteInfo, _channelInfo);
            _relatedIdentities  = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelInfo.Id);
            _tableStyleInfoList = TableStyleManager.GetTableStyleInfoList(_tableName, _relatedIdentities);

            SpContents.ControlToPaginate = RptContents;
            SpContents.SelectCommand     = string.IsNullOrEmpty(AuthRequest.GetQueryString("channelId"))
                ? DataProvider.ContentDao.GetSqlString(_tableName, SiteId,
                                                       _channelInfo.Id, AuthRequest.AdminPermissions.IsSystemAdministrator,
                                                       AuthRequest.AdminPermissions.OwningChannelIdList, DdlSearchType.SelectedValue, TbKeyword.Text,
                                                       TbDateFrom.Text, TbDateTo.Text, true, ETriState.True, !CbIsDuplicate.Checked, false)
                : DataProvider.ContentDao.GetSqlString(_tableName, SiteId,
                                                       _channelInfo.Id, AuthRequest.AdminPermissions.IsSystemAdministrator,
                                                       AuthRequest.AdminPermissions.OwningChannelIdList, AuthRequest.GetQueryString("SearchType"),
                                                       AuthRequest.GetQueryString("Keyword"), AuthRequest.GetQueryString("DateFrom"), AuthRequest.GetQueryString("DateTo"), true,
                                                       ETriState.True, !AuthRequest.GetQueryBool("IsDuplicate"), true);
            SpContents.ItemsPerPage    = SiteInfo.Additional.PageSize;
            SpContents.SortField       = ContentAttribute.Id;
            SpContents.SortMode        = SortMode.DESC;
            SpContents.OrderByString   = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByIdDesc);
            RptContents.ItemDataBound += RptContents_ItemDataBound;

            if (IsPostBack)
            {
                return;
            }

            ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, false, true, AuthRequest.AdminPermissions);

            if (_tableStyleInfoList != null)
            {
                foreach (var styleInfo in _tableStyleInfoList)
                {
                    var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                    DdlSearchType.Items.Add(listitem);
                }
            }

            //添加隐藏属性
            DdlSearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id));
            DdlSearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName));
            DdlSearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName));

            if (AuthRequest.IsQueryExists("channelId"))
            {
                if (SiteId != _channelInfo.Id)
                {
                    ControlUtils.SelectSingleItem(DdlChannelId, _channelInfo.Id.ToString());
                }
                CbIsDuplicate.Checked = AuthRequest.GetQueryBool("IsDuplicate");
                ControlUtils.SelectSingleItem(DdlSearchType, AuthRequest.GetQueryString("SearchType"));
                TbKeyword.Text  = AuthRequest.GetQueryString("Keyword");
                TbDateFrom.Text = AuthRequest.GetQueryString("DateFrom");
                TbDateTo.Text   = AuthRequest.GetQueryString("DateTo");
            }

            SpContents.DataBind();
        }
コード例 #14
0
ファイル: ModalExportMessage.cs プロジェクト: zerojuls/cms-3
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _exportType = AuthRequest.GetQueryString("ExportType");

            if (!IsPostBack)
            {
                var isExport = true;
                var fileName = string.Empty;
                try
                {
                    if (_exportType == ExportTypeRelatedField)
                    {
                        var relatedFieldId = AuthRequest.GetQueryInt("RelatedFieldID");
                        fileName = ExportRelatedField(relatedFieldId);
                    }
                    else if (_exportType == ExportTypeContentZip)
                    {
                        var channelId           = AuthRequest.GetQueryInt("channelId");
                        var contentIdCollection = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("contentIdCollection"));
                        var isPeriods           = AuthRequest.GetQueryBool("isPeriods");
                        var startDate           = AuthRequest.GetQueryString("startDate");
                        var endDate             = AuthRequest.GetQueryString("endDate");
                        var checkedState        = ETriStateUtils.GetEnumType(AuthRequest.GetQueryString("checkedState"));
                        isExport = ExportContentZip(channelId, contentIdCollection, isPeriods, startDate, endDate, checkedState, out fileName);
                    }
                    else if (_exportType == ExportTypeContentAccess)
                    {
                        var channelId           = AuthRequest.GetQueryInt("channelId");
                        var contentIdCollection = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("contentIdCollection"));
                        var displayAttributes   = TranslateUtils.StringCollectionToStringList(AuthRequest.GetQueryString("DisplayAttributes"));
                        var isPeriods           = AuthRequest.GetQueryBool("isPeriods");
                        var startDate           = AuthRequest.GetQueryString("startDate");
                        var endDate             = AuthRequest.GetQueryString("endDate");
                        var checkedState        = ETriStateUtils.GetEnumType(AuthRequest.GetQueryString("checkedState"));
                        isExport = ExportContentAccess(channelId, contentIdCollection, displayAttributes, isPeriods, startDate, endDate, checkedState, out fileName);
                    }
                    else if (_exportType == ExportTypeContentExcel)
                    {
                        var channelId           = AuthRequest.GetQueryInt("channelId");
                        var contentIdCollection = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("contentIdCollection"));
                        var displayAttributes   = TranslateUtils.StringCollectionToStringList(AuthRequest.GetQueryString("DisplayAttributes"));
                        var isPeriods           = AuthRequest.GetQueryBool("isPeriods");
                        var startDate           = AuthRequest.GetQueryString("startDate");
                        var endDate             = AuthRequest.GetQueryString("endDate");
                        var checkedState        = ETriStateUtils.GetEnumType(AuthRequest.GetQueryString("checkedState"));
                        ExportContentExcel(channelId, contentIdCollection, displayAttributes, isPeriods, startDate, endDate, checkedState, out fileName);
                    }
                    else if (_exportType == ExportTypeChannel)
                    {
                        var channelIdList = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("ChannelIDCollection"));
                        fileName = ExportChannel(channelIdList);
                    }
                    else if (_exportType == ExportTypeSingleTableStyle)
                    {
                        var tableName       = AuthRequest.GetQueryString("TableName");
                        var relatedIdentity = AuthRequest.GetQueryInt("RelatedIdentity");
                        fileName = ExportSingleTableStyle(tableName, relatedIdentity);
                    }

                    if (isExport)
                    {
                        var link     = new HyperLink();
                        var filePath = PathUtils.GetTemporaryFilesPath(fileName);
                        link.NavigateUrl = ApiRouteActionsDownload.GetUrl(ApiManager.InnerApiUrl, filePath);
                        link.Text        = "下载";
                        var successMessage = "成功导出文件!&nbsp;&nbsp;" + ControlUtils.GetControlRenderHtml(link);
                        SuccessMessage(successMessage);
                    }
                    else
                    {
                        FailMessage("导出失败,所选条件没有匹配内容,请重新选择条件导出内容");
                    }
                }
                catch (Exception ex)
                {
                    var failedMessage = "文件导出失败!<br/><br/>原因为:" + ex.Message;
                    FailMessage(ex, failedMessage);
                }
            }
        }
コード例 #15
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _isSiteSelect = AuthRequest.GetQueryBool("isSiteSelect");
            _jsMethod     = AuthRequest.GetQueryString("jsMethod");

            _targetSiteId = AuthRequest.GetQueryInt("TargetSiteId");
            if (_targetSiteId == 0)
            {
                _targetSiteId = SiteId;
            }

            if (IsPostBack)
            {
                return;
            }

            PhSiteId.Visible = _isSiteSelect;

            var siteIdList = AuthRequest.AdminPermissionsImpl.GetSiteIdList();

            var mySystemInfoArrayList = new ArrayList();
            var parentWithChildren    = new Hashtable();

            foreach (var siteId in siteIdList)
            {
                var siteInfo = SiteManager.GetSiteInfo(siteId);
                if (siteInfo.ParentId == 0)
                {
                    mySystemInfoArrayList.Add(siteInfo);
                }
                else
                {
                    var children = new ArrayList();
                    if (parentWithChildren.Contains(siteInfo.ParentId))
                    {
                        children = (ArrayList)parentWithChildren[siteInfo.ParentId];
                    }
                    children.Add(siteInfo);
                    parentWithChildren[siteInfo.ParentId] = children;
                }
            }
            foreach (SiteInfo siteInfo in mySystemInfoArrayList)
            {
                AddSite(DdlSiteId, siteInfo, parentWithChildren, 0);
            }
            ControlUtils.SelectSingleItem(DdlSiteId, _targetSiteId.ToString());

            var targetChannelId = AuthRequest.GetQueryInt("TargetChannelId");

            if (targetChannelId > 0)
            {
                var siteName  = SiteManager.GetSiteInfo(_targetSiteId).SiteName;
                var nodeNames = ChannelManager.GetChannelNameNavigation(_targetSiteId, targetChannelId);
                if (_targetSiteId != SiteId)
                {
                    nodeNames = siteName + ":" + nodeNames;
                }
                string value = $"{_targetSiteId}_{targetChannelId}";
                if (!_isSiteSelect)
                {
                    value = targetChannelId.ToString();
                }
                string scripts = $"window.parent.{_jsMethod}('{nodeNames}', '{value}');";
                LayerUtils.CloseWithoutRefresh(Page, scripts);
            }
            else
            {
                var nodeInfo = ChannelManager.GetChannelInfo(_targetSiteId, _targetSiteId);
                var linkUrl  = GetRedirectUrl(_targetSiteId, _targetSiteId.ToString());
                LtlChannelName.Text = $"<a href='{linkUrl}'>{nodeInfo.ChannelName}</a>";

                var additional = new NameValueCollection
                {
                    ["linkUrl"] = GetRedirectUrl(_targetSiteId, string.Empty)
                };
                ClientScriptRegisterClientScriptBlock("NodeTreeScript", ChannelLoading.GetScript(SiteManager.GetSiteInfo(_targetSiteId), string.Empty, ELoadingType.ChannelClickSelect, additional));

                var channelIdList = ChannelManager.GetChannelIdList(nodeInfo, EScopeType.Children, string.Empty, string.Empty, string.Empty);

                RptChannel.DataSource     = channelIdList;
                RptChannel.ItemDataBound += RptChannel_ItemDataBound;
                RptChannel.DataBind();
            }
        }
コード例 #16
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId", "ReturnUrl");
            _returnUrl         = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("ReturnUrl"));
            _isDeleteFromTrash = AuthRequest.GetQueryBool("IsDeleteFromTrash");
            _idsDictionary     = ContentUtility.GetIDsDictionary(Request.QueryString);

            //if (this.channelId > 0)
            //{
            //    this.nodeInfo = NodeManager.GetChannelInfo(base.SiteId, this.channelId);
            //}
            //else
            //{
            //    this.nodeInfo = NodeManager.GetChannelInfo(base.SiteId, -this.channelId);
            //}
            //if (this.nodeInfo != null)
            //{
            //    this.tableStyle = NodeManager.GetTableStyle(base.SiteInfo, nodeInfo);
            //    this.tableName = NodeManager.GetTableName(base.SiteInfo, nodeInfo);
            //}

            //if (this.contentID == 0)
            //{
            //    if (!base.HasChannelPermissions(Math.Abs(this.channelId), AppManager.CMS.Permission.Channel.ContentDelete))
            //    {
            //        PageUtils.RedirectToErrorPage("您没有删除此栏目内容的权限!");
            //        return;
            //    }
            //}
            //else
            //{
            //    ContentInfo contentInfo = DataProvider.ContentDAO.GetContentInfo(this.tableStyle, this.tableName, this.contentID);

            //    if (contentInfo == null || !string.Equals(AuthRequest.AdminName, contentInfo.AddUserName))
            //    {
            //        if (!base.HasChannelPermissions(Math.Abs(this.channelId), AppManager.CMS.Permission.Channel.ContentDelete))
            //        {
            //            PageUtils.RedirectToErrorPage("您没有删除此栏目内容的权限!");
            //            return;
            //        }
            //    }
            //}

            if (IsPostBack)
            {
                return;
            }

            var builder = new StringBuilder();

            foreach (var channelId in _idsDictionary.Keys)
            {
                var contentIdList = _idsDictionary[channelId];
                foreach (var contentId in contentIdList)
                {
                    var contentInfo = ContentManager.GetContentInfo(SiteInfo, channelId, contentId);
                    if (contentInfo != null)
                    {
                        builder.Append(
                            $@"{WebUtils.GetContentTitle(SiteInfo, contentInfo, _returnUrl)}<br />");
                    }
                }
            }
            LtlContents.Text = builder.ToString();

            if (!_isDeleteFromTrash)
            {
                PhRetain.Visible = true;
                InfoMessage("此操作将把所选内容放入回收站,确定吗?");
            }
            else
            {
                PhRetain.Visible = false;
                InfoMessage("此操作将从回收站中彻底删除所选内容,确定吗?");
            }
        }
コード例 #17
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId", "RelatedPath", "FileName", "IsCreate");
            _relatedPath = AuthRequest.GetQueryString("RelatedPath").Trim('/');
            if (!_relatedPath.StartsWith("@"))
            {
                _relatedPath = "@/" + _relatedPath;
            }
            _theFileName = AuthRequest.GetQueryString("FileName");
            _isCreate    = AuthRequest.GetQueryBool("IsCreate");
            _fileCharset = ECharset.utf_8;
            if (SiteInfo != null)
            {
                _fileCharset = ECharsetUtils.GetEnumType(SiteInfo.Additional.Charset);
            }

            if (_isCreate == false)
            {
                var filePath = SiteInfo != null
                    ? PathUtility.MapPath(SiteInfo, PathUtils.Combine(_relatedPath, _theFileName))
                    : PathUtils.MapPath(PathUtils.Combine(_relatedPath, _theFileName));

                if (!FileUtils.IsFileExists(filePath))
                {
                    PageUtils.RedirectToErrorPage("此文件不存在!");
                    return;
                }
            }

            if (IsPostBack)
            {
                return;
            }

            DdlCharset.Items.Add(new ListItem("默认", string.Empty));
            ECharsetUtils.AddListItems(DdlCharset);

            if (_isCreate == false)
            {
                var filePath = SiteInfo != null?PathUtility.MapPath(SiteInfo, PathUtils.Combine(_relatedPath, _theFileName)) : PathUtils.MapPath(PathUtils.Combine(_relatedPath, _theFileName));

                TbFileName.Text    = _theFileName;
                TbFileName.Enabled = false;
                TbFileContent.Text = FileUtils.ReadText(filePath, _fileCharset);
            }

            if (_isCreate)
            {
                return;
            }

            if (SiteInfo != null)
            {
                LtlOpen.Text =
                    $@"<a class=""btn btn-default m-l-10"" href=""{PageUtility.ParseNavigationUrl(SiteInfo,
                        PageUtils.Combine(_relatedPath, _theFileName), true)}"" target=""_blank"">浏 览</a>";
            }
            else
            {
                LtlOpen.Text =
                    $@"<a class=""btn btn-default m-l-10"" href=""{PageUtils.ParseConfigRootUrl(PageUtils.Combine(_relatedPath, _theFileName))}"" target=""_blank"">浏 览</a>";
            }
            LtlView.Text = $@"<a class=""btn btn-default m-l-10"" href=""{ModalFileView.GetRedirectUrl(SiteId, _relatedPath, _theFileName)}"">查 看</a>";
        }
コード例 #18
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("SiteId");
            _channelId = AuthRequest.IsQueryExists("ChannelId") ? AuthRequest.GetQueryInt("ChannelId") : SiteId;

            _isWritingOnly = AuthRequest.GetQueryBool("isWritingOnly");

            var administratorName = string.Empty;

            _isSelfOnly = AuthRequest.GetQueryBool("isSelfOnly");
            if (!_isSelfOnly)
            {
                administratorName = AuthRequest.AdminPermissions.IsViewContentOnlySelf(SiteId, _channelId) ? AuthRequest.AdminName : string.Empty;
            }

            _nodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId);
            var tableName = ChannelManager.GetTableName(SiteInfo, _nodeInfo);

            _relatedIdentities   = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId);
            _styleInfoList       = TableStyleManager.GetTableStyleInfoList(tableName, _relatedIdentities);
            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, _channelId));
            _attributesOfDisplayStyleInfoList = ContentUtility.GetAllTableStyleInfoList(_styleInfoList);
            _pluginLinks = PluginContentManager.GetContentLinks(_nodeInfo);
            _isEdit      = TextUtility.IsEdit(SiteInfo, _channelId, AuthRequest.AdminPermissions);

            var stateType   = AuthRequest.IsQueryExists("state") ? ETriStateUtils.GetEnumType(AuthRequest.GetQueryString("state")) : ETriState.All;
            var searchType  = AuthRequest.IsQueryExists("searchType") ? AuthRequest.GetQueryString("searchType") : ContentAttribute.Title;
            var dateFrom    = AuthRequest.IsQueryExists("dateFrom") ? AuthRequest.GetQueryString("dateFrom") : string.Empty;
            var dateTo      = AuthRequest.IsQueryExists("dateTo") ? AuthRequest.GetQueryString("dateTo") : string.Empty;
            var isDuplicate = AuthRequest.IsQueryExists("isDuplicate") && AuthRequest.GetQueryBool("isDuplicate");
            var keyword     = AuthRequest.IsQueryExists("keyword") ? AuthRequest.GetQueryString("keyword") : string.Empty;

            SpContents.ControlToPaginate = RptContents;
            SpContents.SelectCommand     = DataProvider.ContentDao.GetSqlString(tableName, SiteId, _channelId, AuthRequest.AdminPermissions.IsSystemAdministrator, AuthRequest.AdminPermissions.OwningChannelIdList, searchType, keyword, dateFrom, dateTo, true, stateType, !isDuplicate, false, _isWritingOnly, administratorName);
            SpContents.ItemsPerPage      = SiteInfo.Additional.PageSize;
            SpContents.SortField         = ContentAttribute.Id;
            SpContents.SortMode          = SortMode.DESC;
            SpContents.OrderByString     = ETaxisTypeUtils.GetContentOrderByString(ETaxisType.OrderByIdDesc);
            RptContents.ItemDataBound   += RptContents_ItemDataBound;

            if (!IsPostBack)
            {
                ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, true, true, AuthRequest.AdminPermissions);

                DdlSearchType.Items.Add(new ListItem("标题", ContentAttribute.Title));
                if (_styleInfoList != null)
                {
                    foreach (var styleInfo in _styleInfoList)
                    {
                        if (styleInfo.AttributeName != ContentAttribute.AddDate)
                        {
                            var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                            DdlSearchType.Items.Add(listitem);
                        }
                    }
                }
                DdlSearchType.Items.Add(new ListItem("内容ID", ContentAttribute.Id));
                DdlSearchType.Items.Add(new ListItem("添加者", ContentAttribute.AddUserName));
                DdlSearchType.Items.Add(new ListItem("最后修改者", ContentAttribute.LastEditUserName));

                ETriStateUtils.AddListItems(DdlState, "全部", "已审核", "待审核");

                if (SiteId != _channelId)
                {
                    ControlUtils.SelectSingleItem(DdlChannelId, _channelId.ToString());
                }
                ControlUtils.SelectSingleItem(DdlState, AuthRequest.GetQueryString("State"));
                CbIsDuplicate.Checked = isDuplicate;
                ControlUtils.SelectSingleItem(DdlSearchType, searchType);
                TbKeyword.Text  = keyword;
                TbDateFrom.Text = dateFrom;
                TbDateTo.Text   = dateTo;

                SpContents.DataBind();

                var showPopWinString = ModalAddToGroup.GetOpenWindowStringToContentForMultiChannels(SiteId);
                BtnAddToGroup.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalSelectColumns.GetOpenWindowString(SiteId, _channelId, true);
                BtnSelect.Attributes.Add("onclick", showPopWinString);

                if (HasChannelPermissions(SiteId, ConfigManager.ChannelPermissions.ContentCheck))
                {
                    showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(SiteId, PageUrl);
                    BtnCheck.Attributes.Add("onclick", showPopWinString);
                }
                else
                {
                    PhCheck.Visible = false;
                }

                LtlColumnsHead.Text = TextUtility.GetColumnsHeadHtml(_styleInfoList, _attributesOfDisplay, SiteInfo);
            }

            if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentAdd))
            {
                BtnAddContent.Visible = false;
            }
            if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentTranslate))
            {
                BtnTranslate.Visible = false;
            }
            else
            {
                BtnTranslate.Attributes.Add("onclick", PageContentTranslate.GetRedirectClickStringForMultiChannels(SiteId, PageUrl));
            }

            if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ContentDelete))
            {
                BtnDelete.Visible = false;
            }
            else
            {
                BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, false, PageUrl));
            }
        }