# get a config file
mkdir -m 755 /etc/bacula
chown root:bacula /etc/bacula
- echo '$VAR1 = { template_dir => "/usr/share/bweb/en/tpl" };' > /etc/bacula/bweb.conf
+ echo '$VAR1 = { template_dir => "/usr/share/bweb/tpl" };' > /etc/bacula/bweb.conf
chown www-data /etc/bacula/bweb.conf
# copy the bweb template file
- mkdir -p /usr/share/bweb/en/tpl
- install -m 644 -o root -g root bweb/lang/en/tpl/*.tpl /usr/share/bweb/en/tpl
+ mkdir -p /usr/share/bweb/tpl/en
+ install -m 644 -o root -g root bweb/lang/tpl/en/*.tpl /usr/share/bweb/tpl/en
# copy the bweb graphics elements (bweb elements must reside in /bweb)
mkdir /var/www/bweb
to read the bconsole.conf file!
You can create an bconsole group for that.
-################ USE FRENCH VERSION ############################
+################ USE FRENCH/SPANISH VERSION ####################
-Simply use lang/fr/tpl/*.tpl files instead of lang/en/tpl/*.tpl
+Simply copy lang/fr/tpl/*.tpl files to .../tpl/fr/*.tpl and choose
+your language in the configuration panel.
################ INSTALL PERL LIBRARY ##########################
}, 'Bweb::Autochanger' )
},
'password' => 'xxx',
- 'template_dir' => '/usr/share/bweb/en/tpl',
+ 'template_dir' => '/usr/share/bweb/tpl',
+ 'lang' => 'en',
'dbi' => 'DBI:mysql:database=bacula',
'error' => '',
'debug' => 0,
chown www-data /var/spool/bweb
You have to remove "<!-- Remove this to activate bfileview" and "-->" from
-tpl/display_job_zoom.tpl.
+tpl/en/display_job_zoom.tpl.
You MUST use brestore.pl -b to initialize the database, and
you CAN use bfileview.pl mode=batch jobid=xxx where=/ to compute tree size.
Upgrade from 2.2.Y to 3.0
-------------------------
- - Change your template_dir from
- /path/to/bweb/tpl -> /path/to/bweb/en/tpl
- (french and spanish translation doesn't change)
-
- Add the Date::Calc package to your perl library
- Add user, new job overview and bresto tables to your catalog
}, 'Bweb::Autochanger' )
},
'password' => '${DB_PW}',
- 'template_dir' => '${SHARE_DIR}/bweb/en/tpl',
+ 'template_dir' => '${SHARE_DIR}/bweb/tpl',
+ 'lang' => 'en',
'dbi' => 'DBI:mysql:database=bacula',
'error' => '',
'debug' => 0,
chown ${HTTP_USER} ${CONF_DIR}/bweb.conf
# copy the bweb template file
-if [ ! -d ${SHARE_DIR}/bweb/en/tpl ] ; then
- mkdir -p ${SHARE_DIR}/bweb/en/tpl
+if [ ! -d ${SHARE_DIR}/bweb/tpl/en ] ; then
+ mkdir -p ${SHARE_DIR}/bweb/tpl/{en,fr,es}
fi
-install -m 644 -o root -g root lang/en/tpl/*.tpl ${SHARE_DIR}/bweb/en/tpl
+install -m 644 -o root -g root lang/tpl/en/*.tpl ${SHARE_DIR}/bweb/tpl/en
+install -m 644 -o root -g root lang/tpl/es/*.tpl ${SHARE_DIR}/bweb/tpl/es
+install -m 644 -o root -g root lang/tpl/fr/*.tpl ${SHARE_DIR}/bweb/tpl/fr
# copy the bweb graphics elements (bweb elements must reside in /bweb)
if [ ! -d ${WEB_DIR} ] ; then
+++ /dev/null
-s!__!!g;
-print;
if (navigator.appName == 'Konqueror') {
alert("Sorry at this moment, bweb works only with mozilla.");
}
+if ('Main' == ('_' + '_Main_' + '_')) {
+ document.write("<font color='red'>Update your configuration to use the correct tpl directory (You are using devel tpl)</font>");
+}
</script>
<ul id="menu">
<li><a href="bweb.pl?action=running">Running Jobs</a>
<li><a href="bweb.pl?action=next_job">Next Jobs</a> </li>
<li><a href="bweb.pl?action=restore" title="Launch brestore">Restore</a> </li>
+ <li><a href="/bweb/bresto.html" title="Try bresto">Web Restore</a> </li>
</ul>
</li>
<li style="padding: 0.25em 2em;">Media
<tr><td>graph_font:</td>
<td> <input class="formulaire" type='text' value='<TMPL_VAR graph_font>' size='64' name='graph_font'>
</td></tr>
- <tr><td>template_dir:</td>
- <td> <input class="formulaire" type='text' value='<TMPL_VAR template_dir>' size='64' name='template_dir'>
- </td></tr>
<tr><td>fv_write_path:</td>
<td> <input class="formulaire" title="This folder must be writable by apache user and must be accessible on /bweb/fv" type='text' value='<TMPL_VAR fv_write_path>' size='64' name='fv_write_path'>
<tr><td>stat_job_table:</td>
<tr><td>wiki_url:</td>
<td> <input class="formulaire" title="Use a wiki for jobs documentation?" size='64' type='text' name='wiki_url' value='<TMPL_VAR wiki_url>'>
</td></tr>
+ <tr><td>template_dir:</td>
+ <td> <input class="formulaire" type='text' value='<TMPL_VAR template_dir>' size='64' name='template_dir'>
+ </td></tr>
+ <tr><td>language:</td>
+ <td> <select name="lang" id='lang' class="formulaire">
+ <option id='lang_en' value='en'>English</option>
+ <option id='lang_fr' value='fr'>French</option>
+ <option id='lang_es' value='es'>Spanish</option>
+ </select>
+ </td></tr>
<tr><td>display_log_time:</td>
<td> <input class="formulaire" title="Display log timestamp" type='checkbox' name='display_log_time' <TMPL_IF display_log_time> checked='checked' value='on' </TMPL_IF> >
</td></tr>
<button type="submit" class="bp" name='action' value='apply_conf'> <img src='/bweb/save.png' alt=''>Save</button>
</form>
</div>
+
+<script type="text/javascript" language='JavaScript'>
+<TMPL_IF lang>
+ document.getElementById('lang_<TMPL_VAR lang>').selected = true;
+</TMPL_IF>
+</script>
\ No newline at end of file
<tr><td>email_media:</td> <td> <TMPL_VAR email_media> </td></tr>
<tr> <td><b>Bweb Configuration</b></td> <td/></tr>
<tr><td>config_file:</td> <td> <TMPL_VAR config_file> </td></tr>
- <tr><td title="/path/to/your/template_dir">template_dir:</td> <td> <TMPL_VAR template_dir> </td></tr>
<tr><td title="/path/to/a/font.ttf">graph_font:</td> <td> <TMPL_VAR graph_font> </td></tr>
<tr><td title="This folder must be writable by apache user and must be accessible on /bweb/fv">fv_write_path:</td> <td> <TMPL_VAR fv_write_path> </td></tr>
<tr><td title="You can choose the Job table that you want to use to get statistics">stat_job_table:</td> <td> <TMPL_IF stat_job_table><TMPL_VAR stat_job_table><TMPL_ELSE>Job</TMPL_IF> </td></tr>
<tr><td title="/path/to/bconsole -n -c /path/to/bconsole.conf">bconsole:</td> <td> <TMPL_VAR bconsole> </td></tr>
<tr><td title="use a wiki for jobs documentation?">wiki_url:</td> <td> <TMPL_VAR wiki_url> </td></tr>
+ <tr><td title="/path/to/your/template_dir">template_dir:</td> <td> <TMPL_VAR template_dir> </td></tr>
+ <tr><td title="Default language">language:</td> <td> <TMPL_VAR lang> </td></tr>
<tr><td title="display timestamp in job log">display_log_time:</td> <td> <TMPL_VAR display_log_time> </td></tr>
<tr><td title="user managment">security:</td> <td> <TMPL_VAR enable_security> </td></tr>
<tr><td title="user filter">security acl:</td> <td> <TMPL_VAR enable_security_acl> </td></tr>
</tr><tr>
<td>Comment:</td> <td> <input class="formulaire" type="text" name="comment" value='<TMPL_VAR comment>'> </td>
</tr><tr>
- <td>Lang:</td>
+ <td>Language:</td>
<td>
<select name="lang" id='lang' class="formulaire">
- <option value='en'>english</option>
- <option value='fr'>french</option>
- <option value='es'>spanish</option>
+ <option id='lang_en' value='en'>English</option>
+ <option id='lang_fr' value='fr'>French</option>
+ <option id='lang_es' value='es'>Spanish</option>
</select>
</td>
</tr><tr>
}
}
+<TMPL_IF lang>
+ document.getElementById('lang_<TMPL_VAR lang>').selected = true;
+</TMPL_IF>
</script>
</tr>
<tr><td>Pre-comando :</td>
<td> <input class="formulaire" type='text' id='precmd' value='sudo'
- title='can be "sudo" or "ssh storage\@storagehost"...' name='precmd'>
+ title='can be "sudo" or "ssh storage@storagehost"...' name='precmd'>
</td>
</tr>
<tr><td>Comando mtx :</td>
if (navigator.appName == 'Konqueror') {
alert("Sorry at this moment, bweb works only with mozilla.");
}
+if ('Principal' == ('_' + '_Main_' + '_')) {
+ document.write("<font color='red'>Update your configuration to use the correct tpl directory (You are using devel tpl)</font>");
+}
</script>
<ul id="menu">
<li><a href="bweb.pl?action=running">Jobs en Ejecución</a>
<li><a href="bweb.pl?action=next_job">Próximos Jobs</a> </li>
<li><a href="bweb.pl?action=restore" title="Launch brestore">Recuperación</a> </li>
+ <li><a href="/bweb/bresto.html" title="Try bresto">Web Restore</a> </li>
</ul>
</li>
<li style="padding: 0.25em 2em;">Medios
<tr>
<td><b>Para: </b></td><td><input class='formulaire' name='email' value='<TMPL_VAR email>'></td>
</tr><tr>
-<td><b>Asunto: </b></td><td><input class='formulaire' name='subject' value='__[BACULA] Move media to__ <TMPL_VAR newlocation>' size='80'></td>
+<td><b>Asunto: </b></td><td><input class='formulaire' name='subject' value='[BACULA] Mover medio a <TMPL_VAR newlocation>' size='80'></td>
</tr><tr>
<td></td>
<td>
<textarea name='content' class='formulaire' cols='80' rows='32'>
-Hi,
+Estimado,
-Could you move these media to <TMPL_VAR newlocation>
+Puede mover este medio a <TMPL_VAR newlocation>
Media :
<TMPL_LOOP media>
- <TMPL_VAR VolumeName> (<TMPL_VAR location>)
</TMPL_LOOP>
-When it's finish, could you update media location?
-(you can use this link: <TMPL_VAR url>).
+Cuando finalice, puede actualizar la ubicacion del medio ?
+(puede usar este link : <TMPL_VAR url>).
-Thanks
+Gracias
</textarea>
</td></tr></table>
<input class='formulaire' type='submit' name='action' value='move_email'>
</div>
<div class="otherbox">
<!-- <h1>Acciones</h1> -->
- <button type="submit" class="bp" name='action' value='job' title="Mostrar últimos jobs"> <img src='/bweb/zoom.png' alt=''>Last jobs</button>
- <button type="submit" class="bp" name='action' value='dsp_cur_job' title='Show current job'> <img src='/bweb/zoom.png' alt=''>Current jobs</button>
+ <button type="submit" class="bp" name='action' value='job' title="Mostrar últimos jobs"> <img src='/bweb/zoom.png' alt=''>Últimos Jobs</button>
+ <button type="submit" class="bp" name='action' value='dsp_cur_job' title='Mostrar job actual'> <img src='/bweb/zoom.png' alt=''>Current jobs</button>
<button type="submit" class="bp" name='action' value='client_status' title='Mostrar estado del cliente'> <img src='/bweb/zoom.png' alt=''>Estado </button>
- <button type="submit" class="bp" name='action' value='client_stats' title='Estadísticas del Cliente'> <img src='/bweb/chart.png' alt=''>Stats </button>
+ <button type="submit" class="bp" name='action' value='client_stats' title='Estadísticas del Cliente'> <img src='/bweb/chart.png' alt=''>Estado </button>
</div>
</form>
<tr><td>graph_font:</td>
<td> <input class="formulaire" type='text' value='<TMPL_VAR graph_font>' size='64' name='graph_font'>
</td></tr>
- <tr><td>template_dir:</td>
- <td> <input class="formulaire" type='text' value='<TMPL_VAR template_dir>' size='64' name='template_dir'>
- </td></tr>
<tr><td>fv_write_path:</td>
<td> <input class="formulaire" title="Este directorio debe tener permisos de escritura para el usuario apache y debe ser accesible en /bweb/fv" type='text' value='<TMPL_VAR fv_write_path>' size='64' name='fv_write_path'>
<tr><td>stat_job_table:</td>
<tr><td>wiki_url:</td>
<td> <input class="formulaire" title="Use a wiki for jobs documentation?" size='64' type='text' name='wiki_url' value='<TMPL_VAR wiki_url>'>
</td></tr>
+ <tr><td>template_dir:</td>
+ <td> <input class="formulaire" type='text' value='<TMPL_VAR template_dir>' size='64' name='template_dir'>
+ </td></tr>
+ <tr><td>language:</td>
+ <td> <select name="lang" id='lang' class="formulaire">
+ <option id='lang_en' value='en'>English</option>
+ <option id='lang_fr' value='fr'>French</option>
+ <option id='lang_es' value='es'>Spanish</option>
+ </select>
+ </td></tr>
<tr><td>display_log_time:</td>
<td> <input class="formulaire" title="Display log timestamp" type='checkbox' name='display_log_time' <TMPL_IF display_log_time> checked='checked' value='on' </TMPL_IF> >
</td></tr>
<button type="submit" class="bp" name='action' value='apply_conf'> <img src='/bweb/save.png' alt=''>Save</button>
</form>
</div>
+
+<script type="text/javascript" language='JavaScript'>
+<TMPL_IF lang>
+ document.getElementById('lang_<TMPL_VAR lang>').selected = true;
+</TMPL_IF>
+</script>
\ No newline at end of file
<tr><td>email_media:</td> <td> <TMPL_VAR email_media> </td></tr>
<tr> <td><b>Configuración Bweb</b></td> <td/></tr>
<tr><td>config_file:</td> <td> <TMPL_VAR config_file> </td></tr>
- <tr><td title="/path/to/your/template_dir">template_dir:</td> <td> <TMPL_VAR template_dir> </td></tr>
<tr><td title="/path/to/a/font.ttf">graph_font:</td> <td> <TMPL_VAR graph_font> </td></tr>
<tr><td title="Este directorio debe tener permisos de escritura para el usuario apache y debe ser accesible en /bweb/fv">fv_write_path:</td> <td> <TMPL_VAR fv_write_path> </td></tr>
<tr><td title="You can choose the Job table that you want to use to get statistics">stat_job_table:</td> <td> <TMPL_IF stat_job_table><TMPL_VAR stat_job_table><TMPL_ELSE>Job</TMPL_IF> </td></tr>
<tr><td title="/path/to/bconsole -n -c /path/to/bconsole.conf">bconsole:</td> <td> <TMPL_VAR bconsole> </td></tr>
<tr><td title="use a wiki for jobs documentation?">wiki_url:</td> <td> <TMPL_VAR wiki_url> </td></tr>
+ <tr><td title="/path/to/your/template_dir">template_dir:</td> <td> <TMPL_VAR template_dir> </td></tr>
+ <tr><td title="Default language">language:</td> <td> <TMPL_VAR lang> </td></tr>
<tr><td title="display timestamp in job log">display_log_time:</td> <td> <TMPL_VAR display_log_time> </td></tr>
<tr><td title="user managment">security:</td> <td> <TMPL_VAR enable_security> </td></tr>
<tr><td title="user filter">security acl:</td> <td> <TMPL_VAR enable_security_acl> </td></tr>
<div class="otherbox">
<h1>Actions</h1>
<button type="submit" class="bp" name='action' value='job' title='Mostrar últimos jobs'> <img src='/bweb/zoom.png' alt=''>View last jobs</button>
- <button type="submit" class="bp" name='action' value='dsp_cur_job' title='Show current job'> <img src='/bweb/zoom.png' alt=''>View current jobs</button>
+ <button type="submit" class="bp" name='action' value='dsp_cur_job' title='Mostrar job actual'> <img src='/bweb/zoom.png' alt=''>View current jobs</button>
<button type="submit" class="bp" name='action' value='client_stat' title='Estadísticas del Cliente'> <img src='/bweb/zoom.png' alt=''>Ver estadísticas</button>
</div>
-->
</tr>
<tr><td>Pre-commande :</td>
<td> <input class="formulaire" type='text' id='precmd' value='sudo'
- title='peut être "sudo" ou "ssh storage\@storagehost"...' name='precmd'>
+ title='peut être "sudo" ou "ssh storage@storagehost"...' name='precmd'>
</td>
</tr>
<tr><td>commande mtx :</td>
alert("Désolé, bweb fonctionne seulement avec mozilla.");
}
if ('Accueil' == ('_' + '_Main_' + '_')) {
- alert("Update your configuration to use the correct tpl directory (something like /usr/share/bweb/en/tpl instead of /usr/share/bweb/tpl)");
+ document.write("<font color='red'>Update your configuration to use the correct tpl directory (You are using devel tpl)</font>");
}
</script>
<li><a href="bweb.pl?action=running">Jobs en cours</a>
<li><a href="bweb.pl?action=next_job">Prochains jobs</a> </li>
<li><a href="bweb.pl?action=restore" title="Lancer brestore">Restauration</a> </li>
+ <li><a href="/bweb/bresto.html" title="Try bresto">Web Restore</a> </li>
</ul>
</li>
<li style="padding: 0.25em 2em;">Médias
<tr>
<td><b>To: </b></td><td><input class='formulaire' name='email' value='<TMPL_VAR email>'></td>
</tr><tr>
-<td><b>Subject: </b></td><td><input class='formulaire' name='subject' value='__[BACULA] Move media to__ <TMPL_VAR newlocation>' size='80'></td>
+<td><b>Subject: </b></td><td><input class='formulaire' name='subject' value='[BACULA] Déplacer des médias vers <TMPL_VAR newlocation>' size='80'></td>
</tr><tr>
<td></td>
<td>
<tr><td>graph_font:</td>
<td> <input class="formulaire" type='text' value='<TMPL_VAR graph_font>' size='64' name='graph_font'>
</td></tr>
- <tr><td>template_dir:</td>
- <td> <input class="formulaire" type='text' value='<TMPL_VAR template_dir>' size='64' name='template_dir'>
- </td></tr>
<tr><td>fv_write_path:</td>
<td> <input class="formulaire" title="Ce répertoire doit être accessible en ecriture pour apache et être sous /bweb/fv" type='text' value='<TMPL_VAR fv_write_path>' size='64' name='fv_write_path'>
<tr><td>stat_job_table:</td>
<tr><td>wiki_url:</td>
<td> <input class="formulaire" title="Utiliser un wiki pour documenter les jobs ?" size='64' type='text' name='wiki_url' value='<TMPL_VAR wiki_url>'>
</td></tr>
+ <tr><td>template_dir:</td>
+ <td> <input class="formulaire" type='text' value='<TMPL_VAR template_dir>' size='64' name='template_dir'>
+ </td></tr>
+ <tr><td>language:</td>
+ <td> <select name="lang" id='lang' class="formulaire">
+ <option id='lang_en' value='en'>English</option>
+ <option id='lang_fr' value='fr'>French</option>
+ <option id='lang_es' value='es'>Spanish</option>
+ </select>
+ </td></tr>
<tr><td>display_log_time:</td>
<td> <input class="formulaire" title="Afficher l'heure des logs" type='checkbox' name='display_log_time' <TMPL_IF display_log_time> checked='checked' value='on' </TMPL_IF> >
</td></tr>
<button type="submit" class="bp" name='action' value='apply_conf'> <img src='/bweb/save.png' alt=''>Sauver</button>
</form>
</div>
+
+<script type="text/javascript" language='JavaScript'>
+<TMPL_IF lang>
+ document.getElementById('lang_<TMPL_VAR lang>').selected = true;
+</TMPL_IF>
+</script>
\ No newline at end of file
<tr><td>email_media:</td> <td> <TMPL_VAR email_media> </td></tr>
<tr> <td><b>Configuration Bweb</b></td> <td/></tr>
<tr><td>config_file:</td> <td> <TMPL_VAR config_file> </td></tr>
- <tr><td title="/path/to/your/template_dir">template_dir:</td> <td> <TMPL_VAR template_dir> </td></tr>
<tr><td title="/path/to/a/font.ttf">graph_font:</td> <td> <TMPL_VAR graph_font> </td></tr>
<tr><td title="Ce répertoire doit être accessible en ecriture pour apache et être sous /bweb/fv">fv_write_path:</td> <td> <TMPL_VAR fv_write_path> </td></tr>
<tr><td title="Vous pouvez utiliser une autre table que Job pour vos statistiques">stat_job_table:</td> <td> <TMPL_IF stat_job_table><TMPL_VAR stat_job_table><TMPL_ELSE>Job</TMPL_IF> </td></tr>
<tr><td title="/path/to/bconsole -n -c /path/to/bconsole.conf">bconsole:</td> <td> <TMPL_VAR bconsole> </td></tr>
<tr><td title="Utiliser un wiki pour documenter les jobs ?">wiki_url:</td> <td> <TMPL_VAR wiki_url> </td></tr>
+ <tr><td title="/path/to/your/template_dir">template_dir:</td> <td> <TMPL_VAR template_dir> </td></tr>
+ <tr><td title="Default language">language:</td> <td> <TMPL_VAR lang> </td></tr>
<tr><td title="display timestamp in job log">display_log_time:</td> <td> <TMPL_VAR display_log_time> </td></tr>
<tr><td title="user managment">security:</td> <td> <TMPL_VAR enable_security> </td></tr>
<tr><td title="user filter">security acl:</td> <td> <TMPL_VAR enable_security_acl> </td></tr>
=cut
use HTML::Template;
-our $template_dir='/usr/share/bweb/en/tpl';
+our $template_dir='/usr/share/bweb/tpl';
=head1 FUNCTION
this function is use to render all html codes. it takes an
ref hash as arg in which all param are usable in template.
- it will use global template_dir to search the template file.
+ it will use user template_dir then global template_dir
+ to search the template file.
hash keys are not sensitive. See HTML::Template for more
explanations about the hash ref. (it's can be quiet hard to understand)
=head2 EXAMPLE
- $ref = { name => 'me', age => 26 };
+ $ref = { name => 'me', age => 26 };
$self->display($ref, "people.tpl");
=cut
sub display
{
my ($self, $hash, $tpl) = @_ ;
-
+ my $dir = $self->{template_dir} || $template_dir;
+ my $lang = $self->{lang} || 'en';
my $template = HTML::Template->new(filename => $tpl,
- path =>[$template_dir],
+ path =>["$dir/$lang",
+ $dir],
die_on_bad_params => 0,
case_sensitive => 0);
fv_write_path => qr!^([/\w\d\.-]*)$!,
template_dir => qr!^([/\w\d\.-]+)$!,
debug => qr/^(on)?$/,
+ lang => qr/^(\w\w)?$/,
email_media => qr/^([\w\d\.-]+@[\d\w\.-]+)$/,
graph_font => qr!^([/\w\d\.-]+.ttf)$!,
bconsole => qr!^(.+)?$!,
$self->{loginname} = CGI::remote_user();
$self->{debug} = $self->{info}->{debug};
- $Bweb::Gui::template_dir = $self->{info}->{template_dir};
+ $self->{lang} = $self->{info}->{lang};
+ $self->{template_dir} = $self->{info}->{template_dir};
return $self;
}
sub display_begin
{
my ($self) = @_;
+ if ($self->{info}->{enable_security}) {
+ $self->get_roles(); # get lang
+ }
$self->display($self->{info}, "begin.tpl");
}
}
}
+ if ($what{lang}) {
+ my $lang = CGI::param('lang') || 'en';
+ if ($lang =~ /^(\w\w)$/) {
+ $ret{lang} = $1;
+ }
+ }
+
if ($what{db_clients}) {
my $filter='';
if ($what{filter}) {
my $u = $self->dbh_quote($self->{loginname});
my $query = "
- SELECT use_acl, rolename
+ SELECT use_acl, rolename, tpl
FROM bweb_user
JOIN bweb_role_member USING (userid)
JOIN bweb_role USING (roleid)
foreach my $r (@$rows) {
$self->{security}->{$r->[1]}=1;
}
-
$self->{security}->{use_acl} = $rows->[0]->[0];
+ if ($rows->[0]->[2] =~ /^(\w\w)$/) {
+ $self->{lang} = $1;
+ }
return 1;
}
$self->can_do("r_user_mgnt");
# we don't quote username directly to check that it is conform
- my $arg = $self->get_form(qw/username qpasswd qcomment jrolenames qcreate qcopy_username jclient_groups/) ;
+ my $arg = $self->get_form(qw/username qpasswd qcomment jrolenames qcreate
+ lang qcopy_username jclient_groups/) ;
if (not $arg->{qcreate}) {
$arg = $self->get_form(qw/db_roles db_usernames db_client_groups/);
($self->dbh_do("
UPDATE bweb_user
SET passwd=$arg->{qpasswd}, comment=$arg->{qcomment},
- use_acl=$arg->{use_acl}
+ use_acl=$arg->{use_acl}, tpl='$arg->{lang}'
WHERE username = $u")
# and (! $self->dbh_is_mysql() )
) and
$self->dbh_do("
- INSERT INTO bweb_user (username, passwd, use_acl, comment)
- VALUES ($u, $arg->{qpasswd}, $arg->{use_acl}, $arg->{qcomment})");
+ INSERT INTO bweb_user (username, passwd, use_acl, comment, tpl)
+ VALUES ($u, $arg->{qpasswd}, $arg->{use_acl},
+ $arg->{qcomment}, '$arg->{lang}')");
$self->{dbh}->begin_work();
{
my $user = $self->dbh_quote($arg->{username});
my $userp = $self->dbh_selectrow_hashref("
- SELECT username, passwd, comment, use_acl
+ SELECT username, passwd, comment, use_acl, tpl
FROM bweb_user
WHERE username = $user
");
username => $userp->{username},
comment => $userp->{comment},
passwd => $userp->{passwd},
+ lang => $userp->{lang},
use_acl => $userp->{use_acl},
db_client_groups => $arg->{db_client_groups},
client_group => [ values %$scg ],
23Dec07
+ebl Each user can have a different template dir (lang).
ebl WARNING: now, bweb/tpl contains main tpl files
for english version, you have to use bweb/lang/en/tpl
alert("__Sorry at this moment, bweb works only with mozilla.__");
}
if ('__Main__' == ('_' + '_Main_' + '_')) {
- document.write("<font color='red'>__Update your configuration to use the correct tpl directory (something like /usr/share/bweb/en/tpl instead of /usr/share/bweb/tpl)__</font>");
+ document.write("<font color='red'>__Update your configuration to use the correct tpl directory (You are using devel tpl)__</font>");
}
</script>
<tr><td>graph_font:</td>
<td> <input class="formulaire" type='text' value='<TMPL_VAR graph_font>' size='64' name='graph_font'>
</td></tr>
- <tr><td>template_dir:</td>
- <td> <input class="formulaire" type='text' value='<TMPL_VAR template_dir>' size='64' name='template_dir'>
- </td></tr>
<tr><td>fv_write_path:</td>
<td> <input class="formulaire" title="__This folder must be writable by apache user and must be accessible on /bweb/fv__" type='text' value='<TMPL_VAR fv_write_path>' size='64' name='fv_write_path'>
<tr><td>stat_job_table:</td>
<tr><td>wiki_url:</td>
<td> <input class="formulaire" title="__Use a wiki for jobs documentation?__" size='64' type='text' name='wiki_url' value='<TMPL_VAR wiki_url>'>
</td></tr>
+ <tr><td>template_dir:</td>
+ <td> <input class="formulaire" type='text' value='<TMPL_VAR template_dir>' size='64' name='template_dir'>
+ </td></tr>
+ <tr><td>__language:__</td>
+ <td> <select name="lang" id='lang' class="formulaire">
+ <option id='lang_en' value='en'>__English__</option>
+ <option id='lang_fr' value='fr'>__French__</option>
+ <option id='lang_es' value='es'>__Spanish__</option>
+ </select>
+ </td></tr>
<tr><td>display_log_time:</td>
<td> <input class="formulaire" title="__Display log timestamp__" type='checkbox' name='display_log_time' <TMPL_IF display_log_time> checked='checked' value='on' </TMPL_IF> >
</td></tr>
<button type="submit" class="bp" name='action' value='apply_conf'> <img src='/bweb/save.png' alt=''>__Save__</button>
</form>
</div>
+
+<script type="text/javascript" language='JavaScript'>
+<TMPL_IF lang>
+ document.getElementById('lang_<TMPL_VAR lang>').selected = true;
+</TMPL_IF>
+</script>
\ No newline at end of file
<tr><td>email_media:</td> <td> <TMPL_VAR email_media> </td></tr>
<tr> <td><b>__Bweb Configuration__</b></td> <td/></tr>
<tr><td>config_file:</td> <td> <TMPL_VAR config_file> </td></tr>
- <tr><td title="/path/to/your/template_dir">template_dir:</td> <td> <TMPL_VAR template_dir> </td></tr>
<tr><td title="/path/to/a/font.ttf">graph_font:</td> <td> <TMPL_VAR graph_font> </td></tr>
<tr><td title="__This folder must be writable by apache user and must be accessible on /bweb/fv__">fv_write_path:</td> <td> <TMPL_VAR fv_write_path> </td></tr>
<tr><td title="__You can choose the Job table that you want to use to get statistics__">stat_job_table:</td> <td> <TMPL_IF stat_job_table><TMPL_VAR stat_job_table><TMPL_ELSE>Job</TMPL_IF> </td></tr>
<tr><td title="/path/to/bconsole -n -c /path/to/bconsole.conf">bconsole:</td> <td> <TMPL_VAR bconsole> </td></tr>
<tr><td title="__use a wiki for jobs documentation?__">wiki_url:</td> <td> <TMPL_VAR wiki_url> </td></tr>
+ <tr><td title="/path/to/your/template_dir">template_dir:</td> <td> <TMPL_VAR template_dir> </td></tr>
+ <tr><td title="__Default language__">__language:__</td> <td> <TMPL_VAR lang> </td></tr>
<tr><td title="__display timestamp in job log__">display_log_time:</td> <td> <TMPL_VAR display_log_time> </td></tr>
<tr><td title="__user managment__">__security:__</td> <td> <TMPL_VAR enable_security> </td></tr>
<tr><td title="__user filter__">__security acl:__</td> <td> <TMPL_VAR enable_security_acl> </td></tr>
</tr><tr>
<td>__Comment:__</td> <td> <input class="formulaire" type="text" name="comment" value='<TMPL_VAR comment>'> </td>
</tr><tr>
- <td>__Lang:__</td>
+ <td>__Language:__</td>
<td>
<select name="lang" id='lang' class="formulaire">
- <option value='en'>english</option>
- <option value='fr'>french</option>
- <option value='es'>spanish</option>
+ <option id='lang_en' value='en'>__English__</option>
+ <option id='lang_fr' value='fr'>__French__</option>
+ <option id='lang_es' value='es'>__Spanish__</option>
</select>
</td>
</tr><tr>
}
}
+<TMPL_IF lang>
+ document.getElementById('lang_<TMPL_VAR lang>').selected = true;
+</TMPL_IF>
</script>
usr/share/doc/bweb
usr/share/bweb
usr/share/bweb/tpl
-usr/share/bweb/fr/tpl
-usr/share/bweb/es/tpl
+usr/share/bweb/tpl/en
+usr/share/bweb/tpl/fr
+usr/share/bweb/tpl/es
usr/share/bweb/html
usr/share/perl5
var/spool/bweb
fi
-if [ "$1" = "upgrade" ] ; then
- echo "If you are using postgresql, you have to load /usr/share/bweb/upgrade-2.0_2.2_postgresql.sql in your database"
- echo "postgres@localhost:~$ psql -U bacula bacula < /usr/share/bweb/upgrade-2.0_2.2_postgresql.sql"
- echo
-fi
bweb (2.2.7-1) stable; urgency=low
+ * Move /usr/share/bweb/fr/tpl to /usr/share/bweb/tpl/fr
+ * Move /usr/share/bweb/es/tpl to /usr/share/bweb/tpl/es
+ * Move default /usr/share/bweb/tpl to /usr/share/bweb/tpl/en
+ * Each user can have his own language
* Add new balloon view
* Add new btime module
* Add a new scheduled view, you MUST have Date::Calc module
install -m 755 bweb/cgi/bresto.pl debian/bweb/usr/lib/cgi-bin/bweb
install -m 755 bweb/cgi/bfileview.pl debian/bweb/usr/lib/cgi-bin/bweb
install -m 755 bweb/cgi/bconsole.pl debian/bweb/usr/lib/cgi-bin/bweb
- install -m 644 bweb/tpl/*.tpl debian/bweb/usr/share/bweb/tpl
- install -m 644 bweb/lang/fr/tpl/*.tpl debian/bweb/usr/share/bweb/fr/tpl
- install -m 644 bweb/lang/es/tpl/*.tpl debian/bweb/usr/share/bweb/es/tpl
+ install -m 644 bweb/lang/en/tpl/*.tpl debian/bweb/usr/share/bweb/tpl/en
+ install -m 644 bweb/lang/fr/tpl/*.tpl debian/bweb/usr/share/bweb/tpl/fr
+ install -m 644 bweb/lang/es/tpl/*.tpl debian/bweb/usr/share/bweb/tpl/es
install -m 644 bweb/html/*.js debian/bweb/usr/share/bweb/html
install -m 644 bweb/html/*.css debian/bweb/usr/share/bweb/html
install -m 644 bweb/html/*.png debian/bweb/usr/share/bweb/html