[vhffs-dev] [1743] No more Template::Toolkit in repository prefs

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1743
Author:   beuss
Date:     2011-05-15 00:10:35 +0200 (Sun, 15 May 2011)
Log Message:
-----------
No more Template::Toolkit in repository prefs

Modified Paths:
--------------
    trunk/vhffs-panel/repository/prefs.pl
    trunk/vhffs-panel/templates/Makefile.am

Added Paths:
-----------
    trunk/vhffs-panel/templates/repository/prefs.tt

Removed Paths:
-------------
    trunk/vhffs-panel/templates/repository/admin.tmpl
    trunk/vhffs-panel/templates/repository/prefs.tmpl

Modified: trunk/vhffs-panel/repository/prefs.pl
===================================================================
--- trunk/vhffs-panel/repository/prefs.pl	2011-05-14 22:10:22 UTC (rev 1742)
+++ trunk/vhffs-panel/repository/prefs.pl	2011-05-14 22:10:35 UTC (rev 1743)
@@ -40,13 +40,7 @@
 
 
 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::Repository;
 
 my $panel = new Vhffs::Panel::Main();
@@ -64,21 +58,23 @@
 my $template;
 
 unless( defined $repo_name ) {
-	$template = new HTML::Template( filename => $templatedir.'/panel/misc/simplemsg.tmpl' );
-	$template->param( MESSAGE => gettext('CGI Error !') );
+    $panel->render('misc/message.tt', { message => gettext('CGI Error !') });
 } elsif( ! defined $repo ) {
-	$template = new HTML::Template( filename => $templatedir.'/panel/misc/simplemsg.tmpl' );
-	$template->param( MESSAGE => gettext('Cannot get informations on this object') );
+    $panel->render('misc/message.tt', { message => gettext('Cannot get informations on this object') });
 } elsif( !$user->can_view( $repo ) ) {
-	$template = new HTML::Template( filename => $templatedir.'/panel/misc/simplemsg.tmpl' );
-	$template->param( MESSAGE => gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' ) );
+    $panel->render('misc/message.tt', { message => gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' )} );
 } else {
     if(defined($cgi->param('update_quota_submit'))) {
         update_quota();
     }
+    my $vars = {
+        repository => $repo
+    };
+	$panel->set_title( gettext('Admin Download repository') );
+    $panel->render('repository/prefs.tt', $vars);
+
 	$template = new Vhffs::Panel::Template( filename => $templatedir."/panel/repository/prefs.tmpl" );
 
-	$panel->set_title( gettext('Admin Download repository') );
 	$template->param( TEXT_REPONAME => $repo->get_name );
 
 	$template->param( THEME => $panel->{theme} );
@@ -106,9 +102,6 @@
 	}
 }
 
-$panel->build( $template );
-$panel->display;
-
 sub update_quota {
     unless($user->is_admin()) {
         $panel->add_error( gettext('Only administrators are allowed to do this') );

Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am	2011-05-14 22:10:22 UTC (rev 1742)
+++ trunk/vhffs-panel/templates/Makefile.am	2011-05-14 22:10:35 UTC (rev 1743)
@@ -93,8 +93,6 @@
 	mysql/prefs.tmpl \
 	pgsql/create.tmpl \
 	pgsql/prefs.tmpl \
-	repository/admin.tmpl \
-	repository/prefs.tmpl \
 	git/create.tmpl \
 	git/prefs.tmpl \
 	mercurial/create.tmpl \
@@ -134,6 +132,7 @@
 	misc/welcome.tt \
 	object/delete.tt \
 	repository/create.tt \
+	repository/prefs.tt \
 	svn/create.tt \
 	svn/prefs.tt \
 	user/prefs.tt \

Deleted: trunk/vhffs-panel/templates/repository/admin.tmpl
===================================================================
--- trunk/vhffs-panel/templates/repository/admin.tmpl	2011-05-14 22:10:22 UTC (rev 1742)
+++ trunk/vhffs-panel/templates/repository/admin.tmpl	2011-05-14 22:10:35 UTC (rev 1743)
@@ -1,8 +0,0 @@
-<h2><TMPL_I18N KEY="Repository Quota"></h2>
-<form method="post" action="#">
-	<input type="hidden" name="name" value="<TMPL_VAR ESCAPE=1 NAME="TEXT_REPONAME">"/>
-    <p><label><TMPL_I18N KEY="Used Quota">:</label><TMPL_VAR ESCAPE=1 NAME="USED_QUOTA">/<TMPL_VAR ESCAPE=1 NAME="QUOTA">&nbsp;<TMPL_I18N KEY="MB"></p>
-    <p><label for="new_quota"><TMPL_I18N KEY="New Quota">:</label>
-        <input type="text" name="new_quota" id="new_quota" value="<TMPL_VAR ESCAPE=1 NAME="QUOTA">"/>&nbsp;<TMPL_I18N KEY="MB"></p>
-    <p><input type="submit" name="update_quota_submit" value="<TMPL_I18N KEY="Update Quota">"/></p>
-</form>

Deleted: trunk/vhffs-panel/templates/repository/prefs.tmpl
===================================================================
--- trunk/vhffs-panel/templates/repository/prefs.tmpl	2011-05-14 22:10:22 UTC (rev 1742)
+++ trunk/vhffs-panel/templates/repository/prefs.tmpl	2011-05-14 22:10:35 UTC (rev 1743)
@@ -1,56 +0,0 @@
-<h2><TMPL_VAR ESCAPE=1 NAME="TEXT_REPONAME"></h2>
-
-<div class="info_quota">
-    <div id="repo_quota">
-        <img src="/themes/<TMPL_VAR ESCAPE=1 NAME="THEME">/images/quota_progress.png" width="<TMPL_VAR ESCAPE=1 NAME="QUOTA_WIDTH">" alt="<TMPL_VAR ESCAPE=1 NAME="QUOTA_WIDTH">"/>
-    </div>
-    <p><TMPL_VAR ESCAPE=1 NAME="QUOTA_VALUE"></p>
-</div>
-
-<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>
-
-	<p class="button" id="buttonSendAcl">
-        <input type="hidden" name="target_oid" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_OID">" />
-        <input type="submit" value="<TMPL_VAR ESCAPE=1 NAME="ADMIN_ACL">" />
-	</p>
-</form>
-
-
-<h2><TMPL_VAR ESCAPE=1 NAME="TEXT_DELETE_REPOSITORY"></h2>
-
-<form method="post" action="delete.pl" accept-charset="utf-8">
-	<fieldset class="delete">
-		<legend>
-			<TMPL_VAR ESCAPE=1 NAME="ASK_DELETE_REPOSITORY">:
-		</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="buttonSend">
-		<input type="hidden" name="REPO_NAME" value="<TMPL_VAR ESCAPE=1 NAME="TEXT_REPONAME">" />
-		<input type="submit" value="<TMPL_VAR ESCAPE=1 NAME="TEXT_DELETE">" />
-	</p>
-</form>
-
-<TMPL_IF NAME="ADMIN">
-	<TMPL_VAR ESCAPE=0 NAME="ADMIN_PART">
-	<TMPL_INCLUDE NAME="admin.tmpl">
-</TMPL_IF>

Added: trunk/vhffs-panel/templates/repository/prefs.tt
===================================================================
--- trunk/vhffs-panel/templates/repository/prefs.tt	                        (rev 0)
+++ trunk/vhffs-panel/templates/repository/prefs.tt	2011-05-14 22:10:35 UTC (rev 1743)
@@ -0,0 +1,30 @@
+<h2>[% repository.get_name | html %]</h2>
+
+<div class="info_quota">
+    <div id="repo_quota">
+		<img src="/themes/[% theme %]/images/quota_progress.png" width="[% (repository.get_quota_used / repository.get_quota * 100) | format('%d') %]%" alt="[% (repository.get_quota_used / repository.get_quota * 100) | format('%.2f') %]%" title="[% (repository.get_quota_used / repository.get_quota * 100) | format('%.2f') %]%"/>
+    </div>
+    <p>[% 'Quota (used/total): %d/%dMB' | i18n | pretty_print(repository.get_quota_used, repository.get_quota) | html %]</p>
+</div>
+
+[% INCLUDE 'acl/form.tt' 
+    object = repository %]
+
+[% INCLUDE 'object/delete.tt'
+    type = 'repository'
+    param_name = 'REPO_NAME'
+    param_value = repository.get_name %]
+
+[% IF current_user.is_admin %]
+    [% INCLUDE 'admin/object/edit.tt' 
+        object = repository %]
+
+    <h2>[% 'Repository quota' | i18n | html %]</h2>
+    <form method="post" action="#">
+        <input type="hidden" name="name" value="[% repository.get_name | html %]"/>
+        <p><label>[% 'Space used:' | i18n | html %]</label>[% repository.get_quota_used %]/[% repository.get_quota %]&nbsp;[% 'MB' | i18n | html %]</p>
+        <p><label for="new_quota">[% 'New quota:' | i18n | html %]</label>
+            <input type="text" name="new_quota" id="new_quota" value="[% repository.get_quota %]"/>&nbsp;[% 'MB' | i18n | html %]</p>
+        <p><input type="submit" name="update_quota_submit" value="[% 'Update quota' | i18n | html %]"/></p>
+    </form>
+[% END %]


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/