您目前尚未登陆,请选择【登陆】或【注册
首页->博客论坛->SpaceBuilder v1.1源代码>>BasicWebControls/Channel/ChannelGlobalMenu.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:SpaceBuilder v1.1源代码
当前文件:文件类型 SpaceBuider11/BasicWebControls/Channel/ChannelGlobalMenu.cs打开代码结构图
普通视图
		            
1//------------------------------------------------------------------------------ 2// <copyright company="Tunynet"> 3// Copyright (c) Tunynet Inc. All rights reserved. 4// </copyright> 5//------------------------------------------------------------------------------ 6 7using System; 8using System.Collections.Generic; 9using System.Text; 10using System.Web.UI.WebControls; 11using SpaceBuilder.Controls.BaseClasses; 12using SpaceBuilder.Components; 13using System.Web.UI.HtmlControls; 14using SpaceBuilder.Configuration; 15using SpaceBuilder.Controls; 16using SpaceBuilder.Forums.Components; 17 18namespace SpaceBuilder.Web.Controls 19{ 20 /// <summary> 21 /// 总站中的顶端模块菜单 22 /// </summary> 23 public class ChannelGlobalMenu : TemplatedWebControl 24 { 25 protected override void OnInit(EventArgs e) 26 { 27 if (SkinName == null) 28 ExternalSkinFileName = "Skin-ChannelGlobalMenu.ascx"; 29 else 30 ExternalSkinFileName = SkinName; 31 32 base.OnInit(e); 33 } 34 35 protected override void OnLoad(EventArgs e) 36 { 37 base.OnLoad(e); 38 EnsureChildControls(); 39 // if (!Page.IsPostBack) 40 InitMenu(); 41 42 MenuApplyStyleSheet(); 43 } 44 45 Child Controls 120 121 /// <summary> 122 /// 附加子控件 123 /// </summary> 124 protected override void AttachChildControls() 125 { 126 menu_MyHome = FindControl("Menu_MyHome") as HyperLink; 127 128 menu_Home = FindControl("Menu_Home") as HyperLink; 129 menu_News = FindControl("Menu_News") as HyperLink; 130 menu_Friend = FindControl("Menu_Friend") as HyperLink; 131 menu_Club = FindControl("Menu_Club") as HyperLink; 132 menu_Event = FindControl("Menu_Event") as HyperLink; 133 menu_Blog = FindControl("Menu_Blog") as HyperLink; 134 menu_Photo = FindControl("Menu_Photo") as HyperLink; 135 menu_Bookmark = FindControl("Menu_Bookmark") as HyperLink; 136 menu_File = FindControl("Menu_File") as HyperLink; 137 menu_Forum = FindControl("Menu_Forum") as HyperLink; 138 139 menu_Search = FindControl("Menu_Search") as HyperLink; 140 141 newsMenuBlock = FindControl("NewsMenuBlock") as HtmlContainerControl; 142 friendMenuBlock = FindControl("FriendMenuBlock") as HtmlContainerControl; 143 blogMenuBlock = FindControl("BlogMenuBlock") as HtmlContainerControl; 144 photoMenuBlock = FindControl("PhotoMenuBlock") as HtmlContainerControl; 145 bookmarkMenuBlock = FindControl("BookmarkMenuBlock") as HtmlContainerControl; 146 clubMenuBlock = FindControl("ClubMenuBlock") as HtmlContainerControl; 147 eventMenuBlock = FindControl("EventMenuBlock") as HtmlContainerControl; 148 fileMenuBlock = FindControl("FileMenuBlock") as HtmlContainerControl; 149 forumMenuBlock = FindControl("ForumMenuBlock") as HtmlContainerControl; 150 searchMenuBlock = FindControl("SearchMenuBlock") as HtmlContainerControl; 151 } 152 153 private void InitMenu() 154 { 155 //if (menu_MyHome != null && !SBContext.Current.User.IsAnonymous) 156 //{ 157 // menu_MyHome.Visible = true; 158 // menu_MyHome.NavigateUrl = UserUrls.Instance().UserHome(SBContext.Current.User); 159 //} 160 161 if (menu_Home != null) 162 { 163 menu_Home.Text = ResourceManager.GetString("ChannelName_Home"); 164 menu_Home.NavigateUrl = GlobalUrls.Instance().Home; 165 } 166 167 if (menu_News != null && SBConfiguration.Instance().EnableNews) 168 { 169 menu_News.Text = ResourceManager.GetString("ChannelName_News"); 170 menu_News.NavigateUrl = ChannelUrls.Instance().NewsHome(); 171 } 172 else 173 { 174 if (newsMenuBlock != null) 175 newsMenuBlock.Visible = false; 176 } 177 178 if (menu_Friend != null && SBConfiguration.Instance().EnableSNS) 179 { 180 menu_Friend.Visible = true; 181 menu_Friend.Text = ResourceManager.GetString("ChannelName_Member"); 182 menu_Friend.NavigateUrl = ChannelUrls.Instance().FriendHome(); 183 } 184 else 185 { 186 if (friendMenuBlock != null) 187 friendMenuBlock.Visible = false; 188 } 189 190 if (menu_Club != null && SBConfiguration.Instance().EnableClub) 191 { 192 menu_Club.Text = ResourceManager.GetString("ChannelName_Club"); 193 menu_Club.NavigateUrl = ChannelUrls.Instance().ClubHome(); 194 } 195 else 196 { 197 if (clubMenuBlock != null) 198 clubMenuBlock.Visible = false; 199 } 200 201 if (menu_Event != null && SBConfiguration.Instance().EnableEvent) 202 { 203 menu_Event.Text = ResourceManager.GetString("ChannelName_Event"); 204 menu_Event.NavigateUrl = ChannelUrls.Instance().EventHome(); 205 } 206 else 207 { 208 if (eventMenuBlock != null) 209 eventMenuBlock.Visible = false; 210 } 211 212 if (menu_Blog != null && SBConfiguration.Instance().EnableBlog) 213 { 214 menu_Blog.Text = ResourceManager.GetString("ChannelName_Blog"); 215 menu_Blog.NavigateUrl = ChannelUrls.Instance().BlogHome(); 216 } 217 else 218 { 219 if (blogMenuBlock != null) 220 blogMenuBlock.Visible = false; 221 } 222 223 if (menu_Photo != null && SBConfiguration.Instance().EnableGallery) 224 { 225 menu_Photo.Text = ResourceManager.GetString("ChannelName_Gallery"); 226 menu_Photo.NavigateUrl = ChannelUrls.Instance().PhotoHome(); 227 } 228 else 229 { 230 if (photoMenuBlock != null) 231 photoMenuBlock.Visible = false; 232 } 233 234 if (menu_File != null && SBConfiguration.Instance().EnableFileGallery) 235 { 236 menu_File.Text = ResourceManager.GetString("ChannelName_FileGallery"); 237 menu_File.NavigateUrl = ChannelUrls.Instance().FileHome(); 238 } 239 else 240 { 241 if (fileMenuBlock != null) 242 fileMenuBlock.Visible = false; 243 } 244 245 if (menu_Bookmark != null && SBConfiguration.Instance().EnableBookmark) 246 { 247 menu_Bookmark.Text = ResourceManager.GetString("ChannelName_Bookmark"); 248 menu_Bookmark.NavigateUrl = ChannelUrls.Instance().BookmarkHome(); 249 } 250 else 251 { 252 if (bookmarkMenuBlock != null) 253 bookmarkMenuBlock.Visible = false; 254 } 255 256 if (menu_Forum != null && SBConfiguration.Instance().EnableForum) 257 { 258 menu_Forum.Text = ResourceManager.GetString("ChannelName_Forum"); 259 menu_Forum.NavigateUrl = ForumUrls.Instance().Home(); 260 menu_Forum.Target = "_blank"; 261 } 262 else 263 { 264 if (forumMenuBlock != null) 265 forumMenuBlock.Visible = false; 266 } 267 268 //if (menu_Reward != null && SBConfiguration.Instance().EnableReward) 269 //{ 270 // menu_Reward.Text = ResourceManager.GetString("ChannelName_Reward"); 271 // menu_Reward.NavigateUrl = RewardUrls.Instance().RewardHome(); 272 //} 273 //else 274 //{ 275 // if (rewardMenuBlock != null) 276 // rewardMenuBlock.Visible = false; 277 //} 278 279 //if (menu_Seeker != null && SBConfiguration.Instance().EnableJob) 280 //{ 281 // menu_Seeker.NavigateUrl = JobChannelUrls.Instance().SeekerHome(); 282 // menu_Recruiter.NavigateUrl = JobChannelUrls.Instance().RecruiterHome(); 283 //} 284 //else 285 //{ 286 // if (seekerMenuBlock != null && recruiterMenuBlock != null) 287 // seekerMenuBlock.Visible = false; 288 // recruiterMenuBlock.Visible = false; 289 //} 290 291 if (menu_Search != null) 292 { 293 menu_Search.Text = ResourceManager.GetString("ChannelName_Search"); 294 menu_Search.NavigateUrl = ChannelUrls.Instance().SearchHome(); 295 } 296 } 297 298 /// <summary> 299 /// 根据当前页面设置菜单样式 300 /// </summary> 301 private void MenuApplyStyleSheet() 302 { 303 switch (SeletedMenu) 304 { 305 //case ChanneMenuType.MyHome: 306