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);
        }
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var fileNames = Request.Form["fileNames"];

            if (!string.IsNullOrEmpty(fileNames))
            {
                fileNames = fileNames.Trim('|');
                var builder = new StringBuilder();

                foreach (var fileName in fileNames.Split('|'))
                {
                    var filePath    = PathUtils.GetTemporaryFilesPath(fileName);
                    var wordContent = WordUtils.Parse(SiteId, filePath, CbIsClearFormat.Checked, CbIsFirstLineIndent.Checked, CbIsClearFontSize.Checked, CbIsClearFontFamily.Checked, CbIsClearImages.Checked);
                    wordContent = ContentUtility.TextEditorContentDecode(SiteInfo, wordContent, true);
                    builder.Append(wordContent);
                    FileUtils.DeleteFileIfExists(filePath);
                }
                var script = "parent." + UEditorUtils.GetInsertHtmlScript(_attributeName, builder.ToString());
                LayerUtils.CloseWithoutRefresh(Page, script);
            }
            else
            {
                FailMessage("请选择Word文件上传!");
            }
        }
Example #3
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var playUrl = TbPlayUrl.Text;

            var script = "parent." + ETextEditorTypeUtils.GetInsertAudioScript(_attributeName, playUrl, CbIsAutoPlay.Checked);

            LayerUtils.CloseWithoutRefresh(Page, script);
        }
 public void Submit_OnClick(object sender, EventArgs e)
 {
     if (Page.IsPostBack && Page.IsValid)
     {
         var departmentId   = Utils.ToInt(Request.Form["departmentId"]);
         var departmentName = DepartmentManager.GetDepartmentName(departmentId);
         LayerUtils.CloseWithoutRefresh(Page, $"parent.departmentSelect('{departmentName}', {departmentId})");
     }
 }
Example #5
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

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

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

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

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

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

                    var linkUrl = PageUtils.GetCmsUrl(SiteId, nameof(ModalChannelSelect), new NameValueCollection
                    {
                        { "channelId", nodeInfo.Id.ToString() },
                        { "isProtocol", _isProtocol.ToString() },
                        { "jsMethod", _jsMethod },
                        { "itemIndex", _itemIndex.ToString() }
                    });
                    LtlSite.Text = $"<a href='{linkUrl}'>{nodeInfo.ChannelName}</a>";
                    ClientScriptRegisterClientScriptBlock("NodeTreeScript", ChannelLoading.GetScript(SiteInfo, ELoadingType.ChannelSelect, null));
                    BindGrid();
                }
            }
        }
Example #6
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var displayAttributes = ControlUtils.SelectedItemsValueToStringCollection(CblDisplayAttributes.Items);

            if (!_isContent)
            {
                if (!_isList)
                {
                    if (CblDisplayAttributes.Items.Count == 0)
                    {
                        FailMessage("必须至少选择一项!");
                        return;
                    }
                    SiteInfo.Additional.ChannelEditAttributes = displayAttributes;

                    Body.AddSiteLog(SiteId, "设置栏目编辑项", $"编辑项:{displayAttributes}");
                }
                else
                {
                    if (!CompareUtils.Contains(displayAttributes, ChannelAttribute.ChannelName))
                    {
                        FailMessage("必须选择栏目名称项!");
                        return;
                    }
                    if (!CompareUtils.Contains(displayAttributes, ChannelAttribute.ChannelIndex))
                    {
                        FailMessage("必须选择栏目索引项!");
                        return;
                    }
                    SiteInfo.Additional.ChannelDisplayAttributes = displayAttributes;

                    Body.AddSiteLog(SiteId, "设置栏目显示项", $"显示项:{displayAttributes}");
                }
                DataProvider.SiteDao.Update(SiteInfo);
            }
            else
            {
                var nodeInfo            = ChannelManager.GetChannelInfo(SiteId, _relatedIdentity);
                var attributesOfDisplay = ControlUtils.SelectedItemsValueToStringCollection(CblDisplayAttributes.Items);
                nodeInfo.Additional.ContentAttributesOfDisplay = attributesOfDisplay;

                DataProvider.ChannelDao.Update(nodeInfo);

                Body.AddSiteLog(SiteId, "设置内容显示项", $"显示项:{attributesOfDisplay}");
            }

            if (!_isList)
            {
                LayerUtils.CloseWithoutRefresh(Page);
            }
            else
            {
                LayerUtils.Close(Page);
            }
        }
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var playUrl    = TbPlayUrl.Text;
            var isAutoPlay = CbIsAutoPlay.Checked;

            if (isAutoPlay != SiteInfo.Additional.ConfigUEditorAudioIsAutoPlay)
            {
                SiteInfo.Additional.ConfigUEditorAudioIsAutoPlay = isAutoPlay;
                DataProvider.SiteDao.Update(SiteInfo);
            }

            var script = "parent." + UEditorUtils.GetInsertAudioScript(_attributeName, playUrl, SiteInfo);

            LayerUtils.CloseWithoutRefresh(Page, script);
        }
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var width  = TranslateUtils.ToInt(TbWidth.Text);
            var height = TranslateUtils.ToInt(TbHeight.Text);

            if (width > 0 && height > 0 && (width != SiteInfo.Additional.ConfigVideoContentInsertWidth || height != SiteInfo.Additional.ConfigVideoContentInsertHeight))
            {
                SiteInfo.Additional.ConfigVideoContentInsertWidth  = width;
                SiteInfo.Additional.ConfigVideoContentInsertHeight = height;
                DataProvider.SiteDao.Update(SiteInfo);
            }

            var playUrl = TbPlayUrl.Text;

            var script = "parent." + ETextEditorTypeUtils.GetInsertVideoScript(_attributeName, playUrl, width, height, CbIsAutoPlay.Checked);

            LayerUtils.CloseWithoutRefresh(Page, script);
        }
Example #9
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var nodeInfo            = ChannelManager.GetChannelInfo(SiteId, _relatedIdentity);
            var attributesOfDisplay = ControlUtils.SelectedItemsValueToStringCollection(CblDisplayAttributes.Items);

            nodeInfo.Additional.ContentAttributesOfDisplay = attributesOfDisplay;

            DataProvider.ChannelDao.Update(nodeInfo);

            Body.AddSiteLog(SiteId, "设置内容显示项", $"显示项:{attributesOfDisplay}");

            if (!_isList)
            {
                LayerUtils.CloseWithoutRefresh(Page);
            }
            else
            {
                LayerUtils.Close(Page);
            }
        }
Example #10
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request.Form["IDsCollection"]))
            {
                var builder = new StringBuilder();
                foreach (var pair in TranslateUtils.StringCollectionToStringList(Request.Form["IDsCollection"]))
                {
                    var channelId = TranslateUtils.ToInt(pair.Split('_')[0]);
                    var contentId = TranslateUtils.ToInt(pair.Split('_')[1]);

                    var tableName = ChannelManager.GetTableName(SiteInfo, channelId);
                    var title     = DataProvider.ContentDao.GetValue(tableName, contentId, ContentAttribute.Title);
                    builder.Append($@"parent.{_jsMethod}('{title}', '{pair}');");
                }
                LayerUtils.CloseWithoutRefresh(Page, builder.ToString());
            }
            else
            {
                LayerUtils.CloseWithoutRefresh(Page);
            }
        }
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var playUrl    = TbPlayUrl.Text;
            var isImageUrl = CbIsImageUrl.Checked;
            var isAutoPlay = CbIsAutoPlay.Checked;
            var isWidth    = CbIsWidth.Checked;
            var isHeight   = CbIsHeight.Checked;
            var playBy     = DdlPlayBy.SelectedValue;
            var imageUrl   = TbImageUrl.Text;
            var width      = TranslateUtils.ToInt(TbWidth.Text);
            var height     = TranslateUtils.ToInt(TbHeight.Text);

            if (isImageUrl && string.IsNullOrEmpty(imageUrl))
            {
                FailMessage("请上传视频封面图片");
                return;
            }

            if (isImageUrl != SiteInfo.Additional.ConfigUEditorVideoIsImageUrl ||
                isAutoPlay != SiteInfo.Additional.ConfigUEditorVideoIsAutoPlay ||
                isWidth != SiteInfo.Additional.ConfigUEditorVideoIsWidth ||
                isHeight != SiteInfo.Additional.ConfigUEditorVideoIsHeight ||
                playBy != SiteInfo.Additional.ConfigUEditorVideoPlayBy ||
                width != SiteInfo.Additional.ConfigUEditorVideoWidth ||
                height != SiteInfo.Additional.ConfigUEditorVideoHeight)
            {
                SiteInfo.Additional.ConfigUEditorVideoIsImageUrl = isImageUrl;
                SiteInfo.Additional.ConfigUEditorVideoIsAutoPlay = isAutoPlay;
                SiteInfo.Additional.ConfigUEditorVideoIsWidth    = isWidth;
                SiteInfo.Additional.ConfigUEditorVideoIsHeight   = isHeight;
                SiteInfo.Additional.ConfigUEditorVideoPlayBy     = playBy;
                SiteInfo.Additional.ConfigUEditorVideoWidth      = width;
                SiteInfo.Additional.ConfigUEditorVideoHeight     = height;
                DataProvider.SiteDao.Update(SiteInfo);
            }

            var script = "parent." + UEditorUtils.GetInsertVideoScript(_attributeName, playUrl, imageUrl, SiteInfo);

            LayerUtils.CloseWithoutRefresh(Page, script);
        }
Example #12
0
        public void Page_Load(object sender, EventArgs e)
        {
            _departmentId = AuthRequest.GetQueryInt("departmentID");
            _scriptName   = AuthRequest.GetQueryString("ScriptName");
            var url = PageUtils.GetSettingsUrl(nameof(ModalAdminSelect), new NameValueCollection
            {
                { "scriptName", _scriptName }
            });

            _additional.Add("UrlFormatString", url);

            if (!IsPostBack)
            {
                LtlDepartment.Text = "管理员列表";
                if (AuthRequest.IsQueryExists("UserName"))
                {
                    var    userName    = AuthRequest.GetQueryString("UserName");
                    var    displayName = AdminManager.GetDisplayName(userName, true);
                    string scripts     = $"window.parent.{_scriptName}('{displayName}', '{userName}');";
                    LayerUtils.CloseWithoutRefresh(Page, scripts);
                }
                else if (AuthRequest.IsQueryExists("departmentID"))
                {
                    if (_departmentId > 0)
                    {
                        LtlDepartment.Text     = DepartmentManager.GetDepartmentName(_departmentId);
                        RptUser.DataSource     = DataProvider.AdministratorDao.GetUserNameList(_departmentId, false);
                        RptUser.ItemDataBound += RptUser_ItemDataBound;
                        RptUser.DataBind();
                    }
                }
                else
                {
                    ClientScriptRegisterClientScriptBlock("NodeTreeScript", DepartmentTreeItem.GetScript(EDepartmentLoadingType.DepartmentSelect, _additional));
                }
            }

            BindGrid();
        }
Example #13
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var checkedLevel = TranslateUtils.ToIntWithNagetive(DdlCheckType.SelectedValue);

            var isChecked = checkedLevel >= SiteInfo.Additional.CheckContentLevel;

            var contentInfoListToCheck = new List <ContentInfo>();
            var idsDictionaryToCheck   = new Dictionary <int, List <int> >();

            foreach (var channelId in _idsDictionary.Keys)
            {
                var channelInfo          = ChannelManager.GetChannelInfo(SiteInfo.Id, channelId);
                var contentIdList        = _idsDictionary[channelId];
                var contentIdListToCheck = new List <int>();

                int checkedLevelOfUser;
                var isCheckedOfUser = CheckManager.GetUserCheckLevel(AuthRequest.AdminPermissionsImpl, SiteInfo, channelId, out checkedLevelOfUser);

                foreach (var contentId in contentIdList)
                {
                    var contentInfo = ContentManager.GetContentInfo(SiteInfo, channelInfo, contentId);
                    if (contentInfo != null)
                    {
                        if (CheckManager.IsCheckable(contentInfo.IsChecked, contentInfo.CheckedLevel, isCheckedOfUser, checkedLevelOfUser))
                        {
                            contentInfoListToCheck.Add(contentInfo);
                            contentIdListToCheck.Add(contentId);
                        }

                        //DataProvider.ContentDao.Update(SiteInfo, channelInfo, contentInfo);

                        //CreateManager.CreateContent(SiteId, contentInfo.ChannelId, contentId);
                        //CreateManager.TriggerContentChangedEvent(SiteId, contentInfo.ChannelId);
                    }
                }
                if (contentIdListToCheck.Count > 0)
                {
                    idsDictionaryToCheck[channelId] = contentIdListToCheck;
                }
            }

            if (contentInfoListToCheck.Count == 0)
            {
                LayerUtils.CloseWithoutRefresh(Page, "alert('您的审核权限不足,无法审核所选内容!');");
                return;
            }

            var translateChannelId = TranslateUtils.ToInt(DdlTranslateChannelId.SelectedValue);

            foreach (var channelId in idsDictionaryToCheck.Keys)
            {
                var tableName     = ChannelManager.GetTableName(SiteInfo, channelId);
                var contentIdList = idsDictionaryToCheck[channelId];
                DataProvider.ContentDao.UpdateIsChecked(tableName, SiteId, channelId, contentIdList, translateChannelId, AuthRequest.AdminName, isChecked, checkedLevel, TbCheckReasons.Text);
            }

            if (translateChannelId > 0)
            {
                var tableName = ChannelManager.GetTableName(SiteInfo, translateChannelId);
                ContentManager.RemoveCache(tableName, translateChannelId);
            }

            AuthRequest.AddSiteLog(SiteId, SiteId, 0, "设置内容状态为" + DdlCheckType.SelectedItem.Text, TbCheckReasons.Text);

            foreach (var channelId in idsDictionaryToCheck.Keys)
            {
                var contentIdList = _idsDictionary[channelId];
                if (contentIdList != null)
                {
                    foreach (var contentId in contentIdList)
                    {
                        CreateManager.CreateContent(SiteId, channelId, contentId);
                        CreateManager.TriggerContentChangedEvent(SiteId, channelId);
                    }
                }
            }

            LayerUtils.CloseAndRedirect(Page, _returnUrl);
        }
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

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

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

            if (IsPostBack)
            {
                return;
            }

            PhSiteId.Visible = _isSiteSelect;

            var siteIdList = ProductPermissionsManager.Current.SiteIdList;

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

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

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

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

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

                RptChannel.DataSource     = DataProvider.ChannelDao.GetIdListByParentId(_targetSiteId, _targetSiteId);
                RptChannel.ItemDataBound += RptChannel_ItemDataBound;
                RptChannel.DataBind();
            }
        }
Example #15
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var checkedLevel = TranslateUtils.ToIntWithNagetive(DdlCheckType.SelectedValue);

            var isChecked = checkedLevel >= SiteInfo.Additional.CheckContentLevel;

            var contentInfoArrayListToCheck = new List <ContentInfo>();
            var idsDictionaryToCheck        = new Dictionary <int, List <int> >();

            foreach (var channelId in _idsDictionary.Keys)
            {
                var tableName            = ChannelManager.GetTableName(SiteInfo, channelId);
                var contentIdList        = _idsDictionary[channelId];
                var contentIdListToCheck = new List <int>();

                int checkedLevelOfUser;
                var isCheckedOfUser = CheckManager.GetUserCheckLevel(Body.AdminName, SiteInfo, channelId, out checkedLevelOfUser);

                foreach (var contentId in contentIdList)
                {
                    var contentInfo = DataProvider.ContentDao.GetContentInfo(tableName, contentId);
                    if (contentInfo != null)
                    {
                        if (CheckManager.IsCheckable(SiteInfo, contentInfo.ChannelId, contentInfo.IsChecked, contentInfo.CheckedLevel, isCheckedOfUser, checkedLevelOfUser))
                        {
                            contentInfoArrayListToCheck.Add(contentInfo);
                            contentIdListToCheck.Add(contentId);
                        }

                        DataProvider.ContentDao.Update(tableName, SiteInfo, contentInfo);

                        if (contentInfo.IsChecked)
                        {
                            CreateManager.CreateContentAndTrigger(SiteId, contentInfo.ChannelId, contentId);
                        }
                    }
                }
                if (contentIdListToCheck.Count > 0)
                {
                    idsDictionaryToCheck[channelId] = contentIdListToCheck;
                }
            }

            if (contentInfoArrayListToCheck.Count == 0)
            {
                LayerUtils.CloseWithoutRefresh(Page, "alert('您的审核权限不足,无法审核所选内容!');");
            }
            else
            {
                try
                {
                    var translateChannelId = TranslateUtils.ToInt(DdlTranslateChannelId.SelectedValue);

                    foreach (var channelId in idsDictionaryToCheck.Keys)
                    {
                        var tableName     = ChannelManager.GetTableName(SiteInfo, channelId);
                        var contentIdList = idsDictionaryToCheck[channelId];
                        DataProvider.ContentDao.UpdateIsChecked(tableName, SiteId, channelId, contentIdList, translateChannelId, true, Body.AdminName, isChecked, checkedLevel, TbCheckReasons.Text);

                        DataProvider.ChannelDao.UpdateContentNum(SiteInfo, channelId, true);
                    }

                    if (translateChannelId > 0)
                    {
                        DataProvider.ChannelDao.UpdateContentNum(SiteInfo, translateChannelId, true);
                    }

                    Body.AddSiteLog(SiteId, SiteId, 0, "设置内容状态为" + DdlCheckType.SelectedItem.Text, TbCheckReasons.Text);

                    if (isChecked)
                    {
                        foreach (var channelId in idsDictionaryToCheck.Keys)
                        {
                            var contentIdList = _idsDictionary[channelId];
                            if (contentIdList != null)
                            {
                                foreach (var contentId in contentIdList)
                                {
                                    CreateManager.CreateContent(SiteId, channelId, contentId);
                                }
                            }
                        }
                    }

                    LayerUtils.CloseAndRedirect(Page, _returnUrl);
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "操作失败!");
                }
            }
        }
Example #16
0
        private void Save(bool isClose)
        {
            var isSuccess    = false;
            var errorMessage = string.Empty;

            var content = TranslateUtils.ToBool(DdlIsPureText.SelectedValue) ? TbFileContent.Text : UeFileContent.Text;

            if (_isCreate == false)
            {
                var fileExtName = PathUtils.GetExtension(_theFileName);
                if (!PathUtility.IsFileExtenstionAllowed(SiteInfo, fileExtName))
                {
                    FailMessage("此格式不允许创建,请选择有效的文件名");
                    return;
                }

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

                try
                {
                    try
                    {
                        if (!string.IsNullOrEmpty(DdlCharset.SelectedValue))
                        {
                            _fileCharset = ECharsetUtils.GetEnumType(DdlCharset.SelectedValue);
                        }
                        FileUtils.WriteText(filePath, _fileCharset, content);
                    }
                    catch
                    {
                        FileUtils.RemoveReadOnlyAndHiddenIfExists(filePath);
                        FileUtils.WriteText(filePath, _fileCharset, content);
                    }

                    AuthRequest.AddSiteLog(SiteId, "新建文件", $"文件名:{_theFileName}");

                    isSuccess = true;
                }
                catch (Exception ex)
                {
                    errorMessage = ex.Message;
                }
            }
            else
            {
                var fileExtName = PathUtils.GetExtension(TbFileName.Text);
                if (!PathUtility.IsFileExtenstionAllowed(SiteInfo, fileExtName))
                {
                    FailMessage("此格式不允许创建,请选择有效的文件名");
                    return;
                }

                var filePath = SiteInfo != null
                    ? PathUtility.MapPath(SiteInfo, PathUtils.Combine(_relatedPath, TbFileName.Text))
                    : PathUtils.MapPath(PathUtils.Combine(_relatedPath, TbFileName.Text));

                if (FileUtils.IsFileExists(filePath))
                {
                    errorMessage = "文件名已存在!";
                }
                else
                {
                    try
                    {
                        try
                        {
                            FileUtils.WriteText(filePath, _fileCharset, content);
                        }
                        catch
                        {
                            FileUtils.RemoveReadOnlyAndHiddenIfExists(filePath);
                            FileUtils.WriteText(filePath, _fileCharset, content);
                        }
                        AuthRequest.AddSiteLog(SiteId, "编辑文件", $"文件名:{_theFileName}");
                        isSuccess = true;
                    }
                    catch (Exception ex)
                    {
                        errorMessage = ex.Message;
                    }
                }
            }

            if (isSuccess)
            {
                if (isClose)
                {
                    if (_isCreate)
                    {
                        LayerUtils.Close(Page);
                    }
                    else
                    {
                        LayerUtils.CloseWithoutRefresh(Page);
                    }
                }
                else
                {
                    SuccessMessage("文件保存成功!");
                }
            }
            else
            {
                FailMessage(errorMessage);
            }
        }
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            string scripts = $"window.parent.document.all.{_textBoxClientId}.value = '{TbRule.Text}';";

            LayerUtils.CloseWithoutRefresh(Page, scripts);
        }
Example #18
0
 public void Cancel_OnClick(object sender, EventArgs e)
 {
     LayerUtils.CloseWithoutRefresh(Page);
 }