| 1 |
<?php |
<?php |
| 2 |
// $Id: weblinks.taxonomy.inc,v 1.3 2008/07/29 02:22:45 rmiddle Exp $ |
// $Id: weblinks.taxonomy.inc,v 1.3.2.1 2008/07/30 18:36:01 nancyw Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 45 |
$form['vid'] = array('#type' => 'hidden', '#value' => $vocid); |
$form['vid'] = array('#type' => 'hidden', '#value' => $vocid); |
| 46 |
$form['submit'] = array('#type' => 'submit', '#value' => t('Save')); |
$form['submit'] = array('#type' => 'submit', '#value' => t('Save')); |
| 47 |
if ($tid) { |
if ($tid) { |
| 48 |
$form['delete'] = array('#type' => 'submit', '#value' => t('Delete')); |
$form['delete'] = array('#type' => 'submit', '#value' => t('Delete'), '#submit' => array('weblinks_form_container_submit_delete')); |
| 49 |
$form['tid'] = array('#type' => 'hidden', '#value' => $tid); |
$form['tid'] = array('#type' => 'hidden', '#value' => $tid); |
| 50 |
} |
} |
| 51 |
return $form; |
return $form; |
| 57 |
function weblinks_form_container_submit($form, &$form_state) { |
function weblinks_form_container_submit($form, &$form_state) { |
| 58 |
$container = TRUE; |
$container = TRUE; |
| 59 |
$type = t('weblinks container'); |
$type = t('weblinks container'); |
| 60 |
if ($form_state['values']['delete'] == 'Delete') { |
$status = taxonomy_save_term($form_state['values']); |
|
$status = taxonomy_del_term($form_state['values']['tid']); |
|
|
} |
|
|
else { |
|
|
$status = taxonomy_save_term($form_state['values']); |
|
|
} |
|
| 61 |
switch ($status) { |
switch ($status) { |
| 62 |
case SAVED_NEW: |
case SAVED_NEW: |
| 63 |
$containers = variable_get('weblinks_containers', array()); |
$containers = variable_get('weblinks_containers', array()); |
| 68 |
case SAVED_UPDATED: |
case SAVED_UPDATED: |
| 69 |
drupal_set_message(t('The %type %term has been updated.', array('%term' => $form_state['values']['name'], '%type' => $type))); |
drupal_set_message(t('The %type %term has been updated.', array('%term' => $form_state['values']['name'], '%type' => $type))); |
| 70 |
break; |
break; |
| 71 |
|
} |
| 72 |
|
$form_state['redirect'] = 'admin/content/weblinks'; |
| 73 |
|
return; |
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
/** |
| 77 |
|
* Process forum form and container form submissions. |
| 78 |
|
*/ |
| 79 |
|
function weblinks_form_container_submit_delete($form, &$form_state) { |
| 80 |
|
$container = TRUE; |
| 81 |
|
$type = t('weblinks container'); |
| 82 |
|
$status = taxonomy_del_term($form_state['values']['tid']); |
| 83 |
|
switch ($status) { |
| 84 |
case SAVED_DELETED: |
case SAVED_DELETED: |
| 85 |
drupal_set_message(t('The %type %term has been deleted.', array('%term' => $form_state['values']['name'], '%type' => $type))); |
drupal_set_message(t('The %type %term has been deleted.', array('%term' => $form_state['values']['name'], '%type' => $type))); |
| 86 |
break; |
break; |