| 1 |
<?php |
<?php |
| 2 |
// $Id: feature.module,v 1.23 2006/02/21 18:10:52 dries Exp $ |
// $Id: feature.module,v 1.24 2006/03/25 20:20:09 killes Exp $ |
| 3 |
|
|
| 4 |
$GLOBALS["categories"] = array( |
$GLOBALS["categories"] = array( |
| 5 |
"General features", |
"General features", |
| 170 |
drupal_goto('admin/node/feature'); |
drupal_goto('admin/node/feature'); |
| 171 |
} |
} |
| 172 |
|
|
| 173 |
function feature_admin_delete($feature) { |
function feature_admin_delete() { |
| 174 |
if ($_POST['op'] != t('Delete')) { |
$fid = (int)arg(4); |
| 175 |
return confirm_form('feature_admin_delete', array(), |
$feature = feature_get($fid); |
| 176 |
t('Are you sure you want to delete %feature?', array('%feature' => theme('placeholder', $feature))), |
if (feature_get($fid)) { |
| 177 |
'admin/node/feature', |
$form['fid'] = array('#type' => 'value', '#value' => $fid); |
| 178 |
t('This action cannot be undone.'), |
return confirm_form( |
| 179 |
t('Delete'), |
'feature_admin_delete_confirm', |
| 180 |
t('Cancel')); |
$form, |
| 181 |
|
t('Are you sure you want to delete feature %name?', array('%name' => $feature->name)), |
| 182 |
|
'admin/feature', |
| 183 |
|
t('This action cannot be undone.'), |
| 184 |
|
t('Delete'), |
| 185 |
|
t('Cancel')); |
| 186 |
} |
} |
| 187 |
else { |
else { |
| 188 |
db_query("DELETE FROM {feature} WHERE fid = %d", $feature); |
drupal_set_message(t('You requested to delete an invalid feature.')); |
| 189 |
drupal_goto('admin/node/feature'); |
drupal_goto('admin/node/feature'); |
| 190 |
} |
} |
| 191 |
} |
} |
| 192 |
|
|
| 193 |
|
function feature_admin_delete_confirm_submit($form_id, $form_values) { |
| 194 |
|
db_query("DELETE FROM {feature} WHERE fid = %d", $form_values['fid']); |
| 195 |
|
drupal_set_message(t('The feature has been deleted.')); |
| 196 |
|
return 'admin/node/feature'; |
| 197 |
|
} |
| 198 |
|
|
| 199 |
|
|
| 200 |
function feature_admin_overview() { |
function feature_admin_overview() { |
| 201 |
global $categories; |
global $categories; |
| 202 |
|
|
| 210 |
l($feature->details, $feature->details), |
l($feature->details, $feature->details), |
| 211 |
check_plain($feature->image), |
check_plain($feature->image), |
| 212 |
l(t('edit'), "admin/node/feature/edit/$feature->fid"), |
l(t('edit'), "admin/node/feature/edit/$feature->fid"), |
| 213 |
l(t('feature'), "admin/node/feature/delete/$feature->fid")); |
l(t('delete'), "admin/node/feature/delete/$feature->fid")); |
| 214 |
} |
} |
| 215 |
|
|
| 216 |
return theme("table", $header, $rows); |
return theme("table", $header, $rows); |