Changeset 200
- Timestamp:
- 02/11/07 10:12:59 (3 years ago)
- Location:
- trunk/PluginBuilder/plugins/PluginBuilder
- Files:
-
- 3 added
- 3 modified
-
lib/PluginBuilder/App.pm (modified) (3 diffs)
-
pluginbuilder.pl (modified) (1 diff)
-
tmpl/collect-metadata.tmpl (added)
-
tmpl/plugin.tmpl (added)
-
tmpl/pluginbuilder.tmpl (modified) (1 diff)
-
tmpl/readme.tmpl (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/PluginBuilder/plugins/PluginBuilder/lib/PluginBuilder/App.pm
r199 r200 1 1 # $Id$ 2 3 2 package PluginBuilder::App; 4 5 3 use strict; 6 4 use warnings; 7 8 5 our $VERSION = '0.00_4'; 9 10 6 use MT::App; 11 7 @PluginBuilder::App::ISA = 'MT::App'; … … 15 11 $app->SUPER::init(@_) or return; 16 12 $app->add_methods( show_config => \&show_config ); 13 $app->add_methods( set_metadata => \&set_metadata ); 17 14 $app->{default_mode} = 'show_config'; 18 15 $app->{requires_login} = 1; 19 20 16 return $app; 21 17 } … … 24 20 my $app = shift; 25 21 my $param = { 26 version => $VERSION, 27 user => $app->user, 28 blog => $app->blog, 22 pb_author_link => 'http://', 23 pb_author_name => $app->user->nickname || $app->user->name || $app->user->email, 24 pb_description => 'Frobnicate Whirlygigs', 25 pb_doc_link => 'http://', 26 pb_plugin_link => 'http://', 27 pb_plugin_name => 'Foo', 28 pb_plugin_version => '0.00_0', 29 plugin_version => $VERSION, 30 }; 31 $app->build_page( 'pluginbuilder.tmpl', $param ); 32 } 33 34 sub set_metadata { 35 my $app = shift; 36 my $q = $app->param; 37 my $param = { 38 have_metadata => 1, 39 pb_author_link => $q->param('pb_author_link'), 40 pb_author_name => $q->param('pb_author_name'), 41 pb_description => $q->param('pb_description'), 42 pb_doc_link => $q->param('pb_doc_link'), 43 pb_plugin_link => $q->param('pb_plugin_link'), 44 pb_plugin_name => $q->param('pb_plugin_name'), 45 pb_plugin_version => $q->param('pb_plugin_version'), 46 plugin_version => $VERSION, 29 47 }; 30 48 $app->build_page( 'pluginbuilder.tmpl', $param ); -
trunk/PluginBuilder/plugins/PluginBuilder/pluginbuilder.pl
r196 r200 2 2 # $Id$ 3 3 use strict; 4 my $PLUGIN_NAME = "PluginBuilder";5 4 require MT::Plugin; 6 5 my $plugin = MT::Plugin->new( 7 name => $PLUGIN_NAME, 8 dir_name => lc($PLUGIN_NAME), 6 author_link => 'http://www.sixapart.com/', 7 author_name => 'Gene Boggs', 8 config_link => 'mt-pluginbuilder.cgi', 9 9 description => 'Plugin Stubber', 10 config_link => 'mt-'. lc($PLUGIN_NAME). '.cgi', 10 doc_link => 'http://www.lifewiki.net/sixapart/PluginBuilder documentation', 11 name => 'PluginBuilder', 12 plugin_link => 'http://code.sixapart.com/svn/mtplugins/trunk/PluginBuilder/', 11 13 ); 12 14 return MT->add_plugin($plugin); -
trunk/PluginBuilder/plugins/PluginBuilder/tmpl/pluginbuilder.tmpl
r199 r200 1 1 <TMPL_INCLUDE NAME="header.tmpl"> 2 2 3 <h2>Plugin metadata:</h2> 4 <ul> 5 <li>Plugin name: <TMPL_VAR NAME=PLUGIN_NAME></li> 6 <li>Plugin version: <TMPL_VAR NAME=PLUGIN_VERSION></li> 7 <!-- <li>Plugin link: <TMPL_VAR NAME=PLUGIN_LINK></li> --> 8 <li>Author name: <TMPL_VAR NAME=AUTHOR_NAME></li> 9 <li>Author link: <TMPL_VAR NAME=AUTHOR_LINK></li> 10 <li>Description: <TMPL_VAR NAME=DESCRIPTION></li> 11 <!-- <li>Blog config template: <TMPL_VAR NAME=BLOG_CONFIG_TEMPLATE></li> --> 12 <li>Current blog: <TMPL_VAR NAME=BLOG></li> 13 <li>Current user: <TMPL_VAR NAME=USER></li> 14 </ul> 3 <script type="text/javascript"> 4 <!-- 5 function validate (f) { 6 /* 7 if (!is_valid_url(f.pb_author_link.value)){ 8 alert('<MT_TRANS phrase="You must set a valid Author link." escape="singlequotes">'); 9 return false; 10 } else if (!is_valid_url(f.pb_doc_link.value)){ 11 alert('<MT_TRANS phrase="You must set a valid Documentation link." escape="singlequotes">'); 12 return false; 13 } else if (!is_valid_url(f.pb_plugin_link.value)){ 14 alert('<MT_TRANS phrase="You must set a valid Plugin link." escape="singlequotes">'); 15 return false; 16 } else 17 */ 18 if (!f.pb_author_name.value){ 19 alert('<MT_TRANS phrase="You must set a valid Author name." escape="singlequotes">'); 20 return false; 21 } else if (!f.pb_description.value){ 22 alert('<MT_TRANS phrase="You must set a valid Description." escape="singlequotes">'); 23 return false; 24 } else if (!f.pb_plugin_name.value) { 25 alert('<MT_TRANS phrase="You must set your Plugin name." escape="singlequotes">'); 26 return false; 27 } else if (!f.pb_plugin_version.value) { 28 alert('<MT_TRANS phrase="You must set your Plugin version." escape="singlequotes">'); 29 return false; 30 } 31 return true; 32 } 33 function is_valid_url(url_){ 34 return url_.match( /^https?:\/\/[A-Za-z0-9!$%()=_.:,;@~-]+/ ); 35 } 36 function is_valid_path(path_){ 37 for(i = 0; i < path_.length; i++){ 38 var buf = escape(path_.substr(i, 1)); 39 if (buf.match(/^%u.*/)){ 40 return false; 41 } 42 if (buf.match(/(%.{2}){2}?/)){ 43 return false; 44 } 45 } 46 return true; 47 } 48 //--> 49 </script> 50 51 <TMPL_IF NAME=have_metadata> 52 53 <TMPL_INCLUDE NAME="readme.tmpl"> 54 <hr/> 55 <TMPL_INCLUDE NAME="plugin.tmpl"> 56 57 <TMPL_ELSE> 58 59 <TMPL_INCLUDE NAME="collect-metadata.tmpl"> 60 61 </TMPL_IF> 15 62 16 63 <hr/> 17 64 <p> 18 <MT_TRANS phrase="PluginBuilder"> version <TMPL_VAR NAME=VERSION> 19 <br/> 20 Please see the 21 <a href="http://www.lifewiki.net/sixapart/PluginBuilder">PluginBuilder documentation</a>. 65 <a href="http://www.lifewiki.net/sixapart/PluginBuilder"><MT_TRANS phrase="PluginBuilder"></a> 66 version <TMPL_VAR NAME=PLUGIN_VERSION> 22 67 </p> 23 68
