public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _departmentId = AuthRequest.GetQueryInt("departmentID"); _areaId = AuthRequest.GetQueryInt("areaID"); _userName = AuthRequest.GetQueryString("userName"); if (Page.IsPostBack) { return; } VerifySystemPermissions(ConfigManager.SettingsPermissions.Admin); LtlPageTitle.Text = string.IsNullOrEmpty(_userName) ? "添加管理员" : "编辑管理员"; DdlDepartmentId.Items.Add(new ListItem("<无所属部门>", "0")); var departmentIdList = DepartmentManager.GetDepartmentIdList(); var count = departmentIdList.Count; _isLastNodeArrayOfDepartment = new bool[count]; foreach (var theDepartmentId in departmentIdList) { var departmentInfo = DepartmentManager.GetDepartmentInfo(theDepartmentId); var listitem = new ListItem(GetDepartment(departmentInfo.DepartmentName, departmentInfo.ParentsCount, departmentInfo.IsLastNode), theDepartmentId.ToString()); if (_departmentId == theDepartmentId) { listitem.Selected = true; } DdlDepartmentId.Items.Add(listitem); } DdlAreaId.Items.Add(new ListItem("<无所在区域>", "0")); var areaIdList = AreaManager.GetAreaIdList(); count = areaIdList.Count; _isLastNodeArrayOfArea = new bool[count]; foreach (var theAreaId in areaIdList) { var areaInfo = AreaManager.GetAreaInfo(theAreaId); var listitem = new ListItem(GetArea(areaInfo.AreaName, areaInfo.ParentsCount, areaInfo.IsLastNode), theAreaId.ToString()); if (_areaId == theAreaId) { listitem.Selected = true; } DdlAreaId.Items.Add(listitem); } if (!string.IsNullOrEmpty(_userName)) { var adminInfo = AdminManager.GetAdminInfoByUserName(_userName); if (adminInfo != null) { ControlUtils.SelectSingleItem(DdlDepartmentId, adminInfo.DepartmentId.ToString()); TbUserName.Text = adminInfo.UserName; TbUserName.Enabled = false; TbDisplayName.Text = adminInfo.DisplayName; PhPassword.Visible = false; ControlUtils.SelectSingleItem(DdlAreaId, adminInfo.AreaId.ToString()); TbEmail.Text = adminInfo.Email; TbMobile.Text = adminInfo.Mobile; } } BtnReturn.Attributes.Add("onclick", $"location.href='{PageAdministrator.GetRedirectUrl()}';return false;"); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } if (AuthRequest.IsQueryExists("DeleteDirectory")) { var siteTemplateDir = AuthRequest.GetQueryString("SiteTemplateDir"); try { SiteTemplateManager.Instance.DeleteSiteTemplate(siteTemplateDir); AuthRequest.AddAdminLog("删除站点模板", $"站点模板:{siteTemplateDir}"); SuccessDeleteMessage(); } catch (Exception ex) { FailDeleteMessage(ex); } } else if (AuthRequest.IsQueryExists("DeleteZipFile")) { var fileName = AuthRequest.GetQueryString("FileName"); try { SiteTemplateManager.Instance.DeleteZipSiteTemplate(fileName); AuthRequest.AddAdminLog("删除未解压站点模板", $"站点模板:{fileName}"); SuccessDeleteMessage(); } catch (Exception ex) { FailDeleteMessage(ex); } } if (Page.IsPostBack) { return; } VerifySystemPermissions(ConfigManager.AppPermissions.SettingsSiteTemplates); _sortedlist = SiteTemplateManager.Instance.GetSiteTemplateSortedList(); var directoryList = new List <DirectoryInfo>(); foreach (string directoryName in _sortedlist.Keys) { var directoryPath = PathUtility.GetSiteTemplatesPath(directoryName); var dirInfo = new DirectoryInfo(directoryPath); directoryList.Add(dirInfo); } RptDirectories.DataSource = directoryList; RptDirectories.ItemDataBound += RptDirectories_ItemDataBound; RptDirectories.DataBind(); var fileNames = SiteTemplateManager.Instance.GetZipSiteTemplateList(); var fileList = new List <FileInfo>(); foreach (var fileName in fileNames) { if (!DirectoryUtils.IsDirectoryExists(PathUtility.GetSiteTemplatesPath(PathUtils.GetFileNameWithoutExtension(fileName)))) { var filePath = PathUtility.GetSiteTemplatesPath(fileName); var fileInfo = new FileInfo(filePath); fileList.Add(fileInfo); } } if (fileList.Count > 0) { RptZipFiles.Visible = true; RptZipFiles.DataSource = fileList; RptZipFiles.ItemDataBound += RptZipFiles_ItemDataBound; RptZipFiles.DataBind(); } else { RptZipFiles.Visible = false; } BtnImport.Attributes.Add("onclick", ModalImportZip.GetOpenWindowString(ModalImportZip.TypeSiteTemplate)); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId", "type"); _type = AuthRequest.GetQueryString("type"); var tips = string.Empty; if (_type == TypeInclude) { _name = NameInclude; _ext = ExtInclude; _assetsDir = SiteInfo.Additional.TemplatesAssetsIncludeDir.Trim('/'); tips = $@"包含文件存放在 <code>{_assetsDir}</code> 目录中,模板中使用 <stl:include file=""/{_assetsDir}/包含文件.html""></stl:include> 引用。"; } else if (_type == TypeJs) { _name = NameJs; _ext = ExtJs; _assetsDir = SiteInfo.Additional.TemplatesAssetsJsDir.Trim('/'); tips = $@"脚本文件存放在 <code>{_assetsDir}</code> 目录中,模板中使用 <script type=""text/javascript"" src=""{{stl.siteUrl}}/{_assetsDir}/脚本文件.js""></script> 引用。"; } else if (_type == TypeCss) { _name = NameCss; _ext = ExtCss; _assetsDir = SiteInfo.Additional.TemplatesAssetsCssDir.Trim('/'); tips = $@"样式文件存放在 <code>{_assetsDir}</code> 目录中,模板中使用 <link rel=""stylesheet"" type=""text/css"" href=""{{stl.siteUrl}}/{_assetsDir}/样式文件.css"" /> 引用。"; } if (string.IsNullOrEmpty(_assetsDir)) { return; } _directoryPath = PathUtility.MapPath(SiteInfo, "@/" + _assetsDir); if (AuthRequest.IsQueryExists("delete")) { var fileName = AuthRequest.GetQueryString("fileName"); try { FileUtils.DeleteFileIfExists(PathUtils.Combine(_directoryPath, fileName)); AuthRequest.AddSiteLog(SiteId, $"删除{_name}", $"{_name}:{fileName}"); SuccessDeleteMessage(); } catch (Exception ex) { FailDeleteMessage(ex); } } if (IsPostBack) { return; } VerifySitePermissions(ConfigManager.WebSitePermissions.Template); LtlPageTitle.Text = $"{_name}管理"; InfoMessage(tips); DirectoryUtils.CreateDirectoryIfNotExists(_directoryPath); var fileNames = DirectoryUtils.GetFileNames(_directoryPath); var fileNameList = new List <string>(); foreach (var fileName in fileNames) { if (StringUtils.EqualsIgnoreCase(PathUtils.GetExtension(fileName), _ext)) { fileNameList.Add(fileName); } } RptContents.DataSource = fileNameList; RptContents.ItemDataBound += RptContents_ItemDataBound; RptContents.DataBind(); BtnConfig.Attributes.Add("onclick", ModalTemplateAssetsConfig.GetOpenWindowString(SiteId, _type)); BtnAdd.Attributes.Add("onclick", $"location.href='{PageTemplateAssetsAdd.GetRedirectUrlToAdd(SiteId, _type)}';return false"); }
public override void Submit_OnClick(object sender, EventArgs e) { var displayAttributes = ControlUtils.GetSelectedListControlValueCollection(CblDisplayAttributes); if (PhDisplayAttributes.Visible && string.IsNullOrEmpty(displayAttributes)) { FailMessage("必须至少选择一项!"); return; } ConfigSettings(false); var isPeriods = false; var startDate = string.Empty; var endDate = string.Empty; if (DdlPeriods.SelectedValue != "0") { isPeriods = true; if (DdlPeriods.SelectedValue == "-1") { startDate = TbStartDate.Text; endDate = TbEndDate.Text; } else { var days = int.Parse(DdlPeriods.SelectedValue); startDate = DateUtils.GetDateString(DateTime.Now.AddDays(-days)); endDate = DateUtils.GetDateString(DateTime.Now); } } var checkedState = ETriStateUtils.GetEnumType(DdlPeriods.SelectedValue); var redirectUrl = ModalExportMessage.GetRedirectUrlStringToExportContent(SiteId, _channelId, DdlExportType.SelectedValue, AuthRequest.GetQueryString("contentIdCollection"), displayAttributes, isPeriods, startDate, endDate, checkedState); PageUtils.Redirect(redirectUrl); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId", "channelId", "ReturnUrl"); _channelId = AuthRequest.GetQueryInt("channelId"); _returnUrl = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("ReturnUrl")); CacAttributes.SiteInfo = SiteInfo; CacAttributes.ChannelId = _channelId; if (!IsPostBack) { if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ChannelEdit)) { PageUtils.RedirectToErrorPage("您没有修改栏目的权限!"); return; } var nodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); if (nodeInfo == null) { return; } if (nodeInfo.ParentId == 0) { PhLinkUrl.Visible = false; PhLinkType.Visible = false; PhChannelTemplateId.Visible = false; PhFilePath.Visible = false; } BtnSubmit.Attributes.Add("onclick", "if (UE && UE.getEditor('Content', {{allowDivTransToP: false}})){ UE.getEditor('Content', {{allowDivTransToP: false}}).sync(); }"); CacAttributes.Attributes = nodeInfo.Additional; if (PhLinkType.Visible) { ELinkTypeUtils.AddListItems(DdlLinkType); } ETaxisTypeUtils.AddListItemsForChannelEdit(DdlTaxisType); CblNodeGroupNameCollection.DataSource = DataProvider.ChannelGroupDao.GetDataSource(SiteId); if (PhChannelTemplateId.Visible) { DdlChannelTemplateId.DataSource = DataProvider.TemplateDao.GetDataSourceByType(SiteId, TemplateType.ChannelTemplate); } DdlContentTemplateId.DataSource = DataProvider.TemplateDao.GetDataSourceByType(SiteId, TemplateType.ContentTemplate); DataBind(); if (PhChannelTemplateId.Visible) { DdlChannelTemplateId.Items.Insert(0, new ListItem("<未设置>", "0")); ControlUtils.SelectSingleItem(DdlChannelTemplateId, nodeInfo.ChannelTemplateId.ToString()); } DdlContentTemplateId.Items.Insert(0, new ListItem("<未设置>", "0")); ControlUtils.SelectSingleItem(DdlContentTemplateId, nodeInfo.ContentTemplateId.ToString()); TbNodeName.Text = nodeInfo.ChannelName; TbNodeIndexName.Text = nodeInfo.IndexName; if (PhLinkUrl.Visible) { TbLinkUrl.Text = nodeInfo.LinkUrl; } foreach (ListItem item in CblNodeGroupNameCollection.Items) { item.Selected = StringUtils.In(nodeInfo.GroupNameCollection, item.Value); } if (PhFilePath.Visible) { TbFilePath.Text = nodeInfo.FilePath; } if (PhLinkType.Visible) { ControlUtils.SelectSingleItem(DdlLinkType, nodeInfo.LinkType); } ControlUtils.SelectSingleItem(DdlTaxisType, nodeInfo.Additional.DefaultTaxisType); TbImageUrl.Text = nodeInfo.ImageUrl; LtlImageUrlButtonGroup.Text = WebUtils.GetImageUrlButtonGroupHtml(SiteInfo, TbImageUrl.ClientID); TbContent.SetParameters(SiteInfo, ChannelAttribute.Content, nodeInfo.Content); if (TbKeywords.Visible) { TbKeywords.Text = nodeInfo.Keywords; } if (TbDescription.Visible) { TbDescription.Text = nodeInfo.Description; } } else { CacAttributes.Attributes = new ExtendedAttributes(Request.Form); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId"); _elementName = AuthRequest.GetQueryString("elementName"); if (IsPostBack) { return; } VerifySitePermissions(ConfigManager.WebSitePermissions.Template); var elements = StlAll.Elements; var allBuilder = new StringBuilder(); foreach (var elementName in elements.Keys) { if (!elements.TryGetValue(elementName, out var elementType)) { continue; } var tagName = elementName.Substring(4); var stlAttribute = (StlElementAttribute)Attribute.GetCustomAttribute(elementType, typeof(StlElementAttribute)); allBuilder.Append($@" <tr class=""{(elementName == _elementName ? "bg-secondary text-white" : string.Empty)}""> <td> <a href=""{GetRedirectUrl(SiteId, elementName)}"" class=""{(elementName == _elementName ? "text-white" : string.Empty)}""> {elementName} </a> </td> <td>{stlAttribute.Title}</td> <td><a href=""https://www.siteserver.cn/docs/stl/{tagName}/"" target=""_blank"" class=""{(elementName == _elementName ? "text-white" : string.Empty)}"">https://www.siteserver.cn/docs/stl/{tagName}/</a></td> </tr>"); } LtlAll.Text = $@" <div class=""panel panel-default m-t-10""> <div class=""panel-body p-0""> <div class=""table-responsive""> <table class=""table tablesaw table-striped m-0""> <thead> <tr> <th>标签</th> <th>说明</th> <th>参考</th> </tr> </thead> <tbody> {allBuilder} </tbody> </table> </div> </div> </div> "; if (!string.IsNullOrEmpty(_elementName)) { if (elements.TryGetValue(_elementName, out var elementType)) { var tagName = _elementName.Substring(4); PhRefenreces.Visible = true; var attrBuilder = new StringBuilder(); var fields = elementType.GetFields(BindingFlags.Static | BindingFlags.NonPublic); foreach (var field in fields) { var fieldName = field.Name.ToCamelCase(); var attr = (StlAttributeAttribute)Attribute.GetCustomAttribute(field, typeof(StlAttributeAttribute)); if (attr != null) { var attrUrl = $"https://www.siteserver.cn/docs/stl/{tagName}/#{fieldName.ToLower()}-{attr.Title.ToLower()}"; attrBuilder.Append($@" <tr> <td>{fieldName}</td> <td>{attr.Title}</td> <td><a href=""{attrUrl}"" target=""_blank"">{attrUrl}</a></td> </tr>"); } } var helpUrl = $"https://www.siteserver.cn/docs/stl/{tagName}/"; var stlAttribute = (StlElementAttribute)Attribute.GetCustomAttribute(elementType, typeof(StlElementAttribute)); LtlReferences.Text = $@" <div class=""tab-pane"" style=""display: block;""> <h4 class=""m-t-0 header-title""> <{_elementName}> {stlAttribute.Title} </h4> <p> {stlAttribute.Description} <a href=""{helpUrl}"" target=""_blank"">详细使用说明</a> </p> <div class=""panel panel-default m-t-10""> <div class=""panel-body p-0""> <div class=""table-responsive""> <table class=""table tablesaw table-striped m-0""> <thead> <tr> <th>属性</th> <th>说明</th> <th>参考</th> </tr> </thead> <tbody> {attrBuilder} </tbody> </table> </div> </div> </div> </div> "; } } }
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 = "成功导出文件! " + ControlUtils.GetControlRenderHtml(link); SuccessMessage(successMessage); } else { FailMessage("导出失败,所选条件没有匹配内容,请重新选择条件导出内容"); } } catch (Exception ex) { var failedMessage = "文件导出失败!<br/><br/>原因为:" + ex.Message; FailMessage(ex, failedMessage); } } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } var pageNum = AuthRequest.GetQueryInt("pageNum") == 0 ? 30 : AuthRequest.GetQueryInt("pageNum"); var keyword = AuthRequest.GetQueryString("keyword"); var roleName = AuthRequest.GetQueryString("roleName"); var lastActivityDate = AuthRequest.GetQueryInt("lastActivityDate"); var isConsoleAdministrator = AuthRequest.AdminPermissions.IsConsoleAdministrator; var adminName = AuthRequest.AdminName; var order = AuthRequest.IsQueryExists("order") ? AuthRequest.GetQueryString("order") : nameof(AdministratorInfo.UserName); var departmentId = AuthRequest.GetQueryInt("departmentId"); var areaId = AuthRequest.GetQueryInt("areaId"); if (AuthRequest.IsQueryExists("Delete")) { var userNameCollection = AuthRequest.GetQueryString("UserNameCollection"); try { var userNameArrayList = TranslateUtils.StringCollectionToStringList(userNameCollection); foreach (var userName in userNameArrayList) { DataProvider.AdministratorDao.Delete(userName); } AuthRequest.AddAdminLog("删除管理员", $"管理员:{userNameCollection}"); SuccessDeleteMessage(); } catch (Exception ex) { FailDeleteMessage(ex); } } else if (AuthRequest.IsQueryExists("Lock")) { var userNameCollection = AuthRequest.GetQueryString("UserNameCollection"); try { var userNameList = TranslateUtils.StringCollectionToStringList(userNameCollection); DataProvider.AdministratorDao.Lock(userNameList); AuthRequest.AddAdminLog("锁定管理员", $"管理员:{userNameCollection}"); SuccessMessage("成功锁定所选管理员!"); } catch (Exception ex) { FailMessage(ex, "锁定所选管理员失败!"); } } else if (AuthRequest.IsQueryExists("UnLock")) { var userNameCollection = AuthRequest.GetQueryString("UserNameCollection"); try { var userNameList = TranslateUtils.StringCollectionToStringList(userNameCollection); DataProvider.AdministratorDao.UnLock(userNameList); AuthRequest.AddAdminLog("解除锁定管理员", $"管理员:{userNameCollection}"); SuccessMessage("成功解除锁定所选管理员!"); } catch (Exception ex) { FailMessage(ex, "解除锁定所选管理员失败!"); } } PgContents.Param = new PagerParam { ControlToPaginate = RptContents, TableName = DataProvider.AdministratorDao.TableName, PageSize = pageNum, Page = AuthRequest.GetQueryInt(Pager.QueryNamePage, 1), OrderSqlString = DataProvider.AdministratorDao.GetOrderSqlString(order), ReturnColumnNames = SqlUtils.Asterisk, WhereSqlString = DataProvider.AdministratorDao.GetWhereSqlString(isConsoleAdministrator, adminName, keyword, roleName, lastActivityDate, departmentId, areaId) }; PgContents.Param.TotalCount = DataProvider.DatabaseDao.GetPageTotalCount(DataProvider.AdministratorDao.TableName, PgContents.Param.WhereSqlString); RptContents.ItemDataBound += RptContents_ItemDataBound; _lockType = EUserLockTypeUtils.GetEnumType(ConfigManager.SystemConfigInfo.AdminLockLoginType); if (IsPostBack) { return; } VerifyAdministratorPermissions(ConfigManager.SettingsPermissions.Admin); var theListItem = new ListItem("全部", string.Empty) { Selected = true }; DdlRoleName.Items.Add(theListItem); var allRoles = AuthRequest.AdminPermissions.IsConsoleAdministrator ? DataProvider.RoleDao.GetRoleNameList() : DataProvider.RoleDao.GetRoleNameListByCreatorUserName(AuthRequest.AdminName); var allPredefinedRoles = EPredefinedRoleUtils.GetAllPredefinedRoleName(); foreach (var theRoleName in allRoles) { if (allPredefinedRoles.Contains(theRoleName)) { var listitem = new ListItem(EPredefinedRoleUtils.GetText(EPredefinedRoleUtils.GetEnumType(theRoleName)), theRoleName); DdlRoleName.Items.Add(listitem); } else { var listitem = new ListItem(theRoleName, theRoleName); DdlRoleName.Items.Add(listitem); } } DdlDepartmentId.Items.Add(new ListItem("<所有部门>", "0")); var departmentIdList = DepartmentManager.GetDepartmentIdList(); foreach (var theDepartmentId in departmentIdList) { var departmentInfo = DepartmentManager.GetDepartmentInfo(theDepartmentId); DdlDepartmentId.Items.Add(new ListItem(GetTreeItem(departmentInfo.DepartmentName, departmentInfo.ParentsCount, departmentInfo.IsLastNode, _parentsCountDictOfDepartment), theDepartmentId.ToString())); } ControlUtils.SelectSingleItem(DdlDepartmentId, departmentId.ToString()); DdlAreaId.Items.Add(new ListItem("<全部区域>", "0")); var areaIdList = AreaManager.GetAreaIdList(); foreach (var theAreaId in areaIdList) { var areaInfo = AreaManager.GetAreaInfo(theAreaId); DdlAreaId.Items.Add(new ListItem(GetTreeItem(areaInfo.AreaName, areaInfo.ParentsCount, areaInfo.IsLastNode, _parentsCountDictOfArea), theAreaId.ToString())); } ControlUtils.SelectSingleItem(DdlAreaId, areaId.ToString()); ControlUtils.SelectSingleItem(DdlRoleName, roleName); ControlUtils.SelectSingleItem(DdlPageNum, pageNum.ToString()); TbKeyword.Text = keyword; ControlUtils.SelectSingleItem(DdlDepartmentId, departmentId.ToString()); ControlUtils.SelectSingleItem(DdlAreaId, areaId.ToString()); ControlUtils.SelectSingleItem(DdlLastActivityDate, lastActivityDate.ToString()); ControlUtils.SelectSingleItem(DdlOrder, order); PgContents.DataBind(); BtnAdd.Attributes.Add("onclick", $@"location.href='{PageAdministratorAdd.GetRedirectUrlToAdd(departmentId)}';return false;"); var urlAdministrator = GetRedirectUrl(); BtnLock.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(urlAdministrator + "?Lock=True", "UserNameCollection", "UserNameCollection", "请选择需要锁定的管理员!", "此操作将锁定所选管理员,确认吗?")); BtnUnLock.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(urlAdministrator + "?UnLock=True", "UserNameCollection", "UserNameCollection", "请选择需要解除锁定的管理员!", "此操作将解除锁定所选管理员,确认吗?")); BtnDelete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(urlAdministrator + "?Delete=True", "UserNameCollection", "UserNameCollection", "请选择需要删除的管理员!", "此操作将删除所选管理员,确认吗?")); }
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("此操作将从回收站中彻底删除所选内容,确定吗?"); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } Page.Response.Cache.SetCacheability(HttpCacheability.NoCache); if (AuthRequest.IsQueryExists("CreateChannelsOneByOne") && AuthRequest.IsQueryExists("ChannelIDCollection")) { foreach (var channelId in TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("ChannelIDCollection"))) { CreateManager.CreateChannel(SiteId, channelId); } LayerUtils.CloseAndOpenPageCreateStatus(Page); //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将栏目放入生成队列")); } else if (AuthRequest.IsQueryExists("CreateContentsOneByOne") && AuthRequest.IsQueryExists("channelId") && AuthRequest.IsQueryExists("contentIdCollection")) { foreach (var contentId in TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("contentIdCollection"))) { CreateManager.CreateContent(SiteId, AuthRequest.GetQueryInt("channelId"), contentId); } LayerUtils.CloseAndOpenPageCreateStatus(Page); //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将内容放入生成队列")); } else if (AuthRequest.IsQueryExists("CreateByTemplate") && AuthRequest.IsQueryExists("templateID")) { CreateManager.CreateFile(SiteId, AuthRequest.GetQueryInt("templateID")); LayerUtils.CloseAndOpenPageCreateStatus(Page); //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将文件放入生成队列")); } else if (AuthRequest.IsQueryExists("CreateByIDsCollection") && AuthRequest.IsQueryExists("IDsCollection")) { foreach (var channelIdContentId in TranslateUtils.StringCollectionToStringCollection(AuthRequest.GetQueryString("IDsCollection"))) { var pair = channelIdContentId.Split('_'); CreateManager.CreateContent(SiteId, TranslateUtils.ToInt(pair[0]), TranslateUtils.ToInt(pair[1])); } LayerUtils.CloseAndOpenPageCreateStatus(Page); //PageUtils.Redirect(ModalTipMessage.GetRedirectUrlString(SiteId, "已成功将文件放入生成队列")); } //---------------------------------------------------------------------------------------// else if (AuthRequest.IsQueryExists("SiteTemplateDownload")) { var userKeyPrefix = StringUtils.Guid(); var downloadUrl = TranslateUtils.DecryptStringBySecretKey(AuthRequest.GetQueryString("DownloadUrl")); var directoryName = PathUtils.GetFileNameWithoutExtension(downloadUrl); var parameters = AjaxOtherService.GetSiteTemplateDownloadParameters(downloadUrl, directoryName, userKeyPrefix); LtlScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateDownloadUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } else if (AuthRequest.IsQueryExists("SiteTemplateZip")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxOtherService.GetSiteTemplateZipParameters(AuthRequest.GetQueryString("DirectoryName"), userKeyPrefix); LtlScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateZipUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } else if (AuthRequest.IsQueryExists("SiteTemplateUnZip")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxOtherService.GetSiteTemplateUnZipParameters(AuthRequest.GetQueryString("FileName"), userKeyPrefix); LtlScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetSiteTemplateUnZipUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } //---------------------------------------------------------------------------------------// else if (AuthRequest.IsQueryExists("PluginDownload")) { var userKeyPrefix = StringUtils.Guid(); var parameters = AjaxOtherService.GetPluginDownloadParameters(AuthRequest.GetQueryString("DownloadUrl"), userKeyPrefix); LtlScripts.Text = AjaxManager.RegisterProgressTaskScript(AjaxOtherService.GetPluginDownloadUrl(), parameters, userKeyPrefix, AjaxOtherService.GetCountArrayUrl()); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } SpContents.ControlToPaginate = RptContents; SpContents.ItemsPerPage = StringUtils.Constants.PageSize; SpContents.SelectCommand = !AuthRequest.IsQueryExists("Keyword") ? DataProvider.UserLogDao.GetSelectCommend() : DataProvider.UserLogDao.GetSelectCommend(AuthRequest.GetQueryString("UserName"), AuthRequest.GetQueryString("Keyword"), AuthRequest.GetQueryString("DateFrom"), AuthRequest.GetQueryString("DateTo")); SpContents.SortField = nameof(UserLogInfo.Id); SpContents.SortMode = SortMode.DESC; RptContents.ItemDataBound += RptContents_ItemDataBound; if (IsPostBack) { return; } VerifySystemPermissions(ConfigManager.SettingsPermissions.Log); if (AuthRequest.IsQueryExists("Keyword")) { TbUserName.Text = AuthRequest.GetQueryString("UserName"); TbKeyword.Text = AuthRequest.GetQueryString("Keyword"); TbDateFrom.Text = AuthRequest.GetQueryString("DateFrom"); TbDateTo.Text = AuthRequest.GetQueryString("DateTo"); } if (AuthRequest.IsQueryExists("Delete")) { var list = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("IDCollection")); DataProvider.UserLogDao.Delete(list); SuccessDeleteMessage(); } else if (AuthRequest.IsQueryExists("DeleteAll")) { DataProvider.UserLogDao.DeleteAll(); SuccessDeleteMessage(); } else if (AuthRequest.IsQueryExists("Setting")) { ConfigManager.SystemConfigInfo.IsLogUser = !ConfigManager.SystemConfigInfo.IsLogUser; DataProvider.ConfigDao.Update(ConfigManager.Instance); SuccessMessage($"成功{(ConfigManager.SystemConfigInfo.IsLogUser ? "启用" : "禁用")}日志记录"); } BtnDelete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(PageUtils.GetSettingsUrl(nameof(PageLogUser), new NameValueCollection { { "Delete", "True" } }), "IDCollection", "IDCollection", "请选择需要删除的日志!", "此操作将删除所选日志,确认吗?")); BtnDeleteAll.Attributes.Add("onclick", AlertUtils.ConfirmRedirect("删除所有日志", "此操作将删除所有日志信息,确定吗?", "删除全部", PageUtils.GetSettingsUrl(nameof(PageLogUser), new NameValueCollection { { "DeleteAll", "True" } }))); if (ConfigManager.SystemConfigInfo.IsLogUser) { BtnSetting.Text = "禁用用户日志"; BtnSetting.Attributes.Add("onclick", AlertUtils.ConfirmRedirect("禁用用户日志", "此操作将禁用用户日志记录功能,确定吗?", "禁 用", PageUtils.GetSettingsUrl(nameof(PageLogUser), new NameValueCollection { { "Setting", "True" } }))); } else { LtlState.Text = @"<div class=""alert alert-danger m-t-10"">用户日志当前处于禁用状态,系统将不会记录用户操作日志!</div>"; BtnSetting.Text = "启用用户日志"; BtnSetting.Attributes.Add("onclick", AlertUtils.ConfirmRedirect("启用用户日志", "此操作将启用用户日志记录功能,确定吗?", "启 用", PageUtils.GetSettingsUrl(nameof(PageLogUser), new NameValueCollection { { "Setting", "True" } }))); } SpContents.DataBind(); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId", "ReturnUrl"); _returnUrl = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("ReturnUrl")); _idsDictionary = ContentUtility.GetIDsDictionary(Request.QueryString); if (IsPostBack) { return; } var titles = new StringBuilder(); foreach (var channelId in _idsDictionary.Keys) { var tableName = ChannelManager.GetTableName(SiteInfo, channelId); var contentIdList = _idsDictionary[channelId]; foreach (var contentId in contentIdList) { var title = DataProvider.ContentDao.GetValue(tableName, contentId, ContentAttribute.Title); titles.Append(title + "<br />"); } } if (!string.IsNullOrEmpty(LtlTitles.Text)) { titles.Length -= 6; } LtlTitles.Text = titles.ToString(); var checkedLevel = 5; var isChecked = true; foreach (var channelId in _idsDictionary.Keys) { int checkedLevelByChannelId; var isCheckedByChannelId = CheckManager.GetUserCheckLevel(AuthRequest.AdminPermissionsImpl, SiteInfo, channelId, out checkedLevelByChannelId); if (checkedLevel > checkedLevelByChannelId) { checkedLevel = checkedLevelByChannelId; } if (!isCheckedByChannelId) { isChecked = false; } } CheckManager.LoadContentLevelToCheck(DdlCheckType, SiteInfo, isChecked, checkedLevel); var listItem = new ListItem("<保持原栏目不变>", "0"); DdlTranslateChannelId.Items.Add(listItem); ChannelManager.AddListItemsForAddContent(DdlTranslateChannelId.Items, SiteInfo, true, AuthRequest.AdminPermissionsImpl); }
public void Return_OnClick(object sender, EventArgs e) { PageUtils.Redirect(PageAdminRoleAdd.GetReturnRedirectUrl(AuthRequest.GetQueryString("RoleName"))); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId", "channelId", "ReturnUrl"); _channelId = AuthRequest.GetQueryInt("channelId"); ReturnUrl = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("ReturnUrl")); if (AuthRequest.GetQueryString("CanNotEdit") == null && AuthRequest.GetQueryString("UncheckedChannel") == null) { if (!HasChannelPermissions(_channelId, ConfigManager.ChannelPermissions.ChannelEdit)) { PageUtils.RedirectToErrorPage("您没有修改栏目的权限!"); return; } } if (AuthRequest.IsQueryExists("CanNotEdit")) { BtnSubmit.Visible = false; } var nodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); if (nodeInfo == null) { return; } CacAttributes.SiteInfo = SiteInfo; CacAttributes.ChannelId = _channelId; if (!IsPostBack) { DdlContentModelPluginId.Items.Add(new ListItem("<默认>", string.Empty)); var contentTables = PluginContentManager.GetContentModelPlugins(); foreach (var contentTable in contentTables) { DdlContentModelPluginId.Items.Add(new ListItem(contentTable.Title, contentTable.Id)); } ControlUtils.SelectSingleItem(DdlContentModelPluginId, nodeInfo.ContentModelPluginId); var plugins = PluginContentManager.GetAllContentRelatedPlugins(false); if (plugins.Count > 0) { var relatedPluginIds = TranslateUtils.StringCollectionToStringList(nodeInfo.ContentRelatedPluginIds); foreach (var pluginMetadata in plugins) { CblContentRelatedPluginIds.Items.Add(new ListItem(pluginMetadata.Title, pluginMetadata.Id) { Selected = relatedPluginIds.Contains(pluginMetadata.Id) }); } } else { PhContentRelatedPluginIds.Visible = false; } CacAttributes.Attributes = nodeInfo.Additional; TbImageUrl.Attributes.Add("onchange", GetShowImageScript("preview_NavigationPicPath", SiteInfo.Additional.WebUrl)); var showPopWinString = ModalFilePathRule.GetOpenWindowString(SiteId, _channelId, true, TbChannelFilePathRule.ClientID); BtnCreateChannelRule.Attributes.Add("onclick", showPopWinString); showPopWinString = ModalFilePathRule.GetOpenWindowString(SiteId, _channelId, false, TbContentFilePathRule.ClientID); BtnCreateContentRule.Attributes.Add("onclick", showPopWinString); showPopWinString = ModalSelectImage.GetOpenWindowString(SiteInfo, TbImageUrl.ClientID); BtnSelectImage.Attributes.Add("onclick", showPopWinString); showPopWinString = ModalUploadImage.GetOpenWindowString(SiteId, TbImageUrl.ClientID); BtnUploadImage.Attributes.Add("onclick", showPopWinString); ELinkTypeUtils.AddListItems(DdlLinkType); ETaxisTypeUtils.AddListItemsForChannelEdit(DdlTaxisType); CblNodeGroupNameCollection.DataSource = DataProvider.ChannelGroupDao.GetDataSource(SiteId); DdlChannelTemplateId.DataSource = DataProvider.TemplateDao.GetDataSourceByType(SiteId, TemplateType.ChannelTemplate); DdlContentTemplateId.DataSource = DataProvider.TemplateDao.GetDataSourceByType(SiteId, TemplateType.ContentTemplate); DataBind(); DdlChannelTemplateId.Items.Insert(0, new ListItem("<未设置>", "0")); ControlUtils.SelectSingleItem(DdlChannelTemplateId, nodeInfo.ChannelTemplateId.ToString()); DdlContentTemplateId.Items.Insert(0, new ListItem("<未设置>", "0")); ControlUtils.SelectSingleItem(DdlContentTemplateId, nodeInfo.ContentTemplateId.ToString()); TbNodeName.Text = nodeInfo.ChannelName; TbNodeIndexName.Text = nodeInfo.IndexName; TbLinkUrl.Text = nodeInfo.LinkUrl; foreach (ListItem item in CblNodeGroupNameCollection.Items) { item.Selected = StringUtils.In(nodeInfo.GroupNameCollection, item.Value); } TbFilePath.Text = nodeInfo.FilePath; TbChannelFilePathRule.Text = nodeInfo.ChannelFilePathRule; TbContentFilePathRule.Text = nodeInfo.ContentFilePathRule; ControlUtils.SelectSingleItem(DdlLinkType, nodeInfo.LinkType); ControlUtils.SelectSingleItem(DdlTaxisType, nodeInfo.Additional.DefaultTaxisType); ControlUtils.SelectSingleItem(RblIsChannelAddable, nodeInfo.Additional.IsChannelAddable.ToString()); ControlUtils.SelectSingleItem(RblIsContentAddable, nodeInfo.Additional.IsContentAddable.ToString()); TbImageUrl.Text = nodeInfo.ImageUrl; TbContent.SetParameters(SiteInfo, ChannelAttribute.Content, nodeInfo.Content); TbKeywords.Text = nodeInfo.Keywords; TbDescription.Text = nodeInfo.Description; //this.Content.SiteId = base.SiteId; //this.Content.Text = StringUtility.TextEditorContentDecode(nodeInfo.Content, ConfigUtils.Instance.ApplicationPath, base.SiteInfo.SiteUrl); } else { CacAttributes.Attributes = new ExtendedAttributes(Request.Form); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId", "channelId"); var channelId = AuthRequest.GetQueryInt("channelId"); _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, channelId); _channelInfo = ChannelManager.GetChannelInfo(SiteId, channelId); _tableName = ChannelManager.GetTableName(SiteInfo, _channelInfo); _styleInfoList = TableStyleManager.GetTableStyleInfoList(_tableName, _relatedIdentities); _attributesOfDisplay = TranslateUtils.StringCollectionToStringCollection(ChannelManager.GetContentAttributesOfDisplay(SiteId, channelId)); _allStyleInfoList = ContentUtility.GetAllTableStyleInfoList(_styleInfoList); _pluginMenus = PluginContentManager.GetContentMenus(_channelInfo); _pluginColumns = PluginContentManager.GetContentColumns(_channelInfo); _isEdit = TextUtility.IsEdit(SiteInfo, channelId, AuthRequest.AdminPermissions); if (_channelInfo.Additional.IsPreviewContents) { new Action(() => { DataProvider.ContentDao.DeletePreviewContents(SiteId, _tableName, _channelInfo); }).BeginInvoke(null, null); } if (!HasChannelPermissions(channelId, ConfigManager.ChannelPermissions.ContentView, ConfigManager.ChannelPermissions.ContentAdd, ConfigManager.ChannelPermissions.ContentEdit, ConfigManager.ChannelPermissions.ContentDelete, ConfigManager.ChannelPermissions.ContentTranslate)) { if (!AuthRequest.IsAdminLoggin) { PageUtils.RedirectToLoginPage(); return; } PageUtils.RedirectToErrorPage("您无此栏目的操作权限!"); return; } 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 = DataProvider.ContentDao.GetPagerOrderSqlString(_channelInfo), ReturnColumnNames = TranslateUtils.ObjectCollectionToString(allLowerAttributeNameList) }; var administratorName = AuthRequest.AdminPermissions.IsViewContentOnlySelf(SiteId, channelId) ? AuthRequest.AdminName : string.Empty; if (AuthRequest.IsQueryExists("searchType")) { pagerParam.WhereSqlString = DataProvider.ContentDao.GetPagerWhereSqlString(SiteInfo, _channelInfo, AuthRequest.GetQueryString("searchType"), AuthRequest.GetQueryString("keyword"), AuthRequest.GetQueryString("dateFrom"), string.Empty, CheckManager.LevelInt.All, false, true, false, false, false, AuthRequest.AdminPermissions, allLowerAttributeNameList); pagerParam.TotalCount = DataProvider.DatabaseDao.GetPageTotalCount(_tableName, pagerParam.WhereSqlString); } else { pagerParam.WhereSqlString = DataProvider.ContentDao.GetPagerWhereSqlString(channelId, ETriState.All, administratorName); pagerParam.TotalCount = _channelInfo.ContentNum; } PgContents.Param = pagerParam; if (IsPostBack) { return; } PgContents.DataBind(); var btnHtmls = WebUtils.GetContentCommands(AuthRequest.AdminPermissions, SiteInfo, _channelInfo, PageUrl); var btnDropDownsHtml = WebUtils.GetContentMoreCommands(AuthRequest.AdminPermissions, SiteInfo, _channelInfo, PageUrl); LtlButtonsHead.Text = GetButtonsHtml(true, btnHtmls, btnDropDownsHtml); if (pagerParam.TotalCount > 10) { LtlButtonsFoot.Text = GetButtonsHtml(false, btnHtmls, btnDropDownsHtml); } foreach (var styleInfo in _allStyleInfoList) { if (styleInfo.InputType == InputType.TextEditor) { continue; } var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName); DdlSearchType.Items.Add(listitem); } if (AuthRequest.IsQueryExists("searchType")) { TbDateFrom.Text = AuthRequest.GetQueryString("dateFrom"); ControlUtils.SelectSingleItem(DdlSearchType, AuthRequest.GetQueryString("searchType")); TbKeyword.Text = AuthRequest.GetQueryString("keyword"); if (!string.IsNullOrEmpty(AuthRequest.GetQueryString("searchType")) || !string.IsNullOrEmpty(TbDateFrom.Text) || !string.IsNullOrEmpty(TbKeyword.Text)) { LtlButtonsHead.Text += @" <script> $(document).ready(function() { $('#contentSearch').show(); }); </script> "; } } else { ControlUtils.SelectSingleItem(DdlSearchType, ContentAttribute.Title); } LtlColumnsHead.Text = TextUtility.GetColumnsHeadHtml(_styleInfoList, _pluginColumns, _attributesOfDisplay); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId"); _elementName = AuthRequest.GetQueryString("elementName"); if (IsPostBack) { return; } VerifySitePermissions(ConfigManager.WebSitePermissions.Template); var elements = StlAll.Elements; var allBuilder = new StringBuilder(); foreach (var elementName in elements.Keys) { allBuilder.Append($@"<li class=""nav-item {(elementName == _elementName ? "active" : string.Empty)}""> <a href=""{GetRedirectUrl(SiteId, elementName)}"" class=""nav-link""> {elementName} </a> </li>"); } LtlAll.Text = allBuilder.ToString(); if (!string.IsNullOrEmpty(_elementName)) { Type elementType; if (elements.TryGetValue(_elementName, out elementType)) { PhRefenreces.Visible = true; var attrBuilder = new StringBuilder(); var fields = elementType.GetFields(BindingFlags.Static | BindingFlags.NonPublic); foreach (var field in fields) { var attr = field.GetValue(null) as Attr; if (attr != null) { attrBuilder.Append($@"<tr> <td>{attr.Name}</td> <td>{AttrUtils.GetAttrTypeText(attr.Type, attr.GetEnums(elementType, SiteId))}</td> <td>{attr.Description}</td> </tr>"); } } var helpUrl = StringUtils.Constants.GetStlUrl(false, _elementName); var stlAttribute = (StlClassAttribute)Attribute.GetCustomAttribute(elementType, typeof(StlClassAttribute)); LtlReferences.Text = $@" <div class=""tab-pane"" style=""display: block;""> <h4 class=""m-t-0 header-title""> <{_elementName}> {stlAttribute.Usage} </h4> <p> {stlAttribute.Description} <a href=""{helpUrl}"" target=""_blank"">详细使用说明</a> </p> <div class=""panel panel-default m-t-10""> <div class=""panel-body p-0""> <div class=""table-responsive""> <table class=""table tablesaw table-striped m-0""> <thead> <tr> <th>属性</th> <th>类型</th> <th>说明</th> </tr> </thead> <tbody> {attrBuilder} </tbody> </table> </div> </div> </div> </div> "; } } }
public void Delete_OnClick(object sender, EventArgs e) { if (!Page.IsPostBack || !Page.IsValid) { return; } try { var channelIdList = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("ChannelIDCollection")); channelIdList.Sort(); channelIdList.Reverse(); var channelIdListToDelete = new List <int>(); foreach (var channelId in channelIdList) { if (channelId == SiteId) { continue; } if (HasChannelPermissions(channelId, ConfigManager.ChannelPermissions.ChannelDelete)) { channelIdListToDelete.Add(channelId); } } var builder = new StringBuilder(); foreach (var channelId in channelIdListToDelete) { builder.Append(ChannelManager.GetChannelName(SiteId, channelId)).Append(","); } if (builder.Length > 0) { builder.Length -= 1; } if (_deleteContents) { SuccessMessage(bool.Parse(RblRetainFiles.SelectedValue) == false ? "成功删除内容以及生成页面!" : "成功删除内容,生成页面未被删除!"); foreach (var channelId in channelIdListToDelete) { var tableName = ChannelManager.GetTableName(SiteInfo, channelId); var contentIdList = DataProvider.ContentDao.GetContentIdList(tableName, channelId); DeleteManager.DeleteContents(SiteInfo, channelId, contentIdList); DataProvider.ContentDao.TrashContents(SiteId, tableName, contentIdList); } AuthRequest.AddSiteLog(SiteId, "清空栏目下的内容", $"栏目:{builder}"); } else { if (bool.Parse(RblRetainFiles.SelectedValue) == false) { DeleteManager.DeleteChannels(SiteInfo, channelIdListToDelete); SuccessMessage("成功删除栏目以及相关生成页面!"); } else { SuccessMessage("成功删除栏目,相关生成页面未被删除!"); } foreach (var channelId in channelIdListToDelete) { var tableName = ChannelManager.GetTableName(SiteInfo, channelId); DataProvider.ContentDao.TrashContentsByChannelId(SiteId, tableName, channelId); DataProvider.ChannelDao.Delete(SiteId, channelId); } AuthRequest.AddSiteLog(SiteId, "删除栏目", $"栏目:{builder}"); } AddWaitAndRedirectScript(ReturnUrl); } catch (Exception ex) { FailMessage(ex, _deleteContents ? "删除内容失败!" : "删除栏目失败!"); LogUtils.AddErrorLog(ex); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _type = Request.QueryString["type"]; if (IsPostBack) { return; } if (StringUtils.EqualsIgnoreCase(_type, TypePreviewImage)) { var siteId = AuthRequest.GetQueryInt("siteID"); var siteInfo = SiteManager.GetSiteInfo(siteId); var textBoxClientId = AuthRequest.GetQueryString("textBoxClientID"); LtlHtml.Text = $@" <span id=""previewImage""></span> <script> var rootUrl = '{PageUtils.GetRootUrl(string.Empty)}'; var siteUrl = '{PageUtils.ParseNavigationUrl($"~/{siteInfo.SiteDir}")}'; var imageUrl = window.parent.document.getElementById('{textBoxClientId}').value; if(imageUrl && imageUrl.search(/\.bmp|\.jpg|\.jpeg|\.gif|\.png$/i) != -1){{ if (imageUrl.charAt(0) == '~'){{ imageUrl = imageUrl.replace('~', rootUrl); }}else if (imageUrl.charAt(0) == '@'){{ imageUrl = imageUrl.replace('@', siteUrl); }} if(imageUrl.substr(0,2)=='//'){{ imageUrl = imageUrl.replace('//', '/'); }} $('#previewImage').html('<img src=""' + imageUrl + '"" class=""img-polaroid"" />'); }} </script> "; } else if (StringUtils.EqualsIgnoreCase(_type, TypePreviewVideo)) { var siteId = AuthRequest.GetQueryInt("siteID"); var siteInfo = SiteManager.GetSiteInfo(siteId); var textBoxClientId = AuthRequest.GetQueryString("textBoxClientID"); LtlHtml.Text = $@" <span id=""previewVideo""></span> <script> var rootUrl = '{PageUtils.GetRootUrl(string.Empty)}'; var siteUrl = '{PageUtils.ParseNavigationUrl($"~/{siteInfo.SiteDir}")}'; var videoUrl = window.parent.document.getElementById('{textBoxClientId}').value; if (videoUrl.charAt(0) == '~'){{ videoUrl = videoUrl.replace('~', rootUrl); }}else if (videoUrl.charAt(0) == '@'){{ videoUrl = videoUrl.replace('@', siteUrl); }} if(videoUrl.substr(0,2)=='//'){{ videoUrl = videoUrl.replace('//', '/'); }} if (videoUrl){{ $('#previewVideo').html('<embed src=""../assets/player.swf"" allowfullscreen=""true"" flashvars=""controlbar=over&autostart=true&file='+videoUrl+'"" width=""{450}"" height=""{350}""/>'); }} </script> "; } else if (StringUtils.EqualsIgnoreCase(_type, TypePreviewVideoByUrl)) { var siteId = AuthRequest.GetQueryInt("siteID"); var siteInfo = SiteManager.GetSiteInfo(siteId); var videoUrl = AuthRequest.GetQueryString("videoUrl"); LtlHtml.Text = $@" <embed src=""../assets/player.swf"" allowfullscreen=""true"" flashvars=""controlbar=over&autostart=true&file={PageUtility .ParseNavigationUrl(siteInfo, videoUrl, true)}"" width=""{450}"" height=""{350}""/> "; } else { LtlHtml.Text = TranslateUtils.DecryptStringBySecretKey(Request.QueryString["html"]); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } if (string.IsNullOrEmpty(AuthRequest.GetQueryString("startDate"))) { _begin = DateTime.Now.AddMonths(-1); _end = DateTime.Now; } else { _begin = TranslateUtils.ToDateTime(AuthRequest.GetQueryString("startDate")); _end = TranslateUtils.ToDateTime(AuthRequest.GetQueryString("endDate")); } var siteIdList = SiteManager.GetSiteIdListOrderByLevel(); if (SiteId == 0 && siteIdList.Count > 0) { PageUtils.Redirect(GetRedirectUrl(siteIdList[0], DateUtils.GetDateAndTimeString(_begin), DateUtils.GetDateAndTimeString(_end))); return; } if (IsPostBack) { return; } VerifyAdministratorPermissions(ConfigManager.SettingsPermissions.Chart); foreach (var siteId in siteIdList) { var siteInfo = SiteManager.GetSiteInfo(siteId); DdlSiteId.Items.Add(new ListItem(siteInfo.SiteName, siteId.ToString())); } ControlUtils.SelectSingleItem(DdlSiteId, SiteId.ToString()); TbStartDate.Text = DateUtils.GetDateAndTimeString(_begin); TbEndDate.Text = DateUtils.GetDateAndTimeString(_end); if (SiteInfo == null) { PhAnalysis.Visible = false; return; } var ds = DataProvider.ContentDao.GetDataSetOfAdminExcludeRecycle(SiteInfo.TableName, SiteId, _begin, _end); if (ds == null || ds.Tables.Count <= 0) { return; } var dt = ds.Tables[0]; if (dt.Rows.Count <= 0) { return; } foreach (DataRow dr in dt.Rows) { SetXHashtableUser(dr["userName"].ToString(), dr["userName"].ToString()); SetYHashtableUser(dr["userName"].ToString(), TranslateUtils.ToInt(dr["addCount"].ToString()), YTypeNew); SetYHashtableUser(dr["userName"].ToString(), TranslateUtils.ToInt(dr["updateCount"].ToString()), YTypeUpdate); } foreach (var key in _userNameList) { var yValueNew = GetYHashtableUser(key, YTypeNew); var yValueUpdate = GetYHashtableUser(key, YTypeUpdate); StrArray += $@" xArrayNew.push('{GetXHashtableUser(key)}'); yArrayNew.push('{yValueNew}'); yArrayUpdate.push('{yValueUpdate}');"; } SpContents.ControlToPaginate = RptContents; RptContents.ItemDataBound += RptContents_ItemDataBound; SpContents.ItemsPerPage = StringUtils.Constants.PageSize; SpContents.SortField = "UserName"; SpContents.SortMode = SortMode.DESC; SpContents.SelectCommand = DataProvider.ContentDao.GetSqlStringOfAdminExcludeRecycle(SiteInfo.TableName, SiteId, _begin, _end); SpContents.DataBind(); }
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 whereString = DataProvider.ContentDao.GetPagerWhereSqlString(SiteInfo, _channelInfo, searchType, keyword, dateFrom, dateTo, state, _isCheckOnly, false, _isTrashOnly, _isWritingOnly, _isAdminOnly, 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); 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"); 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.WebSitePermissions.Template); 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"); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId"); ReturnUrl = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("ReturnUrl")); if (!HasChannelPermissions(SiteId, ConfigManager.ChannelPermissions.ContentDelete)) { RblIsDeleteAfterTranslate.Visible = false; } if (IsPostBack) { return; } PhReturn.Visible = !string.IsNullOrEmpty(ReturnUrl); ETranslateTypeUtils.AddListItems(DdlTranslateType); ControlUtils.SelectSingleItem(DdlTranslateType, AuthRequest.IsQueryExists("ChannelIDCollection") ? ETranslateTypeUtils.GetValue(ETranslateType.All) : ETranslateTypeUtils.GetValue(ETranslateType.Content)); var siteIdList = AuthRequest.AdminPermissionsImpl.GetSiteIdList(); foreach (var psId in siteIdList) { var psInfo = SiteManager.GetSiteInfo(psId); var listitem = new ListItem(psInfo.SiteName, psId.ToString()); if (psId == SiteId) { listitem.Selected = true; } DdlSiteId.Items.Add(listitem); } var channelIdStrList = new List <string>(); if (AuthRequest.IsQueryExists("ChannelIDCollection")) { channelIdStrList = TranslateUtils.StringCollectionToStringList(AuthRequest.GetQueryString("ChannelIDCollection")); } var channelIdList = ChannelManager.GetChannelIdList(SiteId); var nodeCount = channelIdList.Count; _isLastNodeArray = new bool[nodeCount]; foreach (var theChannelId in channelIdList) { var enabled = IsOwningChannelId(theChannelId); if (!enabled) { if (!IsDescendantOwningChannelId(theChannelId)) { continue; } } var nodeInfo = ChannelManager.GetChannelInfo(SiteId, theChannelId); var value = enabled ? nodeInfo.Id.ToString() : string.Empty; value = nodeInfo.Additional.IsContentAddable ? value : string.Empty; var text = GetTitle(nodeInfo); var listItem = new ListItem(text, value); if (channelIdStrList.Contains(value)) { listItem.Selected = true; } LbChannelIdFrom.Items.Add(listItem); listItem = new ListItem(text, value); DdlChannelIdTo.Items.Add(listItem); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } if (IsPostBack) { return; } VerifySystemPermissions(ConfigManager.SettingsPermissions.Chart); LtlPageTitle1.Text = $"管理员登录最近{_count}{EStatictisXTypeUtils.GetText(EStatictisXTypeUtils.GetEnumType(AuthRequest.GetQueryString("XType")))}分配图表(按日期统计)"; LtlPageTitle2.Text = $"管理员登录最近{_count}{EStatictisXTypeUtils.GetText(EStatictisXTypeUtils.GetEnumType(AuthRequest.GetQueryString("XType")))}分配图表(按管理员统计)"; EStatictisXTypeUtils.AddListItems(DdlXType); _xType = EStatictisXTypeUtils.GetEnumType(AuthRequest.GetQueryString("XType")); if (Equals(_xType, EStatictisXType.Day)) { _count = 30; } else if (Equals(_xType, EStatictisXType.Month)) { _count = 12; } else if (Equals(_xType, EStatictisXType.Year)) { _count = 10; } TbDateFrom.Text = AuthRequest.GetQueryString("DateFrom"); TbDateTo.Text = AuthRequest.GetQueryString("DateTo"); DdlXType.SelectedValue = EStatictisXTypeUtils.GetValue(_xType); //管理员登录量统计,按照日期 var trackingDayDictionary = DataProvider.LogDao.GetAdminLoginDictionaryByDate(TranslateUtils.ToDateTime(AuthRequest.GetQueryString("DateFrom")), TranslateUtils.ToDateTime(AuthRequest.GetQueryString("DateTo"), DateTime.Now), EStatictisXTypeUtils.GetValue(_xType), LogInfo.AdminLogin); //管理员登录量统计,按照用户名 var adminNumDictionaryName = DataProvider.LogDao.GetAdminLoginDictionaryByName(TranslateUtils.ToDateTime(AuthRequest.GetQueryString("DateFrom")), TranslateUtils.ToDateTime(AuthRequest.GetQueryString("DateTo"), DateTime.Now), LogInfo.AdminLogin); var now = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0); for (var i = 0; i < _count; i++) { var datetime = now.AddDays(-i); if (Equals(_xType, EStatictisXType.Day)) { now = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0); datetime = now.AddDays(-i); } else if (Equals(_xType, EStatictisXType.Month)) { now = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1, 0, 0, 0); datetime = now.AddMonths(-i); } else if (Equals(_xType, EStatictisXType.Year)) { now = new DateTime(DateTime.Now.Year, 1, 1, 0, 0, 0); datetime = now.AddYears(-i); } var accessNum = 0; if (trackingDayDictionary.ContainsKey(datetime)) { accessNum = trackingDayDictionary[datetime]; } _adminNumDictionaryDay.Add(_count - i, accessNum); if (accessNum > _maxAdminNum) { _maxAdminNum = accessNum; } } for (var i = 1; i <= _count; i++) { StrArray1 += $@" xArray.push('{GetGraphicX(i)}'); yArray.push('{GetGraphicY(i)}'); "; } foreach (var key in adminNumDictionaryName.Keys) { StrArray2 += $@" xArray.push('{key}'); yArray.push('{GetGraphicYUser(adminNumDictionaryName, key)}'); "; } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId"); _channelId = AuthRequest.IsQueryExists("ChannelId") ? AuthRequest.GetQueryInt("ChannelId") : SiteId; _relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(SiteId, _channelId); _nodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); _tableName = ChannelManager.GetTableName(SiteInfo, _nodeInfo); _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); if (IsPostBack) { return; } var checkedLevel = 5; var isChecked = true; foreach (var owningChannelId in AuthRequest.AdminPermissions.OwningChannelIdList) { int checkedLevelByChannelId; var isCheckedByChannelId = CheckManager.GetUserCheckLevel(AuthRequest.AdminPermissions, SiteInfo, owningChannelId, out checkedLevelByChannelId); if (checkedLevel > checkedLevelByChannelId) { checkedLevel = checkedLevelByChannelId; } if (!isCheckedByChannelId) { isChecked = false; } } ChannelManager.AddListItems(DdlChannelId.Items, SiteInfo, true, true, AuthRequest.AdminPermissions); CheckManager.LoadContentLevelToList(DdlState, SiteInfo, SiteId, isChecked, checkedLevel); var checkLevelList = new List <int>(); if (!string.IsNullOrEmpty(AuthRequest.GetQueryString("channelId"))) { ControlUtils.SelectSingleItem(DdlChannelId, AuthRequest.GetQueryString("channelId")); } if (!string.IsNullOrEmpty(AuthRequest.GetQueryString("state"))) { ControlUtils.SelectSingleItem(DdlState, AuthRequest.GetQueryString("state")); checkLevelList.Add(AuthRequest.GetQueryInt("state")); } else { checkLevelList = CheckManager.LevelInt.GetCheckLevelList(SiteInfo, isChecked, checkedLevel); } SpContents.ControlToPaginate = RptContents; SpContents.ItemsPerPage = SiteInfo.Additional.PageSize; var nodeInfo = ChannelManager.GetChannelInfo(SiteId, _channelId); var tableName = ChannelManager.GetTableName(SiteInfo, nodeInfo); var channelIdList = ChannelManager.GetChannelIdList(nodeInfo, EScopeType.All, string.Empty, string.Empty, nodeInfo.ContentModelPluginId); var list = new List <int>(); if (AuthRequest.AdminPermissions.IsSystemAdministrator) { list = channelIdList; } else { var owningChannelIdList = new List <int>(); foreach (var owningChannelId in AuthRequest.AdminPermissions.OwningChannelIdList) { if (HasChannelPermissions(owningChannelId, ConfigManager.ChannelPermissions.ContentCheck)) { owningChannelIdList.Add(owningChannelId); } } foreach (var theChannelId in channelIdList) { if (owningChannelIdList.Contains(theChannelId)) { list.Add(theChannelId); } } } SpContents.SelectCommand = DataProvider.ContentDao.GetSelectedCommendByCheck(tableName, SiteId, list, checkLevelList); SpContents.SortField = ContentAttribute.LastEditDate; SpContents.SortMode = SortMode.DESC; RptContents.ItemDataBound += RptContents_ItemDataBound; SpContents.DataBind(); var showPopWinString = ModalContentCheck.GetOpenWindowStringForMultiChannels(SiteId, PageUrl); BtnCheck.Attributes.Add("onclick", showPopWinString); LtlColumnsHead.Text = TextUtility.GetColumnsHeadHtml(_styleInfoList, _attributesOfDisplay, SiteInfo); if (!HasChannelPermissions(SiteId, ConfigManager.ChannelPermissions.ContentDelete)) { BtnDelete.Visible = false; } else { BtnDelete.Attributes.Add("onclick", PageContentDelete.GetRedirectClickStringForMultiChannels(SiteId, false, PageUrl)); } }
public void BtnReturn_OnClick(object sender, EventArgs e) { PageUtils.Redirect(TranslateUtils.DecryptStringBySecretKey(AuthRequest.GetQueryString("returnUrl"))); }
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); contentInfo = DataProvider.ContentDao.GetCacheContentInfo(_tableName, _channelInfo.Id, contentId); } var titleFormat = IsPostBack ? Request.Form[ContentAttribute.GetFormatStringAttributeName(ContentAttribute.Title)] : contentInfo?.GetString(ContentAttribute.GetFormatStringAttributeName(ContentAttribute.Title)); LtlTitleHtml.Text = ContentUtility.GetTitleHtml(titleFormat); 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; var isChecked = CheckManager.GetUserCheckLevel(AuthRequest.AdminPermissionsImpl, SiteInfo, _channelInfo.Id, out var checkedLevel); if (AuthRequest.IsQueryExists("contentLevel")) { checkedLevel = TranslateUtils.ToIntWithNagetive(AuthRequest.GetQueryString("contentLevel")); isChecked = checkedLevel >= SiteInfo.Additional.CheckContentLevel; } CheckManager.LoadContentLevelToEdit(RblContentLevel, 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 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; ControlUtils.SelectSingleItem(RblContentLevel, SiteInfo.Additional.CheckContentDefaultLevel.ToString()); } 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; if (contentInfo.AddDate.HasValue) { TbAddDate.DateTime = contentInfo.AddDate.Value; } ControlUtils.SelectMultiItems(CblContentGroups, TranslateUtils.StringCollectionToStringList(contentInfo.GroupNameCollection)); AcAttributes.Attributes = contentInfo; var checkedLevel = contentInfo.CheckedLevel; if (contentInfo.IsChecked) { checkedLevel = SiteInfo.Additional.CheckContentLevel; } ControlUtils.SelectSingleItem(RblContentLevel, checkedLevel.ToString()); } } else { AcAttributes.Attributes = new AttributesImpl(Request.Form); } //DataBind(); }
public async Task Main() { var request = new AuthRequest(); var siteId = request.GetQueryInt("siteId"); var siteInfo = SiteManager.GetSiteInfo(siteId); try { var channelId = request.GetQueryInt("channelId"); if (channelId == 0) { channelId = siteId; } var contentId = request.GetQueryInt("contentId"); var fileTemplateId = request.GetQueryInt("fileTemplateId"); var specialId = request.GetQueryInt("specialId"); var isRedirect = TranslateUtils.ToBool(request.GetQueryString("isRedirect")); var nodeInfo = ChannelManager.GetChannelInfo(siteId, channelId); var tableName = ChannelManager.GetTableName(siteInfo, nodeInfo); if (specialId != 0) { await FileSystemObjectAsync.ExecuteAsync(siteId, ECreateType.Special, 0, 0, 0, specialId); } else if (fileTemplateId != 0) { await FileSystemObjectAsync.ExecuteAsync(siteId, ECreateType.File, 0, 0, fileTemplateId, 0); } else if (contentId != 0) { await FileSystemObjectAsync.ExecuteAsync(siteId, ECreateType.Content, channelId, contentId, 0, 0); } else if (channelId != 0) { await FileSystemObjectAsync.ExecuteAsync(siteId, ECreateType.Channel, channelId, 0, 0, 0); } else if (siteId != 0) { await FileSystemObjectAsync.ExecuteAsync(siteId, ECreateType.Channel, siteId, 0, 0, 0); } if (isRedirect) { var redirectUrl = string.Empty; if (specialId != 0) { redirectUrl = PageUtility.GetFileUrl(siteInfo, specialId, false); } else if (fileTemplateId != 0) { redirectUrl = PageUtility.GetFileUrl(siteInfo, fileTemplateId, false); } else if (contentId != 0) { var contentInfo = DataProvider.ContentDao.GetContentInfo(tableName, contentId); redirectUrl = PageUtility.GetContentUrl(siteInfo, contentInfo, false); } else if (channelId != 0) { redirectUrl = PageUtility.GetChannelUrl(siteInfo, nodeInfo, false); } else if (siteId != 0) { redirectUrl = PageUtility.GetIndexPageUrl(siteInfo, false); } if (!string.IsNullOrEmpty(redirectUrl)) { var parameters = new NameValueCollection(); var returnUrl = request.GetQueryString("returnUrl"); if (!string.IsNullOrEmpty(returnUrl)) { if (returnUrl.StartsWith("?")) { parameters = TranslateUtils.ToNameValueCollection(returnUrl.Substring(1)); } else { redirectUrl = returnUrl; } } parameters["__r"] = StringUtils.GetRandomInt(1, 10000).ToString(); PageUtils.Redirect(PageUtils.AddQueryString(redirectUrl, parameters)); return; } } } catch { var redirectUrl = PageUtility.GetIndexPageUrl(siteInfo, false); PageUtils.Redirect(redirectUrl); return; } HttpContext.Current.Response.Write(string.Empty); HttpContext.Current.Response.End(); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId", "RootPath", "CurrentRootPath", "TextBoxClientID"); _rootPath = AuthRequest.GetQueryString("RootPath").TrimEnd('/'); _currentRootPath = AuthRequest.GetQueryString("CurrentRootPath"); _textBoxClientId = AuthRequest.GetQueryString("TextBoxClientID"); if (string.IsNullOrEmpty(_currentRootPath)) { _currentRootPath = SiteInfo.Additional.ConfigSelectVideoCurrentUrl.TrimEnd('/'); } else { SiteInfo.Additional.ConfigSelectVideoCurrentUrl = _currentRootPath; DataProvider.SiteDao.Update(SiteInfo); } _currentRootPath = _currentRootPath.TrimEnd('/'); _directoryPath = PathUtility.MapPath(SiteInfo, _currentRootPath); DirectoryUtils.CreateDirectoryIfNotExists(_directoryPath); if (Page.IsPostBack) { return; } BtnUpload.Attributes.Add("onclick", ModalUploadVideo.GetOpenWindowStringToList(SiteId, _currentRootPath)); var previousUrls = Session["PreviousUrls"] as ArrayList ?? new ArrayList(); var currentUrl = GetRedirectUrl(_currentRootPath); if (previousUrls.Count > 0) { var url = previousUrls[previousUrls.Count - 1] as string; if (!string.Equals(url, currentUrl)) { previousUrls.Add(currentUrl); Session["PreviousUrls"] = previousUrls; } } else { previousUrls.Add(currentUrl); Session["PreviousUrls"] = previousUrls; } var navigationBuilder = new StringBuilder(); var directoryNames = _currentRootPath.Split('/'); var linkCurrentRootPath = _rootPath; foreach (var directoryName in directoryNames) { if (!string.IsNullOrEmpty(directoryName)) { if (directoryName.Equals("~")) { navigationBuilder.Append($"<a href='{GetRedirectUrl(_rootPath)}'>根目录</a>"); } else if (directoryName.Equals("@")) { navigationBuilder.Append( $"<a href='{GetRedirectUrl(_rootPath)}'>{SiteInfo.SiteDir}</a>"); } else { linkCurrentRootPath += "/" + directoryName; navigationBuilder.Append($"<a href='{GetRedirectUrl(linkCurrentRootPath)}'>{directoryName}</a>"); } navigationBuilder.Append("\\"); } } LtlCurrentDirectory.Text = navigationBuilder.ToString(); FillFileSystemsToImage(false); }
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)); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _theRoleName = AuthRequest.GetQueryString("RoleName"); _generalPermissionList = AuthRequest.AdminPermissions.PermissionList; if (IsPostBack) { return; } VerifySystemPermissions(ConfigManager.SettingsPermissions.Admin); if (!string.IsNullOrEmpty(_theRoleName)) { TbRoleName.Text = _theRoleName; TbRoleName.Enabled = false; TbDescription.Text = DataProvider.RoleDao.GetRoleDescription(_theRoleName); if (AuthRequest.GetQueryString("Return") == null) { var systemPermissionsInfoList = DataProvider.SitePermissionsDao.GetSystemPermissionsInfoList(_theRoleName); Session[SystemPermissionsInfoListKey] = systemPermissionsInfoList; } } else { if (AuthRequest.GetQueryString("Return") == null) { Session[SystemPermissionsInfoListKey] = new List <SitePermissionsInfo>(); } } var permissions = PermissionConfigManager.Instance.GeneralPermissions; if (permissions.Count > 0) { foreach (var permission in permissions) { if (_generalPermissionList.Contains(permission.Name)) { var listItem = new ListItem(permission.Text, permission.Name); CblPermissions.Items.Add(listItem); } } if (!string.IsNullOrEmpty(_theRoleName)) { var permissionList = DataProvider.PermissionsInRolesDao.GetGeneralPermissionList(new[] { _theRoleName }); if (permissionList != null && permissionList.Count > 0) { ControlUtils.SelectMultiItems(CblPermissions, permissionList); } } } PhSitePermissions.Visible = false; var psPermissionsInRolesInfoList = Session[SystemPermissionsInfoListKey] as List <SitePermissionsInfo>; if (psPermissionsInRolesInfoList != null) { var allSiteIdList = new List <int>(); foreach (var permissionSiteId in AuthRequest.AdminPermissions.SiteIdList) { if (AuthRequest.AdminPermissions.HasChannelPermissions(permissionSiteId, permissionSiteId) && AuthRequest.AdminPermissions.HasSitePermissions(permissionSiteId)) { var listOne = AuthRequest.AdminPermissions.GetChannelPermissions(permissionSiteId, permissionSiteId); var listTwo = AuthRequest.AdminPermissions.GetSitePermissions(permissionSiteId); if (listOne != null && listOne.Count > 0 || listTwo != null && listTwo.Count > 0) { PhSitePermissions.Visible = true; allSiteIdList.Add(permissionSiteId); } } } var managedSiteIdList = new List <int>(); foreach (var systemPermissionsInfo in psPermissionsInRolesInfoList) { managedSiteIdList.Add(systemPermissionsInfo.SiteId); } LtlSites.Text = GetSitesHtml(allSiteIdList, managedSiteIdList); } else { PageUtils.RedirectToErrorPage("页面超时,请重新进入。"); } if (Request.QueryString["Return"] == null) { BtnReturn.Visible = false; StrCookie = @"_setCookie(""pageRoleAdd"", """");"; } else { StrCookie = @" var ss_role = _getCookie(""pageRoleAdd""); if (ss_role) { var strs = ss_role.split("",""); for (i = 0; i < strs.length; i++) { var el = document.getElementById(strs[i].split("":"")[0]); if (el.type == ""checkbox"") { el.checked = (strs[i].split("":"")[1] == ""true""); } else { el.value = strs[i].split("":"")[1]; } } } "; } }