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

Diff of /contributions/modules/authorship/authorship.module

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

revision 1.7, Thu Jul 12 22:21:22 2007 UTC revision 1.8, Sat Oct 11 12:22:16 2008 UTC
# Line 9  Line 9 
9   *  brashquido (http://drupal.org/user/49838)   *  brashquido (http://drupal.org/user/49838)
10   * by AjK (http://drupal.org/user/39030)   * by AjK (http://drupal.org/user/39030)
11   * June 2006   * June 2006
12     *
13     * v6.x-dev written by matt_b
14   */   */
15    
16  if(!defined("_AUTHORSHIP_DEBUG")) {  if(!defined("_AUTHORSHIP_DEBUG")) {
# Line 19  if(!defined("_AUTHORSHIP_DEBUG")) { Line 21  if(!defined("_AUTHORSHIP_DEBUG")) {
21  /**  /**
22   * Implementation of hook_help().   * Implementation of hook_help().
23   */   */
24  function authorship_help($section) {  function authorship_help($path, $arg) {
25    switch ($section) {    switch ($path) {
26      case 'admin/modules#description':      case 'admin/modules#description':
27        return t('Node authorship extention module.');        return t('Node authorship extention module.');
28    }    }
# Line 43  function authorship_perm() { Line 45  function authorship_perm() {
45  /**  /**
46   * Implementation of hook_form_alter()   * Implementation of hook_form_alter()
47   */   */
48  function authorship_form_alter($form_id, &$form) {  function authorship_form_alter(&$form, &$form_state, $form_id) {
49    global $user;    global $user;
50    
51    _authorship_debug("authorship_form_alter(" . $form['#node']->nid . ")");    _authorship_debug("authorship_form_alter(" . $form['#node']->nid . ")");
# Line 78  function authorship_form_alter($form_id, Line 80  function authorship_form_alter($form_id,
80            '#title' => t('Authorship display setting'),            '#title' => t('Authorship display setting'),
81            '#default_value' => $form['#node']->authorship,            '#default_value' => $form['#node']->authorship,
82            '#weight' => 9,            '#weight' => 9,
83            '#description' => t('The name to display as the submitter. '.            '#description' => t('The name to display as the author. '.
84                                'Leave blank for normal operation')                                'Leave blank for normal operation')
85          );          );
86        }        }
# Line 102  function authorship_form_alter($form_id, Line 104  function authorship_form_alter($form_id,
104            '#type' => 'textfield',            '#type' => 'textfield',
105            '#title' => t('Authorship display setting'),            '#title' => t('Authorship display setting'),
106            '#default_value' => $authorship,            '#default_value' => $authorship,
107            '#description' => t('The name to display as the submitter. '.            '#description' => t('The name to display as the author. '.
108                                'Leave blank for normal operation')                                'Leave blank for normal operation')
109          );          );
110        }        }
# Line 165  function authorship_nodeapi(&$node, $op, Line 167  function authorship_nodeapi(&$node, $op,
167      case 'update index':      case 'update index':
168        return db_result(db_query("SELECT authorship FROM {node_authorship} WHERE nid = %d", $node->nid));        return db_result(db_query("SELECT authorship FROM {node_authorship} WHERE nid = %d", $node->nid));
169        break;        break;
170            case 'search result':
171              if ($node->authorship) return array('user' => $node->authorship);
172              break;
173    
174    } // end switch    } // end switch
175  }  }
# Line 207  function authorship_comment(&$comment, $ Line 212  function authorship_comment(&$comment, $
212  }  }
213  /* }}} */  /* }}} */
214    
215    /**
216    *  Implement hook_views_api().
217    */
218    function authorship_views_api() {
219      return array(
220        'api' => 2.0,
221      );
222    }
223    
224  /*=========================*/  /*=========================*/
225  /* Helper functions follow */  /* Helper functions follow */
226  /*=========================*/  /*=========================*/
# Line 254  function _authorship_debug($s) { Line 268  function _authorship_debug($s) {
268  }  }
269  /* }}} */  /* }}} */
270    
 /**  
  * Implementation of hook_views_tables()  
  * (see Views module)  
  */  
 function authorship_views_tables() {  
   $tables['node_authorship'] = array(  
     'join' => array(  
       'left' => array(  
         'table' => 'node',  
         'field' => 'nid',  
       ),  
       'right' => array(  
         'field' => 'nid',  
       ),  
     ),  
     'fields' => array(  
       'authorship' => array(  
         'name' => t('Node: Authorship'),  
         'sortable' => true,  
         'help' => t('Display the authorship display setting for the node.'),  
       ),  
     ),  
     'sorts' => array(  
       'authorship' => array(  
         'name' => t('Node: Authorship'),  
         'help' => t('Sort by the node authorship, alphabetically'),  
       ),  
     ),  
     'filters' => array(  
       'authorship' => array(  
         'name' => t('Node: Authorship'),  
         'operator' => 'views_handler_operator_like',  
         'handler' => 'views_handler_filter_like',  
         'help' => t('Sort by the node authorship, alphabetically'),  
       ),  
     ),  
   );  
   return $tables;  
 }  
271    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.2