| 1 |
<?php |
<?php |
| 2 |
// $Id: signit.module,v 1.5.2.25 2007/11/29 23:47:07 arthuregg Exp $ |
// $Id: signit.module,v 1.5.2.26 2008/01/03 01:47:49 arthuregg Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 280 |
* content types that have signit enabled |
* content types that have signit enabled |
| 281 |
*/ |
*/ |
| 282 |
function signit_create_form($node) { |
function signit_create_form($node) { |
| 283 |
|
// load the js |
| 284 |
drupal_add_js(drupal_get_path('module', 'signit') .'/signit.js'); |
drupal_add_js(drupal_get_path('module', 'signit') .'/signit.js'); |
| 285 |
|
|
| 286 |
|
// make the data accessible |
| 287 |
$signit = $node->signit; |
$signit = $node->signit; |
| 288 |
$form['signit'] = array( |
|
| 289 |
'#type' => 'fieldset', |
// check and see if there are display controls |
| 290 |
'#title' => t('SignIt Information'), |
$targets = signit_extend('signit_control', 'create', $signit); |
| 291 |
'#collapsible' => true, |
if (count($targets)) { |
| 292 |
'#collapsed' => $signit['status'] ? true : false , |
$form['signit']['control'] = array( |
| 293 |
'#description' => t('Set the SignIt configuration. Please note, if you make changes here, these changes will not be reflected on already collected signatures.'), |
'#type' => 'fieldset', |
| 294 |
); |
'#title' => t('SignIt '), |
| 295 |
|
'#collasible' => true, |
| 296 |
$form['signit']['signit_status'] = array( |
); |
| 297 |
'#type' => 'checkbox', |
$form['signit']['control'][] = $targets; |
| 298 |
'#title' => t('This SignIt is enabled.'), |
} |
|
'#options' => array('Enabled'), |
|
|
'#default_value' => $signit['status'] ? 1 : 0, |
|
|
'#description' => t('If this is set, users may sign this node.'), |
|
|
); |
|
| 299 |
|
|
| 300 |
// Get all target options from modules that implement the signit_targets hook |
// Get all target options from modules that implement the signit_targets hook |
| 301 |
$targets = signit_extend('signit_targets', 'create', $signit); |
$targets = signit_extend('signit_targets', 'create', $signit); |
| 410 |
'#description' => t('The path in your site to which users will be taken after signing. Leave blank for this node.'), |
'#description' => t('The path in your site to which users will be taken after signing. Leave blank for this node.'), |
| 411 |
); |
); |
| 412 |
|
|
|
// ----------------------------------------------------- |
|
|
// dates |
|
|
$form['signit']['dates'] = array( |
|
|
'#type' => 'fieldset', |
|
|
'#title' => t('SignIt dates'), |
|
|
'#collapsible' => true, |
|
|
); |
|
|
|
|
|
$form['signit']['dates']['signit_use_dates'] = array( |
|
|
'#type' => 'checkbox', |
|
|
'#title' => t('Enable date control.'), |
|
|
'#options' => array('Enabled'), |
|
|
'#default_value' => $signit['use_dates'] ? 1 : 0, |
|
|
'#description' => t('If this is set, users can only sign a SignIt between these dates. If this is not set, users can always add signatures.'), |
|
|
); |
|
|
|
|
|
$default_date = array('day' => format_date(time(), 'custom', 'j'), |
|
|
'month' => format_date(time(), 'custom', 'n'), |
|
|
'year' => format_date(time(), 'custom', 'Y')); |
|
|
|
|
|
$form['signit']['dates']['signit_start'] = array( |
|
|
'#type' => 'date', |
|
|
'#title' => t('SignIt start'), |
|
|
'#description' => t('Date when the SignIt can be signed.'), |
|
|
'#prefix' => '<div id="signit_dates">', |
|
|
'#default_value' => $node->signit['start'] ? array( |
|
|
'day' => format_date($node->signit['start'], 'custom', 'j'), |
|
|
'month' => format_date($node->signit['start'], 'custom', 'n'), |
|
|
'year' => format_date($node->signit['start'], 'custom', 'Y')) : $default_date |
|
|
); |
|
|
|
|
|
$form['signit']['dates']['signit_end'] = array( |
|
|
'#type' => 'date', |
|
|
'#title' => t('SignIt end'), |
|
|
'#description' => t('Date when the SignIt can no longer be signed.'), |
|
|
'#suffix' => '</div>', |
|
|
'#default_value' => $node->signit['end'] ? array( |
|
|
'day' => format_date($node->signit['end'], 'custom', 'j'), |
|
|
'month' => format_date($node->signit['end'], 'custom', 'n'), |
|
|
'year' => format_date($node->signit['end'], 'custom', 'Y')) : $default_date |
|
|
); |
|
|
|
|
| 413 |
return $form; |
return $form; |
| 414 |
} |
} |
| 415 |
|
|
| 1139 |
'#description' => t('Enter the page users will be taken to after they sign. This option can be overridden at the node level. Leave blank to return to the same page.'), |
'#description' => t('Enter the page users will be taken to after they sign. This option can be overridden at the node level. Leave blank to return to the same page.'), |
| 1140 |
); |
); |
| 1141 |
|
|
| 1142 |
|
// message options |
| 1143 |
|
$form['signit']['control'] = array( |
| 1144 |
|
'#type' => 'fieldset', |
| 1145 |
|
'#title' => t('SignIt control'), |
| 1146 |
|
'#collasible' => true, |
| 1147 |
|
'#access' => TRUE |
| 1148 |
|
); |
| 1149 |
|
$form['signit']['control'][] = signit_extend('signit_control', 'admin', null); |
| 1150 |
|
|
| 1151 |
// @TODO put this into the admin hook |
// @TODO put this into the admin hook |
| 1152 |
if (module_exists("civicrm")) { |
if (module_exists("civicrm")) { |
| 1153 |
$form['civicrm'] = array( |
$form['civicrm'] = array( |