public static string GetUrlInChannelPage(string type, PublishmentSystemInfo publishmentSystemInfo, NodeInfo nodeInfo, int index, int currentPageIndex, int pageCount) { var pageIndex = 0; if (type.ToLower().Equals(StlPageItem.Type_FirstPage.ToLower()))//首页 { pageIndex = 0; } else if (type.ToLower().Equals(StlPageItem.Type_LastPage.ToLower()))//末页 { pageIndex = pageCount - 1; } else if (type.ToLower().Equals(StlPageItem.Type_PreviousPage.ToLower()))//上一页 { pageIndex = currentPageIndex - 1; } else if (type.ToLower().Equals(StlPageItem.Type_NextPage.ToLower()))//下一页 { pageIndex = currentPageIndex + 1; } else if (type.ToLower().Equals(StlPageItem.Type_PageNavigation.ToLower()) || type.ToLower().Equals(StlPageItem.Type_PageSelect.ToLower())) { pageIndex = index - 1; } var physicalPath = PathUtility.GetChannelPageFilePath(publishmentSystemInfo, nodeInfo.NodeId, pageIndex); return(PageUtility.GetPublishmentSystemUrlByPhysicalPath(publishmentSystemInfo, physicalPath)); }
public static List <Article> Trigger(PublishmentSystemInfo publishmentSystemInfo, Model.KeywordInfo keywordInfo, string wxOpenID) { var articleList = new List <Article>(); DataProviderWX.CountDAO.AddCount(keywordInfo.PublishmentSystemID, ECountType.RequestNews); var messageInfoList = DataProviderWX.MessageDAO.GetMessageInfoListByKeywordID(keywordInfo.PublishmentSystemID, keywordInfo.KeywordID); foreach (var messageInfo in messageInfoList) { Article article = null; if (messageInfo != null && !messageInfo.IsDisabled) { var imageUrl = GetImageUrl(publishmentSystemInfo, messageInfo.ImageUrl); var pageUrl = GetMessageUrl(publishmentSystemInfo, messageInfo, wxOpenID); article = new Article() { Title = messageInfo.Title, Description = messageInfo.Summary, PicUrl = imageUrl, Url = pageUrl }; } if (article != null) { articleList.Add(article); } } return(articleList); }
public static IEnumerable GetDataSourceByStlElement(PublishmentSystemInfo publishmentSystemInfo, int templateId, string elementName, string stlElement) { var xmlDocument = StlParserUtility.GetXmlDocument(stlElement, false); XmlNode node = xmlDocument.DocumentElement; if (node != null) { node = node.FirstChild; var templateInfo = TemplateManager.GetTemplateInfo(publishmentSystemInfo.PublishmentSystemId, templateId); var pageInfo = new PageInfo(publishmentSystemInfo.PublishmentSystemId, 0, publishmentSystemInfo, templateInfo, null); var contextInfo = new ContextInfo(pageInfo); if (node?.Name != null) { if (elementName == StlChannels.ElementName) { var displayInfo = ContentsDisplayInfo.GetContentsDisplayInfoByXmlNode(node, pageInfo, contextInfo, EContextType.Channel); return(StlChannels.GetDataSource(pageInfo, contextInfo, displayInfo)); } else if (elementName == StlContents.ElementName) { var displayInfo = ContentsDisplayInfo.GetContentsDisplayInfoByXmlNode(node, pageInfo, contextInfo, EContextType.Content); return(StlContents.GetDataSource(pageInfo, contextInfo, displayInfo)); } } } return(null); }
public static string ParseTextEditor(PublishmentSystemInfo publishmentSystemInfo, string attributeName, NameValueCollection pageScripts, string defaultValue, string width, int height) { var value = defaultValue ?? string.Empty; /****获取编辑器中内容,解析@符号,添加了远程路径处理 20151103****/ value = StringUtility.TextEditorContentDecode(value, publishmentSystemInfo); value = ETextEditorTypeUtils.TranslateToHtml(value); value = StringUtils.HtmlEncode(value); var builder = new StringBuilder(); var controllerUrl = Controllers.Files.UEditor.GetUrl(publishmentSystemInfo.Additional.ApiUrl, publishmentSystemInfo.PublishmentSystemId); var editorUrl = SiteFilesAssets.GetUrl(publishmentSystemInfo.Additional.ApiUrl, "ueditor"); if (pageScripts["uEditor"] == null) { builder.Append( $@"<script type=""text/javascript"">window.UEDITOR_HOME_URL = ""{editorUrl}/"";window.UEDITOR_CONTROLLER_URL = ""{controllerUrl}"";</script><script type=""text/javascript"" src=""{editorUrl}/editor_config.js""></script><script type=""text/javascript"" src=""{editorUrl}/ueditor_all_min.js""></script>"); } pageScripts["uEditor"] = string.Empty; builder.Append($@" <textarea id=""{attributeName}"" name=""{attributeName}"" style=""display:none"">{value}</textarea> <script type=""text/javascript""> $(function(){{ UE.getEditor('{attributeName}', {{allowDivTransToP: false}}); $('#{attributeName}').show(); }}); </script>"); return(builder.ToString()); }
public int Insert(string tableName, PublishmentSystemInfo publishmentSystemInfo, ContentInfo contentInfo, bool isUpdateContentNum, int taxis) { var contentId = 0; if (!string.IsNullOrEmpty(tableName)) { if (publishmentSystemInfo.Additional.IsAutoPageInTextEditor && contentInfo.ContainsKey(BackgroundContentAttribute.Content)) { contentInfo.SetExtendedAttribute(BackgroundContentAttribute.Content, ContentUtility.GetAutoPageContent(contentInfo.GetExtendedAttribute(BackgroundContentAttribute.Content), publishmentSystemInfo.Additional.AutoPageWordNum)); } contentInfo.BeforeExecuteNonQuery(); contentInfo.Taxis = taxis; contentId = BaiRongDataProvider.ContentDao.Insert(tableName, contentInfo); if (isUpdateContentNum) { new Action(() => { DataProvider.NodeDao.UpdateContentNum(PublishmentSystemManager.GetPublishmentSystemInfo(contentInfo.PublishmentSystemId), contentInfo.NodeId, true); }).BeginInvoke(null, null); } } return(contentId); }
public GovInteractApplyTemplate(PublishmentSystemInfo publishmentSystemInfo, int nodeId, TagStyleInfo tagStyleInfo, TagStyleGovInteractApplyInfo tagStyleApplyInfo) { _publishmentSystemInfo = publishmentSystemInfo; _nodeId = nodeId; _tagStyleInfo = tagStyleInfo; _tagStyleApplyInfo = tagStyleApplyInfo; }
public void Update(PublishmentSystemInfo info) { var updateParms = new IDataParameter[] { GetParameter(ParmPublishmentsystemName, EDataType.NVarChar, 50, info.PublishmentSystemName), GetParameter(ParmPublishmentsystemType, EDataType.VarChar, 50, EPublishmentSystemTypeUtils.GetValue(info.PublishmentSystemType)), GetParameter(ParmAuxiliaryTableForContent, EDataType.VarChar, 50, info.AuxiliaryTableForContent), GetParameter(ParmAuxiliaryTableForGovpublic, EDataType.VarChar, 50, info.AuxiliaryTableForGovPublic), GetParameter(ParmAuxiliaryTableForGovinteract, EDataType.VarChar, 50, info.AuxiliaryTableForGovInteract), GetParameter(ParmAuxiliaryTableForVote, EDataType.VarChar, 50, info.AuxiliaryTableForVote), GetParameter(ParmAuxiliaryTableForJob, EDataType.VarChar, 50, info.AuxiliaryTableForJob), GetParameter(ParmIsCheckContentUseLevel, EDataType.VarChar, 18, info.IsCheckContentUseLevel.ToString()), GetParameter(ParmCheckContentLevel, EDataType.Integer, info.CheckContentLevel), GetParameter(ParmPublishmentsystemDir, EDataType.VarChar, 50, info.PublishmentSystemDir), GetParameter(ParmPublishmentsystemUrl, EDataType.VarChar, 200, info.PublishmentSystemUrl), GetParameter(ParmIsHeadquarters, EDataType.VarChar, 18, info.IsHeadquarters.ToString()), GetParameter(ParmParentPublishmentsystemid, EDataType.Integer, info.ParentPublishmentSystemId), GetParameter(ParmTaxis, EDataType.Integer, info.Taxis), GetParameter(ParmSettingsXml, EDataType.NText, info.Additional.ToString()), GetParameter(ParmPublishmentsystemId, EDataType.Integer, info.PublishmentSystemId) }; if (info.IsHeadquarters) { UpdateAllIsHeadquarters(); } ExecuteNonQuery(SqlUpdatePublishmentSystem, updateParms); PublishmentSystemManager.ClearCache(true); }
public int GetCountByDepartmentIdAndState(PublishmentSystemInfo publishmentSystemInfo, int departmentId, EGovInteractState state) { string sqlString = $"SELECT COUNT(*) AS TotalNum FROM {publishmentSystemInfo.AuxiliaryTableForGovInteract} WHERE PublishmentSystemID = {publishmentSystemInfo.PublishmentSystemId} AND DepartmentID = {departmentId} AND State = '{EGovInteractStateUtils.GetValue(state)}'"; return(BaiRongDataProvider.DatabaseDao.GetIntResult(sqlString)); }
public int GetCountByDepartmentIdAndState(PublishmentSystemInfo publishmentSystemInfo, int departmentId, EGovInteractState state, DateTime begin, DateTime end) { string sqlString = $"SELECT COUNT(*) AS TotalNum FROM {publishmentSystemInfo.AuxiliaryTableForGovInteract} WHERE PublishmentSystemID = {publishmentSystemInfo.PublishmentSystemId} AND DepartmentID = {departmentId} AND State = '{EGovInteractStateUtils.GetValue(state)}' AND (AddDate BETWEEN '{begin.ToShortDateString()}' AND '{end.AddDays(1).ToShortDateString()}')"; return(BaiRongDataProvider.DatabaseDao.GetIntResult(sqlString)); }
public int GetCountByNodeId(PublishmentSystemInfo publishmentSystemInfo, int nodeId) { string sqlString = $"SELECT COUNT(*) AS TotalNum FROM {publishmentSystemInfo.AuxiliaryTableForGovInteract} WHERE (NodeID = {nodeId})"; return(BaiRongDataProvider.DatabaseDao.GetIntResult(sqlString)); }
public int GetCountByDepartmentId(PublishmentSystemInfo publishmentSystemInfo, int departmentId) { string sqlString = $"SELECT COUNT(*) AS TotalNum FROM {publishmentSystemInfo.AuxiliaryTableForGovInteract} WHERE PublishmentSystemID = {publishmentSystemInfo.PublishmentSystemId} AND DepartmentID = {departmentId}"; return(BaiRongDataProvider.DatabaseDao.GetIntResult(sqlString)); }
public string GetSelectString(PublishmentSystemInfo publishmentSystemInfo, int nodeId, string state, string dateFrom, string dateTo, string keyword) { var whereBuilder = new StringBuilder(); whereBuilder.Append( $"WHERE PublishmentSystemID = {publishmentSystemInfo.PublishmentSystemId} AND NodeID = {nodeId}"); if (!string.IsNullOrEmpty(state)) { whereBuilder.Append($" AND (State = '{state}')"); } if (!string.IsNullOrEmpty(dateFrom)) { whereBuilder.Append($" AND ({ContentAttribute.AddDate} >= '{dateFrom}')"); } if (!string.IsNullOrEmpty(dateTo)) { whereBuilder.Append($" AND ({ContentAttribute.AddDate} <= '{dateTo}')"); } if (!string.IsNullOrEmpty(keyword)) { var filterKeyword = PageUtils.FilterSql(keyword); whereBuilder.Append($" AND (Title LIKE '{filterKeyword}' OR Content LIKE '{filterKeyword}')"); } return(BaiRongDataProvider.TableStructureDao.GetSelectSqlString(publishmentSystemInfo.AuxiliaryTableForGovInteract, SqlUtils.Asterisk, whereBuilder.ToString())); }
public string GetSelectString(PublishmentSystemInfo publishmentSystemInfo, int nodeId) { string whereString = $"WHERE PublishmentSystemID = {publishmentSystemInfo.PublishmentSystemId} AND NodeID = {nodeId}"; return(BaiRongDataProvider.TableStructureDao.GetSelectSqlString(publishmentSystemInfo.AuxiliaryTableForGovInteract, SqlUtils.Asterisk, whereString)); }
public int GetNodeId(PublishmentSystemInfo publishmentSystemInfo, int contentId) { string sqlString = $"SELECT NodeID FROM {publishmentSystemInfo.AuxiliaryTableForGovInteract} WHERE ID = {contentId}"; return(BaiRongDataProvider.DatabaseDao.GetIntResult(sqlString)); }
public int GetContentNum(PublishmentSystemInfo publishmentSystemInfo) { string sqlString = $"SELECT COUNT(*) AS TotalNum FROM {publishmentSystemInfo.AuxiliaryTableForVote} WHERE PublishmentSystemID = {publishmentSystemInfo.PublishmentSystemId}"; return(BaiRongDataProvider.DatabaseDao.GetIntResult(sqlString)); }
public void UpdateDepartmentId(PublishmentSystemInfo publishmentSystemInfo, int contentId, int departmentId) { string sqlString = $"UPDATE {publishmentSystemInfo.AuxiliaryTableForGovInteract} SET DepartmentID = {departmentId} WHERE ID = {contentId}"; ExecuteNonQuery(sqlString); }
public VoteContentInfo GetContentInfo(PublishmentSystemInfo publishmentSystemInfo, int contentId) { VoteContentInfo info = null; if (contentId > 0) { if (!string.IsNullOrEmpty(publishmentSystemInfo.AuxiliaryTableForVote)) { string sqlWhere = $"WHERE ID = {contentId}"; var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(publishmentSystemInfo.AuxiliaryTableForVote, SqlUtils.Asterisk, sqlWhere); using (var rdr = ExecuteReader(sqlSelect)) { if (rdr.Read()) { info = new VoteContentInfo(); BaiRongDataProvider.DatabaseDao.ReadResultsToExtendedAttributes(rdr, info); } rdr.Close(); } } } if (info != null) { info.AfterExecuteReader(); } return(info); }
public void UpdateDepartmentId(PublishmentSystemInfo publishmentSystemInfo, ArrayList idCollection, int departmentId) { string sqlString = $"UPDATE {publishmentSystemInfo.AuxiliaryTableForGovInteract} SET DepartmentID = {departmentId} WHERE ID IN ({TranslateUtils.ToSqlInStringWithoutQuote(idCollection)})"; ExecuteNonQuery(sqlString); }
public void Update(PublishmentSystemInfo publishmentSystemInfo, TemplateInfo templateInfo, string templateContent, string administratorName) { if (templateInfo.IsDefault) { SetAllTemplateDefaultToFalse(publishmentSystemInfo.PublishmentSystemId, templateInfo.TemplateType); } var updateParms = new IDataParameter[] { 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()), GetParameter(ParmTemplateId, EDataType.Integer, templateInfo.TemplateId) }; ExecuteNonQuery(SqlUpdateTemplate, updateParms); TemplateManager.WriteContentToTemplateFile(publishmentSystemInfo, templateInfo, templateContent, administratorName); TemplateManager.RemoveCache(templateInfo.PublishmentSystemId); }
public static void CreateWeiXinContent(PublishmentSystemInfo publishmentSystemInfo, int keywordID, int resourceID) { var keywordInfo = DataProviderWX.KeywordDAO.GetKeywordInfo(keywordID); if (keywordInfo != null) { var filePath = PathUtilityWX.GetWeiXinFilePath(publishmentSystemInfo, keywordID, resourceID); var templateFilePath = PathUtilityWX.GetWeiXinTemplateFilePath(); var serviceUrl = PageUtilityWX.GetWeiXinTemplateDirectoryUrl(publishmentSystemInfo); var builder = new StringBuilder(FileUtils.ReadText(templateFilePath, ECharset.utf_8)); var resourceInfo = DataProviderWX.KeywordResourceDAO.GetResourceInfo(resourceID); if (resourceInfo != null) { builder.Replace("{serviceUrl}", serviceUrl); builder.Replace("{title}", resourceInfo.Title); if (resourceInfo.IsShowCoverPic && !string.IsNullOrEmpty(resourceInfo.ImageUrl)) { builder.Replace("{image}", $@"<img src=""{PageUtils.AddProtocolToUrl( PageUtility.ParseNavigationUrl(publishmentSystemInfo, resourceInfo.ImageUrl))}"" />"); } else { builder.Replace("{image}", string.Empty); } builder.Replace("{addDate}", DateUtils.GetDateString(keywordInfo.AddDate)); builder.Replace("{weixinName}", publishmentSystemInfo.PublishmentSystemName); builder.Replace("{content}", resourceInfo.Content); } FileUtils.WriteText(filePath, ECharset.utf_8, builder.ToString()); } }
public void InsertWithTrans(PublishmentSystemInfo info, IDbTransaction trans) { //获取排序值 var taxis = GetMaxTaxis() + 1; var insertParms = new IDataParameter[] { GetParameter(ParmPublishmentsystemId, EDataType.Integer, info.PublishmentSystemId), GetParameter(ParmPublishmentsystemName, EDataType.NVarChar, 50, info.PublishmentSystemName), GetParameter(ParmPublishmentsystemType, EDataType.VarChar, 50, EPublishmentSystemTypeUtils.GetValue(info.PublishmentSystemType)), GetParameter(ParmAuxiliaryTableForContent, EDataType.VarChar, 50, info.AuxiliaryTableForContent), GetParameter(ParmAuxiliaryTableForGovpublic, EDataType.VarChar, 50, info.AuxiliaryTableForGovPublic), GetParameter(ParmAuxiliaryTableForGovinteract, EDataType.VarChar, 50, info.AuxiliaryTableForGovInteract), GetParameter(ParmAuxiliaryTableForVote, EDataType.VarChar, 50, info.AuxiliaryTableForVote), GetParameter(ParmAuxiliaryTableForJob, EDataType.VarChar, 50, info.AuxiliaryTableForJob), GetParameter(ParmIsCheckContentUseLevel, EDataType.VarChar, 18, info.IsCheckContentUseLevel.ToString()), GetParameter(ParmCheckContentLevel, EDataType.Integer, info.CheckContentLevel), GetParameter(ParmPublishmentsystemDir, EDataType.VarChar, 50, info.PublishmentSystemDir), GetParameter(ParmPublishmentsystemUrl, EDataType.VarChar, 200, info.PublishmentSystemUrl), GetParameter(ParmIsHeadquarters, EDataType.VarChar, 18, info.IsHeadquarters.ToString()), GetParameter(ParmParentPublishmentsystemid, EDataType.Integer, info.ParentPublishmentSystemId), GetParameter(ParmTaxis, EDataType.Integer, taxis), GetParameter(ParmSettingsXml, EDataType.NText, info.Additional.ToString()) }; ExecuteNonQuery(trans, SqlInsertPublishmentSystem, insertParms); PublishmentSystemManager.ClearCache(true); }
//level=0代表站点根目录,1代表下一级目标。。。返回代码类似../images/pic.jpg public static string GetPublishmentSystemUrlOfRelatedByPhysicalPath(PublishmentSystemInfo publishmentSystemInfo, string physicalPath, int level) { if (publishmentSystemInfo == null) { var publishmentSystemId = PathUtility.GetCurrentPublishmentSystemId(); publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId); } if (!string.IsNullOrEmpty(physicalPath)) { var publishmentSystemPath = PathUtility.GetPublishmentSystemPath(publishmentSystemInfo); var requestPath = physicalPath.ToLower().Replace(publishmentSystemPath.ToLower(), string.Empty); requestPath = requestPath.Replace(PathUtils.SeparatorChar, PageUtils.SeparatorChar); requestPath = requestPath.Trim(PageUtils.SeparatorChar); if (level > 0) { for (var i = 0; i < level; i++) { requestPath = "../" + requestPath; } } return(requestPath); } else { return(string.Empty); } }
private static string ParseDateTime(PublishmentSystemInfo publishmentSystemInfo, string attributeName, NameValueCollection pageScripts, TableStyleInfo styleInfo) { var builder = new StringBuilder(); var dateTime = DateUtils.SqlMinValue; if (!string.IsNullOrEmpty(styleInfo.DefaultValue)) { dateTime = styleInfo.DefaultValue == Current ? DateTime.Now : TranslateUtils.ToDateTime(styleInfo.DefaultValue); } if (pageScripts != null) { pageScripts["calendar"] = $@"<script type=""text/javascript"" src=""{SiteFilesAssets.GetUrl(publishmentSystemInfo.Additional.ApiUrl, SiteFilesAssets.DatePicker.Js)}""></script>"; } var value = string.Empty; if (dateTime > DateUtils.SqlMinValue) { value = DateUtils.GetDateAndTimeString(dateTime, EDateFormatType.Day, ETimeFormatType.LongTime); } builder.Append( $@"<input id=""{attributeName}"" type=""text"" value=""{value}"" onfocus=""{SiteFilesAssets.DatePicker.OnFocus}"" />"); AddHelpText(builder, styleInfo.HelpText); return(builder.ToString()); }
public static string GetPublishmentSystemVirtualUrlByAbsoluteUrl(PublishmentSystemInfo publishmentSystemInfo, string absoluteUrl) { if (publishmentSystemInfo == null) { var publishmentSystemId = PathUtility.GetCurrentPublishmentSystemId(); publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId); } if (!string.IsNullOrEmpty(absoluteUrl)) { if (PageUtils.IsProtocolUrl(absoluteUrl) || absoluteUrl.StartsWith("/")) { absoluteUrl = absoluteUrl.ToLower(); var publishmentSystemUrl = GetPublishmentSystemUrl(publishmentSystemInfo, string.Empty).ToLower(); if (PageUtils.IsProtocolUrl(absoluteUrl)) { publishmentSystemUrl = PageUtils.AddProtocolToUrl(publishmentSystemUrl); } absoluteUrl = StringUtils.ReplaceFirst(publishmentSystemUrl, absoluteUrl, string.Empty); } else if (absoluteUrl.StartsWith(".")) { absoluteUrl = absoluteUrl.Replace("../", string.Empty); absoluteUrl = absoluteUrl.Replace("./", string.Empty); } return(PageUtils.Combine("@", absoluteUrl)); } else { return(string.Empty); } }
public void UpdateAutoPageContent(string tableName, PublishmentSystemInfo publishmentSystemInfo) { if (publishmentSystemInfo.Additional.IsAutoPageInTextEditor) { string sqlString = $"SELECT ID, [{BackgroundContentAttribute.Content}] FROM [{tableName}] WHERE ([PublishmentSystemID] = {publishmentSystemInfo.PublishmentSystemId})"; using (var rdr = ExecuteReader(sqlString)) { while (rdr.Read()) { var contentId = GetInt(rdr, 0); var content = GetString(rdr, 1); if (!string.IsNullOrEmpty(content)) { content = ContentUtility.GetAutoPageContent(content, publishmentSystemInfo.Additional.AutoPageWordNum); string updateString = $"UPDATE [{tableName}] SET [{BackgroundContentAttribute.Content}] = '{content}' WHERE ID = {contentId}"; try { ExecuteNonQuery(updateString); } catch { // ignored } } } rdr.Close(); } } }
/// <summary> /// 从设置信息中的RootUrl中取得地址,并结合发布系统和相对地址,得到能够运行动态文件的地址。 /// </summary> public static string GetRootUrlByPublishmentSystemId(PublishmentSystemInfo psInfo, string requestPath) { if (psInfo == null) { var publishmentSystemId = PathUtility.GetCurrentPublishmentSystemId(); psInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId); } //string url = ConfigUtils.Instance.ApplicationPath; var url = PageUtils.GetRootUrl(string.Empty); if (url.EndsWith("/")) { url = url.Substring(0, url.Length - 1); } url += "/" + psInfo.PublishmentSystemDir; if (requestPath != null && requestPath.Trim().Length > 0) { if (requestPath.StartsWith("/")) { requestPath = requestPath.Substring(1); } if (requestPath.EndsWith("/")) { requestPath = requestPath.Substring(0, requestPath.Length - 1); } url = url + "/" + requestPath; } return(url); }
private string GetPublishmentSystemNameHtml(PublishmentSystemInfo publishmentSystemInfo) { var level = PublishmentSystemManager.GetPublishmentSystemLevel(publishmentSystemInfo.PublishmentSystemId); var psLogo = string.Empty; if (publishmentSystemInfo.IsHeadquarters) { psLogo = "siteHQ.gif"; } else { psLogo = "site.gif"; if (level > 0 && level < 10) { psLogo = $"subsite{level + 1}.gif"; } } psLogo = SiteServerAssets.GetIconUrl("tree/" + psLogo); var padding = string.Empty; for (var i = 0; i < level; i++) { padding += " "; } if (level > 0) { padding += "└ "; } return ($"{padding}<img align='absbottom' border='0' src='{psLogo}'/> <a href='{publishmentSystemInfo.PublishmentSystemUrl}' target='_blank'>{publishmentSystemInfo.PublishmentSystemName}</a>"); }
private static string GetChannelUrlNotComputed(PublishmentSystemInfo publishmentSystemInfo, int nodeId, ENodeType nodeType, bool isFromBackground) { if (nodeType == ENodeType.BackgroundPublishNode) { return(GetIndexPageUrl(publishmentSystemInfo, isFromBackground)); } var linkUrl = string.Empty; var nodeInfo = NodeManager.GetNodeInfo(publishmentSystemInfo.PublishmentSystemId, nodeId); if (nodeInfo != null) { linkUrl = nodeInfo.LinkUrl; } if (string.IsNullOrEmpty(linkUrl)) { if (nodeInfo != null) { var filePath = nodeInfo.FilePath; if (string.IsNullOrEmpty(filePath)) { var channelUrl = PathUtility.ChannelFilePathRules.Parse(publishmentSystemInfo, nodeId); return(GetPublishmentSystemUrl(publishmentSystemInfo, channelUrl, isFromBackground)); } return(ParseNavigationUrl(publishmentSystemInfo, PathUtility.AddVirtualToPath(filePath), isFromBackground)); } } return(ParseNavigationUrl(publishmentSystemInfo, linkUrl, isFromBackground)); }
public static void ChangeToSubSite(PublishmentSystemInfo publishmentSystemInfo, string psDir, ArrayList fileSystemNameArrayList) { if (publishmentSystemInfo.IsHeadquarters) { publishmentSystemInfo.IsHeadquarters = false; publishmentSystemInfo.PublishmentSystemDir = psDir.Trim(); publishmentSystemInfo.PublishmentSystemUrl = PageUtils.Combine(WebConfigUtils.ApplicationPath, psDir.Trim()); DataProvider.PublishmentSystemDao.Update(publishmentSystemInfo); var psPath = PathUtils.Combine(WebConfigUtils.PhysicalApplicationPath, psDir); DirectoryUtils.CreateDirectoryIfNotExists(psPath); if (fileSystemNameArrayList != null && fileSystemNameArrayList.Count > 0) { foreach (string fileSystemName in fileSystemNameArrayList) { var srcPath = PathUtils.Combine(WebConfigUtils.PhysicalApplicationPath, fileSystemName); if (DirectoryUtils.IsDirectoryExists(srcPath)) { var destDirectoryPath = PathUtils.Combine(psPath, fileSystemName); DirectoryUtils.CreateDirectoryIfNotExists(destDirectoryPath); DirectoryUtils.MoveDirectory(srcPath, destDirectoryPath, false); DirectoryUtils.DeleteDirectoryIfExists(srcPath); } else if (FileUtils.IsFileExists(srcPath)) { FileUtils.CopyFile(srcPath, PathUtils.Combine(psPath, fileSystemName)); FileUtils.DeleteFileIfExists(srcPath); } } } } }
public bool UploadGovPublicApply(PublishmentSystemInfo publishmentSystemInfo, out string message, out string url, out string value) { message = url = value = string.Empty; if (HttpContext.Current.Request.Files.Count == 0) { return(false); } var postedFile = HttpContext.Current.Request.Files[0]; var filePath = postedFile.FileName; try { var fileExtName = PathUtils.GetExtension(filePath).ToLower(); var localDirectoryPath = PathUtility.GetUploadDirectoryPath(publishmentSystemInfo, fileExtName); var localFileName = PathUtility.GetUploadFileName(publishmentSystemInfo, filePath); var localFilePath = PathUtils.Combine(localDirectoryPath, localFileName); postedFile.SaveAs(localFilePath); url = PageUtility.GetPublishmentSystemUrlByPhysicalPath(publishmentSystemInfo, localFilePath); value = PageUtility.GetVirtualUrl(publishmentSystemInfo, url); return(true); } catch (Exception ex) { //message = ex.Message; message = "程序出错。"; } return(false); }