On Mon, 14 Jan 2013, Greg Zartman wrote: > Biggest technical change (other then CentOS 6 base) is that FormMagick is > > being gradually ripped out and replaced with new server-manager panels > > based on Mojolicious::Lite. > > > Someone finally came to their senses! :) :) > > FormMagick is a awful.
Well, yes, but so is PHP! :-) To give people an idea of host much better Mojolicious::Lite is to work with, here's one example, the shutdown/reboot panel. This is roughly 100 lines of fairly sparse perl code, and 60 lines of HTML template. [There are comment blocks in the original file, but I think they just add bulk. #!/usr/bin/perl -T # heading : Administration # description : Shutdown or reconfigure # navigation : 4000 4700 use Mitel::MSL::Mojolicious::ServerManager; sub reboot { if (system("/sbin/e-smith/signal-event", "reboot") == 0) { return 'REBOOT_SUCCEEDED'; } else { return 'REBOOT_FAILED'; } } sub shutdown { if (system("/sbin/e-smith/signal-event", "halt") == 0) { return 'SHUTDOWN_SUCCEEDED'; } else { return 'SHUTDOWN_FAILED'; } } sub reconfigure { my $retVal = 'RECONFIGURE_FAILED'; if (system("/sbin/e-smith/signal-event", "post-upgrade" ) == 0) { $retVal = reboot(); } return $retVal; } get '/' => sub { my $self = shift; $self->stash(expires => 1); $self->render('home', layout => 'server_manager'); } => 'home'; post '/' => sub { my $self = shift; my $task = $self->param('task'); $self->flash('task' => $task); $self->redirect_to('confirm'); }; get '/confirm' => sub { shift->render('confirm', layout => 'server_manager'); } => 'confirm'; post '/confirm' => sub { my $self = shift; my $answer = $self->param('answer'); my $task = lc($self->param('task')); if ($answer eq "Yes") { my $result; { no strict "refs"; $result = &$task(); } if ($result =~ m/FAILED/) { $self->flash(error => $result); } else { $self->flash(success => $result); } } $self->redirect_to('home'); }; app->start('cgi'); __DATA__ @@ home.html.ep <h1><%= _('FORM_TITLE') %></h1> <%= include 'operation_status_report' %> <form method = "post" action = "<%=url_for('/')%>" enctype = "application/x-www-form-urlencoded"> <input type="hidden" name="csrftoken" value="<%= csrftoken %>"> <table class="sme-noborders"> <tr> <td colspan="2"> <p><%= _('DESCRIPTION') %></p> </td> </tr> <tr> <td class="sme-noborders-label"><%= _('LABEL_REBOOT') %></td> <td class="sme-noborders-content"> <input type = "radio" name = "task" value = "reboot" checked /> <%= _('REBOOT') %> <br /> <input type = "radio" name = "task" value = "reconfigure" /> <%= _('RECONFIGURE') %> <br /> <input type = "radio" name = "task" value = "shutdown" /> <%= _('SHUTDOWN') %> <br /> </td> </tr> </table> <table width=100%> <tr> <th class="sme-layout"> <input type = "submit" name = "Next" value = "<%= _('PERFORM') %>" /> </th> </tr> </table> </form> @@ confirm.html.ep <h1><%= _('FORM_TITLE') %></h1> <h2><%= _('CONFIRMATION_HEADER') %></h2> <table class="sme-noborders"> <tr> <td colspan="2"> <p> %== _('CONFIRMATION_SENTENCE', {task => flash('task')}); </p> </td> </tr> </table> <form method = "post" action="<%=url_for('confirm')%>" enctype = "application/x-www-form-urlencoded"> <input type="hidden" name="csrftoken" value="<%= csrftoken %>"> <table width=100%> <tr> <th class="sme-layout"> <input type = "submit" name = "answer" value = "Yes" /> <input type = "submit" name = "answer" value = "No" /> <input type = "hidden" name = "task" value = "<%= flash('task') %>" /> </th> </tr> </table> </form> _______________________________________________ Discussion about project organisation and overall direction To unsubscribe, e-mail discussion-unsubscr...@lists.contribs.org Searchable archive at http://lists.contribs.org/mailman/public/discussion/