| |
33 |
33 |
|
| |
34 |
34 |
template::element create album_add title -html { size 30 } \ |
| |
35 |
35 |
-label "[_ photo-album.Album_Name]" -datatype text |
| |
36 |
36 |
|
| |
37 |
37 |
template::element create album_add photographer -html { size 50} \ |
| |
38 |
38 |
-label "[_ photo-album.Photographer_]" -datatype text -optional |
| |
39 |
39 |
|
| |
40 |
40 |
template::element create album_add description -html { size 50 } \ |
| |
41 |
41 |
-label "[_ photo-album._Album]" -datatype text -optional |
| |
42 |
42 |
|
| |
43 |
43 |
template::element create album_add story -html {cols 50 rows 4} \ |
| |
44 |
44 |
-label "[_ photo-album._Album_1]" -datatype text -widget textarea -optional |
| |
45 |
45 |
|
| |
46 |
46 |
if { [template::form is_request album_add] } { |
| |
47 |
47 |
set album_id [db_nextval acs_object_id_seq] |
| |
48 |
48 |
template::element set_properties album_add album_id -value $album_id |
| |
49 |
49 |
template::element set_properties album_add parent_id -value $parent_id |
| |
50 |
50 |
} |
| |
51 |
51 |
|
| |
52 |
52 |
if { [template::form is_valid album_add] } { |
| |
53 |
|
# vaild new album submission so create new album |
| |
|
53 |
# valid new album submission so create new album |
| |
54 |
54 |
set user_id [ad_conn user_id] |
| |
55 |
55 |
set peeraddr [ad_conn peeraddr] |
| |
56 |
56 |
set album_id [template::element::get_value album_add album_id] |
| |
57 |
57 |
set parent_id [template::element::get_value album_add parent_id] |
| |
58 |
58 |
set title [template::element::get_value album_add title] |
| |
59 |
59 |
set description [template::element::get_value album_add description] |
| |
60 |
60 |
set story [template::element::get_value album_add story] |
| |
61 |
61 |
set photographer [template::element::get_value album_add photographer] |
| |
62 |
62 |
# file safe title into name |
| |
63 |
63 |
regsub -all { +} [string tolower $title] {_} name |
| |
64 |
64 |
regsub -all {/+} $name {-} name |
| |
65 |
65 |
|
| |
66 |
66 |
db_transaction { |
| |
67 |
67 |
# add the album |
| |
68 |
68 |
db_exec_plsql new_album {} |
| |
69 |
69 |
|
| |
70 |
70 |
pa_grant_privilege_to_creator $album_id $user_id |
| |
71 |
71 |
|
| |
72 |
72 |
} on_error { |
| |
73 |
73 |
# most likely a duplicate name or a double click |