You are here

function _sheetnode_inject in Sheetnode 5

Same name and namespace in other branches
  1. 6 sheetnode.module \_sheetnode_inject()
  2. 7.2 sheetnode.module \_sheetnode_inject()
  3. 7 sheetnode.module \_sheetnode_inject()
4 calls to _sheetnode_inject()
sheetfield_spreadsheet_process in ./sheetnode.module
sheetnode_form in ./sheetnode.module
Implementation of hook_form().
sheetnode_view in ./sheetnode.module
Implementation of hook_view().
theme_sheetnode_formatter_default in ./sheetnode.module

File

./sheetnode.module, line 110

Code

function _sheetnode_inject($value, $save_element, $context) {
  drupal_add_js(drupal_get_path('module', 'sheetnode') . '/socialcalc/socialcalcconstants.js');
  drupal_add_js(drupal_get_path('module', 'sheetnode') . '/socialcalc/socialcalc-3.js');
  drupal_add_js(drupal_get_path('module', 'sheetnode') . '/socialcalc/socialcalctableeditor.js');
  drupal_add_js(drupal_get_path('module', 'sheetnode') . '/socialcalc/formatnumber2.js');
  drupal_add_js(drupal_get_path('module', 'sheetnode') . '/socialcalc/formula1.js');
  drupal_add_js(drupal_get_path('module', 'sheetnode') . '/socialcalc/socialcalcpopup.js');
  drupal_add_js(drupal_get_path('module', 'sheetnode') . '/socialcalc/socialcalcspreadsheetcontrol.js');
  drupal_add_js(drupal_get_path('module', 'sheetnode') . '/socialcalc/socialcalcviewer.js');
  drupal_add_js(drupal_get_path('module', 'sheetnode') . '/sheetnode.js');
  drupal_add_css(drupal_get_path('module', 'sheetnode') . '/socialcalc/socialcalc.css');
  drupal_add_css(drupal_get_path('module', 'sheetnode') . '/sheetnode.css');
  module_invoke_all('sheetnode_plugins', $value, $save_element, $context);
  static $once = FALSE;
  if (!$once) {
    $once = TRUE;
    drupal_add_js(array(
      'sheetnode' => array(
        'basePath' => url(),
        'value' => $value,
        'imagePrefix' => url(drupal_get_path('module', 'sheetnode') . '/socialcalc/images/sc-'),
        'containerElement' => 'sheetview',
        'saveElement' => $save_element,
        'viewMode' => variable_get('sheetnode_view_mode', SHEETNODE_VIEW_FIDDLE),
        'showToolbar' => variable_get('sheetnode_view_toolbar', FALSE),
        'permissions' => array(
          'edit sheet settings' => user_access('edit sheet settings'),
        ),
        'context' => $context,
      ),
    ), 'setting');
    drupal_add_js('$(document).ready(function() { Drupal.sheetnode.start("body"); });', 'inline');
  }
  return '<div class="sheetview" id="sheetview"></div>';
}