Hacking Movable Type Training - Day 2

Byrne Reese
Byrne ReesePrincipal at Endevver, LLC
Hacking
Movable
Type
        Day
2
    A
guide
for
developers


      Six
Apart
Ltd.

                             Page

Review

• Day
1:
The
Basics
  – Plugin
Structure
  – The
Registry
  – ConfiguraBon
DirecBves
  – Template
Tags
  – Objects
  – Callbacks




                                        2
                                     Page

Developing
for
Movable
Type
in
2
Days

• Day
2:
Building
User
Interfaces
  ➡ Introduc<on
to
Movable
Type
Applica<ons
  – Menus
  – New
ApplicaBon
Screens
  – Dialogs
  – LisBng
Screens
  – Transformer
Callbacks




                                                 3
                                              Page

IntroducBon
to
MT
Apps
• A
collecBon
of
features
that
manifest
in
a
coherent

  interface.
• Each
has
a
dedicated
.cgi
• Why?
   – Portability
   – OpBmizaBon




                                                         Page

Example
Apps
•   Atom
‐
Atom
Publishing
Protocol
•   CMS
‐
the
Main
MT
ApplicaBon
•   XML‐RPC
‐
RESTian
interfaces
•   Feeds
‐
AcBvity
Feeds
•   Search
‐
Blog
Side
Searching
•   Comments
‐
Comment
Processing
•   More..




                                      Page

Apps
in
the
Registry
name: Example Plugin for Movable Type
id: Example
key: Example
description: This plugin is an example plugin for Movable Type.
version: 1.0
applications:
  my_app:

 
      cgi_base:

 
      handler:

 
      methods:

 
      page_actions:

 
      list_actions:

 
      list_filters:

 
      search_apis:

 
      menus:

 
      widgets:

 
      blog_stats_tab:

 
      tags:

 
      import_formats:



                                                                  Page

Developing
for
Movable
Type
in
2
Days

• Day
2:
Building
User
Interfaces
  – IntroducBon
to
Movable
Type
ApplicaBons
  ➡ Menus
  – New
ApplicaBon
Screens
  – Dialogs
  – LisBng
Screens
  – Transformer
Callbacks




                                                 7
                                              Page

Menus




        Page

Adding
Menus
name: Example Plugin for Movable Type
id: Example
key: Example
description: This plugin is an example plugin.
version: 1.0
applications:
     cms:
          menus:
              create:video:
                  label: 'Upload Video'
                  mode: 'video_upload'
                  order: 301
                  args:
  

    
 
 
 
         '_type': quot;blogquot;
                  permission: 'manage_assets,publish_post'
                  view: blog




                                                             Page

Menu
ProperBes
•   label
•   mode
•   dialog
•   order
•   permission
•   args
•   view


                                  Page

Developing
for
Movable
Type
in
2
Days

• Day
2:
Building
User
Interfaces
  – IntroducBon
to
Movable
Type
ApplicaBons
  – Menus
  ➡ New
Applica<on
Screens
  – Dialogs
  – LisBng
Screens
  – Transformer
Callbacks




                                               11
                                              Page

CreaBng
a
New
Screen
in
the
App
•   Extending
different
apps
•   Registering
a
“mode”
•   ImplemenBng
a
Handler
•   CreaBng
a
template
•   Working
with
Templates




                                  Page

Registering
a
Mode
name: Example Plugin for Movable Type
id: Example
key: Example
description: This plugin is an example plugin.
version: 1.0
applications:
  cms:
    methods:

 
        do_something: $Example::Example::Plugin::do_something




                                                                   Page

Mode
Handlers
package Example::Plugin;
use strict;

sub plugin {
  return MT->component('Example');
}

sub some_mode {
  my $app = shift;
  my $input = $app->{query}->param('some_form_parameter');
  my $plugin = plugin();
  my $tmpl = $plugin->load_tmpl('some_template.tmpl');
  return $app->build_page( $tmpl );}
}




                                                        Page

CreaBng
a
Template
<mt:setvarblock name=quot;page_titlequot;>This is a page
  title</mt:setvarblock>
<mt:include name=quot;include/header.tmplquot;>
<p>Hello World!</p>
<mt:include name=quot;include/footer.tmplquot;>




                                                   Page

Including
Custom
Javascript
<mt:setvarblock name=quot;page_titlequot;>This is a page title</
   mt:setvarblock>
<mt:setvarblock name=quot;html_headquot; append=quot;1quot;>
<script type=quot;text/javascriptquot;>
<!--
function do_something(f) {
     alert(quot;Something!quot;);
}
// -->
</script>
</mt:setvarblock>
<mt:include name=quot;include/header.tmplquot;>




                                                           Page

Forms
<mt:setvarblock name=quot;page_titlequot;>This is a page title</mt:setvarblock>
<mt:include name=quot;include/header.tmplquot;>
<form method=quot;postquot; enctype=quot;multipart/form-dataquot; action=quot;<mt:var name=quot;script_urlquot;>quot;>
<input type=quot;hiddenquot; name=quot;__modequot; value=quot;a_modequot; />
<mt:if name=quot;blog_idquot;>
<input type=quot;hiddenquot; name=quot;blog_idquot; value=quot;<mt:var name=quot;blog_idquot;>quot; />
</mt:if>
<input type=quot;hiddenquot; name=quot;magic_tokenquot; value=quot;<mt:var name=quot;magic_tokenquot;>quot; />
<mtapp:setting
    id=quot;some_id_fieldquot;
    label=quot;Enter text herequot;
    hint=quot;Yay, text.quot;
    content_class=quot;field-content-textquot;>
    <input type=quot;textquot; name=quot;fooquot; size=quot;30quot; />
</mtapp:setting>
<mt:setvarblock name=quot;action_buttonsquot;>
    <button
         type=quot;submitquot;
         accesskey=quot;squot;
         title=quot;Continue (s)quot;
         class=quot;primary-buttonquot;>Continue</button>
</mt:setvarblock>
<mt:include name=quot;include/actions_bar.tmplquot; bar_position=quot;bottomquot; hide_pager=quot;1quot; settings_bar=quot;1quot;>
</form>
<mt:include name=quot;include/footer.tmplquot;>




                                                                                                     Page

Working
with
Variables
<mt:setvarblock name=quot;page_titlequot;>This is a page title</mt:setvarblock>
<mt:include name=quot;include/header.tmplquot;>
<p>Hello <mt:var name=quot;personquot;>!</p>
<mt:include name=quot;include/footer.tmplquot;>


sub some_mode {
  my $app = shift;
  my $input = $app->{query}->param('some_form_parameter');
  my $plugin = plugin();
  my $param = {};
  $param->{person} = quot;Byrne”;
  my $tmpl = $plugin->load_tmpl('some_template.tmpl');
  return $app->build_page( $tmpl, $param );
}




                                                                          Page

Developing
for
Movable
Type
in
2
Days

• Day
2:
Building
User
Interfaces
  – IntroducBon
to
Movable
Type
ApplicaBons
  – Menus
  – New
ApplicaBon
Screens
  ➡ Dialogs
  – LisBng
Screens
  – Transformer
Callbacks




                                               19
                                              Page

Dialogs




          Page

Dialog
Template
<mt:var name=quot;page_titlequot; value=quot;My Dialog Titlequot;>
<mt:include name=quot;dialog/header.tmplquot;>
<!-- insert your page content here -->
<mt:include name=quot;dialog/footer.tmplquot;>




                                                     Page

Dialog
Bu^ons
 <form ....>
        <!-- insert form fields here -->

 
     <div class=quot;actions-barquot;>

 
         <div class=quot;actions-bar-inner pkg actionsquot;>

 
             <button

 
                 type=quot;buttonquot;

 
                 accesskey=quot;squot;

 
                 class=quot;primary-button closequot;>Confirm</button>

 
             <button

 
                 onclick=quot;closeDialog(); return falsequot;

 
                 type=quot;submitquot;

 
                 class=quot;cancelquot;

 
                 accesskey=quot;xquot;

 
                 title=quot;Cancel (x)quot;>Cancel</button>

 
         </div>

 
     </div>

 </form>


                                                                Page

Developing
for
Movable
Type
in
2
Days

• Day
2:
Building
User
Interfaces
  – IntroducBon
to
Movable
Type
ApplicaBons
  – Menus
  – New
ApplicaBon
Screens
  – Dialogs
  ➡ Lis<ng
Screens
  – Transformer
Callbacks




                                               23
                                              Page

LisBng
Screens




                 Page

LisBng
Template
Stub

   <mt:setvar name=quot;page_titlequot; value=quot;My Listingquot;>

   <mt:setvarblock name=quot;html_headquot; append=quot;1quot;></mt:setvarblock>

   <mt:setvarblock name=quot;system_msgquot;></mt:setvarblock>
    <mt:setvarblock name=quot;related_contentquot;></mt:setvarblock>


   <mt:setvarblock name=quot;html_body_footerquot;>

       <mt:include name=quot;include/display_options.tmplquot;>

   </mt:setvarblock>


   <mt:setvarblock name=quot;action_buttonsquot;></mt:setvarblock>


   <mt:include name=quot;include/header.tmplquot;>


   <div class=quot;listing-filterquot;>

     <div class=quot;listing-filter-inner inner pkgquot;></div>

   </div>


   <mtapp:listing id=“my-table-id” type=quot;profileeventquot;

       default=quot;No events could be found.quot;

       empty_message=quot;No events could be found.quot;>

   </mtapp:listing>


   <mt:include name=quot;include/footer.tmplquot;>



                                                                    Page

LisBng
Template

   <mtapp:listing type=quot;mybojectquot;

       default=quot;No my objects could be found.quot;

       empty_message=quot;No my objects could be found.quot;>

   
       <mt:if name=quot;__first__quot;>

   
         <thead>

   
           <tr>

   
             <th class=quot;cbquot;><input type=quot;checkboxquot; id=quot;select-all-checkboxquot;

   
                name=quot;id-headquot; value=quot;allquot; class=quot;selectquot; /></th>

   
             <th>Column 1</th>

          
 <th>Column 2</th>

   
       
        <th>A Date</th>

   
           </tr>

   
         </thead>

   
         <tbody>

   
       </mt:if>

   
       <tr class=quot;<mt:if name=quot;__odd__quot;>odd<mt:else>even</mt:if>quot;>

   
         <td class=quot;cbquot;>

   
           <input type=quot;checkboxquot; name=quot;idquot;

   
               value=quot;<mt:var name=quot;idquot;>quot; class=quot;selectquot; />

   
         </td>

   
         <td><mt:var name=quot;column1quot; remove_html=quot;1quot;></td>

   
         <td><mt:var name=quot;column2quot; remove_html=quot;1quot;></td>

   
         <td><mt:var name=quot;datequot; remove_html=quot;1quot;></td>

   
       </tr>

   </mtapp:listing>




                                                                                   Page

LisBng
Handler

   sub list_profileevent {

       my $app = shift;

       my %param = @_;


       # Send the user to the dashboard if no blog ID has been provided.

       $app->return_to_dashboard( redirect => 1 ) if $app->param('blog_id');


       my %service_styles;

       my @service_styles_loop;


   
       # This anonymous subroutine will process each row of data. It takes

   
       # as input the object associated with the current row, and an empty

   
       # hash for the row that should be populated with content from the

   
       # $obj passed to it.

       my $code = sub {

            my ($obj, $row) = @_;

            $row->{'column1'} = $obj->some_property;

            $row->{'column2'} = $obj->another_property;

            my $ts = $row->{created_on};

            $row->{date} = relative_date($ts, time);

       };


   
       # %terms is used in case you want to filter the contents of the

   
       # table in someway

       my %terms = (

            author_id => $app->user->id,

       );




                                                                                  Page

LisBng
Handler

   
       # %args is used in case you want to sort or otherwise modify the

   
       # query arguments of the table

       my %args = (

           sort => 'created_on',

           direction => 'descend',

       );


   
       # %params is an addition hash of input parameters into the template

   
       # and can be used to hold an arbitrary set of name/value pairs that

   
       # can be displayed in your template.

   
       my %params = (

   
       
      some_variable => 'You can do ANYTHING in Movable Type',

   
       );


   
       # Fetch an instance of the current plugin using the plugin's key

       my $plugin = MT->component('Example');


   
       # The main work horse of your handler. This will actually conduct

   
       # the query to the database for you, populate all that is necessary

   
       # for the pagination controls and more. The query is filtered and

   
       # controlled using the %terms and %args parameters.

       $app->listing({

           type     => 'myobject', # the ID of the object in the registry

           terms    => %terms,

           args     => %args,

           listing_screen => 1,

           code     => $code,

           template => $plugin->load_tmpl('my_table.tmpl'),

           params   => %params,

       });

   }



                                                                                  Page

Developing
for
Movable
Type
in
2
Days

• Day
2:
Building
User
Interfaces
  – IntroducBon
to
Movable
Type
ApplicaBons
  – Menus
  – New
ApplicaBon
Screens
  – Dialogs
  – LisBng
Screens
  ➡ Transformer
Callbacks




                                               29
                                              Page

Transformer
Callbacks




                        Page

Callback
Types
• Transform
the
template’s
source:
  – MT::App::CMS::template_source
• Transform
the
template’s
DOM:
  – MT::App::CMS::template_param
• Transform
the
template’s
output:
  – MT::App::CMS::template_output




                                     Page

Registering
the
Callback
name: Example Plugin for Movable Type
id: Example
key: Example
description: This plugin is an example.
version: 1.0
callbacks:
    MT::App::CMS::template_source.edit_entry: 
          $Example::Example::Plugin::xfrm




                                                  Page

Regular
Express
Callback
sub my_xfrm_callback {
  my ($cb, $app, $tmpl) = @_;
  my $slug = <<END_TMPL;
A whole bunch of HTML here
END_TMPL
  $$tmpl =~ s/(<li>Utilitiesn<ul class=quot;subquot;>)/$1$slug/;
}




                                                        Page

Thank
you!

    Byrne
Reese
byrne@sixapart.com



                     Page

1 of 34

Recommended

Hacking Movable Type Training - Day 1 by
Hacking Movable Type Training - Day 1Hacking Movable Type Training - Day 1
Hacking Movable Type Training - Day 1Byrne Reese
9.3K views55 slides
Plone Interactivity by
Plone InteractivityPlone Interactivity
Plone InteractivityEric Steele
748 views194 slides
Bringing "real life" relations to Plone by
Bringing "real life" relations to PloneBringing "real life" relations to Plone
Bringing "real life" relations to PloneMassimo Azzolini
1.1K views71 slides
Plone Konferenz 2012 by
Plone Konferenz 2012Plone Konferenz 2012
Plone Konferenz 2012Massimo Azzolini
1.7K views63 slides
Joomla Template Development by
Joomla Template DevelopmentJoomla Template Development
Joomla Template DevelopmentLinda Coonen
1.8K views37 slides
Taking your Web App for a walk by
Taking your Web App for a walkTaking your Web App for a walk
Taking your Web App for a walkJens-Christian Fischer
3.5K views93 slides

More Related Content

What's hot

User Experience is dead. Long live the user experience! by
User Experience is dead. Long live the user experience!User Experience is dead. Long live the user experience!
User Experience is dead. Long live the user experience!Greg Bell
1.5K views67 slides
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces... by
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...Juliano Martins
13.7K views32 slides
Mozilla Firefox Extension Development, Course 1: Basic by
Mozilla Firefox Extension Development, Course 1: BasicMozilla Firefox Extension Development, Course 1: Basic
Mozilla Firefox Extension Development, Course 1: Basiclittlebtc
2.8K views117 slides
Essential html tweaks for accessible themes by
Essential html tweaks for accessible themesEssential html tweaks for accessible themes
Essential html tweaks for accessible themesMartin Stehle
1.2K views86 slides
Desenvolvimento Mobile Híbrido by
Desenvolvimento Mobile HíbridoDesenvolvimento Mobile Híbrido
Desenvolvimento Mobile HíbridoJuliano Martins
3.4K views43 slides
EPiServer Web Parts by
EPiServer Web PartsEPiServer Web Parts
EPiServer Web PartsEPiServer Meetup Oslo
6.4K views19 slides

What's hot(20)

User Experience is dead. Long live the user experience! by Greg Bell
User Experience is dead. Long live the user experience!User Experience is dead. Long live the user experience!
User Experience is dead. Long live the user experience!
Greg Bell1.5K views
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces... by Juliano Martins
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...
Juliano Martins13.7K views
Mozilla Firefox Extension Development, Course 1: Basic by littlebtc
Mozilla Firefox Extension Development, Course 1: BasicMozilla Firefox Extension Development, Course 1: Basic
Mozilla Firefox Extension Development, Course 1: Basic
littlebtc2.8K views
Essential html tweaks for accessible themes by Martin Stehle
Essential html tweaks for accessible themesEssential html tweaks for accessible themes
Essential html tweaks for accessible themes
Martin Stehle1.2K views
Desenvolvimento Mobile Híbrido by Juliano Martins
Desenvolvimento Mobile HíbridoDesenvolvimento Mobile Híbrido
Desenvolvimento Mobile Híbrido
Juliano Martins3.4K views
Taiwan Web Standards Talk 2011 by Zi Bin Cheah
Taiwan Web Standards Talk 2011Taiwan Web Standards Talk 2011
Taiwan Web Standards Talk 2011
Zi Bin Cheah1.4K views
关于 Html5 那点事 by Sofish Lin
关于 Html5 那点事关于 Html5 那点事
关于 Html5 那点事
Sofish Lin938 views
What's new in Rails 2? by brynary
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?
brynary6.8K views
plumbing for the next web by Ian Forrester
plumbing for the next webplumbing for the next web
plumbing for the next web
Ian Forrester1.2K views
In some simple steps, your site can stand out from the rest. Here's how... by British Council
In some simple steps, your site can stand out from the rest. Here's how... In some simple steps, your site can stand out from the rest. Here's how...
In some simple steps, your site can stand out from the rest. Here's how...
British Council757 views
Use Symfony2 components inside WordPress by Maurizio Pelizzone
Use Symfony2 components inside WordPress Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress
Maurizio Pelizzone9.5K views
[PyConZA 2017] Web Scraping: Unleash your Internet Viking by Andrew Collier
[PyConZA 2017] Web Scraping: Unleash your Internet Viking[PyConZA 2017] Web Scraping: Unleash your Internet Viking
[PyConZA 2017] Web Scraping: Unleash your Internet Viking
Andrew Collier322 views
Developers, Be a Bada$$ with WP-CLI by WP Engine
Developers, Be a Bada$$ with WP-CLIDevelopers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLI
WP Engine1.1K views
JSUG - Spring by Christoph Pickl by Christoph Pickl
JSUG - Spring by Christoph PicklJSUG - Spring by Christoph Pickl
JSUG - Spring by Christoph Pickl
Christoph Pickl639 views
Web Standards: Fueling Innovation [Web Design World Boston '08] by Aaron Gustafson
Web Standards: Fueling Innovation [Web Design World Boston '08]Web Standards: Fueling Innovation [Web Design World Boston '08]
Web Standards: Fueling Innovation [Web Design World Boston '08]
Aaron Gustafson1.5K views
The Structure of Web Code: A Case For Polymer, November 1, 2014 by Tommie Gannert
The Structure of Web Code: A Case For Polymer, November 1, 2014The Structure of Web Code: A Case For Polymer, November 1, 2014
The Structure of Web Code: A Case For Polymer, November 1, 2014
Tommie Gannert816 views
Page Caching Resurrected by Ben Scofield
Page Caching ResurrectedPage Caching Resurrected
Page Caching Resurrected
Ben Scofield4.5K views
Optaros Surf Code Camp Dispatcher by Jeff Potts
Optaros Surf Code Camp DispatcherOptaros Surf Code Camp Dispatcher
Optaros Surf Code Camp Dispatcher
Jeff Potts580 views

Viewers also liked

CIM Personal Branding 2011 #CIMbrandyou by
CIM Personal Branding 2011 #CIMbrandyouCIM Personal Branding 2011 #CIMbrandyou
CIM Personal Branding 2011 #CIMbrandyouLisa Harris
391 views34 slides
Online Communities by
Online CommunitiesOnline Communities
Online CommunitiesByrne Reese
512 views67 slides
Conference Driven Publishing by
Conference Driven PublishingConference Driven Publishing
Conference Driven PublishingDave Cross
3.2K views79 slides
Timespeople Community Features by
Timespeople Community FeaturesTimespeople Community Features
Timespeople Community FeaturesByrne Reese
482 views17 slides
Building Web Sites With Movable Type by
Building Web Sites With Movable TypeBuilding Web Sites With Movable Type
Building Web Sites With Movable TypeByrne Reese
1.5K views39 slides
Melody Designer Training by
Melody Designer TrainingMelody Designer Training
Melody Designer TrainingByrne Reese
2.9K views77 slides

Viewers also liked(6)

CIM Personal Branding 2011 #CIMbrandyou by Lisa Harris
CIM Personal Branding 2011 #CIMbrandyouCIM Personal Branding 2011 #CIMbrandyou
CIM Personal Branding 2011 #CIMbrandyou
Lisa Harris391 views
Online Communities by Byrne Reese
Online CommunitiesOnline Communities
Online Communities
Byrne Reese512 views
Conference Driven Publishing by Dave Cross
Conference Driven PublishingConference Driven Publishing
Conference Driven Publishing
Dave Cross3.2K views
Timespeople Community Features by Byrne Reese
Timespeople Community FeaturesTimespeople Community Features
Timespeople Community Features
Byrne Reese482 views
Building Web Sites With Movable Type by Byrne Reese
Building Web Sites With Movable TypeBuilding Web Sites With Movable Type
Building Web Sites With Movable Type
Byrne Reese1.5K views
Melody Designer Training by Byrne Reese
Melody Designer TrainingMelody Designer Training
Melody Designer Training
Byrne Reese2.9K views

Similar to Hacking Movable Type Training - Day 2

Blueprint talk at Open Hackday London 2009 by
Blueprint talk at Open Hackday London 2009Blueprint talk at Open Hackday London 2009
Blueprint talk at Open Hackday London 2009Ricardo Varela
1.8K views21 slides
More Secrets of JavaScript Libraries by
More Secrets of JavaScript LibrariesMore Secrets of JavaScript Libraries
More Secrets of JavaScript Librariesjeresig
14.3K views148 slides
Building Web Interface On Rails by
Building Web Interface On RailsBuilding Web Interface On Rails
Building Web Interface On RailsWen-Tien Chang
2.7K views26 slides
Yakov Fain - Design Patterns a Deep Dive by
Yakov Fain - Design Patterns a Deep DiveYakov Fain - Design Patterns a Deep Dive
Yakov Fain - Design Patterns a Deep Dive360|Conferences
562 views32 slides
Introduction To Developing Custom Actions Within SharePoint by
Introduction To Developing Custom Actions Within SharePointIntroduction To Developing Custom Actions Within SharePoint
Introduction To Developing Custom Actions Within SharePointGeoff Varosky
3.7K views37 slides
WordPress APIs by
WordPress APIsWordPress APIs
WordPress APIsJoseph Scott
1.8K views35 slides

Similar to Hacking Movable Type Training - Day 2(20)

Blueprint talk at Open Hackday London 2009 by Ricardo Varela
Blueprint talk at Open Hackday London 2009Blueprint talk at Open Hackday London 2009
Blueprint talk at Open Hackday London 2009
Ricardo Varela1.8K views
More Secrets of JavaScript Libraries by jeresig
More Secrets of JavaScript LibrariesMore Secrets of JavaScript Libraries
More Secrets of JavaScript Libraries
jeresig14.3K views
Building Web Interface On Rails by Wen-Tien Chang
Building Web Interface On RailsBuilding Web Interface On Rails
Building Web Interface On Rails
Wen-Tien Chang2.7K views
Yakov Fain - Design Patterns a Deep Dive by 360|Conferences
Yakov Fain - Design Patterns a Deep DiveYakov Fain - Design Patterns a Deep Dive
Yakov Fain - Design Patterns a Deep Dive
360|Conferences562 views
Introduction To Developing Custom Actions Within SharePoint by Geoff Varosky
Introduction To Developing Custom Actions Within SharePointIntroduction To Developing Custom Actions Within SharePoint
Introduction To Developing Custom Actions Within SharePoint
Geoff Varosky3.7K views
Using Geeklog as a Web Application Framework by Dirk Haun
Using Geeklog as a Web Application FrameworkUsing Geeklog as a Web Application Framework
Using Geeklog as a Web Application Framework
Dirk Haun894 views
OSDC 2009 Rails Turtorial by Yi-Ting Cheng
OSDC 2009 Rails TurtorialOSDC 2009 Rails Turtorial
OSDC 2009 Rails Turtorial
Yi-Ting Cheng977 views
Wai Aria - An Intro by Matt Machell
Wai Aria - An IntroWai Aria - An Intro
Wai Aria - An Intro
Matt Machell3.1K views
How Not To Code Flex Applications by jeff tapper
How Not To Code Flex ApplicationsHow Not To Code Flex Applications
How Not To Code Flex Applications
jeff tapper2.7K views
Real-World AJAX with ASP.NET by goodfriday
Real-World AJAX with ASP.NETReal-World AJAX with ASP.NET
Real-World AJAX with ASP.NET
goodfriday2.2K views
Deliverance: Plone theming without the learning curve from Plone Symposium Ea... by Jazkarta, Inc.
Deliverance: Plone theming without the learning curve from Plone Symposium Ea...Deliverance: Plone theming without the learning curve from Plone Symposium Ea...
Deliverance: Plone theming without the learning curve from Plone Symposium Ea...
Jazkarta, Inc.2.3K views
Neil Patel - What You Need to be Measuring and How to Do It by Carsonified Team
Neil Patel - What You Need to be Measuring and How to Do ItNeil Patel - What You Need to be Measuring and How to Do It
Neil Patel - What You Need to be Measuring and How to Do It
Carsonified Team2.7K views
From jQuery to App Store in 30 Minutes by edill3484
From jQuery to App Store in 30 MinutesFrom jQuery to App Store in 30 Minutes
From jQuery to App Store in 30 Minutes
edill34841.4K views
4 coding101 fewd_lesson4_j_query_and_buttons 20210105 by John Picasso
4 coding101 fewd_lesson4_j_query_and_buttons 202101054 coding101 fewd_lesson4_j_query_and_buttons 20210105
4 coding101 fewd_lesson4_j_query_and_buttons 20210105
John Picasso68 views
Pluginが広げるRailsの魅力 by Yoji Shidara
Pluginが広げるRailsの魅力Pluginが広げるRailsの魅力
Pluginが広げるRailsの魅力
Yoji Shidara2.1K views
Yahoo Mobile Widgets by Jose Palazon
Yahoo Mobile WidgetsYahoo Mobile Widgets
Yahoo Mobile Widgets
Jose Palazon562 views

Recently uploaded

virtual reality.pptx by
virtual reality.pptxvirtual reality.pptx
virtual reality.pptxG036GaikwadSnehal
14 views15 slides
Powerful Google developer tools for immediate impact! (2023-24) by
Powerful Google developer tools for immediate impact! (2023-24)Powerful Google developer tools for immediate impact! (2023-24)
Powerful Google developer tools for immediate impact! (2023-24)wesley chun
10 views38 slides
Zero to Automated in Under a Year by
Zero to Automated in Under a YearZero to Automated in Under a Year
Zero to Automated in Under a YearNetwork Automation Forum
15 views23 slides
Piloting & Scaling Successfully With Microsoft Viva by
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft VivaRichard Harbridge
12 views160 slides
Mini-Track: Challenges to Network Automation Adoption by
Mini-Track: Challenges to Network Automation AdoptionMini-Track: Challenges to Network Automation Adoption
Mini-Track: Challenges to Network Automation AdoptionNetwork Automation Forum
13 views27 slides
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveNetwork Automation Forum
34 views35 slides

Recently uploaded(20)

Powerful Google developer tools for immediate impact! (2023-24) by wesley chun
Powerful Google developer tools for immediate impact! (2023-24)Powerful Google developer tools for immediate impact! (2023-24)
Powerful Google developer tools for immediate impact! (2023-24)
wesley chun10 views
Piloting & Scaling Successfully With Microsoft Viva by Richard Harbridge
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft Viva
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Special_edition_innovator_2023.pdf by WillDavies22
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdf
WillDavies2218 views
SAP Automation Using Bar Code and FIORI.pdf by Virendra Rai, PMP
SAP Automation Using Bar Code and FIORI.pdfSAP Automation Using Bar Code and FIORI.pdf
SAP Automation Using Bar Code and FIORI.pdf
Unit 1_Lecture 2_Physical Design of IoT.pdf by StephenTec
Unit 1_Lecture 2_Physical Design of IoT.pdfUnit 1_Lecture 2_Physical Design of IoT.pdf
Unit 1_Lecture 2_Physical Design of IoT.pdf
StephenTec12 views
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors by sugiuralab
TouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective SensorsTouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective Sensors
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors
sugiuralab21 views
"Running students' code in isolation. The hard way", Yurii Holiuk by Fwdays
"Running students' code in isolation. The hard way", Yurii Holiuk "Running students' code in isolation. The hard way", Yurii Holiuk
"Running students' code in isolation. The hard way", Yurii Holiuk
Fwdays17 views
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc11 views
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf by Dr. Jimmy Schwarzkopf
STKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdfSTKI Israeli Market Study 2023   corrected forecast 2023_24 v3.pdf
STKI Israeli Market Study 2023 corrected forecast 2023_24 v3.pdf

Hacking Movable Type Training - Day 2

  • 1. Hacking
Movable
Type Day
2 A
guide
for
developers Six
Apart
Ltd. Page

  • 2. Review • Day
1:
The
Basics – Plugin
Structure – The
Registry – ConfiguraBon
DirecBves – Template
Tags – Objects – Callbacks 2 Page

  • 3. Developing
for
Movable
Type
in
2
Days • Day
2:
Building
User
Interfaces ➡ Introduc<on
to
Movable
Type
Applica<ons – Menus – New
ApplicaBon
Screens – Dialogs – LisBng
Screens – Transformer
Callbacks 3 Page

  • 4. IntroducBon
to
MT
Apps • A
collecBon
of
features
that
manifest
in
a
coherent
 interface. • Each
has
a
dedicated
.cgi • Why? – Portability – OpBmizaBon Page

  • 5. Example
Apps • Atom
‐
Atom
Publishing
Protocol • CMS
‐
the
Main
MT
ApplicaBon • XML‐RPC
‐
RESTian
interfaces • Feeds
‐
AcBvity
Feeds • Search
‐
Blog
Side
Searching • Comments
‐
Comment
Processing • More.. Page

  • 6. Apps
in
the
Registry name: Example Plugin for Movable Type id: Example key: Example description: This plugin is an example plugin for Movable Type. version: 1.0 applications: my_app: cgi_base: handler: methods: page_actions: list_actions: list_filters: search_apis: menus: widgets: blog_stats_tab: tags: import_formats: Page

  • 7. Developing
for
Movable
Type
in
2
Days • Day
2:
Building
User
Interfaces – IntroducBon
to
Movable
Type
ApplicaBons ➡ Menus – New
ApplicaBon
Screens – Dialogs – LisBng
Screens – Transformer
Callbacks 7 Page

  • 8. Menus Page

  • 9. Adding
Menus name: Example Plugin for Movable Type id: Example key: Example description: This plugin is an example plugin. version: 1.0 applications: cms: menus: create:video: label: 'Upload Video' mode: 'video_upload' order: 301 args: '_type': quot;blogquot; permission: 'manage_assets,publish_post' view: blog Page

  • 10. Menu
ProperBes • label • mode • dialog • order • permission • args • view Page

  • 11. Developing
for
Movable
Type
in
2
Days • Day
2:
Building
User
Interfaces – IntroducBon
to
Movable
Type
ApplicaBons – Menus ➡ New
Applica<on
Screens – Dialogs – LisBng
Screens – Transformer
Callbacks 11 Page

  • 12. CreaBng
a
New
Screen
in
the
App • Extending
different
apps • Registering
a
“mode” • ImplemenBng
a
Handler • CreaBng
a
template • Working
with
Templates Page

  • 13. Registering
a
Mode name: Example Plugin for Movable Type id: Example key: Example description: This plugin is an example plugin. version: 1.0 applications: cms: methods: do_something: $Example::Example::Plugin::do_something Page

  • 14. Mode
Handlers package Example::Plugin; use strict; sub plugin { return MT->component('Example'); } sub some_mode { my $app = shift; my $input = $app->{query}->param('some_form_parameter'); my $plugin = plugin(); my $tmpl = $plugin->load_tmpl('some_template.tmpl'); return $app->build_page( $tmpl );} } Page

  • 15. CreaBng
a
Template <mt:setvarblock name=quot;page_titlequot;>This is a page title</mt:setvarblock> <mt:include name=quot;include/header.tmplquot;> <p>Hello World!</p> <mt:include name=quot;include/footer.tmplquot;> Page

  • 16. Including
Custom
Javascript <mt:setvarblock name=quot;page_titlequot;>This is a page title</ mt:setvarblock> <mt:setvarblock name=quot;html_headquot; append=quot;1quot;> <script type=quot;text/javascriptquot;> <!-- function do_something(f) { alert(quot;Something!quot;); } // --> </script> </mt:setvarblock> <mt:include name=quot;include/header.tmplquot;> Page

  • 17. Forms <mt:setvarblock name=quot;page_titlequot;>This is a page title</mt:setvarblock> <mt:include name=quot;include/header.tmplquot;> <form method=quot;postquot; enctype=quot;multipart/form-dataquot; action=quot;<mt:var name=quot;script_urlquot;>quot;> <input type=quot;hiddenquot; name=quot;__modequot; value=quot;a_modequot; /> <mt:if name=quot;blog_idquot;> <input type=quot;hiddenquot; name=quot;blog_idquot; value=quot;<mt:var name=quot;blog_idquot;>quot; /> </mt:if> <input type=quot;hiddenquot; name=quot;magic_tokenquot; value=quot;<mt:var name=quot;magic_tokenquot;>quot; /> <mtapp:setting id=quot;some_id_fieldquot; label=quot;Enter text herequot; hint=quot;Yay, text.quot; content_class=quot;field-content-textquot;> <input type=quot;textquot; name=quot;fooquot; size=quot;30quot; /> </mtapp:setting> <mt:setvarblock name=quot;action_buttonsquot;> <button type=quot;submitquot; accesskey=quot;squot; title=quot;Continue (s)quot; class=quot;primary-buttonquot;>Continue</button> </mt:setvarblock> <mt:include name=quot;include/actions_bar.tmplquot; bar_position=quot;bottomquot; hide_pager=quot;1quot; settings_bar=quot;1quot;> </form> <mt:include name=quot;include/footer.tmplquot;> Page

  • 18. Working
with
Variables <mt:setvarblock name=quot;page_titlequot;>This is a page title</mt:setvarblock> <mt:include name=quot;include/header.tmplquot;> <p>Hello <mt:var name=quot;personquot;>!</p> <mt:include name=quot;include/footer.tmplquot;> sub some_mode { my $app = shift; my $input = $app->{query}->param('some_form_parameter'); my $plugin = plugin(); my $param = {}; $param->{person} = quot;Byrne”; my $tmpl = $plugin->load_tmpl('some_template.tmpl'); return $app->build_page( $tmpl, $param ); } Page

  • 19. Developing
for
Movable
Type
in
2
Days • Day
2:
Building
User
Interfaces – IntroducBon
to
Movable
Type
ApplicaBons – Menus – New
ApplicaBon
Screens ➡ Dialogs – LisBng
Screens – Transformer
Callbacks 19 Page

  • 20. Dialogs Page

  • 21. Dialog
Template <mt:var name=quot;page_titlequot; value=quot;My Dialog Titlequot;> <mt:include name=quot;dialog/header.tmplquot;> <!-- insert your page content here --> <mt:include name=quot;dialog/footer.tmplquot;> Page

  • 22. Dialog
Bu^ons <form ....> <!-- insert form fields here --> <div class=quot;actions-barquot;> <div class=quot;actions-bar-inner pkg actionsquot;> <button type=quot;buttonquot; accesskey=quot;squot; class=quot;primary-button closequot;>Confirm</button> <button onclick=quot;closeDialog(); return falsequot; type=quot;submitquot; class=quot;cancelquot; accesskey=quot;xquot; title=quot;Cancel (x)quot;>Cancel</button> </div> </div> </form> Page

  • 23. Developing
for
Movable
Type
in
2
Days • Day
2:
Building
User
Interfaces – IntroducBon
to
Movable
Type
ApplicaBons – Menus – New
ApplicaBon
Screens – Dialogs ➡ Lis<ng
Screens – Transformer
Callbacks 23 Page

  • 24. LisBng
Screens Page

  • 25. LisBng
Template
Stub <mt:setvar name=quot;page_titlequot; value=quot;My Listingquot;> <mt:setvarblock name=quot;html_headquot; append=quot;1quot;></mt:setvarblock> <mt:setvarblock name=quot;system_msgquot;></mt:setvarblock> <mt:setvarblock name=quot;related_contentquot;></mt:setvarblock> <mt:setvarblock name=quot;html_body_footerquot;> <mt:include name=quot;include/display_options.tmplquot;> </mt:setvarblock> <mt:setvarblock name=quot;action_buttonsquot;></mt:setvarblock> <mt:include name=quot;include/header.tmplquot;> <div class=quot;listing-filterquot;> <div class=quot;listing-filter-inner inner pkgquot;></div> </div> <mtapp:listing id=“my-table-id” type=quot;profileeventquot; default=quot;No events could be found.quot; empty_message=quot;No events could be found.quot;> </mtapp:listing> <mt:include name=quot;include/footer.tmplquot;> Page

  • 26. LisBng
Template <mtapp:listing type=quot;mybojectquot; default=quot;No my objects could be found.quot; empty_message=quot;No my objects could be found.quot;> <mt:if name=quot;__first__quot;> <thead> <tr> <th class=quot;cbquot;><input type=quot;checkboxquot; id=quot;select-all-checkboxquot; name=quot;id-headquot; value=quot;allquot; class=quot;selectquot; /></th> <th>Column 1</th> <th>Column 2</th> <th>A Date</th> </tr> </thead> <tbody> </mt:if> <tr class=quot;<mt:if name=quot;__odd__quot;>odd<mt:else>even</mt:if>quot;> <td class=quot;cbquot;> <input type=quot;checkboxquot; name=quot;idquot; value=quot;<mt:var name=quot;idquot;>quot; class=quot;selectquot; /> </td> <td><mt:var name=quot;column1quot; remove_html=quot;1quot;></td> <td><mt:var name=quot;column2quot; remove_html=quot;1quot;></td> <td><mt:var name=quot;datequot; remove_html=quot;1quot;></td> </tr> </mtapp:listing> Page

  • 27. LisBng
Handler sub list_profileevent { my $app = shift; my %param = @_; # Send the user to the dashboard if no blog ID has been provided. $app->return_to_dashboard( redirect => 1 ) if $app->param('blog_id'); my %service_styles; my @service_styles_loop; # This anonymous subroutine will process each row of data. It takes # as input the object associated with the current row, and an empty # hash for the row that should be populated with content from the # $obj passed to it. my $code = sub { my ($obj, $row) = @_; $row->{'column1'} = $obj->some_property; $row->{'column2'} = $obj->another_property; my $ts = $row->{created_on}; $row->{date} = relative_date($ts, time); }; # %terms is used in case you want to filter the contents of the # table in someway my %terms = ( author_id => $app->user->id, ); Page

  • 28. LisBng
Handler # %args is used in case you want to sort or otherwise modify the # query arguments of the table my %args = ( sort => 'created_on', direction => 'descend', ); # %params is an addition hash of input parameters into the template # and can be used to hold an arbitrary set of name/value pairs that # can be displayed in your template. my %params = ( some_variable => 'You can do ANYTHING in Movable Type', ); # Fetch an instance of the current plugin using the plugin's key my $plugin = MT->component('Example'); # The main work horse of your handler. This will actually conduct # the query to the database for you, populate all that is necessary # for the pagination controls and more. The query is filtered and # controlled using the %terms and %args parameters. $app->listing({ type => 'myobject', # the ID of the object in the registry terms => %terms, args => %args, listing_screen => 1, code => $code, template => $plugin->load_tmpl('my_table.tmpl'), params => %params, }); } Page

  • 29. Developing
for
Movable
Type
in
2
Days • Day
2:
Building
User
Interfaces – IntroducBon
to
Movable
Type
ApplicaBons – Menus – New
ApplicaBon
Screens – Dialogs – LisBng
Screens ➡ Transformer
Callbacks 29 Page

  • 31. Callback
Types • Transform
the
template’s
source: – MT::App::CMS::template_source • Transform
the
template’s
DOM: – MT::App::CMS::template_param • Transform
the
template’s
output: – MT::App::CMS::template_output Page

  • 32. Registering
the
Callback name: Example Plugin for Movable Type id: Example key: Example description: This plugin is an example. version: 1.0 callbacks: MT::App::CMS::template_source.edit_entry: $Example::Example::Plugin::xfrm Page

  • 33. Regular
Express
Callback sub my_xfrm_callback { my ($cb, $app, $tmpl) = @_; my $slug = <<END_TMPL; A whole bunch of HTML here END_TMPL $$tmpl =~ s/(<li>Utilitiesn<ul class=quot;subquot;>)/$1$slug/; } Page

  • 34. Thank
you! Byrne
Reese byrne@sixapart.com Page