| |
1328 |
1328 |
} |
| |
1329 |
1329 |
|
| |
1330 |
1330 |
default { |
| |
1331 |
1331 |
# By default a callback proc takes no arguments |
| |
1332 |
1332 |
return [list] |
| |
1333 |
1333 |
} |
| |
1334 |
1334 |
} |
| |
1335 |
1335 |
} |
| |
1336 |
1336 |
|
| |
1337 |
1337 |
ad_proc -public apm_supported_callback_types {} { |
| |
1338 |
1338 |
Gets the list of package callback types |
| |
1339 |
1339 |
that are supported by the system. |
| |
1340 |
1340 |
Each callback type represents a certain event or time |
| |
1341 |
1341 |
when a Tcl procedure should be invoked, such as after-install |
| |
1342 |
1342 |
|
| |
1343 |
1343 |
@author Peter Marklund |
| |
1344 |
1344 |
} { |
| |
1345 |
1345 |
return [list after-install after-instantiate after-mount before-uninstantiate before-uninstall before-unmount] |
| |
1346 |
1346 |
} |
| |
1347 |
1347 |
|
| |
|
1348 |
ad_proc -private apm_callback_has_valid_args { |
| |
|
1349 |
{-type:required} |
| |
|
1350 |
{-proc_name:required} |
| |
|
1351 |
} { |
| |
|
1352 |
Returns 1 if the specified callback proc of a certain |
| |
|
1353 |
type has a valid argument list in its definition and 0 |
| |
|
1354 |
otherwise. Assumes that the callback proc is defined with |
| |
|
1355 |
ad_proc. |
| |
|
1356 |
|
| |
|
1357 |
@author Peter Marklund |
| |
|
1358 |
} { |
| |
|
1359 |
|
| |
|
1360 |
if { [empty_string_p [info procs ::${proc_name}]] } { |
| |
|
1361 |
return 0 |
| |
|
1362 |
} |
| |
|
1363 |
|
| |
|
1364 |
set test_arg_list "" |
| |
|
1365 |
foreach arg_name [apm_arg_names_for_callback_type -type $type] { |
| |
|
1366 |
append test_arg_list " -${arg_name} value" |
| |
|
1367 |
} |
| |
|
1368 |
|
| |
|
1369 |
if { [empty_string_p $test_arg_list] } { |
| |
|
1370 |
# The callback proc should take no args |
| |
|
1371 |
return [empty_string_p [info args ::${proc_name}]] |
| |
|
1372 |
} |
| |
|
1373 |
|
| |
|
1374 |
# The callback proc should have required arg switches. Check |
| |
|
1375 |
# that the ad_proc arg parser doesn't throw an error with |
| |
|
1376 |
# test arg list |
| |
|
1377 |
if { [catch { |
| |
|
1378 |
set args $test_arg_list |
| |
|
1379 |
::${proc_name}__arg_parser |
| |
|
1380 |
} errmsg] } { |
| |
|
1381 |
return 0 |
| |
|
1382 |
} else { |
| |
|
1383 |
return 1 |
| |
|
1384 |
} |
| |
|
1385 |
} |
| |
|
1386 |
|
| |
1348 |
1387 |
ad_proc -public apm_package_instance_new { |
| |
1349 |
1388 |
{-package_id 0} |
| |
1350 |
1389 |
instance_name |
| |
1351 |
1390 |
context_id |
| |
1352 |
1391 |
package_key |
| |
1353 |
1392 |
} { |
| |
1354 |
1393 |
|
| |
1355 |
1394 |
Creates a new instance of a package and call the post instantiation proc, if any. |
| |
1356 |
1395 |
|
| |
1357 |
1396 |
DRB: I split out the subpieces into two procs because the subsite post instantiation proc |
| |
1358 |
1397 |
needs to be able to find the package's node in the site node map, which results in a |
| |
1359 |
1398 |
cart-before-the-horse scenario. The code can't update the site node map until after the |
| |
1360 |
1399 |
package is created yet the original code called the post instantiation proc before the |
| |
1361 |
1400 |
site node code could update the table. |
| |
1362 |
1401 |
|
| |
1363 |
1402 |
@param instance_name The name of the package instance, defaults to the pretty name of the |
| |
1364 |
1403 |
package type. |
| |
1365 |
1404 |
|
| |
1366 |
1405 |
@return The id of the instantiated package |
| |
1367 |
1406 |
} { |