public class Processor : WebPart
{
    
成员变量

    
private void ExamineControls(Control parentControl)
    
{
        
foreach (Control control in parentControl.Controls)
        
{
            
if (control.ToString().ToUpper() == "Microsoft.SharePoint.WebControls.NewMenu".ToUpper())
            
{
                NewMenu menu 
= (NewMenu) control;
                
try
                
{
                    menu.Visible 
= this.ShowNewMenu;
                }

                
catch
                
{
                }

                
try
                
{
                    menu.GetMenuItem(
"NewFolder").Visible = this.ShowNewFolder;
                }

                
catch
                
{
                }

            }

            
if (control.ToString().ToUpper() == "Microsoft.SharePoint.WebControls.UploadMenu".ToUpper())
            
{
                UploadMenu menu2 
= (UploadMenu) control;
                
try
                
{
                    menu2.Visible 
= this.ShowUploadMenu;
                }

                
catch
                
{
                }

                
try
                
{
                    menu2.GetMenuItem(
"Upload").Visible = this.ShowUploadUpload;
                }

                
catch
                
{
                }

                
try
                
{
                    menu2.GetMenuItem(
"MultipleUpload").Visible = this.ShowUploadMultipleUpload;
                }

                
catch
                
{
                }

            }

            
if (control.ToString().ToUpper() == "Microsoft.SharePoint.WebControls.ActionsMenu".ToUpper())
            
{
                ActionsMenu menu3 
= (ActionsMenu) control;
                
try
                
{
                    menu3.Visible 
= this.ShowActionsMenu;
                }

                
catch
                
{
                }

                
try
                
{
                    menu3.GetMenuItem(
"EditInGridButton").Visible = this.ShowActionsEditInGridButton;
                }

                
catch
                
{
                }

                
try
                
{
                    menu3.GetMenuItem(
"OpenInExplorer").Visible = this.ShowActionsOpenInExplorer;
                }

                
catch
                
{
                }

                
try
                
{
                    menu3.GetMenuItem(
"OfflineButton").Visible = this.ShowActionsOfflineButton;
                }

                
catch
                
{
                }

                
try
                
{
                    menu3.GetMenuItem(
"ExportToSpreadsheet").Visible = this.ShowActionsExportToSpreadsheet;
                }

                
catch
                
{
                }

                
try
                
{
                    menu3.GetMenuItem(
"ExportToDatabase").Visible = this.ShowActionsExportToDatabase;
                }

                
catch
                
{
                }

                
try
                
{
                    menu3.GetMenuItem(
"ViewRSS").Visible = this.ShowActionsViewRSS;
                }

                
catch
                
{
                }

                
try
                
{
                    menu3.GetMenuItem(
"SubscribeButton").Visible = this.ShowActionsSubscribeButton;
                }

                
catch
                
{
                }

            }

            
if (control.ToString().ToUpper() == "Microsoft.SharePoint.WebControls.SettingsMenu".ToUpper())
            
{
                SettingsMenu menu4 
= (SettingsMenu) control;
                
try
                
{
                    menu4.Visible 
= this.ShowSettingsMenu;
                }

                
catch
                
{
                }

                
try
                
{
                    menu4.GetMenuItem(
"AddColumn").Visible = this.ShowSettingsAddColumn;
                }

                
catch
                
{
                }

                
try
                
{
                    menu4.GetMenuItem(
"AddView").Visible = this.ShowSettingsAddView;
                }

                
catch
                
{
                }

                
try
                
{
                    menu4.GetMenuItem(
"ListSettings").Visible = this.ShowSettingsListSettings;
                }

                
catch
                
{
                }

                
try
                
{
                    menu4.GetMenuItem(
"AddQuestion").Visible = this.ShowSettingsAddQuestion;
                }

                
catch
                
{
                }

            }

            
this.ExamineControls(control);
        }

    }


    
protected override void OnPreRender(EventArgs e)
    
{
        
foreach (Control control in this.Page.Controls)
        
{
            
this.ExamineControls(control);
        }

    }



    [WebDisplayName(
"Show 'Edit in Datasheet' Menu Item"), Category("Actions Menu"), WebBrowsable(true), Personalizable(PersonalizationScope.Shared)]
    
public bool ShowActionsEditInGridButton
    
{
        
get
        
{
            
return this.showActionsEditInGridButton;
        }

        
set
        
{
            
this.showActionsEditInGridButton = value;
        }

    }


    [WebDisplayName(
"Show 'Open with Access' Menu Item"), Category("Actions Menu"), WebBrowsable(true), Personalizable(PersonalizationScope.Shared)]
    
public bool ShowActionsExportToDatabase
    
{
        
get
        
{
            
return this.showActionsExportToDatabase;
        }

        
set
        
{
            
this.showActionsExportToDatabase = value;
        }

    }


    [Personalizable(PersonalizationScope.Shared), Category(
"Actions Menu"), WebBrowsable(true), WebDisplayName("Show 'Export to Spreadsheet' Menu Item")]
    
public bool ShowActionsExportToSpreadsheet
    
{
        
get
        
{
            
return this.showActionsExportToSpreadsheet;
        }

        
set
        
{
            
this.showActionsExportToSpreadsheet = value;
        }

    }


    [Personalizable(PersonalizationScope.Shared), WebBrowsable(
true), WebDisplayName("Show 'Actions' Menu"), Category("Actions Menu")]
    
public bool ShowActionsMenu
    
{
        
get
        
{
            
return this.showActionsMenu;
        }

        
set
        
{
            
this.showActionsMenu = value;
        }

    }


    [WebBrowsable(
true), Personalizable(PersonalizationScope.Shared), Category("Actions Menu"), WebDisplayName("Show 'Connect to Outlook' Menu Item")]
    
public bool ShowActionsOfflineButton
    
{
        
get
        
{
            
return this.showActionsOfflineButton;
        }

        
set
        
{
            
this.showActionsOfflineButton = value;
        }

    }


    [Category(
"Actions Menu"), Personalizable(PersonalizationScope.Shared), WebBrowsable(true), WebDisplayName("Show 'Open with Windows Explorer' Menu Item")]
    
public bool ShowActionsOpenInExplorer
    
{
        
get
        
{
            
return this.showActionsOpenInExplorer;
        }

        
set
        
{
            
this.showActionsOpenInExplorer = value;
        }

    }


    [Personalizable(PersonalizationScope.Shared), Category(
"Actions Menu"), WebBrowsable(true), WebDisplayName("Show 'Alert Me' Menu Item")]
    
public bool ShowActionsSubscribeButton
    
{
        
get
        
{
            
return this.showActionsSubscribeButton;
        }

        
set
        
{
            
this.showActionsSubscribeButton = value;
        }

    }


    [WebBrowsable(
true), Personalizable(PersonalizationScope.Shared), Category("Actions Menu"), WebDisplayName("Show 'View RSS Feed' Menu Item")]
    
public bool ShowActionsViewRSS
    
{
        
get
        
{
            
return this.showActionsViewRSS;
        }

        
set
        
{
            
this.showActionsViewRSS = value;
        }

    }


    [WebBrowsable(
true), WebDisplayName("Show 'New Folder' Menu Item"), Category("New Menu"), Personalizable(PersonalizationScope.Shared)]
    
public bool ShowNewFolder
    
{
        
get
        
{
            
return this.showNewFolder;
        }

        
set
        
{
            
this.showNewFolder = value;
        }

    }


    [Personalizable(PersonalizationScope.Shared), WebBrowsable(
true), WebDisplayName("Show 'New' Menu"), Category("New Menu")]
    
public bool ShowNewMenu
    
{
        
get
        
{
            
return this.showNewMenu;
        }

        
set
        
{
            
this.showNewMenu = value;
        }

    }


    [WebBrowsable(
true), WebDisplayName("Show 'Create Column' Menu Item"), Category("Settings Menu"), Personalizable(PersonalizationScope.Shared)]
    
public bool ShowSettingsAddColumn
    
{
        
get
        
{
            
return this.showSettingsAddColumn;
        }

        
set
        
{
            
this.showSettingsAddColumn = value;
        }

    }


    [WebBrowsable(
true), WebDisplayName("Show 'Add Questions' Menu Item"), Personalizable(PersonalizationScope.Shared), Category("Settings Menu")]
    
public bool ShowSettingsAddQuestion
    
{
        
get
        
{
            
return this.showSettingsAddQuestion;
        }

        
set
        
{
            
this.showSettingsAddQuestion = value;
        }

    }


    [WebBrowsable(
true), Personalizable(PersonalizationScope.Shared), Category("Settings Menu"), WebDisplayName("Show 'Create View' Menu Item")]
    
public bool ShowSettingsAddView
    
{
        
get
        
{
            
return this.showSettingsAddView;
        }

        
set
        
{
            
this.showSettingsAddView = value;
        }

    }


    [WebDisplayName(
"Show 'List Settings' Menu Item"), Category("Settings Menu"), WebBrowsable(true), Personalizable(PersonalizationScope.Shared)]
    
public bool ShowSettingsListSettings
    
{
        
get
        
{
            
return this.showSettingsListSettings;
        }

        
set
        
{
            
this.showSettingsListSettings = value;
        }

    }


    [WebDisplayName(
"Show Settings Menu"), Personalizable(PersonalizationScope.Shared), Category("Settings Menu"), WebBrowsable(true)]
    
public bool ShowSettingsMenu
    
{
        
get
        
{
            
return this.showSettingsMenu;
        }

        
set
        
{
            
this.showSettingsMenu = value;
        }

    }


    [Personalizable(PersonalizationScope.Shared), WebBrowsable(
true), WebDisplayName("Show 'Upload' Menu"), Category("Upload Menu")]
    
public bool ShowUploadMenu
    
{
        
get
        
{
            
return this.showUploadMenu;
        }

        
set
        
{
            
this.showUploadMenu = value;
        }

    }


    [WebDisplayName(
"Show 'Upload Multiple Documents' Menu Item"), WebBrowsable(true), Personalizable(PersonalizationScope.Shared), Category("Upload Menu")]
    
public bool ShowUploadMultipleUpload
    
{
        
get
        
{
            
return this.showUploadMultipleUpload;
        }

        
set
        
{
            
this.showUploadMultipleUpload = value;
        }

    }


    [WebDisplayName(
"Show 'Upload Document' Menu Item"), Category("Upload Menu"), WebBrowsable(true), Personalizable(PersonalizationScope.Shared)]
    
public bool ShowUploadUpload
    
{
        
get
        
{
            
return this.showUploadUpload;
        }

        
set
        
{
            
this.showUploadUpload = value;
        }

    }

}


posted on 2008-08-14 12:35  windpole  阅读(163)  评论(0)    收藏  举报