summaryrefslogtreecommitdiff
path: root/httemplate/edit/process/deploy_zone-mobile.html
blob: 9b205ab6e238760f8197672ce6343541e9050341 (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
<& elements/process.html, 
    error_redirect => popurl(2).'deploy_zone-mobile.html',
    table       => 'deploy_zone',
    viewall_dir => 'browse',
    precheck_callback => $precheck_callback,
    process_o2m =>
      { 'table'  => 'deploy_zone_vertex',
                     'fields' => [qw( latitude longitude )]
      },
&>
<%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++;
    }
  }
  if ( length $cgi->param('active_date') ) {
    my $date = parse_datetime( $cgi->param('active_date') );
    $cgi->param('active_date', $date);
  }
  '';
};
</%init>