Index: modules/paypal_tipjar/paypal_tipjar.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/paypal_tipjar/paypal_tipjar.module,v retrieving revision 1.7 diff -u -r1.7 paypal_tipjar.module --- modules/paypal_tipjar/paypal_tipjar.module 27 May 2005 14:39:25 -0000 1.7 +++ modules/paypal_tipjar/paypal_tipjar.module 9 May 2006 18:28:26 -0000 @@ -71,24 +71,109 @@ * hook_settings() implementation */ function paypal_tipjar_settings() { - $tmp_output .= form_textfield(t('PayPal email address'), 'paypal_tipjar_account', variable_get('paypal_tipjar_account', ''), 64, 128, t('This is the PayPal account that receives money for the tip jar.')); - $tmp_output .= form_textfield(t('PayPal item ID'), 'paypal_tipjar_item_ID', variable_get('paypal_tipjar_item_ID', ''), 64, 128, t('This is the PayPal item ID for this donation. Other donations, products, and services may have other IDs.')); - $tmp_output .= form_textfield(t('Minimum hours between updates'), 'paypal_tipjar_cron_period', variable_get('paypal_tipjar_cron_period', 4), 3, 3, t('Specify the minimum number of hours between updates of the total amount of money in the tip jar.')); - $tmp_output .= form_textarea(t('PayPal button code'), 'paypal_tipjar_button_code', variable_get('paypal_tipjar_button_code', ''), 64, 10, t('This is the code that PayPal generates or some similar code that links to PayPal. Other images and text can be entered here as well.')); + $form['paypal_tipjar_account'] = array( + '#type' => 'textfield', + '#title' => t('PayPal email address'), + '#default_value' => variable_get('paypal_tipjar_account', ''), + '#size' => 64, + '#maxlength' => 128, + '#description' => t('This is the PayPal account that receives money for the tip jar.'), + ); + + $form['paypal_tipjar_item_ID'] = array( + '#type' => 'textfield', + '#title' => t('PayPal item ID'), + '#default_value' => variable_get('paypal_tipjar_item_ID', ''), + '#size' => 64, + '#maxlength' => 128, + '#description' => t('This is the PayPal item ID for this donation. Other donations, products, and services may have other IDs.'), + ); + + $form['paypal_tipjar_cron_period'] = array( + '#type' => 'textfield', + '#title' => t('Minimum hours between updates'), + '#default_value' => variable_get('paypal_tipjar_cron_period', 4), + '#size' => 3, + '#maxlength' => 3, + '#description' => t('Specify the minimum number of hours between updates of the total amount of money in the tip jar.'), + ); + + $form['paypal_tipjar_button_code'] = array( + '#type' => 'textarea', + '#title' => t('PayPal button code'), + '#default_value' => variable_get('paypal_tipjar_button_code', ''), + '#cols' => 64, + '#rows' => 10, + '#description' => t('This is the code that PayPal generates or some similar code that links to PayPal. Other images and text can be entered here as well.'), + ); + $output = $tmp_output; if (function_exists('imagepng')) { - $tmp_output = form_checkbox(t('Show graph of donations'), 'paypal_show_graphic', 1, variable_get('paypal_show_graphic', 1), t('Enable a graphic showing the amount of donations compared to the target donation level.')); - $tmp_output .= form_textfield(t('Path to image'), 'paypal_tipjar_output_file', variable_get('paypal_tipjar_output_file', ''), 64, 128, t('This is where the rendered image will be saved. Please supply the complete path to a writeable location. The image will be a PNG. If you want it to appear in the block, add an <image /> tag in the PayPal button code textarea.')); - $tmp_output .= form_textfield(t('Ignore donations older than this number of days'), 'paypal_tipjar_ignore_older_than', variable_get('paypal_tipjar_ignore_older_than', 30), 5, 32, t('Donations older than this will not be counted toward the target level. Enter -1 to count all donations.')); - $tmp_output .= form_textfield(t('Target donation level'), 'paypal_tipjar_target_donation_level', variable_get('paypal_tipjar_target_donation_level', 10), 5, 32, t('This is how much money you would like to receive total. Only donations within the specified timeframe are counted.')); - $tmp_output .= form_textfield(t('Graph foreground color'), 'paypal_tipjar_foreground', variable_get('paypal_tipjar_foreground', '#EFEFEF'), 7, 32, t('Please supply a valid hexidecimal HTML color value.')); - $tmp_output .= form_textfield(t('Graph background color'), 'paypal_tipjar_background', variable_get('paypal_tipjar_background', '#FFFFFF'), 7, 32, t('Please supply a valid hexidecimal HTML color value.')); - $tmp_output .= form_textfield(t('Graph line color'), 'paypal_tipjar_line', variable_get('paypal_tipjar_line', '#000000'), 7, 32, t('Please supply a valid hexidecimal HTML color value.')); - $output .= form_group(t('Graph settings'), $tmp_output); + $form['graph'] = array( + '#type' => 'fieldset', + '#title' => t('Graph settings'), + '#collapsible' => true, + '#collapsed' => true, + ); + $form['graph']['paypal_show_graphic'] = array( + '#type' => 'checkbox', + '#title' => t('Show graph of donations'), + '#return_value' => 1, + '#default_value' => variable_get('paypal_show_graphic', 1), + '#description' => t('Enable a graphic showing the amount of donations compared to the target donation level.'), + ); + $form['graph']['paypal_tipjar_output_file'] = array( + '#type' => 'textfield', + '#title' => t('Path to image'), + '#default_value' => variable_get('paypal_tipjar_output_file', ''), + '#size' => 64, + '#maxlength' => 128, + '#description' => t('This is where the rendered image will be saved. Please supply the complete path to a writeable location. The image will be a PNG. If you want it to appear in the block, add an <image /> tag in the PayPal button code textarea.'), + ); + $form['graph']['paypal_tipjar_ignore_older_than'] = array( + '#type' => 'textfield', + '#title' => t('Ignore donations older than this number of days'), + '#default_value' => variable_get('paypal_tipjar_ignore_older_than', 30), + '#size' => 5, + '#maxlength' => 32, + '#description' => t('Donations older than this will not be counted toward the target level. Enter -1 to count all donations.'), + ); + $form['graph']['paypal_tipjar_target_donation_level'] = array( + '#type' => 'textfield', + '#title' => t('Target donation level'), + '#default_value' => variable_get('paypal_tipjar_target_donation_level', 10), + '#size' => 5, + '#maxlength' => 32, + '#description' => t('This is how much money you would like to receive total. Only donations within the specified timeframe are counted.'), + ); + $form['graph']['paypal_tipjar_foreground'] = array( + '#type' => 'textfield', + '#title' => t('Graph foreground color'), + '#default_value' => variable_get('paypal_tipjar_foreground', '#EFEFEF'), + '#size' => 7, + '#maxlength' => 32, + '#description' => t('Please supply a valid hexidecimal HTML color value.'), + ); + $form['graph']['paypal_tipjar_background'] = array( + '#type' => 'textfield', + '#title' => t('Graph background color'), + '#default_value' => variable_get('paypal_tipjar_background', '#FFFFFF'), + '#size' => 7, + '#maxlength' => 32, + '#description' => t('Please supply a valid hexidecimal HTML color value.'), + ); + $form['graph']['paypal_tipjar_line'] = array( + '#type' => 'textfield', + '#title' => t('Graph line color'), + '#default_value' => variable_get('paypal_tipjar_line', '#000000'), + '#size' => 7, + '#maxlength' => 32, + '#description' => t('Please supply a valid hexidecimal HTML color value.'), + ); } - return $output; + return $form; } /**