diff --git includes/export-ui.inc includes/export-ui.inc index d03adf7..3227df3 100644 --- includes/export-ui.inc +++ includes/export-ui.inc @@ -27,6 +27,9 @@ function ctools_export_ui_defaults($info, &$plugin) { 'form' => array(), 'list' => NULL, 'access' => 'administer site configuration', + 'handler' => array( + 'class' => 'ctools_export_ui', + ), ); if (empty($plugin['schema'])) { diff --git includes/export.inc includes/export.inc index ef3c45a..2a5a803 100644 --- includes/export.inc +++ includes/export.inc @@ -94,7 +94,7 @@ function ctools_export_crud_load($table, $name) { * must have an 'export' section containing data or this function * will fail. * @param $reset - * If true, the static cache of all objects will be flushed prior to + * If TRUE, the static cache of all objects will be flushed prior to * loading all. This can be important on listing pages where items * might have changed on the page load. * @return @@ -104,6 +104,10 @@ function ctools_export_crud_load_all($table, $reset = FALSE) { $schema = ctools_export_get_schema($table); $export = $schema['export']; + if ($reset) { + ctools_export_load_object_reset($table); + } + if (!empty($export['load all callback']) && function_exists($export['load all callback'])) { return $export['load all callback']($reset); } @@ -689,6 +693,7 @@ function ctools_export_get_schema($table) { // Add some defaults $schema['export'] += array( 'key' => 'name', + 'key name' => t('Name'), 'object' => 'stdClass', 'status' => 'default_' . $table, 'default hook' => 'default_' . $table, diff --git plugins/export_ui/ctools_export_ui.class.php plugins/export_ui/ctools_export_ui.class.php index 666fa17..4a6ec28 100644 --- plugins/export_ui/ctools_export_ui.class.php +++ plugins/export_ui/ctools_export_ui.class.php @@ -94,7 +94,7 @@ class ctools_export_ui { * unless the listing mechanism is going to be highly specialized. */ function list_page($js, $input) { - $this->items = ctools_export_crud_load_all($this->plugin['schema']); + $this->items = ctools_export_crud_load_all($this->plugin['schema'], !empty($input['js'])); // Respond to a reset command by clearing session and doing a drupal goto // back to the base URL. @@ -298,7 +298,7 @@ class ctools_export_ui { // Note: Creating this list seems a little clumsy, but can't think of // better ways to do this. $allowed_operations = drupal_map_assoc(array_keys($plugin['allowed operations'])); - $not_allowed_operations = array(); + $not_allowed_operations = array('import'); if ($item->type == t('Normal')) { $not_allowed_operations[] = 'revert'; @@ -472,8 +472,6 @@ class ctools_export_ui { break; } - $class = - $this->rows[$name]['data'] = array(); $this->rows[$name]['class'] = !empty($item->disabled) ? 'ctools-export-ui-disabled' : 'ctools-export-ui-enabled'; @@ -634,6 +632,7 @@ class ctools_export_ui { function edit_form(&$form, &$form_state) { $export_key = $this->plugin['export']['key']; $item = $form_state['item']; + $schema = ctools_export_get_schema($this->plugin['schema']); // Set title. if ($form_state['op'] == 'edit') { @@ -665,8 +664,7 @@ class ctools_export_ui { } $form['info'][$export_key] = array( - // TODO: Add human readable name on key in export.inc? - '#title' => ucfirst($export_key), + '#title' => $schema['export']['key name'], '#type' => 'textfield', '#default_value' => $item->{$export_key}, '#description' => t('The unique ID for this @export', array('@export' => $this->plugin['title'])), @@ -947,7 +945,7 @@ function ctools_export_ui_edit_item_form_delete(&$form, &$form_state) { $item = $form_state['item']; $menu_prefix = ctools_export_ui_plugin_base_path($plugin); - $form_state['redirect'] = "$menu_prefix/list/$item->{$export_key}/delete"; + $form_state['redirect'] = ctools_export_ui_plugin_menu_path($plugin, 'delete', $item->{$export_key}); } /** diff --git plugins/export_ui/ctools_export_ui.inc plugins/export_ui/ctools_export_ui.inc index 1f93710..5602e6d 100644 --- plugins/export_ui/ctools_export_ui.inc +++ plugins/export_ui/ctools_export_ui.inc @@ -11,9 +11,6 @@ * defined then the plugin name will be used. */ $plugin = array( - 'handler' => array( - 'class' => 'ctools_export_ui', - ), // As this is the base class plugin, it shouldn't declare any menu items. 'has menu' => FALSE, );