| |
1 |
1 |
ad_page_contract { |
| |
2 |
|
Make a given photo the iconic photo for the album. |
| |
|
2 |
Make a given photo the cover photo for the album. |
| |
3 |
3 |
} { |
| |
4 |
4 |
photo_id:integer,notnull |
| |
5 |
5 |
} -validate { |
| |
6 |
6 |
valid_photo -requires {photo_id:integer} { |
| |
7 |
7 |
if ![string equal [pa_is_photo_p $photo_id] "t"] { |
| |
8 |
8 |
ad_complain "The specified photo is not valid." |
| |
9 |
9 |
} |
| |
10 |
10 |
} |
| |
11 |
11 |
} |
| |
12 |
12 |
|
| |
13 |
13 |
set album_id [db_string get_album_id { |
| |
14 |
14 |
SELECT a.item_id |
| |
15 |
15 |
FROM cr_items i, cr_items a |
| |
16 |
16 |
WHERE i.item_id = :photo_id |
| |
17 |
17 |
and a.item_id = i.parent_id |
| |
18 |
18 |
and i.content_type = 'pa_photo' |
| |
19 |
19 |
and i.live_revision is not null |
| |
20 |
20 |
} -default 0] |
| |
21 |
21 |
|
| |
22 |
22 |
# If we did not get an album ID |