Can Sitecore Clones Become More Automatic - sitecore

I have read what I can on cloning and it seems like a partial solution for our client. I read http://www.sitecore.net/Community/Technical-Blogs/Getting-to-Know-Sitecore/Posts/2010/10/Cloning-What-Ifs.aspx but the commenters didn't finish out the answer.
Sitecore clones give notification on changes which is nice and supports the idea of workflow for all items, but the clone parent does not give information on what is cloned from it. So when a change is made on our (mainly) master site, finding each cloned item in the 5 sister sites is going to become much too tedious too fast.
I believe that proxy items would have once been the true solution, but considering that they are deprecated, I don't think it's a solution we are looking to implement.
Besides modifying our workflow and messing around with the clones, is there a built-in or easier way to maintain clones?
Desired Behavior:
When parent of clones becomes approved into a final workflow state => Accept the changes on the clones as well.
Or
Less Desired:
Give a list of all child clones of an item in the Content Editor with links to edit.

For your desired behavior: you'd have to implement either an event handler or pipeline processor that when an item is approved, you use the Links Database to find all clones of it and programmatically approve those. I believe this is certainly do-able from a code perspective.
For your less desired behavior: you can use the Navigate tab > Links drop-down to find clones. Just look at the Referrers that have the _source field displayed, meaning they refer to that item via the "_source" field which means they're a clone of it.
UPDATE
To modify the workflow of an item via C#, refer to Changing the Workflow State on an Item.

Related

TFS Allow all states for a work item

Is it possible to open up all possible states for a work item - essentially removing the state transitions?
I am hoping to use a tool outside of TFS for managing work items and would like to know if it's possible to simply allow all states at any time?
If you want to remove the transitions between work item, you need to customize the work flow.
You change the workflow to accomplish the following objectives:
Add or remove a state, reason, or transition.
Specify a value for field to be applied during a change in state,
reason, or transition..
Specify a custom ACTION to automate field assignments based on a
change in state, reason, or transition.
Detail steps to customize the workflow and more info about it, please refer this Modify or add a custom work item type (WIT) from MSDN.
Moreover, here is a 3rd party extension called TFS Work Item Manager which is an innovative team workload coordination platform that helps you manage your TFS work items in a much more efficient and intuitive way. You can also take a look at it.

Sitecore item:setdefaultworkflow and item:resetdefaultworkflow commands

I am Using Sitecore 6.6
I believe item:setdefaultworkflow and item:resetdefaultworkflow commands are used to reset the workflow fields on an Item with values set on Standard values.
If not please correct me.
Here is the Path in Core:
/sitecore/content/Applications/Content Editor/Ribbons/Chunks/Workflow/Set Default Workflow
commands are not shown on the Ribbon. How do I use these commands? what is their purpose. Any Help is greatly appreciated.
I am aware of Version >> Fields(Reset)>> then choose the fields to reset with multiple clicks.
I am trying to use these commands if they solve my purpose to reset the Workflow Fields to standard values with a command on Review Tab >> Workflow section with one Click.
As far as I'm aware, these buttons are only visible on __Standard Values items. They are used to assign the workflow that will be used for new versions of that template going forward, or to clear the workflow that has been set (note that items which are already part way through a workflow will still need to finish it before they are no longer associated with a workflow).
The idea is that you assign the workflow to the standard values of templates (or base templates) in your solution, and those settings then get carried through to your content items.
Although you are able to, I'd advise against fiddling with the workflow fields on individual items before you fully understand the purpose of the fields.
For more information, I'd suggest looking at the Sitecore workflow reference document: https://sdn.sitecore.net/upload/sitecore6/60/workflow_reference_sc60orlater-a4.pdf

custom sitecore shell tools for en masse workflow approval

I'm wondering about documentation to create a simple custom ribbon control for sitecore shell.
The problem i'm trying to address is that Admins should be able to force all subitems recursively to be approved to a certain workflow state (rather than approve each one manually), but we currently don't know any way to achieve that.
To solve this, we want to force items throught the workflow state (triggering the corresponding commands) programmatically, but we need a sane way for admins to interact with this, the sensible option would be a custom thingie in sitecore shell, but we aren't sure how easy is to achieve that.
any recommended readings for this problem?
Though this article claims to be written for Sitecore 5.3, the same steps apply for 6.x as well. Note: it requires access to the SDN: How to create a ribbon button in Sitecore v5.3
The high-level points from the article are:
Create a new class that inherits from Sitecore.Shell.Framework.Commands.Command
Mark the class as [Serializable]. It might not be necessary for simple commands, but add it now so you don't get problems later! Otherwise the button might not work correctly (this is related to pipelines - and the fact that pipelines might be stopped and resumed)
Override Execute() and possibly also GetIcon(), GetHeader(), QueryState(), GetClick(), GetSubmenuItems()
Add a new <command name="…" type="..."> tag to /App_Config/Commands.config file
Log into Sitecore and switch to the core database
Navigate to /sitecore/content/Applications/Content Editor/Ribbons and create (or copy) a command in the desired chunk
Enter your command name (the one from step 4) in the "Click" field (and supply a Header, Icon, Tooltip, etc)

Switching to a new workflow

We have a need to apply a new workflow to items in our content tree. This will replace the Workflow already in place.
I have a base item that these content items inherit from, so I can use that to change the default Workflow.
The problem is, how do I deal with items that are already in the various states of Workflow? Do I have to edit them individually to put them in the equivalent step of the new Workflow?
To answer your questions, yes. However, maybe consider switching them programatically rather than manually. Maybe you can run code to go through the items and switch WF states based on mappings from the old to new states. I recommend you post this question on the SDN forum or even ask Sitecore support as there may be consequences to doing this.

Links and references between cloned items in Sitecore 6.4

I'm building a data repository site that I will then clone in its entirety to provide multiple clone sites, enabling localistaion of global content.
What I need to do is to ensure that all references between items in the repository site (links in rich text fields, item references to pull in "related items" spots etc) are overridden to refer to the relevant clones instead of the original items in the repository.
This will likely involve e.g. customising the LinkManager and maybe GetItem(itemID) with some additional logic to find the correct clone.
What I need to know is which bits of the API do I need to worry about? Is there a single modification I can make which will inherit to link rendering in a rich text field in .Net components, item references fed to a sublayout from drop list, renderings through XSLT etc? I need an item ID to work as an alias for its clone when in the context of the clone site. Context.Database.GetItem(ID) needs to return a clone when in the clone site context.
I'm basically looking for a mechanism that will translate "Data/Home/Products/Product A" to "clone/Home/Products/ProductA" whenever and however I use it in the context of a clone site.
Where do I need to implement this logic, how many places?
Cross posted to SDN http://sdn.sitecore.net/SDN5/Forum/ShowPost.aspx?PostID=35598
This is related to an earlier question Handling internal links in Sitecore 6.4 cloned sites , but contains more detail and is more specific.
EDIT: though the ideal solution would place this functionality deep within Sitecore it is important that this only applies to content as viewed on the actual website, i.e. it must not interfere with Sitecore pipelines for e.g. creating, cloning and deleting items.
I recommend you take a different approach. Rather than changing the links themselves, you can add code to the HttpRequestPipeline to resolve "Data/Home/Products/Product A" as "clone/Home/Products/ProductA". A similar approach is described in Reusing and Sharing Data:
A CMS user could use the Rich Text Editor, rendering properties, or other features to link to an item
based on an item selection data template. Account for these conditions in your code. You can
configure an httpRequestBegin pipeline processor to handle HTTP requests for items [...]
To apply this approach to your scenario, add the custom implementation of HttpRequestProcessor after <processor type="Sitecore.Pipelines.HttpRequest.ItemResolver, Sitecore.Kernel"/> in the HttpRequestBegin pipeline in web.config.
Here's the logic to implement:
Use HttpContext.Current.Request.UrlReferrer to determine the referring site.
Verify that the referring site is in your list of cloned sites.
Check if Sitecore.Context.Item is in the source site.
Create a string with the new path, and verify that this item exists using Database.GetItem().
Modify Sitecore.Context.Item to the new item.
The advantage of this approach is that you do not need to intercept the many ways that a link can be created, and you keep your path rewriting logic in one place. In effect, you will be creating an alias from "Data/Products/ProductA" to "clone/Home/ProductA" that will only take effect if your site is in your list of clones.
Update: I did a test of this approach in Office Core. I created a second site, AlternalteSite, with a child node Our-Process. The AlternateSite home page has a link to /home/Our-Process. When the code below is added to the HttpRequestBegin pipeline, the link directs to the /AlternateSite/Our-Process item.
public class SiteChanger : HttpRequestProcessor
{
// Some definitions removed...
public override void Process(HttpRequestArgs args)
{
if (ReferringSiteIsTarget())
{
Item targetItem = GetTargetItem();
if (targetItem != null)
{
Sitecore.Context.Item = targetItem;
}
}
}
private Item GetTargetItem()
{
string currentItemPath = Sitecore.Context.Item.Paths.FullPath;
string newPath;
if (currentItemPath.Contains(SourcePath))
{
newPath = currentItemPath.Replace(SourcePath, TargetPath);
return Sitecore.Context.Database.GetItem(newPath);
}
return null;
}
}
Update2: As James Walford points out in the comments, this approach only works if the clones are not renamed. Sitecore does not, to my knowledge, provide a way of traversing from a source item to its clones in the web database. In master, you can use the Link Database to get from an item to its clones (see this forum post by John West), but after publication, clones become normal items, so presumably will not be included in the Link Database.
One approach would be to add a multilist of links to clones to the standard template, and add logic to populate this as part of the uiCloneItems pipeline, and to use this data in the HttpRequestProcessor code. This will preserve the Link Database relationship, but will put overhead on both the cloning process and the Http Request resolution process, as your code would need to iterate through all the clones to determine which one lived in the requesting website.