[vhffs-dev] [1738] Use common template for object deletion. |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1738
Author: beuss
Date: 2011-05-14 22:59:45 +0200 (Sat, 14 May 2011)
Log Message:
-----------
Use common template for object deletion.
Modified Paths:
--------------
trunk/vhffs-panel/templates/Makefile.am
trunk/vhffs-panel/templates/group/prefs.tt
trunk/vhffs-panel/templates/svn/prefs.tt
trunk/vhffs-panel/templates/web/prefs.tt
Added Paths:
-----------
trunk/vhffs-panel/templates/object/
trunk/vhffs-panel/templates/object/delete.tt
Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am 2011-05-14 20:29:29 UTC (rev 1737)
+++ trunk/vhffs-panel/templates/Makefile.am 2011-05-14 20:59:45 UTC (rev 1738)
@@ -133,6 +133,7 @@
misc/message.tt \
misc/service-index.tt \
misc/welcome.tt \
+ object/delete.tt \
svn/create.tt \
svn/prefs.tt \
user/prefs.tt \
Modified: trunk/vhffs-panel/templates/group/prefs.tt
===================================================================
--- trunk/vhffs-panel/templates/group/prefs.tt 2011-05-14 20:29:29 UTC (rev 1737)
+++ trunk/vhffs-panel/templates/group/prefs.tt 2011-05-14 20:59:45 UTC (rev 1738)
@@ -102,36 +102,11 @@
[% INCLUDE 'acl/form.tt'
object = group %]
-<h2>[% 'Delete this project' | i18n | html %]</h2>
+[% INCLUDE 'object/delete.tt'
+ type = 'group'
+ param_name = 'group'
+ param_value = group.get_groupname %]
-<form method="post" action="delete.pl" accept-charset="utf-8">
- <fieldset class="delete">
- <legend>
- [% 'Are you SURE you want DELETE this project ?' | i18n | html %]
- </legend>
-
- <p class="warning">[% 'This action is non-reversible. All services associated to this project 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 prefer to keep this project.' | 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="group" value="[% group.get_groupname %]" />
- <input type="submit" value="[% 'Delete' | i18n | html %]" />
- </p>
-
-</form>
-
[% IF current_user.is_admin() %]
[% INCLUDE 'admin/object/edit.tt'
object = group %]
Added: trunk/vhffs-panel/templates/object/delete.tt
===================================================================
--- trunk/vhffs-panel/templates/object/delete.tt (rev 0)
+++ trunk/vhffs-panel/templates/object/delete.tt 2011-05-14 20:59:45 UTC (rev 1738)
@@ -0,0 +1,38 @@
+[%# Provides delete form for any object, need the following parameters:
+ - type: type of object, used to generate URLs
+ - param_name: name of the hidden field that will be created to
+ contain param_value
+ - param_value: value to put in the hidden field (object id or unique key)
+%]
+<h2>[% 'Delete this object' | i18n | html %]</h2>
+
+<form method="post" action="/[% type %]/delete.pl" accept-charset="utf-8">
+ <fieldset class="delete">
+ <legend>
+ [% 'Are you SURE you want DELETE this object?' | i18n | html %]
+ </legend>
+
+ <p class="warning">[% 'This action is non-reversible. The object will be physically destroyed and deleted from the database, there is no way to recover your data.' | i18n | html %]</p>
+[% IF type == 'group' %]
+ <p class="warning">[% 'Moreover all associated services will be DESTROYED' | i18n | html %]</p>
+[% END %]
+ <p>
+ <input type="radio" name="DELETE" id="DELETE_NO" value="0" checked="checked" />
+ <label for="DELETE_NO">
+ [% 'No, I\'m not sure, I prefer to keep this object. All these warnings scare me' | 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, I do not know the fear' | i18n | html %]
+ </label>
+ </p>
+ </fieldset>
+
+ <p class="button" id="buttonDelete">
+ <input type="hidden" name="[% param_name | html %]" value="[% param_value | html %]" />
+ <input type="submit" value="[% 'Delete' | i18n | html %]" />
+ </p>
+
+</form>
Modified: trunk/vhffs-panel/templates/svn/prefs.tt
===================================================================
--- trunk/vhffs-panel/templates/svn/prefs.tt 2011-05-14 20:29:29 UTC (rev 1737)
+++ trunk/vhffs-panel/templates/svn/prefs.tt 2011-05-14 20:59:45 UTC (rev 1738)
@@ -23,31 +23,10 @@
[% INCLUDE 'acl/form.tt'
object = repository %]
-<h2>[% 'Delete this repository' | i18n | html %]</h2>
+[% INCLUDE 'object/delete.tt'
+ type = 'svn'
+ param_name = 'name'
+ param_value = repository.get_reponame %]
-<form method="post" action="/svn/delete.pl" accept-charset="utf-8">
- <fieldset class="delete">
- <legend>[% 'Are you SURE you want DELETE this subversion repository?' | i18n | html %]</legend>
- <p class="warning">[% 'This action is non-reversible. This subversion repository 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 this repository' | 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="[% repository.get_reponame %]" />
- <input type="submit" value="[% 'Delete' | i18n | html %]" />
- </p>
-
-</form>
[% INCLUDE 'admin/object/edit.tt'
object = repository %]
Modified: trunk/vhffs-panel/templates/web/prefs.tt
===================================================================
--- trunk/vhffs-panel/templates/web/prefs.tt 2011-05-14 20:29:29 UTC (rev 1737)
+++ trunk/vhffs-panel/templates/web/prefs.tt 2011-05-14 20:59:45 UTC (rev 1738)
@@ -21,29 +21,11 @@
[% INCLUDE 'acl/form.tt'
object = web %]
-<h2>[% 'Delete this web area' | i18n | html %]</h2>
+[% INCLUDE 'object/delete.tt'
+ type = 'web'
+ param_name = 'name'
+ param_value = web.get_servername %]
-<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 %]