Skeleton needs to be able to allow skeleton administrators to add new templates to a skeleton, and then push them out to instantiated outlines. As well, if a template is removed from a skeleton, and it hasn't been changed, it should be able to be removed as well. As is, I see a few things needed to reach this goal:

  1. When a skeleton is created, an instance needs to have recorded what skeleton ID it came from.
  2. Each template instance needs to be able to store if it's been changed from the base template or not. This could be as simple as comparing to the stored template by ID, or by storing a flag which is switched the first time a node is re-saved.
  3. There should be a list of instances, along with notes as to if an instance or specific template has been changed. It needs to be easy for users to determine if a outline instance has been changed.

Comments

deviantintegral’s picture

Status: Active » Needs work
StatusFileSize
new20.18 KB

Here is an incomplete patch which starts to implement this. It adds a new database table to store nid's link to template ID's. On the first save of the node, it plays it safe and removes the link, as we may not always be able to tell if content has changed.

This will still need some work.

deviantintegral’s picture

Status: Needs work » Needs review
StatusFileSize
new23.41 KB

Here is a patch which implements the following features:

  • When a template is instantiated, the template ID and tokens used are stored with the node.
  • For templates which haven't changed, updating the source template will update the instantiated template. Right now this is on by default, as it fits the use case of my client, but I'm open to input on that.
  • As soon as a node is updated manually, it is removed as a "linked" node.
  • An additional tab is shown on nodes for users with the right permissions to edit the source template.

Some functions had to be moved around (notably hook_form_alter()) so that it could be accessed in more than one case.

deviantintegral’s picture

StatusFileSize
new23.55 KB

Updated to not unset node ownership.

agentrickard’s picture

I am not sure I agree with this feature. Can the created instance opt-out of these updates? I suppose I would implement this as a batch operation, similar to admin/content/list and hook_node_operations(). Allow the editor to select which instances to update.

deviantintegral’s picture

Status: Needs review » Needs work

I really like the idea of using the batch API; that will also ensure that the operation doesn't time out on slower sites. Opt-out could also be useful.

I'm going to re-approach this as more of a "sync" feature versus automatically doing it when saving a template. Since the information will be recorded, it should be possible to have a "Synchronize content" tab which allows editors to apply updates as needed.

agentrickard’s picture

Yeah ++ for 'sync'

I can help with the batch stuff, if need be. The documentation has a few errors.

deviantintegral’s picture

Status: Needs work » Needs review
StatusFileSize
new26.99 KB

Here is a reworked patch which adds a "Synchronize" tab and uses the batch API. For anyone testing, it will only work for newly created nodes so the table can get populated properly.

For now, it only deals with templates which have been modified. I'd like to keep this issue just to that function, but so far it's been designed so that adding other functions shouldn't be too difficult.

deviantintegral’s picture

StatusFileSize
new27.88 KB

I realized that in order to properly manage adding and removing templates, the skeleton ID needs to be recorded as well. This update adds a column to the table (though it won't be used in this patch).

deviantintegral’s picture

StatusFileSize
new27.88 KB

Reroll against HEAD.

deviantintegral’s picture

Status: Needs review » Fixed

I've committed this to HEAD.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.