function fillpdf_settings in FillPDF 6
Same name and namespace in other branches
- 7 fillpdf.admin.inc \fillpdf_settings()
Settings form for user to place API Key
1 string reference to 'fillpdf_settings'
- fillpdf_menu in ./
fillpdf.module - Implementation of hook_menu().
File
- ./
fillpdf.admin.inc, line 23 - Allows mappings of PDFs to site content
Code
function fillpdf_settings() {
$form['settings_help'] = array(
'#type' => 'markup',
'#value' => t("\n This module requires one of several external PDF manipulation tools -- you can:<ul>\n <li>Sign up for <a href='http://fillpdf-service.com'>Fillpdf as-a-service</a>, and plug your API key in here; <strong>or</strong>\n <li>Deploy locally -- You'll need a VPS or dedicated server so you can deploy PHP/JavaBridge on Tomcat (see README.txt), then select \"Use Local Service\"\n <li>Use a local installation of the pdftk program - you'll need a VPS or a dedicated server so you can install pdftk (see README.txt), then select \"Use locally-installed pdftk\"\n </ul>\n "),
);
$form['remote'] = array(
'#type' => 'fieldset',
'#title' => t('Use Remote Service'),
);
$form['remote']['fillpdf_remote_service'] = array(
'#type' => 'checkbox',
'#title' => t('Use fillpdf-service.com'),
'#default_value' => variable_get('fillpdf_remote_service', true),
);
$form['remote']['fillpdf_api_key'] = array(
'#type' => 'textfield',
'#title' => t('API Key'),
'#default_value' => variable_get('fillpdf_api_key', ''),
'#description' => t(''),
);
$form['remote']['fillpdf_remote_protocol'] = array(
'#type' => 'radios',
'#title' => t('Use HTTPS?'),
'#description' => t('It is recommended to select <em>Use HTTPS</em> for this option. Doing so will help prevent
sensitive information in your PDFs from being intercepted in transit between your server and the remote service.'),
'#default_value' => variable_get('fillpdf_remote_protocol', 'https'),
'#options' => array(
'https' => t('Use HTTPS'),
'http' => t('Do not use HTTPS'),
),
);
if (variable_get('fillpdf_api_key', '') == '') {
$form['remote']['warning'] = array(
'#type' => 'markup',
'#prefix' => "<div class='warning'>",
'#suffix' => "</div>",
'#value' => t("You need to sign up for an API key at <a href='http://fillpdf-service.com'>fillpdf-service.com</a>"),
);
}
$form['local'] = array(
'#type' => 'fieldset',
'#title' => t('Use Local Service'),
);
$form['local']['fillpdf_local_service'] = array(
'#type' => 'checkbox',
'#title' => t('Use locally-installed PHP/JavaBridge'),
'#default_value' => variable_get('fillpdf_local_service', true),
);
if (!file_exists(drupal_get_path('module', 'fillpdf') . '/lib/JavaBridge/java/Java.inc')) {
$form['local']['warning'] = array(
'#type' => 'markup',
'#prefix' => "<div class='warning'>",
'#suffix' => "</div>",
'#value' => t("JavaBridge isn't installed locally. See README.txt for setting it up."),
);
}
$form['local_php'] = array(
'#type' => 'fieldset',
'#title' => t('Use Local pdftk'),
);
$form['local_php']['fillpdf_local_php'] = array(
'#type' => 'checkbox',
'#title' => t('Use locally-installed pdftk'),
'#default_value' => variable_get('fillpdf_local_php', true),
);
/*if(!(file_exists(drupal_get_path('module', 'fillpdf').'/lib/JavaBridge/java/Java.inc'))){
$form['local']['warning'] = array(
'#type' => 'markup',
'#prefix' => "<div class='warning'>", '#suffix' => "</div>",
'#value' => t("JavaBridge isn't installed locally. See README.txt for setting it up."),
);
} */
//TODO: Modify to add check for pdftk installed
$js = <<<JS
Drupal.behaviors.fillpdfSettingsCheckboxes = function (context) {
\$("input#edit-fillpdf-remote-service").click(function(){
\$("input#edit-fillpdf-local-service").attr('checked', false);
\$("input#edit-fillpdf-local-php").attr('checked', false);
});
\$("input#edit-fillpdf-local-service").change(function(){
\$("input#edit-fillpdf-remote-service").attr('checked', false);
\$("input#edit-fillpdf-local-php").attr('checked', false);
});
\$("input#edit-fillpdf-local-php").change(function(){
\$("input#edit-fillpdf-local-service").attr('checked', false);
\$("input#edit-fillpdf-remote-service").attr('checked', false);
});
};
JS;
drupal_add_js($js, 'inline');
return system_settings_form($form);
}