// Constructors //////////////////////////////////////////// public ConfigurationWrapper(SNC.Content configContent) { if (configContent == null) throw new ArgumentNullException("configContent"); _configContent = configContent; }
internal static List<SNC.Content> GetChildren(int contentId, string repositoryId, out SNC.Content folder) { SNC.Content content = null; content = SNC.Content.Load(contentId); if (content == null) throw new ArgumentException("Object '" + contentId + "' is not exist in '" + repositoryId + "' repository"); var ifolder = content.ContentHandler as IFolder; if (ifolder == null) throw new ArgumentException("Object is not a folder (id = '" + contentId + "')"); var contentList = new List<SNC.Content>(); foreach (var node in ifolder.Children) contentList.Add(SNC.Content.Create(node)); folder = content; return contentList; }
private static string GenerateAtomContent(SNC.Content content) { return String.Concat( "Name: ", content.Name, ", type: ", String.IsNullOrEmpty(content.ContentType.DisplayName) ? content.ContentType.Name : content.ContentType.DisplayName, content.ContentHandler is IFolder ? ". This object can contain other objects" : "", ". ", String.IsNullOrEmpty(content.ContentType.Description) ? "" : content.ContentType.Description ); }
private void BuildAfterSubmitForm(SNC.Content formitem) { if (!string.IsNullOrEmpty(AfterSubmitViewPath)) { BuildAfterSubmitForm_ContentView(formitem); } else { Controls.Add(new LiteralControl(string.Concat("<div class=\"sn-form-submittext\">", CurrentForm.AfterSubmitText, "</div>"))); Button ok = new Button(); ok.ID = "btnOk"; ok.Text = "Ok"; ok.CssClass = "sn-submit"; ok.Click += new EventHandler(ok_Click); Controls.Add(ok); } }
private static List<CmisProperty> BuildCmisProperties(SNC.Content content) { var cmisProps = new List<CmisProperty>(); foreach (var fieldName in content.Fields.Keys) { var field = content.Fields[fieldName]; var fieldValue = field.GetData(); if (fieldValue == null) continue; if (fieldName == "NodeType" || fieldName == "Path" || fieldName == "Password") continue; if (fieldName == "Index") { cmisProps.Add(new CmisIntegerProperty { Name = fieldName, Value = Convert.ToInt32(fieldValue) }); } else if (fieldName == "Id") { cmisProps.Add(new CmisIdProperty { Name = fieldName, Value = fieldValue }); } else if (fieldValue is int) { cmisProps.Add(new CmisIntegerProperty { Name = fieldName, Value = fieldValue }); } else if (fieldValue is decimal) { cmisProps.Add(new CmisDecimalProperty { Name = fieldName, Value = fieldValue }); } else if (fieldValue is Boolean) { cmisProps.Add(new CmisBooleanProperty { Name = fieldName, Value = fieldValue }); } else if (fieldValue is WhoAndWhenField.WhoAndWhenData) { var whoAndWhenValue = (WhoAndWhenField.WhoAndWhenData)fieldValue; cmisProps.Add(new CmisDateTimeProperty { Name = fieldName + "_When", Value = whoAndWhenValue.When }); cmisProps.Add(new CmisStringProperty { Name = fieldName + "_Who", Value = whoAndWhenValue.Who.Name }); } else if (fieldValue is HyperLinkField.HyperlinkData) { var hyperlinkData = (HyperLinkField.HyperlinkData)fieldValue; cmisProps.Add(new CmisUriProperty { Name = fieldName, Value = hyperlinkData.Href }); } else if (fieldValue is List<string>) { cmisProps.Add(new CmisStringProperty { Name = fieldName, Value = String.Join(",", ((List<string>)fieldValue).ToArray()) }); } else { cmisProps.Add(new CmisStringProperty { Name = fieldName, Value = fieldValue.ToString() }); } } return cmisProps; }
private static CmisAllowableActions GetAllowableActions(SNC.Content content) { if (content.ContentHandler is IFolder) { return new CmisAllowableFolderActions { CanGetParent = content.ContentHandler.ParentId == 0 ? false : content.ContentHandler.ParentId != Repository.Root.Id, CanAddPolicy = false, CanGetChildren = true, CanDelete = false, CanGetDescendants = false, CanGetProperties = false, CanMove = false, CanRemovePolicy = false, CanUpdateProperties = false }; } else return new CmisAllowableDocumentActions { CanAddPolicy = false, CanAddToFolder = false, CanCancelCheckout = false, CanCheckin = false, CanCheckout = false, CanDelete = false, CanDeleteContent = false, CanDeleteVersion = false, CanGetAllVersions = false, CanGetParents = false, CanGetProperties = false, CanMove = false, CanRemoveFromFolder = false, CanRemovePolicy = false, CanSetContent = false, CanUpdateProperties = false, CanViewContent = false }; }
/// <summary> /// Creates the ContenView for the <see cref="SenseNet.ContentRepository.Content ">Content</see>. /// </summary> /// <param name="content">The Content belonging to the the ContentView</param> /// <param name="aspNetPage"></param> /// <param name="mode">The ViewMode in which FieldControls of the ContentView will be rendered</param> /// <param name="viewPath">The location of the file defining the ContentView</param> public static ContentView Create(SNC.Content content, System.Web.UI.Page aspNetPage, ViewMode mode, string viewPath) { // ways to call this function: // - absolute actual: "/Root/Global/contentviews/Book/Edit.ascx" // - relative actual: "$skin/contentviews/Book/Edit.ascx" // - absolute root: "/Root/Global/contentviews" // - relative root: "$skin/contentviews" // - empty string: "" var resolvedPath = ResolveContentViewPath(content, mode, viewPath); if (string.IsNullOrEmpty(resolvedPath)) { if (viewPath.ToLower().EndsWith(".ascx")) throw new ApplicationException(String.Concat("ContentView was not found: ", viewPath)); else throw new ApplicationException(String.Concat("ViewRoot was not found: ", viewPath)); } return CreateFromActualPath(content, aspNetPage, mode, resolvedPath); }
internal static string GetValue(string name, SNC.Content parentContent) { string[] parts = name.Split(new char[] { '.' }); if (parts.Length == 0) return ""; string currPart = ""; #region special values if (parts[0].ToLower() == "current" && parts.Length > 1) { switch (parts[1].ToLower()) { case "url": if (parts.Length > 2) { switch (parts[2].ToLower()) { case "hostname": foreach (string url in SNP.Page.Current.Site.UrlList.Keys) { if (SenseNet.Portal.Virtualization.PortalContext.Current.OriginalUri.ToString().IndexOf(string.Concat(SenseNet.Portal.Virtualization.PortalContext.Current.OriginalUri.Scheme, "://", url, "/")) == 0) { return (url); } } return (""); case "host": foreach (string url in SNP.Page.Current.Site.UrlList.Keys) { if (SenseNet.Portal.Virtualization.PortalContext.Current.OriginalUri.ToString().IndexOf(string.Concat(SenseNet.Portal.Virtualization.PortalContext.Current.OriginalUri.Scheme, "://", url, "/")) == 0) { return (string.Concat(SenseNet.Portal.Virtualization.PortalContext.Current.OriginalUri.Scheme, "://", url)); } } return (""); case "name": return (SenseNet.Portal.Virtualization.PortalContext.Current.OriginalUri.OriginalString); default: return (""); } } else return (""); case "user": if (User.Current != null && parts.Length > 1) { switch (parts[2].ToLower()) { case "isauthenticated": return (User.Current.IsAuthenticated ? "1" : "0"); default: return (((User)User.Current).GetProperty(parts[2]).ToString()); } } else return (""); case "site": if (PortalContext.Current.Site != null) { return PortalContext.Current.Site.GetProperty(parts[2]).ToString(); } else return (""); case "page": if (PortalContext.Current.Page != null) { return PortalContext.Current.Page.GetProperty(parts[2]).ToString(); } else return (""); } } #endregion object obj = null; object previousListObj = null; // Needed because of IList fields with no indexing foreach (string _currPart in parts) { currPart = _currPart; int index = 0; //bool isIndexed = false; #region Custom properties // Check if current part is indexed and if it is get the index and take it off the current part if (IsIndexedField(currPart)) { index = GetIndexedFieldValue(currPart); //isIndexed = true; currPart = StripIndex(currPart); } if (currPart == "Count") { if (previousListObj is ICollection) return (((ICollection)previousListObj).Count.ToString()); else if (obj is ICollection) return (((ICollection)obj).Count.ToString()); } if (currPart == "AsList()" || Regex.IsMatch(currPart, "AsList[(](['\"](.*)['\"])[)]")) { if (previousListObj is IList) { Match firstMatch = Regex.Match(currPart, "AsList[(](['\"](.*)['\"])[)]"); string separatorString = firstMatch.Groups[1].Value; if (separatorString == String.Empty) separatorString = ", "; // default List<string> elements = new List<string>(); foreach (object currObj in previousListObj as IList) elements.Add(currObj.ToString()); return string.Join(separatorString, elements.ToArray()); } } if (_currPart == "Load()" && obj is string) { obj = Node.Load<Node>(obj as string); if (!(obj is Node)) return ""; else parentContent = SNC.Content.Load(((Node)obj).Id); continue; } if (currPart == "SiteRelativePath") { if (SNP.Page.Current.Site != null && ((Node)parentContent.ContentHandler).Path.StartsWith(SNP.Page.Current.Site.Path)) return (((Node)parentContent.ContentHandler).Path.Substring(SNP.Page.Current.Site.Path.Length)); else currPart = "Path"; } if (currPart == "PageRelativePath") { if (SNP.Page.Current != null && ((Node)parentContent.ContentHandler).Path.StartsWith(SNP.Page.Current.Path)) return (((Node)parentContent.ContentHandler).Path.Substring(String.Concat(SNP.Page.Current.Path, "/").Length)); else currPart = "Path"; } if (currPart == "Children" && obj is IFolder) { IFolder f = obj as IFolder; previousListObj = f.Children; obj = f.Children; if (index < f.ChildCount) { obj = f.Children.ToArray<Node>()[index]; parentContent = SNC.Content.Load(((Node)obj).Id); } continue; } // Check for 'string' parts if (Regex.IsMatch(_currPart, @"'(.+)'")) { if (obj == null || obj is string) { Match firstMatch = Regex.Match(_currPart, @"'(.+)'"); obj += firstMatch.Groups[1].Value; continue; } else return ""; } #region Custom Field property mappings if (obj is SenseNet.ContentRepository.Fields.HyperLinkField.HyperlinkData) { var hyperlinkObj = (SenseNet.ContentRepository.Fields.HyperLinkField.HyperlinkData)obj; if (currPart == "Href") obj = hyperlinkObj.Href; if (currPart == "Text") obj = hyperlinkObj.Text; if (currPart == "Title") obj = hyperlinkObj.Title; if (currPart == "Target") obj = hyperlinkObj.Target; continue; } #endregion #endregion // If parent content is empty next part can not be resolved. Later on however something could be returned if 'string' or Load() part is present if (parentContent == null) { obj = null; continue; } // Try to get the property of the current part try { obj = parentContent[_currPart];//((GenericContent)parentContent.ContentHandler).GetProperty(currPart); } catch (Exception e) //logged { Logger.WriteException(e); obj = ((GenericContent)parentContent.ContentHandler).GetProperty(currPart); } #region Check the type of the obj and deal with it and set previousListObj, parentContent and obj accordingly if (obj is IList) { IList list = obj as IList; obj = list; previousListObj = list; if (index < list.Count) { obj = list[index]; Node node = obj as Node; if (node != null) parentContent = SNC.Content.Load(node.Id); else parentContent = null; } else parentContent = null; continue; } else if (obj is SenseNet.ContentRepository.Fields.HyperLinkField.HyperlinkData) { continue; } else if (obj is Node)//Not link and not HyperlinkData { parentContent = SNC.Content.Load(((Node)obj).Id); continue; } else // If the object was not of the above then carry it on to the next iteration { continue; } #endregion } if (obj != null) // No more parts left return (obj.ToString()); else { return (""); //throw new Exception(String.Format("{0} could not be resolved at {1}.", name, currPart)); } }
internal void Initialize(SNC.Content content, ViewMode viewMode) { this.Content = content; this.FieldControls = new List<FieldControl>(); _errorControls = new List<ErrorControl>(); this.DisplayName = content.DisplayName; this.Description = content.Description; this.Icon = content.Icon; string prefixId = String.Concat("ContentView", "_", viewMode, "_"); this.ID = String.Concat(prefixId, content.ContentHandler.Id.ToString()); this.ViewMode = viewMode; this.DefaultControlRenderMode = GetDefaultControlRenderMode(viewMode); OnViewInitialize(); }
private ValiditySetting GetValiditySetting(SNC.Content content) { ValiditySetting result = new ValiditySetting(); //if (!String.IsNullOrEmpty(this.ValidFromPropertyName)) // result.ValidFromPropertyName = this.ValidFromPropertyName; //if (!String.IsNullOrEmpty(this.ValidTillPropertyName)) // result.ValidTillPropertyName = this.ValidTillPropertyName; // try to fetch PreviewDate value if (content.Security.HasPermission(SenseNet.ContentRepository.Storage.Schema.PermissionType.OpenMinor)) result.CurrentDateTime = GetPreviewDate(); // reads property values result.Fill(content); // if error has been occured while parsing property values, returns null. if (!result.IsValid) return null; return result; }
private static ContentView CreateFromViewRoot(SNC.Content content, System.Web.UI.Page aspNetPage, ViewMode mode, string viewRoot) { // ways to call this function: // - absolute root: "/Root/Global/contentviews" // - relative root: "$skin/contentviews" // - empty string: "" string resolvedPath = ResolveContentViewPath(content, mode, viewRoot); return CreateFromActualPath(content, aspNetPage, mode, resolvedPath); }
private static ContentView CreateFromActualPath(SNC.Content content, System.Web.UI.Page aspNetPage, ViewMode viewMode, string viewPath) { if (content == null) throw new ArgumentNullException("content"); if (aspNetPage == null) throw new ArgumentNullException("aspNetPage"); if (viewPath == null) throw new ArgumentNullException("viewPath"); if (viewPath.Length == 0) throw new ArgumentOutOfRangeException("viewPath", "Parameter 'viewPath' cannot be empty"); if (viewMode == ViewMode.None) throw new ArgumentOutOfRangeException("viewMode", "Parameter 'viewMode' cannot be ViewMode.None"); string path = String.Concat("~", viewPath); ContentView view = GetContentViewFromCache(path); // if not in request cache if (view == null) { var addToCache = false; try { view = aspNetPage.LoadControl(path) as ContentView; addToCache = true; } catch (Exception e) //logged { Logger.WriteException(e); var errorContentViewPath = RepositoryPath.Combine(Repository.ContentViewFolderName, "Error.ascx"); var resolvedErrorContentViewPath = SkinManager.Resolve(errorContentViewPath); path = String.Concat("~", resolvedErrorContentViewPath); view = aspNetPage.LoadControl(path) as ContentView; view.ContentException = e; } if (view == null) throw new ApplicationException(string.Format("ContentView instantiation via LoadControl for path '{0}' failed.", path)); if (addToCache) AddContentViewToCache(path, view); } view.Initialize(content, viewMode); return view; }
private static string ResolveContentViewPath(SNC.Content content, ViewMode mode, string path) { // ways to call this function: // - absolute actual: "/Root/Global/contentviews/Book/Edit.ascx" // - relative actual: "$skin/contentviews/Book/Edit.ascx" // - absolute root: "/Root/Global/contentviews" // - relative root: "$skin/contentviews" // - empty string: "" if (string.IsNullOrEmpty(path)) path = Repository.ContentViewFolderName; var isActual = path.EndsWith(".ascx"); // - relative with custom name --> convert to relative actual if (isActual && !path.Contains(RepositoryPath.PathSeparator)) path = string.Format("{0}/{1}/{2}", Repository.ContentViewFolderName, content.ContentType.Name, path); var isAbsolute = SkinManager.IsNotSkinRelativePath(path); // - absolute actual: "/Root/Global/contentviews/Book/Edit.ascx" if (isAbsolute && isActual) { return path; // "/Root/Global/contentviews/Book/Edit.ascx" } // - relative actual: "$skin/contentviews/Book/Edit.ascx" if (!isAbsolute && isActual) { return SkinManager.Resolve(path); // "/Root/{skin/global}/contentviews/Book/Edit.ascx" } // - absolute root: "/Root/Global/contentviews" if (isAbsolute && !isActual) { var probePath = GetTypeDependentPath(content, mode, path); var node = Node.LoadNode(probePath); if (node != null) return probePath; // "/Root/Global/contentviews/Book/Edit.ascx" probePath = GetGenericPath(content, mode, path); node = Node.LoadNode(probePath); if (node != null) return probePath; // "/Root/Global/contentviews/Edit.ascx" return string.Empty; } // - relative root: "$skin/contentviews" if (!isAbsolute && !isActual) { var typedPath = GetTypeDependentPath(content, mode, path); var resolvedPath = string.Empty; if (SkinManager.TryResolve(typedPath, out resolvedPath)) return resolvedPath; // "/Root/{skin}/contentviews/Book/Edit.ascx" var genericPath = GetGenericPath(content, mode, path); if (SkinManager.TryResolve(genericPath, out resolvedPath)) return resolvedPath; // "/Root/{skin}/contentviews/Edit.ascx" var probePath = SkinManager.Resolve(typedPath); var node = Node.LoadNode(probePath); if (node != null) return probePath; // "/Root/Global/contentviews/Book/Edit.ascx" probePath = SkinManager.Resolve(genericPath); node = Node.LoadNode(probePath); if (node != null) return probePath; // "/Root/Global/contentviews/Edit.ascx" return string.Empty; } return string.Empty; }
private static string GetGenericPath(SNC.Content content, ViewMode mode, string viewRoot) { // "$skin/contentviews/Edit.ascx" return RepositoryPath.Combine(viewRoot, String.Concat(mode, ".ascx")); }
private static string GetTypeDependentPath(SNC.Content content, ViewMode mode, string viewRoot) { // "$skin/contentviews/Book/Edit.ascx" return RepositoryPath.Combine(viewRoot, String.Concat("/", content.ContentType.Name, "/", mode, ".ascx")); }
private void BuildAfterSubmitForm_ContentView(SNC.Content formitem) { if (CurrentForm == null) return; //FormItem fi = new FormItem(CurrentForm); //_cFormItem = SNC.Content.Create(fi); if (formitem == null && _formItemID != 0) { formitem = Content.Load(_formItemID); } if (formitem != null) { _cFormItem = formitem; _cvFormItem = ContentView.Create(_cFormItem, this.Page, ViewMode.New, AfterSubmitViewPath); _cvFormItem.ID = "cvAfterSubmitFormItem"; //_cvFormItem.Init += new EventHandler(_cvFormItem_Init); _cvFormItem.UserAction += new EventHandler<UserActionEventArgs>(_cvAfterSubmitFormItem_UserAction); this.Controls.Add(_cvFormItem); } else if (!string.IsNullOrEmpty(AfterSubmitViewPath)) { this.Controls.Add(Page.LoadControl(AfterSubmitViewPath)); } }
private static string PrintFieldErrors(SnC.Content content) { var sb = new StringBuilder(); sb.AppendLine("---------- Field Errors:"); foreach (string fieldName in content.Fields.Keys) { Field field = content.Fields[fieldName]; if (!field.IsValid) { sb.Append(field.Name); sb.Append(": "); sb.AppendLine(field.GetValidationMessage()); } } sb.AppendLine("------------------------"); return sb.ToString(); }
public void Fill(SNC.Content content) { _isValid = true; DateTimeField validFromField = content.Fields[_validFromPropertyName] as DateTimeField; DateTimeField reviewDateField = content.Fields[_reviewDatePropertyName] as DateTimeField; DateTimeField archiveDateField = content.Fields[_archiveDatePropertyName] as DateTimeField; DateTimeField validTillField = content.Fields[_validTillPropertyName] as DateTimeField; if (_isValid) { _validFrom = Convert.ToDateTime(validFromField.GetData()); _reviewDate = Convert.ToDateTime(reviewDateField.GetData()); _archiveDate = Convert.ToDateTime(archiveDateField.GetData()); _validTill = Convert.ToDateTime(validTillField.GetData()); } }
public bool SetMetadata(SNC.Content content, string currentDirectory, bool isNewContent, bool needToValidate, bool updateReferences) { if (_xmlDoc == null) return true; _transferringContext = new ImportContext( _xmlDoc.SelectNodes("/ContentMetaData/Fields/*"), currentDirectory, isNewContent, needToValidate, updateReferences); bool result = content.ImportFieldData(_transferringContext); _contentId = content.ContentHandler.Id; return result; }
private static bool SetMetadata(SnC.Content snContent, Content content, bool isNewContent, bool updateReferences) { XmlDocument xml = new XmlDocument(); xml.LoadXml(content.Data); var context = new ImportContext(xml.SelectNodes("/ContentMetaData/Fields/*"), null, isNewContent, true, updateReferences); bool result = snContent.ImportFieldData(context); var contentId = snContent.ContentHandler.Id; content.HasReference = context.HasReference; return result; }
/// <summary> /// Creates the ContenView for the <see cref="SenseNet.ContentRepository.Content ">Content</see>. /// </summary> /// <param name="content">The Content belonging to the the ContentView</param> /// <param name="aspNetPage"></param> /// <param name="mode">The ViewMode in which FieldControls of the ContentView will be rendered</param> public static ContentView Create(SNC.Content content, System.Web.UI.Page aspNetPage, ViewMode mode) { return CreateFromViewRoot(content, aspNetPage, mode, Repository.ContentViewFolderName); }
//-- Object service tools private static Atom10FeedFormatter BuildEntry(SNC.Content content, string repositoryId) { var baseUri = GetBaseUri(); var title = content.Name; var description = GenerateAtomContent(content); var lastUpdateTime = new DateTimeOffset(content.ContentHandler.ModificationDate); var linkHref = GetEntryActionUri(baseUri, repositoryId, content.Id, "getEntry"); var feedAlternateLink = new Uri(linkHref); var feedId = linkHref; CmisObject cmisObject = new CmisObject { Properties = BuildCmisProperties(content), AllowableActions = GetAllowableActions(content) }; SyndicationFeed feed = new SyndicationFeed(title, description, feedAlternateLink, feedId, lastUpdateTime); feed.ElementExtensions.Add(cmisObject, new XmlSerializer(typeof(CmisObject))); foreach (var link in BuildLinks(content, baseUri, repositoryId)) feed.Links.Add(link); var formatter = new Atom10FeedFormatter(feed); return formatter; }
private static List<SyndicationLink> BuildLinks(SNC.Content content, string baseUri, string repositoryId) { var links = new List<SyndicationLink>(); //-- atom links links.Add(new SyndicationLink { RelationshipType = "self", Uri = new Uri(GetEntryActionUri(baseUri, repositoryId, content.Id, "getEntry")) }); //links.Add(new SyndicationLink { RelationshipType = "edit", Uri = new Uri(GetEntryActionUri(baseUri, repositoryId, content.Id, "__????__")) }); //-- CMIS links //links.Add(new SyndicationLink { RelationshipType = "cmis-allowableactions", Uri = new Uri(GetEntryActionUri(baseUri, repositoryId, content.Id, "__????__")) }); //links.Add(new SyndicationLink { RelationshipType = "cmis-relationships", Uri = new Uri(GetEntryActionUri(baseUri, repositoryId, content.Id, "__????__")) }); //links.Add(new SyndicationLink { RelationshipType = "cmis-type", Uri = new Uri(GetEntryActionUri(baseUri, repositoryId, content.Id, "__????__")) }); if (content.ContentHandler is IFolder) { //-- atom links links.Add(new SyndicationLink { RelationshipType = "cmis-parent", Uri = new Uri(GetEntryActionUri(baseUri, repositoryId, content.Id, "getParent")) }); links.Add(new SyndicationLink { RelationshipType = "cmis-children", Uri = new Uri(GetEntryActionUri(baseUri, repositoryId, content.Id, "getChildren")) }); } else { //-- atom links //links.Add(new SyndicationLink { RelationshipType = "edit-media", Uri = new Uri(GetEntryActionUri(baseUri, repositoryId, content.Id, "__????__")) }); //links.Add(new SyndicationLink { RelationshipType = "enclosure", Uri = new Uri(GetEntryActionUri(baseUri, repositoryId, content.Id, "__????__")) }); //links.Add(new SyndicationLink { RelationshipType = "alternate", Uri = new Uri(GetEntryActionUri(baseUri, repositoryId, content.Id, "__????__")) }); //-- CMIS links links.Add(new SyndicationLink { RelationshipType = "cmis-parents", Uri = new Uri(GetEntryActionUri(baseUri, repositoryId, content.Id, "getParents")) }); //links.Add(new SyndicationLink { RelationshipType = "cmis-allversions", Uri = new Uri(GetEntryActionUri(baseUri, repositoryId, content.Id, "__????__")) }); //links.Add(new SyndicationLink { RelationshipType = "cmis-latestversion", Uri = new Uri(GetEntryActionUri(baseUri, repositoryId, content.Id, "__????__")) }); //links.Add(new SyndicationLink { RelationshipType = "cmis-stream", Uri = new Uri(GetEntryActionUri(baseUri, repositoryId, content.Id, "__????__")) }); } return links; }
internal bool UpdateReferences(SNC.Content content, bool needToValidate) { if (_transferringContext == null) _transferringContext = new ImportContext(_xmlDoc.SelectNodes("/ContentMetaData/Fields/*"), null, false, needToValidate, true); else _transferringContext.UpdateReferences = true; var node = content.ContentHandler; node.NodeModificationDate = node.NodeModificationDate; node.ModificationDate = node.ModificationDate; node.NodeModifiedBy = node.NodeModifiedBy; node.ModifiedBy = node.ModifiedBy; if (!content.ImportFieldData(_transferringContext)) return false; if (!HasPermissions && !HasBreakPermissions) return true; var permissionsNode = _xmlDoc.SelectSingleNode("/ContentMetaData/Permissions"); content.ContentHandler.Security.ImportPermissions(permissionsNode, this._metaDataPath); return true; }
/// <summary> /// Gets a the specified property belonging to the Content of the View in a safe way. /// </summary> /// <param name="name">The property name. Can be hierarchical.</param> /// <returns>String value of the property specified</returns> internal static string GetValue(string name, SNC.Content parentContent, OutputMethod outputMethod) { switch (outputMethod) { case OutputMethod.Default: throw new NotSupportedException("OutputMethod cannot be Default"); case OutputMethod.Raw: return GetValue(name, parentContent); case OutputMethod.Text: return System.Web.HttpUtility.HtmlEncode(GetValue(name, parentContent)); case OutputMethod.Html: return SenseNet.Portal.Security.Sanitize(GetValue(name, parentContent)); default: throw new NotImplementedException("Unknown OutputMethod: " + outputMethod); } }