Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 9816fbfe

Von Sven Schöling vor etwa 13 Jahren hinzugefügt

  • ID 9816fbfe7ec8e672dc93685111082d3ac9d51800
  • Vorgänger 2bb92a98
  • Nachfolger 84565d3d

select_project in templates ausgelagert

Unterschiede anzeigen:

bin/mozilla/arap.pl
340 340
}
341 341

  
342 342
sub select_project {
343
  $main::lxdebug->enter_sub();
344

  
345
  my $form     = $main::form;
346
  my $locale   = $main::locale;
347
  my $cgi      = $main::cgi;
343
  $::lxdebug->enter_sub;
348 344

  
349
  $main::auth->assert('general_ledger         | vendor_invoice_edit  | sales_order_edit    | invoice_edit |' .
350
                'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash         | report');
345
  $::auth->assert('general_ledger         | vendor_invoice_edit  | sales_order_edit    | invoice_edit |' .
346
                  'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash         | report');
351 347

  
352 348
  my ($is_global, $nextsub) = @_;
349
  my $project_list = delete $::form->{project_list};
353 350

  
354
  my @column_index = qw(ndx projectnumber description);
355

  
356
  my %column_data;
357
  $column_data{ndx}           = qq|<th>&nbsp;</th>|;
358
  $column_data{projectnumber} = qq|<th>| . $locale->text('Number') . qq|</th>|;
359
  $column_data{description}   =
360
    qq|<th>| . $locale->text('Description') . qq|</th>|;
361

  
362
  # list items with radio button on a form
363
  $form->header;
364

  
365
  my $title = $locale->text('Select from one of the projects below');
366

  
367
  print qq|
368
<body>
369

  
370
<form method=post action=$form->{script}>
371

  
372
<input type=hidden name=rownumber value=$form->{rownumber}>
373

  
374
<table width=100%>
375
  <tr>
376
    <th class=listtop>$title</th>
377
  </tr>
378
  <tr space=5></tr>
379
  <tr>
380
    <td>
381
      <table width=100%>
382
        <tr class=listheading>|;
383

  
384
  map { print "\n$column_data{$_}" } @column_index;
385

  
386
  print qq|
387
        </tr>
388
|;
389

  
390
  my $i = 0;
391
  my $j;
392
  foreach my $ref (@{ $form->{project_list} }) {
393
    my $checked = ($i++) ? "" : "checked";
394

  
395
    $ref->{name} =~ s/\"/&quot;/g;
396

  
397
    $column_data{ndx} =
398
      qq|<td><input name=ndx class=radio type=radio value=$i $checked></td>|;
399
    $column_data{projectnumber} =
400
      qq|<td><input name="new_projectnumber_$i" type=hidden value="$ref->{projectnumber}">$ref->{projectnumber}</td>|;
401
    $column_data{description} = qq|<td>$ref->{description}</td>|;
402

  
403
    $j++;
404
    $j %= 2;
405
    print qq|
406
        <tr class=listrow$j>|;
407

  
408
    map { print "\n$column_data{$_}" } @column_index;
409

  
410
    print qq|
411
        </tr>
412

  
413
<input name="new_id_$i" type=hidden value=$ref->{id}>
414

  
415
|;
416

  
417
  }
418

  
419
  print qq|
420
      </table>
421
    </td>
422
  </tr>
423
  <tr>
424
    <td><hr size=3 noshade></td>
425
  </tr>
426
</table>
427

  
428
<input name=lastndx type=hidden value=$i>
429

  
430
|;
351
  map { delete $::form->{$_} } qw(action header update);
431 352

  
432
  # delete action variable
433
  map { delete $form->{$_} } qw(action project_list header update);
434

  
435
  # save all other form variables
436
  foreach my $key (keys %${form}) {
437
    next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
438
    $form->{$key} =~ s/\"/&quot;/g;
439
    print qq|<input name=$key type=hidden value="$form->{$key}">\n|;
353
  my @hiddens;
354
  for my $key (keys %$::form) {
355
    next if $key eq 'login' || $key eq 'password' || '' ne ref $::form->{$key};
356
    push @hiddens, { key => $key, value => $::form->{$key} };
440 357
  }
358
  push @hiddens, { key => 'is_global',                value => $is_global },
359
                 { key => 'project_selected_nextsub', value => $nextsub };
441 360

  
442
  print
443
      $cgi->hidden('-name' => 'is_global',                '-default' => [$is_global])
444
    . $cgi->hidden('-name' => 'project_selected_nextsub', '-default' => [$nextsub])
445
    . qq|<input type=hidden name=nextsub value=project_selected>
446

  
447
<br>
448
<input class=submit type=submit name=action value="|
449
    . $locale->text('Continue') . qq|">
450
</form>
361
  $::form->header;
362
  print $::form->parse_html_template('arap/select_project', { hiddens => \@hiddens, project_list => $project_list });
451 363

  
452
</body>
453
</html>
454
|;
455

  
456
  $main::lxdebug->leave_sub();
364
  $::lxdebug->leave_sub;
457 365
}
458 366

  
459 367
sub project_selected {
templates/webpages/arap/select_project.html
1
[%- USE HTML %]
2
[%- USE T8 %]
3
[%- USE L  %]
4
[%- USE LxERP %]
5
<body>
6

  
7
<h1>[% 'Select from one of the projects below' | $T8 %]</h1>
8

  
9
<form method=post action="[% script %]">
10

  
11
<table width=100%>
12
 <tr class=listheading>
13
  <th>&nbsp;</th>
14
  <th>[% 'Number' | $T8 %]</th>
15
  <th>[% 'Description' | $T8 %]</th>
16
 </tr>
17
[%- FOREACH row IN project_list %]
18
 <tr class=listrow[% loop.count % 2 %]>
19
  <td>[% L.radio_button_tag('ndx', value=loop.count, checked=loop.first) %]</td>
20
  <td>[% row.projectnumber | html %]</td>
21
  <td>[% row.description | html %]</td>
22
  [% L.hidden_tag('new_id_' _ loop.count, row.id) %]
23
  [% L.hidden_tag('new_projectnumber_' _ loop.count, row.projectnumber) %]
24
 </tr>
25
[%- END %]
26
</table>
27

  
28
<hr size=3 noshade>
29

  
30
[% L.hidden_tag(row.key, row.value) FOREACH row = hiddens %]
31
[% L.hidden_tag('lastndx', project_list.size) %]
32
[% L.hidden_tag('nextsub', 'project_selected') %]
33
[% L.hidden_tag('rownumber', rownumber) %]
34
[% L.submit_tag('action', LxERP.t8('Continue')) %]
35

  
36
</form>
37

  
38
</body>
39
</html>

Auch abrufbar als: Unified diff