| 1 |
<?php |
<?php |
| 2 |
// $Id: flexinode_admin.module,v 1.5.2.1 2007/02/07 10:08:21 ber Exp $ |
// $Id: flexinode_admin.module,v 1.5.2.2 2007/04/17 13:20:28 ber Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file Administration interface for flexinode. |
* @file Administration interface for flexinode. |
| 258 |
'#maxlength' => 128, |
'#maxlength' => 128, |
| 259 |
'#description' => t('A one-line description of the content type.'), |
'#description' => t('A one-line description of the content type.'), |
| 260 |
); |
); |
|
$form['help'] = array( |
|
|
'#type' => 'textarea', |
|
|
'#title' => t('Help text'), |
|
|
'#default_value' => $ctype->help, |
|
|
'#size' => 60, |
|
|
'#maxlength' => 5, |
|
|
'#description' => t('Instructions to present to the user when adding new content of this type.'), |
|
|
); |
|
| 261 |
$form['ctype_id'] = array('#type' => 'hidden', '#value' => $ctype_id); |
$form['ctype_id'] = array('#type' => 'hidden', '#value' => $ctype_id); |
| 262 |
$form['submit'] = array('#type' => 'submit', '#value' => t('Submit')); |
$form['submit'] = array('#type' => 'submit', '#value' => t('Submit')); |
| 263 |
|
|
| 289 |
|
|
| 290 |
$former_ctype = flexinode_load_content_type($ctype_id); |
$former_ctype = flexinode_load_content_type($ctype_id); |
| 291 |
|
|
| 292 |
db_query("UPDATE {flexinode_type} SET name = '%s', description = '%s', help = '%s' WHERE ctype_id = %d", $edit['name'], $edit['description'], $edit['help'], $ctype_id); |
db_query("UPDATE {flexinode_type} SET name = '%s', description = '%s' WHERE ctype_id = %d", $edit['name'], $edit['description'], $ctype_id); |
| 293 |
|
|
| 294 |
drupal_set_message(t('updated content type "%name".', array('%name' => $edit['name']))); |
drupal_set_message(t('updated content type "%name".', array('%name' => $edit['name']))); |
| 295 |
} |
} |
| 296 |
else { |
else { |
| 297 |
$ctype_id = db_next_id('{flexinode_ctype}'); |
$ctype_id = db_next_id('{flexinode_ctype}'); |
| 298 |
|
|
| 299 |
db_query("INSERT INTO {flexinode_type} (name, description, help, ctype_id) VALUES ('%s', '%s', '%s', %d)", $edit['name'], $edit['description'], $edit['help'], $ctype_id); |
db_query("INSERT INTO {flexinode_type} (name, description, ctype_id) VALUES ('%s', '%s', %d)", $edit['name'], $edit['description'], $ctype_id); |
| 300 |
|
|
| 301 |
drupal_set_message(t('created new content type "%name".', array('%name' => $edit['name']))); |
drupal_set_message(t('created new content type "%name".', array('%name' => $edit['name']))); |
| 302 |
} |
} |