forked from Sitecore/Media-Framework-Brightcove-Edition
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix bug which prevents the user from embedding media in the Siteocre RTE in certain scenarios * Add support for syncing video scheduling/status information * Reserialize content * Add some help text to the new scheduling fields --------- Co-authored-by: Cody Rodgers <[email protected]>
- Loading branch information
1 parent
bdafbd0
commit 62237d0
Showing
43 changed files
with
784 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
|
||
namespace Brightcove.Core.Models | ||
{ | ||
public class VideoSchedule | ||
{ | ||
[JsonProperty("starts_at", NullValueHandling = NullValueHandling.Ignore)] | ||
public DateTime? StartsAt { get; set; } | ||
|
||
[JsonProperty("ends_at", NullValueHandling = NullValueHandling.Ignore)] | ||
public DateTime? EndsAt { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
....DataExchangeFramework/Converters/ValueAccessor/DateTimePropertyValueAccessorConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using Brightcove.DataExchangeFramework.ValueReaders; | ||
using Brightcove.DataExchangeFramework.ValueWriters; | ||
using Sitecore.DataExchange; | ||
using Sitecore.DataExchange.Attributes; | ||
using Sitecore.DataExchange.Converters.DataAccess.ValueAccessors; | ||
using Sitecore.DataExchange.DataAccess; | ||
using Sitecore.DataExchange.DataAccess.Readers; | ||
using Sitecore.DataExchange.DataAccess.Writers; | ||
using Sitecore.DataExchange.Repositories; | ||
using Sitecore.Services.Core.Model; | ||
|
||
namespace Brightcove.DataExchangeFramework | ||
{ | ||
[SupportedIds(new string[] { "{CC5AC65C-ACAF-4D89-8811-43B2D8E8134A}" })] | ||
public class DateTimePropertyValueAccessorConverter : ValueAccessorConverter | ||
{ | ||
public const string FieldNamePropertyName = "PropertyName"; | ||
|
||
public DateTimePropertyValueAccessorConverter(IItemModelRepository repository) | ||
: base(repository) | ||
{ | ||
} | ||
|
||
protected override ConvertResult<IValueAccessor> ConvertSupportedItem( | ||
ItemModel source) | ||
{ | ||
ConvertResult<IValueAccessor> convertResult = base.ConvertSupportedItem(source); | ||
if (!convertResult.WasConverted) | ||
return convertResult; | ||
string stringValue = this.GetStringValue(source, "PropertyName"); | ||
if (string.IsNullOrWhiteSpace(stringValue)) | ||
return this.NegativeResult(source, "The property name field must have a value specified.", "field: PropertyName"); | ||
IValueAccessor convertedValue = convertResult.ConvertedValue; | ||
if (convertedValue == null) | ||
return this.NegativeResult(source, "A null value accessor was returned by the converter."); | ||
if (convertedValue.ValueReader == null) | ||
{ | ||
DateTimePropertyValueReader propertyValueReader = new DateTimePropertyValueReader(stringValue); | ||
convertedValue.ValueReader = (IValueReader)propertyValueReader; | ||
} | ||
if (convertedValue.ValueWriter == null) | ||
{ | ||
DateTimePropertyValueWriter propertyValueWriter = new DateTimePropertyValueWriter(stringValue); | ||
convertedValue.ValueWriter = (IValueWriter)propertyValueWriter; | ||
} | ||
return this.PositiveResult(convertedValue); | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
Brightcove.DataExchangeFramework/ValueReaders/DateTimePropertyValueReader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using Sitecore.DataExchange.DataAccess; | ||
using Sitecore.DataExchange.DataAccess.Readers; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Reflection; | ||
using System.Linq; | ||
using System.Web; | ||
|
||
namespace Brightcove.DataExchangeFramework.ValueReaders | ||
{ | ||
public class DateTimePropertyValueReader : ChainedPropertyValueReader | ||
{ | ||
public DateTimePropertyValueReader(string propertyName) : base(propertyName) | ||
{ | ||
} | ||
|
||
public override ReadResult Read(object source, DataAccessContext context) | ||
{ | ||
if (context == null) | ||
throw new ArgumentNullException(nameof(context)); | ||
|
||
var result = base.Read(source, context); | ||
|
||
bool wasValueRead = result.WasValueRead; | ||
object obj = result.ReadValue; | ||
|
||
if(obj == null || !(obj is DateTime)) | ||
{ | ||
obj = ""; | ||
wasValueRead = true; | ||
} | ||
else | ||
{ | ||
obj = ((DateTime)obj).ToString("yyyyMMddTHHmmss\\Z"); | ||
} | ||
|
||
return new ReadResult(DateTime.UtcNow) | ||
{ | ||
WasValueRead = wasValueRead, | ||
ReadValue = obj | ||
}; | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
Brightcove.DataExchangeFramework/ValueWriters/DateTimePropertyValueWriter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Sitecore.DataExchange.DataAccess; | ||
using System; | ||
using System.Globalization; | ||
|
||
namespace Brightcove.DataExchangeFramework.ValueWriters | ||
{ | ||
public class DateTimePropertyValueWriter : ChainedPropertyValueWriter | ||
{ | ||
public DateTimePropertyValueWriter(string propertyName) : base(propertyName) | ||
{ | ||
|
||
} | ||
|
||
public override bool Write(object target, object value, DataAccessContext context) | ||
{ | ||
DateTime? returnValue = null; | ||
|
||
try | ||
{ | ||
if ((value is string) && !string.IsNullOrWhiteSpace((string)value)) | ||
{ | ||
string sourceValue = (string)value; | ||
DateTime tmp; | ||
|
||
if (DateTime.TryParseExact(sourceValue, new string[2] { "yyyyMMddTHHmmss", "yyyyMMddTHHmmss\\Z" }, (IFormatProvider)CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out tmp)) | ||
{ | ||
returnValue = tmp; | ||
} | ||
} | ||
} | ||
catch | ||
{ | ||
returnValue = null; | ||
} | ||
|
||
return base.Write(target, returnValue, context); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,4 @@ | |
|
||
<div class="brightcove-media-rendering-container"> | ||
@Html.Raw(Model.Markup) | ||
@Html.Raw(Model.ScriptTag) | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...rk.Framework.Branches/9f623c7f-51f5-4091-8645-daad69627e67/Schedule_StartsAt Property.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
ID: "e6d6979d-50c4-4904-a82f-970b9abfbbda" | ||
Parent: "9f623c7f-51f5-4091-8645-daad69627e67" | ||
Template: "cc5ac65c-acaf-4d89-8811-43b2d8e8134a" | ||
Path: /sitecore/templates/Branches/Data Exchange/Framework/Branches/Brightcove Tenant/$name/Data Access/Value Accessor Sets/Providers/Brightcove/Video Model Properties/Schedule_StartsAt Property | ||
DB: master | ||
SharedFields: | ||
- ID: "bbcf1be5-5f6b-4e21-9c8e-00e12aa2f042" | ||
Hint: PropertyName | ||
Value: Schedule.StartsAt | ||
Languages: | ||
- Language: en | ||
Versions: | ||
- Version: 1 | ||
Fields: | ||
- ID: "25bed78c-4957-4165-998a-ca1b52f67497" | ||
Hint: __Created | ||
Value: 20231115T163646Z | ||
- ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f" | ||
Hint: __Created by | ||
Value: | | ||
sitecore\Admin |
18 changes: 18 additions & 0 deletions
18
...ss/Value Accessor Sets/Providers/Brightcove/Video Model Properties/ItemState Property.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
ID: "a9578900-8b33-4ac4-9edd-8f3d0942b967" | ||
Parent: "9f623c7f-51f5-4091-8645-daad69627e67" | ||
Template: "729aeffb-b5bd-4cd4-958f-e25b50948ac8" | ||
Path: /sitecore/templates/Branches/Data Exchange/Framework/Branches/Brightcove Tenant/$name/Data Access/Value Accessor Sets/Providers/Brightcove/Video Model Properties/ItemState Property | ||
DB: master | ||
SharedFields: | ||
- ID: "06fd1c3e-a7f7-4cd2-a54e-a995d7a9e4de" | ||
Hint: PropertyName | ||
Value: ItemState | ||
Languages: | ||
- Language: en | ||
Versions: | ||
- Version: 1 | ||
Fields: | ||
- ID: "25bed78c-4957-4165-998a-ca1b52f67497" | ||
Hint: __Created | ||
Value: 20231115T142712Z |
22 changes: 22 additions & 0 deletions
22
...ue Accessor Sets/Providers/Brightcove/Video Model Properties/Schedule_EndsAt Property.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
ID: "95f41ff7-7660-478f-9a25-dc576db83c81" | ||
Parent: "9f623c7f-51f5-4091-8645-daad69627e67" | ||
Template: "cc5ac65c-acaf-4d89-8811-43b2d8e8134a" | ||
Path: /sitecore/templates/Branches/Data Exchange/Framework/Branches/Brightcove Tenant/$name/Data Access/Value Accessor Sets/Providers/Brightcove/Video Model Properties/Schedule_EndsAt Property | ||
DB: master | ||
SharedFields: | ||
- ID: "bbcf1be5-5f6b-4e21-9c8e-00e12aa2f042" | ||
Hint: PropertyName | ||
Value: Schedule.EndsAt | ||
Languages: | ||
- Language: en | ||
Versions: | ||
- Version: 1 | ||
Fields: | ||
- ID: "25bed78c-4957-4165-998a-ca1b52f67497" | ||
Hint: __Created | ||
Value: 20231115T163711Z | ||
- ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f" | ||
Hint: __Created by | ||
Value: | | ||
sitecore\Admin |
Oops, something went wrong.