| |
1 |
1 |
ad_library { |
| |
2 |
2 |
API for Simulation roles. |
| |
3 |
3 |
|
| |
4 |
4 |
@author Lars Pind (lars@collaboraid.biz) |
| |
5 |
5 |
@creation-date 2003-10-14 |
| |
6 |
6 |
@cvs-id $Id$ |
| |
7 |
7 |
} |
| |
8 |
8 |
|
| |
9 |
9 |
namespace eval simulation::role {} |
| |
10 |
10 |
|
| |
11 |
11 |
ad_proc -public simulation::role::edit { |
| |
12 |
12 |
{-operation "update"} |
| |
13 |
13 |
{-role_id {}} |
| |
14 |
14 |
{-workflow_id {}} |
| |
15 |
15 |
{-array {}} |
| |
16 |
16 |
{-internal:boolean} |
| |
|
17 |
{-no_complain:boolean} |
| |
17 |
18 |
} { |
| |
18 |
19 |
Edit a role. |
| |
19 |
20 |
|
| |
20 |
21 |
@param operation insert, update, delete |
| |
21 |
22 |
|
| |
22 |
23 |
@param role_id For update/delete: The role to update or delete. |
| |
23 |
24 |
For insert: Optionally specify a pre-generated role_id for the role. |
| |
24 |
25 |
|
| |
25 |
26 |
@param workflow_id For update/delete: Optionally specify the workflow_id. If not specified, we will execute a query to find it. |
| |
26 |
27 |
For insert: The workflow_id of the new role. |
| |
27 |
28 |
|
| |
28 |
29 |
@param array For insert/update: Name of an array in the caller's namespace with attributes to insert/update. |
| |
29 |
30 |
|
| |
30 |
31 |
@param internal Set this flag if you're calling this proc from within the corresponding proc |
| |
31 |
32 |
for a particular workflow model. Will cause this proc to not flush the cache |
| |
32 |
33 |
or call workflow::definition_changed_handler, which the caller must then do. |
| |
33 |
34 |
|
| |
|
35 |
@param no_complain Silently ignore extra attributes that we don't know how to handle. |
| |
|
36 |
|
| |
34 |
37 |
@return role_id |
| |
35 |
38 |
|
| |
36 |
39 |
@see workflow::role::fsm::edit |
| |
37 |
40 |
} { |
| |
38 |
41 |
switch $operation { |
| |
39 |
42 |
update - delete { |
| |
40 |
43 |
if { [empty_string_p $role_id] } { |
| |
41 |
44 |
error "You must specify the role_id of the role to $operation." |
| |
42 |
45 |
} |
| |
43 |
46 |
} |
| |
44 |
47 |
insert {} |
| |
45 |
48 |
default { |
| |
46 |
49 |
error "Illegal operation '$operation'" |
| |
47 |
50 |
} |
| |
48 |
51 |
} |
| |
49 |
52 |
switch $operation { |
| |
50 |
53 |
insert - update { |
| |
51 |
54 |
upvar 1 $array org_row |
| |
52 |
55 |
if { ![array exists org_row] } { |
| |
53 |
56 |
error "Array $array does not exist or is not an array" |