예제 #1
0
        private void ButtonPreLoad()
        {
            var showPopWinString = string.Empty;

            PlaceHolder_AddChannel.Visible = HasChannelPermissionsIgnoreNodeId(AppManager.Cms.Permission.Channel.ChannelAdd);
            if (PlaceHolder_AddChannel.Visible)
            {
                AddChannel1.Attributes.Add("onclick", ModalChannelAdd.GetOpenWindowString(PublishmentSystemId, PublishmentSystemId, GetRedirectUrl(PublishmentSystemId, PublishmentSystemId)));
                AddChannel2.Attributes.Add("onclick",
                                           $"location.href='{PageChannelAdd.GetRedirectUrl(PublishmentSystemId, PublishmentSystemId, GetRedirectUrl(PublishmentSystemId, 0))}';return false;");
            }

            PlaceHolder_ChannelEdit.Visible = HasChannelPermissionsIgnoreNodeId(AppManager.Cms.Permission.Channel.ChannelEdit);
            if (PlaceHolder_ChannelEdit.Visible)
            {
                showPopWinString = ModalAddToGroup.GetOpenWindowStringToChannel(PublishmentSystemId);
                AddToGroup.Attributes.Add("onclick", showPopWinString);

                SelectEditColumns.Attributes.Add("onclick", ModalSelectColumns.GetOpenWindowStringToChannel(PublishmentSystemId, false));
            }

            PlaceHolder_Translate.Visible = HasChannelPermissionsIgnoreNodeId(AppManager.Cms.Permission.Channel.ChannelTranslate);
            if (PlaceHolder_Translate.Visible)
            {
                Translate.Attributes.Add("onclick",
                                         PageUtils.GetRedirectStringWithCheckBoxValue(
                                             PageChannelTranslate.GetRedirectUrl(PublishmentSystemId,
                                                                                 GetRedirectUrl(PublishmentSystemId, _currentNodeId)), "ChannelIDCollection",
                                             "ChannelIDCollection", "请选择需要转移的栏目!"));
            }

            PlaceHolder_Delete.Visible = HasChannelPermissionsIgnoreNodeId(AppManager.Cms.Permission.Channel.ChannelDelete);
            if (PlaceHolder_Delete.Visible)
            {
                Delete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValue(PageChannelDelete.GetRedirectUrl(PublishmentSystemId, GetRedirectUrl(PublishmentSystemId, PublishmentSystemId)), "ChannelIDCollection", "ChannelIDCollection", "请选择需要删除的栏目!"));
            }

            PlaceHolder_Create.Visible = AdminUtility.HasWebsitePermissions(Body.AdministratorName, PublishmentSystemId, AppManager.Cms.Permission.WebSite.Create) ||
                                         HasChannelPermissionsIgnoreNodeId(AppManager.Cms.Permission.Channel.CreatePage);
            if (PlaceHolder_Create.Visible)
            {
                Create.Attributes.Add("onclick", ModalCreateChannels.GetOpenWindowString(PublishmentSystemId));
            }

            PlaceHolder_Import.Visible = PlaceHolder_AddChannel.Visible;
            if (PlaceHolder_Import.Visible)
            {
                Import.Attributes.Add("onclick", ModalChannelImport.GetOpenWindowString(PublishmentSystemId, PublishmentSystemId));
            }
            Export.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToChannel(PublishmentSystemId, "ChannelIDCollection", "请选择需要导出的栏目!"));
        }
예제 #2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID", "InputName");
            var theInputName = Body.GetQueryString("InputName");

            _inputInfo = DataProvider.InputDao.GetInputInfo(theInputName, PublishmentSystemId);
            if (_inputInfo == null)
            {
                return;
            }

            if (Body.IsQueryExists("Delete") && Body.IsQueryExists("ContentIDCollection"))
            {
                var arraylist = TranslateUtils.StringCollectionToIntList(Body.GetQueryString("ContentIDCollection"));
                try
                {
                    DataProvider.InputContentDao.Delete(arraylist);
                    Body.AddSiteLog(PublishmentSystemId, "删除提交表单内容", $"提交表单:{_inputInfo.InputName}");
                    SuccessMessage("删除成功!");
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "删除失败!");
                }
            }

            _relatedIdentities = RelatedIdentities.GetRelatedIdentities(ETableStyle.InputContent, PublishmentSystemId, _inputInfo.InputId);

            _styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.InputContent, DataProvider.InputContentDao.TableName, _relatedIdentities);

            var isAnythingVisible = false;

            foreach (var styleInfo in _styleInfoList)
            {
                if (styleInfo.IsVisibleInList)
                {
                    isAnythingVisible = true;
                    break;
                }
            }
            if (!isAnythingVisible && _styleInfoList != null && _styleInfoList.Count > 0)
            {
                _styleInfoList[0].IsVisibleInList = true;
            }

            spContents.ControlToPaginate = rptContents;
            spContents.ItemsPerPage      = PublishmentSystemInfo.Additional.PageSize;
            spContents.SelectCommand     = DataProvider.InputContentDao.GetSelectStringOfContentId(_inputInfo.InputId, string.Empty);
            spContents.SortField         = DataProvider.InputContentDao.GetSortFieldName();
            spContents.SortMode          = SortMode.DESC;
            rptContents.ItemDataBound   += rptContents_ItemDataBound;

            if (!IsPostBack)
            {
                spContents.DataBind();

                BreadCrumbWithItemTitle(AppManager.Cms.LeftMenu.IdFunction, AppManager.Cms.LeftMenu.Function.IdInput, "提交表单内容管理",
                                        $"{_inputInfo.InputName}({spContents.TotalCount})", AppManager.Cms.Permission.WebSite.Input);

                var showPopWinString = string.Empty;

                showPopWinString = ModalInputContentAdd.GetOpenWindowStringToAdd(PublishmentSystemId, _inputInfo.InputId, PageUrl);
                AddButton.Attributes.Add("onclick", showPopWinString);


                //this.Delete.Attributes.Add("onclick", "return confirm(\"此操作将删除所选内容,确定吗?\");");
                Delete.Attributes.Add("onclick",
                                      PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(
                                          PageUtils.GetCmsUrl(nameof(PageInputContent), new NameValueCollection
                {
                    { "PublishmentSystemID", PublishmentSystemId.ToString() },
                    { "InputName", _inputInfo.InputName },
                    { "Delete", true.ToString() }
                }), "ContentIDCollection", "ContentIDCollection", "请选择需要删除的表单内容!", "此操作将删除所选内容,确定删除吗?"));

                Check.Attributes.Add("onclick", "return confirm(\"此操作将把所选内容设为审核通过,确定吗?\");");


                showPopWinString = ModalInputContentTaxis.GetOpenWindowString(PublishmentSystemId, _inputInfo.InputId, PageUrl);
                TaxisButton.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalSelectColumns.GetOpenWindowStringToInputContent(PublishmentSystemId, _inputInfo.InputId, true);
                SelectListButton.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalSelectColumns.GetOpenWindowStringToInputContent(PublishmentSystemId, _inputInfo.InputId, false);
                SelectFormButton.Attributes.Add("onclick", showPopWinString);

                ImportExcel.Attributes.Add("onclick", ModalInputContentImport.GetOpenWindowString(PublishmentSystemId, _inputInfo.InputId));

                ExportExcel.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToInputContent(PublishmentSystemId, _inputInfo.InputId));

                var urlReturn = PageInput.GetRedirectUrl(PublishmentSystemId);
                btnReturn.Attributes.Add("onclick", $"location.href='{urlReturn}';return false;");


                if (_styleInfoList != null)
                {
                    foreach (var styleInfo in _styleInfoList)
                    {
                        if (styleInfo.IsVisibleInList)
                        {
                            ltlColumnHeadRows.Text += $@"<td class=""center"">{styleInfo.DisplayName}</td>";
                        }
                    }
                }

                if (_inputInfo.IsReply)
                {
                    ltlHeadRowReply.Text = @"
<td class=""center"" style=""width:60px;"">是否回复</td>
<td class=""center"" style=""width:60px;"">&nbsp;</td>
";
                }
            }
        }
예제 #3
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId");

            if (Body.IsQueryExists("channelId") && (Body.IsQueryExists("Subtract") || Body.IsQueryExists("Add")))
            {
                var channelId = Body.GetQueryInt("channelId");
                if (SiteId != channelId)
                {
                    var isSubtract = Body.IsQueryExists("Subtract");
                    DataProvider.ChannelDao.UpdateTaxis(SiteId, channelId, isSubtract);

                    Body.AddSiteLog(SiteId, channelId, 0, "栏目排序" + (isSubtract ? "上升" : "下降"),
                                    $"栏目:{ChannelManager.GetChannelName(SiteId, channelId)}");

                    PageUtils.Redirect(GetRedirectUrl(SiteId, channelId));
                    return;
                }
            }

            if (IsPostBack)
            {
                return;
            }

            ClientScriptRegisterClientScriptBlock("NodeTreeScript", ChannelLoading.GetScript(SiteInfo, ELoadingType.Channel, null));

            if (Body.IsQueryExists("CurrentChannelId"))
            {
                _currentChannelId = Body.GetQueryInt("CurrentChannelId");
                var onLoadScript = ChannelLoading.GetScriptOnLoad(SiteId, _currentChannelId);
                if (!string.IsNullOrEmpty(onLoadScript))
                {
                    ClientScriptRegisterClientScriptBlock("NodeTreeScriptOnLoad", onLoadScript);
                }
            }

            PhAddChannel.Visible = HasChannelPermissionsIgnoreChannelId(ConfigManager.Permissions.Channel.ChannelAdd);
            if (PhAddChannel.Visible)
            {
                BtnAddChannel1.Attributes.Add("onclick", ModalChannelsAdd.GetOpenWindowString(SiteId, SiteId, GetRedirectUrl(SiteId, SiteId)));
                BtnAddChannel2.Attributes.Add("onclick",
                                              $"location.href='{PageChannelAdd.GetRedirectUrl(SiteId, SiteId, GetRedirectUrl(SiteId, 0))}';return false;");
            }

            PhChannelEdit.Visible = HasChannelPermissionsIgnoreChannelId(ConfigManager.Permissions.Channel.ChannelEdit);
            if (PhChannelEdit.Visible)
            {
                var showPopWinString = ModalAddToGroup.GetOpenWindowStringToChannel(SiteId);
                BtnAddToGroup.Attributes.Add("onclick", showPopWinString);

                BtnSelectEditColumns.Attributes.Add("onclick", ModalSelectColumns.GetOpenWindowStringToChannel(SiteId, false));
            }

            PhTranslate.Visible = HasChannelPermissionsIgnoreChannelId(ConfigManager.Permissions.Channel.ChannelTranslate);
            if (PhTranslate.Visible)
            {
                BtnTranslate.Attributes.Add("onclick",
                                            PageUtils.GetRedirectStringWithCheckBoxValue(
                                                PageChannelTranslate.GetRedirectUrl(SiteId,
                                                                                    GetRedirectUrl(SiteId, _currentChannelId)), "ChannelIDCollection",
                                                "ChannelIDCollection", "请选择需要转移的栏目!"));
            }

            PhDelete.Visible = HasChannelPermissionsIgnoreChannelId(ConfigManager.Permissions.Channel.ChannelDelete);
            if (PhDelete.Visible)
            {
                BtnDelete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValue(PageChannelDelete.GetRedirectUrl(SiteId, GetRedirectUrl(SiteId, SiteId)), "ChannelIDCollection", "ChannelIDCollection", "请选择需要删除的栏目!"));
            }

            PhCreate.Visible = HasSitePermissions(ConfigManager.Permissions.WebSite.Create) || HasChannelPermissionsIgnoreChannelId(ConfigManager.Permissions.Channel.CreatePage);
            if (PhCreate.Visible)
            {
                BtnCreate.Attributes.Add("onclick", ModalCreateChannels.GetOpenWindowString(SiteId));
            }

            PhImport.Visible = PhAddChannel.Visible;
            if (PhImport.Visible)
            {
                BtnImport.Attributes.Add("onclick", ModalChannelImport.GetOpenWindowString(SiteId, SiteId));
            }
            BtnExport.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToChannel(SiteId, "ChannelIDCollection", "请选择需要导出的栏目!"));

            RptContents.DataSource     = DataProvider.ChannelDao.GetIdListByParentId(SiteId, 0);
            RptContents.ItemDataBound += RptContents_ItemDataBound;
            RptContents.DataBind();
        }
예제 #4
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            var permissions = PermissionsManager.GetPermissions(Body.AdminName);

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

            _isWritingOnly = Body.GetQueryBool("isWritingOnly");

            var administratorName = string.Empty;

            _isSelfOnly = Body.GetQueryBool("isSelfOnly");
            if (!_isSelfOnly)
            {
                administratorName = AdminUtility.IsViewContentOnlySelf(Body.AdminName, SiteId, _channelId) ? Body.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.GetColumnTableStyleInfoList(SiteInfo, _styleInfoList);
            _pluginLinks = PluginContentManager.GetContentLinks(_nodeInfo);
            _isEdit      = TextUtility.IsEdit(SiteInfo, _channelId, Body.AdminName);

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

            SpContents.ControlToPaginate = RptContents;
            SpContents.SelectCommand     = DataProvider.ContentDao.GetSqlString(tableName, SiteId, _channelId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.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, Body.AdminName);

                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, Body.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 (AdminUtility.HasChannelPermissions(Body.AdminName, SiteId, SiteId, ConfigManager.Permissions.Channel.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.Permissions.Channel.ContentAdd))
            {
                BtnAddContent.Visible = false;
            }
            if (!HasChannelPermissions(_channelId, ConfigManager.Permissions.Channel.ContentTranslate))
            {
                BtnTranslate.Visible = false;
            }
            else
            {
                BtnTranslate.Attributes.Add("onclick", PageContentTranslate.GetRedirectClickStringForMultiChannels(SiteId, PageUrl));
            }

            if (!HasChannelPermissions(_channelId, ConfigManager.Permissions.Channel.ContentDelete))
            {
                BtnDelete.Visible = false;
            }
            else
            {
                BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, false, PageUrl));
            }
        }
예제 #5
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));
                }
            }
        }
        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));
            }
        }
예제 #7
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            var permissions = PermissionsManager.GetPermissions(Body.AdministratorName);

            PageUtils.CheckRequestParameter("PublishmentSystemID");
            if (Body.IsQueryExists("NodeID"))
            {
                _nodeId = Body.GetQueryInt("NodeID");
            }
            else
            {
                _nodeId = PublishmentSystemId;
            }

            _isWritingOnly = Body.GetQueryBool("isWritingOnly");

            var administratorName = string.Empty;

            _isSelfOnly = Body.GetQueryBool("isSelfOnly");
            if (!_isSelfOnly)
            {
                administratorName = AdminUtility.IsViewContentOnlySelf(Body.AdministratorName, PublishmentSystemId, _nodeId) ? Body.AdministratorName : string.Empty;
            }

            _nodeInfo   = NodeManager.GetNodeInfo(PublishmentSystemId, _nodeId);
            _tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, _nodeInfo);
            var tableName = NodeManager.GetTableName(PublishmentSystemInfo, _nodeInfo);

            _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(NodeManager.GetContentAttributesOfDisplay(PublishmentSystemId, _nodeId));
            _relatedIdentities   = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, _nodeId);
            _tableStyleInfoList  = TableStyleManager.GetTableStyleInfoList(_tableStyle, tableName, _relatedIdentities);

            spContents.ControlToPaginate = rptContents;
            if (string.IsNullOrEmpty(Body.GetQueryString("NodeID")))
            {
                var stateType = ETriStateUtils.GetEnumType(State.SelectedValue);
                spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, SearchType.SelectedValue, Keyword.Text, DateUtils.GetDateString(DateTime.Now.AddMonths(-1)), DateUtils.GetDateString(DateTime.Now), true, stateType, !IsDuplicate.Checked, false, _isWritingOnly, administratorName);
            }
            else
            {
                var stateType = ETriStateUtils.GetEnumType(Body.GetQueryString("State"));
                spContents.SelectCommand = DataProvider.ContentDao.GetSelectCommend(_tableStyle, tableName, PublishmentSystemId, _nodeId, permissions.IsSystemAdministrator, ProductPermissionsManager.Current.OwningNodeIdList, Body.GetQueryString("SearchType"), Body.GetQueryString("Keyword"), Body.GetQueryString("DateFrom"), Body.GetQueryString("DateTo"), true, stateType, !Body.GetQueryBool("IsDuplicate"), false, _isWritingOnly, administratorName);
            }
            spContents.ItemsPerPage    = PublishmentSystemInfo.Additional.PageSize;
            spContents.SortField       = ContentAttribute.Id;
            spContents.SortMode        = SortMode.DESC;
            spContents.OrderByString   = ETaxisTypeUtils.GetOrderByString(_tableStyle, ETaxisType.OrderByIdDesc);
            rptContents.ItemDataBound += rptContents_ItemDataBound;

            if (!IsPostBack)
            {
                var pageTitle = _isSelfOnly ? "我的内容" : "内容搜索";
                if (_isWritingOnly)
                {
                    pageTitle = "投稿内容";
                }
                BreadCrumb(AppManager.Cms.LeftMenu.IdContent, pageTitle, string.Empty);

                NodeManager.AddListItems(NodeIDDropDownList.Items, PublishmentSystemInfo, true, true, Body.AdministratorName);

                if (_tableStyleInfoList != null)
                {
                    foreach (var styleInfo in _tableStyleInfoList)
                    {
                        if (styleInfo.IsVisible && styleInfo.AttributeName != ContentAttribute.AddDate)
                        {
                            var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName);
                            SearchType.Items.Add(listitem);
                        }
                    }
                }

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

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

                if (Body.IsQueryExists("NodeID"))
                {
                    if (PublishmentSystemId != _nodeId)
                    {
                        ControlUtils.SelectListItems(NodeIDDropDownList, _nodeId.ToString());
                    }
                    ControlUtils.SelectListItems(State, Body.GetQueryString("State"));
                    IsDuplicate.Checked = Body.GetQueryBool("IsDuplicate");
                    ControlUtils.SelectListItems(SearchType, Body.GetQueryString("SearchType"));
                    Keyword.Text  = Body.GetQueryString("Keyword");
                    DateFrom.Text = Body.GetQueryString("DateFrom");
                    DateTo.Text   = Body.GetQueryString("DateTo");
                }
                else
                {
                    DateFrom.Text = DateUtils.GetDateString(DateTime.Now.AddMonths(-1));
                    DateTo.Text   = DateUtils.GetDateString(DateTime.Now);
                }

                spContents.DataBind();

                var showPopWinString = ModalAddToGroup.GetOpenWindowStringToContentForMultiChannels(PublishmentSystemId);
                AddToGroup.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalSelectColumns.GetOpenWindowStringToContent(PublishmentSystemId, _nodeId, true);
                SelectButton.Attributes.Add("onclick", showPopWinString);

                if (AdminUtility.HasChannelPermissions(Body.AdministratorName, PublishmentSystemId, PublishmentSystemId, AppManager.Cms.Permission.Channel.ContentCheck))
                {
                    showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(PublishmentSystemId, PageUrl);
                    Check.Attributes.Add("onclick", showPopWinString);
                }
                else
                {
                    CheckPlaceHolder.Visible = false;
                }

                ltlColumnHeadRows.Text  = ContentUtility.GetColumnHeadRowsHtml(_tableStyleInfoList, _attributesOfDisplay, _tableStyle, PublishmentSystemInfo);
                ltlCommandHeadRows.Text = ContentUtility.GetCommandHeadRowsHtml(Body.AdministratorName, _tableStyle, PublishmentSystemInfo, _nodeInfo);
            }

            if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentAdd))
            {
                AddContent.Visible = false;
            }
            if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentTranslate))
            {
                Translate.Visible = false;
            }
            else
            {
                Translate.Attributes.Add("onclick", PageContentTranslate.GetRedirectClickStringForMultiChannels(PublishmentSystemId, PageUrl));
            }

            if (!HasChannelPermissions(_nodeId, AppManager.Cms.Permission.Channel.ContentDelete))
            {
                Delete.Visible = false;
            }
            else
            {
                Delete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(PublishmentSystemId, false, PageUrl));
            }
        }