public static string ParseNavigationUrl(int publishmentSystemId, string url) { var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId); return(ParseNavigationUrl(publishmentSystemInfo, url, false)); }
public static void Translate(string administratorName, PublishmentSystemInfo publishmentSystemInfo, int nodeId, int contentId, int targetPublishmentSystemId, int targetNodeId, ETranslateContentType translateType) { if (publishmentSystemInfo == null || nodeId <= 0 || contentId <= 0 || targetPublishmentSystemId <= 0 || targetNodeId <= 0) { return; } var targetPublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(targetPublishmentSystemId); var targetTableName = NodeManager.GetTableName(targetPublishmentSystemInfo, targetNodeId); var nodeInfo = NodeManager.GetNodeInfo(publishmentSystemInfo.PublishmentSystemId, nodeId); var tableStyle = NodeManager.GetTableStyle(publishmentSystemInfo, nodeInfo); var tableName = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo); var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentId); if (contentInfo == null) { return; } if (translateType == ETranslateContentType.Copy) { FileUtility.MoveFileByContentInfo(publishmentSystemInfo, targetPublishmentSystemInfo, contentInfo); contentInfo.PublishmentSystemId = targetPublishmentSystemId; contentInfo.SourceId = contentInfo.NodeId; contentInfo.NodeId = targetNodeId; contentInfo.Attributes[ContentAttribute.TranslateContentType] = ETranslateContentType.Copy.ToString(); //contentInfo.Attributes.Add(ContentAttribute.TranslateContentType, ETranslateContentType.Copy.ToString()); var theContentId = DataProvider.ContentDao.Insert(targetTableName, targetPublishmentSystemInfo, contentInfo); if (EContentModelTypeUtils.IsPhoto(nodeInfo.ContentModelId)) { var photoInfoList = DataProvider.PhotoDao.GetPhotoInfoList(publishmentSystemInfo.PublishmentSystemId, contentId); if (photoInfoList.Count > 0) { foreach (var photoInfo in photoInfoList) { photoInfo.PublishmentSystemID = targetPublishmentSystemId; photoInfo.ContentID = theContentId; FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.SmallUrl); FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.MiddleUrl); FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.LargeUrl); DataProvider.PhotoDao.Insert(photoInfo); } } } if (contentInfo.IsChecked) { CreateManager.CreateContentAndTrigger(targetPublishmentSystemInfo.PublishmentSystemId, contentInfo.NodeId, theContentId); } } else if (translateType == ETranslateContentType.Cut) { FileUtility.MoveFileByContentInfo(publishmentSystemInfo, targetPublishmentSystemInfo, contentInfo); contentInfo.PublishmentSystemId = targetPublishmentSystemId; contentInfo.SourceId = contentInfo.NodeId; contentInfo.NodeId = targetNodeId; contentInfo.Attributes[ContentAttribute.TranslateContentType] = ETranslateContentType.Cut.ToString(); //contentInfo.Attributes.Add(ContentAttribute.TranslateContentType, ETranslateContentType.Cut.ToString()); if (StringUtils.EqualsIgnoreCase(tableName, targetTableName)) { contentInfo.Taxis = DataProvider.ContentDao.GetTaxisToInsert(targetTableName, targetNodeId, contentInfo.IsTop); DataProvider.ContentDao.Update(targetTableName, targetPublishmentSystemInfo, contentInfo); } else { DataProvider.ContentDao.Insert(targetTableName, targetPublishmentSystemInfo, contentInfo); DataProvider.ContentDao.DeleteContents(publishmentSystemInfo.PublishmentSystemId, tableName, TranslateUtils.ToIntList(contentId), nodeId); } DataProvider.NodeDao.UpdateContentNum(publishmentSystemInfo, nodeId, true); DataProvider.NodeDao.UpdateContentNum(targetPublishmentSystemInfo, targetNodeId, true); if (EContentModelTypeUtils.IsPhoto(nodeInfo.ContentModelId)) { var photoInfoList = DataProvider.PhotoDao.GetPhotoInfoList(publishmentSystemInfo.PublishmentSystemId, contentId); if (photoInfoList.Count > 0) { foreach (var photoInfo in photoInfoList) { photoInfo.PublishmentSystemID = targetPublishmentSystemId; FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.SmallUrl); FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.MiddleUrl); FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.LargeUrl); DataProvider.PhotoDao.Update(photoInfo); } } } if (contentInfo.IsChecked) { CreateManager.CreateContentAndTrigger(targetPublishmentSystemInfo.PublishmentSystemId, contentInfo.NodeId, contentInfo.Id); } } else if (translateType == ETranslateContentType.Reference) { if (contentInfo.ReferenceId != 0) { return; } contentInfo.PublishmentSystemId = targetPublishmentSystemId; contentInfo.SourceId = contentInfo.NodeId; contentInfo.NodeId = targetNodeId; contentInfo.ReferenceId = contentId; contentInfo.Attributes[ContentAttribute.TranslateContentType] = ETranslateContentType.Reference.ToString(); //contentInfo.Attributes.Add(ContentAttribute.TranslateContentType, ETranslateContentType.Reference.ToString()); DataProvider.ContentDao.Insert(targetTableName, targetPublishmentSystemInfo, contentInfo); } else if (translateType == ETranslateContentType.ReferenceContent) { if (contentInfo.ReferenceId != 0) { return; } FileUtility.MoveFileByContentInfo(publishmentSystemInfo, targetPublishmentSystemInfo, contentInfo); contentInfo.PublishmentSystemId = targetPublishmentSystemId; contentInfo.SourceId = contentInfo.NodeId; contentInfo.NodeId = targetNodeId; contentInfo.ReferenceId = contentId; contentInfo.Attributes[ContentAttribute.TranslateContentType] = ETranslateContentType.ReferenceContent.ToString(); var theContentId = DataProvider.ContentDao.Insert(targetTableName, targetPublishmentSystemInfo, contentInfo); if (EContentModelTypeUtils.IsPhoto(nodeInfo.ContentModelId)) { var photoInfoList = DataProvider.PhotoDao.GetPhotoInfoList(publishmentSystemInfo.PublishmentSystemId, contentId); if (photoInfoList.Count > 0) { foreach (var photoInfo in photoInfoList) { photoInfo.PublishmentSystemID = targetPublishmentSystemId; photoInfo.ContentID = theContentId; FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.SmallUrl); FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.MiddleUrl); FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.LargeUrl); DataProvider.PhotoDao.Insert(photoInfo); } } } if (contentInfo.IsChecked) { CreateManager.CreateContentAndTrigger(targetPublishmentSystemInfo.PublishmentSystemId, contentInfo.NodeId, theContentId); } } }
public static string GetPublishmentSystemPath(int publishmentSystemId, params string[] paths) { return(GetPublishmentSystemPath(PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId), paths)); }