public int Insert(TemplateInfo templateInfo, string templateContent, string administratorName) { if (templateInfo.IsDefault) { SetAllTemplateDefaultToFalse(templateInfo.SiteId, templateInfo.TemplateType); } var sqlInsertTemplate = "INSERT INTO siteserver_Template (SiteId, TemplateName, TemplateType, RelatedFileName, CreatedFileFullName, CreatedFileExtName, Charset, IsDefault) VALUES (@SiteId, @TemplateName, @TemplateType, @RelatedFileName, @CreatedFileFullName, @CreatedFileExtName, @Charset, @IsDefault)"; var insertParms = new IDataParameter[] { GetParameter(ParmSiteId, DataType.Integer, templateInfo.SiteId), GetParameter(ParmTemplateName, DataType.VarChar, 50, templateInfo.TemplateName), GetParameter(ParmTemplateType, DataType.VarChar, 50, templateInfo.TemplateType.Value), GetParameter(ParmRelatedFileName, DataType.VarChar, 50, templateInfo.RelatedFileName), GetParameter(ParmCreatedFileFullName, DataType.VarChar, 50, templateInfo.CreatedFileFullName), GetParameter(ParmCreatedFileExtName, DataType.VarChar, 50, templateInfo.CreatedFileExtName), GetParameter(ParmCharset, DataType.VarChar, 50, ECharsetUtils.GetValue(templateInfo.Charset)), GetParameter(ParmIsDefault, DataType.VarChar, 18, templateInfo.IsDefault.ToString()) }; var id = ExecuteNonQueryAndReturnId(TableName, nameof(TemplateInfo.Id), sqlInsertTemplate, insertParms); var siteInfo = SiteManager.GetSiteInfo(templateInfo.SiteId); TemplateManager.WriteContentToTemplateFile(siteInfo, templateInfo, templateContent, administratorName); TemplateManager.RemoveCache(templateInfo.SiteId); return(id); }
public void Update(SiteInfo siteInfo, TemplateInfo templateInfo, string templateContent, string administratorName) { if (templateInfo.IsDefault) { SetAllTemplateDefaultToFalse(siteInfo.Id, templateInfo.TemplateType); } var updateParms = new IDataParameter[] { GetParameter(ParmTemplateName, DataType.VarChar, 50, templateInfo.TemplateName), GetParameter(ParmTemplateType, DataType.VarChar, 50, templateInfo.TemplateType.Value), GetParameter(ParmRelatedFileName, DataType.VarChar, 50, templateInfo.RelatedFileName), GetParameter(ParmCreatedFileFullName, DataType.VarChar, 50, templateInfo.CreatedFileFullName), GetParameter(ParmCreatedFileExtName, DataType.VarChar, 50, templateInfo.CreatedFileExtName), GetParameter(ParmCharset, DataType.VarChar, 50, ECharsetUtils.GetValue(templateInfo.Charset)), GetParameter(ParmIsDefault, DataType.VarChar, 18, templateInfo.IsDefault.ToString()), GetParameter(ParmId, DataType.Integer, templateInfo.Id) }; ExecuteNonQuery(SqlUpdateTemplate, updateParms); TemplateManager.WriteContentToTemplateFile(siteInfo, templateInfo, templateContent, administratorName); TemplateManager.RemoveCache(templateInfo.SiteId); }
public void Insert(GatherFileRuleInfo gatherFileRuleInfo) { var insertParms = new IDataParameter[] { GetParameter(ParmGatherFileRuleName, EDataType.NVarChar, 50, gatherFileRuleInfo.GatherRuleName), GetParameter(ParmPublishmentSystemId, EDataType.Integer, gatherFileRuleInfo.PublishmentSystemId), GetParameter(ParmGatherUrl, EDataType.NVarChar, 255, gatherFileRuleInfo.GatherUrl), GetParameter(ParmCharset, EDataType.VarChar, 50, ECharsetUtils.GetValue(gatherFileRuleInfo.Charset)), GetParameter(ParmLastGatherDate, EDataType.DateTime, gatherFileRuleInfo.LastGatherDate), GetParameter(ParmIsToFile, EDataType.VarChar, 18, gatherFileRuleInfo.IsToFile.ToString()), GetParameter(ParmFilePath, EDataType.NVarChar, 255, gatherFileRuleInfo.FilePath), GetParameter(ParmIsSaveRelatedFiles, EDataType.VarChar, 18, gatherFileRuleInfo.IsSaveRelatedFiles.ToString()), GetParameter(ParmIsRemoveScripts, EDataType.VarChar, 18, gatherFileRuleInfo.IsRemoveScripts.ToString()), GetParameter(ParmStyleDirectoryPath, EDataType.NVarChar, 255, gatherFileRuleInfo.StyleDirectoryPath), GetParameter(ParmScriptDirectoryPath, EDataType.NVarChar, 255, gatherFileRuleInfo.ScriptDirectoryPath), GetParameter(ParmImageDirectoryPath, EDataType.NVarChar, 255, gatherFileRuleInfo.ImageDirectoryPath), GetParameter(ParmNodeId, EDataType.Integer, gatherFileRuleInfo.NodeId), GetParameter(ParmIsSaveImage, EDataType.VarChar, 18, gatherFileRuleInfo.IsSaveImage.ToString()), GetParameter(ParmIsChecked, EDataType.VarChar, 18, gatherFileRuleInfo.IsChecked.ToString()), GetParameter(ParmContentExclude, EDataType.NText, gatherFileRuleInfo.ContentExclude), GetParameter(ParmContentHtmlClearCollection, EDataType.NVarChar, 255, gatherFileRuleInfo.ContentHtmlClearCollection), GetParameter(ParmContentHtmlClearTagCollection, EDataType.NVarChar, 255, gatherFileRuleInfo.ContentHtmlClearTagCollection), GetParameter(ParmContentTitleStart, EDataType.NText, gatherFileRuleInfo.ContentTitleStart), GetParameter(ParmContentTitleEnd, EDataType.NText, gatherFileRuleInfo.ContentTitleEnd), GetParameter(ParmContentContentStart, EDataType.NText, gatherFileRuleInfo.ContentContentStart), GetParameter(ParmContentContentEnd, EDataType.NText, gatherFileRuleInfo.ContentContentEnd), GetParameter(ParmContentAttributes, EDataType.NText, gatherFileRuleInfo.ContentAttributes), GetParameter(ParmContentAttributesXml, EDataType.NText, gatherFileRuleInfo.ContentAttributesXml), GetParameter(ParmIsAutoCreate, EDataType.VarChar, 18, gatherFileRuleInfo.IsAutoCreate.ToString()) }; ExecuteNonQuery(SqlInsertGatherFileRule, insertParms); }
public IHttpActionResult Submit() { try { var request = new AuthenticatedRequest(); var siteId = request.SiteId; if (!request.IsAdminLoggin || !request.AdminPermissionsImpl.HasSitePermissions(siteId, ConfigManager.SitePermissions.ConfigSite)) { return(Unauthorized()); } var siteInfo = SiteManager.GetSiteInfo(siteId); var siteName = request.GetPostString("siteName"); var charset = ECharsetUtils.GetEnumType(request.GetPostString("charset")); var pageSize = request.GetPostInt("pageSize", siteInfo.Additional.PageSize); var isCreateDoubleClick = request.GetPostBool("isCreateDoubleClick"); siteInfo.SiteName = siteName; siteInfo.Additional.Charset = ECharsetUtils.GetValue(charset); siteInfo.Additional.PageSize = pageSize; siteInfo.Additional.IsCreateDoubleClick = isCreateDoubleClick; //修改所有模板编码 var templateInfoList = DataProvider.TemplateDao.GetTemplateInfoListBySiteId(siteId); foreach (var templateInfo in templateInfoList) { if (templateInfo.Charset == charset) { continue; } var templateContent = TemplateManager.GetTemplateContent(siteInfo, templateInfo); templateInfo.Charset = charset; DataProvider.TemplateDao.Update(siteInfo, templateInfo, templateContent, request.AdminName); } DataProvider.SiteDao.Update(siteInfo); request.AddSiteLog(siteId, "修改站点设置"); return(Ok(new { Value = siteInfo, Config = siteInfo.Additional, })); } catch (Exception ex) { return(InternalServerError(ex)); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId"); if (AuthRequest.IsQueryExists("FileName")) { _fileName = AuthRequest.GetQueryString("FileName"); _fileName = PathUtils.RemoveParentPath(_fileName); } _directoryPath = PathUtility.MapPath(SiteInfo, "@/include"); if (IsPostBack) { return; } VerifySitePermissions(ConfigManager.WebSitePermissions.Template); LtlPageTitle.Text = string.IsNullOrEmpty(_fileName) ? "添加包含文件" : "编辑包含文件"; var isCodeMirror = SiteInfo.Additional.ConfigTemplateIsCodeMirror; BtnEditorType.Text = isCodeMirror ? "采用纯文本编辑模式" : "采用代码编辑模式"; PhCodeMirror.Visible = isCodeMirror; ECharsetUtils.AddListItems(DdlCharset); if (_fileName != null) { if (!EFileSystemTypeUtils.IsHtml(PathUtils.GetExtension(_fileName))) { PageUtils.RedirectToErrorPage("对不起,此文件无法编辑!"); } else { TbRelatedFileName.Text = PathUtils.RemoveExtension(_fileName); LtlCreatedFileExtName.Text = PathUtils.GetExtension(_fileName); var fileCharset = FileUtils.GetFileCharset(PathUtils.Combine(_directoryPath, _fileName)); ControlUtils.SelectSingleItemIgnoreCase(DdlCharset, ECharsetUtils.GetValue(fileCharset)); TbContent.Text = FileUtils.ReadText(PathUtils.Combine(_directoryPath, _fileName), fileCharset); } } else { LtlCreatedFileExtName.Text = ".html"; ControlUtils.SelectSingleItemIgnoreCase(DdlCharset, SiteInfo.Additional.Charset); } }
public int Insert(TemplateInfo templateInfo, string templateContent, string administratorName) { int templateId; if (templateInfo.IsDefault) { SetAllTemplateDefaultToFalse(templateInfo.PublishmentSystemId, templateInfo.TemplateType); } var sqlInsertTemplate = "INSERT INTO siteserver_Template (PublishmentSystemID, TemplateName, TemplateType, RelatedFileName, CreatedFileFullName, CreatedFileExtName, Charset, IsDefault) VALUES (@PublishmentSystemID, @TemplateName, @TemplateType, @RelatedFileName, @CreatedFileFullName, @CreatedFileExtName, @Charset, @IsDefault)"; var insertParms = new IDataParameter[] { GetParameter(ParmPublishmentSystemId, EDataType.Integer, templateInfo.PublishmentSystemId), GetParameter(ParmTemplateName, EDataType.NVarChar, 50, templateInfo.TemplateName), GetParameter(ParmTemplateType, EDataType.VarChar, 50, ETemplateTypeUtils.GetValue(templateInfo.TemplateType)), GetParameter(ParmRelatedFileName, EDataType.NVarChar, 50, templateInfo.RelatedFileName), GetParameter(ParmCreatedFileFullName, EDataType.NVarChar, 50, templateInfo.CreatedFileFullName), GetParameter(ParmCreatedFileExtName, EDataType.VarChar, 50, templateInfo.CreatedFileExtName), GetParameter(ParmCharset, EDataType.VarChar, 50, ECharsetUtils.GetValue(templateInfo.Charset)), GetParameter(ParmIsDefault, EDataType.VarChar, 18, templateInfo.IsDefault.ToString()) }; using (var conn = GetConnection()) { conn.Open(); using (var trans = conn.BeginTransaction()) { try { templateId = ExecuteNonQueryAndReturnId(trans, sqlInsertTemplate, insertParms); trans.Commit(); } catch { trans.Rollback(); throw; } } } var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(templateInfo.PublishmentSystemId); TemplateManager.WriteContentToTemplateFile(publishmentSystemInfo, templateInfo, templateContent, administratorName); TemplateManager.RemoveCache(templateInfo.PublishmentSystemId); return(templateId); }
public static string GetParameters(int publishmentSystemId, string ajaxDivId, int pageNum, bool isHighlight, bool isRedirectSingle, bool isDefaultDisplay, string dateAttribute, ECharset charset, string template) { return($@" {{ publishmentSystemId: '{publishmentSystemId}', ajaxDivId: '{ajaxDivId}', pageNum: {pageNum}, isHighlight: {isHighlight.ToString().ToLower()}, isRedirectSingle: {isRedirectSingle.ToString().ToLower()}, isDefaultDisplay: {isDefaultDisplay.ToString().ToLower()}, dateAttribute: '{dateAttribute}', charset: '{ECharsetUtils.GetValue(charset)}', template: '{TranslateUtils.EncryptStringBySecretKey(template)}' }}"); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID"); if (Body.IsQueryExists("FileName")) { fileName = Body.GetQueryString("FileName"); fileName = PathUtils.RemoveParentPath(fileName); } directoryPath = PathUtility.MapPath(PublishmentSystemInfo, "@/js"); if (!IsPostBack) { var pageTitle = string.IsNullOrEmpty(fileName) ? "添加脚本文件" : "编辑脚本文件"; BreadCrumb(AppManager.Cms.LeftMenu.IdTemplate, pageTitle, AppManager.Cms.Permission.WebSite.Template); ltlPageTitle.Text = pageTitle; ECharsetUtils.AddListItems(Charset); if (fileName != null) { if (!EFileSystemTypeUtils.IsJs(PathUtils.GetExtension(fileName))) { PageUtils.RedirectToErrorPage("对不起,此文件无法编辑!"); } else { RelatedFileName.Text = PathUtils.RemoveExtension(fileName); ltlCreatedFileExtName.Text = PathUtils.GetExtension(fileName); var fileCharset = FileUtils.GetFileCharset(PathUtils.Combine(directoryPath, fileName)); ControlUtils.SelectListItemsIgnoreCase(Charset, ECharsetUtils.GetValue(fileCharset)); Content.Text = FileUtils.ReadText(PathUtils.Combine(directoryPath, fileName), fileCharset); } } else { ltlCreatedFileExtName.Text = ".js"; ControlUtils.SelectListItemsIgnoreCase(Charset, PublishmentSystemInfo.Additional.Charset); } } }
public void Insert(GatherRuleInfo gatherRuleInfo) { var insertParms = new IDataParameter[] { GetParameter(ParmGatherRuleName, EDataType.NVarChar, 50, gatherRuleInfo.GatherRuleName), GetParameter(ParmPublishmentSystemId, EDataType.Integer, gatherRuleInfo.PublishmentSystemId), GetParameter(ParmCookieString, EDataType.Text, gatherRuleInfo.CookieString), GetParameter(ParmGatherUrlIsCollection, EDataType.VarChar, 18, gatherRuleInfo.GatherUrlIsCollection.ToString()), GetParameter(ParmGatherUrlCollection, EDataType.Text, gatherRuleInfo.GatherUrlCollection), GetParameter(ParmGatherUrlIsSerialize, EDataType.VarChar, 18, gatherRuleInfo.GatherUrlIsSerialize.ToString()), GetParameter(ParmGatherUrlSerialize, EDataType.VarChar, 200, gatherRuleInfo.GatherUrlSerialize), GetParameter(ParmGatherSerializeFrom, EDataType.Integer, gatherRuleInfo.SerializeFrom), GetParameter(ParmGatherSerializeTo, EDataType.Integer, gatherRuleInfo.SerializeTo), GetParameter(ParmGatherSerializeInternal, EDataType.Integer, gatherRuleInfo.SerializeInterval), GetParameter(ParmGatherSerializeOrderByDesc, EDataType.VarChar, 18, gatherRuleInfo.SerializeIsOrderByDesc.ToString()), GetParameter(ParmGatherSerializeIsAddZero, EDataType.VarChar, 18, gatherRuleInfo.SerializeIsAddZero.ToString()), GetParameter(ParmNodeId, EDataType.Integer, gatherRuleInfo.NodeId), GetParameter(ParmCharset, EDataType.VarChar, 50, ECharsetUtils.GetValue(gatherRuleInfo.Charset)), GetParameter(ParmUrlInclude, EDataType.VarChar, 200, gatherRuleInfo.UrlInclude), GetParameter(ParmTitleInclude, EDataType.NVarChar, 255, gatherRuleInfo.TitleInclude), GetParameter(ParmContentExclude, EDataType.NText, gatherRuleInfo.ContentExclude), GetParameter(ParmContentHtmlClearCollection, EDataType.NVarChar, 255, gatherRuleInfo.ContentHtmlClearCollection), GetParameter(ParmContentHtmlClearTagCollection, EDataType.NVarChar, 255, gatherRuleInfo.ContentHtmlClearTagCollection), GetParameter(ParmLastGatherDate, EDataType.DateTime, gatherRuleInfo.LastGatherDate), GetParameter(ParmListAreaStart, EDataType.NText, gatherRuleInfo.ListAreaStart), GetParameter(ParmListAreaEnd, EDataType.NText, gatherRuleInfo.ListAreaEnd), GetParameter(ParmListContentChannelStart, EDataType.NText, gatherRuleInfo.ContentChannelStart), GetParameter(ParmListContentChannelEnd, EDataType.NText, gatherRuleInfo.ContentChannelEnd), GetParameter(ParmContentTitleStart, EDataType.NText, gatherRuleInfo.ContentTitleStart), GetParameter(ParmContentTitleEnd, EDataType.NText, gatherRuleInfo.ContentTitleEnd), GetParameter(ParmContentContentStart, EDataType.NText, gatherRuleInfo.ContentContentStart), GetParameter(ParmContentContentEnd, EDataType.NText, gatherRuleInfo.ContentContentEnd), GetParameter(ParmContentNextPageStart, EDataType.NText, gatherRuleInfo.ContentNextPageStart), GetParameter(ParmContentNextPageEnd, EDataType.NText, gatherRuleInfo.ContentNextPageEnd), GetParameter(ParmContentAttributes, EDataType.NText, gatherRuleInfo.ContentAttributes), GetParameter(ParmContentAttributesXml, EDataType.NText, gatherRuleInfo.ContentAttributesXml), GetParameter(ParmExtendValues, EDataType.NText, gatherRuleInfo.Additional.ToString()) }; ExecuteNonQuery(SqlInsertGatherRule, insertParms); }
private static AtomEntry ExportGatherRuleInfo(GatherRuleInfo gatherRuleInfo) { var entry = AtomUtility.GetEmptyEntry(); AtomUtility.AddDcElement(entry.AdditionalElements, "GatherRuleName", gatherRuleInfo.GatherRuleName); AtomUtility.AddDcElement(entry.AdditionalElements, "PublishmentSystemID", gatherRuleInfo.PublishmentSystemId.ToString()); AtomUtility.AddDcElement(entry.AdditionalElements, "CookieString", AtomUtility.Encrypt(gatherRuleInfo.CookieString)); //加密 AtomUtility.AddDcElement(entry.AdditionalElements, "GatherUrlIsCollection", gatherRuleInfo.GatherUrlIsCollection.ToString()); AtomUtility.AddDcElement(entry.AdditionalElements, "GatherUrlCollection", gatherRuleInfo.GatherUrlCollection); AtomUtility.AddDcElement(entry.AdditionalElements, "GatherUrlIsSerialize", gatherRuleInfo.GatherUrlIsSerialize.ToString()); AtomUtility.AddDcElement(entry.AdditionalElements, "GatherUrlSerialize", gatherRuleInfo.GatherUrlSerialize); AtomUtility.AddDcElement(entry.AdditionalElements, "SerializeFrom", gatherRuleInfo.SerializeFrom.ToString()); AtomUtility.AddDcElement(entry.AdditionalElements, "SerializeTo", gatherRuleInfo.SerializeTo.ToString()); AtomUtility.AddDcElement(entry.AdditionalElements, "SerializeInterval", gatherRuleInfo.SerializeInterval.ToString()); AtomUtility.AddDcElement(entry.AdditionalElements, "SerializeIsOrderByDesc", gatherRuleInfo.SerializeIsOrderByDesc.ToString()); AtomUtility.AddDcElement(entry.AdditionalElements, "SerializeIsAddZero", gatherRuleInfo.SerializeIsAddZero.ToString()); AtomUtility.AddDcElement(entry.AdditionalElements, "NodeID", gatherRuleInfo.NodeId.ToString()); AtomUtility.AddDcElement(entry.AdditionalElements, "Charset", ECharsetUtils.GetValue(gatherRuleInfo.Charset)); AtomUtility.AddDcElement(entry.AdditionalElements, "UrlInclude", gatherRuleInfo.UrlInclude); AtomUtility.AddDcElement(entry.AdditionalElements, "TitleInclude", gatherRuleInfo.TitleInclude); AtomUtility.AddDcElement(entry.AdditionalElements, "ContentExclude", AtomUtility.Encrypt(gatherRuleInfo.ContentExclude)); //加密 AtomUtility.AddDcElement(entry.AdditionalElements, "ContentHtmlClearCollection", gatherRuleInfo.ContentHtmlClearCollection); AtomUtility.AddDcElement(entry.AdditionalElements, "ContentHtmlClearTagCollection", gatherRuleInfo.ContentHtmlClearTagCollection); AtomUtility.AddDcElement(entry.AdditionalElements, "LastGatherDate", gatherRuleInfo.LastGatherDate.ToLongDateString()); AtomUtility.AddDcElement(entry.AdditionalElements, "ListAreaStart", AtomUtility.Encrypt(gatherRuleInfo.ListAreaStart)); //加密 AtomUtility.AddDcElement(entry.AdditionalElements, "ListAreaEnd", AtomUtility.Encrypt(gatherRuleInfo.ListAreaEnd)); //加密 AtomUtility.AddDcElement(entry.AdditionalElements, "ContentChannelStart", AtomUtility.Encrypt(gatherRuleInfo.ContentChannelStart)); //加密 AtomUtility.AddDcElement(entry.AdditionalElements, "ContentChannelEnd", AtomUtility.Encrypt(gatherRuleInfo.ContentChannelEnd)); //加密 AtomUtility.AddDcElement(entry.AdditionalElements, "ContentTitleStart", AtomUtility.Encrypt(gatherRuleInfo.ContentTitleStart)); //加密 AtomUtility.AddDcElement(entry.AdditionalElements, "ContentTitleEnd", AtomUtility.Encrypt(gatherRuleInfo.ContentTitleEnd)); //加密 AtomUtility.AddDcElement(entry.AdditionalElements, "ContentContentStart", AtomUtility.Encrypt(gatherRuleInfo.ContentContentStart)); //加密 AtomUtility.AddDcElement(entry.AdditionalElements, "ContentContentEnd", AtomUtility.Encrypt(gatherRuleInfo.ContentContentEnd)); //加密 AtomUtility.AddDcElement(entry.AdditionalElements, "ContentNextPageStart", AtomUtility.Encrypt(gatherRuleInfo.ContentNextPageStart)); //加密 AtomUtility.AddDcElement(entry.AdditionalElements, "ContentNextPageEnd", AtomUtility.Encrypt(gatherRuleInfo.ContentNextPageEnd)); //加密 AtomUtility.AddDcElement(entry.AdditionalElements, "ContentAttributes", AtomUtility.Encrypt(gatherRuleInfo.ContentAttributes)); //加密 AtomUtility.AddDcElement(entry.AdditionalElements, "ContentAttributesXML", AtomUtility.Encrypt(gatherRuleInfo.ContentAttributesXml)); //加密 AtomUtility.AddDcElement(entry.AdditionalElements, "ExtendValues", AtomUtility.Encrypt(gatherRuleInfo.ExtendValues)); //加密 return(entry); }
private AtomEntry ExportTemplateInfo(TemplateInfo templateInfo) { var entry = AtomUtility.GetEmptyEntry(); var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(_publishmentSystemId); AtomUtility.AddDcElement(entry.AdditionalElements, "TemplateID", templateInfo.TemplateId.ToString()); AtomUtility.AddDcElement(entry.AdditionalElements, "PublishmentSystemID", templateInfo.PublishmentSystemId.ToString()); AtomUtility.AddDcElement(entry.AdditionalElements, "TemplateName", templateInfo.TemplateName); AtomUtility.AddDcElement(entry.AdditionalElements, "TemplateType", ETemplateTypeUtils.GetValue(templateInfo.TemplateType)); AtomUtility.AddDcElement(entry.AdditionalElements, "RelatedFileName", templateInfo.RelatedFileName); AtomUtility.AddDcElement(entry.AdditionalElements, "CreatedFileFullName", templateInfo.CreatedFileFullName); AtomUtility.AddDcElement(entry.AdditionalElements, "CreatedFileExtName", templateInfo.CreatedFileExtName); AtomUtility.AddDcElement(entry.AdditionalElements, "Charset", ECharsetUtils.GetValue(templateInfo.Charset)); AtomUtility.AddDcElement(entry.AdditionalElements, "IsDefault", templateInfo.IsDefault.ToString()); var templateContent = StlCacheManager.FileContent.GetTemplateContent(publishmentSystemInfo, templateInfo); AtomUtility.AddDcElement(entry.AdditionalElements, "Content", AtomUtility.Encrypt(templateContent)); return(entry); }
public static string GetCommentsTemplateContent(ECharset charset) { return ($@"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd""> <html xmlns=""http://www.w3.org/1999/xhtml""> <head> <meta http-equiv=""Content-Type"" content=""text/html; charset={ECharsetUtils.GetValue(charset)}"" /> <title>评论</title> <style> *{{font-size:12px}} </style> </head> <body> <stl:comments isPage=""true"" pageNum=""20"" isLinkToAll=""false""></stl:comments> <br /> <stl:commentInput isDynamic=""true""></stl:commentInput> </body> </html>"); }
public static string GetSearchTemplateContent(ECharset charset) { return ($@"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd""> <html xmlns=""http://www.w3.org/1999/xhtml""> <head> <meta http-equiv=""Content-Type"" content=""text/html; charset={ECharsetUtils.GetValue(charset)}"" /> <title>搜索</title> <style> *{{font-size:12px}} </style> </head> <body> <stl:searchInput openwin=""false"" isLoadValues=""true""></stl:searchInput> <br /> <stl:searchOutput isHighlight=""true""></stl:searchOutput> </body> </html>"); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId"); TemplateInfo templateInfo = null; if (AuthRequest.GetQueryInt("TemplateID") > 0) { var templateId = AuthRequest.GetQueryInt("TemplateID"); _isCopy = AuthRequest.GetQueryBool("IsCopy"); templateInfo = TemplateManager.GetTemplateInfo(SiteId, templateId); if (templateInfo != null) { _templateType = templateInfo.TemplateType; } } else { _templateType = TemplateTypeUtils.GetEnumType(Request.QueryString["TemplateType"]); } if (_templateType == TemplateType.IndexPageTemplate || _templateType == TemplateType.FileTemplate) { PhCreatedFileFullName.Visible = true; } else { PhCreatedFileFullName.Visible = false; } if (IsPostBack) { return; } VerifySitePermissions(ConfigManager.SitePermissions.Templates); LtlTemplateType.Text = TemplateTypeUtils.GetText(_templateType); LtlPageTitle.Text = AuthRequest.GetQueryInt("TemplateID") > 0 ? "编辑模板" : "添加模板"; var isCodeMirror = SiteInfo.Additional.ConfigTemplateIsCodeMirror; BtnEditorType.Text = isCodeMirror ? "采用纯文本编辑模式" : "采用代码编辑模式"; PhCodeMirror.Visible = isCodeMirror; EFileSystemTypeUtils.AddWebPageListItems(DdlCreatedFileExtName); ECharsetUtils.AddListItems(DdlCharset); if (AuthRequest.GetQueryInt("TemplateID") > 0) { if (templateInfo == null) { return; } TbContent.Text = TemplateManager.GetTemplateContent(SiteInfo, templateInfo); if (_isCopy) { TbTemplateName.Text = templateInfo.TemplateName + "_复件"; TbRelatedFileName.Text = PathUtils.RemoveExtension(templateInfo.RelatedFileName) + "_复件"; TbCreatedFileFullName.Text = PathUtils.RemoveExtension(templateInfo.CreatedFileFullName) + "_复件"; } else { TbTemplateName.Text = templateInfo.TemplateName; TbRelatedFileName.Text = PathUtils.RemoveExtension(templateInfo.RelatedFileName); TbCreatedFileFullName.Text = PathUtils.RemoveExtension(templateInfo.CreatedFileFullName); LtlCommands.Text += $@" <button class=""btn"" onclick=""{ModalProgressBar.GetOpenWindowStringWithCreateByTemplate(SiteId, templateInfo.Id)}"">生成页面</button> <button class=""btn"" onclick=""{ModalTemplateRestore.GetOpenWindowString(SiteId, templateInfo.Id, string.Empty)}"">还原历史版本</button>"; if (AuthRequest.GetQueryInt("TemplateLogID") > 0) { var templateLogId = AuthRequest.GetQueryInt("TemplateLogID"); if (templateLogId > 0) { TbContent.Text = DataProvider.TemplateLogDao.GetTemplateContent(templateLogId); SuccessMessage("已导入历史版本的模板内容,点击确定保存模板"); } } } ControlUtils.SelectSingleItemIgnoreCase(DdlCharset, ECharsetUtils.GetValue(templateInfo.Charset)); ControlUtils.SelectSingleItem(DdlCreatedFileExtName, GetTemplateFileExtension(templateInfo)); HihTemplateType.Value = templateInfo.TemplateType.Value; } else { TbRelatedFileName.Text = "T_"; TbCreatedFileFullName.Text = _templateType == TemplateType.ChannelTemplate ? "index" : "@/"; ControlUtils.SelectSingleItemIgnoreCase(DdlCharset, SiteInfo.Additional.Charset); ControlUtils.SelectSingleItem(DdlCreatedFileExtName, EFileSystemTypeUtils.GetValue(EFileSystemType.Html)); HihTemplateType.Value = AuthRequest.GetQueryString("TemplateType"); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } if (IsPostBack) { return; } VerifySystemPermissions(ConfigManager.SettingsPermissions.SiteAdd); DataProvider.TableDao.CreateAllTableCollectionInfoIfNotExists(); var hqSiteId = DataProvider.SiteDao.GetIdByIsRoot(); if (hqSiteId == 0) { ControlUtils.SelectSingleItem(RblIsRoot, true.ToString()); PhIsNotRoot.Visible = false; } else { RblIsRoot.Enabled = false; } DdlParentId.Items.Add(new ListItem("<无上级站点>", "0")); var siteIdArrayList = SiteManager.GetSiteIdList(); var mySystemInfoArrayList = new ArrayList(); var parentWithChildren = new Hashtable(); foreach (var siteId in siteIdArrayList) { var siteInfo = SiteManager.GetSiteInfo(siteId); if (siteInfo.IsRoot == false) { 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(DdlParentId, siteInfo, parentWithChildren, 0); } ControlUtils.SelectSingleItem(DdlParentId, "0"); ECharsetUtils.AddListItems(DdlCharset); ControlUtils.SelectSingleItem(DdlCharset, ECharsetUtils.GetValue(ECharset.utf_8)); var tableList = DataProvider.TableDao.GetTableCollectionInfoListCreatedInDb(); foreach (var tableInfo in tableList) { if (tableInfo.DisplayName.StartsWith("插件内容表:")) { continue; } var li = new ListItem($"{tableInfo.DisplayName}({tableInfo.TableName})", tableInfo.TableName); DdlTableName.Items.Add(li); } RblIsCheckContentUseLevel.Items.Add(new ListItem("默认审核机制", false.ToString())); RblIsCheckContentUseLevel.Items.Add(new ListItem("多级审核机制", true.ToString())); ControlUtils.SelectSingleItem(RblIsCheckContentUseLevel, false.ToString()); if (SiteTemplateManager.Instance.IsSiteTemplateExists) { RblSource.Items.Add(new ListItem("创建空站点(不使用站点模板)", ETriStateUtils.GetValue(ETriState.True))); RblSource.Items.Add(new ListItem("使用本地站点模板创建站点", ETriStateUtils.GetValue(ETriState.False))); RblSource.Items.Add(new ListItem("使用在线站点模板创建站点", ETriStateUtils.GetValue(ETriState.All))); } else { RblSource.Items.Add(new ListItem("创建空站点(不使用站点模板)", ETriStateUtils.GetValue(ETriState.True))); RblSource.Items.Add(new ListItem("使用在线站点模板创建站点", ETriStateUtils.GetValue(ETriState.All))); } ControlUtils.SelectSingleItem(RblSource, ETriStateUtils.GetValue(ETriState.True)); var siteTemplateDir = AuthRequest.GetQueryString("siteTemplateDir"); var onlineTemplateName = AuthRequest.GetQueryString("onlineTemplateName"); if (!string.IsNullOrEmpty(siteTemplateDir)) { HihSiteTemplateDir.Value = siteTemplateDir; ControlUtils.SelectSingleItem(RblSource, ETriStateUtils.GetValue(ETriState.False)); BtnNext_Click(null, EventArgs.Empty); } else if (!string.IsNullOrEmpty(onlineTemplateName)) { HihOnlineTemplateName.Value = onlineTemplateName; ControlUtils.SelectSingleItem(RblSource, ETriStateUtils.GetValue(ETriState.All)); BtnNext_Click(null, EventArgs.Empty); } }
public IHttpActionResult Submit() { try { var request = new AuthenticatedRequest(); if (!request.IsAdminLoggin || !request.AdminPermissionsImpl.HasSystemPermissions(ConfigManager.SettingsPermissions.SiteAdd)) { return(Unauthorized()); } var createType = request.GetPostString("createType"); var createTemplateId = request.GetPostString("createTemplateId"); var siteName = request.GetPostString("siteName"); var isRoot = request.GetPostBool("isRoot"); var parentId = request.GetPostInt("parentId"); var siteDir = request.GetPostString("siteDir"); var domainName = request.GetPostString("domainName"); var tableRule = ETableRuleUtils.GetEnumType(request.GetPostString("tableRule")); var tableChoose = request.GetPostString("tableChoose"); var tableHandWrite = request.GetPostString("tableHandWrite"); var isImportContents = request.GetPostBool("isImportContents"); var isImportTableStyles = request.GetPostBool("isImportTableStyles"); if (!isRoot) { if (DirectoryUtils.IsSystemDirectory(siteDir)) { return(BadRequest("文件夹名称不能为系统文件夹名称,请更改文件夹名称!")); } if (!DirectoryUtils.IsDirectoryNameCompliant(siteDir)) { return(BadRequest("文件夹名称不符合系统要求,请更改文件夹名称!")); } var list = DataProvider.SiteDao.GetLowerSiteDirList(parentId); if (list.IndexOf(siteDir.ToLower()) != -1) { return(BadRequest("已存在相同的发布路径,请更改文件夹名称!")); } } var channelInfo = new ChannelInfo(); channelInfo.ChannelName = channelInfo.IndexName = "首页"; channelInfo.ParentId = 0; channelInfo.ContentModelPluginId = string.Empty; var tableName = string.Empty; if (tableRule == ETableRule.Choose) { tableName = tableChoose; } else if (tableRule == ETableRule.HandWrite) { tableName = tableHandWrite; if (!DataProvider.DatabaseDao.IsTableExists(tableName)) { DataProvider.ContentDao.CreateContentTable(tableName, DataProvider.ContentDao.TableColumnsDefault); } else { DataProvider.DatabaseDao.AlterSystemTable(tableName, DataProvider.ContentDao.TableColumnsDefault); } } var siteInfo = new SiteInfo { SiteName = AttackUtils.FilterXss(siteName), SiteDir = siteDir, DomainName = domainName, TableName = tableName, ParentId = parentId, IsRoot = isRoot }; siteInfo.Additional.IsCheckContentLevel = false; siteInfo.Additional.Charset = ECharsetUtils.GetValue(ECharset.utf_8); var siteId = DataProvider.ChannelDao.InsertSiteInfo(channelInfo, siteInfo, request.AdminName); if (string.IsNullOrEmpty(tableName)) { tableName = ContentDao.GetContentTableName(siteId); DataProvider.ContentDao.CreateContentTable(tableName, DataProvider.ContentDao.TableColumnsDefault); DataProvider.SiteDao.UpdateTableName(siteId, tableName); } if (request.AdminPermissionsImpl.IsSystemAdministrator && !request.AdminPermissionsImpl.IsConsoleAdministrator) { var siteIdList = request.AdminPermissionsImpl.GetSiteIdList() ?? new List <int>(); siteIdList.Add(siteId); var adminInfo = AdminManager.GetAdminInfoByUserId(request.AdminId); DataProvider.AdministratorDao.UpdateSiteIdCollection(adminInfo, TranslateUtils.ObjectCollectionToString(siteIdList)); } var siteTemplateDir = string.Empty; var onlineTemplateName = string.Empty; if (StringUtils.EqualsIgnoreCase(createType, "local")) { siteTemplateDir = createTemplateId; } else if (StringUtils.EqualsIgnoreCase(createType, "cloud")) { onlineTemplateName = createTemplateId; } var redirectUrl = PageProgressBar.GetCreateSiteUrl(siteId, isImportContents, isImportTableStyles, siteTemplateDir, onlineTemplateName, StringUtils.Guid()); SystemManager.UpdateSites(); return(Ok(new { Value = redirectUrl })); } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult Get() { try { var request = Context.AuthenticatedRequest; var siteId = request.GetQueryInt("siteId"); var ruleId = request.GetQueryInt("ruleId"); if (!request.IsAdminLoggin || !request.AdminPermissions.HasSitePermissions(siteId, Utils.PluginId)) { return(Unauthorized()); } GatherRuleInfo ruleInfo; List <string> contentHtmlClearList; List <string> contentHtmlClearTagList; Dictionary <string, string> attributesDict; if (ruleId > 0) { ruleInfo = Main.GatherRuleRepository.GetGatherRuleInfo(ruleId); contentHtmlClearList = TranslateUtils.StringCollectionToStringList(ruleInfo.ContentHtmlClearCollection); contentHtmlClearTagList = TranslateUtils.StringCollectionToStringList(ruleInfo.ContentHtmlClearTagCollection); attributesDict = TranslateUtils.JsonDeserialize <Dictionary <string, string> >(ruleInfo.ContentAttributesXml); } else { ruleInfo = new GatherRuleInfo { SiteId = siteId, Charset = ECharsetUtils.GetValue(ECharset.utf_8), IsOrderByDesc = true, GatherUrlIsCollection = true, ContentHtmlClearCollection = "", ContentHtmlClearTagCollection = "" }; contentHtmlClearList = new List <string> { "script", "object", "iframe" }; contentHtmlClearTagList = new List <string> { "font", "div", "span" }; attributesDict = new Dictionary <string, string>(); } var channels = new List <KeyValuePair <int, string> >(); var channelIdList = Context.ChannelApi.GetChannelIdList(siteId); var isLastNodeArray = new bool[channelIdList.Count]; foreach (var theChannelId in channelIdList) { var channelInfo = Context.ChannelApi.GetChannelInfo(siteId, theChannelId); var title = Utils.GetChannelListBoxTitle(siteId, channelInfo.Id, channelInfo.ChannelName, channelInfo.ParentsCount, channelInfo.LastNode, isLastNodeArray); channels.Add(new KeyValuePair <int, string>(channelInfo.Id, title)); } var charsets = ECharsetUtils.GetAllCharsets(); return(Ok(new { Value = ruleInfo, Channels = channels, Charsets = charsets, ContentHtmlClearList = contentHtmlClearList, ContentHtmlClearTagList = contentHtmlClearTagList, AttributesDict = attributesDict })); } catch (Exception ex) { return(InternalServerError(ex)); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID"); if (Body.IsQueryExists("GatherRuleName")) { _isEdit = true; _theGatherRuleName = Body.GetQueryString("GatherRuleName"); } if (!Page.IsPostBack) { var pageTitle = _isEdit ? "编辑单文件页采集规则" : "添加单文件页采集规则"; BreadCrumb(AppManager.Cms.LeftMenu.IdFunction, AppManager.Cms.LeftMenu.Function.IdGather, pageTitle, AppManager.Cms.Permission.WebSite.Gather); ltlPageTitle.Text = pageTitle; ECharsetUtils.AddListItems(Charset); ControlUtils.SelectListItemsIgnoreCase(Charset, ECharsetUtils.GetValue(ECharset.utf_8)); NodeManager.AddListItemsForAddContent(NodeIDDropDownList.Items, PublishmentSystemInfo, true, Body.AdministratorName); SetActivePanel(WizardPanel.GatherRuleBase, GatherRuleBase); if (_isEdit) { var gatherFileRuleInfo = DataProvider.GatherFileRuleDao.GetGatherFileRuleInfo(_theGatherRuleName, PublishmentSystemId); GatherRuleName.Text = gatherFileRuleInfo.GatherRuleName; GatherUrl.Text = gatherFileRuleInfo.GatherUrl; ControlUtils.SelectListItemsIgnoreCase(Charset, ECharsetUtils.GetValue(gatherFileRuleInfo.Charset)); ControlUtils.SelectListItems(IsToFile, gatherFileRuleInfo.IsToFile.ToString()); FilePath.Text = gatherFileRuleInfo.FilePath; ControlUtils.SelectListItems(IsSaveRelatedFiles, gatherFileRuleInfo.IsSaveRelatedFiles.ToString()); ControlUtils.SelectListItems(IsRemoveScripts, gatherFileRuleInfo.IsRemoveScripts.ToString()); StyleDirectoryPath.Text = gatherFileRuleInfo.StyleDirectoryPath; ScriptDirectoryPath.Text = gatherFileRuleInfo.ScriptDirectoryPath; ImageDirectoryPath.Text = gatherFileRuleInfo.ImageDirectoryPath; ControlUtils.SelectListItems(NodeIDDropDownList, gatherFileRuleInfo.NodeId.ToString()); ControlUtils.SelectListItems(IsSaveImage, gatherFileRuleInfo.IsSaveImage.ToString()); ControlUtils.SelectListItems(IsChecked, gatherFileRuleInfo.IsChecked.ToString()); ControlUtils.SelectListItems(IsAutoCreate, gatherFileRuleInfo.IsAutoCreate.ToString()); ContentExclude.Text = gatherFileRuleInfo.ContentExclude; var htmlClearArrayList = TranslateUtils.StringCollectionToStringList(gatherFileRuleInfo.ContentHtmlClearCollection); foreach (ListItem item in ContentHtmlClearCollection.Items) { if (htmlClearArrayList.Contains(item.Value)) { item.Selected = true; } } var htmlClearTagArrayList = TranslateUtils.StringCollectionToStringList(gatherFileRuleInfo.ContentHtmlClearTagCollection); foreach (ListItem item in ContentHtmlClearTagCollection.Items) { if (htmlClearTagArrayList.Contains(item.Value)) { item.Selected = true; } } ContentTitleStart.Text = gatherFileRuleInfo.ContentTitleStart; ContentTitleEnd.Text = gatherFileRuleInfo.ContentTitleEnd; ContentContentStart.Text = gatherFileRuleInfo.ContentContentStart; ContentContentEnd.Text = gatherFileRuleInfo.ContentContentEnd; var contentAttributeArrayList = TranslateUtils.StringCollectionToStringList(gatherFileRuleInfo.ContentAttributes); var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.BackgroundContent, PublishmentSystemInfo.AuxiliaryTableForContent, null); foreach (var styleInfo in styleInfoList) { if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.Title) || StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, BackgroundContentAttribute.Content)) { continue; } var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName.ToLower()); if (contentAttributeArrayList.Contains(listitem.Value)) { listitem.Selected = true; } ContentAttributes.Items.Add(listitem); } _contentAttributesXml = TranslateUtils.ToNameValueCollection(gatherFileRuleInfo.ContentAttributesXml); ContentAttributes_SelectedIndexChanged(null, EventArgs.Empty); } DropDownList_SelectedIndexChanged(null, EventArgs.Empty); } SuccessMessage(string.Empty); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _publishmentSystemType = EPublishmentSystemTypeUtils.GetEnumType(Body.GetQueryString("publishmentSystemType")); _sortedlist = SiteTemplateManager.Instance.GetSiteTemplateSortedList(); _permissions = PermissionsManager.GetPermissions(Body.AdministratorName); if (!IsPostBack) { BaiRongDataProvider.TableCollectionDao.CreateAllAuxiliaryTableIfNotExists(); SiteTemplateDir.Value = Body.GetQueryString("siteTemplate"); string pageTitle = $"创建{EPublishmentSystemTypeUtils.GetText(_publishmentSystemType)}"; ltlPageTitle.Text = pageTitle; BreadCrumbSys(AppManager.Sys.LeftMenu.Site, pageTitle, AppManager.Sys.Permission.SysSite); var hqSiteId = DataProvider.PublishmentSystemDao.GetPublishmentSystemIdByIsHeadquarters(); if (hqSiteId == 0) { IsHeadquarters.SelectedValue = "True"; phNotIsHeadquarters.Visible = false; } else { IsHeadquarters.Enabled = false; } ltlPublishmentSystemType.Text = EPublishmentSystemTypeUtils.GetHtml(_publishmentSystemType); phWCMTables.Visible = _publishmentSystemType == EPublishmentSystemType.WCM; ParentPublishmentSystemID.Items.Add(new ListItem("<无上级站点>", "0")); var publishmentSystemIdArrayList = PublishmentSystemManager.GetPublishmentSystemIdList(); var mySystemInfoArrayList = new ArrayList(); var parentWithChildren = new Hashtable(); foreach (int publishmentSystemId in publishmentSystemIdArrayList) { var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId); if (publishmentSystemInfo.IsHeadquarters == false) { if (publishmentSystemInfo.ParentPublishmentSystemId == 0) { mySystemInfoArrayList.Add(publishmentSystemInfo); } else { var children = new ArrayList(); if (parentWithChildren.Contains(publishmentSystemInfo.ParentPublishmentSystemId)) { children = (ArrayList)parentWithChildren[publishmentSystemInfo.ParentPublishmentSystemId]; } children.Add(publishmentSystemInfo); parentWithChildren[publishmentSystemInfo.ParentPublishmentSystemId] = children; } } } foreach (PublishmentSystemInfo publishmentSystemInfo in mySystemInfoArrayList) { AddSite(ParentPublishmentSystemID, publishmentSystemInfo, parentWithChildren, 0); } ControlUtils.SelectListItems(ParentPublishmentSystemID, "0"); phNodeRelated.Visible = EPublishmentSystemTypeUtils.IsNodeRelated(_publishmentSystemType); ECharsetUtils.AddListItems(Charset); ControlUtils.SelectListItems(Charset, ECharsetUtils.GetValue(ECharset.utf_8)); var tableList = BaiRongDataProvider.TableCollectionDao.GetAuxiliaryTableListCreatedInDbByAuxiliaryTableType(EAuxiliaryTableType.BackgroundContent); foreach (var tableInfo in tableList) { var li = new ListItem($"{tableInfo.TableCnName}({tableInfo.TableEnName})", tableInfo.TableEnName); AuxiliaryTableForContent.Items.Add(li); } tableList = BaiRongDataProvider.TableCollectionDao.GetAuxiliaryTableListCreatedInDbByAuxiliaryTableType(EAuxiliaryTableType.GovPublicContent); foreach (var tableInfo in tableList) { var li = new ListItem($"{tableInfo.TableCnName}({tableInfo.TableEnName})", tableInfo.TableEnName); AuxiliaryTableForGovPublic.Items.Add(li); } tableList = BaiRongDataProvider.TableCollectionDao.GetAuxiliaryTableListCreatedInDbByAuxiliaryTableType(EAuxiliaryTableType.GovInteractContent); foreach (var tableInfo in tableList) { var li = new ListItem($"{tableInfo.TableCnName}({tableInfo.TableEnName})", tableInfo.TableEnName); AuxiliaryTableForGovInteract.Items.Add(li); } tableList = BaiRongDataProvider.TableCollectionDao.GetAuxiliaryTableListCreatedInDbByAuxiliaryTableType(EAuxiliaryTableType.VoteContent); foreach (var tableInfo in tableList) { var li = new ListItem($"{tableInfo.TableCnName}({tableInfo.TableEnName})", tableInfo.TableEnName); AuxiliaryTableForVote.Items.Add(li); } tableList = BaiRongDataProvider.TableCollectionDao.GetAuxiliaryTableListCreatedInDbByAuxiliaryTableType(EAuxiliaryTableType.JobContent); foreach (var tableInfo in tableList) { var li = new ListItem($"{tableInfo.TableCnName}({tableInfo.TableEnName})", tableInfo.TableEnName); AuxiliaryTableForJob.Items.Add(li); } IsCheckContentUseLevel.Items.Add(new ListItem("默认审核机制", false.ToString())); IsCheckContentUseLevel.Items.Add(new ListItem("多级审核机制", true.ToString())); ControlUtils.SelectListItems(IsCheckContentUseLevel, false.ToString()); UseSiteTemplate.Attributes.Add("onclick", "displaySiteTemplateDiv(this)"); BindGrid(); if (_sortedlist.Count > 0) { SetActivePlaceHolder(WizardPlaceHolder.ChooseSiteTemplate, ChooseSiteTemplate); } else { ChooseSiteTemplate.Visible = false; UseSiteTemplate.Checked = false; SetActivePlaceHolder(WizardPlaceHolder.CreateSiteParameters, CreateSiteParameters); RowSiteTemplateName.Visible = RowIsImportContents.Visible = RowIsImportTableStyles.Visible = RowIsUserSiteTemplateAuxiliaryTables.Visible = false; phAuxiliaryTable.Visible = true; } } }
private AtomEntry ExportTemplateInfo(TemplateInfo templateInfo) { var entry = AtomUtility.GetEmptyEntry(); var siteInfo = SiteManager.GetSiteInfo(_siteId); AtomUtility.AddDcElement(entry.AdditionalElements, new List <string> { nameof(TemplateInfo.Id), "TemplateID" }, templateInfo.Id.ToString()); AtomUtility.AddDcElement(entry.AdditionalElements, new List <string> { nameof(TemplateInfo.SiteId), "PublishmentSystemID" }, templateInfo.SiteId.ToString()); AtomUtility.AddDcElement(entry.AdditionalElements, nameof(TemplateInfo.TemplateName), templateInfo.TemplateName); AtomUtility.AddDcElement(entry.AdditionalElements, nameof(TemplateInfo.TemplateType), templateInfo.TemplateType.Value); AtomUtility.AddDcElement(entry.AdditionalElements, nameof(TemplateInfo.RelatedFileName), templateInfo.RelatedFileName); AtomUtility.AddDcElement(entry.AdditionalElements, nameof(TemplateInfo.CreatedFileFullName), templateInfo.CreatedFileFullName); AtomUtility.AddDcElement(entry.AdditionalElements, nameof(TemplateInfo.CreatedFileExtName), templateInfo.CreatedFileExtName); AtomUtility.AddDcElement(entry.AdditionalElements, nameof(TemplateInfo.Charset), ECharsetUtils.GetValue(templateInfo.Charset)); AtomUtility.AddDcElement(entry.AdditionalElements, nameof(TemplateInfo.IsDefault), templateInfo.IsDefault.ToString()); var templateContent = TemplateManager.GetTemplateContent(siteInfo, templateInfo); AtomUtility.AddDcElement(entry.AdditionalElements, "Content", AtomUtility.Encrypt(templateContent)); return(entry); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID"); if (Body.IsQueryExists("GatherRuleName")) { _isEdit = true; _theGatherRuleName = Body.GetQueryString("GatherRuleName"); } if (!Page.IsPostBack) { var pageTitle = _isEdit ? "编辑Web页面信息采集规则" : "添加Web页面信息采集规则"; BreadCrumb(AppManager.Cms.LeftMenu.IdFunction, AppManager.Cms.LeftMenu.Function.IdGather, pageTitle, AppManager.Cms.Permission.WebSite.Gather); ltlPageTitle.Text = pageTitle; ECharsetUtils.AddListItems(Charset); ControlUtils.SelectListItemsIgnoreCase(Charset, ECharsetUtils.GetValue(ECharset.utf_8)); NodeManager.AddListItemsForAddContent(NodeIDDropDownList.Items, PublishmentSystemInfo, true, Body.AdministratorName); SetActivePanel(WizardPanel.GatherRuleBase, GatherRuleBase); if (_isEdit) { var gatherRuleInfo = DataProvider.GatherRuleDao.GetGatherRuleInfo(_theGatherRuleName, PublishmentSystemId); GatherRuleName.Text = gatherRuleInfo.GatherRuleName; ControlUtils.SelectListItemsIgnoreCase(Charset, ECharsetUtils.GetValue(gatherRuleInfo.Charset)); GatherNum.Text = gatherRuleInfo.Additional.GatherNum.ToString(); foreach (ListItem item in IsSaveImage.Items) { if (item.Value.Equals(gatherRuleInfo.Additional.IsSaveImage.ToString())) { item.Selected = true; } else { item.Selected = false; } } foreach (ListItem item in IsSetFirstImageAsImageUrl.Items) { if (item.Value.Equals(gatherRuleInfo.Additional.IsSetFirstImageAsImageUrl.ToString())) { item.Selected = true; } else { item.Selected = false; } } foreach (ListItem item in IsEmptyContentAllowed.Items) { if (item.Value.Equals(gatherRuleInfo.Additional.IsEmptyContentAllowed.ToString())) { item.Selected = true; } else { item.Selected = false; } } foreach (ListItem item in IsSameTitleAllowed.Items) { if (item.Value.Equals(gatherRuleInfo.Additional.IsSameTitleAllowed.ToString())) { item.Selected = true; } else { item.Selected = false; } } foreach (ListItem item in IsChecked.Items) { if (item.Value.Equals(gatherRuleInfo.Additional.IsChecked.ToString())) { item.Selected = true; } else { item.Selected = false; } } foreach (ListItem item in IsAutoCreate.Items) { if (item.Value.Equals(gatherRuleInfo.Additional.IsAutoCreate.ToString())) { item.Selected = true; } else { item.Selected = false; } } foreach (ListItem item in IsOrderByDesc.Items) { if (item.Value.Equals(gatherRuleInfo.Additional.IsOrderByDesc.ToString())) { item.Selected = true; } else { item.Selected = false; } } GatherUrlIsCollection.Checked = gatherRuleInfo.GatherUrlIsCollection; GatherUrlCollection.Text = gatherRuleInfo.GatherUrlCollection; GatherUrlIsSerialize.Checked = gatherRuleInfo.GatherUrlIsSerialize; GatherUrlSerialize.Text = gatherRuleInfo.GatherUrlSerialize; SerializeFrom.Text = gatherRuleInfo.SerializeFrom.ToString(); SerializeTo.Text = gatherRuleInfo.SerializeTo.ToString(); SerializeInterval.Text = gatherRuleInfo.SerializeInterval.ToString(); SerializeIsOrderByDesc.Checked = gatherRuleInfo.SerializeIsOrderByDesc; SerializeIsAddZero.Checked = gatherRuleInfo.SerializeIsAddZero; foreach (ListItem item in NodeIDDropDownList.Items) { if (item.Value.Equals(gatherRuleInfo.NodeId.ToString())) { item.Selected = true; } else { item.Selected = false; } } UrlInclude.Text = gatherRuleInfo.UrlInclude; TitleInclude.Text = gatherRuleInfo.TitleInclude; ContentExclude.Text = gatherRuleInfo.ContentExclude; var htmlClearArrayList = TranslateUtils.StringCollectionToStringList(gatherRuleInfo.ContentHtmlClearCollection); foreach (ListItem item in ContentHtmlClearCollection.Items) { item.Selected = htmlClearArrayList.Contains(item.Value); } var htmlClearTagArrayList = TranslateUtils.StringCollectionToStringList(gatherRuleInfo.ContentHtmlClearTagCollection); foreach (ListItem item in ContentHtmlClearTagCollection.Items) { item.Selected = htmlClearTagArrayList.Contains(item.Value); } ListAreaStart.Text = gatherRuleInfo.ListAreaStart; ListAreaEnd.Text = gatherRuleInfo.ListAreaEnd; CookieString.Text = gatherRuleInfo.CookieString; ContentTitleStart.Text = gatherRuleInfo.ContentTitleStart; ContentTitleEnd.Text = gatherRuleInfo.ContentTitleEnd; ContentContentStart.Text = gatherRuleInfo.ContentContentStart; ContentContentEnd.Text = gatherRuleInfo.ContentContentEnd; ContentContentStart2.Text = gatherRuleInfo.Additional.ContentContentStart2; ContentContentEnd2.Text = gatherRuleInfo.Additional.ContentContentEnd2; ContentContentStart3.Text = gatherRuleInfo.Additional.ContentContentStart3; ContentContentEnd3.Text = gatherRuleInfo.Additional.ContentContentEnd3; ContentReplaceFrom.Text = gatherRuleInfo.Additional.ContentReplaceFrom; ContentReplaceTo.Text = gatherRuleInfo.Additional.ContentReplaceTo; ContentChannelStart.Text = gatherRuleInfo.ContentChannelStart; ContentChannelEnd.Text = gatherRuleInfo.ContentChannelEnd; ContentNextPageStart.Text = gatherRuleInfo.ContentNextPageStart; ContentNextPageEnd.Text = gatherRuleInfo.ContentNextPageEnd; var contentAttributeArrayList = TranslateUtils.StringCollectionToStringList(gatherRuleInfo.ContentAttributes); var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, PublishmentSystemId); var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.BackgroundContent, PublishmentSystemInfo.AuxiliaryTableForContent, relatedIdentities); foreach (var styleInfo in styleInfoList) { if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.Title) || StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, BackgroundContentAttribute.Content)) { continue; } var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName.ToLower()); if (contentAttributeArrayList.Contains(listitem.Value)) { listitem.Selected = true; } ContentAttributes.Items.Add(listitem); } var listItem = new ListItem("点击量", ContentAttribute.Hits.ToLower()); if (contentAttributeArrayList.Contains(listItem.Value)) { listItem.Selected = true; } ContentAttributes.Items.Add(listItem); _contentAttributesXml = TranslateUtils.ToNameValueCollection(gatherRuleInfo.ContentAttributesXml); ContentAttributes_SelectedIndexChanged(null, EventArgs.Empty); } else { var relatedIdentities = RelatedIdentities.GetChannelRelatedIdentities(PublishmentSystemId, PublishmentSystemId); var styleInfoList = TableStyleManager.GetTableStyleInfoList(ETableStyle.BackgroundContent, PublishmentSystemInfo.AuxiliaryTableForContent, relatedIdentities); foreach (var styleInfo in styleInfoList) { if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.Title) || StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, BackgroundContentAttribute.Content)) { continue; } var listitem = new ListItem(styleInfo.DisplayName, styleInfo.AttributeName.ToLower()); ContentAttributes.Items.Add(listitem); } var listItem = new ListItem("点击量", ContentAttribute.Hits.ToLower()); ContentAttributes.Items.Add(listItem); } GatherUrl_CheckedChanged(null, null); } SuccessMessage(string.Empty); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("siteId", "type"); _type = AuthRequest.GetQueryString("type"); if (_type == PageTemplateAssets.TypeInclude) { _name = PageTemplateAssets.NameInclude; _ext = PageTemplateAssets.ExtInclude; _assetsDir = SiteInfo.Additional.TemplatesAssetsIncludeDir.Trim('/'); PhCodeMirrorInclude.Visible = true; } else if (_type == PageTemplateAssets.TypeJs) { _name = PageTemplateAssets.NameJs; _ext = PageTemplateAssets.ExtJs; _assetsDir = SiteInfo.Additional.TemplatesAssetsJsDir.Trim('/'); PhCodeMirrorJs.Visible = true; } else if (_type == PageTemplateAssets.TypeCss) { _name = PageTemplateAssets.NameCss; _ext = PageTemplateAssets.ExtCss; _assetsDir = SiteInfo.Additional.TemplatesAssetsCssDir.Trim('/'); PhCodeMirrorCss.Visible = true; } if (string.IsNullOrEmpty(_assetsDir)) { return; } _directoryPath = PathUtility.MapPath(SiteInfo, "@/" + _assetsDir); if (AuthRequest.IsQueryExists("fileName")) { _fileName = AuthRequest.GetQueryString("fileName"); _fileName = PathUtils.RemoveParentPath(_fileName); } if (IsPostBack) { return; } VerifySitePermissions(ConfigManager.SitePermissions.TemplatesIncludes); LtlPageTitle.Text = string.IsNullOrEmpty(_fileName) ? $"添加{_name}" : $"编辑{_name}"; var isCodeMirror = SiteInfo.Additional.ConfigTemplateIsCodeMirror; BtnEditorType.Text = isCodeMirror ? "采用纯文本编辑模式" : "采用代码编辑模式"; PhCodeMirror.Visible = isCodeMirror; ECharsetUtils.AddListItems(DdlCharset); if (_fileName != null) { if (!StringUtils.EqualsIgnoreCase(PathUtils.GetExtension(_fileName), _ext)) { PageUtils.RedirectToErrorPage("对不起,此文件格式无法编辑!"); } else { TbRelatedFileName.Text = _fileName; var fileCharset = FileUtils.GetFileCharset(PathUtils.Combine(_directoryPath, _fileName)); ControlUtils.SelectSingleItemIgnoreCase(DdlCharset, ECharsetUtils.GetValue(fileCharset)); TbContent.Text = FileUtils.ReadText(PathUtils.Combine(_directoryPath, _fileName), fileCharset); } } else { ControlUtils.SelectSingleItemIgnoreCase(DdlCharset, SiteInfo.Additional.Charset); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemID"); TemplateInfo templateInfo = null; if (Body.GetQueryInt("TemplateID") > 0) { var templateId = Body.GetQueryInt("TemplateID"); _isCopy = Body.GetQueryBool("IsCopy"); templateInfo = TemplateManager.GetTemplateInfo(PublishmentSystemId, templateId); if (templateInfo != null) { _theTemplateType = templateInfo.TemplateType; } } else { _theTemplateType = ETemplateTypeUtils.GetEnumType(Request.QueryString["TemplateType"]); } TemplateTypeString = ETemplateTypeUtils.GetText(_theTemplateType); if (_theTemplateType == ETemplateType.IndexPageTemplate || _theTemplateType == ETemplateType.FileTemplate) { CreatedFileFullNameRow.Visible = true; } else { CreatedFileFullNameRow.Visible = false; } if (!IsPostBack) { var pageTitle = Body.GetQueryInt("TemplateID") > 0 ? "编辑模板" : "添加模板"; BreadCrumb(AppManager.Cms.LeftMenu.IdTemplate, pageTitle, AppManager.Cms.Permission.WebSite.Template); ltlPageTitle.Text = pageTitle; var isCodeMirror = PublishmentSystemInfo.Additional.ConfigTemplateIsCodeMirror; btnEditorType.Text = isCodeMirror ? "采用纯文本编辑模式" : "采用代码编辑模式"; phCodeMirror.Visible = isCodeMirror; EFileSystemTypeUtils.AddWebPageListItems(CreatedFileExtNameDropDownList); ECharsetUtils.AddListItems(Charset); if (Body.GetQueryInt("TemplateID") > 0) { if (templateInfo != null) { Content.Text = StlCacheManager.FileContent.GetTemplateContent(PublishmentSystemInfo, templateInfo); if (_isCopy) { TemplateName.Text = templateInfo.TemplateName + "_复件"; RelatedFileName.Text = PathUtils.RemoveExtension(templateInfo.RelatedFileName) + "_复件"; CreatedFileFullName.Text = PathUtils.RemoveExtension(templateInfo.CreatedFileFullName) + "_复件"; } else { TemplateName.Text = templateInfo.TemplateName; RelatedFileName.Text = PathUtils.RemoveExtension(templateInfo.RelatedFileName); CreatedFileFullName.Text = PathUtils.RemoveExtension(templateInfo.CreatedFileFullName); LtlCommands.Text += $@"<a href=""javascript:;"" class=""btn btn-info"" onclick=""{ModalProgressBar.GetOpenWindowStringWithCreateByTemplate(PublishmentSystemId, templateInfo.TemplateId)}"">生成页面</a><a href=""javascript:;"" class=""btn btn-info"" onclick=""{ModalTemplateRestore.GetOpenLayerString(PublishmentSystemId, templateInfo.TemplateId, string.Empty)}"">还原历史版本</a>"; if (Body.GetQueryInt("TemplateLogID") > 0) { var templateLogId = Body.GetQueryInt("TemplateLogID"); if (templateLogId > 0) { Content.Text = DataProvider.TemplateLogDao.GetTemplateContent(templateLogId); SuccessMessage("已导入历史版本的模板内容,点击确定保存模板"); } } } ControlUtils.SelectListItemsIgnoreCase(Charset, ECharsetUtils.GetValue(templateInfo.Charset)); ControlUtils.SelectListItems(CreatedFileExtNameDropDownList, GetTemplateFileExtension(templateInfo)); TemplateType.Value = ETemplateTypeUtils.GetValue(templateInfo.TemplateType); } } else { RelatedFileName.Text = "T_"; if (_theTemplateType == ETemplateType.ChannelTemplate) { CreatedFileFullName.Text = "index"; } else { CreatedFileFullName.Text = "@/"; } ControlUtils.SelectListItemsIgnoreCase(Charset, PublishmentSystemInfo.Additional.Charset); ControlUtils.SelectListItems(CreatedFileExtNameDropDownList, EFileSystemTypeUtils.GetValue(EFileSystemType.Html)); TemplateType.Value = Body.GetQueryString("TemplateType"); } } }