Tuesday, March 14, 2017

Sitecore Experiences -Unlock Items

Contents

1   Introduction

This utility will provide option to unlock any item, in such cases items get locked by other editorial team and may need to work by other team, they can use this utility to unlock this item.


Message will looks like




1.1  Purpose of document

Provide the facility and custom menu option to editor to unlock any items. This will create new version in the system for the auditing purpose.

2   Sitecore Customization

2.1     Unlock Item Functionality.


In this customization, there would be a new Menu in the ribbon bar, If Unlock item will be clicked, Current locked item will be unlocked.

2.2     Unlock Item Functionality – How to implement/Extend.

Unlock item if that locked by someone else.

2.2.1              Create Ribbon- Login and go to Core DB window.

 




2.2.2              Add new Ribbon Item from Reference Template.

 Go to path: - /sitecore/content/Applications/Content Editor/Ribbons/Ribbons
Right click and define new ribbon


Select Template
Template Path: - /sitecore/templates/System/Reference -


2.2.3 Add reference items/Ribbon-Strips



Path for template:- /sitecore/templates/System/Ribbon/Strip


Add reference item:-

2.2.2 Define Chunk Item and add reference

Template path: - /sitecore/templates/System/Ribbon/Chunk

2.2.5              Add Button to Ribbon

Path: - /sitecore/templates/System/Ribbon/Large Button

Add chunk button reference to strip

Add strip referent to ribbon

2.2.6              Define command for button and configuration

2.2.7              Finally, add this new ribbon to Master/Editorial Window



2.2.8             Sample Configuration and code file





Sample Code for configuration of command file"-


using System;
using Sitecore;
using Siteco.reDiagnostics;
using Sitecore.Shell.Framework.Commands;

namespace sf.web.Custom.UnLock
{
    public class UnLock : Comma
nd

 
{
 

      public override void Execute(CommandContext context)
        {
            try
            {
                var item = context.Items[0];
                if (item == null) return;
                    item.Editing.BeginEdit();
                    item.Locking.Unlock();
                    item.Editing.EndEdit();
                    Context.ClientPage.SendMessage(this, "item:checkedin");
                    Context.ClientPage.ClientResponse.Alert(item.Name + " has been Checkin completed!");
            }
            catch (Exception ex)
            {
             Context.ClientPage.ClientResponse.Alert("error in checkein completed!");
             Log.Error("Unlock - Error occured"  , ex);
            }
        }  
    }
}

Ref document :-

No comments:

Post a Comment