-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmeteor_signup.module
73 lines (62 loc) · 2.4 KB
/
meteor_signup.module
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
<?php
/**
* Implements hook_menu().
*/
function meteor_signup_menu() {
$items['home'] = array(
'title' => t('Meteor Signup'),
'description' => t('Signup for Meteor app'),
'access arguments' => array('access content'),
'page callback' => 'drupal_get_form',
'page arguments' => array('meteor_signup_form'),
'type' => MENU_CALLBACK,
);
$items['admin/config/development/meteor-signup'] = array(
'title' => t('Meteor Signup'),
'description' => t('Configure Meteor Signup so it will work.'),
'access arguments' => array('administer meteor signup'),
'page callback' => 'drupal_get_form',
'page arguments' => array('meteor_signup_admin_form'),
'file' => 'meteor_signup.admin.inc',
);
return $items;
}
function meteor_signup_form($form, &$form_state) {
// TODO: Port
// if (isset($_COOKIE['meteorLoggedIn']) && $_COOKIE['meteorLoggedIn']== 1) {
// //redirect to app
// global $base_root;
// $redirect = "https://app." . preg_replace('#^https?://#', '', $base_root);
// //drupal_set_message($redirect);
// drupal_goto($redirect);
// }
$settings = array('meteor_signup' => array());
// Has to be manually set.
if (!variable_get("meteor_signup_meteor_socket", false)) {
drupal_set_message("meteor_signup_meteor_socket variable is unset!", "error");
} else {
$settings['meteor_signup'] = array('socket' => variable_get("meteor_signup_meteor_socket", false));
}
drupal_add_js($settings, 'setting');
drupal_add_js(drupal_get_path("module", "meteor_signup") . "/sockjs-0.3.min.js");
drupal_add_js(drupal_get_path("module", "meteor_signup") . "/meteor-ddp.js");
drupal_add_js(drupal_get_path("module", "meteor_signup") . "/meteor_signup.js");
drupal_add_js(drupal_get_path("module", "meteor_signup") . "/alertify/lib/alertify.min.js");
drupal_add_css(drupal_get_path("module", "meteor_signup") . "/alertify/themes/alertify.core.css");
drupal_add_css(drupal_get_path("module", "meteor_signup") . "/alertify/themes/alertify.default.css");
$form['signup_fields'] = array(
'#type' => 'fieldset',
'#attributes' => array('class' => array('meteor_signup_wrap'))
);
$form['signup_fields']['email'] = array(
'#type' => 'textfield',
'#title' => t('E-mail'),
'#size' => 60,
'#required' => TRUE,
);
$form['signup_fields']['submit'] = array(
'#type' => 'submit',
'#value' => 'Sign Up',
);
return $form;
}