source: trunk/autoquest-htmlmonitor/src/main/modules/drupal/autoquest/autoquest.module @ 1344

Last change on this file since 1344 was 1192, checked in by ftrautsch, 12 years ago

changes for drupal-module build process

File size: 1.8 KB
Line 
1<?php
2
3/**
4 * changes the drupal admin paths array. the "log" section in nodes
5 * need to be declared as administrative
6 *
7 * @param paths the admin paths array
8 *
9 */
10function autoquest_admin_paths_alter(&$paths) {
11        // Log is Administrative
12        $paths['node/*/log'] = TRUE;
13}
14
15/**
16 * adds the autquest-htmlmonitor.js to every drupal side
17 * except the administrative ones
18 */
19function autoquest_init() {
20        // Check if current Path is Administrative
21        if (!path_is_admin(current_path())) {
22                // Get URL from Config
23                $url = variable_get('autoquestURL', 'https://swe-tooling.informatik.uni-goettingen.de/autoquest-htmlmonitor/script/');
24                $url = $url."autoquest-htmlmonitor.js";
25               
26                drupal_add_js($url, 'external');
27        }
28}
29
30
31
32/**
33* Page callback: Autoquest settings
34*
35* @see autoquest_menu()
36*/
37function autoquest_form($form, &$form_state) {
38  $form['autoquestURL'] = array(
39    '#type' => 'textfield',
40    '#title' => t('URL of autoquest-htmlmonitor'),
41    '#default_value' => variable_get('autoquestURL', 'https://swe-tooling.informatik.uni-goettingen.de/autoquest-htmlmonitor/script/'),
42    '#size' => 150,
43    '#maxlength' => 250,
44    '#description' => t('The exact URL of the autoquest-htmlmonitor.js. Example: https://swe-tooling.informatik.uni-goettingen.de/autoquest-htmlmonitor/script/'),
45    '#required' => TRUE,
46  );
47
48  return system_settings_form($form);
49}
50
51/**
52* Implements hook_menu().
53*/
54function autoquest_menu() {
55  $items = array();
56
57  $items['admin/config/content/autoquest'] = array(
58    'title' => 'AutoQUEST-htmlmonitor-4drupal',
59    'description' => 'Configuration for AutoQUEST-Htmlmonitor module',
60    'page callback' => 'drupal_get_form',
61    'page arguments' => array('autoquest_form'),
62    'access arguments' => array('access administration pages'),
63    'type' => MENU_NORMAL_ITEM,
64  );
65
66  return $items;
67}
Note: See TracBrowser for help on using the repository browser.