| 1 |
<?php |
<?php |
| 2 |
// $Id: signit.module,v 1.5.2.20 2007/10/23 20:00:15 robeano Exp $ |
// $Id: signit.module,v 1.5.2.21 2007/10/25 01:08:17 arthuregg Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 237 |
|
|
| 238 |
case "view": |
case "view": |
| 239 |
signit_view_node($node, $teaser); |
signit_view_node($node, $teaser); |
| 240 |
break; |
break; |
| 241 |
} |
} |
| 242 |
} |
} |
| 243 |
} |
} |
| 253 |
*/ |
*/ |
| 254 |
function signit_kinds() { |
function signit_kinds() { |
| 255 |
$kinds = array( |
$kinds = array( |
| 256 |
"send on sign" => "send on sign", |
"send on sign" => t('send on sign'), |
| 257 |
"save for batch sending" => "save for batch sending", |
"save for batch sending" => t('save for batch sending'), |
| 258 |
"just collect signatures, no send" => "just collect signatures, no send", |
"just collect signatures, no send" => t('just collect signatures, no send'), |
| 259 |
); |
); |
| 260 |
return $kinds; |
return $kinds; |
| 261 |
} |
} |
| 265 |
* content types that have signit enabled |
* content types that have signit enabled |
| 266 |
*/ |
*/ |
| 267 |
function signit_create_form($node) { |
function signit_create_form($node) { |
| 268 |
|
drupal_add_js(drupal_get_path('module', 'signit') .'/signit.js'); |
| 269 |
|
|
| 270 |
|
|
| 271 |
$signit = $node->signit; |
$signit = $node->signit; |
| 272 |
$form['signit'] = array( |
$form['signit'] = array( |
| 273 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 285 |
'#description' => t('If this is set, users may sign this node.'), |
'#description' => t('If this is set, users may sign this node.'), |
| 286 |
); |
); |
| 287 |
|
|
| 288 |
// targets |
// Get all target options from modules that implement the signit_targets hook |
| 289 |
$form['signit']['targets'] = array( |
$targets = signit_extend('signit_targets', 'create', $signit); |
|
'#type' => 'fieldset', |
|
|
'#title' => t('SignIt targets'), |
|
|
'#collasible' => true, |
|
|
); |
|
|
$form['signit']['targets'][] = signit_extend('signit_targets', 'create', $signit); |
|
| 290 |
|
|
| 291 |
|
if (count($targets)) { |
| 292 |
|
$form['signit']['targets'] = array( |
| 293 |
|
'#type' => 'fieldset', |
| 294 |
|
'#title' => t('SignIt targets'), |
| 295 |
|
'#collasible' => true, |
| 296 |
|
); |
| 297 |
|
$form['signit']['targets'][] = $targets; |
| 298 |
|
} |
| 299 |
|
|
| 300 |
// messaging |
// Get all messaging options from modules that implement the signit_message hook |
| 301 |
$form['signit']['message'] = array( |
$message = signit_extend('signit_message', 'create', $signit); |
| 302 |
'#type' => 'fieldset', |
if (count($message)) { |
| 303 |
'#title' => t('Messaging'), |
$form['signit']['message'] = array( |
| 304 |
'#collasible' => true, |
'#type' => 'fieldset', |
| 305 |
); |
'#title' => t('Messaging'), |
| 306 |
// run the signit_message hook |
'#collasible' => true, |
| 307 |
$form['signit']['message'][] = signit_extend('signit_message', 'create', $signit); |
); |
| 308 |
|
// run the signit_message hook |
| 309 |
|
$form['signit']['message'][] = $message; |
| 310 |
|
} |
| 311 |
|
|
|
|
|
| 312 |
|
|
| 313 |
// ----------------------------------------------------- |
// ----------------------------------------------------- |
| 314 |
// User data |
// User data |
| 349 |
'#default_value' => array($node->signit['signature_display_count'] ? $node->signit['signature_display_count'] : 20), |
'#default_value' => array($node->signit['signature_display_count'] ? $node->signit['signature_display_count'] : 20), |
| 350 |
'#options' => array(5 => 5, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 50 => 50, 100 => 100), |
'#options' => array(5 => 5, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 50 => 50, 100 => 100), |
| 351 |
'#description' => t('Controls how many signatures are shown on the viewing page.'), |
'#description' => t('Controls how many signatures are shown on the viewing page.'), |
| 352 |
|
'#prefix' => '<div id="signit_stats">', |
| 353 |
); |
); |
| 354 |
|
|
| 355 |
$form['signit']['stats']['signit_padding'] = array( |
$form['signit']['stats']['signit_padding'] = array( |
| 358 |
'#size' => 4, |
'#size' => 4, |
| 359 |
'#default_value' => $node->signit['padding'] ? $node->signit['padding'] : 0, |
'#default_value' => $node->signit['padding'] ? $node->signit['padding'] : 0, |
| 360 |
'#description' => t('You can increase the number of people who have signed this by this value. Only displayed user side.'), |
'#description' => t('You can increase the number of people who have signed this by this value. Only displayed user side.'), |
| 361 |
|
'#suffix' => '</div>', |
| 362 |
); |
); |
| 363 |
|
|
| 364 |
|
// ----------------------------------------------------- |
| 365 |
// process options |
// process options |
| 366 |
$form['signit']['processing'] = array( |
$form['signit']['processing'] = array( |
| 367 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 370 |
'#access' => user_access('configure processing'), |
'#access' => user_access('configure processing'), |
| 371 |
); |
); |
| 372 |
|
|
| 373 |
$form['signit']['processing']['signit_process'] = array( |
// check and see if SignIt creator can set processing options |
| 374 |
'#type' => 'radios', |
// creator is allowed |
| 375 |
'#title' => t('SignIt procesing'), |
if (variable_get('signit_process_allow', false) ) { |
| 376 |
'#default_value' => $node->signit['process'] ? $node->signit['process'] : variable_get('signit_process', 0), |
$form['signit']['processing']['signit_process'] = array( |
| 377 |
'#description' => t('Determines when how a node is processed when someone signs it. It is generally not a good idea to change this setting once a node has been created.'), |
'#type' => 'select', |
| 378 |
'#options' => signit_kinds(), |
'#title' => t('SignIt procesing'), |
| 379 |
'#required' => true, |
'#default_value' => $node->signit['process'] ? $node->signit['process'] : variable_get('signit_process', 0), |
| 380 |
); |
'#description' => t('Determines when how a node is processed when someone signs it. It is generally not a good idea to change this setting once a node has been created.'), |
| 381 |
|
'#options' => variable_get('signit_sign_types', array()), |
| 382 |
|
'#required' => true, |
| 383 |
|
); |
| 384 |
|
} |
| 385 |
|
else { |
| 386 |
|
$form['signit']['processing']['signit_process'] = array( |
| 387 |
|
'#type' => 'hidden', |
| 388 |
|
'#default_value' => variable_get('signit_process', null), |
| 389 |
|
); |
| 390 |
|
} |
| 391 |
|
|
| 392 |
$form['signit']['processing']['signit_thank_you_page'] = array( |
$form['signit']['processing']['signit_thank_you_page'] = array( |
| 393 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 394 |
'#title' => t('"Thank You" page'), |
'#title' => t('"Thank You" page'), |
| 396 |
'#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.'), |
| 397 |
); |
); |
| 398 |
|
|
| 399 |
|
// ----------------------------------------------------- |
| 400 |
// dates |
// dates |
| 401 |
$form['signit']['dates'] = array( |
$form['signit']['dates'] = array( |
| 402 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 406 |
|
|
| 407 |
$form['signit']['dates']['signit_use_dates'] = array( |
$form['signit']['dates']['signit_use_dates'] = array( |
| 408 |
'#type' => 'checkbox', |
'#type' => 'checkbox', |
| 409 |
'#title' => t('Allow signatures between dates.'), |
'#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.'), |
|
|
); |
|
|
|
|
|
$form['signit']['dates']['signit_use_dates'] = array( |
|
|
'#type' => 'checkbox', |
|
|
'#title' => t('Allow signatures between dates.'), |
|
| 410 |
'#options' => array('Enabled'), |
'#options' => array('Enabled'), |
| 411 |
'#default_value' => $signit['use_dates'] ? 1 : 0, |
'#default_value' => $signit['use_dates'] ? 1 : 0, |
| 412 |
'#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.'), |
'#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.'), |
| 419 |
$form['signit']['dates']['signit_start'] = array( |
$form['signit']['dates']['signit_start'] = array( |
| 420 |
'#type' => 'date', |
'#type' => 'date', |
| 421 |
'#title' => t('SignIt start'), |
'#title' => t('SignIt start'), |
| 422 |
'#description' => t('Date when the node can be signed.'), |
'#description' => t('Date when the SignIt can be signed.'), |
| 423 |
|
'#prefix' => '<div id="signit_dates">', |
| 424 |
'#default_value' => $node->signit['start'] ? array( |
'#default_value' => $node->signit['start'] ? array( |
| 425 |
'day' => format_date($node->signit['start'], 'custom', 'j'), |
'day' => format_date($node->signit['start'], 'custom', 'j'), |
| 426 |
'month' => format_date($node->signit['start'], 'custom', 'n'), |
'month' => format_date($node->signit['start'], 'custom', 'n'), |
| 429 |
|
|
| 430 |
$form['signit']['dates']['signit_end'] = array( |
$form['signit']['dates']['signit_end'] = array( |
| 431 |
'#type' => 'date', |
'#type' => 'date', |
| 432 |
'#title' => t('SignIt end'), |
'#title' => t('SignIt end'), |
| 433 |
'#description' => t('Date when the node can no longer be signed.'), |
'#description' => t('Date when the SignIt can no longer be signed.'), |
| 434 |
|
'#suffix' => '</div>', |
| 435 |
'#default_value' => $node->signit['end'] ? array( |
'#default_value' => $node->signit['end'] ? array( |
| 436 |
'day' => format_date($node->signit['end'], 'custom', 'j'), |
'day' => format_date($node->signit['end'], 'custom', 'j'), |
| 437 |
'month' => format_date($node->signit['end'], 'custom', 'n'), |
'month' => format_date($node->signit['end'], 'custom', 'n'), |
| 438 |
'year' => format_date($node->signit['end'], 'custom', 'Y')) : $default_date |
'year' => format_date($node->signit['end'], 'custom', 'Y')) : $default_date |
| 439 |
); |
); |
| 440 |
|
|
| 441 |
return $form; |
return $form; |
| 442 |
} |
} |
| 443 |
|
|
| 444 |
/** |
/** |
| 445 |
* Validate a signit creation |
* Validate a signit creation |
| 446 |
* @ TODO code these functions |
* @ TODO code these functions |
| 447 |
|
* @ TODO implement hook |
| 448 |
*/ |
*/ |
| 449 |
function signit_create_form_validate($node) { |
function signit_create_form_validate($node) { |
| 450 |
// do some validation on the incoming data |
// do some validation on the incoming data |
| 825 |
|
|
| 826 |
|
|
| 827 |
/** |
/** |
| 828 |
* handles the display of the signit on a node |
* handles the display of the SignIt on a node. |
| 829 |
|
* attaches some data to the node object, creates display data as well |
| 830 |
* called from nodeapi view |
* called from nodeapi view |
| 831 |
*/ |
*/ |
| 832 |
function signit_view_node(&$node, $teaser) { |
function signit_view_node(&$node, $teaser) { |
| 833 |
global $user; |
global $user; |
| 834 |
$form = signit_node_render($node); |
|
|
|
|
| 835 |
if ($signit = signit_load_signit($node->nid)) { |
if ($signit = signit_load_signit($node->nid)) { |
| 836 |
// never show on teaser |
// never show on teaser |
| 837 |
if (! $teaser) { |
if (! $teaser) { |
| 838 |
if (user_access("sign node")) { |
// can user sign node? |
| 839 |
|
if (user_access("sign node")) { |
| 840 |
|
// is the signit active? |
| 841 |
if (signit_is_active($node)) { |
if (signit_is_active($node)) { |
| 842 |
|
// has user signed this already? |
| 843 |
if ((!(signit_user_signed_signit($node->nid, $user->mail, $user->uid))) || ($user->uid == 0) ) { |
if ((!(signit_user_signed_signit($node->nid, $user->mail, $user->uid))) || ($user->uid == 0) ) { |
| 844 |
$signit_form = signit_node_render($node); |
$signit_form = signit_node_render($node); |
|
|
|
| 845 |
} |
} |
| 846 |
else { |
else { |
| 847 |
$signit_form = theme("signit_already_signed", $node); |
$signit_form = theme("signit_already_signed", $node); |
| 876 |
* helper function to see if signit is active |
* helper function to see if signit is active |
| 877 |
*/ |
*/ |
| 878 |
function signit_is_active($node) { |
function signit_is_active($node) { |
| 879 |
|
|
| 880 |
// make sure the status is active |
// make sure the status is active |
| 881 |
if ($node->signit['status'] != 1) { |
if ($node->signit['status'] != 1) { |
| 882 |
return false; |
return false; |
| 927 |
|
|
| 928 |
/** |
/** |
| 929 |
* Load an existing signit |
* Load an existing signit |
| 930 |
|
* @param $nid is a node id |
| 931 |
*/ |
*/ |
| 932 |
function signit_load_signit($nid) { |
function signit_load_signit($nid) { |
| 933 |
$result = db_fetch_array(db_query("SELECT * FROM {signit} WHERE nid = %d", $nid)); |
$result = db_fetch_array(db_query("SELECT * FROM {signit} WHERE nid = %d", $nid)); |
| 1001 |
return $result['total']; |
return $result['total']; |
| 1002 |
} |
} |
| 1003 |
|
|
|
|
|
| 1004 |
/** |
/** |
| 1005 |
* returns total number of signatures to send |
* returns total number of signatures to send |
| 1006 |
*/ |
*/ |
| 1072 |
} |
} |
| 1073 |
|
|
| 1074 |
|
|
|
/** |
|
|
* implementation of the hook_signit_messaging |
|
|
*/ |
|
|
function signit_signit_message($op, $data){ |
|
|
switch ($op) { |
|
|
case 'admin': |
|
|
return signit_signit_message_admin(); |
|
|
break; |
|
|
case 'create': |
|
|
return signit_signit_message_create($data); |
|
|
} |
|
|
} |
|
|
|
|
|
/** |
|
|
* generates the form for admining hook_signit_targets |
|
|
*/ |
|
|
function signit_signit_message_admin($signit){ |
|
|
$form['signit_message_control'] = array( |
|
|
'#type' => 'checkbox', |
|
|
'#title' => 'SignIt creators can set the email options of their signit', |
|
|
'#default_value' => variable_get('signit_message_control', true) |
|
|
); |
|
|
return $form; |
|
|
} |
|
|
|
|
|
/** |
|
|
* generates the form for creating hook_signit_targets |
|
|
*/ |
|
|
function signit_signit_message_create($signit){ |
|
|
$form['signit']['message']['signit_email_from'] = array( |
|
|
'#type' => 'textfield', |
|
|
'#title' => t('Email from'), |
|
|
'#default_value' => $node->signit['email_from'] ? $node->signit['email_from']: variable_get("site_mail", null), |
|
|
'#description' => t('Enter the email address that will appear in the "From: " header of sent messages. This is <em>only</em> used when sending a list of signatures.'), |
|
|
); |
|
|
$form['signit']['message']['signit_email_subject_set'] = array( |
|
|
'#type' => 'checkbox', |
|
|
'#title' => t('Allow users to set email subject.'), |
|
|
'#options' => array('Enabled'), |
|
|
'#default_value' => $node->signit['email_subject_set'] ? 1 : 0, |
|
|
'#description' => t('If this is not set, the subject will be populated by the below value'), |
|
|
); |
|
|
|
|
|
// signit message subject |
|
|
$form['signit']['message']['signit_email_subject'] = array( |
|
|
'#type' => 'textfield', |
|
|
'#title' => t('Email subject'), |
|
|
'#default_value' => $node->signit['email_subject'] ? $node->signit['email_subject'] : "My SignIt ", |
|
|
'#description' => t('Subject of auto-response email message to be sent.'), |
|
|
); |
|
|
|
|
|
// signit message body |
|
|
$form['signit']['message']['signit_message_filter']['signit_message'] = array( |
|
|
'#type' => 'textarea', |
|
|
'#title' => t('Email message'), |
|
|
'#default_value' => $node->signit['message'], |
|
|
'#description' => t('Body of auto-response email message to be sent. Please note, changes to this do not effect already collected signatures.'), |
|
|
); |
|
|
// add a filter form to to the body |
|
|
$form['signit']['message']['signit_message_filter']['signit_message_format'] = filter_form($node->signit['message_format'], null, array('signit_message_filter')); |
|
|
|
|
|
|
|
|
$form['signit']['message']['signit_personal_message'] = array( |
|
|
'#type' => 'checkbox', |
|
|
'#title' => t('Allow users to add personal messages.'), |
|
|
'#options' => array('Enabled'), |
|
|
'#default_value' => $node->signit['personal_message'] ? 1 : 0, |
|
|
'#description' => t('Gives user the ability to add a personal message to the email template. ') |
|
|
); |
|
|
|
|
|
$form['signit']['message']['signit_comment_allow'] = array( |
|
|
'#type' => 'checkbox', |
|
|
'#title' => t('Allow users to add a comment.'), |
|
|
'#options' => array('Enabled'), |
|
|
'#default_value' => $node->signit['comment_allow'] ? 1 : 0, |
|
|
'#description' => t('Gives user the ability to leave a comment along with their message. This can be displayed on the list of signatures.') |
|
|
); |
|
|
|
|
|
$form['signit']['message']['signit_comment_allow_html'] = array( |
|
|
'#type' => 'checkbox', |
|
|
'#title' => t('Allow HTML in comment form.'), |
|
|
'#options' => array('Enabled'), |
|
|
'#default_value' => $node->signit['comment_allow_html'] ? 1 : 0, |
|
|
'#description' => t('If this is checked, non-anonymous users will be allowed to have HTML tags in the comment form. Anonymous users are <em>never</em> allowed to enter HTML.'), |
|
|
); |
|
|
return $form; |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
* implementation of the hook_signit_targets |
|
|
*/ |
|
|
function signit_signit_targets($op, $data){ |
|
|
switch ($op) { |
|
|
case 'admin': |
|
|
return signit_signit_targets_admin(); |
|
|
break; |
|
|
case 'create': |
|
|
return signit_signit_targets_create($data); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
* generates the form for hook_signit_targets |
|
|
*/ |
|
|
function signit_signit_targets_create($signit){ |
|
|
|
|
|
// set target title |
|
|
$form['target_title'] = array( |
|
|
'#type' => 'textfield', |
|
|
'#title' => t('Target title'), |
|
|
'#default_value' => $node->signit['target_title'], |
|
|
'#description' => t('Give the intended target of your SignIt a title.'), |
|
|
'#access' => variable_get('signit_target_title_set', false) ? true: false, |
|
|
); |
|
|
|
|
|
// build the potential targets |
|
|
// @ TODO |
|
|
|
|
|
// check the target settigns |
|
|
switch (variable_get('signit_targets_set', 0)) { |
|
|
|
|
|
case 0: |
|
|
$form['signit_targets_email_to'] = array( |
|
|
'#type' => 'hidden', |
|
|
'#default_value' => variable_get('signit_targets_default',''), |
|
|
); |
|
|
break; |
|
|
|
|
|
case 1: |
|
|
$form['signit_targets_email_to'] = array( |
|
|
'#type' => 'select', |
|
|
'#title' => t('SignIt email targets'), |
|
|
'#default_value' => $addresses, |
|
|
'#description' => t('Enter email address and name seperated by comma, eg: "janedoe@janedoe.com, Jane Doe". Names are not needed, but will replace the email address on the display. Please note, changes to this do not effect already collected signatures.'), |
|
|
); |
|
|
break; |
|
|
|
|
|
case 2: |
|
|
$form['signit_targets_email_to'] = array( |
|
|
'#type' => 'textarea', |
|
|
'#title' => t('SignIt email targets'), |
|
|
'#default_value' => $addresses, |
|
|
'#description' => t('Enter email address and name seperated by comma, eg: "janedoe@janedoe.com, Jane Doe". Names are not needed, but will replace the email address on the display. Please note, changes to this do not effect already collected signatures.'), |
|
|
); |
|
|
break; |
|
|
} |
|
|
return $form; |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
* generates the form for hook_signit_targets for admin |
|
|
*/ |
|
|
function signit_signit_targets_admin() { |
|
|
|
|
|
$form['signit_target_title_set'] = array( |
|
|
'#type' => 'checkbox', |
|
|
'#title' => 'SignIt creators can set the title of their signit', |
|
|
'#default_value' => variable_get('signit_target_title_set', true) |
|
|
); |
|
|
|
|
|
$radios = array( |
|
|
0 => t('SignIt Creators can not select target'), |
|
|
1 => t('SignIt Creators can select targets from a list'), |
|
|
2 => t('SignIt Creators can enter their own targets') |
|
|
); |
|
|
$form['signit_targets_set'] = array( |
|
|
'#type' => 'select', |
|
|
'#title' => t('Target settings'), |
|
|
'#options' => $radios, |
|
|
'#default_value' => variable_get('signit_targets_set', 0), |
|
|
'#description' => t('If SignIt creators can not select a target, the target(s) are used from the field below. If users can select from a list, that list is populated from the field below.'), |
|
|
); |
|
|
$form['signit_targets_default'] = array( |
|
|
'#type' => 'textarea', |
|
|
'#title' => t('SignIt email targets'), |
|
|
'#default_value' => variable_get('signit_targets_default',''), |
|
|
'#description' => t('Enter email address and name seperated by comma, eg: "janedoe@janedoe.com, Jane Doe". Names are not needed, but will replace the email address on the display. Please note, changes to this do not effect already collected signatures.'), |
|
|
); |
|
|
|
|
|
return $form; |
|
|
} |
|
|
|
|
|
|
|
| 1075 |
/* ******************************************** */ |
/* ******************************************** */ |
| 1076 |
/* Admin functions */ |
/* Admin functions */ |
| 1077 |
/* ******************************************** */ |
/* ******************************************** */ |
| 1085 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 1086 |
'#title' => t('Settings'), |
'#title' => t('Settings'), |
| 1087 |
); |
); |
| 1088 |
|
|
|
// We check all options by default |
|
|
$form['signit']['signit_sign_types'] = array( |
|
|
'#type' => 'checkboxes', |
|
|
'#title' => t('SignIt types'), |
|
|
'#default_value' => variable_get('signit_sign_types', signit_kinds()), |
|
|
'#description' => t('Set what kinds of SignIt modes are avaiable. Enabling multiple options will allow a SignIt creator to choose one option'), |
|
|
'#options' => signit_kinds(), |
|
|
); |
|
|
|
|
| 1089 |
// display options |
// display options |
| 1090 |
$options = array(1 => t('In line in body'), 0 => t('Only in the node object') ); |
$options = array(1 => t('In line (normal)'), 0 => t('Via node object (requires custom theming)') ); |
| 1091 |
$form['signit']['signit_themeing_options'] = array( |
$form['signit']['signit_themeing_options'] = array( |
| 1092 |
'#type' => 'radios', |
'#type' => 'radios', |
| 1093 |
'#title' => t('Themeing options'), |
'#title' => t('Themeing options'), |
| 1096 |
'#description' => t('This controls if the SignIt form displays in the body of the node. Choose "In line" if you don\'t understand this'), |
'#description' => t('This controls if the SignIt form displays in the body of the node. Choose "In line" if you don\'t understand this'), |
| 1097 |
); |
); |
| 1098 |
|
|
|
|
|
| 1099 |
// target options |
// target options |
| 1100 |
$form['signit']['targets'] = array( |
$form['signit']['targets'] = array( |
| 1101 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 1118 |
// defaults for processing especially for users who do not have permission to change |
// defaults for processing especially for users who do not have permission to change |
| 1119 |
$form['signit']['processing'] = array( |
$form['signit']['processing'] = array( |
| 1120 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 1121 |
'#title' => t('Processing Defaults'), |
'#title' => t('Processing'), |
| 1122 |
'#collapsible' => true, |
'#collapsible' => true, |
| 1123 |
'#access' => TRUE, |
'#access' => TRUE, |
| 1124 |
'#description' => t('When a user does not have access to Signit Processing, these default settings will be used') |
'#description' => t('When a user does not have access to Signit Processing, these default settings will be used') |
| 1125 |
); |
); |
| 1126 |
|
|
| 1127 |
|
// We check all options by default |
| 1128 |
|
$form['signit']['processing']['signit_sign_types'] = array( |
| 1129 |
|
'#type' => 'select', |
| 1130 |
|
'#multiple' => true, |
| 1131 |
|
'#title' => t('SignIt types'), |
| 1132 |
|
'#default_value' => variable_get('signit_sign_types', signit_kinds()), |
| 1133 |
|
'#description' => t('Set what kinds of SignIt modes are avaiable. Enabling multiple options will allow a SignIt creator to choose an option'), |
| 1134 |
|
'#options' => signit_kinds(), |
| 1135 |
|
); |
| 1136 |
|
|
| 1137 |
|
$form['signit']['processing']['signit_process_allow'] = array( |
| 1138 |
|
'#type' => 'checkbox', |
| 1139 |
|
'#title' => t('SignIt creators can choose processing.'), |
| 1140 |
|
'#default_value' => variable_get('signit_process_allow', false), |
| 1141 |
|
'#description' => t('Allows SignIt creators to choose what kind of processing options their SignIt will use.'), |
| 1142 |
|
); |
| 1143 |
|
|
| 1144 |
$form['signit']['processing']['signit_process'] = array( |
$form['signit']['processing']['signit_process'] = array( |
| 1145 |
'#type' => 'radios', |
'#type' => 'select', |
| 1146 |
'#title' => t('SignIt processing'), |
'#title' => t('Default SignIt processing'), |
| 1147 |
'#default_value' => variable_get('signit_process',0), |
'#default_value' => variable_get('signit_process',0), |
| 1148 |
'#description' => t('Determines when how a node is processed when someone signs it. It is generally not a good idea to change this setting once a node has been created.'), |
'#description' => t('Determines how a SignIt is processed when someone signs it if the creator can not set what type of processing is used'), |
| 1149 |
'#options' => signit_kinds(), |
'#options' => signit_kinds(), |
| 1150 |
'#default_value' => variable_get('signit_process', null), |
'#default_value' => variable_get('signit_process', null), |
| 1151 |
'#required' => true, |
'#required' => true, |
| 1152 |
); |
); |
| 1153 |
|
|
| 1154 |
$form['signit']['processing']['signit_default_goto_page'] = array( |
$form['signit']['processing']['signit_default_goto_page'] = array( |
| 1155 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 1156 |
'#title' => t('Default "Thank You" Page'), |
'#title' => t('Default "Thank You" Page'), |
| 1157 |
'#default_value' => variable_get('signit_default_goto_page', ''), |
'#default_value' => variable_get('signit_default_goto_page', ''), |
| 1158 |
'#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.'), |
| 1159 |
); |
); |
| 1160 |
|
|
| 1161 |
|
// @TODO put this into the admin hook |
| 1162 |
if (module_exists("civicrm")) { |
if (module_exists("civicrm")) { |
| 1163 |
$form['civicrm'] = array( |
$form['civicrm'] = array( |
| 1164 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 1805 |
* format the signit email content |
* format the signit email content |
| 1806 |
*/ |
*/ |
| 1807 |
function theme_signit_display_message($signit) { |
function theme_signit_display_message($signit) { |
| 1808 |
$output = "<blockquote>". check_markup($signit['message']) ."</blockquote>"; |
$output = "<blockquote>". check_markup($signit->message) ."</blockquote>"; |
| 1809 |
return $output; |
return $output; |
| 1810 |
} |
} |
| 1811 |
|
|
| 1822 |
* display the signit email content |
* display the signit email content |
| 1823 |
*/ |
*/ |
| 1824 |
function theme_signit_already_signed($node) { |
function theme_signit_already_signed($node) { |
| 1825 |
drupal_set_message(t("You have already signed this. Thanks for participating!")); |
static $control; |
| 1826 |
$output = theme('signit_display_message', $node->signit); |
|
| 1827 |
return $output; |
if (! $control) { |
| 1828 |
|
$control = 1; |
| 1829 |
|
drupal_set_message(t("You have already signed this. Thanks for participating!")); |
| 1830 |
|
$output = theme('signit_display_message', $node->signit); |
| 1831 |
|
return $output; |
| 1832 |
|
} |
| 1833 |
} |
} |
| 1834 |
|
|
| 1835 |
/** |
/** |
| 1836 |
* signit has expried |
* signit has expried |
| 1837 |
*/ |
*/ |
| 1838 |
function theme_signit_not_active($node) { |
function theme_signit_not_active($node) { |
| 1839 |
drupal_set_message(t("This has closed for signatures.")); |
static $control; |
| 1840 |
$output = theme('signit_display_message', $node->signit); |
if (! $control) { |
| 1841 |
return $output; |
drupal_set_message(t("This has closed for signatures.")); |
| 1842 |
|
$output = theme('signit_display_message', $node->signit); |
| 1843 |
|
return $output; |
| 1844 |
|
} |
| 1845 |
|
$control = true; |
| 1846 |
} |
} |
| 1847 |
|
|
| 1848 |
/** |
/** |