AnsweredAssumed Answered

Checkin/Checkout with cm:contains

Question asked by tgmweb on Dec 8, 2012
I have an issue using checkin/checkout with an object that uses cm:contains. Essentially, child nodes are "lost" when the checkin is done.

I wrote about this a while ago here:

as openPJ said (and I agree somewhat) checking out a node with cm:contains is a little weird (however, surely this also must be the case for discussion nodes below cm:content??)

I got round the issue (or so I thought) by writing a little bodge:

if (page.hasAspect("cm:workingcopy")) {
  // get the original node.
  var original = page.assocs["cm:original"][0];
  p = page.checkin();
  // loop through the originals child nodes, and "move" them under the newly checked-in node   
  for (i=0;i<original.children.length;i++) {

This seems to work 80% of the time, but not always. I'm guessing that the checkin runs in a transaction, and it's not always complete when I "move" my nodes.

If anyone sees a way around this, or anything I can do to get it working 100% I'd be extremely appreciative!!