[vhffs-dev] [1719] Converted user prefs to Template::Toolkit. |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1719
Author: beuss
Date: 2011-05-14 10:13:01 +0200 (Sat, 14 May 2011)
Log Message:
-----------
Converted user prefs to Template::Toolkit.
What a mess...
Modified Paths:
--------------
trunk/vhffs-panel/templates/Makefile.am
trunk/vhffs-panel/user/prefs.pl
Added Paths:
-----------
trunk/vhffs-panel/templates/user/prefs.tt
Removed Paths:
-------------
trunk/vhffs-panel/templates/user/admin.tmpl
trunk/vhffs-panel/templates/user/ircnick.tmpl
trunk/vhffs-panel/templates/user/mailuser.tmpl
trunk/vhffs-panel/templates/user/mailuserspam.tmpl
trunk/vhffs-panel/templates/user/mailuservirus.tmpl
trunk/vhffs-panel/templates/user/prefs.tmpl
trunk/vhffs-panel/templates/user/prefs_avatar.tmpl
Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am 2011-05-14 08:12:54 UTC (rev 1718)
+++ trunk/vhffs-panel/templates/Makefile.am 2011-05-14 08:13:01 UTC (rev 1719)
@@ -109,13 +109,6 @@
bazaar/create.tmpl \
bazaar/prefs.tmpl \
bazaar/user_part.tmpl \
- user/admin.tmpl \
- user/ircnick.tmpl \
- user/mailuserspam.tmpl \
- user/mailuser.tmpl \
- user/mailuservirus.tmpl \
- user/prefs_avatar.tmpl \
- user/prefs.tmpl \
web/create.tmpl \
web/mailuser.tmpl \
web/prefs.tmpl \
@@ -147,4 +140,5 @@
misc/languages.tt \
misc/message.tt \
misc/service-index.tt \
- misc/welcome.tt
+ misc/welcome.tt \
+ user/prefs.tt
Deleted: trunk/vhffs-panel/templates/user/admin.tmpl
===================================================================
--- trunk/vhffs-panel/templates/user/admin.tmpl 2011-05-14 08:12:54 UTC (rev 1718)
+++ trunk/vhffs-panel/templates/user/admin.tmpl 2011-05-14 08:13:01 UTC (rev 1719)
@@ -1,12 +0,0 @@
-<h2><TMPL_I18N KEY="User's Permissions"></h2>
-<form method="post" action="#">
- <input type="hidden" name="name" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_USERNAME">"/>
- <p><label for="user_permissions"><TMPL_I18N KEY="User's permissions">:</label>
- <select name="permissions" id="user_permissions">
- <option value="<TMPL_VAR ESCAPE=1 NAME="USER_NORMAL">" <TMPL_IF EXPR="PERMISSIONS == USER_NORMAL">selected="selected"</TMPL_IF>><TMPL_I18N KEY="Normal"></option>
- <option value="<TMPL_VAR ESCAPE=1 NAME="USER_MODERATOR">" <TMPL_IF EXPR="PERMISSIONS == USER_MODERATOR">selected="selected"</TMPL_IF>><TMPL_I18N KEY="Moderator"></option>
- <option value="<TMPL_VAR ESCAPE=1 NAME="USER_ADMIN">" <TMPL_IF EXPR="PERMISSIONS == USER_ADMIN">selected="selected"</TMPL_IF>><TMPL_I18N KEY="Administrator"></option>
- </select>
- </p>
- <p><input type="submit" name="update_permissions_submit" value="<TMPL_I18N KEY="Update Permissions">"/></p>
-</form>
Deleted: trunk/vhffs-panel/templates/user/ircnick.tmpl
===================================================================
--- trunk/vhffs-panel/templates/user/ircnick.tmpl 2011-05-14 08:12:54 UTC (rev 1718)
+++ trunk/vhffs-panel/templates/user/ircnick.tmpl 2011-05-14 08:13:01 UTC (rev 1719)
@@ -1,8 +0,0 @@
-<h2><TMPL_I18N KEY="IRC nick"></h2>
-<form method="post" action="#">
- <input type="hidden" name="name" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_USERNAME">"/>
- <p><label for="user_ircnick"><TMPL_VAR ESCAPE=1 NAME="TEXT_IRCNICK"> :</label>
- <input name="ircnick" id="user_ircnick" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_IRCNICK">" type="text" />
- </p>
- <p><input type="submit" name="update_ircnick_submit" value="<TMPL_I18N KEY="Update IRC nick">"/></p>
-</form>
Deleted: trunk/vhffs-panel/templates/user/mailuser.tmpl
===================================================================
--- trunk/vhffs-panel/templates/user/mailuser.tmpl 2011-05-14 08:12:54 UTC (rev 1718)
+++ trunk/vhffs-panel/templates/user/mailuser.tmpl 2011-05-14 08:13:01 UTC (rev 1719)
@@ -1,40 +0,0 @@
- <fieldset id="chooseMailMode">
- <legend>
- <TMPL_VAR ESCAPE=1 NAME="TEXT_LEGEND">
- </legend>
-
- <tmpl_unless name="STATUSSTR">
-
- <p>
- <input name="mail_activate" id="mail_activate" class="labeled"
- type="checkbox"
- <TMPL_IF NAME="ACTIV_CHECKED">checked="checked"</TMPL_IF>
- onchange="javascript:Element.toggle('mail_prefs');"/>
- <label for="mail_activate"><TMPL_VAR ESCAPE=1 NAME="TEXT_MAILACTIV"></label>
- </p>
- <div id="mail_prefs"<tmpl_unless name="ACTIV_CHECKED">style="display:none"</tmpl_unless>>
- <p><TMPL_VAR ESCAPE=1 NAME="TEXT_MAILINFO2"></p>
-
- <p>
- <input name="mail_usage" id="mail_usage_box" value="1" type="radio"
- class="labeled" <TMPL_IF NAME="POP_CHECKED">checked="checked"</TMPL_IF>
- onchange="javascript:document.getElementById('mbox_options').style.display='';"/>
- <label for="mail_usage_box" ><TMPL_VAR ESCAPE=0 NAME="TEXT_MAILBOX"></label>
- </p>
- <div id="mbox_options" <tmpl_unless name="POP_CHECKED">style="display:none"</tmpl_unless>>
-<TMPL_VAR ESCAPE=0 NAME="MAILUSER_OPTIONS">
- </div>
- <p>
- <input name="mail_usage"
- id="mail_usage_foward" value="2" class="labeled"
- type="radio" <TMPL_IF NAME="FWD_CHECKED">checked="checked"</TMPL_IF>
- onchange="javascript:document.getElementById('mbox_options').style.display='none';" />
- <label for="mail_usage_foward"><TMPL_VAR ESCAPE=1 NAME="TEXT_MAILFORWARD"></label>
- </p>
- </div>
-
-
- <tmpl_else>
- <TMPL_VAR ESCAPE=1 NAME="STATUSSTR">
- </tmpl_unless>
- </fieldset>
Deleted: trunk/vhffs-panel/templates/user/mailuserspam.tmpl
===================================================================
--- trunk/vhffs-panel/templates/user/mailuserspam.tmpl 2011-05-14 08:12:54 UTC (rev 1718)
+++ trunk/vhffs-panel/templates/user/mailuserspam.tmpl 2011-05-14 08:13:01 UTC (rev 1719)
@@ -1,3 +0,0 @@
-<p><input name="mail_nospam" id="mail_nospam" type="checkbox"
- class="labeled" <TMPL_VAR ESCAPE=1 NAME="ACTIV_CHECKED">/>
- <label for="mail_nospam"><TMPL_VAR ESCAPE=1 NAME="TEXT_NOSPAM"></label></p>
Deleted: trunk/vhffs-panel/templates/user/mailuservirus.tmpl
===================================================================
--- trunk/vhffs-panel/templates/user/mailuservirus.tmpl 2011-05-14 08:12:54 UTC (rev 1718)
+++ trunk/vhffs-panel/templates/user/mailuservirus.tmpl 2011-05-14 08:13:01 UTC (rev 1719)
@@ -1,3 +0,0 @@
-<p><input name="mail_novirus" id="mail_novirus" type="checkbox"
- class="labeled" <TMPL_VAR ESCAPE=1 NAME="ACTIV_CHECKED">/>
- <label for="mail_novirus"><TMPL_VAR ESCAPE=1 NAME="TEXT_VIRUS"></label></p>
Deleted: trunk/vhffs-panel/templates/user/prefs.tmpl
===================================================================
--- trunk/vhffs-panel/templates/user/prefs.tmpl 2011-05-14 08:12:54 UTC (rev 1718)
+++ trunk/vhffs-panel/templates/user/prefs.tmpl 2011-05-14 08:13:01 UTC (rev 1719)
@@ -1,125 +0,0 @@
-
- <form method="post" action="/user/prefs.pl" accept-charset="utf-8">
- <p>
- <label><TMPL_VAR ESCAPE=1 NAME="TEXT_USERNAME"> :</label>
- <span class="formInput"><TMPL_VAR ESCAPE=1 NAME="VALUE_USERNAME"></span>
- </p>
-
- <p>
- <label for="FIRSTNAME"><TMPL_VAR ESCAPE=1 NAME="TEXT_FIRSTNAME"> :</label>
- <input name="FIRSTNAME" id="FIRSTNAME" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_FIRSTNAME">" type="text" />
- </p>
-
- <p>
- <label for="LASTNAME"><TMPL_VAR ESCAPE=1 NAME="TEXT_LASTNAME"> :</label>
- <input name="LASTNAME" id="LASTNAME" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_LASTNAME">" type="text" />
- </p>
-
- <p>
- <label for="MAIL"><TMPL_VAR ESCAPE=1 NAME="TEXT_MAIL"> :</label>
- <input name="MAIL" id="MAIL" maxlength="200" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_MAIL">" type="text" />
- </p>
-
- <p>
- <label for="ADDRESS"><TMPL_VAR ESCAPE=1 NAME="TEXT_ADDRESS"> :</label>
- <input name="ADDRESS" id="ADDRESS" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_ADDRESS">" type="text" />
- </p>
-
- <p>
- <label for="CITY"><TMPL_VAR ESCAPE=1 NAME="TEXT_CITY"> :</label>
- <input name="CITY" id="CITY" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_CITY">" type="text" />
- </p>
-
- <p>
- <label for="ZIPCODE"><TMPL_VAR ESCAPE=1 NAME="TEXT_ZIPCODE"> :</label>
- <input name="ZIPCODE" id="ZIPCODE" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_ZIPCODE">" type="text" />
- </p>
-
- <p>
- <label for="COUNTRY"><TMPL_VAR ESCAPE=1 NAME="TEXT_COUNTRY"> :</label>
- <input name="COUNTRY" id="COUNTRY" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_COUNTRY">" type="text" />
- </p>
-
- <p>
- <label for="PASSWORD1"><TMPL_VAR ESCAPE=1 NAME="TEXT_PASSWORD1"> :</label>
- <input name="PASSWORD1" id="PASSWORD1" value="" type="password" />
- </p>
-
- <p>
- <label for="PASSWORD2"><TMPL_VAR ESCAPE=1 NAME="TEXT_PASSWORD2"> :</label>
- <input name="PASSWORD2" id="PASSWORD2" value="" type="password" />
- </p>
-
- <p>
- <label for="LANG"><TMPL_VAR ESCAPE=1 NAME="TEXT_LANG"> :</label>
- <select name="LANG" id="LANG">
- <TMPL_VAR ESCAPE=0 NAME="LANG_LIST">
- </select>
- </p>
-
- <p>
- <label for="THEME"><TMPL_VAR ESCAPE=1 NAME="TEXT_THEME"> :</label>
- <select name="THEME" id="THEME">
- <TMPL_VAR ESCAPE=0 NAME="THEME_LIST">
- </select>
- </p>
-
- <p>
- <label for="SHELL"><TMPL_VAR ESCAPE=1 NAME="TEXT_SHELL"> :</label>
- <select name="SHELL" id="SHELL">
- <TMPL_VAR ESCAPE=0 NAME="SHELL_LIST">
- </select>
- </p>
-<TMPL_IF NAME="NEWSLETTER_TEXT">
- <p>
- <label for="NEWSLETTER"><TMPL_VAR ESCAPE=1 NAME="NEWSLETTER_TEXT"> :</label>
- <input type="checkbox" name="NEWSLETTER" id="NEWSLETTER" <TMPL_IF NAME="NEWSLETTER_CHECKED">checked="checked"</TMPL_IF>/>
- </p>
-</TMPL_IF>
- <TMPL_VAR ESCAPE=0 NAME="MAILUSER">
-
- <p class="button" id="buttonModify">
- <TMPL_IF NAME="HELP_URL">
- <a href="<TMPL_VAR ESCAPE=1 NAME="HELP_URL">"><TMPL_VAR ESCAPE=1 NAME="HELP_TEXT"></a>
- </TMPL_IF>
- <input type="submit" value="<TMPL_VAR ESCAPE=1 NAME="TEXT_SEND">" name="prefs_submit" id="prefs_submit"/>
- </p>
-
- <input type="hidden" name="name" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_USERNAME">" />
- </form>
-
- <TMPL_VAR ESCAPE=0 NAME="AVATAR">
-
- <h2><TMPL_VAR ESCAPE=1 NAME="TEXT_DELETE_USER"></h2>
-
- <form method="post" action="/user/delete.pl" accept-charset="utf-8">
-
- <p><TMPL_VAR ESCAPE=1 NAME="TEXT_BEFORE_DELETE"></p>
-
- <fieldset id="deleteUser" class="delete">
- <legend>
- <TMPL_VAR ESCAPE=1 NAME="ASK_DELETE_USER"> :
- </legend>
-
- <p>
- <input type="radio" name="DELETE" id="DELETENo" value="0" checked="checked" />
- <label for="DELETENo"><TMPL_VAR ESCAPE=1 NAME="NO"></label>
- </p>
- <p>
- <input type="radio" name="DELETE" id="DELETEYes" value="1" />
- <label for="DELETEYes"><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_USERNAME">" />
- <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="ircnick.tmpl">
- <TMPL_INCLUDE NAME="admin.tmpl">
-</TMPL_IF>
Added: trunk/vhffs-panel/templates/user/prefs.tt
===================================================================
--- trunk/vhffs-panel/templates/user/prefs.tt (rev 0)
+++ trunk/vhffs-panel/templates/user/prefs.tt 2011-05-14 08:13:01 UTC (rev 1719)
@@ -0,0 +1,213 @@
+ <form method="post" action="/user/prefs.pl" accept-charset="utf-8">
+ <p>
+ <label>[% 'Username:' | i18n | html %]</label>
+ <span class="formInput">[% user.get_username | html %]</span>
+ </p>
+
+ <p>
+ <label for="FIRSTNAME">[% 'Firstname:' | i18n | html %]</label>
+ <input name="FIRSTNAME" id="FIRSTNAME" value="[% user.get_firstname | html %]" type="text" />
+ </p>
+
+ <p>
+ <label for="LASTNAME">[% 'Last name:' | i18n | html %]</label>
+ <input name="LASTNAME" id="LASTNAME" value="[% user.get_lastname %]" type="text" />
+ </p>
+
+ <p>
+ <label for="MAIL">[% 'Email address:' | i18n | html %]</label>
+ <input name="MAIL" id="MAIL" maxlength="200" value="[% user.get_mail | html %]" type="text" />
+ </p>
+
+ <p>
+ <label for="ADDRESS">[% 'Address:' | i18n |html %]</label>
+ <input name="ADDRESS" id="ADDRESS" value="[% user.get_address | html %]" type="text" />
+ </p>
+
+ <p>
+ <label for="CITY">[% 'City:' | i18n | html %]</label>
+ <input name="CITY" id="CITY" value="[% user.get_city | html %]" type="text" />
+ </p>
+
+ <p>
+ <label for="ZIPCODE">[% 'Zipcode:' | i18n | html %]</label>
+ <input name="ZIPCODE" id="ZIPCODE" value="[% user.get_zipcode | html %]" type="text" />
+ </p>
+
+ <p>
+ <label for="COUNTRY">[% 'Country:' | i18n | html %]</label>
+ <input name="COUNTRY" id="COUNTRY" value="[% user.get_country %]" type="text" />
+ </p>
+
+ <p>
+ <label for="PASSWORD1">[% 'Password:' | i18n | html %]</label>
+ <input name="PASSWORD1" id="PASSWORD1" value="" type="password" />
+ </p>
+
+ <p>
+ <label for="PASSWORD2">[% 'Password (confirm):' | i18n | html %]</label>
+ <input name="PASSWORD2" id="PASSWORD2" value="" type="password" />
+ </p>
+
+ <p>
+ <label for="LANG">[% 'Panel language:' | i18n | html %]</label>
+ <select name="LANG" id="LANG">
+[% FOREACH l IN languages %]
+ <option value="[% l | html %]"[% ' selected="selected"' IF current_language == l %]>[% l | html %]</option>
+[% END %]
+ </select>
+ </p>
+
+ <p>
+ <label for="THEME">[% 'Panel UI theme:' | i18n | html %]</label>
+ <select name="THEME" id="THEME">
+[% FOREACH t IN themes %]
+ <option value="[% t | html %]"[% ' selected="selected"' IF current_theme == t %]>[% t | html %]</option>
+[% END %]
+ </select>
+ </p>
+
+ <p>
+ <label for="SHELL">[% 'Shell:' | i18n | html %]</label>
+ <select name="SHELL" id="SHELL">
+[% FOREACH s IN shells %]
+ <option value="[% s | html %]"[% ' selected="selected"' IF current_shell == s %]>[% s | html %]</option>
+[% END %]
+ </select>
+ </p>
+[% IF newsletter.active %]
+ <p>
+ <label for="NEWSLETTER">[% 'Subscribe to newsletter' | i18n | html %]</label>
+ <input type="checkbox" name="NEWSLETTER" id="NEWSLETTER"[% ' selected="selected"' IF newsletter.subscribed %]/>
+ </p>
+[% END %]
+
+[% IF mail_user.defined() %]
+ <fieldset id="chooseMailMode">
+ <legend>[% 'We offer you the possibility to have one email box on the domain %s' | i18n | pretty_print(mail_user.domain) | html %]</legend>
+[% IF (!mail_user.service.exists) || mail_user.service.exists_forward ||
+ (mail_user.service.exists_box && mail_user.service.get_box_status == constants.object_statuses.ACTIVATED ) %]
+[% IF mail_user.help_url %]
+ <p><a href="[% mail_user.help_url | html %]">[% 'Read more about this service.' | i18n | html %]</a></p>
+[% END %]
+ <p>
+ <input name="mail_activate" id="mail_activate" class="labeled"
+ type="checkbox"[% ' checked="chedcked"' IF mail_user.service.exists() %]
+ onchange="javascript:Element.toggle('mail_prefs');"/>
+ <label for="mail_activate">[% 'Activate %s@%s email' | i18n | pretty_print(user.get_username, mail_user.domain) | html %]</label>
+ </p>
+ <div id="mail_prefs"[% ' style="display:none"' UNLESS mail_user.service.exists() %]>
+ <p>[% 'There are two possible usages:' | i18n | html %]</p>
+
+ <p>
+ <input name="mail_usage" id="mail_usage_box" value="1" type="radio"
+ class="labeled"[% ' checked="checked"' IF mail_user.service.exists_box && !mail_user.service.exists_forward %]
+ onchange="javascript:document.getElementById('mbox_options').style.display='';"/>
+ <label for="mail_usage_box" >[% 'Use VHFFS servers to manage this mail.' | i18n | html %]
+ <br/>[% 'You should use use the host pop.%s or imap.%s to fetch your mails.' | i18n | pretty_print(mail_user.domain, mail_user.domain) | html %]</label>
+ </p>
+ <div id="mbox_options"[% ' style="display:none"' UNLESS mail_user.service.exists_box && !mail_user.service.exists_forward %]>
+[% IF mail_user.nospam %]
+ <p><input name="mail_nospam" id="mail_nospam" type="checkbox"
+ class="labeled"[% ' checked="checked"' IF mail_user.service.use_nospam %]/>
+ <label for="mail_nospam">[% 'Activate anti-spam protection' | i18n | html %]</label></p>
+[% END %]
+[% IF mail_user.novirus %]
+ <p><input name="mail_novirus" id="mail_novirus" type="checkbox"
+ class="labeled"[% ' checked="checked"' IF mail_user.service.use_novirus %]/>
+ <label for="mail_novirus">[% 'Activate anti-virus protection' | i18n | html %]</label></p>
+[% END %]
+ </div>
+ <p>
+ <input name="mail_usage"
+ id="mail_usage_foward" value="2" class="labeled"
+ type="radio"[% ' checked="checked"' IF mail_user.service.exists_forward %]
+ onchange="javascript:document.getElementById('mbox_options').style.display='none';" />
+ <label for="mail_usage_foward">[% 'Forward emails from %s@%s to %s' | i18n | pretty_print(user.get_username, mail_user.domain, user.get_mail) | html %]</label>
+ </p>
+ </div>
+
+[% ELSE # mailbox does not exists or is activated %]
+ <p>[% mail_user.service.get_box_status | stringify_status | html %]</p>
+[% END %]
+ </fieldset>
+[% END # mail_user.defined %]
+
+ <p class="button" id="buttonModify">
+[% IF user_help_url %]
+ <a href="[% user_help_url | html %]">Aide</a>
+[% END %]
+ <input type="submit" value="[% 'Update' | i18n | html %]" name="prefs_submit" id="prefs_submit"/>
+ </p>
+
+ <input type="hidden" name="name" value="[% user.get_username | html %]" />
+ </form>
+
+[% IF use_avatars %]
+ <h2>[% 'Send my avatar' | i18n | html %]</h2>
+ <form method="post" action="/object/upavatar.pl" enctype="multipart/form-data" accept-charset="utf-8">
+ <h3>[% 'Current avatar' | i18n | html %]</h3>
+ <img alt="[% 'User\'s avatar' | i18n | html %]" src="/getavatar.pl?oid=[% user.get_oid %]"/>
+ <p>[% 'The avatar is a PNG image that will appear next to your username in the public section.' | i18n | html %]
+ </p>
+ <input type="hidden" name="OID" value="[% user.get_oid %]"/>
+
+ <input type="file" name="avatar" tabindex="1" size="45"/>
+ <br/>
+ <input type="submit" value="[% 'Update my avatar' | i18n | html %]" />
+ </form>
+[% END %]
+
+ <h2>[% 'Delete YOUR user' | i18n | html %]</h2>
+
+ <form method="post" action="/user/delete.pl" accept-charset="utf-8">
+
+ <p>[% 'This action is non-reversible. Your user will be DESTROYED.' | i18n | html %]</p>
+
+ <fieldset id="deleteUser" class="delete">
+ <legend>[% 'Are you SURE you want DELETE this user?' | i18n | html %]</legend>
+ <p>
+ <input type="radio" name="DELETE" id="DELETENo" value="0" checked="checked" />
+ <label for="DELETENo">[% 'No, I\'m not sure, I\'d prefer to keep it.' | i18n | html %]</label>
+ </p>
+ <p>
+ <input type="radio" name="DELETE" id="DELETEYes" value="1" />
+ <label for="DELETEYes">[% 'Yes I\'m sure of what I do' | i18n | html %]</label>
+ </p>
+ </fieldset>
+
+ <p class="button" id="buttonDelete">
+ <input type="hidden" name="name" value="[% user.get_username | html %]" />
+ <input type="submit" value="[% 'Delete my user' | i18n | html %]" />
+ </p>
+
+ </form>
+
+[% IF current_user.is_admin %]
+ [% INCLUDE 'admin/object/edit.tt'
+ object = user %]
+ <TMPL_INCLUDE NAME="ircnick.tmpl">
+ <h2>[% 'IRC nick'%]</h2>
+ <form method="post" action="#">
+ <input type="hidden" name="name" value="[% user.get_username | html %]"/>
+ <p><label for="user_ircnick">[% 'IRC nickname:' | i18n | html %]</label>
+ <input name="ircnick" id="user_ircnick" value="[% user.get_ircnick | html %]" type="text" />
+ </p>
+ <p><input type="submit" name="update_ircnick_submit" value="[% 'Update IRC nick' | i18n | html %]"/></p>
+ </form>
+ <h2>[% 'User\'s permissions' | i18n | html %]</h2>
+ <form method="post" action="#">
+ <input type="hidden" name="name" value="[% user.get_username %]"/>
+ <p><label for="user_permissions">[% 'User\'s permissions:' | i18n | html %]</label>
+ <select name="permissions" id="user_permissions">
+ <option value="[% constants.user_permissions.NORMAL %]"[% ' selected="selected"' IF user.get_permissions == constants.user_permissions.NORMAL %]>
+ [% 'Normal' | i18n | html %]</option>
+ <option value="[% constants.user_permissions.MODERATOR %]"[% ' selected="selected"' IF user.get_permissions == constants.user_permissions.MODERATOR %]>
+ [% 'Moderator' | i18n | html %]</option>
+ <option value="[% constants.user_permissions.ADMIN %]"[% ' selected="selected"' IF user.get_permissions == constants.user_permissions.ADMIN %]>
+ [% 'Administrator' | i18n | html %]</option>
+ </select>
+ </p>
+ <p><input type="submit" name="update_permissions_submit" value="[% 'Update permissions' | i18n | html %]"/></p>
+ </form>
+[% END %]
Deleted: trunk/vhffs-panel/templates/user/prefs_avatar.tmpl
===================================================================
--- trunk/vhffs-panel/templates/user/prefs_avatar.tmpl 2011-05-14 08:12:54 UTC (rev 1718)
+++ trunk/vhffs-panel/templates/user/prefs_avatar.tmpl 2011-05-14 08:13:01 UTC (rev 1719)
@@ -1,14 +0,0 @@
- <h2><TMPL_VAR ESCAPE=1 NAME="TEXT_AVATAR"></h2>
- <form method="post" action="../object/upavatar.pl" enctype="multipart/form-data" accept-charset="utf-8">
- <h3><TMPL_VAR ESCAPE=1 NAME="CURRENT_AVATAR"></h3>
- <img alt="avatar for your user" src="/getavatar.pl?oid=<TMPL_VAR ESCAPE=1 NAME="VALUE_OID">"/>
- <p>
- <TMPL_VAR ESCAPE=1 NAME="EXPLAIN_AVATAR">
- </p>
- <input type="hidden" name="OID" value="<TMPL_VAR ESCAPE=1 NAME="VALUE_OID">"/>
-
- <input type="file" name="avatar" tabindex="1" size="45"/>
- <br/>
- <input type="submit" value="<TMPL_VAR ESCAPE=1 NAME="SEND_AVATAR">" />
- <input type="hidden" name=".cgifields" value="type" />
- </form>
Modified: trunk/vhffs-panel/user/prefs.pl
===================================================================
--- trunk/vhffs-panel/user/prefs.pl 2011-05-14 08:12:54 UTC (rev 1718)
+++ trunk/vhffs-panel/user/prefs.pl 2011-05-14 08:13:01 UTC (rev 1719)
@@ -57,10 +57,11 @@
my $cgi = $panel->{cgi};
my $vhffs = $panel->{vhffs};
my $maintemplate = $panel->{template};
-my $user = $panel->{user};
my $templatedir = $panel->{templatedir};
my $template;
+my $user = $panel->{user};
my $userp;
+my $vars = {};
my $username = $cgi->param('name');
if( defined $username ) {
@@ -70,16 +71,10 @@
}
unless( defined $userp ) {
- $template = new HTML::Template( filename => $templatedir.'/panel/misc/simplemsg.tmpl' );
- $template->param( MESSAGE => gettext('Cannot get informations on this object') );
-}
-elsif( !$user->can_view( $userp ) )
-{
- $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' ) );
-}
-else
-{
+ $panel->render( 'misc/message.tt', { message => gettext('Cannot get informations on this object')} );
+} elsif( !$user->can_view( $userp ) ) {
+ $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('prefs_submit') ) {
unless( $user->can_modify( $userp ) ) {
$panel->add_error( gettext( 'You\'re not allowed to do this, object is not in active state or you don\'t have enough ACL rights' ) );
@@ -316,180 +311,51 @@
}
$panel->set_title( gettext("User Preferences") );
-
- $template = new Vhffs::Panel::Template( filename => $templatedir."/panel/user/prefs.tmpl" );
-
- $template->param( TEXT_USERNAME => gettext("Username") );
- $template->param( TEXT_MAIL => gettext("mail") );
- $template->param( TEXT_FIRSTNAME => gettext("Firstname") );
- $template->param( TEXT_LASTNAME => gettext("Lastname") );
- $template->param( TEXT_ZIPCODE => gettext("Zipcode") );
- $template->param( TEXT_CITY => gettext("City") );
- $template->param( TEXT_ADDRESS => gettext("Address") );
- $template->param( TEXT_COUNTRY => gettext("Country") );
- $template->param( TEXT_PASSWORD1 => gettext("Password") );
- $template->param( TEXT_PASSWORD2 => gettext("Confirm Password") );
- $template->param( TEXT_LANG => gettext("Language") );
- $template->param( TEXT_THEME => gettext("Theme") );
- $template->param( TEXT_SHELL => gettext("Shell") );
- $template->param( TEXT_SEND => gettext("Modify") );
-
- $template->param( VALUE_USERNAME => $userp->get_username );
- $template->param( VALUE_MAIL => $userp->get_mail );
- $template->param( VALUE_FIRSTNAME => $userp->get_firstname );
- $template->param( VALUE_LASTNAME => $userp->get_lastname );
- $template->param( VALUE_ZIPCODE => $userp->get_zipcode );
- $template->param( VALUE_CITY => $userp->get_city );
- $template->param( VALUE_ADDRESS => $userp->get_address );
- $template->param( VALUE_COUNTRY => $userp->get_country );
-
- $template->param( TEXT_DELETE_USER => gettext("Delete YOUR user") );
- $template->param( TEXT_BEFORE_DELETE => gettext("This action is non-reversible. Your user will be DESTROYED.") );
- $template->param( ASK_DELETE_USER => gettext("Are you SURE you want DELETE this user?") );
- $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") );
-
- if( $panel->use_users_avatars ) {
-
- my $ta = new HTML::Template( filename => $templatedir."/panel/user/prefs_avatar.tmpl" );
-
- $ta->param( SEND_AVATAR => gettext("Send my avatar") );
- $ta->param( CURRENT_AVATAR => gettext("Current avatar") );
- $ta->param( TEXT_AVATAR => gettext("Send my avatar") );
- $ta->param( EXPLAIN_AVATAR => gettext("The avatar is a pictures that describes you. You can upload an PNG image and use it as avatar. This image will then appear in the public section.") );
- $ta->param( VALUE_OID => $userp->get_oid );
-
- $template->param( AVATAR => $ta->output );
- }
-
- # themes
+ $vars->{user} = $userp;
+ $vars->{current_language} = Vhffs::Panel::User::get_lang( $userp );
my @themes = Vhffs::Panel::Main::list_themes( $vhffs );
- my $curtheme = Vhffs::Panel::User::get_theme( $userp );
- my $themelist;
- foreach( @themes )
- {
- if($curtheme ne $_)
- {
- $themelist .= "<option value=\"".$_."\">".$_."</option>\n";
- }
- else
- {
- $themelist .= "<option value=\"".$_."\" selected=\"selected\">".$_."</option>\n";
- }
- }
- $template->param( THEME_LIST => $themelist );
+ $vars->{themes} = \@themes;
+ $vars->{current_theme} = Vhffs::Panel::User::get_theme( $userp );
+ $template = new Vhffs::Panel::Template( filename => $templatedir."/panel/user/prefs.tmpl" );
+ $vars->{user_help_url} = $vhffs->get_config->get_users()->{url_doc};
- # languages
- my @langs = Vhffs::Panel::Main::list_languages( $vhffs );
- my $curlang = Vhffs::Panel::User::get_lang( $userp );
- my $langlist = '';
- foreach( @langs ) {
- if($curlang ne $_) {
- $langlist .= "<option value=\"".$_."\">".$_."</option>\n";
- } else {
- $langlist .= "<option value=\"".$_."\" selected=\"selected\">".$_."</option>\n";
- }
- }
- $template->param( LANG_LIST => $langlist );
- # shells
if( $userp->have_activegroups > 0 ) {
- my @shells = Vhffs::Panel::User::list_shells( $vhffs );
- my $curshell = Vhffs::Panel::User::get_shell( $userp );
- my $shelllist = "";
- foreach( @shells )
- {
- if($curshell ne $_)
- {
- $shelllist .= "<option value=\"".$_."\">".$_."</option>\n";
- }
- else
- {
- $shelllist .= "<option value=\"".$_."\" selected=\"selected\">".$_."</option>\n";
- }
- }
- $template->param( SHELL_LIST => $shelllist );
+ my @shells = Vhffs::Panel::User::list_shells( $vhffs );
+ $vars->{shells} = \@shells;
+ $vars->{current_shell} = Vhffs::Panel::User::get_shell( $userp );
+ } else {
+ $vars->{shells} = [ Vhffs::Panel::User::default_shell( $vhffs ) ];
}
- else {
- my $defaultshell = Vhffs::Panel::User::default_shell( $vhffs );
- $template->param( SHELL_LIST => "<option value=\"".$defaultshell."\" selected=\"selected\">".$defaultshell."</option>\n" );
- }
- my $mu = init Vhffs::Services::MailUser( $vhffs , $userp );
- if( defined $mu ) {
-
- my $subtemplate = new HTML::Template( filename => $templatedir.'/panel/user/mailuser.tmpl' );
- my $config = $vhffs->get_config->get_service( 'mailuser' );
-
- #nothing, a forward, or a box but activated
- if( !$mu->exists || $mu->exists_forward || ( $mu->exists_box && $mu->get_box_status == Vhffs::Constants::ACTIVATED ) ) {
- my $tmp = '';
-
- $subtemplate->param( ACTIV_CHECKED => 1 ) if( $mu->exists == 1 );
- $subtemplate->param( POP_CHECKED => 1 ) if( $mu->exists_box == 1 && $mu->exists_forward == 0 );
- $subtemplate->param( FWD_CHECKED => 1 ) if( $mu->exists_forward == 1 );
- $subtemplate->param( TEXT_MAILACTIV => sprintf( gettext("Activate %s\@%s email"), $userp->get_username, $config->{domain}) );
- $subtemplate->param( TEXT_MAILINFO2 => gettext("There is two possible usages :") );
- $subtemplate->param( TEXT_MAILBOX => sprintf( gettext("Use VHFFS servers to manage this mail,<br/>you should use use the host pop.%s or imap.%s to fetch your mails") , $config->{domain} , $config->{domain} ) );
- $subtemplate->param( TEXT_MAILFORWARD => sprintf( gettext("Forward emails from %s\@%s to %s"), $userp->get_username, $config->{domain}, $userp->get_mail ) );
-
- if( defined ( my $url = $config->{'url_doc'} ) ) {
- $template->param( HELP_TEXT => gettext('Help') );
- $template->param( HELP_URL => $url );
- }
-
- if( $vhffs->get_config->get_service('mail')->{'use_nospam'} eq 'yes' )
- {
- my $subtemplate2 = new HTML::Template( filename => $templatedir.'/panel/user/mailuserspam.tmpl' );
- $subtemplate2->param( TEXT_NOSPAM => gettext("Use anti-spam protection") );
- $subtemplate2->param( ACTIV_CHECKED => "checked" ) if( $mu->use_nospam == 1 );
- $tmp .= $subtemplate2->output;
- }
-
- if( $vhffs->get_config->get_service('mail')->{'use_novirus'} eq 'yes' )
- {
- my $subtemplate2 = new HTML::Template( filename => $templatedir.'/panel/user/mailuservirus.tmpl' );
- $subtemplate2->param( TEXT_VIRUS => gettext("Use anti-virus protection") );
- $subtemplate2->param( ACTIV_CHECKED => "checked" ) if( $mu->use_novirus == 1 );
- $tmp .= $subtemplate2->output;
- }
-
- $subtemplate->param( MAILUSER_OPTIONS => $tmp );
- }
- else {
- $subtemplate->param( STATUSSTR => Vhffs::Functions::status_string_from_status_id( $mu->get_box_status ) );
- }
-
- $subtemplate->param( TEXT_LEGEND => sprintf( gettext("We offer you the possibility to have one email box on the domain %s") , $config->{domain}) );
- $template->param( MAILUSER => $subtemplate->output );
- }
-
my $newsletter = init Vhffs::Services::Newsletter( $vhffs , $userp );
if( defined $newsletter ) {
if( $newsletter->get_collectmode != Vhffs::Services::Newsletter::PERMANENT ) {
- $template->param( NEWSLETTER_TEXT => gettext('Receive mails from the newsletter') );
- $template->param( NEWSLETTER_CHECKED => $newsletter->exists );
+ $vars->{newsletter} = {
+ active => 1,
+ subscribed => $newsletter->exists
+ };
}
}
- if($user->is_admin) {
- my $adminpart = Vhffs::Panel::Object::admin_part( $panel, $userp );
- $template->param( ADMIN_PART => $adminpart->output ) if( defined $adminpart );
- $template->param( ADMIN => 1 );
- $template->param( PERMISSIONS => $userp->get_permissions );
- $template->param( USER_NORMAL => Vhffs::Constants::USER_NORMAL );
- $template->param( USER_MODERATOR => Vhffs::Constants::USER_MODERATOR );
- $template->param( USER_ADMIN => Vhffs::Constants::USER_ADMIN );
- $template->param( TEXT_IRCNICK => gettext('IRC nick') );
- $template->param( VALUE_USERNAME => $userp->get_username );
- $template->param( VALUE_IRCNICK => $userp->get_ircnick );
+ my $mu = init Vhffs::Services::MailUser( $vhffs , $userp );
+ if(defined $mu) {
+ my $mu_config = $vhffs->get_config->get_service( 'mailuser' );
+ my $mail_config = $vhffs->get_config->get_service('mail');
+ $vars->{mail_user} = {
+ service => $mu,
+ domain => $mu_config->{domain},
+ help_url => $mu_config->{url_doc},
+ nospam => $mail_config->{use_nospam} eq 'yes',
+ novirus => $mail_config->{use_novirus} eq 'yes'
+ };
}
-}
-$panel->build( $template );
-$panel->display;
+ $vars->{use_avatars} = $panel->use_users_avatars;
+ $panel->render('user/prefs.tt', $vars);
+}
+
sub update_ircnick {
unless( $user->is_admin ) {
$panel->add_error( gettext('Only administrators can do this') );