Movable Type 6 Overview - New York Perl Mongers Tech Talk

43
Yuji Takayama Movable Type 6 Overview New York Perl Mongers Tech Talk / Oct 18th, 2013 131026日土曜日

description

 

Transcript of Movable Type 6 Overview - New York Perl Mongers Tech Talk

Page 1: Movable Type 6 Overview - New York Perl Mongers Tech Talk

Yuji Takayama

Movable Type 6 OverviewNew York Perl Mongers Tech Talk / Oct 18th, 2013

13年10月26日土曜日

Page 2: Movable Type 6 Overview - New York Perl Mongers Tech Talk

AGENDA

• About Me

• Six Apart is ...

• Movable Type is ...

• Movable Type 6

• Data API

• New features

• Loupe

• Panel Discussion

• Fumiaki Yoshimatsu

• Akira Sawada

• Yuji Takayama

13年10月26日土曜日

Page 3: Movable Type 6 Overview - New York Perl Mongers Tech Talk

ABOUT ME

Yuji Takayama1973, Born in Yamagata, Japan

2006, Started working at Six ApartDeveloper for Movable Type 3.2, 3.3, 4.x, 5.x and 6.0 Acted as the Engineer Lead for the development team starting from 5.1. As a Program Manager, focuses mostly on development of product specifications.

Cat LoverMy social media links are listed on the left. Feel free to follow me!

This is my second year in a row visiting New York City.

[email protected]

@yuji

yuji

swordbreaker

13年10月26日土曜日

Page 4: Movable Type 6 Overview - New York Perl Mongers Tech Talk

TitleDo you know “Six Apart”?13年10月26日土曜日

Page 5: Movable Type 6 Overview - New York Perl Mongers Tech Talk

SIX APART IS...

• 2001, Founded in San Francisco

• 2003, Open Japanese branch

• 2010, Six Apart(US) merged with Video Egg, -> Say MEDIA

• 2011, Six Apart(JP) acquired by infocom, a Japanese information technology company

• 2013, Six Apart(US) Re-brunch

• Famous Perl monger from Six Apart

13年10月26日土曜日

Page 6: Movable Type 6 Overview - New York Perl Mongers Tech Talk

Tatsuhiko Miyagawa

SIX APART ALUMNI CLUB

13年10月26日土曜日

Page 7: Movable Type 6 Overview - New York Perl Mongers Tech Talk

David Recordon

SIX APART ALUMNI CLUB

13年10月26日土曜日

Page 8: Movable Type 6 Overview - New York Perl Mongers Tech Talk

Brad Fitzpatrick

SIX APART ALUMNI CLUB

13年10月26日土曜日

Page 9: Movable Type 6 Overview - New York Perl Mongers Tech Talk

13年10月26日土曜日

Page 10: Movable Type 6 Overview - New York Perl Mongers Tech Talk

Do you know “Movable Type”?13年10月26日土曜日

Page 11: Movable Type 6 Overview - New York Perl Mongers Tech Talk

movable type13年10月26日土曜日

Page 12: Movable Type 6 Overview - New York Perl Mongers Tech Talk

12th Anniversary13年10月26日土曜日

Page 13: Movable Type 6 Overview - New York Perl Mongers Tech Talk

MOVABLE TYPE IS...

• 2001, Released Movable Type 1.0

• Perl based CMS/Blogging tool.

• Primary development team is in Tokyo with help from American and European teams

• Movable Type is available in 6 languages

• Supported a combination of both Static and Dynamic Publishing

• Source code available on Github

• Pull request Welcome!

https://github.com/movabletype/

13年10月26日土曜日

Page 14: Movable Type 6 Overview - New York Perl Mongers Tech Talk

MOVABLE TYPE IS...

• MTML (Movable Type Markup Language)

• Available Plugin mechanism that will be able to add new features, link with web services, and more

• Support multiple databases

• MySQL

• MS SQL Server, Oracle (Movable Type Advanced)

• PostgreSQL, SQLite (technical support not available)

•Windows Ready

• Windows Azure Ready

13年10月26日土曜日

Page 15: Movable Type 6 Overview - New York Perl Mongers Tech Talk

MOVABLE TYPE MARKUP LANGUAGE

• Simple template markup language

• Syntax is similar to HTML

• Learning cost is low

• High compatibility with old versions

13年10月26日土曜日

Page 16: Movable Type 6 Overview - New York Perl Mongers Tech Talk

MOVABLE TYPE MARKUP LANGUAGE

<MTBlogs> <MTEntries category=”foo” limit=”10”> <MTEntryHeader><ul> </MTEntryHeader> <li><a href=”<MTEntryPermalink>”> <MTEntryTitle> </a></li> <MTEntryFooter><ul> </MTEntryFooter> </MTEntries></MTBlogs>

13年10月26日土曜日

Page 17: Movable Type 6 Overview - New York Perl Mongers Tech Talk

MOVABLE TYPE MARKUP LANGUAGE

<MTBlogs> <MTEntries category=”foo” limit=”10”> <MTEntryHeader><ul> </MTEntryHeader> <li><a href=”<MTEntryPermalink>”> <MTEntryTitle> </a></li> <MTEntryFooter><ul> </MTEntryFooter> </MTEntries></MTBlogs>

13年10月26日土曜日

Page 18: Movable Type 6 Overview - New York Perl Mongers Tech Talk

WORDPRESS TEMPLATE

<ul> <?php $cat_id = get_cat_ID('foo'); $postslist = get_posts( "category=$cat_id&numberposts=10"); foreach ( $postslist as $post ) {?> <li><a href=<?php echo get_permalink( $post->ID ); ?>><?php echo $post->post_title; ?></a></li> <?php }?></ul>

13年10月26日土曜日

Page 19: Movable Type 6 Overview - New York Perl Mongers Tech Talk

WORDPRESS TEMPLATE

<ul> <?php $cat_id = get_cat_ID('foo'); $postslist = get_posts( "category=$cat_id&numberposts=10"); foreach ( $postslist as $post ) {?> <li><a href=<?php echo get_permalink( $post->ID ); ?>><?php echo $post->post_title; ?></a></li> <?php }?></ul>

13年10月26日土曜日

Page 20: Movable Type 6 Overview - New York Perl Mongers Tech Talk

WHICH ONE IS SIMPLEFOR NON DEVELOPER?

18

13年10月26日土曜日

Page 21: Movable Type 6 Overview - New York Perl Mongers Tech Talk

MOVABLE TYPE IS...

• Data::ObjectDriver

• Memcached

• PSGI/Plack

• OpenID

• TheSchwartz

• Perl 5.8.1+

• CGI.pm

13年10月26日土曜日

Page 22: Movable Type 6 Overview - New York Perl Mongers Tech Talk

MT::OBJECT

use MT;use MT::Entry;

my $mt = MT->new;my $e = MT::Entry->new;

$e->title(‘foo’);$e->text(‘bar’);$e->blog_id(1);

$e->save or die;

use MT;use MT::Entry;

my $mt = MT->new;my @entries = MT::Entry->load({ title => { like => ‘%foo%’ },}, { sort_by => ‘title’,});foreach my $e ( @entries ) { print $e->text;}

13年10月26日土曜日

Page 23: Movable Type 6 Overview - New York Perl Mongers Tech Talk

Oct 16th, 2013 Movable Type 6 Debut13年10月26日土曜日

Page 24: Movable Type 6 Overview - New York Perl Mongers Tech Talk

WHAT’S NEW IN MOVABLE TYPE 6

• New APIs

• Movable Type Data API

• Movable Type Chart API

•Website management improvements

• Entries can be created and posted directly on a website

• New feature for scheduled unpublish entry

• Google Analytics API integration

• Page view stats accessible on the Dashboard

• Loupe, a mobile web app

• Monitors site stats and offers basic administrative abilities

13年10月26日土曜日

Page 25: Movable Type 6 Overview - New York Perl Mongers Tech Talk

MOVABLE TYPE DATA API

• REST/JSON API

• MT Authentication

• JavaScript Library

• Pluggable

• CGI based API

13年10月26日土曜日

Page 26: Movable Type 6 Overview - New York Perl Mongers Tech Talk

MOVABLE TYPE DATA API - REST API

Create Read Update DeleteEntry P P P P

Comment P P P P

Trackback P P P

User P P

Site(Blog, Website) P

Category P

Site Statistics P

Asset P

ex) http(s)://<your-server>/<your-mt>/mt-data-api.cgi/v1/sites/2/entries

13年10月26日土曜日

Page 27: Movable Type 6 Overview - New York Perl Mongers Tech Talk

https://github.com/movabletype/Documentation/wiki/Quick-reference

13年10月26日土曜日

Page 28: Movable Type 6 Overview - New York Perl Mongers Tech Talk

curl -i http://localhost/cgi-bin/mt/mt-data-api.cgi/v1/sites/1

HTTP/1.1 200 OK

Date: Fri, 02 Aug 2013 13:12:10 GMT

Server: Apache/2.2.22 (Unix) DAV/2 PHP/5.3.15

X-content-type: nosniff

Cache-control: no-cache

Transfer-Encoding: chunked

Content-Type: application/json; charset=UTF-8

{"name":"First Website","archiveUrl":"http://localhost/blogs/20130731-1/","url":"http://localhost/blogs/20130731-1/","id":"1","class":"website","description":null}

13年10月26日土曜日

Page 29: Movable Type 6 Overview - New York Perl Mongers Tech Talk

curl -i http://localhost/cgi-bin/mt/mt-data-api.cgi/v1/users/me

HTTP/1.1 401 Authorization Required

Date: Fri, 02 Aug 2013 13:14:54 GMT

Server: Apache/2.2.22 (Unix) DAV/2 PHP/5.3.15

X-content-type: nosniff

Cache-control: no-cache

Transfer-Encoding: chunked

Content-Type: application/json; charset=UTF-8

{"error":{"code":401,"message":"Unauthorized"}}

13年10月26日土曜日

Page 30: Movable Type 6 Overview - New York Perl Mongers Tech Talk

curl -i -d clientId=test -d username=takayama -d password=password http://localhost/cgi-bin/mt/mt-data-api.cgi/v1/authentication

HTTP/1.1 200 OK

Date: Fri, 02 Aug 2013 13:20:08 GMT

Server: Apache/2.2.22 (Unix) DAV/2 PHP/5.3.15

X-content-type: nosniff

Cache-control: no-cache

Transfer-Encoding: chunked

Content-Type: application/json; charset=UTF-8

{"accessToken":"MAQgv0HhhN82CQm88aP6r0QjtYpvRtMm8cS0av7E","sessionId":"Z9STct7OztObi6Bd4aDMH8qcZBbPh6mlxpkh5yQo","expiresIn":3600,"remember":false}

13年10月26日土曜日

Page 31: Movable Type 6 Overview - New York Perl Mongers Tech Talk

curl -H "X-MT-Authorization: MTAuth accessToken=MAQgv0HhhN82CQm88aP6r0QjtYpvRtMm8cS0av7E" -i http://localhost/cgi-bin/mt/mt-data-api.cgi/v1/users/me

HTTP/1.1 200 OK

Date: Fri, 02 Aug 2013 13:31:13 GMT

Server: Apache/2.2.22 (Unix) DAV/2 PHP/5.3.15

X-content-type: nosniff

Cache-control: no-cache

Transfer-Encoding: chunked

Content-Type: application/json; charset=UTF-8

{"email":"[email protected]","userpicUrl":null,"language":"ja","url":null,"name":"takayama","updatable":true,"id":"1","displayName":"Yuji Takayama"}

13年10月26日土曜日

Page 32: Movable Type 6 Overview - New York Perl Mongers Tech Talk

curl -i http://localhost/cgi-bin/mt/mt-data-api.cgi/v1/users/1

HTTP/1.1 200 OK

Date: Fri, 02 Aug 2013 13:34:34 GMT

Server: Apache/2.2.22 (Unix) DAV/2 PHP/5.3.15

X-content-type: nosniff

Cache-control: no-cache

Transfer-Encoding: chunked

Content-Type: application/json; charset=UTF-8

{"email":"[email protected]","userpicUrl":null,"language":"ja","url":null,"updatable":false,"displayName":"Yuji Takayama"}

13年10月26日土曜日

Page 33: Movable Type 6 Overview - New York Perl Mongers Tech Talk

MOVABLE TYPE DATA API - JAVASCRIPT LIBRARY

• JavaScript library for Data API is available

• MIT license

13年10月26日土曜日

Page 34: Movable Type 6 Overview - New York Perl Mongers Tech Talk

var  api  =  new  MT.DataAPI({    baseUrl:    "https://your-­‐host/mt/mt-­‐data-­‐api.cgi",    clientId:  "your-­‐client-­‐id"});

api.listEntries(siteId,  function(response)  {    if  (response.error)  {        //  Handle  error        return;    }

   for  (var  i  =  0;  i  <  response.items.length;  i++)  {            var  entry  =  response.items[i];            //  Render  an  entry    }});

13年10月26日土曜日

Page 35: Movable Type 6 Overview - New York Perl Mongers Tech Talk

var  api  =  new  MT.DataAPI({    baseUrl:    "https://your-­‐host/mt/mt-­‐data-­‐api.cgi",    clientId:  "your-­‐client-­‐id"});

api.getToken(function(response)  {    if  (response.error)  {        if  (response.error.code  ===  401)  {            //  You  have  not  been  authenticated  yet.            location.href  =  api.getAuthorizationUrl(location.href);        }  else  {  /*  Handle  error  */  }    }  else  {        //  You  have  been  authenticated.        api.listEntries(siteId,  {status:  'Draft'},  function(response)  {            if  (response.error)  {  /*  Handle  error  */  return;  }                //  Fetched  a  list  of  drafts.            for  (var  i  =  0;  i  <  response.items.length;  i++)  {                    var  entry  =  response.items[i];                    //  Render  an  entry            }        });    }});

13年10月26日土曜日

Page 36: Movable Type 6 Overview - New York Perl Mongers Tech Talk

var  api  =  new  MT.DataAPI({    baseUrl:    "https://your-­‐host/mt/mt-­‐data-­‐api.cgi",    clientId:  "your-­‐client-­‐id"});

var  params  =  {    search:  "foo",    searchFields:  "title,body",    fields:  "assets,author,title,permalink,body,categories"};

api.listEntries(siteId,  params,  function(response)  {    if  (response.error)  {        //  Handle  error        return;    }

   for  (var  i  =  0;  i  <  response.items.length;  i++)  {            var  entry  =  response.items[i];            //  Render  an  entry    }});

13年10月26日土曜日

Page 37: Movable Type 6 Overview - New York Perl Mongers Tech Talk

https://github.com/movabletype/mt-data-api-sdk-js

13年10月26日土曜日

Page 38: Movable Type 6 Overview - New York Perl Mongers Tech Talk

MOVABLE TYPE DATA API - PLUGGABLE

• REST API endpoints can be added via plugin

• Output formats can be added via plugin (Default is JSON format)

• Create your own custom object with endpoints via plugin

13年10月26日土曜日

Page 39: Movable Type 6 Overview - New York Perl Mongers Tech Talk

YAML applications: data_api: endpoints: - id: list_foobar route: /sites/:site_id/foobars verb: GET version: 1 handler: $Core::MT::API::Endpoint::FooBar::list requires_login: 0 default_params: limit: 10 offset: 0 sort_by: authored_on sort_order: descend search_fields: title,text,text_more,keywords error_codes: 403:blah blah blah

13年10月26日土曜日

Page 40: Movable Type 6 Overview - New York Perl Mongers Tech Talk

• A reference app created with JavaScript + Movable Type Data API + Chart API

• Available for iPhone and Android

• MIT License

LOUPE - MOBILE WEB APPLICATION

https://github.com/movabletype/mt-plugin-Loupe

13年10月26日土曜日

Page 41: Movable Type 6 Overview - New York Perl Mongers Tech Talk

LOUPE - FEATURES

• Monitor your Movable Type site stats

• Today's page views

• Page views from over the past 10 days

• Comment management

• Leave responses

• Delete spam comments

• Upload image files

• Manage entries

13年10月26日土曜日

Page 42: Movable Type 6 Overview - New York Perl Mongers Tech Talk

ANY QUESTIONS?

13年10月26日土曜日

Page 43: Movable Type 6 Overview - New York Perl Mongers Tech Talk

THANK YOU FOR LISTING

13年10月26日土曜日