/
PageDataRaw.cs
202 lines (181 loc) · 5.99 KB
/
PageDataRaw.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
using ToSic.Eav.Data.Build;
using ToSic.Eav.Data.Raw;
namespace ToSic.Sxc.DataSources.Internal;
/// <summary>
/// Internal class to hold all the information about the page,
/// until it's converted to an IEntity in the <see cref="Pages"/> DataSource.
///
/// For detailed documentation, check the docs of the underlying objects:
///
/// * [Dnn TabInfo](https://docs.dnncommunity.org/api/DotNetNuke.Entities.Tabs.TabInfo.html)
/// * [Oqtane Page](https://docs.oqtane.org/api/Oqtane.Models.Page.html)
///
/// Important: this is an internal object.
/// We're just including in in the docs to better understand where the properties come from.
/// We'll probably move it to another namespace some day.
/// </summary>
/// <remarks>
/// Make sure the property names never change, as they are critical for the created Entity.
/// </remarks>
[PrivateApi("Was InternalApi till v17 - hide till we know how to handle to-typed-conversions")]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public class PageDataRaw: IRawEntity
{
public static DataFactoryOptions Option = new(typeName: "Page", titleField: nameof(Name));
/// <summary>
/// The page ID.
///
/// * In Dnn it's from `TabInfo.TabID`
/// * In Oqtane it's `Page.PageId`
/// </summary>
public int Id { get; set; }
/// <summary>
/// The parent page ID.
///
/// It's usually `0` if it's a top level page.
///
/// * In Dnn it's from `TabInfo.ParentId`
/// * in Oqtane it's from `Page.ParentId`
/// </summary>
public int ParentId { get; set; }
/// <summary>
/// The page GUID.
///
/// * In Dnn it's from `TabInfo.UniqueId`
/// * In Oqtane it's `Guid.Empty` as Oqtane doesn't have page GUIDs
/// </summary>
public Guid Guid { get; set; }
/// <summary>
/// The page title.
///
/// * In Dnn it's from `TabInfo.Title`
/// * in Oqtane it's from `Page.Title`
/// </summary>
public string Title { get; set; }
/// <summary>
/// The page name.
///
/// * In Dnn it's from `TabInfo.Name`
/// * in Oqtane it's from `Page.Name`
/// </summary>
public string Name { get; set; }
/// <summary>
/// Determines if this item is clickable in the menu.
///
/// * In Dnn it's from `!TabInfo.DisableLink`
/// * in Oqtane it's from `Page.IsClickable`
/// </summary>
/// <remarks>
/// Added in v15.01
/// </remarks>
public bool Clickable { get; set; }
/// <summary>
/// Order of this item in a menu.
/// It is 1 based, so the first item has Order 1.
///
/// * In Dnn it's from `TabInfo.TabOrder`
/// * in Oqtane it's from `Page.Order`
/// </summary>
/// <remarks>
/// Added in v15.01
/// </remarks>
public int Order { get; set; }
/// <summary>
/// The page visibility - if it should be shown in the menu.
///
/// * In Dnn it's from `TabInfo.IsVisible`
/// * in Oqtane it's from `Page.IsNavigation`
/// </summary>
public bool Visible { get; set; }
/// <summary>
/// Info if the page has sub-pages.
///
/// * In Dnn it's from `TabInfo.HasChildren`
/// * in Oqtane it's from `Page.HasChildren`
/// </summary>
/// <remarks>
/// Added in v15.01
/// </remarks>
public bool HasChildren { get; set; }
/// <summary>
/// How deep this page is in the breadcrumb.
/// The number is 1 based, so the top level is 1.
///
/// * In Dnn it's from `TabInfo.Level` (+1)
/// * in Oqtane it's from `Page.Level` (+1)
/// </summary>
/// <remarks>
/// Added in v15.01
/// </remarks>
public int Level { get; set; }
/// <summary>
/// WIP
/// * In Dnn it's from `TabInfo.TabSettings["LinkNewWindow"]`and will be either `_blank` or `` (empty string)
/// * In Oqtane it's _not implemented_ an will be an empty string
/// </summary>
/// <remarks>
/// Added in v15.02
/// </remarks>
public string LinkTarget { get; set; }
/// <summary>
/// The path with slashes to this page.
///
/// * In Dnn it's from `TabInfo.TabPath`
/// * in Oqtane it's from `Page.Path`
/// </summary>
public string Path { get; set; }
/// <summary>
/// The public url to this page (without any trailing slashes)
///
/// * In Dnn it's from `TabInf.FullUrl` (last slash removed)
/// * in Oqtane it's a combination of protocol, site-alias and path
/// </summary>
public string Url { get; set; }
/// <summary>
/// The page creation date/time.
///
/// * In Dnn it's from `TabInfo.CreatedOnDate`
/// * in Oqtane it's from `Page.CreatedOn`
/// </summary>
public DateTime Created { get; set; }
/// <summary>
/// The page modification date/time.
///
/// * In Dnn it's from `TabInfo.LastModifiedOnDate`
/// * in Oqtane it's from `Page.ModifiedOn`
/// </summary>
public DateTime Modified { get; set; }
/// <summary>
/// The page delete-status.
/// Normally you will only see not-deleted pages, so it should usually be false.
///
/// * In Dnn it's from `TabInfo.IsDeleted`
/// * in Oqtane it's from `Page.IsDeleted`
/// </summary>
/// <remarks>
/// Added in v15.01
/// </remarks>
public bool IsDeleted { get; set; }
/// <summary>
/// Data but without Id, Guid, Created, Modified
/// </summary>
[PrivateApi]
public IDictionary<string, object> Attributes(RawConvertOptions options) => new Dictionary<string, object>
{
// v14+
{ Eav.Data.Attributes.TitleNiceName, Title },
{ nameof(Name), Name },
{ nameof(ParentId), ParentId },
{ nameof(Visible), Visible },
{ nameof(Path), Path },
{ nameof(Url), Url },
// New in v15.01
{ nameof(Clickable), Clickable },
{ nameof(Order), Order },
{ nameof(IsDeleted), IsDeleted },
{ nameof(Level), Level },
{ nameof(HasChildren), HasChildren },
// New in v15.02
{ nameof(LinkTarget), LinkTarget }
};
}