| 1 |
<?php |
<?php |
| 2 |
// $Id: flexiconvert.module,v 1.12 2009/06/04 17:14:40 anarcat Exp $ |
// $Id: flexiconvert.module,v 1.13 2009/06/04 17:15:26 anarcat Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 59 |
$items[] = array( |
$items[] = array( |
| 60 |
'path' => 'admin/flexiconvert/convert', |
'path' => 'admin/flexiconvert/convert', |
| 61 |
'title' => t('Flexiconvert'), |
'title' => t('Flexiconvert'), |
| 62 |
'callback' => 'flexiconvert_page', |
'callback' => 'drupal_get_form', |
| 63 |
|
'callback arguments' => array('flexiconvert_form'), |
| 64 |
'access' => user_access('convert flexinode types'), |
'access' => user_access('convert flexinode types'), |
| 65 |
); |
); |
| 66 |
} |
} |
| 196 |
/** |
/** |
| 197 |
* Returns the form for converting Flexinode types to CCK types. |
* Returns the form for converting Flexinode types to CCK types. |
| 198 |
* |
* |
| 199 |
* If CCK is not running correctly, an error message is set instead of a form. |
* If CCK is not running correctly, set an error message |
| 200 |
|
* Implementation of hook_form(). |
| 201 |
*/ |
*/ |
| 202 |
function flexiconvert_page() { |
function flexiconvert_form() { |
| 203 |
$cck_is_init = flexiconvert_cck_running(); |
$cck_is_init = flexiconvert_cck_running(); |
| 204 |
|
|
| 205 |
if ($cck_is_init == FLEXICONVERT_CCK_DISABLED) { |
if ($cck_is_init == FLEXICONVERT_CCK_DISABLED) { |
| 206 |
drupal_set_message(t('CCK module disabled or does not exist!'), 'error'); |
drupal_set_message(t('CCK module disabled or does not exist!'), 'error'); |
| 207 |
|
return; |
| 208 |
} |
} |
| 209 |
else if ($cck_is_init == FLEXICONVERT_CCK_ASSOCIATED_MODULES_DISABLED) { |
else if ($cck_is_init == FLEXICONVERT_CCK_ASSOCIATED_MODULES_DISABLED) { |
| 210 |
drupal_set_message(t('One or more of the packaged CCK field type modules is disabled!'), 'error'); |
drupal_set_message(t('One or more of the packaged CCK field type modules is disabled!'), 'error'); |
| 211 |
|
return; |
| 212 |
} |
} |
|
else { // CCK is running happily! Yay! |
|
|
return drupal_get_form('flexiconvert_form'); |
|
|
} |
|
|
} |
|
| 213 |
|
|
|
/** |
|
|
* Implementation of hook_form(). |
|
|
*/ |
|
|
function flexiconvert_form() { |
|
| 214 |
// Include a stylesheet because we need a pretty table-like appearance of the form. |
// Include a stylesheet because we need a pretty table-like appearance of the form. |
| 215 |
drupal_add_css('sites/all/modules/flexiconvert/flexiconvert_styles.css', 'module', 'all', TRUE); |
drupal_add_css('sites/all/modules/flexiconvert/flexiconvert_styles.css', 'module', 'all', TRUE); |
| 216 |
// Add jQuery code to select all the elements in the form. |
// Add jQuery code to select all the elements in the form. |