Skip to content

Commit

Permalink
Updated the documentation and the release notes for v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Fischer committed Mar 19, 2019
1 parent 5d610c0 commit c1dc8c6
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 48 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ There are [many features which come with NitroNet](https://github.com/namics/Nit
## Future roadmap
[Please look at the milestones regarding the features and time frames of future releases.](https://github.com/namics/NitroNetSitecore/milestones)

**Important features planned for 2018:**
- SC9 compatibility
**Important features planned in the near future:**
- [Possibility to exclude certain Sitecore renderings](https://github.com/namics/NitroNetSitecore/pull/25)
- [Better error message when there are renderings with identical name](https://github.com/namics/NitroNetSitecore/issues/24)
- Youtube tutorial videos
- Demo solution/integration -> [here](https://github.com/hombreDelPez/NitroNet-Demo-Integration-Habitat/tree/feature/nitronet-sitecore-demo) (almost done)
- Extending the documentation

## Contact / Contributing
If you want to submit a bug or request a feature please feel free to open an issue.
Expand Down
23 changes: 22 additions & 1 deletion docs/releases/2.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,27 @@

### Update/Installation Instructions

#### Migrate Dynamic Plaeholders
#### Migrate from a Sitecore 8.1 or 8.2 NuGet

1) If you are using a Sitecore 9 NitroNet.Sitecore NuGet then there is nothing to do for you. But if you are currently using a Sitecore 8.1 or 8.2 NitroNet.Sitecore NuGet you first have to become aware of all Visual Studio projects on which the NitroNet.Sitecore NuGet has been installed and write this information down.

- When using Microsoft DI, Unity or CastleWindsor you have to look for the following packages:
- NitroNet.Sitecore.Microsoft.DependencyInjection.Sitecore82
- NitroNet.Sitecore.UnityModules.Sitecore8x
- NitroNet.Sitecore.CastleWindsorModules.Sitecore8x
- When using another IoC framework you have to look for the following package:
- NitroNet.Sitecore.Sitecore8x

2) Uninstall these packages in all Visual Studio projects

3) Install the following new NuGet package in your selected Visual Studio projects:

- When using MS DI:
- `PM >` `Install-Package NitroNet.Sitecore.Microsoft.DependencyInjection.Sitecore90`
- When using another IoC framework:
- `PM >` `Install-Package NitroNet.Sitecore.Sitecore90`

#### Migrate Dynamic Placeholders

Sitecore 9 introduced the dynamic placeholder feature. Please follow the [official documentation](https://doc.sitecore.net/sitecore_experience_platform/developing/developing_with_sitecore/dynamic_placeholders) for more information about when and how to use it. NitroNet for Sitecore uses the new native dynamic placeholders starting with version 2.0. This means if you used NitroNet for Sitecore 1.x in combination with Sitecore 8.x and are upgrading to Sitecore 9 then you need to migrate all existing placeholder keys to the new format.

Expand All @@ -34,6 +54,7 @@ This pattern needs to be migrated to the new format: *mykey-{88498EE8-6DAE-470E-
Instructions:

- Add admin page [MigrateDynamicPlaceholders.aspx](https://github.com/namics/NitroNetSitecore/tree/master/docs/releases/utils/MigrateDynamicPlaceholders.aspx) to your solution in folder /sitecore/admin
- Change the setting *Query.MaxItems* to a high value which should be higher than the amount of page items you need to migrate (e.g. 10000)
- Run /sitecore/admin/MigrateDynamicPlaceholders.aspx in your browser. You should first run this script on a single test page and check if the migration works as intended. There are the following GET parameters you can use to migrate the right content.
- database: Sitecore database. Default value: master
- itemId: The dynamic placeholder migration is only processed on this start item. Example: {456B38B8-1C42-48AF-858E-FC58A2FC1491}
Expand Down
110 changes: 67 additions & 43 deletions docs/releases/utils/MigrateDynamicPlaceholders.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@

<script language="C#" runat="server">
/// <summary>
/// GET Parameters
///
/// database: The Sitecore database. Example: web
///
/// itemId: The dynamic placeholder migration is only processed on this start item. Example: {456B38B8-1C42-48AF-858E-FC58A2FC1491}
///
/// enableRecursion: This option enables recursion for the start item. Example: true
/// </summary>
/// <summary>
/// This script migrates the "old" dynamic placeholder format to the new format used in Sitecore 9.
///
/// GET Parameters
/// - database: The Sitecore database the script should run on. Example: master
/// - itemId: The dynamic placeholder migration is only processed on this start item. Example: {456B38B8-1C42-48AF-858E-FC58A2FC1491}
/// - enableRecursion: This option enables recursion for the start item. Example: true
/// - allVersions: This option enables the migration of all versions of an item. Example: true
/// </summary>
protected void Page_Load(object sender, EventArgs e)
{
Expand Down Expand Up @@ -62,14 +62,16 @@
return;
}
bool isRecursionEnabled;
bool.TryParse(Context.Request.QueryString["enableRecursion"], out isRecursionEnabled);
bool isRecursionEnabled;
bool migrateAllVersions;
bool.TryParse(Context.Request.QueryString["enableRecursion"], out isRecursionEnabled);
bool.TryParse(Context.Request.QueryString["allVersions"], out migrateAllVersions);
var fixRenderings = new UpgradeDynamicPlaceholderHelper(database);
Sitecore.Diagnostics.Log.Info("Dynamic Placeholder Migration: Started", this);
var result = fixRenderings.Iterate(startItem, isRecursionEnabled);
var result = fixRenderings.Iterate(startItem, isRecursionEnabled, migrateAllVersions);
OutputResult(result);
Expand Down Expand Up @@ -108,66 +110,88 @@
_database = database;
}
public Dictionary<Item, List<KeyValuePair<string, string>>> Iterate(Item startItem, bool isRecursionEnabled)
public Dictionary<Item, List<KeyValuePair<string, string>>> Iterate(Item startItem, bool isRecursionEnabled, bool migrateAllVersions)
{
var result = new Dictionary<Item, List<KeyValuePair<string, string>>>();
var items = new List<Item>();
if (startItem != null)
{
items.Add(startItem);
if (isRecursionEnabled)
{
items.AddRange(_database.SelectItems(string.Format(ItemsWithPresentationDetailsQuery, startItem.Paths.FullPath)));
}
else
{
items.Add(startItem);
}
}
else
{
items.AddRange(_database.SelectItems(string.Format(ItemsWithPresentationDetailsQuery, "/sitecore/content")));
}
var layoutFieldIds = new[] {FieldIDs.LayoutField, FieldIDs.FinalLayoutField};
foreach (var itemInDefaultLanguage in items)
{
foreach (var itemLanguage in itemInDefaultLanguage.Languages)
{
var item = itemInDefaultLanguage.Database.GetItem(itemInDefaultLanguage.ID, itemLanguage);
if (item.Versions.Count > 0)
{
foreach (var layoutFieldId in layoutFieldIds)
{
var layoutField = item.Fields[layoutFieldId];
ChangeLayout(result, item, FieldIDs.LayoutField, false);
ChangeLayout(result, item, FieldIDs.FinalLayoutField, true);
}
}
}
// Don't convert standard values!
if (layoutField.ContainsStandardValue)
{
continue;
}
return result;
}
var changeResult = ChangeLayoutFieldForItem(item, layoutField);
private void ChangeLayout(Dictionary<Item, List<KeyValuePair<string, string>>> result, Item item, ID layoutFieldId, bool migrateAllVersions)
{
if (migrateAllVersions)
{
var versionCount = item.Versions.GetVersionNumbers().Length;
var versions = item.Versions.GetVersions(false);
if (changeResult.Any())
{
if (!result.ContainsKey(item))
{
result.Add(item, changeResult);
}
else
{
result[item].AddRange(changeResult);
}
}
}
}
if (versions.Length != versionCount)
{
Sitecore.Diagnostics.Log.Warn(string.Format("MigrateDynamicPlaceholders: {0} - Could not load all item versions", item.Name), this);
}
foreach (var itemVersion in versions)
{
ChangeLayoutInternal(result, itemVersion, layoutFieldId);
}
}
else
{
ChangeLayoutInternal(result, item, layoutFieldId);
}
}
return result;
private void ChangeLayoutInternal(Dictionary<Item, List<KeyValuePair<string, string>>> result, Item item, ID layoutFieldId)
{
var layoutField = item.Fields[layoutFieldId];
// Don't convert standard values!
if (layoutField.ContainsStandardValue)
{
return;
}
var changeResult = ChangeLayoutFieldForItem(item, layoutField);
if (changeResult.Any())
{
if (!result.ContainsKey(item))
{
result.Add(item, changeResult);
}
else
{
result[item].AddRange(changeResult);
}
}
}
private List<KeyValuePair<string, string>> ChangeLayoutFieldForItem(Item currentItem, Field field)
Expand All @@ -181,7 +205,7 @@
var details = LayoutDefinition.Parse(xml);
var device = details.GetDevice(DefaultDeviceId);
if (device != null && device.Renderings != null)
{
bool requiresUpdate = false;
Expand Down

0 comments on commit c1dc8c6

Please sign in to comment.