summaryrefslogtreecommitdiff
path: root/httemplate/edit/process/deploy_zone-fixed.html
blob: 0033bbe52e6e282153617008e2ebcc920d93b03a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<& elements/process.html, 
    debug => 1,
    error_redirect => popurl(2).'deploy_zone-fixed.html',
    table       => 'deploy_zone',
    viewall_dir => 'browse',
    precheck_callback => $precheck_callback,
    process_o2m =>
      { 'table'  => 'deploy_zone_vertex',
                     'fields' => [qw( latitude longitude )]
      },
    progress_init => [
      'PostForm',
      [ 'zonenum' ],
      $fsurl.'misc/process/deploy_zone-block_lookup.cgi',
      $fsurl.'browse/deploy_zone.html',
    ],
&>
<%init>
my $precheck_callback = sub {
  # convert the vertex list into a process_o2m-style parameter list
  if ( $cgi->param('vertices') ) {
    my $vertices = decode_json($cgi->param('vertices'));
    my $i = 0;
    foreach (@$vertices) {
      $cgi->param("vertexnum${i}", '');
      $cgi->param("vertexnum${i}_latitude", $_->[0]);
      $cgi->param("vertexnum${i}_longitude", $_->[1]);
      $i++;
    }
  }
  '';
};
</%init>