| 1 |
<?php |
<?php |
| 2 |
// $Id: workflow.admin.inc,v 1.6 2008/12/31 21:38:07 jvandyk Exp $ |
// $Id: workflow.admin.inc,v 1.7 2009/01/01 20:33:20 jvandyk Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 132 |
|
|
| 133 |
while ($data = db_fetch_object($result)) { |
while ($data = db_fetch_object($result)) { |
| 134 |
foreach (explode(',', $data->roles) as $role) { |
foreach (explode(',', $data->roles) as $role) { |
| 135 |
$all[$role]['transitions'][] = array($data->state_name, WORKFLOW_ARROW, $data->target_state_name); |
$all[$role]['transitions'][] = array(check_plain(t($data->state_name)), WORKFLOW_ARROW, check_plain(t($data->target_state_name))); |
| 136 |
} |
} |
| 137 |
} |
} |
| 138 |
|
|
| 248 |
foreach ($states as $state_id => $name) { |
foreach ($states as $state_id => $name) { |
| 249 |
// Don't allow transition TO (creation). |
// Don't allow transition TO (creation). |
| 250 |
if ($name != t('(creation)')) { |
if ($name != t('(creation)')) { |
| 251 |
$header[] = array('data' => t($name)); |
$header[] = array('data' => check_plain(t($name))); |
| 252 |
} |
} |
| 253 |
$row = array(array('data' => $name)); |
$row = array(array('data' => check_plain(t($name)))); |
| 254 |
foreach ($states as $nested_state_id => $nested_name) { |
foreach ($states as $nested_state_id => $nested_name) { |
| 255 |
if ($nested_name == t('(creation)')) { |
if ($nested_name == t('(creation)')) { |
| 256 |
// Don't allow transition TO (creation). |
// Don't allow transition TO (creation). |
| 466 |
$tid = workflow_get_transition_id($from, $to); |
$tid = workflow_get_transition_id($from, $to); |
| 467 |
$form[$from][$to][$rid] = array( |
$form[$from][$to][$rid] = array( |
| 468 |
'#type' => 'checkbox', |
'#type' => 'checkbox', |
| 469 |
'#title' => $role_name, |
'#title' => check_plain($role_name), |
| 470 |
'#default_value' => $tid ? workflow_transition_allowed($tid, $rid) : FALSE); |
'#default_value' => $tid ? workflow_transition_allowed($tid, $rid) : FALSE); |
| 471 |
} |
} |
| 472 |
} |
} |
| 507 |
unset($links['workflow_overview_actions']); |
unset($links['workflow_overview_actions']); |
| 508 |
} |
} |
| 509 |
|
|
| 510 |
$row[] = array($name, theme('links', $links)); |
$row[] = array(check_plain(t($name)), theme('links', $links)); |
| 511 |
$subrows = array(); |
$subrows = array(); |
| 512 |
|
|
| 513 |
foreach ($states as $sid => $state_name) { |
foreach ($states as $sid => $state_name) { |
| 514 |
$state_links = array(); |
$state_links = array(); |
| 515 |
if (!workflow_is_system_state(t($state_name))) { |
if (!workflow_is_system_state(check_plain(t($state_name)))) { |
| 516 |
$state_links = array( |
$state_links = array( |
| 517 |
'workflow_overview_edit_state' => array( |
'workflow_overview_edit_state' => array( |
| 518 |
'title' => t('Edit'), |
'title' => t('Edit'), |
| 526 |
} |
} |
| 527 |
// Allow modules to insert state operations. |
// Allow modules to insert state operations. |
| 528 |
$state_links = array_merge($state_links, module_invoke_all('workflow_operations', 'state', $wid, $sid)); |
$state_links = array_merge($state_links, module_invoke_all('workflow_operations', 'state', $wid, $sid)); |
| 529 |
$subrows[] = array(t($state_name), theme('links', $state_links)); |
$subrows[] = array(check_plain(t($state_name)), theme('links', $state_links)); |
| 530 |
unset($state_links); |
unset($state_links); |
| 531 |
} |
} |
| 532 |
|
|
| 643 |
foreach (node_get_types('names') as $type => $name) { |
foreach (node_get_types('names') as $type => $name) { |
| 644 |
$form[$type]['workflow'] = array( |
$form[$type]['workflow'] = array( |
| 645 |
'#type' => 'select', |
'#type' => 'select', |
| 646 |
'#title' => $name, |
'#title' => check_plain($name), |
| 647 |
'#options' => $workflows, |
'#options' => $workflows, |
| 648 |
'#default_value' => isset($type_map[$type]) ? $type_map[$type] : 0 |
'#default_value' => isset($type_map[$type]) ? $type_map[$type] : 0 |
| 649 |
); |
); |
| 687 |
function workflow_types_form_submit($form, &$form_state) { |
function workflow_types_form_submit($form, &$form_state) { |
| 688 |
workflow_types_save($form_state['values']); |
workflow_types_save($form_state['values']); |
| 689 |
drupal_set_message(t('The workflow mapping was saved.')); |
drupal_set_message(t('The workflow mapping was saved.')); |
| 690 |
menu_rebuild(); |
menu_rebuild(); |
| 691 |
$form_state['redirect'] = 'admin/build/workflow'; |
$form_state['redirect'] = 'admin/build/workflow'; |
| 692 |
} |
} |