예제 #1
0
        public Dictionary <int, List <string> > GetChannelPermissionSortedList(string[] roles)
        {
            var sortedlist = new Dictionary <int, List <string> >();

            foreach (var roleName in roles)
            {
                var systemPermissionsInfoList = GetSystemPermissionsInfoList(roleName);
                foreach (var systemPermissionsInfo in systemPermissionsInfoList)
                {
                    var channelIdStrList = TranslateUtils.StringCollectionToStringList(systemPermissionsInfo.ChannelIdCollection);
                    foreach (var channelIdStr in channelIdStrList)
                    {
                        var channelId = TranslateUtils.ToInt(channelIdStr);
                        var list      = new List <string>();
                        if (sortedlist.ContainsKey(channelId))
                        {
                            list = sortedlist[channelId];
                        }

                        var channelPermissionList = TranslateUtils.StringCollectionToStringList(systemPermissionsInfo.ChannelPermissions);
                        foreach (var channelPermission in channelPermissionList)
                        {
                            if (!list.Contains(channelPermission))
                            {
                                list.Add(channelPermission);
                            }
                        }
                        sortedlist[channelId] = list;
                    }
                }
            }

            return(sortedlist);
        }
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (!Page.IsPostBack || !Page.IsValid)
            {
                return;
            }

            if (CbIsSmallImage.Checked && string.IsNullOrEmpty(TbSmallImageWidth.Text) && string.IsNullOrEmpty(TbSmallImageHeight.Text))
            {
                FailMessage("缩略图尺寸不能为空!");
                return;
            }

            ConfigSettings(false);

            var scripts = string.Empty;

            var fileNames = TranslateUtils.StringCollectionToStringList(HihFilePaths.Value);

            foreach (var filePath in fileNames)
            {
                if (!string.IsNullOrEmpty(filePath))
                {
                    var fileName = PathUtils.GetFileName(filePath);

                    var fileExtName        = PathUtils.GetExtension(filePath).ToLower();
                    var localDirectoryPath = PathUtility.GetUploadDirectoryPath(SiteInfo, fileExtName);

                    var imageUrl = PageUtility.GetSiteUrlByPhysicalPath(SiteInfo, filePath, true);

                    if (CbIsSmallImage.Checked)
                    {
                        var localSmallFileName = Constants.SmallImageAppendix + fileName;
                        var localSmallFilePath = PathUtils.Combine(localDirectoryPath, localSmallFileName);

                        var smallImageUrl = PageUtility.GetSiteUrlByPhysicalPath(SiteInfo, localSmallFilePath, true);

                        var width  = TranslateUtils.ToInt(TbSmallImageWidth.Text);
                        var height = TranslateUtils.ToInt(TbSmallImageHeight.Text);
                        ImageUtils.MakeThumbnail(filePath, localSmallFilePath, width, height, true);

                        var insertHtml = CbIsLinkToOriginal.Checked
                            ? $@"<a href=""{imageUrl}"" target=""_blank""><img src=""{smallImageUrl}"" border=""0"" /></a>"
                            : $@"<img src=""{smallImageUrl}"" border=""0"" />";

                        scripts += "if(parent." + UEditorUtils.GetEditorInstanceScript() + ") parent." +
                                   UEditorUtils.GetInsertHtmlScript("Content", insertHtml);
                    }
                    else
                    {
                        var insertHtml = $@"<img src=""{imageUrl}"" border=""0"" />";

                        scripts += "if(parent." + UEditorUtils.GetEditorInstanceScript() + ") parent." +
                                   UEditorUtils.GetInsertHtmlScript("Content", insertHtml);
                    }
                }
            }

            LayerUtils.CloseWithoutRefresh(Page, scripts);
        }
예제 #3
0
        public void GetContent_Click(object sender, EventArgs e)
        {
            var getContent = (Button)sender;
            var contentUrl = getContent.CommandArgument;

            var gatherRuleInfo = DataProvider.GatherRuleDao.GetGatherRuleInfo(_gatherRuleName, PublishmentSystemId);

            var regexContentExclude = GatherUtility.GetRegexString(gatherRuleInfo.ContentExclude);
            var regexChannel        = GatherUtility.GetRegexChannel(gatherRuleInfo.ContentChannelStart, gatherRuleInfo.ContentChannelEnd);
            var regexContent        = GatherUtility.GetRegexContent(gatherRuleInfo.ContentContentStart, gatherRuleInfo.ContentContentEnd);
            var regexContent2       = string.Empty;

            if (!string.IsNullOrEmpty(gatherRuleInfo.Additional.ContentContentStart2) && !string.IsNullOrEmpty(gatherRuleInfo.Additional.ContentContentEnd2))
            {
                regexContent2 = GatherUtility.GetRegexContent(gatherRuleInfo.Additional.ContentContentStart2, gatherRuleInfo.Additional.ContentContentEnd2);
            }
            var regexContent3 = string.Empty;

            if (!string.IsNullOrEmpty(gatherRuleInfo.Additional.ContentContentStart3) && !string.IsNullOrEmpty(gatherRuleInfo.Additional.ContentContentEnd3))
            {
                regexContent3 = GatherUtility.GetRegexContent(gatherRuleInfo.Additional.ContentContentStart3, gatherRuleInfo.Additional.ContentContentEnd3);
            }
            var regexNextPage        = GatherUtility.GetRegexUrl(gatherRuleInfo.ContentNextPageStart, gatherRuleInfo.ContentNextPageEnd);
            var regexTitle           = GatherUtility.GetRegexTitle(gatherRuleInfo.ContentTitleStart, gatherRuleInfo.ContentTitleEnd);
            var contentAttributes    = TranslateUtils.StringCollectionToStringList(gatherRuleInfo.ContentAttributes);
            var contentAttributesXML = TranslateUtils.ToNameValueCollection(gatherRuleInfo.ContentAttributesXml);

            var attributes = GatherUtility.GetContentNameValueCollection(gatherRuleInfo.Charset, contentUrl, gatherRuleInfo.CookieString, regexContentExclude, gatherRuleInfo.ContentHtmlClearCollection, gatherRuleInfo.ContentHtmlClearTagCollection, regexTitle, regexContent, regexContent2, regexContent3, regexNextPage, regexChannel, contentAttributes, contentAttributesXML);

            var builder = new StringBuilder();

            var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, PublishmentSystemId);

            var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.BackgroundContent, PublishmentSystemInfo.AuxiliaryTableForContent, relatedIdentities);

            foreach (var styleInfo in styleInfoList)
            {
                if (string.IsNullOrEmpty(attributes[styleInfo.AttributeName.ToLower()]))
                {
                    continue;
                }
                if (StringUtils.EqualsIgnoreCase(ContentAttribute.Title, styleInfo.AttributeName))
                {
                    builder.Append(
                        $@"<a href=""{contentUrl}"" target=""_blank"">{styleInfo.DisplayName}: {attributes[
                            styleInfo.AttributeName.ToLower()]}</a><br><br>");
                }
                else if (StringUtils.EqualsIgnoreCase(BackgroundContentAttribute.ImageUrl, styleInfo.AttributeName) || EInputTypeUtils.Equals(styleInfo.InputType, EInputType.Image))
                {
                    var imageUrl = PageUtils.GetUrlByBaseUrl(attributes[styleInfo.AttributeName.ToLower()], contentUrl);
                    builder.Append($"{styleInfo.DisplayName}: <img src='{imageUrl}' /><br><br>");
                }
                else
                {
                    builder.Append($"{styleInfo.DisplayName}: {attributes[styleInfo.AttributeName.ToLower()]}<br><br>");
                }
            }

            Content.Text = builder.ToString();
        }
예제 #4
0
        public void Update(KeywordInfo keywordInfo)
        {
            if (keywordInfo != null && keywordInfo.KeywordID > 0)
            {
                var parms = new IDataParameter[]
                {
                    GetParameter(PARM_PUBLISHMENT_SYSTEM_ID, EDataType.Integer, keywordInfo.PublishmentSystemID),
                    GetParameter(PARM_KEYWORDS, EDataType.NVarChar, 255, keywordInfo.Keywords),
                    GetParameter(PARM_IS_DISABLED, EDataType.VarChar, 18, keywordInfo.IsDisabled.ToString()),
                    GetParameter(PARM_KEYWORD_TYPE, EDataType.VarChar, 50, EKeywordTypeUtils.GetValue(keywordInfo.KeywordType)),
                    GetParameter(PARM_MATCH_TYPE, EDataType.VarChar, 50, EMatchTypeUtils.GetValue(keywordInfo.MatchType)),
                    GetParameter(PARM_REPLY, EDataType.NText, keywordInfo.Reply),
                    GetParameter(PARM_ADD_DATE, EDataType.DateTime, keywordInfo.AddDate),
                    GetParameter(PARM_TAXIS, EDataType.Integer, keywordInfo.Taxis),
                    GetParameter(PARM_KEYWORD_ID, EDataType.Integer, keywordInfo.KeywordID)
                };

                ExecuteNonQuery(SQL_UPDATE, parms);

                DataProviderWX.KeywordMatchDAO.DeleteByKeywordID(keywordInfo.KeywordID);

                foreach (var str in TranslateUtils.StringCollectionToStringList(keywordInfo.Keywords, ' '))
                {
                    var keyword = str.Trim();
                    if (!string.IsNullOrEmpty(keyword))
                    {
                        DataProviderWX.KeywordMatchDAO.Insert(new KeywordMatchInfo(0, keywordInfo.PublishmentSystemID, keyword, keywordInfo.KeywordID, keywordInfo.IsDisabled, keywordInfo.KeywordType, keywordInfo.MatchType));
                    }
                }
            }
        }
예제 #5
0
        public static bool Execute(TaskInfo taskInfo)
        {
            var taskGatherInfo = new TaskGatherInfo(taskInfo.ServiceParameters);

            if (taskInfo.PublishmentSystemID != 0)
            {
                var webGatherNames      = TranslateUtils.StringCollectionToStringList(taskGatherInfo.WebGatherNames);
                var databaseGatherNames = TranslateUtils.StringCollectionToStringList(taskGatherInfo.DatabaseGatherNames);
                var fileGatherNames     = TranslateUtils.StringCollectionToStringList(taskGatherInfo.FileGatherNames);
                Gather(taskInfo.PublishmentSystemID, webGatherNames, databaseGatherNames, fileGatherNames);
            }
            else
            {
                var publishmentSystemIDArrayList = TranslateUtils.StringCollectionToIntList(taskGatherInfo.PublishmentSystemIDCollection);
                foreach (int publishmentSystemID in publishmentSystemIDArrayList)
                {
                    var webGatherNames      = DataProvider.GatherRuleDao.GetGatherRuleNameArrayList(publishmentSystemID);
                    var databaseGatherNames = DataProvider.GatherDatabaseRuleDao.GetGatherRuleNameArrayList(publishmentSystemID);
                    var fileGatherNames     = DataProvider.GatherFileRuleDao.GetGatherRuleNameArrayList(publishmentSystemID);
                    Gather(publishmentSystemID, webGatherNames, databaseGatherNames, fileGatherNames);
                }
            }

            return(true);
        }
예제 #6
0
        public void LinkButton_Command(object sender, CommandEventArgs e)
        {
            if (e.CommandName.Equals("NavigationBar"))
            {
                if (e.CommandArgument.Equals("Delete"))
                {
                    var directoryNameCollection = Request["DirectoryNameCollection"];
                    if (!string.IsNullOrEmpty(directoryNameCollection))
                    {
                        var directoryNameArrayList = TranslateUtils.StringCollectionToStringList(directoryNameCollection);
                        if (directoryNameArrayList != null && directoryNameArrayList.Count > 0)
                        {
                            foreach (string directoryName in directoryNameArrayList)
                            {
                                var path = PathUtils.Combine(_directoryPath, directoryName);
                                DirectoryUtils.DeleteDirectoryIfExists(path);
                            }
                        }
                    }
                    var fileNameCollection = Request["FileNameCollection"];
                    if (!string.IsNullOrEmpty(fileNameCollection))
                    {
                        var fileNameArrayList = TranslateUtils.StringCollectionToStringList(fileNameCollection);
                        if (fileNameArrayList != null && fileNameArrayList.Count > 0)
                        {
                            FileUtils.DeleteFilesIfExists(_directoryPath, fileNameArrayList);
                        }
                    }
                }
            }

            PageUtils.Redirect(GetRedirectUrl(PublishmentSystemId, _relatedPath));
        }
예제 #7
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID", "NodeID");
            var nodeID = int.Parse(Body.GetQueryString("NodeID"));

            nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, nodeID);

            if (!IsPostBack)
            {
                ECrossSiteTransTypeUtils.AddAllListItems(TransType);

                ControlUtils.SelectListItems(TransType, ECrossSiteTransTypeUtils.GetValue(nodeInfo.Additional.TransType));

                TransType_OnSelectedIndexChanged(null, EventArgs.Empty);
                ControlUtils.SelectListItems(PublishmentSystemIDCollection, nodeInfo.Additional.TransPublishmentSystemID.ToString());


                PublishmentSystemIDCollection_OnSelectedIndexChanged(null, EventArgs.Empty);
                ControlUtils.SelectListItems(NodeIDCollection, TranslateUtils.StringCollectionToStringList(nodeInfo.Additional.TransNodeIDs));
                NodeNames.Text = nodeInfo.Additional.TransNodeNames;

                EBooleanUtils.AddListItems(IsAutomatic, "自动", "提示");
                ControlUtils.SelectListItemsIgnoreCase(IsAutomatic, nodeInfo.Additional.TransIsAutomatic.ToString());

                ETranslateContentTypeUtils.AddListItems(ddlTranslateDoneType, false);
                ControlUtils.SelectListItems(ddlTranslateDoneType, ETranslateContentTypeUtils.GetValue(nodeInfo.Additional.TransDoneType));
            }
        }
예제 #8
0
        public void Update(KeywordInfo keywordInfo)
        {
            if (keywordInfo != null && keywordInfo.KeywordId > 0)
            {
                var parms = new IDataParameter[]
                {
                    GetParameter(ParmPublishmentSystemId, EDataType.Integer, keywordInfo.PublishmentSystemId),
                    GetParameter(ParmKeywords, EDataType.NVarChar, 255, keywordInfo.Keywords),
                    GetParameter(ParmIsDisabled, EDataType.VarChar, 18, keywordInfo.IsDisabled.ToString()),
                    GetParameter(ParmKeywordType, EDataType.VarChar, 50, EKeywordTypeUtils.GetValue(keywordInfo.KeywordType)),
                    GetParameter(ParmMatchType, EDataType.VarChar, 50, EMatchTypeUtils.GetValue(keywordInfo.MatchType)),
                    GetParameter(ParmReply, EDataType.NText, keywordInfo.Reply),
                    GetParameter(ParmAddDate, EDataType.DateTime, keywordInfo.AddDate),
                    GetParameter(ParmTaxis, EDataType.Integer, keywordInfo.Taxis),
                    GetParameter(ParmKeywordId, EDataType.Integer, keywordInfo.KeywordId)
                };

                ExecuteNonQuery(SqlUpdate, parms);

                DataProviderWx.KeywordMatchDao.DeleteByKeywordId(keywordInfo.KeywordId);

                foreach (var str in TranslateUtils.StringCollectionToStringList(keywordInfo.Keywords, ' '))
                {
                    var keyword = str.Trim();
                    if (!string.IsNullOrEmpty(keyword))
                    {
                        DataProviderWx.KeywordMatchDao.Insert(new KeywordMatchInfo(0, keywordInfo.PublishmentSystemId, keyword, keywordInfo.KeywordId, keywordInfo.IsDisabled, keywordInfo.KeywordType, keywordInfo.MatchType));
                    }
                }
            }
        }
예제 #9
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _nodeId   = TranslateUtils.ToInt(Request.QueryString["NodeID"]);
            _userName = Request.QueryString["UserName"];

            if (!IsPostBack)
            {
                var permissionArrayList = new List <string>();
                var permissionsInfo     = DataProvider.GovInteractPermissionsDao.GetPermissionsInfo(_userName, _nodeId);
                if (permissionsInfo != null)
                {
                    permissionArrayList = TranslateUtils.StringCollectionToStringList(permissionsInfo.Permissions);
                }

                foreach (PermissionConfig permission in PermissionConfigManager.Instance.GovInteractPermissions)
                {
                    var listItem = new ListItem(permission.Text, permission.Name);
                    if (permissionArrayList.Contains(permission.Name))
                    {
                        listItem.Selected = true;
                    }
                    cblPermissions.Items.Add(listItem);
                }
            }
        }
예제 #10
0
        public void Delete_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                if (Request.Form["AdAreaNameCollection"] != null)
                {
                    var arraylist = TranslateUtils.StringCollectionToStringList(Request.Form["AdAreaNameCollection"]);
                    try
                    {
                        foreach (string adAreaName in arraylist)
                        {
                            DataProvider.AdAreaDao.Delete(adAreaName, PublishmentSystemId);
                        }

                        Body.AddSiteLog(PublishmentSystemId, "删除广告位", $"广告名称:{Request.Form["AdAreaNameCollection"]}");

                        SuccessDeleteMessage();
                    }
                    catch (Exception ex)
                    {
                        FailDeleteMessage(ex);
                    }
                    BindGrid();
                }
                else
                {
                    FailMessage("请选择广告位后进行操作!");
                }
            }
        }
예제 #11
0
        public static Hashtable GetIDsHashtable(NameValueCollection queryString)
        {
            var idsHashtable = new Hashtable();

            if (!string.IsNullOrEmpty(queryString["IDsCollection"]))
            {
                var idsArrayList = TranslateUtils.StringCollectionToStringList(queryString["IDsCollection"]);
                foreach (string ids in idsArrayList)
                {
                    var nodeID             = TranslateUtils.ToInt(ids.Split('_')[0]);
                    var contentID          = TranslateUtils.ToInt(ids.Split('_')[1]);
                    var contentIDArrayList = idsHashtable[nodeID] as ArrayList;
                    if (contentIDArrayList == null)
                    {
                        contentIDArrayList = new ArrayList();
                    }
                    contentIDArrayList.Add(contentID);
                    idsHashtable[nodeID] = contentIDArrayList;
                }
            }
            else
            {
                var nodeID             = TranslateUtils.ToInt(queryString["NodeID"]);
                var contentIDArrayList = TranslateUtils.StringCollectionToIntList(queryString["ContentIDCollection"]);
                idsHashtable[nodeID] = contentIDArrayList;
            }

            return(idsHashtable);
        }
예제 #12
0
        void dgContents_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var userName          = e.Item.DataItem as string;
                var administratorInfo = BaiRongDataProvider.AdministratorDao.GetByUserName(userName);
                var permissionsInfo   = DataProvider.GovInteractPermissionsDao.GetPermissionsInfo(userName, _nodeId);

                var ltlDepartmentName = e.Item.FindControl("ltlDepartmentName") as Literal;
                var ltlUserName       = e.Item.FindControl("ltlUserName") as Literal;
                var ltlDisplayName    = e.Item.FindControl("ltlDisplayName") as Literal;
                var ltlPermissions    = e.Item.FindControl("ltlPermissions") as Literal;
                var ltlEditUrl        = e.Item.FindControl("ltlEditUrl") as Literal;

                ltlDepartmentName.Text = DepartmentManager.GetDepartmentName(administratorInfo.DepartmentId);
                ltlUserName.Text       = userName;
                ltlDisplayName.Text    = administratorInfo.DisplayName;

                if (permissionsInfo != null)
                {
                    var permissionNameArrayList = new ArrayList();
                    var permissionArrayList     = TranslateUtils.StringCollectionToStringList(permissionsInfo.Permissions);
                    foreach (string permission in permissionArrayList)
                    {
                        permissionNameArrayList.Add(AppManager.Wcm.Permission.GovInteract.GetPermissionName(permission));
                    }
                    ltlPermissions.Text = TranslateUtils.ObjectCollectionToString(permissionNameArrayList);
                }

                ltlEditUrl.Text =
                    $@"<a href='javascript:;' onclick=""{ModalGovInteractPermissions.GetOpenWindowString(
                        PublishmentSystemId, _nodeId, userName)}"">设置权限</a>";
            }
        }
예제 #13
0
        public static Dictionary <string, List <HyperLink> > GetContentLinks(ChannelInfo nodeInfo)
        {
            if (string.IsNullOrEmpty(nodeInfo.ContentRelatedPluginIds) &&
                string.IsNullOrEmpty(nodeInfo.ContentModelPluginId))
            {
                return(null);
            }

            var dict      = new Dictionary <string, List <HyperLink> >();
            var pluginIds = TranslateUtils.StringCollectionToStringList(nodeInfo.ContentRelatedPluginIds);

            if (!string.IsNullOrEmpty(nodeInfo.ContentModelPluginId))
            {
                pluginIds.Add(nodeInfo.ContentModelPluginId);
            }

            foreach (var service in PluginManager.Services)
            {
                if (!pluginIds.Contains(service.PluginId) || service.ContentLinks == null || service.ContentLinks.Count == 0)
                {
                    continue;
                }

                dict[service.PluginId] = service.ContentLinks;
            }

            return(dict);
        }
예제 #14
0
        public Dictionary <string, List <string> > GetChannelPermissionSortedList(string[] roles)
        {
            var dict = new Dictionary <string, List <string> >();

            foreach (var roleName in roles)
            {
                var systemPermissionsInfoList = GetSystemPermissionsInfoList(roleName);
                foreach (var systemPermissionsInfo in systemPermissionsInfoList)
                {
                    var channelIdList = TranslateUtils.StringCollectionToIntList(systemPermissionsInfo.ChannelIdCollection);
                    foreach (var channelId in channelIdList)
                    {
                        var key = PermissionsImpl.GetChannelPermissionDictKey(systemPermissionsInfo.SiteId, channelId);

                        if (!dict.TryGetValue(key, out var list))
                        {
                            list      = new List <string>();
                            dict[key] = list;
                        }

                        var channelPermissionList = TranslateUtils.StringCollectionToStringList(systemPermissionsInfo.ChannelPermissions);
                        foreach (var channelPermission in channelPermissionList)
                        {
                            if (!list.Contains(channelPermission))
                            {
                                list.Add(channelPermission);
                            }
                        }
                    }
                }
            }

            return(dict);
        }
예제 #15
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _id = AuthRequest.GetQueryInt("id");

            if (IsPostBack)
            {
                return;
            }

            VerifyAdministratorPermissions(ConfigManager.SettingsPermissions.Utility);

            LtlPageTitle.Text = _id > 0 ? "修改API密钥" : "新增API密钥";

            foreach (var scope in AccessTokenManager.ScopeList)
            {
                CblScopes.Items.Add(new ListItem(scope, scope));
            }

            if (_id > 0)
            {
                var tokenInfo = DataProvider.AccessTokenDao.GetAccessTokenInfo(_id);

                TbTitle.Text = tokenInfo.Title;

                var scopes = TranslateUtils.StringCollectionToStringList(tokenInfo.Scopes);
                ControlUtils.SelectMultiItemsIgnoreCase(CblScopes, scopes);
            }
        }
예제 #16
0
파일: ContentUtility.cs 프로젝트: zxbe/cms
        public static Dictionary <int, List <int> > GetIDsDictionary(NameValueCollection queryString)
        {
            var dic = new Dictionary <int, List <int> >();

            if (!string.IsNullOrEmpty(queryString["IDsCollection"]))
            {
                foreach (var ids in TranslateUtils.StringCollectionToStringList(queryString["IDsCollection"]))
                {
                    var channelId     = TranslateUtils.ToIntWithNagetive(ids.Split('_')[0]);
                    var contentId     = TranslateUtils.ToInt(ids.Split('_')[1]);
                    var contentIdList = new List <int>();
                    if (dic.ContainsKey(channelId))
                    {
                        contentIdList = dic[channelId];
                    }
                    if (!contentIdList.Contains(contentId))
                    {
                        contentIdList.Add(contentId);
                    }

                    dic[channelId] = contentIdList;
                }
            }
            else
            {
                var channelId = TranslateUtils.ToInt(queryString["channelId"]);
                dic[channelId] = TranslateUtils.StringCollectionToIntList(queryString["contentIdCollection"]);
            }

            return(dic);
        }
예제 #17
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId", "channelId");
            var channelId = int.Parse(Body.GetQueryString("channelId"));

            _channelInfo = ChannelManager.GetChannelInfo(SiteId, channelId);

            if (IsPostBack)
            {
                return;
            }

            ECrossSiteTransTypeUtils.AddAllListItems(DdlTransType, SiteInfo.ParentId > 0);

            ControlUtils.SelectSingleItem(DdlTransType, ECrossSiteTransTypeUtils.GetValue(_channelInfo.Additional.TransType));

            DdlTransType_OnSelectedIndexChanged(null, EventArgs.Empty);
            ControlUtils.SelectSingleItem(DdlSiteId, _channelInfo.Additional.TransSiteId.ToString());


            DdlSiteId_OnSelectedIndexChanged(null, EventArgs.Empty);
            ControlUtils.SelectMultiItems(LbChannelId, TranslateUtils.StringCollectionToStringList(_channelInfo.Additional.TransChannelIds));
            TbNodeNames.Text = _channelInfo.Additional.TransChannelNames;

            EBooleanUtils.AddListItems(DdlIsAutomatic, "自动", "提示");
            ControlUtils.SelectSingleItemIgnoreCase(DdlIsAutomatic, _channelInfo.Additional.TransIsAutomatic.ToString());

            ETranslateContentTypeUtils.AddListItems(DdlTranslateDoneType, false);
            ControlUtils.SelectSingleItem(DdlTranslateDoneType, ETranslateContentTypeUtils.GetValue(_channelInfo.Additional.TransDoneType));
        }
예제 #18
0
        private static string ParseSelectMultiple(IAttributes attributes, TableStyleInfo styleInfo, StringBuilder extraBuilder)
        {
            if (styleInfo.Additional.IsValidate)
            {
                extraBuilder.Append(
                    $@"<span id=""{styleInfo.AttributeName}_msg"" style=""color:red;display:none;"">*</span><script>event_observe('{styleInfo.AttributeName}', 'blur', checkAttributeValue);</script>");
            }

            var builder    = new StringBuilder();
            var styleItems = styleInfo.StyleItems ?? DataProvider.TableStyleItemDao.GetStyleItemInfoList(styleInfo.Id);

            var selectedValues = TranslateUtils.StringCollectionToStringList(attributes.GetString(styleInfo.AttributeName));

            var validateAttributes = InputParserUtils.GetValidateAttributes(styleInfo.Additional.IsValidate, styleInfo.DisplayName, styleInfo.Additional.IsRequired, styleInfo.Additional.MinNum, styleInfo.Additional.MaxNum, styleInfo.Additional.ValidateType, styleInfo.Additional.RegExp, styleInfo.Additional.ErrorMessage);

            builder.Append($@"<select id=""{styleInfo.AttributeName}"" name=""{styleInfo.AttributeName}"" class=""form-control"" isListItem=""true"" multiple  {validateAttributes}>");

            foreach (var styleItem in styleItems)
            {
                var isSelected = selectedValues.Contains(styleItem.ItemValue);
                builder.Append($@"<option value=""{styleItem.ItemValue}"" {(isSelected ? "selected" : string.Empty)}>{styleItem.ItemTitle}</option>");
            }

            builder.Append("</select>");
            return(builder.ToString());
        }
예제 #19
0
        public void Delete(int siteId, string groupName)
        {
            var sqlString = $"DELETE FROM {TableName} WHERE GroupName = @GroupName AND SiteId = @SiteId";

            var groupParms = new IDataParameter[]
            {
                GetParameter(ParmGroupName, DataType.VarChar, 255, groupName),
                GetParameter(ParmSiteId, DataType.Integer, siteId)
            };

            ExecuteNonQuery(sqlString, groupParms);

            var channelIdList = ChannelManager.GetChannelIdList(ChannelManager.GetChannelInfo(siteId, siteId), EScopeType.All, groupName, string.Empty, string.Empty);

            foreach (var channelId in channelIdList)
            {
                var channelInfo   = ChannelManager.GetChannelInfo(siteId, channelId);
                var groupNameList = TranslateUtils.StringCollectionToStringList(channelInfo.GroupNameCollection);
                groupNameList.Remove(groupName);
                channelInfo.GroupNameCollection = TranslateUtils.ObjectCollectionToString(groupNameList);
                DataProvider.ChannelDao.Update(channelInfo);
            }

            ChannelGroupManager.ClearCache();
        }
예제 #20
0
        public static bool IsKeywordUpdateConflict(int publishmentSystemID, string keywordsNow, string keywordsUpdate, out string conflictKeywords)
        {
            var isConflict = false;
            conflictKeywords = string.Empty;

            if (keywordsNow != keywordsUpdate)
            {
                var keywordListNow = TranslateUtils.StringCollectionToStringList(keywordsNow, ' ');
                foreach (var str in TranslateUtils.StringCollectionToStringList(keywordsUpdate, ' '))
                {
                    var keyword = str.Trim();
                    if (!string.IsNullOrEmpty(keyword) && !keywordListNow.Contains(keyword))
                    {
                        if (DataProviderWx.KeywordMatchDao.IsExists(publishmentSystemID, keyword))
                        {
                            isConflict = true;
                            conflictKeywords += keyword + " ";
                        }
                    }
                }

                conflictKeywords = conflictKeywords.Trim();
            }

            return isConflict;
        }
        public List <string> GetGeneralPermissionList(IEnumerable <string> roles)
        {
            var list = new List <string>();

            if (roles == null)
            {
                return(list);
            }

            foreach (var roleName in roles)
            {
                var permissionsInRolesInfo = GetPermissionsInRolesInfo(roleName);
                if (permissionsInRolesInfo != null)
                {
                    var permissionList = TranslateUtils.StringCollectionToStringList(permissionsInRolesInfo.GeneralPermissions);
                    foreach (var permission in permissionList)
                    {
                        if (!list.Contains(permission))
                        {
                            list.Add(permission);
                        }
                    }
                }
            }

            return(list);
        }
        public Dictionary <int, List <string> > GetWebsitePermissionSortedList(IEnumerable <string> roles)
        {
            var sortedList = new Dictionary <int, List <string> >();

            if (roles == null)
            {
                return(sortedList);
            }

            foreach (var roleName in roles)
            {
                var systemPermissionsList = GetSystemPermissionsInfoList(roleName);
                foreach (var systemPermissionsInfo in systemPermissionsList)
                {
                    var list = new List <string>();
                    var websitePermissionList = TranslateUtils.StringCollectionToStringList(systemPermissionsInfo.WebsitePermissions);
                    foreach (var websitePermission in websitePermissionList)
                    {
                        if (!list.Contains(websitePermission))
                        {
                            list.Add(websitePermission);
                        }
                    }
                    sortedList[systemPermissionsInfo.SiteId] = list;
                }
            }

            return(sortedList);
        }
        public List <string> GetChannelPermissionListIgnoreChannelId(IList <string> roles)
        {
            var list = new List <string>();

            if (roles == null)
            {
                return(list);
            }

            foreach (var roleName in roles)
            {
                var systemPermissionsInfoList = GetSystemPermissionsInfoList(roleName);
                foreach (var systemPermissionsInfo in systemPermissionsInfoList)
                {
                    var channelPermissionList = TranslateUtils.StringCollectionToStringList(systemPermissionsInfo.ChannelPermissions);
                    foreach (var channelPermission in channelPermissionList)
                    {
                        if (!list.Contains(channelPermission))
                        {
                            list.Add(channelPermission);
                        }
                    }
                }
            }

            return(list);
        }
예제 #24
0
        public static List <ServiceImpl> GetContentPlugins(ChannelInfo channelInfo, bool includeContentTable)
        {
            var list      = new List <ServiceImpl>();
            var pluginIds = TranslateUtils.StringCollectionToStringList(channelInfo.ContentRelatedPluginIds);

            if (!string.IsNullOrEmpty(channelInfo.ContentModelPluginId))
            {
                pluginIds.Add(channelInfo.ContentModelPluginId);
            }

            foreach (var service in PluginManager.Services)
            {
                if (!pluginIds.Contains(service.PluginId))
                {
                    continue;
                }

                if (!includeContentTable && PluginContentTableManager.IsContentTable(service))
                {
                    continue;
                }

                list.Add(service);
            }

            return(list);
        }
예제 #25
0
        public Dictionary <int, List <string> > GetPermissionSortedList(string userName)
        {
            var sortedlist = new Dictionary <int, List <string> >();

            var permissionsInfoArrayList = GetPermissionsInfoArrayList(userName);

            foreach (GovInteractPermissionsInfo permissionsInfo in permissionsInfoArrayList)
            {
                var list = new List <string>();
                if (sortedlist[permissionsInfo.NodeID] != null)
                {
                    list = sortedlist[permissionsInfo.NodeID];
                }

                var permissionArrayList = TranslateUtils.StringCollectionToStringList(permissionsInfo.Permissions);
                foreach (string permission in permissionArrayList)
                {
                    if (!list.Contains(permission))
                    {
                        list.Add(permission);
                    }
                }
                sortedlist[permissionsInfo.NodeID] = list;
            }

            return(sortedlist);
        }
예제 #26
0
 private void ConfigSettings(bool isLoad)
 {
     if (isLoad)
     {
         if (!string.IsNullOrEmpty(PublishmentSystemInfo.Additional.ConfigExportType))
         {
             rblExportType.SelectedValue = PublishmentSystemInfo.Additional.ConfigExportType;
         }
         if (!string.IsNullOrEmpty(PublishmentSystemInfo.Additional.ConfigExportPeriods))
         {
             ddlPeriods.SelectedValue = PublishmentSystemInfo.Additional.ConfigExportPeriods;
         }
         if (!string.IsNullOrEmpty(PublishmentSystemInfo.Additional.ConfigExportDisplayAttributes))
         {
             var displayAttributes = TranslateUtils.StringCollectionToStringList(PublishmentSystemInfo.Additional.ConfigExportDisplayAttributes);
             ControlUtils.SelectListItems(cblDisplayAttributes, displayAttributes);
         }
         if (!string.IsNullOrEmpty(PublishmentSystemInfo.Additional.ConfigExportIsChecked))
         {
             ddlIsChecked.SelectedValue = PublishmentSystemInfo.Additional.ConfigExportIsChecked;
         }
     }
     else
     {
         PublishmentSystemInfo.Additional.ConfigExportType              = rblExportType.SelectedValue;
         PublishmentSystemInfo.Additional.ConfigExportPeriods           = ddlPeriods.SelectedValue;
         PublishmentSystemInfo.Additional.ConfigExportDisplayAttributes = ControlUtils.GetSelectedListControlValueCollection(cblDisplayAttributes);
         PublishmentSystemInfo.Additional.ConfigExportIsChecked         = ddlIsChecked.SelectedValue;
         DataProvider.PublishmentSystemDao.Update(PublishmentSystemInfo);
     }
 }
예제 #27
0
 private void ConfigSettings(bool isLoad)
 {
     if (isLoad)
     {
         if (!string.IsNullOrEmpty(SiteInfo.Additional.ConfigExportType))
         {
             DdlExportType.SelectedValue = SiteInfo.Additional.ConfigExportType;
         }
         if (!string.IsNullOrEmpty(SiteInfo.Additional.ConfigExportPeriods))
         {
             DdlPeriods.SelectedValue = SiteInfo.Additional.ConfigExportPeriods;
         }
         if (!string.IsNullOrEmpty(SiteInfo.Additional.ConfigExportDisplayAttributes))
         {
             var displayAttributes = TranslateUtils.StringCollectionToStringList(SiteInfo.Additional.ConfigExportDisplayAttributes);
             ControlUtils.SelectMultiItems(CblDisplayAttributes, displayAttributes);
         }
         if (!string.IsNullOrEmpty(SiteInfo.Additional.ConfigExportIsChecked))
         {
             DdlIsChecked.SelectedValue = SiteInfo.Additional.ConfigExportIsChecked;
         }
     }
     else
     {
         SiteInfo.Additional.ConfigExportType              = DdlExportType.SelectedValue;
         SiteInfo.Additional.ConfigExportPeriods           = DdlPeriods.SelectedValue;
         SiteInfo.Additional.ConfigExportDisplayAttributes = ControlUtils.GetSelectedListControlValueCollection(CblDisplayAttributes);
         SiteInfo.Additional.ConfigExportIsChecked         = DdlIsChecked.SelectedValue;
         DataProvider.SiteDao.Update(SiteInfo);
     }
 }
예제 #28
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (AuthRequest.IsQueryExists("Delete"))
            {
                var tagName = AuthRequest.GetQueryString("TagName");

                try
                {
                    var contentIdList = DataProvider.TagDao.GetContentIdListByTag(tagName, SiteId);
                    if (contentIdList.Count > 0)
                    {
                        foreach (var contentId in contentIdList)
                        {
                            var tuple = DataProvider.ContentDao.GetValue(SiteInfo.TableName, contentId, ContentAttribute.Tags);
                            if (tuple != null)
                            {
                                var contentTagList = TranslateUtils.StringCollectionToStringList(tuple.Item2);
                                contentTagList.Remove(tagName);
                                DataProvider.ContentDao.Update(SiteInfo.TableName, tuple.Item1, contentId, ContentAttribute.Tags, TranslateUtils.ObjectCollectionToString(contentTagList));
                            }
                        }
                    }
                    DataProvider.TagDao.DeleteTag(tagName, SiteId);
                    AuthRequest.AddSiteLog(SiteId, "删除内容标签", $"内容标签:{tagName}");
                    SuccessDeleteMessage();
                }
                catch (Exception ex)
                {
                    FailDeleteMessage(ex);
                }
            }

            SpContents.ControlToPaginate = RptContents;
            SpContents.ItemsPerPage      = SiteInfo.Additional.PageSize;

            SpContents.SelectCommand = DataProvider.TagDao.GetSqlString(SiteId, 0, true, 0);
            SpContents.SortField     = nameof(TagInfo.UseNum);
            SpContents.SortMode      = SortMode.DESC;

            RptContents.ItemDataBound += RptContents_ItemDataBound;

            if (IsPostBack)
            {
                return;
            }

            VerifySitePermissions(ConfigManager.SitePermissions.ConfigGroups);

            SpContents.DataBind();

            var showPopWinString = ModalContentTagAdd.GetOpenWindowStringToAdd(SiteId);

            BtnAddTag.Attributes.Add("onclick", showPopWinString);
        }
예제 #29
0
        public static DataSet GetContentsDataSource(SiteInfo siteInfo, int channelId, int contentId, string groupContent, string groupContentNot, string tags, bool isImageExists, bool isImage, bool isVideoExists, bool isVideo, bool isFileExists, bool isFile, bool isRelatedContents, int startNum, int totalNum, string orderByString, bool isTopExists, bool isTop, bool isRecommendExists, bool isRecommend, bool isHotExists, bool isHot, bool isColorExists, bool isColor, string where, EScopeType scopeType, string groupChannel, string groupChannelNot, NameValueCollection others)
        {
            if (!ChannelManager.IsExists(siteInfo.Id, channelId))
            {
                return(null);
            }

            var nodeInfo  = ChannelManager.GetChannelInfo(siteInfo.Id, channelId);
            var tableName = ChannelManager.GetTableName(siteInfo, nodeInfo);

            if (isRelatedContents && contentId > 0)
            {
                var tagCollection = StlContentCache.GetValue(tableName, contentId, ContentAttribute.Tags);
                if (!string.IsNullOrEmpty(tagCollection))
                {
                    var contentIdList = StlTagCache.GetContentIdListByTagCollection(TranslateUtils.StringCollectionToStringList(tagCollection), siteInfo.Id);
                    if (contentIdList.Count > 0)
                    {
                        contentIdList.Remove(contentId);

                        if (string.IsNullOrEmpty(where))
                        {
                            where =
                                $"ID IN ({TranslateUtils.ToSqlInStringWithoutQuote(contentIdList)})";
                        }
                        else
                        {
                            where +=
                                $" AND (ID IN ({TranslateUtils.ToSqlInStringWithoutQuote(contentIdList)}))";
                        }
                    }
                }
                else
                {
                    if (string.IsNullOrEmpty(where))
                    {
                        where = $"ID <> {contentId}";
                    }
                    else
                    {
                        where += $" AND (ID <> {contentId})";
                    }
                }
            }

            var sqlWhereString = PluginManager.IsExists(nodeInfo.ContentModelPluginId)
                ? StlContentCache.GetStlWhereString(siteInfo.Id, groupContent, groupContentNot,
                                                    tags, isTopExists, isTop, where)
                : StlContentCache.GetStlWhereString(siteInfo.Id, groupContent,
                                                    groupContentNot, tags, isImageExists, isImage, isVideoExists, isVideo, isFileExists, isFile,
                                                    isTopExists, isTop, isRecommendExists, isRecommend, isHotExists, isHot, isColorExists, isColor,
                                                    where);

            var channelIdList = ChannelManager.GetChannelIdList(nodeInfo, scopeType, groupChannel, groupChannelNot, string.Empty);

            return(StlContentCache.GetStlDataSourceChecked(channelIdList, tableName, startNum, totalNum, orderByString, sqlWhereString, others));
        }
예제 #30
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _isPreview = Body.GetQueryBool("IsPreview");

            if (IsPostBack)
            {
                return;
            }

            var inputId   = Body.GetQueryInt("InputID");
            var inputInfo = DataProvider.InputDao.GetInputInfo(inputId);

            if (inputInfo != null)
            {
                PhAdministratorSmsNotify.Visible = true;

                TbInputName.Text = inputInfo.InputName;
                ControlUtils.SelectListItems(RblIsChecked, inputInfo.IsChecked.ToString());
                ControlUtils.SelectListItems(RblIsReply, inputInfo.IsReply.ToString());
                ControlUtils.SelectListItems(RblIsAnomynous, inputInfo.Additional.IsAnomynous.ToString());

                ControlUtils.SelectListItems(RblIsAdministratorSmsNotify,
                                             inputInfo.Additional.IsAdministratorSmsNotify.ToString());
                TbAdministratorSmsNotifyTplId.Text = inputInfo.Additional.AdministratorSmsNotifyTplId;

                var keys = TranslateUtils.StringCollectionToStringList(inputInfo.Additional.AdministratorSmsNotifyKeys);
                CblAdministratorSmsNotifyKeys.Items.Add(new ListItem(InputContentAttribute.Id, InputContentAttribute.Id));
                CblAdministratorSmsNotifyKeys.Items.Add(new ListItem(InputContentAttribute.AddDate,
                                                                     InputContentAttribute.AddDate));
                var relatedIdentities = RelatedIdentities.GetRelatedIdentities(ETableStyle.InputContent,
                                                                               PublishmentSystemId, inputInfo.InputId);
                var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.InputContent,
                                                                            DataProvider.InputContentDao.TableName, relatedIdentities);
                foreach (var styleInfo in styleInfoList)
                {
                    CblAdministratorSmsNotifyKeys.Items.Add(new ListItem(styleInfo.AttributeName,
                                                                         styleInfo.AttributeName));
                }
                ControlUtils.SelectListItems(CblAdministratorSmsNotifyKeys, keys);

                TbAdministratorSmsNotifyMobile.Text = inputInfo.Additional.AdministratorSmsNotifyMobile;
            }
            else
            {
                PhAdministratorSmsNotify.Visible = false;
            }

            RblIsAdministratorSmsNotify_SelectedIndexChanged(null, EventArgs.Empty);
        }