给ccs1.03部署快速导航栏

该博客内容为转载,原文链接为https://www.cnblogs.com/hyouhaku/archive/2005/09/11/234218.html ,原内容可能涉及UI和人工智能相关信息技术。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

343.html 
None.gif//------------------------------------------------------------------------------
None.gif
// <copyright company="Telligent Systems">
None.gif
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
None.gif
// </copyright> 
None.gif
//------------------------------------------------------------------------------
None.gif

None.gif
using System;
None.gif
using System.Collections;
None.gif
using System.Web.UI;
None.gif
using System.Web.UI.WebControls;
None.gif
None.gif
using CommunityServer.Components;
None.gif
None.gif
None.gif
namespace CommunityServer.Controls
ExpandedBlockStart.gifContractedBlock.gif
dot.gif{
InBlock.gif
InBlock.gif    [
InBlock.gif    ParseChildren(
true)
InBlock.gif    ]
InBlock.gif    
public class JumpDropDownList : DropDownList 
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif
InBlock.gif
InBlock.gif        
public JumpDropDownList() 
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif
InBlock.gif            
// Set up some default property values
InBlock.gif            
//
InBlock.gif
            AutoPostBack = true;
InBlock.gif            SelectedIndexChanged 
+= new System.EventHandler(Location_Changed);
InBlock.gif
InBlock.gif            
// head of the drop down
InBlock.gif            
//
InBlock.gif
            Items.Add(new ListItem( "快速导航""" ));
InBlock.gif            Items.Add(
new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Seperator") ));
InBlock.gif
InBlock.gif            
// standard "home" links
InBlock.gif            
//
InBlock.gif
            Items.Add(new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Home"), Globals.GetSiteUrls().ForumsHome));
InBlock.gif            Items.Add(
new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+ ResourceManager.GetString("Navigation_JumpDropDownList_Search"), Globals.GetSiteUrls().Search));
InBlock.gif            Items.Add(
new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+ ResourceManager.GetString("ViewActiveThreads_Title"), Globals.GetSiteUrls().PostsActive));
InBlock.gif            Items.Add(
new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+ ResourceManager.GetString("ViewUnansweredThreads_Title"), Globals.GetSiteUrls().PostsUnanswered));
InBlock.gif            
if(!CSContext.Current.User.IsAnonymous)
InBlock.gif                Items.Add(
new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+ ResourceManager.GetString("ViewNotReadThreads_Title"), Globals.GetSiteUrls().PostsNotRead));
InBlock.gif
InBlock.gif            
// User Options to display, based if the user is signed in or not.
InBlock.gif            
//
InBlock.gif
            if (CSContext.Current.User.IsForumAdministrator || CSContext.Current.User.IsModerator) 
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                Items.Add(
new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Seperator") ));
InBlock.gif                Items.Add(
new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_AdminOptions") ));
InBlock.gif                
if ( CSContext.Current.User.IsForumAdministrator  )
InBlock.gif                    Items.Add(
new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+ ResourceManager.GetString("Navigation_JumpDropDownList_AdminHome"), Globals.GetSiteUrls().AdminHome ));
InBlock.gif                Items.Add(
new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+ ResourceManager.GetString("Navigation_JumpDropDownList_ModeratorHome"), Globals.GetSiteUrls().ModerationHome ));
ExpandedSubBlockEnd.gif            }
            
InBlock.gif
InBlock.gif            
// seperator
InBlock.gif            
//
InBlock.gif
            Items.Add(new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Seperator") ));
InBlock.gif
InBlock.gif            
// User Options to display, based if the user is signed in or not.
InBlock.gif            
//
InBlock.gif
            if (!CSContext.Current.User.IsAnonymous) 
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                Items.Add(
new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_UserOptions") ));
InBlock.gif                Items.Add(
new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+ ResourceManager.GetString("Navigation_JumpDropDownList_Profile"), Globals.GetSiteUrls().UserEditProfile ));
InBlock.gif                Items.Add(
new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+ ResourceManager.GetString("Navigation_JumpDropDownList_PrivateMessages"), Globals.GetSiteUrls().UserPrivateMessages ));
InBlock.gif                Items.Add(
new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+ ResourceManager.GetString("Navigation_JumpDropDownList_MyThreads"), Globals.GetSiteUrls().UserMyForums ));
InBlock.gif                
//added by blogs
InBlock.gif
                Items.Add(new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Seperator") ));
InBlock.gif                Items.Add(
new ListItem( "我的博客", Globals.GetSiteUrls().Home + "blogs" + "/" + CSContext.Current.User.Username + "/" + "default.aspx" ));
InBlock.gif                Items.Add(
new ListItem(  ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+"新建随笔", Globals.GetSiteUrls().Home + "admin/blogs/posteditor.aspx?App=" +  CSContext.Current.User.Username + "&BPT=Post"  ));
InBlock.gif                Items.Add(
new ListItem(  ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+"新建文章", Globals.GetSiteUrls().Home + "admin/blogs/posteditor.aspx?App=" +  CSContext.Current.User.Username + "&BPT=Article"  ));
InBlock.gif                Items.Add(
new ListItem(  ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+"管理评论", Globals.GetSiteUrls().Home + "admin/blogs/feedback.aspx?App=" +  CSContext.Current.User.Username   ));
InBlock.gif                Items.Add(
new ListItem(  ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+"管理链接", Globals.GetSiteUrls().Home + "admin/blogs/manageblogroll.aspx?App=" +  CSContext.Current.User.Username   ));
InBlock.gif                Items.Add(
new ListItem(  ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+"管理博客", Globals.GetSiteUrls().Home + "admin/blogs/weblogsettings.aspx?App=" +  CSContext.Current.User.Username + "&Url=blog_myblogs&Args="  ));
InBlock.gif                
//added by photos
InBlock.gif
                Items.Add(new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Seperator") ));
InBlock.gif                Items.Add(
new ListItem( "我的相册", Globals.GetSiteUrls().Home + "photos" + "/" + CSContext.Current.User.Username + "/" + "default.aspx" ));
InBlock.gif                Items.Add(
new ListItem(  ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+"添加图片", Globals.GetSiteUrls().Home + "admin/gallery/PictureAdmin.aspx?App="+  CSContext.Current.User.Username + "&CategoryID=-1&PostID=-1"  ));
InBlock.gif                Items.Add(
new ListItem(  ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+"管理图片", Globals.GetSiteUrls().Home + "admin/gallery/ManagePictures.aspx?App=" +  CSContext.Current.User.Username + "&CategoryID=-1"  ));
InBlock.gif                Items.Add(
new ListItem(  ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+"管理分类", Globals.GetSiteUrls().Home + "admin/gallery/ManageCategories.aspx?App=" +  CSContext.Current.User.Username   ));
InBlock.gif                Items.Add(
new ListItem(  ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+"管理相册", Globals.GetSiteUrls().Home + "admin/gallery/galleryadmin.aspx?App="+  CSContext.Current.User.Username +"&Url=gallery_ViewGallery&Args=" +  CSContext.Current.User.Username  ));
InBlock.gif            
InBlock.gif            
ExpandedSubBlockEnd.gif            }
 
InBlock.gif            
else 
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                Items.Add(
new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_UserOptions") ));
InBlock.gif                Items.Add(
new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+ ResourceManager.GetString("Navigation_JumpDropDownList_Login"), Globals.GetSiteUrls().Login ));
InBlock.gif                Items.Add(
new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+ ResourceManager.GetString("Navigation_JumpDropDownList_CreateAccount"), Globals.GetSiteUrls().UserRegister ));
InBlock.gif                Items.Add(
new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Indent1"+ ResourceManager.GetString("Navigation_JumpDropDownList_ForgotPassword"), Globals.GetSiteUrls().UserForgotPassword ));
ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif            
// seperator
InBlock.gif            
//
InBlock.gif
            Items.Add(new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Seperator") ));
InBlock.gif
InBlock.gif            
// Get all forum groups and the remaining items are displayed
InBlock.gif            
// as ForumGroups and Forums.
InBlock.gif            
//
InBlock.gif
//            ArrayList forumGroups = ForumGroups.GetForumGroups(true);
InBlock.gif
//
InBlock.gif
//            foreach (Group group in forumGroups) 
InBlock.gif
//            {
InBlock.gif
//                //lazy load sections
InBlock.gif
//                if(!group.HasSections)
InBlock.gif
//                    group.Sections = Forums.GetForumsByForumGroupID(group.GroupID);
InBlock.gif
//
InBlock.gif
//                //Only add if we have sections. We do not display groups that have no sections
InBlock.gif
//                if(group.HasSections)
InBlock.gif
//                {
InBlock.gif
//
InBlock.gif
//                    // Add the forum group
InBlock.gif
//                    //
InBlock.gif
//                    Items.Add(new ListItem(group.Name, "g-" + group.GroupID));
InBlock.gif
//
InBlock.gif
//
InBlock.gif
//                    // Add all forums recursively.
InBlock.gif
//                    //
InBlock.gif
//                    RecursiveAddForum (0, group.Sections);
InBlock.gif
//
InBlock.gif
//                    // Add the forum group
InBlock.gif
//                    //
InBlock.gif
//                    Items.Add(new ListItem( ResourceManager.GetString("Navigation_JumpDropDownList_Seperator") ));
InBlock.gif
//                }
InBlock.gif
//            }
ExpandedSubBlockEnd.gif
        }

InBlock.gif
InBlock.gif
//        void RecursiveAddForum (int depth, ArrayList forums) 
InBlock.gif
//        {
InBlock.gif
//            
InBlock.gif
//            foreach (Forum forum in forums) 
InBlock.gif
//            {
InBlock.gif
//                // We only go 3 deep
InBlock.gif
//                //
InBlock.gif
//
InBlock.gif
//                switch (depth) 
InBlock.gif
//                {
InBlock.gif
//                    case 0:
InBlock.gif
//
InBlock.gif
//                        Items.Add(new ListItem(ResourceManager.GetString("Navigation_JumpDropDownList_Indent1") + forum.Name, "f-" + forum.SectionID.ToString()));
InBlock.gif
//                        if (forum.Sections.Count > 0)
InBlock.gif
//                            RecursiveAddForum((depth + 1), forum.Sections);
InBlock.gif
//                        break;
InBlock.gif
//
InBlock.gif
//                    case 1:
InBlock.gif
//                        Items.Add(new ListItem(ResourceManager.GetString("Navigation_JumpDropDownList_Indent2") + forum.Name, "f-" + forum.SectionID.ToString()));
InBlock.gif
//                        if (forum.Sections.Count > 0)
InBlock.gif
//                            RecursiveAddForum((depth + 1), forum.Sections);
InBlock.gif
//                        break;
InBlock.gif
//
InBlock.gif
//                    case 2:
InBlock.gif
//                        Items.Add(new ListItem(ResourceManager.GetString("Navigation_JumpDropDownList_Indent3") + forum.Name, "f-" + forum.SectionID.ToString()));
InBlock.gif
//                        if (forum.Sections.Count > 0)
InBlock.gif
//                            RecursiveAddForum((depth + 1), forum.Sections);
InBlock.gif
//                        break;
InBlock.gif
//
InBlock.gif
//                    default:
InBlock.gif
//                        return;
InBlock.gif
//
InBlock.gif
//                }
InBlock.gif
//            }
InBlock.gif
//        }
InBlock.gif
InBlock.gif
InBlock.gif        
// *********************************************************************
InBlock.gif        
//  Location_Changed
InBlock.gif        
//
ExpandedSubBlockStart.gifContractedSubBlock.gif
        /**//**//**//// <summary>
InBlock.gif        
/// User wants to jump to a new location
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// 

InBlock.gif        // ********************************************************************/ 
InBlock.gif
        private void Location_Changed(Object sender, EventArgs e) 
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif
InBlock.gif            DropDownList jumpLocation 
= (DropDownList) sender;
InBlock.gif            
string jumpValue = jumpLocation.SelectedItem.Value;
InBlock.gif
InBlock.gif            
if (jumpValue.StartsWith("/")) 
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                Page.Response.Redirect(jumpValue);
ExpandedSubBlockEnd.gif            }
 
InBlock.gif
//            else if (jumpValue.StartsWith("g")) 
InBlock.gif
//            {
InBlock.gif
//                int forumGroupId = 0;
InBlock.gif
//                forumGroupId = Convert.ToInt32(jumpValue.Substring(jumpValue.IndexOf("-") + 1));
InBlock.gif
//                Page.Response.Redirect(Globals.GetSiteUrls().ForumGroup( forumGroupId)  );
InBlock.gif
//            } 
InBlock.gif
//            else if (jumpValue.StartsWith("f")) 
InBlock.gif
//            {
InBlock.gif
//                int forumId = 0;
InBlock.gif
//                forumId = Convert.ToInt32(jumpValue.Substring(jumpValue.IndexOf("-") + 1));
InBlock.gif
//                Page.Response.Redirect(ForumUrls.Instance().Forum(forumId) );
InBlock.gif
//            } 
InBlock.gif
            else 
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                Page.Response.Redirect(Globals.GetSiteUrls().Home);
ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif            
// End the response
InBlock.gif
            Page.Response.End();
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif
InBlock.gif        
// *********************************************************************
InBlock.gif        
//  DisplayText
InBlock.gif        
//
ExpandedSubBlockStart.gifContractedSubBlock.gif
        /**//**//**//// <summary>
InBlock.gif        
/// Text preceding the drop down list of options
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// 

InBlock.gif        // ********************************************************************/ 
InBlock.gif
        public virtual String DisplayText 
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
get 
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                Object state 
= ViewState["DisplayText"];
InBlock.gif                
if ( state != null ) 
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
return (String)state;
ExpandedSubBlockEnd.gif                }

InBlock.gif                
return ResourceManager.GetString("Navigation_JumpDropDownList_displayText");
ExpandedSubBlockEnd.gif            }

InBlock.gif            
set 
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                ViewState[
"DisplayText"= value;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif

转载于:https://www.cnblogs.com/hyouhaku/archive/2005/09/11/234218.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值