Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7c215391

Von Kivitendo Admin vor mehr als 9 Jahren hinzugefügt

  • ID 7c21539153d43f09a72398d77d07ebc302a6fd9d
  • Vorgänger 185d9aae
  • Nachfolger 818499d9

Typos und Kommentare angepasst

Unterschiede anzeigen:

SL/DB/Manager/Employee.pm
70 70
For each user created by the administrator in the admin section an
71 71
entry only exists in the authentication table, but not in the employee
72 72
table. This is where this function comes in: It iterates over all
73
authentication users that have access to the current client and ensure
74
than an entry for them exists in the table C<employee>. The matching
73
authentication users that have access to the current client and ensures
74
that an entry for them exists in the table C<employee>. The matching
75 75
is done via the login name which must be the same in both tables.
76 76

  
77 77
The only other properties that will be copied from the authentication
SL/Request.pm
169 169
          # legacy, some old upload routines expect this to be here
170 170
          $temp_target->{FILENAME} = $filename if defined $filename;
171 171

  
172
          # name can potentially be both a normal variable or a file upload
173
          # a file upload can be identified by its "filename" attribute
174
          # the thing is, if a [+] clause vivifies atructur in one of the
172
          # Name can potentially be both a normal variable or a file upload.
173
          # A file upload can be identified by its "filename" attribute.
174
          # The thing is, if a [+] clause vivifies structure in one of the
175 175
          # branches it must be done in both, or subsequent "[]" will fail
176 176
          my $temp_target_slot = _store_value($temp_target, $name);
177 177
          my $target_slot      = _store_value($target,      $name);
......
286 286
    read STDIN, $content, $ENV{CONTENT_LENGTH};
287 287
    if ($ENV{'CONTENT_TYPE'} && $ENV{'CONTENT_TYPE'} =~ /multipart\/form-data/) {
288 288
      # multipart formdata can bring it's own encoding, so give it both
289
      # and let ti decide on it's own
289
      # and let it decide on it's own
290 290
      _parse_multipart_formdata($target, $temp_target, $content, 1);
291 291
    } else {
292 292
      # normal encoding must be recoded
......
313 313
  my ($source, $target, $prefix, $in_array) = @_;
314 314
  $target ||= [];
315 315

  
316
  # there are two edge cases that need attention. first: more than one hash
317
  # inside an array.  only the first of each nested can have a [+].  second: if
316
  # There are two edge cases that need attention. First: more than one hash
317
  # inside an array.  Only the first of each nested can have a [+].  Second: if
318 318
  # an array contains mixed values _store_value will rely on autovivification.
319
  # so any type change must have a [+]
320
  # this closure decides one recursion step AFTER an array has been found if a
319
  # So any type change must have a [+]
320
  # This closure decides one recursion step AFTER an array has been found if a
321 321
  # [+] needs to be generated
322 322
  my $arr_prefix = sub {
323 323
    return $_[0] ? '[+]' : '[]' if $in_array;
......
373 373
=head1 SYNOPSIS
374 374

  
375 375
This module handles unpacking of CGI parameters. It also gives
376
information about the request like whether or not it was done via AJAX
376
information about the request, such as whether or not it was done via AJAX,
377 377
or the requested content type.
378 378

  
379 379
  use SL::Request qw(read_cgi_input);
......
418 418

  
419 419
=item Arrays
420 420

  
421
Arrays will by trailing empty brackets (C<[]>). An hash like this
421
Arrays will be marked by empty brackets (C<[]>). A hash like this
422 422

  
423 423
  selected_id => [ 2, 6, 8, 9 ]
424 424

  
......
439 439

  
440 440
=item Nested structures
441 441

  
442
A special version of this are nested hashs in an array, which is very common.
442
A special version of this are nested hashes in an array, which is very common.
443 443
The combined operator (C<[].>) will be used. As a special case, every time a new
444 444
array slice is started, the special convention (C<[+].>) will be used. Again this
445 445
is because it's easy to write a template with it.
......
491 491

  
492 492
=item Sparse Arrays
493 493

  
494
It is not possible to serialize somehing like
494
It is not possible to serialize something like
495 495

  
496 496
  sparse_array => do { my $sa = []; $sa[100] = 1; $sa },
497 497

  
......
522 522
This function will flatten the provided hash ref into the provided array ref.
523 523
The array ref may be non empty, but will be changed in this case.
524 524

  
525
Return value is the flattened array ref.
525
The return value is the flattened array ref.
526 526

  
527 527
=item C<unflatten ARRAYREF [ HASHREF ]>
528 528

  
......
540 540
=item C<layout>
541 541

  
542 542
Set and retrieve the layout object for the current request. Must be an instance
543
of L<SL::Layout::Base>. Defaults to an isntance of L<SL::Layout::None>.
543
of L<SL::Layout::Base>. Defaults to an instance of L<SL::Layout::None>.
544 544

  
545 545
For more information about layouts, see L<SL::Layout::Dispatcher>.
546 546

  
......
565 565

  
566 566
=head2 C<_store_value()>
567 567

  
568
parses a complex var name, and stores it in the form.
568
Parses a complex var name, and stores it in the form.
569 569

  
570
syntax:
570
Syntax:
571 571
  _store_value($target, $key, $value);
572 572

  
573
keys must start with a string, and can contain various tokens.
574
supported key structures are:
573
Keys must start with a string, and can contain various tokens.
574
Supported key structures are:
575 575

  
576 576
1. simple access
577
  simple key strings work as expected
577
  Simple key strings work as expected
578 578

  
579 579
  id => $form->{id}
580 580

  
581 581
2. hash access.
582
  separating two keys by a dot (.) will result in a hash lookup for the inner value
583
  this is similar to the behaviour of java and templating mechanisms.
582
  Separating two keys by a dot (.) will result in a hash lookup for the inner value
583
  This is similar to the behaviour of java and templating mechanisms.
584 584

  
585 585
  filter.description => $form->{filter}->{description}
586 586

  
587 587
3. array+hashref access
588 588

  
589
  adding brackets ([]) before the dot will cause the next hash to be put into an array.
590
  using [+] instead of [] will force a new array index. this is useful for recurring
591
  data structures like part lists. put a [+] into the first varname, and use [] on the
589
  Adding brackets ([]) before the dot will cause the next hash to be put into an array.
590
  Using [+] instead of [] will force a new array index. This is useful for recurring
591
  data structures like part lists. Put a [+] into the first varname, and use [] on the
592 592
  following ones.
593 593

  
594
  repeating these names in your template:
594
  Repeating these names in your template:
595 595

  
596 596
    invoice.items[+].id
597 597
    invoice.items[].parts_id
......
612 612

  
613 613
4. arrays
614 614

  
615
  using brackets at the end of a name will result in a pure array to be created.
616
  note that you mustn't use [+], which is reserved for array+hash access and will
615
  Using brackets at the end of a name will result in the creation of a pure array.
616
  Note that you mustn't use [+], which is reserved for array+hash access and will
617 617
  result in undefined behaviour in array context.
618 618

  
619 619
  filter.status[]  => $form->{status}->[ val1, val2, ... ]

Auch abrufbar als: Unified diff