You are here

function _sheetnode_ajax_load in Sheetnode 7

Same name and namespace in other branches
  1. 5 sheetnode.module \_sheetnode_ajax_load()
  2. 6 sheetnode.module \_sheetnode_ajax_load()
  3. 7.2 sheetnode.module \_sheetnode_ajax_load()

AJAX function to return a sheet value.

1 string reference to '_sheetnode_ajax_load'
sheetnode_menu in ./sheetnode.module
Implements hook_menu().

File

./sheetnode.module, line 1054
Module file for the sheetnode module.

Code

function _sheetnode_ajax_load($sheetname = NULL) {

  // Parse the sheetname which might contain extra args separated by forward-slash.
  if (empty($sheetname)) {
    $sheetname = $_REQUEST['sheetname'];
  }

  // Look for the sheet.
  list($value, $title) = sheetnode_find_sheet($sheetname);

  // Found a spreadsheet: return it.
  drupal_add_http_header('Content-type', 'text/plain; charset=utf-8');
  if ($value) {
    $parts = socialcalc_parse_parts($value);
    if (isset($parts['sheet'])) {
      echo $parts['sheet'];
    }
  }
  drupal_exit();
}