public IEnumerable<ElementAction> GetActions(EntityToken entityToken) { var dataEntityToken = entityToken as DataEntityToken; if (dataEntityToken == null) return NoActions; if (dataEntityToken.InterfaceType != typeof(IXsltFunction)) return NoActions; var action = new ElementAction(new ActionHandle(new ConvertFunctionActionToken())) { VisualData = new ActionVisualizedData { Label = "Convert to Razor", ToolTip = "Creates a new razor function with the same name and parameters while renaming the existing xsl function", Icon = ActionIcon, Disabled = false, ActionLocation = new ActionLocation { ActionType = ActionType.Other, IsInFolder = false, IsInToolbar = true, ActionGroup = PrimaryActionGroup } } }; return new [] { action }; }
protected override void OnAddAction(Action<ElementAction> actionAdder, EntityToken entityToken, TreeNodeDynamicContext dynamicContext, DynamicValuesHelperReplaceContext dynamicValuesHelperReplaceContext) { string url = this.UrlDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext); this.External = url.Contains("://"); if(!External) { url = UrlUtils.ResolvePublicUrl(url); } CustomUrlActionNodeActionToken actionToken = new CustomUrlActionNodeActionToken( url, this.External, (this.External ? "externalview" : "documentview"), this.ViewLabelDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext), this.ViewToolTipDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext), this.Serialize(), this.PermissionTypes); ElementAction elementAction = new ElementAction(new ActionHandle(actionToken)) { VisualData = CreateActionVisualizedData(dynamicValuesHelperReplaceContext) }; actionAdder(elementAction); }
public IEnumerable<ElementAction> GetActions(EntityToken entityToken) { if (entityToken is NugetPackageEntityToken) { var isRemote = ((NugetPackageEntityToken)entityToken).IsRemotePackage(); var isUpdate = ((NugetPackageEntityToken)entityToken).IsUpdatePackage(); ElementAction elementAction = new ElementAction(new ActionHandle(new NugetActionToken())) { VisualData = new ActionVisualizedData { Label = isRemote ? "Install Package" : isUpdate? "Update Package" : "Uninstall Package", ToolTip = string.Empty, Icon = isRemote ? CommonCommandIcons.AddNew : isUpdate? CommonCommandIcons.Refresh : CommonCommandIcons.Delete, ActionLocation = new ActionLocation { ActionType = ActionType.Edit, IsInToolbar = true, ActionGroup = AppendedActionGroup } } }; yield return elementAction; } }
/// <summary> /// Remove an action from the element /// </summary> /// <param name="elementAction">The action to remove</param> public void RemoveAction(ElementAction elementAction) { if (elementAction == null) { throw new ArgumentNullException("elementAction"); } _elementActions.Remove(elementAction); }
/// <exclude /> public bool Equals(ElementAction elementAction) { if (elementAction == null) { return(false); } return(this.ActionHandle.Equals(elementAction)); }
/// <summary> /// Add an action to the element /// </summary> /// <param name="elementAction">The action to add</param> public void AddAction(ElementAction elementAction) { Verify.ArgumentNotNull(elementAction, "elementAction"); if (_elementActions.Contains(elementAction) == false) { _elementActions.Add(elementAction); } else { LoggingService.LogWarning("Element", string.Format("An action with the same action token type '{0}' and same serialized string '{1}' has already been added", elementAction.ActionHandle.ActionToken.GetType(), elementAction.ActionHandle.ActionToken.Serialize())); } }
protected override void OnAddAction(Action<ElementAction> actionAdder, EntityToken entityToken, TreeNodeDynamicContext dynamicContext, DynamicValuesHelperReplaceContext dynamicValuesHelperReplaceContext) { ActionToken actionToken = new MessageBoxActionNodeActionToken( this.TitleDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext), this.MessageDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext), this.Serialize(), this.PermissionTypes ); ElementAction elementAction = new ElementAction(new ActionHandle(actionToken)) { VisualData = this.CreateActionVisualizedData(dynamicValuesHelperReplaceContext) }; elementAction.VisualData.ActionLocation = this.Location; actionAdder(elementAction); }
/// <summary> /// Remove an action from the element /// </summary> /// <param name="elementAction">The action to remove</param> public void RemoveAction(ElementAction elementAction) { if (elementAction == null) throw new ArgumentNullException("elementAction"); _elementActions.Remove(elementAction); }
/// <exclude /> public List<ElementAction> GetActions(IData data, Type elementProviderType) { if (!(data is IPublishControlled) || !data.DataSourceId.DataScopeIdentifier.Equals(DataScopeIdentifier.Administrated)) { return new List<ElementAction>(); } if (data is ILocalizedControlled && !UserSettings.ActiveLocaleCultureInfo.Equals(data.DataSourceId.LocaleScope)) { return new List<ElementAction>(); } var publishControlled = (IPublishControlled)data; IList<string> visualTrans = _visualTransitions[publishControlled.PublicationStatus]; var clientActions = visualTrans.Select(newState => _visualTransitionsActions[newState]()).ToList(); IData publicData = DataFacade.GetDataFromOtherScope(data, DataScopeIdentifier.Public, true).FirstOrDefault(); if (publicData != null) { var unpublishAction = new ElementAction(new ActionHandle(new ProxyDataActionToken(ActionIdentifier.Unpublish))) { VisualData = new ActionVisualizedData() { Label = StringResourceSystemFacade.GetString("Composite.Plugins.GenericPublishProcessController", "Unpublish"), ToolTip = StringResourceSystemFacade.GetString("Composite.Plugins.GenericPublishProcessController", "UnpublishToolTip"), Icon = GenericPublishProcessController.Unpublish, Disabled = false, ActionLocation = new ActionLocation { ActionType = ActionType.Other, IsInFolder = false, IsInToolbar = true, ActionGroup = WorkflowActionGroup } } }; clientActions.Add(unpublishAction); if (publishControlled.PublicationStatus == Draft) { if (ProcessControllerAttributesFacade.IsActionIgnored(elementProviderType, GenericPublishProcessControllerActionTypeNames.UndoUnpublishedChanges) == false) { ActionToken actionToken; IActionTokenProvider actionTokenProvider = ProcessControllerAttributesFacade.GetActionTokenProvider(elementProviderType, GenericPublishProcessControllerActionTypeNames.UndoUnpublishedChanges); if (actionTokenProvider != null) { actionToken = actionTokenProvider.GetActionToken(GenericPublishProcessControllerActionTypeNames.UndoUnpublishedChanges, data); } else { actionToken = new UndoPublishedChangesActionToken(); } var undoPublishedChangesAction = new ElementAction(new ActionHandle(actionToken)) { VisualData = new ActionVisualizedData { Label = StringResourceSystemFacade.GetString("Composite.Plugins.GenericPublishProcessController", "UndoPublishedChanges"), ToolTip = StringResourceSystemFacade.GetString("Composite.Plugins.GenericPublishProcessController", "UndoPublishedChangesToolTip"), Icon = GenericPublishProcessController.UndoUnpublishedChanges, Disabled = false, ActionLocation = new ActionLocation { ActionType = ActionType.Other, IsInFolder = false, IsInToolbar = true, ActionGroup = WorkflowActionGroup } } }; clientActions.Add(undoPublishedChangesAction); } } } return clientActions; }
/// <exclude /> public bool Equals(ElementAction elementAction) { if (elementAction == null) return false; return this.ActionHandle.Equals(elementAction); }