/[drupal]/contributions/modules/unfuddle_api/unfuddle_api.module
ViewVC logotype

Diff of /contributions/modules/unfuddle_api/unfuddle_api.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.3.2.2 by lynn, Sun Nov 8 20:42:33 2009 UTC revision 1.3.2.3 by lynn, Mon Nov 23 22:36:10 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: unfuddle_api.module,v 1.3.2.1 2009/11/01 01:52:26 lynn Exp $  // $Id: unfuddle_api.module,v 1.3.2.2 2009/11/08 20:42:33 lynn Exp $
3    
4  /**  /**
5   * @file Unfuddle API Drupal module hooks and API.   * @file Unfuddle API Drupal module hooks and API.
6   */   */
7    
8  /**  /**
9     * Implement hook_help().
10     */
11    function unfuddle_help($path, $arg) {
12      if ($path == 'admin/config/services/unfuddle-api') {
13        return '<p>' . t('Use the following form to enter your Unfuddle connection settings.') . '</p>';
14      }
15    }
16    
17    /**
18   * Implement hook_permission().   * Implement hook_permission().
19   */   */
20  function unfuddle_api_permission() {  function unfuddle_api_permission() {
# Line 21  function unfuddle_api_permission() { Line 30  function unfuddle_api_permission() {
30   * Implement hook_menu().   * Implement hook_menu().
31   */   */
32  function unfuddle_api_menu() {  function unfuddle_api_menu() {
33    $items = array();    $items['admin/config/services/unfuddle-api'] = array(
   
   $items['admin/config/services/unfuddle_api'] = array(  
34      'title' => 'Unfuddle API',      'title' => 'Unfuddle API',
35      'description' => 'Adjust settings for Unfuddle',      'description' => 'Adjust settings for Unfuddle',
36      'page callback' => 'drupal_get_form',      'page callback' => 'drupal_get_form',
37      'page arguments' => array('unfuddle_api_admin_settings'),      'page arguments' => array('unfuddle_api_admin_settings'),
38      'access arguments' => array('administer unfuddle api configuration'),      'access arguments' => array('administer unfuddle api configuration'),
39    );    );
   
40    return $items;    return $items;
41  }  }
42    
# Line 38  function unfuddle_api_menu() { Line 44  function unfuddle_api_menu() {
44   * Administration form for Unfuddle API connection strings stored in the variable table.   * Administration form for Unfuddle API connection strings stored in the variable table.
45   */   */
46  function unfuddle_api_admin_settings() {  function unfuddle_api_admin_settings() {
   $form = array();  
   
   $form['#prefix'] = t('Use the following form to enter your Unfuddle connection settings.');  
   
47    $form['unfuddle_api_url'] = array(    $form['unfuddle_api_url'] = array(
48      '#type' => 'textfield',      '#type' => 'textfield',
49      '#title' => t('URL of the Unfuddle instance'),      '#title' => t('URL of the Unfuddle instance'),
50      '#description' => t('The Unfuddle URL, ensure you enter the FULL URL with leading protocol (http:// OR https://) and NO trailing slash'),      '#description' => t('The Unfuddle URL, ensure you enter the FULL URL with leading protocol (http:// OR https://) and NO trailing slash'),
51      '#default_value' => variable_get('unfuddle_api_url', ''),      '#default_value' => '',
52      '#required' => TRUE,      '#required' => TRUE,
53    );    );
54    $form['unfuddle_api_user'] = array(    $form['unfuddle_api_user'] = array(
55      '#type' => 'textfield',      '#type' => 'textfield',
56      '#title' => t('Unfuddle user'),      '#title' => t('Unfuddle user'),
57      '#default_value' => variable_get('unfuddle_api_user', ''),      '#default_value' => '',
58      '#description' => t('<strong>Note:</strong> this user must have permissions on Unfuddle to perform the actions required'),      '#description' => t('<strong>Note:</strong> this user must have permissions on Unfuddle to perform the actions required'),
59      '#required' => TRUE,      '#required' => TRUE,
60    );    );
61    $form['unfuddle_api_pass'] = array(    $form['unfuddle_api_pass'] = array(
62      '#type' => 'password',      '#type' => 'password',
63      '#title' => t("Unfuddle user's password"),      '#title' => t("Unfuddle user's password"),
64      '#default_value' => variable_get('unfuddle_api_pass', ''),      '#default_value' => '',
65      '#required' => TRUE,      '#required' => TRUE,
66    );    );
67    $form['unfuddle_api_project'] = array(    $form['unfuddle_api_project'] = array(
68      '#type' => 'textfield',      '#type' => 'textfield',
69      '#title' => t("Unfuddle project ID"),      '#title' => t("Unfuddle project ID"),
70      '#description' => t('The integer ID of the project, e.g. 12345.  Find this in your project URL.'),      '#description' => t('The integer ID of the project, e.g. 12345.  Find this in your project URL.'),
71      '#default_value' => variable_get('unfuddle_api_project', ''),      '#default_value' => '',
72    );    );
   
73    return system_settings_form($form);    return system_settings_form($form);
 }  
   
 /**  
  * Wrapper function for loading the Unfuddle class and returning an instantiated Unfuddle object. The main API function for use.  
  *  
  * @param string $url Optional Unfuddle URL.  
  * @param string $user Optional Unfuddle user.  
  * @param string $pass Optional Unfuddle user's password.  
  * @param string $project Optional Unfuddle project ID.  
  */  
 function unfuddle_api_create($url = NULL, $user = NULL, $pass = NULL, $project = NULL) {  
   module_load_include('classes.inc', 'unfuddle_api');  
   
   $unfuddle = new Unfuddle($url, $user, $pass, $project);  
   
   return $unfuddle;  
74  }  }

Legend:
Removed from v.1.3.2.2  
changed lines
  Added in v.1.3.2.3

  ViewVC Help
Powered by ViewVC 1.1.3