[vhffs-dev] [1729] web/prefs.pl uses Template::Toolkit. |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1729
Author: beuss
Date: 2011-05-14 13:13:41 +0200 (Sat, 14 May 2011)
Log Message:
-----------
web/prefs.pl uses Template::Toolkit.
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Panel/Main.pm
trunk/vhffs-panel/templates/Makefile.am
trunk/vhffs-panel/web/prefs.pl
Added Paths:
-----------
trunk/vhffs-panel/templates/web/prefs.tt
Removed Paths:
-------------
trunk/vhffs-panel/templates/web/prefs.tmpl
Modified: trunk/vhffs-api/src/Vhffs/Panel/Main.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Main.pm 2011-05-14 11:13:35 UTC (rev 1728)
+++ trunk/vhffs-api/src/Vhffs/Panel/Main.pm 2011-05-14 11:13:41 UTC (rev 1729)
@@ -747,7 +747,7 @@
mercurial => 'Mercurial repositories',
bazaar => 'Bazaar repositories',
web => 'Webareas',
- cron => 'Cron jobs',
+ cron => 'Cron jobs',
);
my $vhffs = $panel->{'vhffs'};
Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am 2011-05-14 11:13:35 UTC (rev 1728)
+++ trunk/vhffs-panel/templates/Makefile.am 2011-05-14 11:13:41 UTC (rev 1729)
@@ -109,7 +109,6 @@
bazaar/prefs.tmpl \
bazaar/user_part.tmpl \
web/mailuser.tmpl \
- web/prefs.tmpl \
cron/create.tmpl \
cron/prefs.tmpl \
acl/view.tt \
@@ -141,4 +140,5 @@
misc/service-index.tt \
misc/welcome.tt \
user/prefs.tt \
- web/create.tt
+ web/create.tt \
+ web/prefs.tt
Deleted: trunk/vhffs-panel/templates/web/prefs.tmpl
===================================================================
--- trunk/vhffs-panel/templates/web/prefs.tmpl 2011-05-14 11:13:35 UTC (rev 1728)
+++ trunk/vhffs-panel/templates/web/prefs.tmpl 2011-05-14 11:13:41 UTC (rev 1729)
@@ -1,68 +0,0 @@
-<h1><TMPL_VAR ESCAPE=1 NAME="TEXT_TITLE"></h1>
-
-<form method="post" action="/web/prefs.pl" accept-charset="utf-8">
- <p>
- <label>
- <TMPL_VAR ESCAPE=1 NAME="TEXT_SERVERNAME"> :
- </label>
- <TMPL_VAR ESCAPE=1 NAME="VALUE_SERVERNAME">
- <input type="hidden" name="name" id="name" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_SERVERNAME">" />
- </p>
-
- <p>
- <label>
- <TMPL_VAR ESCAPE=1 NAME="TEXT_DESCRIPTION"> :
- </label>
- <textarea name="description" id="description" cols="45" rows="7"><TMPL_VAR ESCAPE=1 NAME="VALUE_DESCRIPTION"></textarea>
- </p>
-
- <p class="button">
- <input value="<TMPL_VAR ESCAPE=1 NAME="TEXT_SEND">" type="submit"
- name="save_prefs_submit"/>
- </p>
-
-</form>
-
-<h2><TMPL_VAR ESCAPE=1 NAME="TEXT_ACL_ADMIN"></h2>
-
-<form method="post" action="../acl/view.pl" accept-charset="utf-8">
- <p><TMPL_VAR ESCAPE=1 NAME="EXPLAIN_ADMIN_ACL"></p>
-
- <input type="hidden" name="target_oid" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_OID">" />
- <p class="button" id="buttonAclAdmin">
- <input type="submit" value="<TMPL_VAR ESCAPE=1 NAME="ADMIN_ACL">" />
- </p>
-</form>
-
-<h2><TMPL_VAR ESCAPE=1 NAME="TEXT_DELETE_WEB"></h2>
-
-<form method="post" action="/web/delete.pl" accept-charset="utf-8">
- <fieldset class="delete">
- <legend>
- <TMPL_VAR ESCAPE=1 NAME="ASK_DELETE_WEB">:
- </legend>
-
- <p class="warning"><TMPL_VAR ESCAPE=1 NAME="TEXT_BEFORE_DELETE"></p>
- <p>
- <input type="radio" name="DELETE" id="DELETE_NO" value="0" checked="checked" />
- <label for="DELETE_NO">
- <TMPL_VAR ESCAPE=1 NAME="NO">
- </label>
- </p>
- <p>
- <input type="radio" name="DELETE" id="DELETE_YES" value="1" />
- <label for="DELETE_YES">
- <TMPL_VAR ESCAPE=1 NAME="YES">
- </label>
- </p>
- </fieldset>
-
- <p class="button" id="buttonDelete">
- <input type="hidden" name="name" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_SERVERNAME">" />
- <input type="submit" value="<TMPL_VAR ESCAPE=1 NAME="TEXT_DELETE">" />
- </p>
-
-</form>
-
-
-<TMPL_VAR ESCAPE=0 NAME="ADMIN_PART">
Added: trunk/vhffs-panel/templates/web/prefs.tt
===================================================================
--- trunk/vhffs-panel/templates/web/prefs.tt (rev 0)
+++ trunk/vhffs-panel/templates/web/prefs.tt 2011-05-14 11:13:41 UTC (rev 1729)
@@ -0,0 +1,58 @@
+<h1>[% 'Web area administration' | i18n | html %]</h1>
+
+<form method="post" action="/web/prefs.pl" accept-charset="utf-8">
+ <p>
+ <label>[% 'Address (Servername):' | i18n | html %]</label>
+ [% web.get_servername | html %]
+ <input type="hidden" name="name" id="name" value="[% web.get_servername | html %]" />
+ </p>
+ <p>
+ <label>[% 'Description of your web area:' | i18n | html %]
+ </label>
+ <textarea name="description" id="description" cols="45" rows="7">[% web.get_description | html %]</textarea>
+ </p>
+
+ <p class="button">
+ <input value="[% 'Update' | i18n | html %]" type="submit" name="save_prefs_submit"/>
+ </p>
+
+</form>
+
+<h2>[% 'Admin Rights on this object (ACL)' | i18n | html %]</h2>
+
+<form method="post" action="../acl/view.pl" accept-charset="utf-8">
+ <p>[% 'You can Manage rights on this service for each user in the VHFFS database. Please read help before modifying anything.' | i18n | html %]</p>
+
+ <input type="hidden" name="target_oid" value="[% web.get_oid %]" />
+ <p class="button" id="buttonAclAdmin">
+ <input type="submit" value="[% 'Ok, go to ACL admin' | i18n | html %]" />
+ </p>
+</form>
+
+<h2>[% 'Delete this web area' | i18n | html %]</h2>
+
+<form method="post" action="/web/delete.pl" accept-charset="utf-8">
+ <fieldset class="delete">
+ <legend>[% 'Are you SURE you want DELETE this Web Area?' | i18n | html %]</legend>
+
+ <p class="warning">[% 'This action is non-reversible. This web area will be DESTROYED.' | i18n | html %]</p>
+ <p>
+ <input type="radio" name="DELETE" id="DELETE_NO" value="0" checked="checked" />
+ <label for="DELETE_NO">[% 'No, I\'m not sure, I\'d prefer to keep it.' | i18n | html %]</label>
+ </p>
+ <p>
+ <input type="radio" name="DELETE" id="DELETE_YES" value="1" />
+ <label for="DELETE_YES">[% 'Yes I\'m sure of what I do' | i18n | html %]</label>
+ </p>
+ </fieldset>
+
+ <p class="button" id="buttonDelete">
+ <input type="hidden" name="name" value="[% web.get_servername | html %]" />
+ <input type="submit" value="[% 'Delete' %]" />
+ </p>
+</form>
+
+[% IF current_user.is_admin %]
+ [% INCLUDE 'admin/object/edit.tt'
+ object = web %]
+[% END %]
Modified: trunk/vhffs-panel/web/prefs.pl
===================================================================
--- trunk/vhffs-panel/web/prefs.pl 2011-05-14 11:13:35 UTC (rev 1728)
+++ trunk/vhffs-panel/web/prefs.pl 2011-05-14 11:13:41 UTC (rev 1729)
@@ -32,7 +32,6 @@
use strict;
use utf8;
use POSIX qw(locale_h);
-use HTML::Template;
use locale;
use Locale::gettext;
use CGI;
@@ -40,15 +39,9 @@
use Encode;
use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
-use Vhffs::Group;
use Vhffs::Main;
use Vhffs::Panel::Main;
-use Vhffs::Panel::Menu;
-use Vhffs::Panel::Object;
-use Vhffs::Panel::Template;
use Vhffs::Services::Web;
-use Vhffs::Acl;
use Vhffs::Constants;
my $panel = new Vhffs::Panel::Main();
@@ -60,62 +53,26 @@
my $user = $panel->{'user'};
my $cgi = $panel->{'cgi'};
my $servername = $cgi->param("name");
-my $template;
-my $templatedir = $vhffs->get_config->get_templatedir;
my $web = Vhffs::Services::Web::get_by_servername( $vhffs , $servername );
if( ! defined($web) ) {
+ $panel->render('misc/message.tt', { message => gettext( "Cannot get informations on this object") } );;
- $template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
- my $message = gettext( "Cannot get informations on this object");
- $template->param( MESSAGE => $message );
-
} elsif( $web->get_status != Vhffs::Constants::ACTIVATED ) {
-
- $template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
- my $message = gettext( "This object is not functionnal yet. Please wait creation or moderation.");
- $template->param( MESSAGE => $message );
+ $panel->render('misc/message.tt', { message => gettext( "This object is not functionnal yet. Please wait creation or moderation.") } );
} elsif( !$user->can_view($web) ) {
- $template = new HTML::Template( filename => $templatedir."/panel/misc/simplemsg.tmpl" );
- my $message = gettext("You're not allowed to do this (ACL rights)");
- $template->param( MESSAGE => $message );
+ $panel->render('misc/message.tt', { message => gettext("You're not allowed to do this (ACL rights)") } );
} else {
-
if(defined($cgi->param('save_prefs_submit'))) {
save_prefs();
}
- $template = new Vhffs::Panel::Template( filename => $templatedir."/panel/web/prefs.tmpl" );
-
- $template->param( TEXT_TITLE => gettext("Web Area Administration") );
-
- $template->param( TEXT_SERVERNAME => gettext("Address (Servername)") );
- $template->param( VALUE_SERVERNAME => $web->get_servername );
-
- #Show the current description
- $template->param( TEXT_DESCRIPTION => gettext("Description of your webarea") );
- $template->param( VALUE_DESCRIPTION => $web->get_description );
- $template->param( TEXT_SEND => gettext("Modify") );
-
- $template->param( TEXT_ACL_ADMIN => gettext("Admin Rights on this object (ACL)") );
- $template->param( EXPLAIN_ADMIN_ACL => gettext("You can Manage rights on this service for each user in the VHFFS database. Please read help before manage it.") );
- $template->param( ADMIN_ACL => gettext("Ok, go to ACL admin") );
- $template->param( VALUE_OID => $web->get_oid );
-
- $template->param( TEXT_DELETE_WEB => gettext("Delete this web area") );
- $template->param( TEXT_BEFORE_DELETE => gettext("This action is non-reversible. This web area will be DESTROYED.") );
- $template->param( ASK_DELETE_WEB => gettext("Are you SURE you want DELETE this Web Area ?") );
- $template->param( YES => gettext("Yes I'm sure of what I do") );
- $template->param( NO => gettext("No, I'm not sure, I prefer to keep it.") );
- $template->param( TEXT_DELETE => gettext("Delete") );
-
- my $adminpart = Vhffs::Panel::Object::admin_part( $panel, $web );
- $template->param( ADMIN_PART => $adminpart->output ) if( defined $adminpart );
+ my $vars = {
+ web => $web
+ };
+ $panel->render('web/prefs.tt', $vars);
}
-$panel->build( $template );
-$panel->display;
-
sub save_prefs {
my $description = Encode::decode_utf8( $cgi->param('description') );
if(!$user->can_modify($web)) {