2222 * under the License.
2323 */
2424
25+ using YAF . Core . Helpers ;
26+
2527namespace YAF . SampleWebApplication
2628{
2729 using System ;
@@ -35,6 +37,9 @@ namespace YAF.SampleWebApplication
3537 using YAF . Configuration ;
3638 using YAF . Core . Context ;
3739 using YAF . Core . Extensions ;
40+ using YAF . Core . Services ;
41+ using YAF . Core . Utilities ;
42+ using YAF . Types . Constants ;
3843 using YAF . Types . Interfaces ;
3944 using YAF . Types . Interfaces . Services ;
4045 using YAF . Types . Models ;
@@ -77,14 +82,33 @@ protected void Page_Load(object sender, EventArgs e)
7782 scriptManager . Scripts . Add (
7883 new ScriptReference ( BoardInfo . GetURLToScripts ( "forumExtensions.min.js" ) ) ) ;
7984
85+ if ( BoardContext . Current is not null )
86+ {
87+ var logoutScript = JavaScriptBlocks . LogOutJs (
88+ BoardContext . Current . Get < ILocalization > ( ) . GetText ( "TOOLBAR" , "LOGOUT_TITLE" ) ,
89+ BoardContext . Current . Get < ILocalization > ( ) . GetText ( "TOOLBAR" , "LOGOUT_QUESTION" ) ,
90+ BoardContext . Current . Get < ILocalization > ( ) . GetText ( "TOOLBAR" , "LOGOUT" ) ,
91+ BoardContext . Current . Get < ILocalization > ( ) . GetText ( "COMMON" , "CANCEL" ) ,
92+ BoardContext . Current . Get < LinkBuilder > ( ) . GetLink ( ForumPages . Account_Logout ) ) ;
93+
94+
95+ ScriptManager . RegisterStartupScript (
96+ this . Page ,
97+ this . Page . GetType ( ) ,
98+ nameof ( JavaScriptBlocks . LogOutJs ) ,
99+ JsAndCssHelper . CompressJavaScript ( logoutScript ) ,
100+ true ) ;
101+ }
102+
103+
80104 var link = new HtmlLink ( ) ;
81105
82106 link . Attributes . Add ( "rel" , "stylesheet" ) ;
83107 link . Attributes . Add ( "type" , "text/css" ) ;
84108
85- link . Href = BoardContext . Current != null
86- ? BoardContext . Current . Get < ITheme > ( ) . BuildThemePath ( "bootstrap-forum.min.css" )
87- : "~/Forum/Content/Themes/yaf/bootstrap-forum.min.css" ;
109+ link . Href = BoardContext . Current != null
110+ ? BoardContext . Current . Get < ITheme > ( ) . BuildThemePath ( "bootstrap-forum.min.css" )
111+ : "~/Forum/Content/Themes/yaf/bootstrap-forum.min.css" ;
88112
89113 this . Page . Header . Controls . Add ( link ) ;
90114
0 commit comments