Clase ConsoleAction
Representa la clase base que deben heredar todas las acciones de la consola en particular que se utilizará en el ConsoleDataSource.
Jerarquía de la herencia
System.Object
System.Web.UI.Control
System.Web.UI.WebControls.WebControl
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ConsoleAction
Espacio de nombres: Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions
Ensamblado: Microsoft.SharePoint.Publishing (en Microsoft.SharePoint.Publishing.dll)
Sintaxis
'Declaración
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public MustInherit Class ConsoleAction _
Inherits WebControl _
Implements IPostBackEventHandler
'Uso
Dim instance As ConsoleAction
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public abstract class ConsoleAction : WebControl,
IPostBackEventHandler
Comentarios
El menú Acciones del sitio , Menú de acceso rápidoo Menú Ediciónpresentan varias acciones para el usuario. Cada uno de estos menús contiene una instancia del objeto ConsoleDataSource que proporciona una colección jerárquica de objetos ConsoleNode , algunas de las cuales implementan la clase ConsoleAction . Cada implementación de esta clase representa una acción específica, como la Página Crear, Publicar, Mostrar el historial de versioneso Guardar y detener edición.
El ejemplo de código que se presenta aquí se ha simplificado, pero muestra cómo se debe construir una acción de la consola. Ejecute esta aplicación de ejemplo, agrega un botón "Guardar y detener edición" en el Menú de acceso rápido. Se requiere que la página esté en modo de edición y que el usuario tenga los permisos para este objeto PublishingPageEditListItem . En el ejemplo se utiliza ECMAScript (JavaScript, JScript) para registrar este control, y cuando provoca un evento de devolución, el evento guarda el objeto de PublishingPage actual y muestra la página guardada en modo de presentación.
Ejemplos
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions;
/// Assemblies that need to be referenced in this sample;
/// Microsoft.SharePoint.dll
/// Microsoft.SharePoint.Publishing.dll
/// Microsoft.Web.CommandUI.dll
namespace Microsoft.SDK.SharePointServer.Samples.Publishing.RteExtensions
{
public class RteExtensionsAction : ConsoleAction
{
/// <summary>
/// This Console Action will include on the client a reference to RteExtension.js file
/// on pages that have a Rich Text Editor.
/// </summary>
public RteExtensionsAction()
: base()
{
}
/// <summary>
/// Gets the rights required for this console action to be active on the page.
///
/// For this example, we will have the same value as the Publishing Rich Text Editor
/// which requires Edit List Item Right, since we want to activate under
/// the same circumstances.
/// </summary>
/// <value>
/// The rights required for this console action to be active on the page.
/// </value>
public override SPBasePermissions UserRights
{
get { return SPBasePermissions.EditListItems; }
}
/// <summary>
/// The value returned by this function represents a list of Ribbon tabs, if these
/// ribbon tabs are currently shown, then this console action will be activate on this page.
///
/// For this example, we are specifying the Format Text tab, which is requested
/// when the Publishing Rich Text Editor is on the page. Also, we are adding a new
/// button to this tab, and hence we want to activate when that button is present on
/// the page.
/// </summary>
/// <returns>
/// A list of ribbon tabs for which the ConsoleAction is activated.
/// </returns>
public override string[] GetRibbonTabIdsWhereConsoleActionIsShown()
{
return new string[] { SPRibbon.EditTabId };
}
/// <summary>
/// If the UserRights are met and the Ribbon Tabs have been found, then this method will be called.
/// This is where you register your appropriate ribbon files and send to the client data it requires.
///
/// For this example, we will tell SharePoint ScriptLink about the existance of RteExtensions.js.
/// This will allow code on the client to download it on demand.
/// The second part will register a startup script that will download RteExtensions.js once the
/// SharePoint rich text editor file (sp.ui.rte.js) has finished downloaded.
/// </summary>
public override void RegisterClientData()
{
// Register the extension script, such that it can be downloaded on demand.
ScriptLink.RegisterOnDemand(this.Page, "RteExtensions.js", false);
// Download the RteExtension script when the SharePoint RTE has finished downloaded.
string onDemandScript = @"
// This method informs SharePoint to start downloading the Script On Demand
// file that was registered on the server.
function loadRteExtensions()
{
// Include the RteExtensions.js if it is not already on the page.
var defd;
try
{
defd = typeof(RteExtensions);
}
catch (e)
{
defd = 'undefined';
}
EnsureScript('RteExtensions.js', defd, null);
}
// This method is run when the body has finished loading.
// Inform SharePoint to wait until the rich text editor has been
// downloaded on the page before including the rte extensions.
function loadExtensionsDependencies()
{
ExecuteOrDelayUntilScriptLoaded(loadRteExtensions, 'sp.ui.rte.js');
}
// Add to the SharePoint array of functions to call when the
// body of the document has finished loading
// Wait for the page to have completed to load
// this will make sure that all script on demand information
// has been processed by SharePoint.
if (_spBodyOnLoadFunctionNames != null)
{
_spBodyOnLoadFunctionNames.push('loadExtensionsDependencies');
}
";
Page.ClientScript.RegisterStartupScript(typeof(RteExtensionsAction), "RteExtensionsAction", onDemandScript, true);
}
}
}
Seguridad para subprocesos
Los miembros static (Shared en Visual Basic) públicos de este tipo son seguros para subprocesos. No se garantiza que los miembros de instancias sean seguros para los subprocesos.
Vea también
Referencia
Espacio de nombres Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions
Jerarquía de la herencia
System.Object
System.Web.UI.Control
System.Web.UI.WebControls.WebControl
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ConsoleAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ApproveOrDeclineAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.BaseApproveAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.BaseDeclineAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.BrowseWebPartsAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CancelApprovalRequestAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CancelApprovalWorkflowRequestAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CancelSchedulingAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CheckInAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CheckInWithCommentAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CheckOutAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CheckOutOverrideAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CopyAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CreateNewPublishingPageAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CreateNewSiteAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CreateNewsLinkAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CreatePageVariationAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.CreateSiteVariationAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.DeleteAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.DesignSiteAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.DeviceChannelReorderingAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.EditListItemPropertiesAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.EditPropertiesAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.EditSeoPropertiesAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ExitMenuAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ExitWithoutSavingAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ForceSavePublishingPageAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ImportWebPartsAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ManageSiteAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ModifyNavigationAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ModifyPagesLibrarySettingsAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.MoveAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.OneClickPublishAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.PageLayoutAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.PersonalViewAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.PreviewAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.PreviewExistingPublishingPageAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.PublishAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.PublishWithCommentAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.QuickDeployAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ReviewPublishingPageAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.RevisionHistoryAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.RTEV4Action
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.SavePublishingPageAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.SchedulingAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.SearchWebPartsAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.SharedViewAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ShowUnapprovedResourcesAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.SiteDirectoryBrokenLinksCheckerAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.SiteSettingsAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.SpellCheckEntirePageAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.SwitchToAuthoringModeAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.SwitchToPublishedModeAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.UndoCheckOutAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.UnpublishAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.VersionDifferenceAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.VersionInfoAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ViewAllSiteContentAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ViewChangesPageVariationAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.ViewRecycleBinAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.WorkflowStartAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.WorkflowStatusAction
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.WorkflowTasksAction
Microsoft.SharePoint.Publishing.WebControls.SmallBusinessWebsiteConsoleAction
Microsoft.SharePoint.Publishing.WebControls.SpellCheckV4Action