initial version

master
Marek Isalski 9 years ago
commit b197c92c8d

@ -0,0 +1,50 @@
<?php
function fulcrm_webhook_admin_form_submit( $form, &$form_state ) {
}
function fulcrm_webhook_admin_form( $form, &$form_state ) {
global $is_https;
$form[ 'title' ] = array( '#type' => 'item',
'#title' => 'fulcrm webhook Settings',
'#description' => '',
);
if ( $is_https ) {
$form[ 'webhook_url' ] = array( '#type' => 'textfield',
'#disabled' => TRUE,
'#title' => 'Webhook URL (to be registered with fulcrm)',
'#default_value' => url( 'services/fulcrm/webhook/' . variable_get( 'fulcrm_webhook_url' ), array( 'absolute' => TRUE, 'https' => TRUE ) ),
'#size' => 150,
'#max_length' => 200,
'#required' => FALSE,
);
$form[ 'actions' ] = array( '#type' => 'actions' );
$form[ 'actions' ][ 'save' ] = array( '#type' => 'submit',
'#value' => t('Save'),
'#submit' => array( 'fulcrm_webhook_admin_form_submit' ),
);
} else {
$form[ 'no_https' ] = array( '#type' => 'fieldset',
'#title' => 'HTTPS Missing!',
'#collapsible' => FALSE,
'#collapsed' => FALSE,
'detail' => array( '#type' => 'item',
'#title' => '',
'#markup' => '<p>You need to enable SSL on this Drupal instance to continue.</p><p>fulcrm will only send data to HTTPS webhooks.</p>' ),
);
$form[ 'actions' ] = array( '#type' => 'actions' );
$form[ 'actions' ][ 'save' ] = array( '#type' => 'link',
'#title' => t('Reload'),
'#href' => str_replace( 'http://', 'https://', url( 'admin/config/services/fulcrm/webhook', array( 'absolute' => TRUE ) ) ),
);
}
return $form;
}
function fulcrm_webhook_admin() {
return drupal_get_form( 'fulcrm_webhook_admin_form' );
}

@ -0,0 +1,6 @@
name = fulcrm webhook
description = fulcrm webhooks
core = 7.x
package = fulcrm
configure = admin/config/services/fulcrm/webhook
dependencies[] = fulcrm_uuid

@ -0,0 +1,6 @@
<?php /* -*- php -*- */
function fulcrm_webhook_install() {
$url = fulcrm_uuid_uuid4();
variable_set( 'fulcrm_webhook_url', $url );
}

@ -0,0 +1,32 @@
<?php
function fulcrm_webhook_permission() {
return array( 'administer fulcrm webhooks' => array( 'title' => t('Administer fulcrm webhooks'),
'description' => t('Perform main installation/administration tasks for fulcrm webhooks.'),
),
);
}
function fulcrm_webhook_menu() {
/*
$items[ 'admin/config/services/fulcrm' ] = array( 'page callback' => 'system_admin_menu_block_page',
'file' => 'system.admin.inc',
'file path' => drupal_get_path('module', 'system'),
'title' => 'fulcrm',
'description' => 'Configuration integration with fulcrm.org.',
'position' => 'right',
'access callback' => 'user_access',
'access arguments' => array('access administration pages'),
);
*/
$items[ 'admin/config/services/fulcrm/webhook' ] = array( 'page callback' => 'fulcrm_webhook_admin',
'file' => 'fulcrm_webhook.admin.inc',
'title' => 'fulcrm webhook',
'description' => 'Configuring webhooks for fulcrm.org.',
'access callback' => 'user_access',
'access arguments' => array('administer fulcrm webhooks'),
);
return $items;
}
Loading…
Cancel
Save