Last updated by indytechcook on Sun, 2012-05-06 15:23
The first deliverable for the Content Staging initiative within LSD is flowcharts for end user facing processes.
Be sure to reference the Definitions page for clarification on certain terms. http://groups.drupal.org/node/225474
Workflow
The workflow flowcharts are recommend patterns to use. The system will not require any particular workflow methods or modules. The only workflow requirement will be the use of revision to manage the workflow of a piece of content.
Sample Workflow
File: http://groups.drupal.org/files/sample_workflow_0.pdf
Summary:
This flowchart shows the assumed default workflow for content. In the final product, the workflow will be configurable. This assumption was made to help clarify the rest of the flowcharts and to help unify discussion without worrying about this implementation detail.
The first column represents states. The arrows represent events that can occur on those states. The third column is the ending state that occurs upon event completion. The last column are the representations in the content staging system.
Content Creation/Update Process
File: http://groups.drupal.org/files/content_update.pdf
Summary
The content creation process speaks to nodes but could be used against any revisionable entities. The process assumes the workflow from the Sample Workflow flowchart. The "Approve" decision point could be much more involved then the representation of this flowchart. What's important is that the content receives final approval in all of the states within the review stage.
The published workflow refers the to Flowchart.
Publishing Workflow
File: http://groups.drupal.org/files/publishing_workflow.pdf
Summary
The publishing workflow occurs when content is moving from into the Published Stage. The content can be either published immediately, scheduled or as part of a collection.
Multiple Revision Workflow
File: http://groups.drupal.org/files/mulitple_revisions.pdf
Summary
This process show the life of a revision when you have multiple revisions being worked on at one time. This is the basis of how we planned the rest of content staging.
Site Preview
Viewing the Site Preview Form
File: http://groups.drupal.org/files/page_preview_form.pdf
Summary
The page preview form is displayed when a user wants to turn on the site preview mode. The form will use the Site Conditions to build a form. Each Site Condition will define the user input.
Set Page Preview
File: http://groups.drupal.org/files/set_page_preview_mode.pdf
Summary
When a user submits the site preview form the set page preview process kicks off. The overall goal of this process is to collect all of the overrides needed to be used in preview mode. The overrides are generated by the Preview Setters. The Preview Setters know how to use the Preview Conditions to build a list of ids and revision ids that will be used for the override list. The override list is saved to a table for the Preview Reaction object to use.
Entity Load Preview Reaction
File: http://groups.drupal.org/files/entity_load_reaction.pdf
Summary
When a page is loading and the preview mode is active then the Preview Reactions will control the loading of the content. The Entity Load Preview Reaction will use the override data to load the correct revision for the active Site State.
Flow of data for loading entities
- primary id is passed to entity load function
- load controller checks to see if a site state is active
- if site state is active, then it checks to see if any overrides exist for the id it’s loading
- if overrides exists, it loads the correct revision
Example
This is an example node controller
<?php
class LSDNodeController extends NodeController {
public function load($ids = array(), $conditions = array()) {
$site_state = lsd_get_site_state()
if ($site_state->active()) {
if ($override_vid = $site_state->getVid(‘node’, reset($ids))) {
$conditions[$this->revisionKey] = $override_vid;
}
}
}
}
?>Query Alter Preview Reaction
File: http://groups.drupal.org/files/query_alter_reaction.pdf
Summary
When a page is loading and the preview mode is active then the Preview Reactions will control the loading of the content. The Query Alter Preview Reaction will override a query in hook_query_alter to make sure that the correct joins are on the tables to load the correct revisions.
Flow of data for loading entities
- Query Alter checks if there is an active site state
- Modify query to check for overrides
Example
This example assumes that the override data is stored in a table called "revision_overrides"
Fields
- id
- entity_type
- entity_id
- entity_vid
- site_state_key
- timestamp
Before Query
SELECT n.nid, n.vid FROM node n
WHERE n.type = "faq"
AND n.status = 1
ORDER BY n.created DESC LIMIT 10;After Query
SELECT n.nid, n.vid, COALESCE(rev.entity_vid, n.vid) FROM node n
LEFT JOIN revision_collection rev
ON rev.entity_id = n.nid
AND rev.entity_type = 'node'
WHERE n.type = "faq"
AND n.status = 1
OR (rev.entity_id IS NOT NULL AND rev.site_state_key = "test1")
ORDER BY n.created DESC LIMIT 10;| Attachment | Size |
|---|---|
| content_update.pdf | 48.07 KB |
| mulitple_revisions.pdf | 47.51 KB |
| publishing_workflow.pdf | 35.25 KB |
| sample_workflow.pdf | 83.92 KB |
| page_preview_form.pdf | 32.65 KB |
| set_page_preview_mode.pdf | 46.88 KB |
| entity_load_reaction.pdf | 45.42 KB |
| query_alter_reaction.pdf | 42.19 KB |