? .DS_Store
? cache_indexes_00.patch
? ctools_contexts_00.patch
? ctools_contexts_01.patch
? ctools_contexts_02.patch
? ctools_contexts_03.patch
? layer_filters_04.patch
? load_function_00.patch
? pluggable_contexts_05.patch
? pluggable_contexts_06.patch
? pluggable_contexts_07.patch
? pluggable_contexts_08.patch
? includes/.DS_Store
? includes/ctools_plugins/.DS_Store
? includes/ctools_plugins/arguments/.DS_Store
? includes/ctools_plugins/contexts/.DS_Store
Index: index.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/index/Attic/index.module,v
retrieving revision 1.1.2.41
diff -u -p -r1.1.2.41 index.module
--- index.module	27 Feb 2010 19:41:10 -0000	1.1.2.41
+++ index.module	28 Feb 2010 02:33:07 -0000
@@ -212,6 +212,15 @@ function index_block($op = 'list', $delt
 }
 
 /**
+ * Implementation of hook_ctools_plugin_directory().
+ */
+function index_ctools_plugin_directory($module, $plugin) {
+  if ($module == 'index' && !empty($plugin)) {
+    return "includes/$plugin";
+  }
+}
+
+/**
  * Helper function for loading include files.
  *
  * @param $name
@@ -227,25 +236,25 @@ function index_load_include($name) {
 function index_index_display_info() {
   $displays['tree'] = array(
     '#title' => t('Tree'),
-    '#contexts' => array('block', 'page'),
+    '#contexts' => array('block', 'page', 'ctools'),
     '#depth' => 0,
     '#callback' => new indexCallback('index_render_tree', 'includes/index.view.inc'),
   );
   $displays['tree_expandable'] = array(
     '#title' => t('Expandable tree'),
-    '#contexts' => array('block', 'page'),
+    '#contexts' => array('block', 'page', 'ctools'),
     '#depth' => 0,
     '#callback' => new indexCallback('index_render_tree_expandable', 'includes/index.view.inc'),
   );
   $displays['upper'] = array(
     '#title' => t('Upper level'),
-    '#contexts' => array('block', 'page'),
+    '#contexts' => array('block', 'page', 'ctools'),
     '#depth' => 1,
     '#callback' => new indexCallback('index_render_upper', 'includes/index.view.inc'),
   );
   $displays['upper_two'] = array(
     '#title' => t('Upper two levels'),
-    '#contexts' => array('block', 'page'),
+    '#contexts' => array('block', 'page', 'ctools'),
     '#depth' => 2,
     '#callback' => new indexCallback('index_render_upper_two', 'includes/index.view.inc'),
   );/*
@@ -355,6 +364,9 @@ function index_index_context_info() {
   $contexts['block'] = array(
     '#title' => t('Block'),
   );
+  $contexts['ctools'] = array(
+    '#title' => t('Ctools context'),
+  );
 
   return $contexts;
 }
Index: includes/ctools_plugins/arguments/index_arg.inc
===================================================================
RCS file: includes/ctools_plugins/arguments/index_arg.inc
diff -N includes/ctools_plugins/arguments/index_arg.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ includes/ctools_plugins/arguments/index_arg.inc	28 Feb 2010 02:33:08 -0000
@@ -0,0 +1,28 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ *   Create a Ctools argument for Index contexts.
+ */
+
+$plugin = array(
+  'title' => t('Index arguments'),
+  'keyword' => 'index',
+  'description' => t('Creates an <em>index</em> from the argument.'),
+  'context' => 'index_ctools_context_create_argument',
+  'placeholder form' => array(
+    '#type' => 'textfield',
+    '#description' => t('Enter the index context arg (CHANGE THIS)'),
+  ),
+);
+
+function index_ctools_context_create_argument($arg = NULL, $conf = NULL, $empty = FALSE) {
+  if ($empty) {
+    return ctools_context_create_empty('index');
+  }
+  elseif (!empty($arg) && db_result(db_query("SELECT COUNT(*) FROM {index_index} WHERE iid = %d", $arg))) {
+    return ctools_context_create_empty('index', $arg);
+  }
+  return FALSE;
+}
Index: includes/ctools_plugins/contexts/index.inc
===================================================================
RCS file: includes/ctools_plugins/contexts/index.inc
diff -N includes/ctools_plugins/contexts/index.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ includes/ctools_plugins/contexts/index.inc	28 Feb 2010 02:33:08 -0000
@@ -0,0 +1,74 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ *   Expose indexes as Ctools contexts.
+ */
+
+$plugin = array(
+  'title' => t('Index'),
+  'description' => t('An <a href="@index_list">index</a> created as a Ctools context.', array('@index_list' => url('admin/build/index'))),
+  'context' => 'index_ctools_context_create',
+  'context name' => 'index',
+  'settings form' => 'index_ctools_context_form_settings',
+  'keyword' => 'index',
+
+  // Provides a list of items which are exposed as keywords.
+  'convert list' => 'simplecontext_convert_list',
+  // Convert keywords into data.
+  'convert' => 'simplecontext_convert',
+
+  'placeholder form' => array(
+    '#type' => 'textfield',
+    '#description' => t('Enter some data to represent this index.'),
+  ),
+);
+
+/**
+ * Create a Ctools context.
+ */
+function index_ctools_context_create($empty, $data = NULL, $conf = FALSE) {
+  $context = new ctools_context('index');
+  $context->plugin = 'index';
+
+  if ($empty) {
+    return $context;
+  }
+
+  if ($conf) {
+    $iid = is_array($data) && isset($data['iid']) ? $data['iid'] : (is_object($data) ? $data->iid : 0);
+
+    if (is_array($data)) {
+      $data = index_load($iid);
+    }
+  }
+
+  if (!empty($data)) {
+    $context->data     = $data;
+    $context->title    = $data->title;
+    $context->argument = $data->iid;
+
+    $context->restrictions['type'] = array($data->type);
+    return $context;
+  }
+}
+
+function index_ctools_context_form_settings($conf, $external = FALSE) {
+  if (empty($conf)) {
+    $conf = array(
+      'sample_simplecontext_setting' => 'default simplecontext setting',
+    );
+  }
+  $form = array();
+  $form['sample_simplecontext_setting'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Setting for simplecontext'),
+    '#size' => 50,
+    '#description' => t('An example setting that could be used to configure a context'),
+    '#default_value' => $conf['sample_simplecontext_setting'],
+    '#prefix' => '<div class="clear-block no-float">',
+    '#suffix' => '</div>',
+  );
+  return $form;
+}
\ No newline at end of file
