Permalink
Browse files

Added description field in subnet/create

  • Loading branch information...
1 parent 5f325ec commit 802dffff5a5c58f2bf8d6a8a392177fbba87a9f3 @rigorighetti rigorighetti committed Nov 11, 2011
Showing with 24 additions and 18 deletions.
  1. +11 −9 lib/Manoc/Controller/IpRange.pm
  2. +7 −7 lib/Manoc/DB/Result/IPRange.pm
  3. +5 −0 root/src/iprange/create.tt
  4. +1 −2 root/src/iprange/edit.tt
@@ -653,8 +653,8 @@ sub create : Chained('base') : PathPart('create') : Args() {
}
$tmpl_param{range} = $c->req->param('name');
$tmpl_param{parent} = $parent;
- $tmpl_param{type_subnet} = $c->req->param('type') eq 'subnet';
- $tmpl_param{type_range} = $c->req->param('type') eq 'range';
+ $tmpl_param{type_subnet} = $c->req->param('type') eq 'subnet' if(defined($c->req->param('type')));
+ $tmpl_param{type_range} = $c->req->param('type') eq 'range' if(defined($c->req->param('type')));
$tmpl_param{vlans} = \@vlans;
$tmpl_param{template} = 'iprange/create.tt';
@@ -667,6 +667,7 @@ sub process_create : Private {
my $name = $c->req->param('name');
my $type = $c->req->param('type');
my $vlan_id = $c->req->param('vlan');
+ my $desc = $c->req->param('description');
my $error;
$name or $error->{name} = "Please insert range name";
@@ -780,13 +781,14 @@ sub process_create : Private {
$c->stash->{'resultset'}->create(
{
- name => $name,
- parent => $parent_name,
- from_addr => int2ip($from_addr_i),
- to_addr => int2ip($to_addr_i),
- network => $network_i ? int2ip($network_i) : undef,
- netmask => $netmask_i ? int2ip($netmask_i) : undef,
- vlan_id => $vlan_id,
+ name => $name,
+ parent => $parent_name,
+ from_addr => int2ip($from_addr_i),
+ to_addr => int2ip($to_addr_i),
+ network => $network_i ? int2ip($network_i) : undef,
+ netmask => $netmask_i ? int2ip($netmask_i) : undef,
+ vlan_id => $vlan_id,
+ description => $desc
}
) or
return ( 0, "Impossible create subnet" );
@@ -63,13 +63,13 @@ __PACKAGE__->has_many(
children => 'Manoc::DB::Result::IPRange',
{ 'foreign.parent' => 'self.name' }
);
-__PACKAGE__->resultset_attributes( { order_by => [ 'from_addr', 'to_addr' ] } );
+# __PACKAGE__->resultset_attributes( { order_by => [ 'from_addr', 'to_addr' ] } );
-foreach my $col (qw(from_addr to_addr network netmask)) {
- __PACKAGE__->filter_column(
- $col => {
- filter_to_storage => sub { Manoc::Utils::padded_ipaddr($_[1]) },
- });
-}
+# foreach my $col (qw(from_addr to_addr network netmask)) {
+# __PACKAGE__->filter_column(
+# $col => {
+# filter_to_storage => sub { Manoc::Utils::padded_ipaddr($_[1]) },
+# });
+# }
1;
@@ -61,6 +61,11 @@ onClick="javascript:enableFields()" [% IF type_subnet %] checked [% END %] />Sub
</select>
</td>
</tr>
+<tr>
+ <td class="label">Description: </td>
+ <td><textarea cols="40" rows="6" name="description">[% object.description | html -%]
+ </textarea></input></td>
+</tr>
</table>
<div class="buttons">
<input type="submit" name="submit" value="Submit">
View
@@ -56,8 +56,7 @@
</tr>
<tr>
<td class="label">Description: </td>
- <td><textarea cols="40" rows="6" name="description">[%
- object.description | html %]
+ <td><textarea cols="40" rows="6" name="description">[% object.description | html -%]
</textarea></input></td>
</tr>
</table>

0 comments on commit 802dfff

Please sign in to comment.