1+ /*==============================================================================================================================
2+ | Author Ignia, LLC
3+ | Client Ignia, LLC
4+ | Project OnTopicSample OnTopic Site
5+ \=============================================================================================================================*/
6+ using System ;
7+ using System . Linq ;
8+ using System . Web . UI ;
9+
10+ namespace Ignia . Topics . Web . Host . Common . Templates {
11+
12+ /*============================================================================================================================
13+ | CLASS: LAYOUT MASTER
14+ \---------------------------------------------------------------------------------------------------------------------------*/
15+ /// <summary>
16+ /// Provides properties and functionality necessary for use with the master page template and dependent pages.
17+ /// </summary>
18+ public partial class Layout : System . Web . UI . MasterPage {
19+
20+
21+ /*==========================================================================================================================
22+ | PAGE LOAD
23+ \-------------------------------------------------------------------------------------------------------------------------*/
24+ void Page_Load ( Object Src , EventArgs E ) {
25+
26+ /*------------------------------------------------------------------------------------------------------------------------
27+ | Set page title
28+ \-----------------------------------------------------------------------------------------------------------------------*/
29+ Page . Title = Page . Title ;
30+
31+ /*------------------------------------------------------------------------------------------------------------------------
32+ | Set data sources
33+ \-----------------------------------------------------------------------------------------------------------------------*/
34+ Attributes . DataSource = PageTopic . Attributes . Where ( t => t . Key != "Body" ) ;
35+ Relationships . DataSource = PageTopic . Relationships ;
36+
37+ /*------------------------------------------------------------------------------------------------------------------------
38+ | Ensure data binding
39+ \-----------------------------------------------------------------------------------------------------------------------*/
40+ this . DataBind ( ) ;
41+
42+ }
43+
44+ /*==========================================================================================================================
45+ | PROPERTY: PAGE TOPIC
46+ \-------------------------------------------------------------------------------------------------------------------------*/
47+ /// <summary>
48+ /// Identifies the topic associated with the page based on the RouteData. If the topic cannot be identified then a null
49+ /// reference is returned.
50+ /// </summary>
51+ public Topic PageTopic {
52+ get {
53+ if ( Page is TopicPage ) {
54+ return ( ( TopicPage ) Page ) . Topic ;
55+ }
56+ return TopicRepository . DataProvider . Load ( "Web" ) ;
57+ }
58+ }
59+
60+ }
61+ }
0 commit comments