Skip to content

Commit

Permalink
Value mapping gutter
Browse files Browse the repository at this point in the history
  • Loading branch information
DK\vls committed Jul 31, 2017
1 parent a187339 commit f8de4cb
Show file tree
Hide file tree
Showing 10 changed files with 205 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,8 @@
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain



# Do not adjust line endings on Sitecore .item files
*.item -text
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
<command name="dataExchange:pipelineBatchContextMenu" type="Sitecore.DataExchange.Gutters.Commands.PipelineBatchContextMenuCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:cleanPipelineBatchSummary" type="Sitecore.DataExchange.Gutters.Commands.CleanPipelineBatchSummaryCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:displayPipelineSteps" type="Sitecore.DataExchange.Gutters.Commands.DisplayPipelineStepsCommand, Sitecore.DataExchange.Gutters" />

<command name="dataExchange:valueMappingContextMenu" type="Sitecore.DataExchange.Gutters.Commands.ValueMappingContextMenuCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:referenceMenu" type="Sitecore.DataExchange.Gutters.Commands.ReferenceMenuCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:goToReference" type="Sitecore.DataExchange.Gutters.Commands.GoToReferenceCommand, Sitecore.DataExchange.Gutters" />

<command name="dataExchange:pipelineStepContextMenu" type="Sitecore.DataExchange.Gutters.Commands.PipelineStepContextMenuCommand, Sitecore.DataExchange.Gutters" />
<command name="dataExchange:displayRequired" type="Sitecore.DataExchange.Gutters.Commands.DisplayRequiredCommand, Sitecore.DataExchange.Gutters" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public override void Execute(CommandContext context)
item["{985BA535-0F3E-4DA8-A768-A469026DE9DB}"] = string.Empty;
item["{6A2B2CBB-4338-4814-A8A9-9FECBB90456A}"] = string.Empty;
item["{47F8050D-6EEE-423F-A9F0-3DC34948C365}"] = string.Empty;
item["{83E6292F-A00E-463D-A1C6-0FC25BC0FBAD}"] = string.Empty;
item["{2AA5C591-FF55-411D-96C0-978BB2C58B94}"] = string.Empty;
}
}
}
Expand Down
21 changes: 21 additions & 0 deletions Sitecore.DataExchange.Gutters/Commands/GoToReferenceCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace Sitecore.DataExchange.Gutters.Commands
{
using System;
using Shell.Framework.Commands;

[Serializable]
public class GoToReferenceCommand : Command
{
public override void Execute(CommandContext context)
{
var item = context.Items[0];
string id = context.Parameters["id"];

//Sitecore.Context.ClientPage.ClientResponse.Timer(string.Format("item:load(id={0})", id), 100);
Sitecore.Text.UrlString parameters = new Sitecore.Text.UrlString();
parameters.Add("id", id);
parameters.Add("fo", id);
Sitecore.Shell.Framework.Windows.RunApplication("Content Editor", parameters.ToString());
}
}
}
35 changes: 35 additions & 0 deletions Sitecore.DataExchange.Gutters/Commands/ReferenceMenuCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
namespace Sitecore.DataExchange.Gutters.Commands
{
using System;
using Shell.Framework.Commands;
using Web.UI.HtmlControls;
using Web.UI.Sheer;

[Serializable]
public class ReferenceMenuCommand : Command
{
public override void Execute(CommandContext context)
{
var item = context.Items[0];
string fieldName = context.Parameters["fieldName"];

Sitecore.Data.Fields.MultilistField multilistField =
(Sitecore.Data.Fields.MultilistField) item.Fields[fieldName];

var targetIDs = multilistField.TargetIDs;

Menu menu = new Menu();
SheerResponse.DisableOutput();

foreach (var targetID in targetIDs)
{
var item1 = item.Database.GetItem(targetID);

menu.Add(item1.DisplayName, "Office/32x32/radio_button_selected.png",
string.Concat(new object[] { "dataExchange:goToReference(id=", targetID, ")" }));
}
SheerResponse.EnableOutput();
SheerResponse.ShowContextMenu(Sitecore.Context.ClientPage.ClientRequest.Control, "right", menu);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace Sitecore.DataExchange.Gutters.Commands
{
using System;
using Shell.Framework.Commands;
using Sitecore.Diagnostics;
using Web.UI.HtmlControls;
using Web.UI.Sheer;

[Serializable]
public class ValueMappingContextMenuCommand : Command
{
public override void Execute(CommandContext context)
{
Assert.ArgumentNotNull(context, nameof(context));

Menu menu = new Menu();
SheerResponse.DisableOutput();
menu.Add("Source Accessor", "Office/32x32/radio_button_selected.png", string.Concat(new object[] { "dataExchange:referenceMenu(fieldName=", "SourceAccessor", ")" }));
menu.Add("Target Accessor", "Office/32x32/radio_button_selected.png", string.Concat(new object[] { "dataExchange:referenceMenu(fieldName=", "TargetAccessor", ")" }));
menu.Add("Source Pre Transformer", "Office/32x32/graph_from.png", string.Concat(new object[] { "dataExchange:referenceMenu(fieldName=", "SourceValuePreTransformer", ")" }));
menu.Add("Source Transformer", "Office/32x32/graph_from.png", string.Concat(new object[] { "dataExchange:referenceMenu(fieldName=", "SourceValueTransformer", ")" }));

SheerResponse.EnableOutput();
SheerResponse.ShowContextMenu(Sitecore.Context.ClientPage.ClientRequest.Control, "right", menu);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sitecore.DataExchange.Gutters</RootNamespace>
<AssemblyName>Sitecore.DataExchange.Gutters</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -53,13 +54,17 @@
<Compile Include="Commands\DisplayPipelineStepsCommand.cs" />
<Compile Include="Commands\DisplayRequiredCommand.cs" />
<Compile Include="Commands\EnableItemCommand.cs" />
<Compile Include="Commands\GoToReferenceCommand.cs" />
<Compile Include="Commands\PipelineStepContextMenuCommand.cs" />
<Compile Include="Commands\ReferenceMenuCommand.cs" />
<Compile Include="Commands\ShowEnableCommand.cs" />
<Compile Include="Commands\PipelineBatchContextMenuCommand.cs" />
<Compile Include="Commands\ValueMappingContextMenuCommand.cs" />
<Compile Include="ItemDisabledGutter.cs" />
<Compile Include="PipelineBatchGutter.cs" />
<Compile Include="PipelineStepGutter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ValueMappingGutter.cs" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
Expand Down
26 changes: 26 additions & 0 deletions Sitecore.DataExchange.Gutters/ValueMappingGutter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace Sitecore.DataExchange.Gutters
{
using Data;
using Data.Items;
using Data.Managers;
using Shell.Applications.ContentEditor.Gutters;
using Sitecore.Diagnostics;

public class ValueMappingGutter : GutterRenderer
{
protected readonly ID ValueMappingTemplateId = new ID("{450C8F38-91C9-4896-957B-6F7DAF18CCFC}");


protected override GutterIconDescriptor GetIconDescriptor(Item item)
{
Assert.ArgumentNotNull(item, nameof(item));
if (item.TemplateID == this.ValueMappingTemplateId)
{
var gutterIconDescriptor = new GutterIconDescriptor() { Icon = TemplateManager.GetTemplate(item).Icon, Tooltip = item.DisplayName };
gutterIconDescriptor.Click = "dataExchange:valueMappingContextMenu()";
return gutterIconDescriptor;
}
return null;
}
}
}
9 changes: 7 additions & 2 deletions TDS.core/TDS.core.scproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand Down Expand Up @@ -74,6 +75,10 @@
<ItemDeployment>DeployOnce</ItemDeployment>
<ChildItemSynchronization>NoChildSynchronization</ChildItemSynchronization>
</SitecoreItem>
<SitecoreItem Include="sitecore\content\Applications\Content Editor\Gutters\DataExchange - Value Mapping.item">
<ItemDeployment>DeployOnce</ItemDeployment>
<ChildItemSynchronization>NoChildSynchronization</ChildItemSynchronization>
</SitecoreItem>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\HedgehogDevelopment\SitecoreProject\v9.0\HedgehogDevelopment.SitecoreProject.targets" />
<Import Project="$(MSBuildExtensionsPath)\HedgehogDevelopment\SitecoreProject\v9.0\HedgehogDevelopment.SitecoreProject.targets" Condition="Exists('$(MSBuildExtensionsPath)\HedgehogDevelopment\SitecoreProject\v9.0\HedgehogDevelopment.SitecoreProject.targets')" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
----item----
version: 1
id: {AB2C6026-635C-419A-AC2C-204D1A4F03D1}
database: core
path: /sitecore/content/Applications/Content Editor/Gutters/DataExchange - Value Mapping
parent: {59F37069-3118-4151-8C01-5DA0EF12CB4E}
name: DataExchange - Value Mapping
master: {00000000-0000-0000-0000-000000000000}
template: {F5D247E0-80E6-4F31-9921-D30D00B61B3C}
templatekey: Gutter Renderer
created: 20170731T113243Z

----field----
field: {7A108204-DC61-4D25-A138-FD6F53F48ABF}
name: Type
key: type
content-length: 78

Sitecore.DataExchange.Gutters.ValueMappingGutter,Sitecore.DataExchange.Gutters
----version----
language: en
version: 1
revision: c571d857-124a-4487-8f39-fea50a68667b

----field----
field: {5024402F-0B92-4C13-A7D2-86ED85FF3560}
name: Header
key: header
content-length: 29

Data Exchange - Value Mapping
----field----
field: {52807595-0F8F-4B20-8D2A-CB71D28C6103}
name: __Owner
key: __owner
content-length: 14

sitecore\admin
----field----
field: {25BED78C-4957-4165-998A-CA1B52F67497}
name: __Created
key: __created
content-length: 16

20170119T082920Z
----field----
field: {5DD74568-4D4B-44C1-B513-0AF5F4CDA34F}
name: __Created by
key: __created by
content-length: 14

sitecore\admin
----field----
field: {8CDC337E-A112-42FB-BBB4-4143751E123F}
name: __Revision
key: __revision
content-length: 36

c571d857-124a-4487-8f39-fea50a68667b
----field----
field: {D9CF14B1-FA16-4BA6-9288-E8A174D4D522}
name: __Updated
key: __updated
content-length: 16

20170731T113340Z
----field----
field: {BADD9CF9-53E0-4D0C-BCC0-2D784C282F6A}
name: __Updated by
key: __updated by
content-length: 14

sitecore\admin

0 comments on commit f8de4cb

Please sign in to comment.