public class Processor : WebPart


{

成员变量#region 成员变量
private const string MENU_CONTROL_ACTIONS = "Microsoft.SharePoint.WebControls.ActionsMenu";
private const string MENU_CONTROL_NEW = "Microsoft.SharePoint.WebControls.NewMenu";
private const string MENU_CONTROL_SETTINGS = "Microsoft.SharePoint.WebControls.SettingsMenu";
private const string MENU_CONTROL_UPLOAD = "Microsoft.SharePoint.WebControls.UploadMenu";
private const string MENU_ID_ALERT = "SubscribeButton";
private const string MENU_ID_COLUMN = "AddColumn";
private const string MENU_ID_DATABASE = "ExportToDatabase";
private const string MENU_ID_DATASHEET = "EditInGridButton";
private const string MENU_ID_EXPLORER = "OpenInExplorer";
private const string MENU_ID_NEW = "New0";
private const string MENU_ID_NEWFOLDER = "NewFolder";
private const string MENU_ID_OUTLOOK = "OfflineButton";
private const string MENU_ID_QUESTIONS = "AddQuestion";
private const string MENU_ID_RSS = "ViewRSS";
private const string MENU_ID_SETTINGS = "ListSettings";
private const string MENU_ID_SPREADSHEET = "ExportToSpreadsheet";
private const string MENU_ID_UPLOADDOCUMENT = "Upload";
private const string MENU_ID_UPLOADMULTIPLE = "MultipleUpload";
private const string MENU_ID_VIEW = "AddView";
private bool showActionsEditInGridButton = true;
private bool showActionsExportToDatabase = true;
private bool showActionsExportToSpreadsheet = true;
private bool showActionsMenu = true;
private bool showActionsOfflineButton = true;
private bool showActionsOpenInExplorer = true;
private bool showActionsSubscribeButton = true;
private bool showActionsViewRSS = true;
private bool showNewFolder = true;
private bool showNewMenu = true;
private bool showSettingsAddColumn = true;
private bool showSettingsAddQuestion = true;
private bool showSettingsAddView = true;
private bool showSettingsListSettings = true;
private bool showSettingsMenu = true;
private bool showUploadMenu = true;
private bool showUploadMultipleUpload = true;
private bool showUploadUpload = true;
#endregion

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)
评论()
收藏
举报