-
Notifications
You must be signed in to change notification settings - Fork 2
/
islandora_bookviewer.install
85 lines (71 loc) · 2.39 KB
/
islandora_bookviewer.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
// $Id$
/**
* @file islandora_bookviewer.install
*
* This is the islandora installation of the Ineternet Archive Bookviewer
*
*/
/**
* Implementation of hook_enable().
*/
function islandora_bookviewer_enable() {
create_js_callback();
}
/**
* Implementation of hook_requirements().
*
* @return
* An array describing the status of the site regarding available updates.
* If there is no update data, only one record will be returned, indicating
* that the status of core can't be determined. If data is available, there
* will be two records: one for core, and another for all of contrib
* (assuming there are any contributed modules or themes enabled on the
* site). In addition to the fields expected by hook_requirements ('value',
* 'severity', and optionally 'description'), this array will contain a
* 'reason' attribute, which is an integer constant to indicate why the
* given status is being returned (UPDATE_NOT_SECURE, UPDATE_NOT_CURRENT, or
* UPDATE_UNKNOWN). This is used for generating the appropriate e-mail
* notification messages during update_cron(), and might be useful for other
* modules that invoke update_requirements() to find out if the site is up
* to date or not.
*
* @see _update_message_text()
* @see _update_cron_notify()
*/
function islandora_bookviewer_requirements($phase) {
}
function create_js_callback() {
global $base_url;
$URL = $base_url . '/bookreader/setup/';
$created = strftime('%c');
$javascript = <<<FILE
// Created $created
// This file is generated dynamically during the Drupal installation process.
// Any changes made to this file will be lost on reinstallation.
// Clone and rename this file if changes are to survive module reactivation.
$.urlParam = function(name){
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (!results)
{
return 0;
}
return results[1] || 0;
}
PID = $.urlParam('pid');
$.ajax({
url:'$URL' + PID,
async:false,
success: function(data, status, xhr) {
islandora_params = data;
},
error: function() {
alert("AJAX call failed");
},
dataType: 'json'
});
FILE;
$path = drupal_get_path('module', 'islandora_bookviewer');
$filename = "$path/js/islandora_loader.js";
file_put_contents($filename, $javascript);
}