| 1 | # Action Streams Plugin for Movable Type |
|---|
| 2 | # Author: Mark Paschal |
|---|
| 3 | # Copyright 2008 Six Apart, Ltd. |
|---|
| 4 | # License: Artistic, licensed under the same terms as Perl itself |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | OVERVIEW |
|---|
| 8 | |
|---|
| 9 | The Action Streams plugin utilizes Movable Type to monitor a collection of 3rd party web sites |
|---|
| 10 | and services for changes to a user's profile. The plugin will then aggregate and collect those |
|---|
| 11 | actions so that they can be published to a user's website, blog or profile. |
|---|
| 12 | |
|---|
| 13 | The plugin adds the ability for an author within Movable Type to list their accounts on 3rd |
|---|
| 14 | party web sites. From these accounts, a periodic task automatically imports the author's |
|---|
| 15 | activities on those services via RSS, Atom, and some web scraping. This allows the author to |
|---|
| 16 | create an Action Stream completely under their control. |
|---|
| 17 | |
|---|
| 18 | This plugin then provides a set of template tags as well that make it possible to publish and |
|---|
| 19 | display the author's accounts and actions on any page powered by Movable Type. The default |
|---|
| 20 | example templates use the Microformats XFN and hAtom to make the information more accessible. |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | PREREQUISITES |
|---|
| 24 | |
|---|
| 25 | - Movable Type 4.1 or higher |
|---|
| 26 | - Scheduled task or cron job to execute the Periodic Tasks script (see below) |
|---|
| 27 | |
|---|
| 28 | The Action Streams plugin ships with all of the external libraries you should need to run it. |
|---|
| 29 | |
|---|
| 30 | Note: Action Streams does not work when run-periodic-tasks is run in daemon mode. |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | INSTALLATION |
|---|
| 34 | |
|---|
| 35 | 1. Configure a cronjob (see below) for the script run-periodic-tasks. |
|---|
| 36 | 2. Unpack the ActionStreams archive. |
|---|
| 37 | 3. Copy the contents of ActionStreams/extlib into /path/to/mt/extlib/ |
|---|
| 38 | 3. Copy the contents of ActionStreams/mt-static into /path/to/mt/mt-static/ |
|---|
| 39 | 4. Copy the contents of ActionStreams/plugins into /path/to/mt/plugins/ |
|---|
| 40 | 5. Navigate to your profile, and click on "Other Profiles." |
|---|
| 41 | 6. Build a list of your accounts that you wish to display and stream actions from. |
|---|
| 42 | 7. Edit your stylesheet to include needed CSS. (see STYLES below) |
|---|
| 43 | 8. Edit your templates to display your other profiles and your Action Stream. (see |
|---|
| 44 | example_templates folder) A template set is also provided for convenience. |
|---|
| 45 | 9. Edit the plugin's settings to enable automatically rebuilding your blog as new |
|---|
| 46 | actions are imported. This setting is under each of your blog's plugin settings. |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | CRONJOB |
|---|
| 50 | |
|---|
| 51 | Add the following lines to your crontab to execute the script at the hour and 30 minutes |
|---|
| 52 | past the hour: |
|---|
| 53 | |
|---|
| 54 | # Movable Type's scheduled tasks script: |
|---|
| 55 | 0,30 * * * * cd /path/to/mt; perl ./tools/run-periodic-tasks |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | STYLES |
|---|
| 59 | |
|---|
| 60 | To add icons to your Action Streams and other basic styling, add the following line to |
|---|
| 61 | the top of your main stylesheet (normally styles.css). |
|---|
| 62 | |
|---|
| 63 | @import url(<MT:StaticWebPath>/plugins/ActionStreams/css/action-streams.css); |
|---|
| 64 | |
|---|
| 65 | The classes used in the template code examples use the same classes as the default templates |
|---|
| 66 | and thus they work well with the default themes. |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | TEMPLATE CODE |
|---|
| 70 | |
|---|
| 71 | The example_templates folder within the Action Streams plugin includes example widgets and |
|---|
| 72 | index templates which make use of an author's Other Profiles and Action Stream. Though it |
|---|
| 73 | is possible to create Action Streams combining actions from multiple authors, all of the |
|---|
| 74 | examples display profiles or actions from a single author. |
|---|
| 75 | |
|---|
| 76 | The following template code will produce a list of actions for the author "Melody Nelson": |
|---|
| 77 | |
|---|
| 78 | <mt:ActionStreams display_name="Melody Nelson" lastn="20"> |
|---|
| 79 | <mt:if name="__first__"> |
|---|
| 80 | <div class="action-stream"> |
|---|
| 81 | <ul class="action-stream"> |
|---|
| 82 | </mt:if> |
|---|
| 83 | <li class="service-icon service-<mt:var name="service_type">"><mt:StreamAction></li> |
|---|
| 84 | <mt:if name="__last__"> |
|---|
| 85 | </ul> |
|---|
| 86 | </div> |
|---|
| 87 | </mt:if> |
|---|
| 88 | </mt:ActionStreams> |
|---|
| 89 | |
|---|
| 90 | It is recommended that you add the above code as a template module or widget to make it |
|---|
| 91 | easier to include and display profile actions throughout your web site. |
|---|
| 92 | |
|---|
| 93 | For more detailed examples see the templates in the example_templates directory. |
|---|
| 94 | |
|---|
| 95 | There are additional template tags, such as mt:StreamActionThumbnailURL, which need to |
|---|
| 96 | be documented better in the future. |
|---|
| 97 | <mt:setvarblock name="thumb_url"><mt:StreamActionThumbnailURL></mt:setvarblock> |
|---|
| 98 | <mt:if name="thumb_url"> |
|---|
| 99 | <div style='padding-left: 20px; padding-bottom: 10px; padding-top: 5px;'> |
|---|
| 100 | <img src='<mt:var name='thumb_url'>' /> |
|---|
| 101 | </div> |
|---|
| 102 | </mt:if> |
|---|
| 103 | |
|---|
| 104 | CREDITS |
|---|
| 105 | |
|---|
| 106 | This distribution contains icons from Silk, an icon set by Mark James, |
|---|
| 107 | licensed under the Creative Commons Attribution 2.5 License. |
|---|
| 108 | |
|---|
| 109 | http://www.famfamfam.com/lab/icons/silk/ |
|---|
| 110 | |
|---|
| 111 | |
|---|