<h1 class='newstitle'> UbicaciĆ³n : <TMPL_VAR Location></h1>
</div>
<div class='bodydiv'>
- <form action="?" method='get'>
+ <form name='form1' action="?" method='get'>
<input type='hidden' name='location' value='<TMPL_VAR location>'>
<table>
<tr><td>UbicaciĆ³n :</td>
</td>
</tr>
<tr><td>Activado :</td>
- <td> <input class="formulaire" type='checkbox' name='enabled' <TMPL_IF enabled> checked </TMPL_IF> >
- </td>
+ <td> <select name='enabled' class='formulaire'>
+ <option value='yes'>yes</option>
+ <option value='no'>no</option>
+ <option value='archived'>archived</option>
+ </select>
+ </td>
</tr>
</table>
<input type="image" name='action' value='location_save'
src='/bweb/save.png'>
</form>
</div>
+<script type="text/javascript" language='JavaScript'>
+ok=1;
+for (var i=0; ok && i < document.form1.enabled.length; ++i) {
+ if (document.form1.enabled[i].value == '<TMPL_VAR enabled>') {
+ document.form1.enabled[i].selected = true;
+ ok=0;
+ }
+}
+</script>
<h1 class='newstitle'> Localisation : <TMPL_VAR Location></h1>
</div>
<div class='bodydiv'>
- <form action="?" method='get'>
+ <form name='form1' action="?" method='get'>
<input type='hidden' name='location' value='<TMPL_VAR location>'>
<table>
<tr><td>Localisation :</td>
<td> <input class="formulaire" type='text' value='<TMPL_VAR cost>' name='cost' size='3'>
</td>
</tr>
- <tr><td>Enabled :</td>
- <td> <input class="formulaire" type='checkbox' name='enabled' <TMPL_IF enabled> checked </TMPL_IF> >
- </td>
- </tr>
+ <tr><td>Enabled:</td>
+ <td> <select name='enabled' class='formulaire'>
+ <option value='yes'>yes</option>
+ <option value='no'>no</option>
+ <option value='archived'>archived</option>
+ </select>
+ </td>
+ </tr>
</table>
<input type="image" name='action' value='location_save'
src='/bweb/save.png'>
</form>
</div>
+<script type="text/javascript" language='JavaScript'>
+ok=1;
+for (var i=0; ok && i < document.form1.enabled.length; ++i) {
+ if (document.form1.enabled[i].value == '<TMPL_VAR enabled>') {
+ document.form1.enabled[i].selected = true;
+ ok=0;
+ }
+}
+</script>
{
my $val = shift || 0;
- if ($val == 1 or $val eq "yes") {
+ if ($val eq '1' or $val eq "yes") {
return "yes";
- } elsif ($val == 2 or $val eq "archived") {
+ } elsif ($val eq '2' or $val eq "archived") {
return "archived";
} else {
return "no";
}
}
+# display Enabled
+sub from_human_enabled
+{
+ my $val = shift || 0;
+
+ if ($val == 1 or $val eq "yes") {
+ return 1;
+ } elsif ($val == 2 or $val eq "archived") {
+ return 2;
+ } else {
+ return 0;
+ }
+}
+
# get Day, Hour, Year
sub from_human_sec
{
if ($self->{info}->{dbi} =~ /^dbi:Pg/i) {
$self->{dbh}->do("SET datestyle TO 'ISO, YMD'");
+ } else {
+ $self->{dbh}->do("SET group_concat_max_len=1000000");
}
}
}
";
my $row = $self->dbh_selectrow_hashref($query);
-
+ $row->{enabled} = human_enabled($row->{enabled});
$self->display({ ID => $cur_id++,
%$row }, "location_edit.tpl") ;
}
my ($self) = @_ ;
$self->can_do('r_location_mgnt');
- my $arg = $self->get_form(qw/qlocation qnewlocation cost/) ;
+ my $arg = $self->get_form(qw/qlocation qnewlocation cost enabled/) ;
unless ($arg->{qlocation}) {
return $self->error("Can't get location");
}
return $self->error("Can't get new cost");
}
- my $enabled = CGI::param('enabled') || '';
- $enabled = $enabled?1:0;
+ my $enabled = from_human_enabled($arg->{enabled});
my $query = "
UPDATE Location SET Cost = $arg->{cost},
<h1 class='newstitle'> Location : <TMPL_VAR Location></h1>
</div>
<div class='bodydiv'>
- <form action="?" method='get'>
+ <form name='form1' action="?" method='get'>
<input type='hidden' name='location' value='<TMPL_VAR location>'>
<table>
<tr><td>Location :</td>
<td> <input class="formulaire" type='text' value='<TMPL_VAR cost>' name='cost' size='3'>
</td>
</tr>
- <tr><td>Enabled :</td>
- <td> <input class="formulaire" type='checkbox' name='enabled' <TMPL_IF enabled> checked </TMPL_IF> >
- </td>
- </tr>
+ <tr><td>Enabled:</td>
+ <td> <select name='enabled' class='formulaire'>
+ <option value='yes'>yes</option>
+ <option value='no'>no</option>
+ <option value='archived'>archived</option>
+ </select>
+ </td>
+ </tr>
</table>
<input type="image" name='action' value='location_save'
src='/bweb/save.png'>
</form>
</div>
+
+<script type="text/javascript" language='JavaScript'>
+ok=1;
+for (var i=0; ok && i < document.form1.enabled.length; ++i) {
+ if (document.form1.enabled[i].value == '<TMPL_VAR enabled>') {
+ document.form1.enabled[i].selected = true;
+ ok=0;
+ }
+}
+</script>