2 |
## $Id$ |
## $Id$ |
3 |
## --------------------------------------------------------------------------- |
## --------------------------------------------------------------------------- |
4 |
## $Log$ |
## $Log$ |
5 |
|
## Revision 1.15 2003/02/27 14:39:48 jonen |
6 |
|
## + fixed bug at _hash2object() |
7 |
|
## |
8 |
|
## Revision 1.14 2003/02/22 17:13:55 jonen |
9 |
|
## + added function 'childObject2string()' to encode 'child'-references to option related string |
10 |
|
## + use new option at 'expand()' for replacing 'childObject2string' |
11 |
|
## |
12 |
## Revision 1.13 2003/02/21 01:48:50 joko |
## Revision 1.13 2003/02/21 01:48:50 joko |
13 |
## renamed core function |
## renamed core function |
14 |
## |
## |
162 |
my $item; |
my $item; |
163 |
# if current item is a reference ... |
# if current item is a reference ... |
164 |
if (ref $_[0]) { |
if (ref $_[0]) { |
165 |
# ... expand structure recursively |
$item = $_[0]; |
166 |
$item = expand($_[0], $options); |
# if $options->{childObj2string} is TRUE or STRING don't expand referenced object, |
167 |
|
# instead replace it by per option choosed string (default: o_<classname>_<ref type>_<guid> ) |
168 |
|
if ($item && $options->{childObj2string}) { |
169 |
|
$item = childObj2string($item, $options->{childObj2string}); |
170 |
|
} else { |
171 |
|
# ... expand structure recursively |
172 |
|
$item = expand($_[0], $options); |
173 |
|
} |
174 |
# destroy item via seperate callback method (a POST) if requested |
# destroy item via seperate callback method (a POST) if requested |
175 |
#$options->{cb}->{destroy}->($_[0]) if $options->{destroy}; |
#$options->{cb}->{destroy}->($_[0]) if $options->{destroy}; |
176 |
|
|
199 |
|
|
200 |
# if current item is a reference ... |
# if current item is a reference ... |
201 |
if (ref $_[1]) { |
if (ref $_[1]) { |
202 |
# ... expand structure recursively |
$item = $_[1]; |
203 |
$item = expand($_[1], $options); |
# if $options->{childObj2string} is TRUE or STRING don't expand referenced object, |
204 |
|
# instead replace it by per option choosed string (default: o_<classname>_<ref type>_<guid> ) |
205 |
|
if ($item && $options->{childObj2string} && !(ref $_[1] eq "ARRAY") && !(ref $_[1] eq "HASH")) { |
206 |
|
$item = childObj2string($item, $options->{childObj2string}); |
207 |
|
} else { |
208 |
|
# ... expand structure recursively |
209 |
|
$item = expand($_[1], $options); |
210 |
|
} |
211 |
# destroy item via seperate callback method (a POST) if requested |
# destroy item via seperate callback method (a POST) if requested |
212 |
#$options->{cb}->{destroy}->($_[1]) if $options->{destroy}; |
#$options->{cb}->{destroy}->($_[1]) if $options->{destroy}; |
213 |
|
|
308 |
numhash2list($data) if ($options->{php}); |
numhash2list($data) if ($options->{php}); |
309 |
|
|
310 |
# utf8-conversion/-encoding (essential for I18N) |
# utf8-conversion/-encoding (essential for I18N) |
311 |
var_utf2iso($data) if ($options->{utf8}); |
utf8_to_latin($data) if ($options->{utf8}); |
312 |
|
|
313 |
# get fresh object from database |
# get fresh object from database |
314 |
# todo: |
# todo: |
479 |
} |
} |
480 |
|
|
481 |
|
|
482 |
|
sub childObj2string { |
483 |
|
my $obj = shift; |
484 |
|
my $option = shift; |
485 |
|
my $classname = ref $obj; |
486 |
|
|
487 |
|
if($option == 1) { |
488 |
|
my $string = "o_" . $classname . "_" .$obj->{guid}; |
489 |
|
return $string; |
490 |
|
} |
491 |
|
} |
492 |
|
|
493 |
|
|
494 |
1; |
1; |
495 |
__END__ |
__END__ |