Index: modules/smsgateway/smsgateway.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/smsgateway/smsgateway.module,v retrieving revision 1.3 diff -u -r1.3 smsgateway.module --- modules/smsgateway/smsgateway.module 29 Oct 2005 18:04:51 -0000 1.3 +++ modules/smsgateway/smsgateway.module 10 Apr 2006 13:13:11 -0000 @@ -158,7 +158,10 @@ _smsgateway_clearlogs(); } - $form = form_submit(t('Clear Logs')); + $form[] = array( + '#type' => 'submit', + '#value' => t('Clear Logs'), + ); $header = array( array('data' => t('Date'), 'field' => 's.sid', 'sort' => 'desc'), @@ -194,8 +197,8 @@ $rows[] = array(array('data' => $pager, 'colspan' => '5')); } - $output = '
'. form($form, 'post', 'admin/smsgateway/logs/clear') .'
'; - $output .= theme('table', $header, $rows); + //$output = '
'. form_render($form) .'
'; + $output .= '
' . theme('table', $header, $rows) . '
'; print theme('page', $output); } // function _smsgateway_logs @@ -235,12 +238,28 @@ $page_content .= '

Initial Balance was '. $initialbalance .'

'; $page_content .= '

Response from gateway was '. $response .'

'; } - $page_content .= form_textfield(t("Test Mobile Number"), "smsgatewaytest_destination", - variable_get("smsgatewaytest_destination", ""), 25, 40, - t("The number to be used as the destination for the test.", NULL, TRUE)); - $page_content .= form_checkbox(t("Use Bulk Sending for test"), 'smsgatewaytest_usebulk', 1, '0', "Whether the multiple message send approach is used"); - $page_content .= form_submit(t('Submit')); - print theme("page", form($page_content)); + + $form["smsgatewaytest_destination"] = array( + '#type' => 'textfield', + '#title' => t("Test Mobile Number"), + '#default_value' => variable_get("smsgatewaytest_destination", ""), + '#size' => 25, + '#maxlength' => 40, + '#description' => t("The number to be used as the destination for the test.", NULL, TRUE), + ); + $form['smsgatewaytest_usebulk'] = array( + '#type' => 'checkbox', + '#title' => t("Use Bulk Sending for test"), + '#return_value' => 1, + '#default_value' => '0', + '#description' => "Whether the multiple message send approach is used", + ); + $form[] = array( + '#type' => 'submit', + '#value' => t('Submit'), + ); + $page_content .= drupal_get_form('smsgateway_test', $form); + return $page_content; } // function smsgateway_all /** @@ -334,8 +353,7 @@ break; case 'admin/settings/smsgateway': - $output = t("

This page controls the configuration of the smsgateway module. If allows the gateway sending implementation to be chosen and the - gateway settings to be configured.

"); + $output = t('

This page controls the configuration of the smsgateway module. It allows the gateway sending implementation to be chosen and the gateway settings to be configured.

'); break; case "admin/smsgateway/test": @@ -362,41 +380,69 @@ * @return settings HTML or deny access */ function smsgateway_settings() { - // only administrators can access this module - if (!user_access("admin smsgateway")) { - return message_access(); - } + + drupal_set_title(t('SMS Gateway Settings')); + $gateways = _smsgateway_gateway_types(); - $gatewayoptions = array(); foreach( $gateways as $gateway) { - $gatewayoptions[$gateway] = _smsgateway_invoke( 'name', $gateway); + $gateway_options[$gateway] = _smsgateway_invoke('name', $gateway); } $current_gateway = variable_get('smsgateway_gateway', ''); - $output = '

Currently Selected Gateway

'; - if ($current_gateway == '') { - $output .= '

No gateway has been selected

'; - } - else { - $output .= '

'. $gatewayoptions[ $current_gateway] .' Gateway

'; - $output .= '

'. _smsgateway_invoke( 'description', $gateway) .'

'; - } - $output .= form_select("Service Provider", "smsgateway_gateway", - $current_gateway, $gatewayoptions, - "The Name of the SMS Service Provider", 0, FALSE, TRUE); - $output .= form_checkbox(t("Use SSL Encryption"), "smsgateway_usessl", 1, variable_get("smsgateway_usessl", "0"), "Whether the connection to the gateway should be encrypted"); - $output .= form_textfield(t("API Identifier"), "smsgateway_apiid", - variable_get("smsgateway_apiid", ""), 10, 10, - t("The API version identifier that may be used by the SMS gateway.")); - $output .= form_textfield(t("Account Name"), "smsgateway_accountname", - variable_get("smsgateway_accountname", ""), 25, 40, - t("The account or user name used to log into the SMS gateway.", NULL, TRUE)); - $output .= form_textfield(t("Password"), "smsgateway_password", - variable_get("smsgateway_password", ""), 25, 40, - t("The password used to log into the SMS gateway.", NULL, TRUE)); - $output .= form_textfield(t("From Number"), "smsgateway_from", - variable_get("smsgateway_from", ""), 25, 40, - t("The telephone number that the messge is sent from.")); - return $output; -} // function smsgateway_settings -?> +$form['smsgateway_gateway'] = array( + '#type' => 'select', + '#title' => t('Selected Gateway'), + '#default_value' => $current_gateway, + '#options' => $gateway_options, + '#description' => t('The Name of the SMS Service Provider'), + '#extra' => 0, + '#multiple' => FALSE, +); + +$form['smsgateway_usessl'] = array( + '#type' => 'checkbox', + '#title' => t('SSL Encryption'), + '#return_value' => 1, + '#default_value' => variable_get('smsgateway_usessl', '0'), + '#description' => t('Whether the connection to the gateway should be encrypted.'), +); + +$form["smsgateway_apiid"] = array( + '#type' => 'textfield', + '#title' => t('API Identifier'), + '#default_value' => variable_get('smsgateway_apiid', ''), + '#size' => 10, + '#maxlength' => 10, + '#description' => t('The API version identifier that may be used by the SMS gateway.'), +); + +$form['smsgateway_accountname'] = array( + '#type' => 'textfield', + '#title' => t('Account Name'), + '#default_value' => variable_get('smsgateway_accountname', ''), + '#size' => 25, + '#maxlength' => 40, + '#description' => t('The account or user name used to log into the SMS gateway.', NULL, TRUE), +); + +$form['smsgateway_password'] = array( + '#type' => 'textfield', + '#title' => t('Password'), + '#default_value' => variable_get('smsgateway_password', ''), + '#size' => 25, + '#maxlength' => 40, + '#description' => t('The password used to log into the SMS gateway.', NULL, TRUE), +); + +$form['smsgateway_from'] = array( + '#type' => 'textfield', + '#title' => t('From Number'), + '#default_value' => variable_get('smsgateway_from', ''), + '#size' => 25, + '#maxlength' => 40, + '#description' => t('The telephone number that the message is sent from.'), +); +return $form; +} //smsgateway_settings + +