'admin/settings/jquery_media', 'title' => t('jQuery Media'), 'callback' => 'drupal_get_form', 'callback arguments' => array('_jquery_media_settings'), ); $items[] = array( 'path' => JQUERY_MEDIA_DEFAULT_JS_FILEPATH, 'type' => MENU_CALLBACK, 'access' => user_access('access content'), 'callback' => '_jquery_media_default_js_file', ); return $items; } } /** * Implements hook_help */ function jquery_media_help($section) { include_once(drupal_get_path('module', 'jquery_media') .'/jquery_media.settings.inc'); return _jquery_media_help($section); } /** * Callback for /admin/settings/jquery_media */ function _jquery_media_settings() { include_once(drupal_get_path('module', 'jquery_media') .'/jquery_media.settings.inc'); if (!module_exists('jq')) { drupal_set_message(t('You may wish to install and enable the !jq for a more centralized administration and development of jQuery plugin User Interface modules such as jQuery Media.', array('!jq' => l(t('jQ Module'), 'http://drupal.org/project/jq', array('target' => '_blank'))))); } else { drupal_set_message(t('You may wish to configure these settings at the !jq.', array('!jq' => l(t('jQ administrative settings page'), 'admin/settings/jq')))); } return system_settings_form(_jquery_media_settings_form()); } /** * This is provided for when the jQ module is not installed. */ function jquery_media_add($options = array()) { static $installed = FALSE; if (!$installed) { drupal_add_js(drupal_get_path('module', 'jquery_media') .'/js/jquery.media.js'); } include_once(drupal_get_path('module', 'jquery_media') .'/jquery_media.jq.inc'); _jquery_media_add($options); return TRUE; } /** * Print the default js file. */ function _jquery_media_default_js_file() { include_once(drupal_get_path('module', 'jquery_media') .'/jquery_media.jq.inc'); $js = _jquery_media_add(array(), TRUE); header('Content-Length: '. strlen($js)); header('Content-Type: text/javascript'); header('Date: '.date('r')); print $js; } function jquery_media_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) { if ($op == 'view') { if (in_array($node->type, variable_get('jquery_media_node_types', array()))) { if (module_exists('jq')) { module_invoke('jq', 'add', 'jquery_media'); } else { jquery_media_add(); } } } }