Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
byrnereese committed Mar 26, 2010
0 parents commit dc1968a
Show file tree
Hide file tree
Showing 13 changed files with 1,500 additions and 0 deletions.
17 changes: 17 additions & 0 deletions MANIFEST.SKIP
@@ -0,0 +1,17 @@
# version control
\bCVS
(^|/)\.

# CPAN chain files
^MANIFEST
^Makefile
^META.yml$
^blib/
\#$
~$
.bak$

# packages
\.zip$
\.tar\.gz$

7 changes: 7 additions & 0 deletions Makefile.PL
@@ -0,0 +1,7 @@
use ExtUtils::MakeMaker;

WriteMakefile(
NAME => 'Theme Exporter',
VERSION => '0.1',
DISTNAME => 'ThemeExport',
);
124 changes: 124 additions & 0 deletions README.md
@@ -0,0 +1,124 @@
This plugin provides the ability to export a blog's templates as a theme.
Users can export a blog's templates in one of two ways:

* via the command line using the export-ts tool
* via the administrative interface

It should also be mentioned that this plugin also provides a simple API
for managing and configuring your own theme export if you so wish. Consult
the POD documentation for MT::Theme::Exporter, found in this plugin's
lib directory.

# Prerequisites

* Movable Type 4.x
* The perl module Archive::Zip installed

# Installation

To install this plugin follow the instructions found here:

[http://tinyurl.com/easy-plugin-install](The Ultimate Guide to Installing Movable Type Plugins)

# Usage

## Web Interface

From the Design menu select "Templates." In the sidebar under "Page Actions"
you will see a link called "Export Theme." Click this to spawn a dialog and
export a blog's templates as a theme. Then fill in the details in the dialog
that appears and when you are finished, click the Download link.

## `export-ts` Command Line Tool

A tool to export a blog's templates as a template set.

Basic Usage:

cd /PATH/TO/MT/
perl ./tools/export-ts --blog=1 --id="MyTemplateSet"

### Options

The following options are available:

#### blog

(required) The Blog ID(s) to export templates from. When more than one blog ID
is specified in a comma delimited list, the tool will output a theme for each
blog.

#### id

The ID to be used for the creation of the resulting plugin. This is also used to determine the output directory for related files.

#### name

The name to be used for the creation of the resulting plugin. This is also used to determine the output directory for related files.

#### version

The version string to be used for the creation of the resulting plugin.

#### static

The path to the directory containing your mt-static files for this template set. It must be a relative path from your mt-static folder.

#### key

The MT::PluginData key of the resulting template set.

#### verbose

Show verbose messages.

#### dryrun

When set to true, the tool will not actually do anything. Rather it will output logging
messages indicating what it would have done.

#### zip

When set to true, the tool will create a zip file of the resulting theme for you
automatically.

### Example

From the command line, one would type:

cd /PATH/TO/MT/
chmod a+x tools/export-ts
perl ./tools/export-ts --blog=1 --id=MySet --name="My Template Set" \
--version=3 --out="template-sets"

This would result in the following directories being created:

/PATH/TO/MT/template-sets/
MySet-3.0/
plugins/
MySet/
config.yaml
templates/*
mt-static/
plugins/
MySet/*

You should then be able to zip up the MySet directory or simply install as you
would install any other plugin.

Once installed you can use the "refresh blog templates" action in the sidebar of
the the Manage Templates screen (Design > Templates). Once templates are
refreshed, rebuild the blog.

# About Endevver

Endevver LLC is the premiere consulting company for Movable Type. To see a full
list of our services and plugins please visit [http://endevver.com][our web site].

# License

This plugin is licensed under the same terms as Perl itself.

# Support

For help with this plugin please visit http://endevver.tenderapp.com
78 changes: 78 additions & 0 deletions mt-static/plugins/ThemeExport/app.css
@@ -0,0 +1,78 @@
.page {
display: none;
}
.page.first {
display: block;
}

#steps {
margin-bottom: 10px;
}
#steps li {
float: left;
background: none;
color: black;
margin-right: 20px;
padding: 5px 12px 5px 7px;
}
#steps li.active {
background-color: #336699;
color: white;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
#steps li span {
color: white;
background-color: #336699;
padding: 1px 5px;
margin-right: 5px;
border-radius: 7px;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
}
#steps li.active span {
background-color: white;
color: #336699;
padding: 0px 4px;
}
#steps li,
#steps li span,
#steps li label { cursor: pointer; }

#export-pane {
display: none;
float: none;
}
#export-pane .progress {
float: none;
position: relative;
}
#export-pane .progress p.working {
background-repeat: no-repeat;
background-position: 0 0;
background-image: url(../../images/indicator.white.gif);
padding-top: 2px;
padding-left: 20px;
height: 16px;
}
#export-pane .progress a {
font-size: 1.3em;
padding-top: 8px;
background-repeat: no-repeat;
background-position: 0 0;
background-image: url(download.gif);
padding-left: 38px;
height: 33px;
display: block;
}
#export-pane #export-log {
background: white;
border: 1px solid black;
color: #222;
font-family: monospace;
width: 588px;
height: 310px;
padding: 5px 10px;
overflow: auto;
}
49 changes: 49 additions & 0 deletions mt-static/plugins/ThemeExport/app.js
@@ -0,0 +1,49 @@
var page = 1;
var response_pos = 0;
function setPage(p) {
page = p;
$('#steps li').removeClass('active');
$('.page').hide();
$('#page-' + p).show();
var step = $('#steps li.page-' + p);
step.addClass('active');
}
function interactive_export( c ) {
var responseText;
try {
responseText = c.responseText;
} catch ( e ) {
return;
}
if (!responseText) return;
var text = responseText.substr(response_pos);
text = text.replace(/\s*JSON:(.|\n)*/, '');
// strip any partial lines. we'll grab 'em next time
if (!text.match(/\n$/))
text = text.replace(/(\r?\n)[^\r\n]*$/, '$1');
response_pos += text.length;
if (!text.length) return;

text = text.replace(/\r?\n$/, '');

var lines = text.split(/\r?\n/);
var last_line;
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
var h = $('#export-log ul').append('<li>' + line + '</li>').height();
$('#export-log').scrollTo( 'max' , { 'axis' : 'y' });
}
if (last_line) {
alert("Last line: " + last_line);
//current_task.innerHTML = last_line;
}

}
$(document).ready( function() {
$('#steps li').click( function() {
var p = $(this).attr('pageid');
if (p != page) {
setPage(p);
}
});
});
Binary file added mt-static/plugins/ThemeExport/download.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions mt-static/plugins/ThemeExport/jquery.scrollTo-1.4.2-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions plugins/ThemeExport/config.yaml
@@ -0,0 +1,22 @@
id: ThemeExport
name: 'Theme Exporter'
description: "A plugin that provides a simple user interface for exporting a blog's templates into an easily distributable theme."
version: 0.1

applications:
cms:
methods:
theme_export_start: $ThemeExport::ThemeExport::Plugin::export_start
theme_export: $ThemeExport::ThemeExport::Plugin::export

page_actions:
list_templates:
export:
label: Export Theme
order: 101
dialog: 'theme_export_start'
theme_dashboard:
export:
label: Export Theme
order: 101
dialog: 'theme_export_start'

0 comments on commit dc1968a

Please sign in to comment.