/[drupal]/contributions/modules/simpletest_automator/simpletest_automator_proctor/simpletest_automator_proctor.module
ViewVC logotype

Diff of /contributions/modules/simpletest_automator/simpletest_automator_proctor/simpletest_automator_proctor.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1, Fri Aug 1 03:37:53 2008 UTC revision 1.2, Fri Aug 1 04:13:20 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id$  // $Id: simpletest_automator_proctor.module,v 1.1 2008/08/01 03:37:53 cwgordon7 Exp $
3    
4  if (!function_exists('custom_url_rewrite_outbound')) {  /**
5    function custom_url_rewrite_outbound(&$path, &$options, $original_path) {   * Implementation of hook_init().
6      if (isset($_GET['simpletest_automator']) && preg_match('/simpletest\d+/', $_GET['simpletest_automator'])) {   */
7        $options['query'] += array('simpletest_automator' => $_GET['simpletest_automator']);  function simpletest_automator_proctor_init() {
8      }    if (!function_exists('custom_url_rewrite_outbound')) {
9      if (function_exists('_custom_url_rewrite_outbound')) {      $code = <<<EOT
10        _custom_url_rewrite_outbound($path, $options, $original_path);  if (isset(\$_GET['simpletest_automator']) && preg_match('/simpletest\d+/', \$_GET['simpletest_automator'])) {
11      }    \$GLOBALS['db_prefix'] = \$_GET['simpletest_automator'];
12      \$GLOBALS['db_prefix_original'] = \$GLOBALS['db_prefix'];
13      function custom_url_rewrite_outbound(&\$path, &\$options, \$original_path) {
14        \$options['query'] += array('simpletest_automator' => \$_GET['simpletest_automator']);
15    }    }
16  }  }
17  else {  EOT;
18    drupal_set_message(t('Please rename your custom_url_rewrite_outbound() function in settings.php to _custom_url_rewrite_outbound() in order for the SimpleTest automator proctor to work properly.'), 'error');      drupal_set_message(t('Please add the following code to settings.php: <code><pre>@code</pre></code>', array('@code' => $code)), 'warning');
19      }
20      drupal_add_js(drupal_get_path('module', 'simpletest_automator_proctor') .'/simpletest_automator_proctor.js');
21  }  }
22    
23  /**  /**
24   * Implementation of hook_init().   * Implementation of hook_menu().
25   */   */
26  function simpletest_automator_proctor_init() {  function simpletest_automator_proctor_menu() {
27    drupal_add_js(drupal_get_path('module', 'simpletest_automator') .'/simpletest_automator.js');    $items = array();
28    
29      $items['simpletest_automator/js'] = array(
30        'page callback' => 'simpletest_automator_proctor_js',
31        'access callback' => TRUE,
32        'type' => MENU_CALLBACK,
33      );
34    
35      return $items;
36  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.2