-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
gggeek
committed
Jun 8, 2017
1 parent
a247bd8
commit d96a566
Showing
6 changed files
with
259 additions
and
1 deletion.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# This workflow is designed to fill in automatically a 'screenshot' image when editors publish video files. | ||
# | ||
# It expects the 'video' content class to have 3 attributes: | ||
# - 'file': the video file itself (type: media) | ||
# - 'screenshot': the field that will hold the screenshot (type: image) | ||
# - 'screenshot_frame': an integer field, used to specify the time in the video at which the screenshot is taken (type: integer) | ||
|
||
# hook up to post-publication | ||
- | ||
type: workflow | ||
signal: ContentService\PublishVersionSignal | ||
avoid_recursion: true | ||
|
||
# load the content to be able to set a reference to its class | ||
- | ||
type: content | ||
mode: load | ||
match: | ||
content_id: workflow:signal:content_id | ||
references: | ||
- | ||
identifier: content_type_as | ||
attribute: content_type_identifier | ||
|
||
# unless content type is video, stop here | ||
- | ||
type: workflow | ||
mode: cancel | ||
unless: | ||
"reference:content_type_as": | ||
eq: "video" | ||
|
||
# set references to the video-specific fields | ||
- | ||
type: content | ||
mode: load | ||
match: | ||
content_id: workflow:signal:content_id | ||
references: | ||
- | ||
identifier: video_path | ||
attribute: attributes.file.path | ||
- | ||
identifier: screenshot_path | ||
attribute: attributes.screenshot.path | ||
- | ||
identifier: screenshot_frame | ||
attribute: attributes.screenshot_frame | ||
|
||
# cancel the workflow if the screenshot field has been filled in already | ||
- | ||
type: workflow | ||
mode: cancel | ||
unless: | ||
"reference:screenshot_frame": | ||
ne: null | ||
|
||
# run 'avconv' to generate the screenshot (avconv is a fork of ffmpeg, available by default on debian 8) | ||
- | ||
type: process | ||
mode: run | ||
command: avconv | ||
arguments: | ||
- '-i' | ||
- 'reference:video_path' | ||
- '-y' | ||
- '-ss' | ||
- 'reference:screenshot_frame' | ||
- '/tmp/test.jpg' | ||
|
||
# upload the generated file to the screenshot field and re-publish the content | ||
- | ||
type: content | ||
mode: update | ||
match: | ||
content_id: workflow:signal:content_id | ||
attributes: | ||
screenshot: | ||
path: "/tmp/test.jpg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# This workflow is designed to demo the capability of using http calls to external systems to alter cms contents. | ||
# | ||
# When a content is published of type 'comment', and the 'body' field has been left void, fill it with 'lore ipsum' text | ||
|
||
# hook up to post-publication | ||
- | ||
type: workflow | ||
signal: ContentService\PublishVersionSignal | ||
avoid_recursion: true | ||
|
||
# load the content to be able to set a reference to its class | ||
- | ||
type: content | ||
mode: load | ||
match: | ||
content_id: workflow:signal:content_id | ||
references: | ||
- | ||
identifier: content_type_fc | ||
attribute: content_type_identifier | ||
|
||
# cancel the workflow if the content is not of the desired type | ||
- | ||
type: workflow | ||
mode: cancel | ||
unless: | ||
"reference:content_type_fc": | ||
eq: "comment" | ||
|
||
# set references to the content fields | ||
- | ||
type: content | ||
mode: load | ||
match: | ||
content_id: workflow:signal:content_id | ||
references: | ||
- | ||
identifier: comment_message | ||
attribute: attributes.message | ||
|
||
# help with debugging: dump current references to a file for inspection | ||
- | ||
# Save the complete set of references currently defined to a json or yaml file | ||
type: reference | ||
mode: save | ||
file: "./refs.json" | ||
overwrite: true | ||
|
||
# cancel the workflow if the body field is not null | ||
- | ||
type: workflow | ||
mode: cancel | ||
unless: | ||
and: | ||
- | ||
"reference:content_type_fc": | ||
eq: "comment" | ||
- | ||
"reference:comment_message": | ||
eq: null | ||
|
||
# get a bunch of lorem ipsum text to be used to fill in the body | ||
- | ||
type: http | ||
mode: call | ||
client: acme | ||
uri: "http://loripsum.net/api/3/plaintext" | ||
references: | ||
- | ||
attribute: body | ||
identifier: lipsum_text | ||
|
||
# and set it into the comment by republishing it | ||
- | ||
type: content | ||
mode: update | ||
match: | ||
content_id: workflow:signal:content_id | ||
attributes: | ||
message: "reference:lipsum_text" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# This workflow is designed to implement the classic 'keep content hidden until desired date' pattern. | ||
# | ||
# It works for contents of type 'article'. It expects the article content type to have a 'publish_date' field | ||
|
||
# hook up to post-publication | ||
- | ||
type: workflow | ||
signal: ContentService\PublishVersionSignal | ||
avoid_recursion: true | ||
|
||
# load the content to be able to set a reference to its class | ||
- | ||
type: content | ||
mode: load | ||
match: | ||
content_id: workflow:signal:content_id | ||
references: | ||
- | ||
identifier: content_type | ||
attribute: content_type_identifier | ||
|
||
# cancel the workflow if the content is not of the desired type | ||
- | ||
type: workflow | ||
mode: cancel | ||
unless: | ||
"reference:content_type": | ||
eq: "article" | ||
|
||
# hide the content by default (nb: all its locations) | ||
- | ||
type: location | ||
mode: update | ||
is_hidden: true | ||
match: | ||
content_id: workflow:signal:content_id | ||
|
||
# suspend the workflow until the desired date. When the 'resume' cli command is run, the workflow will restart from here | ||
- | ||
type: workflow | ||
mode: suspend | ||
load: | ||
# make sure that we check the current date against the desired date as currently set. | ||
# This is needed for the case where someone has changed the publication-date while this workflow was suspended | ||
type: content | ||
match: | ||
content_id: workflow:signal:content_id | ||
references: | ||
- | ||
identifier: content_type | ||
attribute: attributes.publish_date | ||
until: | ||
date: reference:content_type | ||
|
||
# once the desired time has arrived, display the content (nb: all its locations) | ||
- | ||
type: location | ||
mode: update | ||
is_hidden: false | ||
match: | ||
content_id: workflow:signal:content_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# This workflow is designed to demo the capability of sending emails upon content changes. | ||
# | ||
# Goal: notify the editorial manager when someone moves any content to be positioned directly under the homepage | ||
|
||
# hook up the workflow to the trigger | ||
- | ||
type: workflow | ||
signal: LocationService\MoveSubtreeSignal | ||
avoid_recursion: true | ||
#run_as: admin | ||
|
||
# cancel the workflow unless the new location is the content root | ||
- | ||
type: workflow | ||
mode: cancel | ||
unless: | ||
"workflow:signal:new_parent_location_id": | ||
eq: "2" | ||
|
||
# load the content to be able to set a reference to its name | ||
- | ||
type: content | ||
mode: load | ||
match: | ||
location_id: workflow:signal:subtree_id | ||
references: | ||
- | ||
identifier: content_name | ||
attribute: name | ||
|
||
# send an email to a fixed recipient using information from the content for both subject and body | ||
- | ||
type: mail | ||
mode: send | ||
from: [email protected] | ||
to: [email protected] | ||
subject: "Content '[reference:content_name]' has been moved to root location!" | ||
body: "It was done by [workflow:original_user]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters