? json_check.2.patch
? json_check.patch
Index: features.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/features/features.admin.inc,v
retrieving revision 1.1.2.14
diff -u -r1.1.2.14 features.admin.inc
--- features.admin.inc	5 Jun 2009 04:18:48 -0000	1.1.2.14
+++ features.admin.inc	6 Jun 2009 15:11:28 -0000
@@ -59,19 +59,22 @@
       '#value' => $sign,
     );
 
-    $actions = array(l(t('View'), "admin/build/features/{$name}"));
-    $state = '';
+    $actions = l(t('View'), "admin/build/features/{$name}");
+    $actions .= '<span class="admin-overridden"> | </span>';
+    $actions .= l(t('Re-export'), "admin/build/features/{$name}/export", array(
+      'attributes' => array('class' => 'admin-overridden')
+    ));
+
     if ($module->status) {
-      $storage = count(features_detect_overrides($module)) ? FEATURES_OVERRIDDEN : FEATURES_DEFAULT;
-      switch ($storage) {
-        case FEATURES_OVERRIDDEN:
-          $state = l(theme('features_storage', $storage), "admin/build/features/{$name}/compare", array('html' => TRUE));
-          $actions[] = l(t('Re-export'), "admin/build/features/{$name}/export");
-          break;
-        case FEATURES_DEFAULT:
-          $state = theme('features_storage', $storage);
-          break;
-      }
+      $state = l('check', "admin/build/features/{$name}/status", array('attributes' => array('class' => 'admin-check')));
+      $state .= l(theme('features_storage', FEATURES_OVERRIDDEN), "admin/build/features/{$name}/compare", array(
+        'html' => TRUE, 
+        'attributes' => array('class' => 'admin-overridden')
+      ));
+      $state .= theme('features_storage', FEATURES_DEFAULT);
+    }
+    else {
+      $state = t('Disabled');
     }
 
     $form['state'][$name] = array(
@@ -80,7 +83,7 @@
     );
     $form['actions'][$name] = array(
       '#type' => 'markup',
-      '#value' => !empty($actions) ? implode(' | ', $actions) : '',
+      '#value' => !empty($actions) ? $actions : '',
     );
   }
 
@@ -241,3 +244,12 @@
   $output = "<div class='features-comparison'>{$output}</div>";
   return $output;
 }
+
+/**
+ * Javascript call back that returns the status of a feature.
+ */
+function features_feature_status($feature) {
+  module_load_include('inc', 'features', 'features.export');
+  $storage = count(features_detect_overrides($feature)) ? FEATURES_OVERRIDDEN : FEATURES_DEFAULT;
+  return drupal_json(array('status' => $storage));
+}
\ No newline at end of file
Index: features.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/features/features.css,v
retrieving revision 1.1.2.4
diff -u -r1.1.2.4 features.css
--- features.css	31 May 2009 02:44:04 -0000	1.1.2.4
+++ features.css	6 Jun 2009 15:11:28 -0000
@@ -25,6 +25,10 @@
 
   table.features td.sign * { margin:0px; }
 
+  table.features .admin-check,
+  table.features .admin-default,
+  table.features .admin-overridden { display: none;}
+
 /**
  * Feature export form
  */
Index: features.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/features/features.js,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 features.js
--- features.js	17 Mar 2009 13:08:55 -0000	1.1.2.3
+++ features.js	6 Jun 2009 15:11:29 -0000
@@ -9,8 +9,35 @@
       $(this).parents('tr').addClass('enabled').removeClass('disabled');
     }
   });
+
+  Drupal.features.checkStatus();
 };
 
+Drupal.features = {
+  'checkStatus': function() {
+    $('table.features tbody tr').not('.processed').filter(':first').each(function() {
+      var elem = $(this);
+      $(elem).addClass('processed');
+      var uri = $(this).find('a.admin-check').attr('href');
+      if (uri) {
+        $.get(uri, [], function(data) {
+          $(elem).find('.admin-loading').hide();
+          if (data.status == 1) {
+            $(elem).find('.admin-overridden').show();
+          }
+          else {
+            $(elem).find('.admin-default').show();
+          }
+          Drupal.features.checkStatus();
+        }, 'json')
+      }
+      else {
+          Drupal.features.checkStatus();
+        }
+    });
+  }
+}
+
 Drupal.behaviors.featuresMachineReadable = function() {
   if ($('.feature-name').size() > 0) {
     $('.feature-name').after(' <small class="feature-module-name-suffix">&nbsp;</small>');
Index: features.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/features/features.module,v
retrieving revision 1.1.2.22
diff -u -r1.1.2.22 features.module
--- features.module	31 May 2009 02:44:04 -0000	1.1.2.22
+++ features.module	6 Jun 2009 15:11:29 -0000
@@ -76,6 +76,14 @@
     'file' => "features.export.inc",
     'weight' => 10,
   );
+    $items['admin/build/features/%feature/status'] = array(
+    'title' => 'Status',
+    'description' => 'Javascript status call back.',
+    'page callback' => 'features_feature_status',
+    'page arguments' => array(3),
+    'type' => MENU_LOCAL_TASK,
+    'file' => 'features.admin.inc',
+  );
   foreach ($items as $path => $item) {
     $items[$path]['access callback'] = 'user_access';
     $items[$path]['access arguments'] = array('administer site configuration');
