public static IHtmlString RenderEditLink(this HtmlHelper helper, IPageTeaser teaser, string label) { if (DataScopeManager.CurrentDataScope != DataScopeIdentifier.Administrated) { return(helper.Raw(String.Empty)); } var editWorkflowAttribute = teaser.DataSourceId.InterfaceType.GetCustomAttributes(true).OfType <EditWorkflowAttribute>().FirstOrDefault(); if (editWorkflowAttribute == null) { return(helper.Raw(String.Empty)); } var page = PageManager.GetPageById(teaser.PageId); var entityToken = new PageTeaserInstanceEntityToken(page, teaser); var serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true); var editActionToken = new WorkflowActionToken(editWorkflowAttribute.EditWorkflowType); var serializedActionToken = ActionTokenSerializer.Serialize(editActionToken, true); var html = String.Format("<a href=\"#\" data-providername=\"{0}\" data-entitytoken=\"{1}\" data-actiontoken=\"{2}\" data-piggybag=\"{3}\" data-piggybaghash=\"{4}\" onclick=\"executeAction(this)\">{5}</a>", teaser.DataSourceId.ProviderName, serializedEntityToken, serializedActionToken, String.Empty, HashSigner.GetSignedHash(string.Empty).Serialize(), label); return(helper.Raw(html)); }
/// <summary> /// Constructs a new search document. /// </summary> /// <param name="source">The data source name.</param> /// <param name="id">An id to update the document later on.</param> /// <param name="label">A text to be shown in search results.</param> /// <param name="entityToken">The entity token, will be used to locate the found document in the /// console tree structure.</param> public SearchDocument(string source, string id, string label, EntityToken entityToken) : this(source, id, label, "") { Verify.ArgumentNotNull(entityToken, nameof(entityToken)); SerializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true); }
/// <exclude /> public void UpdateWithNewBindings(Dictionary <string, object> bindings, IEnumerable <string> selectedSerializedEntityTokens) { Dictionary <string, string> options = new Dictionary <string, string>(); foreach (Element perspectiveElement in _perspectiveElements) { options.Add( EntityTokenSerializer.Serialize(perspectiveElement.ElementHandle.EntityToken), perspectiveElement.VisualData.Label ); } if (bindings.ContainsKey(MultiKeySelectorOptionsBindingName) == false) { bindings.Add(MultiKeySelectorOptionsBindingName, options); } else { bindings[MultiKeySelectorOptionsBindingName] = options; } if (bindings.ContainsKey(MultiKeySelectorSelectedBindingName) == false) { bindings.Add(MultiKeySelectorSelectedBindingName, selectedSerializedEntityTokens.ToList()); } else { bindings[MultiKeySelectorSelectedBindingName] = selectedSerializedEntityTokens.ToList(); } }
public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer) { //string documentTitle = "Unpublished Pages and Page Folder Data"; //string description = "The list below display pages and page data which are currently being edited or are ready to be approved / published."; string documentTitle = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.ViewUnpublishedItems-document-title"); string description = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.ViewUnpublishedItems-document-description"); string emptyLabel = StringResourceSystemFacade.GetString("Composite.Plugins.GeneratedDataTypesElementProvider", "ViewUnpublishedItems-document-empty-label"); string url = string.Format("{0}?showpagedata=true&title={1}&description={2}&emptyLabel={3}", UrlUtils.ResolveAdminUrl(string.Format("content/views/publishworkflowstatus/ViewUnpublishedItems.aspx")), HttpUtility.UrlEncode(documentTitle, Encoding.UTF8), HttpUtility.UrlEncode(description, Encoding.UTF8), HttpUtility.UrlEncode(emptyLabel, Encoding.UTF8)); IManagementConsoleMessageService consoleServices = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>(); OpenViewMessageQueueItem openViewMsg = new OpenViewMessageQueueItem { EntityToken = EntityTokenSerializer.Serialize(entityToken, true), ViewId = "ViewUnpublishedPageItems", Label = documentTitle, Url = url, ViewType = ViewType.Main }; ConsoleMessageQueueFacade.Enqueue(openViewMsg, consoleServices.CurrentConsoleId); return(null); }
public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer) { string currentConsoleId = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>().CurrentConsoleId; string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken); if (actionToken.Serialize() == "ShowGraph") { string url = string.Format("{0}?EntityToken={1}", UrlUtils.ResolveAdminUrl("content/views/relationshipgraph/Default.aspx"), System.Web.HttpUtility.UrlEncode(serializedEntityToken)); ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem { Url = url, ViewId = Guid.NewGuid().ToString(), ViewType = ViewType.Main, Label = "Show graph..." }, currentConsoleId); } else if (actionToken.Serialize() == "ShowOrientedGraph") { Guid id = Guid.NewGuid(); string filename = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.TempDirectory), string.Format("{0}.RelationshipGraph", id)); C1File.WriteAllLines(filename, new string[] { serializedEntityToken }); string url = string.Format("{0}?Id={1}", UrlUtils.ResolveAdminUrl("content/views/relationshipgraph/ShowRelationshipOrientedGraph.aspx"), id); ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem { Url = url, ViewId = Guid.NewGuid().ToString(), ViewType = ViewType.Main, Label = "Show graph..." }, currentConsoleId); } return(null); }
public override IEnumerable <System.Xml.Linq.XElement> Install() { // grant Perspective permissions to the current user string perspectiveName = "Composite.Tools.PackageCreator"; var entityToken = new VirtualElementProviderEntityToken("VirtualElementProvider", perspectiveName); var serializedEntityToken = EntityTokenSerializer.Serialize(entityToken); var sitemapPerspective = DataFacade.BuildNew <IUserGroupActivePerspective>(); var userGroup = DataFacade.GetData <IUserGroup>().FirstOrDefault(u => u.Name == "Administrator"); if (userGroup != null) { sitemapPerspective.UserGroupId = userGroup.Id; sitemapPerspective.SerializedEntityToken = serializedEntityToken; sitemapPerspective.Id = Guid.NewGuid(); DataFacade.AddNew(sitemapPerspective); Log.LogInformation("Composite.Tools.PackageCreator", $"Access to the '{perspectiveName}' granted for user group '{userGroup.Name}'."); } if (UserValidationFacade.IsLoggedIn()) { var activePerspective = DataFacade.BuildNew <IUserActivePerspective>(); activePerspective.Username = C1Console.Users.UserSettings.Username; activePerspective.SerializedEntityToken = serializedEntityToken; activePerspective.Id = Guid.NewGuid(); DataFacade.AddNew <IUserActivePerspective>(activePerspective); Log.LogInformation("Composite.Tools.PackageCreator", $"Access to the '{perspectiveName}' granted for user '{C1Console.Users.UserSettings.Username}'."); } yield break; }
private bool ValidateUserPreservesAdminRights(IUserGroup userGroup, List <string> newUserGroupEntityTokens) { string systemPerspectiveEntityToken = EntityTokenSerializer.Serialize(AttachingPoint.SystemPerspective.EntityToken); Guid groupId = userGroup.Id; string userName = UserSettings.Username; var userGroupIds = UserGroupFacade.GetUserGroupIds(userName); HashSet <Guid> groupsWithAccessToSystemPerspective = new HashSet <Guid>(GetGroupsThatHasAccessToPerspective(systemPerspectiveEntityToken)); if (groupsWithAccessToSystemPerspective.Contains(groupId) && !newUserGroupEntityTokens.Contains(systemPerspectiveEntityToken) && !UserPerspectiveFacade.GetSerializedEntityTokens(userName).Contains(systemPerspectiveEntityToken) && !userGroupIds.Any(anotherGroupId => anotherGroupId != groupId && groupsWithAccessToSystemPerspective.Contains(anotherGroupId))) { this.ShowMessage(DialogType.Message, SR.GetString("Composite.Management", "EditUserWorkflow.EditErrorTitle"), SR.GetString("Composite.Management", "EditUserWorkflow.EditOwnAccessToSystemPerspective")); return(false); } return(true); }
private static void AddLockingInformation(EntityToken entityToken, object ownerId) { LockingInformation lockingInformation; if (_lockingInformations.TryGetValue(entityToken, out lockingInformation)) { if (object.Equals(lockingInformation.OwnerId, ownerId)) { // NO OP: The owner may acquire a lock multiple times return; } // This will only happen if an entity token subclass is not rightly implemented throw new ActionLockingException("This item is used by another user, try again."); } lockingInformation = new LockingInformation { Username = UserValidationFacade.GetUsername(), OwnerId = ownerId }; string serializedOwnerId = SerializeOwnerId(lockingInformation.OwnerId); ILockingInformation li = DataFacade.BuildNew <ILockingInformation>(); li.Id = Guid.NewGuid(); li.SerializedEntityToken = EntityTokenSerializer.Serialize(entityToken); li.SerializedOwnerId = serializedOwnerId; li.Username = lockingInformation.Username; DataFacade.AddNew <ILockingInformation>(li); _lockingInformations.Add(entityToken, lockingInformation); }
private static void RemoveLockingInformation(EntityToken entityToken, object ownerId) { LockingInformation lockingInformation; if (!_lockingInformations.TryGetValue(entityToken, out lockingInformation)) { return; } if (Equals(lockingInformation.OwnerId, ownerId)) { _lockingInformations.Remove(entityToken); } string serializedOwnerId = SerializeOwnerId(ownerId); string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken); ILockingInformation lockingInformationDataItem = DataFacade.GetData <ILockingInformation>() .SingleOrDefault(f => f.SerializedEntityToken == serializedEntityToken && f.SerializedOwnerId == serializedOwnerId); if (lockingInformationDataItem == null) { Log.LogWarning(LogTitle, "Failed to find entity token lock. EntityToken: " + serializedEntityToken); return; } DataFacade.Delete(lockingInformationDataItem); }
/// <exclude /> public static Dictionary <string, string> PreparePiggybag(this Dictionary <string, string> piggybag, TreeNode parentNode, EntityToken parentEntityToken) { var newPiggybag = new Dictionary <string, string>(); foreach (KeyValuePair <string, string> kvp in piggybag) { if (kvp.Key.StartsWith(ParentEntityTokenPiggybagString)) { int generation = int.Parse(kvp.Key.Substring(ParentEntityTokenPiggybagString.Length)); generation += 1; newPiggybag.Add(string.Format("{0}{1}", ParentEntityTokenPiggybagString, generation), kvp.Value); } else if (kvp.Key.StartsWith(ParentNodeIdPiggybagString)) { int generation = int.Parse(kvp.Key.Substring(ParentNodeIdPiggybagString.Length)); generation += 1; newPiggybag.Add(string.Format("{0}{1}", ParentNodeIdPiggybagString, generation), kvp.Value); } else { newPiggybag.Add(kvp.Key, kvp.Value); } } newPiggybag.Add(string.Format("{0}1", ParentEntityTokenPiggybagString), EntityTokenSerializer.Serialize(parentEntityToken)); newPiggybag.Add(string.Format("{0}1", ParentNodeIdPiggybagString), parentNode.Id.ToString()); return(newPiggybag); }
protected override IEnumerable <Element> OnGetElements(EntityToken parentEntityToken, TreeNodeDynamicContext dynamicContext) { var entityToken = new TreeSimpleElementEntityToken( this.Id, this.Tree.TreeId, EntityTokenSerializer.Serialize(parentEntityToken)); Element element = new Element(new ElementHandle( dynamicContext.ElementProviderName, entityToken, dynamicContext.Piggybag.PreparePiggybag(this.ParentNode, parentEntityToken) )); if (parentEntityToken is TreePerspectiveEntityToken) { element.ElementHandle.Piggyback[StringConstants.PiggybagTreeId] = Tree.TreeId; } var replaceContext = new DynamicValuesHelperReplaceContext(parentEntityToken, dynamicContext.Piggybag); element.VisualData = new ElementVisualizedData { Label = this.LabelDynamicValuesHelper.ReplaceValues(replaceContext), ToolTip = this.ToolTipDynamicValuesHelper.ReplaceValues(replaceContext), HasChildren = ChildNodes.Any(), Icon = this.Icon, OpenedIcon = this.OpenIcon }; yield return(element); }
internal static string GetEntityTokenHash(EntityToken entityToken) { var entityTokenString = EntityTokenSerializer.Serialize(entityToken); var bytes = Encoding.UTF8.GetBytes(entityTokenString); return(UrlUtils.CompressGuid(new Guid(HashingAlgorithm.ComputeHash(bytes)))); }
public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer) { UrlActionToken urlActionToken = (UrlActionToken)actionToken; string currentConsoleId = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>().CurrentConsoleId; string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken); string url = urlActionToken.Url; string extendedUrl = $"{url}{(url.Contains("?") ? "&" : "?")}EntityToken={HttpUtility.UrlEncode(serializedEntityToken)}"; if (extendedUrl.IndexOf("consoleId", StringComparison.OrdinalIgnoreCase) == -1) { extendedUrl = $"{extendedUrl}&consoleId={currentConsoleId}"; } ConsoleMessageQueueFacade.Enqueue( new OpenViewMessageQueueItem { Url = extendedUrl, ViewId = Guid.NewGuid().ToString(), ViewType = ViewType.Main, Label = urlActionToken.Label, IconResourceHandle = urlActionToken.Icon }, currentConsoleId); return(null); }
/// <summary> /// Selects the specified element in the console /// </summary> /// <param name="consoleId">The console id.</param> /// <param name="entityToken">The entity token.</param> public static void SelectConsoleElement(string consoleId, EntityToken entityToken) { var serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true); var rootEntityToken = AttachingPoint.PerspectivesRoot.EntityToken; var refreshInfo = TreeServicesFacade.FindEntityToken(rootEntityToken, entityToken, new List <RefreshChildrenParams>(new[] { new RefreshChildrenParams { ProviderName = rootEntityToken.Source, EntityToken = EntityTokenSerializer.Serialize(rootEntityToken, true) } })); if (refreshInfo == null || refreshInfo.Count == 0) { return; } string perspectiveElementKey = refreshInfo.Count > 1 ? refreshInfo[1].ElementKey : refreshInfo[0].ElementKey; var selectItem = new SelectElementQueueItem { EntityToken = serializedEntityToken, PerspectiveElementKey = perspectiveElementKey }; ConsoleMessageQueueFacade.Enqueue(selectItem, consoleId); }
public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer) { SearchActionToken searchActionToken = (SearchActionToken)actionToken; string currentConsoleId = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>().CurrentConsoleId; string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken); string viewId = Guid.NewGuid().ToString(); string url = UrlUtils.ResolveAdminUrl(string.Format("content/dialogs/treesearch/treeSearchForm.aspx?ProviderName={0}&EntityToken={1}&ViewId={2}&ConsoleId={3}", HttpUtility.UrlEncode(searchActionToken.ProviderName), HttpUtility.UrlEncode(serializedEntityToken), HttpUtility.UrlEncode(viewId), HttpUtility.UrlEncode(currentConsoleId))); ConsoleMessageQueueFacade.Enqueue( new OpenViewMessageQueueItem { Url = url, ViewId = viewId, ViewType = ViewType.ModalDialog, Label = StringResourceSystemFacade.GetString("Composite.Management", "RelationshipGraphActionExecutor.SearchElements"), ToolTip = StringResourceSystemFacade.GetString("Composite.Management", "RelationshipGraphActionExecutor.SearchElementsToolTip"), IconResourceHandle = CommonElementIcons.Question }, currentConsoleId); return(null); }
public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer) { string currentConsoleId = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>().CurrentConsoleId; string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken); StringBuilder sb = new StringBuilder(); var elementInformationService = flowControllerServicesContainer.GetService <IElementInformationService>(); if (elementInformationService != null) { Dictionary <string, string> piggybag = elementInformationService.Piggyback; foreach (var kvp in piggybag) { Core.Serialization.StringConversionServices.SerializeKeyValuePair(sb, kvp.Key, kvp.Value); } } Guid id = Guid.NewGuid(); string filename = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.TempDirectory), string.Format("{0}.showinfo", id)); C1File.WriteAllLines(filename, new string[] { serializedEntityToken, sb.ToString() }); string url = string.Format("{0}?PiggyBagId={1}", UrlUtils.ResolveAdminUrl("content/views/showelementinformation/Default.aspx"), id); ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem { Url = url, ViewId = Guid.NewGuid().ToString(), ViewType = ViewType.Main, Label = "Show Element Information..." }, currentConsoleId); return(null); }
/// <exclude /> public string ReplaceValues(DynamicValuesHelperReplaceContext context) { string currentValue = this.Template; if (this.DataFieldValueHelper != null) { currentValue = this.DataFieldValueHelper.ReplaceValues(currentValue, context.PiggybagDataFinder, context.CurrentDataItem, this.UseUrlEncode); } if (currentValue.Contains(CurrentEntityTokenMask)) { string serializedEntityToken = context.CurrentEntityToken != null ? EntityTokenSerializer.Serialize(context.CurrentEntityToken) : "(null)"; if (this.UseUrlEncode) { serializedEntityToken = HttpUtility.UrlEncode(serializedEntityToken); } currentValue = currentValue.Replace(CurrentEntityTokenMask, serializedEntityToken); } return(StringResourceSystemFacade.ParseString(currentValue)); }
public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer) { string functionNamePrefix = ""; if (entityToken.Id.IndexOf('.') > -1) { functionNamePrefix = entityToken.Id.Substring(entityToken.Id.IndexOf('.') + 1); } bool widgets = entityToken.Id.ToLower().Contains("widget"); string currentConsoleId = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>().CurrentConsoleId; string url = UrlUtils.ResolveAdminUrl(string.Format("content/views/functiondoc/FunctionDocumentation.aspx?functionPrefix={0}&widgets={1}", functionNamePrefix, widgets)); ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem { Url = url, EntityToken = EntityTokenSerializer.Serialize(entityToken, true), ViewId = Guid.NewGuid().ToString(), ViewType = ViewType.Main, Label = "Documentation" }, currentConsoleId); return(null); }
/// <exclude /> protected void SelectElement(EntityToken entityToken) { FlowControllerServicesContainer container = WorkflowFacade.GetFlowControllerServicesContainer(WorkflowEnvironment.WorkflowInstanceId); IManagementConsoleMessageService service = container.GetService <IManagementConsoleMessageService>(); service.SelectElement(EntityTokenSerializer.Serialize(entityToken, true)); }
/// <exclude /> protected void SelectElement(EntityToken entityToken) { var container = GetFlowControllerServicesContainer(); IManagementConsoleMessageService service = container.GetService <IManagementConsoleMessageService>(); service.SelectElement(EntityTokenSerializer.Serialize(entityToken, true)); }
protected void Page_Load(object sender, EventArgs e) { if (!UserValidationFacade.IsLoggedIn()) { Response.Redirect("/Composite/Login.aspx?ReturnUrl=" + Request.Url.PathAndQuery); return; } ScriptLoader.Render("sub"); rptCountryList.DataSource = DataFacade.GetData <Country>().Take(10) .ToArray() .Select(x => { var editLink = new EditLink() { Label = x.Name }; if (DataScopeManager.CurrentDataScope != DataScopeIdentifier.Administrated) { editLink.Link = String.Empty; return(editLink); } var teaser = x; //var editWorkflowAttribute = teaser.DataSourceId.InterfaceType.GetCustomAttributes(true).OfType<EditWorkflowAttribute>().FirstOrDefault(); //if (editWorkflowAttribute == null) //{ // editLink.Link = string.Empty; // return editLink; //} var page = PageManager.GetPageById(Guid.Parse("63ec1a73-b1ed-4ec8-923f-2840448c43ce")); var entityToken = new PageTeaserInstanceEntityToken(page, teaser); var serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true); var editActionToken = new WorkflowActionToken(typeof(EditWorkflowAttribute)); var serializedActionToken = ActionTokenSerializer.Serialize(editActionToken, true); var html = String.Format("<a href=\"#\" data-providername='{0}' data-entitytoken='{1}' data-actiontoken=\"{2}\" data-piggybag='{3}' data-piggybaghash='{4}' onclick=\"executeAction(this)\">{5}</a>", teaser.DataSourceId.ProviderName, serializedEntityToken, serializedActionToken, String.Empty, HashSigner.GetSignedHash(string.Empty).Serialize(), "edit"); editLink.Link = html; return(editLink); }); rptCountryList.DataBind(); }
private void saveCodeActivity_ExecuteCode(object sender, EventArgs e) { string[] files = GetFiles(); var fileContent = new List <string>(); for (int i = 0; i < files.Length; i++) { string bindingPrefix = GetBindingPrefix(i); fileContent.Add(this.GetBinding <string>(bindingPrefix + "Content")); } // Fixing html specific escape sequences in .master file string fixedMaster = PageTemplateHelper.FixHtmlEscapeSequences(fileContent[0]); bool viewNeedsUpdating = fileContent[0] != fixedMaster; fileContent[0] = fixedMaster; EntityToken newEntityToken; if (!CompileAndValidate(files, fileContent, out newEntityToken)) { SetSaveStatus(false); return; } for (int i = 0; i < files.Length; i++) { var websiteFile = new WebsiteFile(files[i]); websiteFile.WriteAllText(fileContent[i]); } PageTemplateProviderRegistry.FlushTemplates(); if (newEntityToken != null) { SetSaveStatus(true, newEntityToken); SerializedEntityToken = EntityTokenSerializer.Serialize(newEntityToken); } else { SetSaveStatus(true); } if (viewNeedsUpdating) { UpdateBinding(GetBindingPrefix(0) + "Content", fixedMaster); RerenderView(); } this.CreateParentTreeRefresher().PostRefreshMesseges(this.EntityToken); }
/// <exclude /> public void UpdateWithNewBindings(Dictionary <string, object> bindings, IEnumerable <string> selectedSerializedEntityTokens) { var options = _perspectiveElements.ToDictionary( perspectiveElement => EntityTokenSerializer.Serialize(perspectiveElement.ElementHandle.EntityToken), perspectiveElement => perspectiveElement.VisualData.Label); bindings[MultiKeySelectorOptionsBindingName] = options; bindings[MultiKeySelectorSelectedBindingName] = selectedSerializedEntityTokens.ToList(); }
private string GetShowFunction(EntityToken entityToken, ActionToken actionToken) { return(string.Format("VersioningReport.Show('{0}','{1}','{2}','{3}','{4}');", providerName, EntityTokenSerializer.Serialize(entityToken, true).SerializeToJs(), ActionTokenSerializer.Serialize(actionToken, true).SerializeToJs(), piggybag, piggybagHash )); }
/// <summary> /// Selects the specified element in the console, doesn't change the perspective /// </summary> /// <param name="consoleId">The console id.</param> /// <param name="entityToken">The entity token.</param> public static void SelectConsoleElementWithoutPerspectiveChange(string consoleId, EntityToken entityToken) { var serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true); var selectItem = new SelectElementQueueItem { EntityToken = serializedEntityToken, }; ConsoleMessageQueueFacade.Enqueue(selectItem, consoleId); }
/// <exclude /> public static ClientElement GetClientElement(this Element element) { if (element.VisualData.Icon == null || element.Actions.Any(a => a.VisualData?.Icon == null)) { throw new InvalidOperationException($"Unable to create ClientElement from Element with entity token '{element.ElementHandle.EntityToken.Serialize()}'. The element or one of its actions is missing an icon definition."); } string entityToken = EntityTokenSerializer.Serialize(element.ElementHandle.EntityToken, true); string piggyBag = element.ElementHandle.SerializedPiggyback; var clientElement = new ClientElement { ElementKey = $"{element.ElementHandle.ProviderName}{entityToken}{piggyBag}", ProviderName = element.ElementHandle.ProviderName, EntityToken = entityToken, Piggybag = piggyBag, PiggybagHash = HashSigner.GetSignedHash(piggyBag).Serialize(), Label = element.VisualData.Label, HasChildren = element.VisualData.HasChildren, IsDisabled = element.VisualData.IsDisabled, Icon = element.VisualData.Icon, OpenedIcon = element.VisualData.OpenedIcon, ToolTip = element.VisualData.ToolTip, Actions = element.Actions.ToClientActionList(), PropertyBag = element.PropertyBag.ToClientPropertyBag(), TagValue = element.TagValue, ContainsTaggedActions = element.Actions.Any(f => f.TagValue != null), TreeLockEnabled = element.TreeLockBehavior == TreeLockBehavior.Normal, ElementBundle = element.VisualData.ElementBundle, BundleElementName = element.VisualData.BundleElementName }; clientElement.ActionKeys = (from clientAction in clientElement.Actions select clientAction.ActionKey).ToList(); if (element.MovabilityInfo.DragType != null) { clientElement.DragType = element.MovabilityInfo.GetHashedTypeIdentifier(); } List <string> apoptables = element.MovabilityInfo.GetDropHashTypeIdentifiers(); if (apoptables != null && apoptables.Count > 0) { clientElement.DropTypeAccept = apoptables; } clientElement.DetailedDropSupported = element.MovabilityInfo.SupportsIndexedPosition; return(clientElement); }
/// <exclude /> public static string GetInlineElementActionScriptCode(EntityToken entityToken, ActionToken actionToken, Dictionary <string, string> piggyBag) { StringBuilder sb = new StringBuilder(); StringConversionServices.SerializeKeyValuePair(sb, "EntityToken", EntityTokenSerializer.Serialize(entityToken, false)); StringConversionServices.SerializeKeyValuePair(sb, "ActionToken", ActionTokenSerializer.Serialize(actionToken, true)); StringConversionServices.SerializeKeyValuePair(sb, "PiggyBag", PiggybagSerializer.Serialize(piggyBag)); string scriptAction = string.Format(@"SystemAction.invokeInlineAction(""{0}"");", Convert.ToBase64String(Encoding.UTF8.GetBytes(sb.ToString()))); return(scriptAction); }
/// <exclude /> public static FlowToken ExecuteEntityTokenLocked(ActionToken lockedActionToken, EntityToken lockedEntityToken, FlowControllerServicesContainer flowControllerServicesContainer) { EntityToken entityToken = new EntityTokenLockedEntityToken( ActionLockingFacade.LockedBy(lockedEntityToken), ActionTokenSerializer.Serialize(lockedActionToken), EntityTokenSerializer.Serialize(lockedEntityToken) ); WorkflowActionToken actionToken = new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Actions.Workflows.EntityTokenLockedWorkflow")); return(Execute(entityToken, actionToken, flowControllerServicesContainer)); }
public static IHtmlString RenderFocusLink(this HtmlHelper helper, IPageTeaser teaser, string label) { if (DataScopeManager.CurrentDataScope != DataScopeIdentifier.Administrated) { return(helper.Raw(String.Empty)); } var page = PageManager.GetPageById(teaser.PageId); var token = new PageTeaserInstanceEntityToken(page, teaser); var serializedToken = EntityTokenSerializer.Serialize(token, true); return(helper.Raw("<a href=\"#\" data-token=\"" + serializedToken + "\" onclick=\"setFocus(this)\">" + label + "</a>")); }
public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer) { string currentConsoleId = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>().CurrentConsoleId; string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken); Dictionary <string, string> viewArguments = new Dictionary <string, string>(); viewArguments.Add("serializedEntityToken", serializedEntityToken); ConsoleMessageQueueFacade.Enqueue(new OpenHandledViewMessageQueueItem(EntityTokenSerializer.Serialize(entityToken, true), "Composite.Management.PermissionEditor", viewArguments), currentConsoleId); return(null); }