Skip to content

Commit

Permalink
Initial code
Browse files Browse the repository at this point in the history
  • Loading branch information
sc-YevhenPovzlo committed Dec 15, 2020
1 parent ded7905 commit 164398a
Show file tree
Hide file tree
Showing 8 changed files with 331 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
root = true

[*.{cs,sln,csproj,config,xml}]
indent_size = 4
indent_style = space
22 changes: 22 additions & 0 deletions src/Sitecore.Support.430451.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{B2C04B42-19BB-4F74-AC3F-9AA8951F9142}") = "Sitecore.Support.430451", "Sitecore.Support.430451\Sitecore.Support.430451.csproj", "{A01DCA8E-339C-4462-872F-991715429EFC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A01DCA8E-339C-4462-872F-991715429EFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A01DCA8E-339C-4462-872F-991715429EFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A01DCA8E-339C-4462-872F-991715429EFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A01DCA8E-339C-4462-872F-991715429EFC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore role:require="Standalone OR ContentManagement OR ContentDelivery OR Processing OR Reporting">
</sitecore>
</configuration>
6 changes: 6 additions & 0 deletions src/Sitecore.Support.430451/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("Sitecore.Support.430451")]
[assembly: AssemblyProduct("Sitecore.Support.430451")]
[assembly: ComVisible(false)]
170 changes: 170 additions & 0 deletions src/Sitecore.Support.430451/Rendering.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
namespace Sitecore.XA.Foundation.Mvc.Wrappers
{
using Sitecore.Data;
using Sitecore.Data.Items;
using Sitecore.Mvc.Presentation;
using Sitecore.XA.Foundation.Mvc;
using Sitecore.XA.Foundation.Mvc.Wrappers;
using Sitecore.XA.Foundation.Presentation.Services;
using Sitecore.XA.Foundation.SitecoreExtensions.Interfaces;

public class Rendering : IRendering
{
private Parameters _parameters;

private readonly Sitecore.Mvc.Presentation.Rendering _sitecoreRendering;

public RenderingProperties Properties => _sitecoreRendering.Properties;

public Item Item
{
get
{
Item item = DataSourceItem;
if (item == null)
{
RenderingModel obj = _sitecoreRendering.Model as RenderingModel;
if (obj == null)
{
return null;
}
item = obj.PageItem;
}
return item;
}
}

public Item DataSourceItem
{
get
{
if (!string.IsNullOrEmpty(_sitecoreRendering.DataSource))
{
return _sitecoreRendering.Item;
}
return PlaceholderDatasourceContext.CurrentOrNull?.ContextItem;
}
}

public string DataSource => _sitecoreRendering.DataSource;

public virtual IParameters Parameters => _parameters ?? (_parameters = new Parameters(_sitecoreRendering.Parameters));

public string Name
{
get
{
if (_sitecoreRendering?.RenderingItem != null)
{
return _sitecoreRendering.RenderingItem.Name;
}
return string.Empty;
}
}

public ID SnippetId
{
get
{
string id = _sitecoreRendering.Properties["sid"];
if (ID.IsID(id))
{
return new ID(id);
}
return null;
}
}

public ID UniqueId
{
get
{
string id = Properties["uid"];
if (ID.IsID(id))
{
return new ID(id);
}
return null;
}
}

public string UniqueIdString
{
get
{
if (!(UniqueId == (ID)null))
{
return UniqueId.ToString();
}
return string.Empty;
}
}

public bool IsFromSnippet => !ID.IsNullOrEmpty(SnippetId);

public string OriginalDataSource => Properties["ods"];

public ID RenderingId
{
get
{
string id = Properties["id"];
if (ID.IsID(id))
{
return new ID(id);
}
return null;
}
}

public string RenderingCssClass
{
get
{
string text = _sitecoreRendering.RenderingItem.InnerItem[Templates.ExtendedOptions.Fields.RenderingCssClass];
if (!string.IsNullOrWhiteSpace(text))
{
return text;
}
return null;
}
}

public string RenderingViewPath
{
get
{
string text = _sitecoreRendering.RenderingItem.InnerItem[Templates.ExtendedOptions.Fields.RenderingViewPath];
if (!string.IsNullOrWhiteSpace(text))
{
return text;
}
return null;
}
}

public string ControllerType
{
get
{
string text = _sitecoreRendering.RenderingItem.InnerItem[Templates.ControllerRendering.Fields.Controller];
if (string.IsNullOrWhiteSpace(text))
{
return null;
}
return text;
}
}

public Rendering()
{
RenderingContext currentOrNull = RenderingContext.CurrentOrNull;
_sitecoreRendering = ((currentOrNull != null) ? currentOrNull.Rendering : new Sitecore.Mvc.Presentation.Rendering());
}

public Rendering(Sitecore.Mvc.Presentation.Rendering sitecoreRendering)
{
_sitecoreRendering = sitecoreRendering;
}
}
}
111 changes: 111 additions & 0 deletions src/Sitecore.Support.430451/Sitecore.Support.430451.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A01DCA8E-339C-4462-872F-991715429EFC}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sitecore.Support</RootNamespace>
<AssemblyName>Sitecore.Support.430451</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<TargetFrameworkProfile />
<LangVersion>6</LangVersion>
<Use64BitIISExpress />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Sitecore.Kernel">
<HintPath>..\packages\SC.Sitecore.Kernel.9.0.2\lib\Sitecore.Kernel.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Sitecore.Mvc, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SC.Sitecore.Mvc.9.0.2\lib\Sitecore.Mvc.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Sitecore.XA.Foundation.Common">
<HintPath>..\packages\SXA90.Sitecore.XA.Foundation.Common.1.8.0\lib\Sitecore.XA.Foundation.Common.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Sitecore.XA.Foundation.Mvc, Version=3.8.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SXA90.Sitecore.XA.Foundation.Mvc.1.8.0\lib\Sitecore.XA.Foundation.Mvc.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Sitecore.XA.Foundation.Presentation, Version=3.8.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SXA90.Sitecore.XA.Foundation.Presentation.1.8.0\lib\Sitecore.XA.Foundation.Presentation.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Sitecore.XA.Foundation.SitecoreExtensions, Version=3.8.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SXA90.Sitecore.XA.Foundation.SitecoreExtensions.1.8.0\lib\Sitecore.XA.Foundation.SitecoreExtensions.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Rendering.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="App_Config\Include\zzz\Sitecore.Support.430451.config" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="web.config" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>0</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:56279/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
9 changes: 9 additions & 0 deletions src/Sitecore.Support.430451/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SC.Sitecore.Kernel" version="9.0.2" targetFramework="net462" />
<package id="SC.Sitecore.Mvc" version="9.0.2" targetFramework="net462" />
<package id="SXA90.Sitecore.XA.Foundation.Common" version="1.8.0" targetFramework="net462" />
<package id="SXA90.Sitecore.XA.Foundation.Mvc" version="1.8.0" targetFramework="net462" />
<package id="SXA90.Sitecore.XA.Foundation.Presentation" version="1.8.0" targetFramework="net462" />
<package id="SXA90.Sitecore.XA.Foundation.SitecoreExtensions" version="1.8.0" targetFramework="net462" />
</packages>
4 changes: 4 additions & 0 deletions src/Sitecore.Support.430451/web.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- Do not change this file - it must be empty, see https://github.com/SitecoreSupport/PatchCreator/issues/13 -->
</configuration>

0 comments on commit 164398a

Please sign in to comment.