Tuesday 18 June 2019

Creating an Admin Menu Item On Launch Pad




If you are building a Sitecore admin application, you are going to need to link to them from the Sitecore start screen/launch pad.

To create a menu item on the Sitecore start screen:
  • Log into Sitecore and switch to the core DB.
  • Open content editor and navigate to /Sitecore/client/Applications/LaunchPad/PageSettings/Buttons
  • You will see groupings for each of the sections that appear on the start screen/Launchpad.
  • Add a new LaunchPad Group using  "/sitecore/client/Applications/Launchpad/PageSettings/Templates/LaunchPad-Group" Template and given Title is "Admin Section" as see the below screenshot.

  • Add a new Launch Pad-Button item to the "Admin Section" section you want it to appear in.
  • Give it a name, icon and link.

  • Your button now appears on the start screen

  • Now you can click on "Show Config" button and show the config file.

Saturday 15 June 2019

Check SiteCore Items has ALIASES or Not using GutterRender


Aliases to set up shortened URLs for publicity purposes, but they were finding it difficult to manage the large number of aliases they were creating. Their key issues were remembering which pages had aliases defined, and remembering to delete aliases when they removed the pages they were related to.


Sitecore provides a helpful dialogue for managing aliases, in the Presentation ribbon tab:




Custom gutter renderings are classes based on the "Sitecore.Shell.Applications.ContentEditor.Gutters.GutterRenderer" class. All you have to provide is an implementation for the GetIconDescriptor() method:

namespace SitecoreMaster.Models
{
    public class AliasGutterRenderer: GutterRenderer
    {
        private static Sitecore.Data.ID aliasID = new Sitecore.Data.ID("{54BCFFB7-8F46-4948-AE74-DA5B6B5AFA86}");

        protected override GutterIconDescriptor GetIconDescriptor(Sitecore.Data.Items.Item item)
        {
            GutterIconDescriptor gid = null;
            int aliases = 0;

            try
            {
                aliases = Sitecore.Globals.LinkDatabase.GetReferrers(item)
                    .Select(l => l.GetSourceItem())
                    .Where(s => s.TemplateID == aliasID)
                    .Count();

                if (aliases > 0)
                {
                    gid = new GutterIconDescriptor();
                    gid.Icon = "Network/32x32/spy.png";
                    gid.Tooltip = string.Format("This item has {0} alias{1}", aliases, aliases > 1 ? "es" : "");
                    gid.Click = "item:setaliases(id=" + item.ID + ")";
                }

            }
            catch (Exception exception)
            {
                // this should always succeed - exceptions seem to come
                // if link database is out of date
                // In production code, we'd do something cleverer than
                // this and try to prevent rather than catch the exception

                throw exception;
            }
            
            return gid;
        }
    }
}

If we want to visualise Aliases, we need to write some sort of query to detect if the current item has any Aliases attached to it. There are a couple of ways you can go about this. One way would be to write a query for children of the /Sitecore/system/Aliases item and look for references to the current item’s ID in the Linked Item field. But Sitecore can make our life easier than this – since it maintains something called the Link Database for us. Inside the Sitecore database, it maintains references between items. Whenever you fill in a field which stores a link between two or more items this relationship is stored in the Link Database to make it easy to query these relationships later. You can see this data yourself when you click the Links button in the Navigate tab of the ribbon:


You’ll notice that this example page has lots of links in the database table – it references things like templates, sublayouts etc. But it also shows that it is referred to by an Alias item. And that shows us that we can use the Links Database to do the query we need.


Now, what do we need to do to make this custom gutter rendering available for users? The data for configuring the Content Editor UI lives in the Core database, under /sitecore/content/Applications/Content Editor/Gutters and configuring a new Gutter Renderer is as simple as adding a new item here based on the “Gutter Renderer” template:


The “Header” field here contains the text displayed in the right-click context menu we saw back at the beginning of this post. The “Type” field contains the fully qualified .Net type descriptor for the custom rendering class we defined. As usual for configuring extension types, this is formatted as “, ”.

And once you have configured that for your custom class, you can go back to the Master database and enable the new renderer by right-clicking the gutter:


Our new custom gutter render is now visible, and its selected state will be remembered between user sessions. Once it’s selected, we start to see the alias icon in the gutter for any item which has Aliases defined:


And clicking the icon will launch the Aliases dialogue.


Check Sitecore Items Publish or Not using GutterRender


Friday 14 June 2019

Sitecore Standard Template Fields - Part-7



Sitecore Standard Template: Validators Section

The Validators section of the Sitecore standard template contains the following fields used to configure data validation for the item:
  • Quick Action Bar Validation Rules (N/A): Item validators to apply in the Quick Action Bar.
  • Validate Button Validation Rules (N/A): Item validators to apply in dialogue that appears when a CMS user clicks the Validation button in the Proofing group on the Review tab of the ribbon in the Content Editor.
  • Validator Bar Validation Rules (N/A): Item validators to apply in the Validation Bar.
  • Workflow Validation Rules (N/A): Item validators for the validation workflow action to apply.
  • Suppressed Validation Rules (N/A): Item validators suppressed for this item.

Sitecore Standard Template: Workflow Section

The Workflow section of the Sitecore standard template contains the following fields that control workflow for the item:
  • Workflow (Sitecore.FieldIDs.Workflow): The workflow currently associated with the item.
  • Workflow state (Sitecore.FieldIDs.WorkflowState): The workflow state currently associated with the item.
  • Lock (Sitecore.FieldIDs.Lock): Identifies the owner of the lock associated with the item, preventing other non-admin users from editing that item.
  • Default workflow (Sitecore.FieldIDs.DefaultWorkflow): The workflow into which the system should place versions of the item when CMS users edit it. In general, unlike other fields in the Workflow section, the __Default workflow field should have a value in standard values for the data template associated with the item.

Thursday 13 June 2019

Sitecore Standard Template Fields - Part-6



Sitecore Standard Template: Statistics Section

The Statistics section of the standard template contains the following fields (that have nothing to do with web statistics, personalization, testing, or any other aspect of experience management):
  • Created (Sitecore.FieldIDs.Created): The date and time at which the system created the version. I believe that tracking the actual item created date rather than the version created date may require customization (maybe there is a technique in the box, but it currently escapes me, as the creation date of the first version could vary by language).
  • Created by (Sitecore.FieldIDs.CreatedBy): Identifies the CMS user that created the version. I believe that tracking the actual item creator rather than the version creator may require customization  (maybe there is a technique in the box, but it currently escapes me, as the of the first version could vary by language). 
  • Revision (Sitecore.FieldIDs.Revision): A unique identifier that the system updates (almost) every time the item changes. I write "almost" because passing certain parameters to specific APIs prevents Sitecore from updating this field.
  • Updated (Sitecore.FieldIDs.Updated): The date and time at which the system last updated the version. Again, passing certain parameters to specific APIs prevents Sitecore from updating this field.
  • Updated by (Sitecore.FieldIDs.UpdatedBy): Identifies the CMS user that last updated the version.

Sitecore Standard Template: Tagging Section

The Tagging section of the Sitecore standard template contains a single field:
  • Semantics (Sitecore.Buckets.Util.Constants.SemanticsField): Stores tags that CMS users and potentially visitors to the live site can use to search for items.

Sitecore Standard Template: Tasks Section

The Tasks section of the Sitecore standard template contains the following fields:
  • Archive date (Sitecore.FieldIDs.ArchiveDate): Date/time after which the system can archive the entire item.
  • Archive Version date (Sitecore.FieldIDs.ArchiveVersionDate): Date after which the system can archive the version of the item.
  • Reminder date (Sitecore.FieldIDs.ReminderDate): Date after which to send a reminder notification by email.
  • Reminder recipients (Sitecore.FieldIDs.ReminderRecipients): Email addresses of recipients for the reminder email.
  • Reminder text (Sitecore.FieldIDs.ReminderText): Text to send in the reminder email.


Sitecore Package Designer – Dynamic Items and Dynamic Files



Sitecore package designer allows us to add the following to our Sitecore package:
  • Sitecore Items. 
  • Files (configuration, dlls, CSS... etc.).
  • Security accounts.
Also, the above items can be added in two ways:
  • Static
  • Dynamic.

So you can use the first way if you know that you have specific items or specific location path Childs, but let's assume that you want to add items or files based on creation date query?!.

Here you can use the dynamic feature provided by Sitecore Package Designer; let see who we can add items or files dynamically:

·         Open Sitecore Package Designer.
·         Create new Sitecore Package Project.
·         From the add buttons section you can see the following options:
·         Security accounts.
·         Items dynamically
·         Files dynamically
·         Items statically
·         File statically

More can be found in the following screenshot:

  • Select items dynamically; then you can see a window where you need to select the root item from a Sitecore content tree as you can see from the following screenshot:


  • After clicking select you can apply any of the following filters:
Item name filter 
All or part of the item name: Filter items by name or by a part of the name. 

Use: Select a lookup option. The lookup options are: 
  • Simple Search Simple substring search, no wildcards, not case sensitive. 
  • Regular Expression Common regular expressions and regular .NET expressions are allowed. For more information about regular .NET expressions, read the official Microsoft documentation. 
  • Wildcards Common wildcards are allowed. A question mark (?) stands for a single character. An asterisk (*) stands for any number of characters. Any other character is matched as is. Search is not case sensitive. 
Creation date filter
Within the past … days: Filters items by the date they were created. 
Note Within the past XX days function is just a UI convenience; this is not a floating date. When a user enters a number of days, this value is converted to a static date range. 
Specify dates: Filters items by the date they were created. 

Modification date filter 
Within the past … days: Filters items by the date they were modified. 
Note Within the past XX days function is just a UI convenience; this is not a floating date. When a user enters a number of days, this value is converted to a static date range. 

Specify dates: Filters items by the date they were.
Publish date filter 
Publish date: Includes only those items which are publishable on a specific date. You will get only those items from the source, which appears on the web database if you perform republishing on the Publish date.
Take workflow into account: Select the Take workflow into account checkbox if you want to apply workflow restrictions to publishing when filtering. 

Template filter: Filters items by templates that the items are based on. Only the items which are based on at least one of the templates from the list are added. 

Created by filter: Filters items by the users who created them and/or by the roles which the users who created the items belong to. Click Add to display the list of users or roles and add them to the filter.

Updated by filter: This filter works in a similar way as Created by Filter one. It filters by users who updated an item last and/or by roles which those users belong to.

Language filter: Select the checkboxes you want to make only the items in the selected languages added.

As you can see from the following screenshots:












  • Add the filters you need and click next
  • Enter the source name and now you can generate your package.

The files dynamically work the same as described for the items dynamically.



Wednesday 12 June 2019

Sitecore Standard Template Fields - Part-5



Sitecore Standard Template: Publishing Section


The Publishing section of the standard template contains fields for managing publishing restrictions at the item level. Sitecore manages version-level publishing restrictions in fields within the Lifetime section of the standard template.

  • Publish (Sitecore.FieldIDs.PublishDate): Date after which publishing operations can publish the item to publishing targets.
  • Unpublish (Sitecore.FieldIDs.UnpublishDate): Date after which publishing operations will remove the item from publishing targets.
  • Publishing groups (Sitecore.FieldIDs.PublishingTargets): Publishing targets associated with the item. Publishing Groups is a legacy term for functionality similar to publishing targets.
  • Never publish (Sitecore.FieldIDs.NeverPublish): Prevents publishing operations from publishing the item to publishing targets.


Sitecore Standard Template: Security Section

The Security section of the Sitecore standard template contains the following fields:
  • Owner (Sitecore.FieldIDs.Owner): Identifies the CMS user that owns the item. From what I can tell, the owner is typically the user who created the item or its latest version in a language, although it is possible to change ownership of an item explicitly through the UI (or by changing the value in this field). Note that the owner does not necessarily own the current lock (the __Lock field in the Workflow section specifies the current lock owner if any).
  • Security (Sitecore.FieldIDs.Security): Defines access rights for the item. One key thing to remember here is that when you change access rights for an item, you must publish those changes to any relevant publishing target database(s).

Monday 10 June 2019

Sitecore Standard Template Fields - Part-3



Sitecore Standard Template: Insert Options Section

The Insert Options section of the standard template contains fields that define insert options for the item. Insert options control which types of items CMS users can create (insert) beneath existing items. In general, best practice is to assign insert options in standard values for data templates rather than individual items.
  • Insert Rules (N/A): Insert rules to apply to insert options. In general, I advise the use of insert options rules, which use the rules engine, rather than insert rules, which use functionality more specific to insert options.
  • Masters (Sitecore.FieldIDs.Branches and Sitecore.FieldIDs.Masters): Insert options for the item (masters is an old name for functionality similar to insert options).

Sitecore Standard Template: Item Buckets Section

The Item Buckets section of the standard template contains fields that affect buckets and bucketing. Buckets support storage, path management, search, an nd other features for very large numbers of Sitecore items. Most of these fields apply to buckets, of which most solutions should have very few if any. The __Bucketable and __Should Not Organize In Bucket fields are exceptions to the previous statement, as they apply to items within buckets. In general, those fields should be set in the standard values of the templates associated with those items rather than in individual items.
  • Bucket Parent Reference (Sitecore.Buckets.Util.Constants.BucketParentReference): Set to the ID of the parent of the item before its relocation into a bucket. Unbucketing an item moves it back under that parent. Sitecore stores a value in this field automatically as appropriate.
  • Is Bucket (Sitecore.Buckets.Util.Constants.IsBucket): Indicates that an item is a bucket.
  • Bucketable (Sitecore.Buckets.Util.Constants.BucketableField): Indicates that an item should be hidden if it exists in a bucket. It
  • Should Not Organize In Bucket (Sitecore.Buckets.Util.Constants.ShouldNotOrganizeInBucket): Indicates not to apply bucketing operations to the descendants of an item (it will maintain its structure within a bucket).
  • Default Bucket Query (Sitecore.Buckets.Util.Constants.DefaultBucketQuery): Default filtering for bucket Search pane.
  • Persistent Bucket Filter (Sitecore.Buckets.Util.Constants.DefaultFilter): Similar to __Default Bucket Query, but read-only (CMS users cannot change the search criteria for the bucket).
  • Enabled Views (Sitecore.Buckets.Util.Constants.EnabledView): Views enabled for this item. In this context, views expose alternate user interfaces for working with items in a bucket.
  • Default View (Sitecore.Buckets.Util.Constants.ItemViews): Default view for working with items in a bucket.
  • Quick Actions (Sitecore.Buckets.Util.Constants.QuickActionField): Quick actions expose CMS operations in views and potentially other user interfaces.

Sunday 9 June 2019

Sitecore Standard Template Fields - Part-2


Sitecore Standard Template: Help Section

The fields in the Help section of the standard template can provide context-sensitive assistance to users working with items in Sitecore. The fact that properties that expose the IDs of these fields appear in the Sitecore.TemplateFieldIDs class may indicate that Sitecore intends these fields to be relevant only to data templates (or at least, populated in data template definition items rather than standard values or individual items).
  • __Help link (Sitecore.TemplateFieldIDs.HelpLink): I could not easily find any usage of this field. I can imagine using it to develop a system that provides links to further information for working with items, for example in the Quick Info section to generate a link to external documentation, or to make the short description a link to such documentation. In that case, I feel that the field should appear in the data template for data templates rather than the standard template.
  • __Long description (Sitecore.TemplateFieldIDs.Description): Appears when a user hovers over an item in the content tree (what one might refer to as a tooltip…)
  • __Short description (Sitecore.TemplateFieldIDs.ToolTip): Appears in the item title bar.

Sitecore Standard Template: Indexing Section

The Indexing section of the standard template contains the following fields:
  • Boost (Sitecore.ContentSearch.Utilities.BoostingFieldId): Affects the relevance of item when it appears in search results.
  • Boosting Rules (Sitecore.ContentSearch.Utilities.BoostingRulesFieldId): Sitecore invokes the rules selected in this field to adjust the relevance of the item when it appears in search results.
  • Facets (Sitecore.Buckets.Utils.Constants.FacetsField): Item-specific search facets added to the global facets defined under the /Sitecore/system/Settings/Buckets/Facets item



Sitecore Standard Template Fields - Part-1



Sitecore Standard Template: Advanced Section

The Advanced section of the standard template defines the following fields:
  • Source (Sitecore.FieldIDs.Source): For clone items, identifies the cloned item.
  • Standard values (Sitecore.FieldIDs.StandardValues): For template definition items, the ID of the item that defines standard values for the template. It seems that logically, this field belongs in the data template for data templates rather than in the standard template for all items.
  • Tracking (Sitecore.Analytics.AnalyticsIds.TrackingField): For managing analytics properties associated with the item, including Profiles, Goals, and other Attributes (Campaigns, Events, Failure Actions, and Settings, including disabling analytics features for an item).

Sitecore Standard Template: Appearance Section

The Appearance section of the standard template defines the following fields:
  • Context Menu (Sitecore.FieldIDs.ContextMenu): Custom context menu for the item (often set in standard values for the template associated with the item).
  • Display name (Sitecore.FieldIDs.DisplayName): Display name for the item.
  • Editor (N/A): I believe that this field may be obsolete, or at least deprecated, from a time when items supported only a single custom editor.
  • Editors (Sitecore.Buckets.Utils.Constants.Editors): Custom editors (tabs) associated with the item (often set in standard values for the template associated with the item).
  • Hidden (Sitecore.FieldIDs.Hidden): To hide an item in content trees, select this checkbox for that item.
  • Icon (Sitecore.FieldIDs.Icon): Icon to render for the item (often set in standard values for the template associated with the item).
  • Read Only (Sitecore.FieldIDs.ReadOnly): To protect an item from updates, select this checkbox for that item.
  • Ribbon (Sitecore.FieldIDs.Ribbon): Configures a custom ribbon for the item (often set in standard values for the template associated with the item).
  • Skin (Sitecore.FieldIDs.Skin): For theming items in the Content Editor. To my knowledge, I have never seen this used.
  • __Sortorder (Sitecore.FieldIDs.Sortorder): For sorting items in content trees.
  • Style (Sitecore.FieldIDs.Style): For applying styles to items in content trees and fields in the content editor.
  • Subitems Sorting (Sitecore.FieldIDs.SubitemsSorting): For managing rules for sorting child items in content trees.
  • Thumbnail (Sitecore.FieldIDs.Thumbnail): Thumbnail image used for example when selecting a rendering.
  • Originator (Sitecore.FieldIDs.Originator): According to Sitecore’s own glossary, the intention of this appears to be the storage of the ID of the item in a branch template used to create an item. This did not seem to be the case in my simple tests, although there do seem to be some items in the Core database that have a value in this field that seems to match this purpose. The code that I think would populate this field appears obfuscated, so I gave up researching.
  • Preview (Sitecore.FieldIDs.Preview): Manages screenshots of the rendered item from various browsers.


Friday 7 June 2019

Sitecore Standard Template Fields - Part-4



Sitecore Standard Template: Layout Section

The Layout section of the standard template contains the following fields that control how Sitecore renders an item:
  • Renderings (Sitecore.FieldIDs.LayoutField): Often defined in standard values for data templates, this is the field in which Sitecore stores shared (unversioned/untranslated) layout details for items.
  • Final Renderings (Sitecore.FieldIDs.FinalLayoutField): Typically defined in individual items rather than standard values, this is the field in which Sitecore stores the versioned and translated components of layout details.
  • Renderers (Sitecore.FieldIDs.Renderers): This is the field in which an item can specify renderers (for rendering items in the context of a page generated from another item) for use by the Sitecore.Web.UI.WebControls.ItemRenderer web control or the ItemRenderer MVC renderer.
  • Controller (Sitecore.Mvc. Names.FieldNames.Controller, which actually provides the name of the field rather than its ID): This field can specify an MVC controller to invoke when a client requests the item.
  • Controller Action (Sitecore.Mvc. Names.FieldNames.ControllerAction, which also provides the name of the field rather than its ID): This field can specify the name of an action method in the MVC controller to invoke when a client requests the item. A value in this field makes sense only when the __Controller field has a value.
  • Presets (Sitecore.Web.WebEditUtil.LayoutPresetsFieldId): This field can store references to preconfigured layout details that users can apply to items.
  • Page Level Test Set Definition (Sitecore.Analytics.AnalyticsIds.PageLevelTestDefinitionField): Manages page-level tests for the item.


Sitecore Standard Template: Lifetime Section


The Lifetime section of the standard template contains fields for managing publishing restrictions at the version level. Sitecore manages item-level publishing restrictions in fields within the Publishing section of the standard template.


  • Valid to (Sitecore.FieldIDs.ValidTo): The date after which publishing operations will remove the version from publishing target databases.
  • Hide version (Sitecore.FieldIDs.HideVersion): Prevents publishing of the version to publishing target databases.
  • Valid from (Sitecore.FieldIDs.ValidFrom): Date after which publishing operations will remove the version from publishing target databases.


Sitecore Publishing Service 7.0 Installation Guide

  About the Publishing Service module The Publishing Service module is an optional replacement for the existing Sitecore publishing methods....