public static void TransContentInfo(SiteInfo siteInfo, ChannelInfo channelInfo, int contentId, SiteInfo targetSiteInfo, int targetChannelId) { var targetTableName = ChannelManager.GetTableName(targetSiteInfo, targetChannelId); var tableName = ChannelManager.GetTableName(siteInfo, channelInfo); var contentInfo = DataProvider.ContentDao.GetContentInfo(tableName, contentId); FileUtility.MoveFileByContentInfo(siteInfo, targetSiteInfo, contentInfo); contentInfo.SiteId = targetSiteInfo.Id; contentInfo.SourceId = channelInfo.Id; contentInfo.ChannelId = targetChannelId; contentInfo.IsChecked = targetSiteInfo.Additional.IsCrossSiteTransChecked; contentInfo.CheckedLevel = 0; //复制 if (Equals(channelInfo.Additional.TransDoneType, ETranslateContentType.Copy)) { contentInfo.Set(ContentAttribute.TranslateContentType, ETranslateContentType.Copy.ToString()); } //引用地址 else if (Equals(channelInfo.Additional.TransDoneType, ETranslateContentType.Reference)) { contentInfo.SiteId = targetSiteInfo.Id; contentInfo.SourceId = channelInfo.Id; contentInfo.ChannelId = targetChannelId; contentInfo.ReferenceId = contentId; contentInfo.Set(ContentAttribute.TranslateContentType, ETranslateContentType.Reference.ToString()); } //引用内容 else if (Equals(channelInfo.Additional.TransDoneType, ETranslateContentType.ReferenceContent)) { contentInfo.SiteId = targetSiteInfo.Id; contentInfo.SourceId = channelInfo.Id; contentInfo.ChannelId = targetChannelId; contentInfo.ReferenceId = contentId; contentInfo.Set(ContentAttribute.TranslateContentType, ETranslateContentType.ReferenceContent.ToString()); } if (!string.IsNullOrEmpty(targetTableName)) { DataProvider.ContentDao.Insert(targetTableName, targetSiteInfo, contentInfo); #region 制资源 //资源:图片,文件,视频 if (!string.IsNullOrEmpty(contentInfo.GetString(BackgroundContentAttribute.ImageUrl))) { //修改图片 var sourceImageUrl = PathUtility.MapPath(siteInfo, contentInfo.GetString(BackgroundContentAttribute.ImageUrl)); CopyReferenceFiles(targetSiteInfo, sourceImageUrl, siteInfo); } else if (!string.IsNullOrEmpty(contentInfo.GetString(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.ImageUrl)))) { var sourceImageUrls = TranslateUtils.StringCollectionToStringList(contentInfo.GetString(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.ImageUrl))); foreach (string imageUrl in sourceImageUrls) { var sourceImageUrl = PathUtility.MapPath(siteInfo, imageUrl); CopyReferenceFiles(targetSiteInfo, sourceImageUrl, siteInfo); } } if (!string.IsNullOrEmpty(contentInfo.GetString(BackgroundContentAttribute.FileUrl))) { //修改附件 var sourceFileUrl = PathUtility.MapPath(siteInfo, contentInfo.GetString(BackgroundContentAttribute.FileUrl)); CopyReferenceFiles(targetSiteInfo, sourceFileUrl, siteInfo); } else if (!string.IsNullOrEmpty(contentInfo.GetString(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl)))) { var sourceFileUrls = TranslateUtils.StringCollectionToStringList(contentInfo.GetString(ContentAttribute.GetExtendAttributeName(BackgroundContentAttribute.FileUrl))); foreach (string fileUrl in sourceFileUrls) { var sourceFileUrl = PathUtility.MapPath(siteInfo, fileUrl); CopyReferenceFiles(targetSiteInfo, sourceFileUrl, siteInfo); } } #endregion } }
//public static VisualInfo GetInstance() //{ // var siteId = TranslateUtils.ToInt(HttpContext.Current.Request.QueryString["s"]); ; // var channelId = TranslateUtils.ToInt(HttpContext.Current.Request.QueryString["n"]); ; // var contentId = TranslateUtils.ToInt(HttpContext.Current.Request.QueryString["c"]); // var fileTemplateId = TranslateUtils.ToInt(HttpContext.Current.Request.QueryString["f"]); // var pageIndex = TranslateUtils.ToInt(HttpContext.Current.Request.QueryString["p"]); // var previewId = TranslateUtils.ToInt(HttpContext.Current.Request.QueryString["previewId"]);//编辑界面预览 // return GetInstance(siteId, channelId, contentId, fileTemplateId, pageIndex, previewId); //} public static VisualInfo GetInstance(int siteId, int channelId, int contentId, int fileTemplateId, int pageIndex, int previewId) { var visualInfo = new VisualInfo { SiteId = siteId, ChannelId = channelId, ContentId = contentId, FileTemplateId = fileTemplateId, PageIndex = pageIndex }; if (visualInfo.SiteId == 0) { visualInfo.SiteId = PathUtility.GetCurrentSiteId(); } if (previewId > 0) { visualInfo.IsPreview = true; visualInfo.ContentId = previewId; } if (visualInfo.ChannelId > 0) { visualInfo.TemplateType = TemplateType.ChannelTemplate; } if (visualInfo.ContentId > 0 || visualInfo.IsPreview) { visualInfo.TemplateType = TemplateType.ContentTemplate; } if (visualInfo.FileTemplateId > 0) { visualInfo.TemplateType = TemplateType.FileTemplate; } if (visualInfo.ChannelId == 0) { visualInfo.ChannelId = visualInfo.SiteId; } var siteInfo = SiteManager.GetSiteInfo(visualInfo.SiteId); if (visualInfo.TemplateType == TemplateType.IndexPageTemplate) { var templateInfo = TemplateManager.GetIndexPageTemplateInfo(visualInfo.SiteId); var isHeadquarters = siteInfo.IsRoot; visualInfo.FilePath = PathUtility.GetIndexPageFilePath(siteInfo, templateInfo.CreatedFileFullName, isHeadquarters, visualInfo.PageIndex); } else if (visualInfo.TemplateType == TemplateType.ChannelTemplate) { visualInfo.FilePath = PathUtility.GetChannelPageFilePath(siteInfo, visualInfo.ChannelId, visualInfo.PageIndex); } else if (visualInfo.TemplateType == TemplateType.ContentTemplate) { visualInfo.FilePath = PathUtility.GetContentPageFilePath(siteInfo, visualInfo.ChannelId, visualInfo.ContentId, visualInfo.PageIndex); } else if (visualInfo.TemplateType == TemplateType.FileTemplate) { var templateInfo = TemplateManager.GetFileTemplateInfo(visualInfo.SiteId, visualInfo.FileTemplateId); visualInfo.FilePath = PathUtility.MapPath(siteInfo, templateInfo.CreatedFileFullName); } return(visualInfo); }
static PublishmentSystemManager() { var fileWatcher = new FileWatcherClass(PathUtility.GetCacheFilePath(CacheFileName)); fileWatcher.OnFileChange += fileWatcher_OnFileChange; }
public static string GetIncludeContent(SiteInfo siteInfo, string file, ECharset charset) { var filePath = PathUtility.MapPath(siteInfo, PathUtility.AddVirtualToPath(file)); return(GetContentByFilePath(filePath, charset)); }