| |
346 |
346 |
} |
| |
347 |
347 |
return $form_part |
| |
348 |
348 |
} |
| |
349 |
349 |
ad_proc object::form::new { |
| |
350 |
350 |
-object_view:required |
| |
351 |
351 |
-object_id |
| |
352 |
352 |
-form |
| |
353 |
353 |
} { |
| |
354 |
354 |
} { |
| |
355 |
355 |
|
| |
356 |
356 |
if { ![info exists form] } { |
| |
357 |
357 |
set form $object_view |
| |
358 |
358 |
} |
| |
359 |
359 |
|
| |
360 |
360 |
if { ![info exists object_id] } { |
| |
361 |
361 |
set object_id [template::element::get_value $form \ |
| |
362 |
362 |
[template::element::get_value $form __key]] |
| |
363 |
363 |
} |
| |
364 |
364 |
|
| |
365 |
365 |
form::get_attributes \ |
| |
|
366 |
-form $form \ |
| |
366 |
367 |
-object_view $object_view \ |
| |
367 |
368 |
-array attributes |
| |
368 |
369 |
|
| |
369 |
370 |
set object_type [object_view::get_element \ |
| |
370 |
371 |
-object_view $object_view \ |
| |
371 |
372 |
-element object_type] |
| |
372 |
373 |
|
| |
373 |
374 |
set attributes(creation_user) "[ad_conn user_id]" |
| |
374 |
375 |
set attributes(creation_ip) "[ad_conn peeraddr]" |
| |
375 |
376 |
set attributes(object_type) "$object_type" |
| |
376 |
377 |
db_transaction { |
| |
377 |
378 |
object::new_inner \ |
| |
378 |
379 |
-object_type $object_type \ |
| |
379 |
380 |
-object_id $object_id \ |
| |
380 |
381 |
-attributes [array get attributes] |
| |
381 |
382 |
} |
| |
382 |
383 |
return $object_id |
| |
383 |
384 |
} |
| |
384 |
385 |
|
| |
385 |
386 |
ad_proc object::form::update { |