1

I want to change the version name of an item, from 'Modified xx by xx' to something like 'Bonus Offer', to make each version name to be more specific. Is it possible to do it? Or it is 'out of the box'? If it's possible, could it go even further like add an edit button alongside each version? Thanks, guys. enter image description here

2

It is possible, but not simple. The dialog in your screenshot is located here:

{webroot}/sitecore/shell/Applications/Content Manager/Galleries/Versions/Gallery Versions.xml

And the code beside is:

Sitecore.Shell.Applications.ContentManager.Galleries.Versions.GalleryVersionsForm,Sitecore.Client

To change this, you would need to create your own code beside file and change the .xml file to point at your new code beside. Then modify the OnLoad handler in your code beside to get the content you want.

Currently the OOTB version is doing this for each version:

Item[] versions = currentItem.Versions.GetVersions();
for (int index = versions.Length - 1; index >= 0; --index)
{
    Item obj = versions[index];
    XmlControl control = ControlFactory.GetControl("Gallery.Versions.Option") as XmlControl;
    Assert.IsNotNull((object) control, typeof (XmlControl), "Xml Control \"{0}\" not found", "Gallery.Versions.Option");
    Context.ClientPage.AddControl((System.Web.UI.Control) this.Versions, (System.Web.UI.Control) control);
    CultureInfo culture = Context.User.Profile.Culture;
    string str1 = obj.Statistics.Updated == DateTime.MinValue ? Translate.Text("[Not set]") : DateUtil.FormatShortDateTime(DateUtil.ToServerTime(obj.Statistics.Updated), culture);
    string str2 = obj.Statistics.UpdatedBy.Length == 0 ? "-" : obj.Statistics.UpdatedBy;
    string str3 = obj.Version.ToString() + ".";
    string str4 = obj.Version.Number != currentItem.Version.Number ? "<div class=\"versionNum\">" + str3 + "</div>" : "<div class=\"versionNumSelected\">" + str3 + "</div>";
    control["Number"] = (object) str4;
    control["Header"] = (object) Translate.Text("Modified <b>{0}</b> by <b>{1}</b>.", (object) str1, (object) str2);
    control["Click"] = (object) string.Format("item:load(id={0},language={1},version={2})", (object) currentItem.ID, (object) currentItem.Language, (object) obj.Version.Number);
}

I'm not sure where you are storing the descriptions of your versions. Maybe you could add a versioned field to your base page or item template that contains that description and your content editors can update that each time they create a new version? Then you would be able to use that in the code above.

There are caveats tho - this would require changing an OOTB file to point at your new CodeBeside file, so anytime there is an upgrade, you may have to replicate that change.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.