Index: /home/obarton/workspace/jcause/modules/contrib-5/views_argument_api/modules/views_argument_api_og.inc =================================================================== --- /home/obarton/workspace/jcause/modules/contrib-5/views_argument_api/modules/views_argument_api_og.inc (revision 6) +++ /home/obarton/workspace/jcause/modules/contrib-5/views_argument_api/modules/views_argument_api_og.inc (working copy) @@ -3,7 +3,7 @@ /** * @file - * This include file implements views_argument_api functionality on + * This include file implements views_argument_api functionality on * behalf of og.module */ @@ -15,42 +15,42 @@ * Hook to define ways to handle user argument form elements. */ function og_views_argument_api_argument_elements() { - $qs = db_query("SELECT n.nid, n.title FROM {node} n INNER JOIN {og} og ON n.nid = og.nid"); - while($obj = db_fetch_object($qs)) { - $group_options[$obj->nid] = $obj->title; - } + $qs = db_query("SELECT n.nid, n.title FROM {node} n INNER JOIN {og} og ON n.nid = og.nid"); + while($obj = db_fetch_object($qs)) { + $group_options[$obj->nid] = $obj->title; + } - $elements = array(); - - // Gid - $elements['gid'] = array(); - - $elements['gid']['gid_select'] = array( - 'name' => 'uid_select', - 'label' => t('Groups: Select a pre-defined group'), - 'handler' => 'views_argument_api_handler_default_form_value', - 'element' => array( - '#options' => $group_options, - '#type' => 'select', - '#title' => t('Group'), - '#description' => t('Choose a group from which to display nodes.'), - ), - ); - - $elements['gid']['gid_node'] = array( - 'name' => 'gid_current', - 'label' => t('Groups: Based on current group'), - 'handler' => 'og_views_argument_api_handler_current', - 'element' => array( - '#type' => 'checkbox', - '#default_value' => TRUE, - '#title' => t('Use the current group to filter for nodes.'), - '#disabled' => TRUE, - '#description' => t('Pass the current group\'s ID to the view.'), - ), - ); - - return $elements; + $elements = array(); + + // Gid + $elements['gid'] = array(); + + $elements['gid']['gid_select'] = array( + 'name' => 'uid_select', + 'label' => t('Groups: Select a pre-defined group'), + 'handler' => 'views_argument_api_handler_default_form_value', + 'element' => array( + '#options' => $group_options, + '#type' => 'select', + '#title' => t('Group'), + '#description' => t('Choose a group from which to display nodes.'), + ), + ); + + $elements['gid']['gid_node'] = array( + 'name' => 'gid_current', + 'label' => t('Groups: Based on current group'), + 'handler' => 'og_views_argument_api_handler_current', + 'element' => array( + '#type' => 'checkbox', + '#default_value' => TRUE, + '#title' => t('Use the current group to filter for nodes.'), + '#disabled' => TRUE, + '#description' => t('Pass the current group\'s ID to the view.'), + ), + ); + + return $elements; } /********************************************************************* @@ -61,21 +61,21 @@ * Passes the current group's gid to the view. */ function og_views_argument_api_handler_gid_current($value) { - $nid = explode('node/', substr(urldecode(drupal_get_destination()), 12)); - if(count($nid) < 2) { - return NULL; - } - - $nid = $nid[1]; - $nid = explode('/', $nid); - $nid = array_shift($nid); - - if(is_numeric($nid)) { - $node = node_load($nid); - $gid = $node->gid; // Todo: verify that this is the right place to look. - } else { - $gid = NULL; - } - - return $gid; + $nid = explode('node/', substr(urldecode(drupal_get_destination()), 12)); + if(count($nid) < 2) { + return NULL; + } + + $nid = $nid[1]; + $nid = explode('/', $nid); + $nid = array_shift($nid); + + if(is_numeric($nid)) { + $node = node_load($nid); + $gid = $node->gid; // Todo: verify that this is the right place to look. + } else { + $gid = NULL; + } + + return $gid; } \ No newline at end of file Index: /home/obarton/workspace/jcause/modules/contrib-5/views_argument_api/modules/views_argument_api_taxonomy.inc =================================================================== --- /home/obarton/workspace/jcause/modules/contrib-5/views_argument_api/modules/views_argument_api_taxonomy.inc (revision 6) +++ /home/obarton/workspace/jcause/modules/contrib-5/views_argument_api/modules/views_argument_api_taxonomy.inc (working copy) @@ -3,7 +3,7 @@ /** * @file - * This include file implements views_argument_api functionality on + * This include file implements views_argument_api functionality on * behalf of taxonomy.module */ @@ -16,73 +16,73 @@ */ function taxonomy_views_argument_api_argument_elements() { - $elements = array(); - - // Taxid - $elements['taxid'] = array(); - - $elements['taxid']['taxid_select'] = array( - 'name' => 'taxid_select', - 'label' => t('Taxonomy: Select a pre-defined term'), - 'handler' => 'views_argument_api_handler_default_form_value', - 'element' => array( - '#options' => taxonomy_form_all(), - '#type' => 'select', - '#title' => t('Term'), - '#description' => t('Choose a term from which to display nodes.'), - ), - ); - - foreach(taxonomy_get_vocabularies() as $vocabulary) { - $elements['taxid']['taxid_node_' . $vocabulary->vid] = array( - 'name' => 'taxid_node_' . $vocabulary->vid, - 'label' => t('Taxonomy: Use node\'s term for !vocabulary', array('!vocabulary' => $vocabulary->name)), - 'handler' => 'taxonomy_views_argument_api_handler_node', - 'callback arguments' => array( - 'vid' => $vocabulary->vid, - ), - 'element' => array( - '#type' => 'checkbox', - '#default_value' => TRUE, - '#title' => t('Use node\'s term for !vocabulary.', array('!vocabulary' => $vocabulary->name)), - '#disabled' => TRUE, - '#description' => t('Pass the node\'s taxonomy for !vocabulary to the view.', array('!vocabulary' => $vocabulary->name)), - ), - ); - } - - // Taxletter - $elements['taxletter'] = array(); - $elements['taxletter']['taxletter_textfield'] = array( - 'name' => 'taxletter_textfield', - 'label' => t('Taxonomy: Enter a pre-defined term'), - 'handler' => 'views_argument_api_handler_default_form_value', - 'element' => array( - '#type' => 'textfield', - '#title' => t('Term'), - '#description' => t('Enter a term (by name) from which to display nodes.'), - ), - ); - - // Vocid - foreach(taxonomy_get_vocabularies() as $vocabulary) { - $vocabularies[$vocabulary->vid] = $vocabulary->name; - } - - $elements['vocid'] = array(); - $elements['vocid']['vocid_select'] = array( - 'name' => 'taxletter_select', - 'label' => t('Taxonomy: Select a pre-defined vocabulary'), - 'handler' => 'views_argument_api_handler_default_form_value', - 'element' => array( - '#options' => $vocabularies, - '#type' => 'select', - '#title' => t('Vocabulary'), - '#description' => t('Choose a vocabulary from which to display nodes.'), - ), - ); - - return $elements; + $elements = array(); + + // Taxid + $elements['taxid'] = array(); + + $elements['taxid']['taxid_select'] = array( + 'name' => 'taxid_select', + 'label' => t('Taxonomy: Select a pre-defined term'), + 'handler' => 'views_argument_api_handler_default_form_value', + 'element' => array( + '#options' => taxonomy_form_all(), + '#type' => 'select', + '#title' => t('Term'), + '#description' => t('Choose a term from which to display nodes.'), + ), + ); + + foreach(taxonomy_get_vocabularies() as $vocabulary) { + $elements['taxid']['taxid_node_' . $vocabulary->vid] = array( + 'name' => 'taxid_node_' . $vocabulary->vid, + 'label' => t('Taxonomy: Use node\'s term for !vocabulary', array('!vocabulary' => $vocabulary->name)), + 'handler' => 'taxonomy_views_argument_api_handler_node', + 'callback arguments' => array( + 'vid' => $vocabulary->vid, + ), + 'element' => array( + '#type' => 'checkbox', + '#default_value' => TRUE, + '#title' => t('Use node\'s term for !vocabulary.', array('!vocabulary' => $vocabulary->name)), + '#disabled' => TRUE, + '#description' => t('Pass the node\'s taxonomy for !vocabulary to the view.', array('!vocabulary' => $vocabulary->name)), + ), + ); + } + + // Taxletter + $elements['taxletter'] = array(); + $elements['taxletter']['taxletter_textfield'] = array( + 'name' => 'taxletter_textfield', + 'label' => t('Taxonomy: Enter a pre-defined term'), + 'handler' => 'views_argument_api_handler_default_form_value', + 'element' => array( + '#type' => 'textfield', + '#title' => t('Term'), + '#description' => t('Enter a term (by name) from which to display nodes.'), + ), + ); + + // Vocid + foreach(taxonomy_get_vocabularies() as $vocabulary) { + $vocabularies[$vocabulary->vid] = $vocabulary->name; + } + + $elements['vocid'] = array(); + $elements['vocid']['vocid_select'] = array( + 'name' => 'taxletter_select', + 'label' => t('Taxonomy: Select a pre-defined vocabulary'), + 'handler' => 'views_argument_api_handler_default_form_value', + 'element' => array( + '#options' => $vocabularies, + '#type' => 'select', + '#title' => t('Vocabulary'), + '#description' => t('Choose a vocabulary from which to display nodes.'), + ), + ); + + return $elements; } /********************************************************************* @@ -93,22 +93,22 @@ * Returns a tid from a particular vid for a loaded node. */ function taxonomy_views_argument_api_handler_node($value, $vid) { - $nid = explode('node/', substr(urldecode(drupal_get_destination()), 12)); - if(count($nid) < 2) { - return NULL; - } - - $nid = $nid[1]; - $nid = explode('/', $nid); - $nid = array_shift($nid); - - if(is_numeric($nid)) { - $terms = taxonomy_node_get_terms_by_vocabulary($nid, $vid); - $term = array_shift($terms); - $tid = $term->tid; - } else { - $tid = NULL; - } - - return $tid; + $nid = explode('node/', substr(urldecode(drupal_get_destination()), 12)); + if(count($nid) < 2) { + return NULL; + } + + $nid = $nid[1]; + $nid = explode('/', $nid); + $nid = array_shift($nid); + + if(is_numeric($nid)) { + $terms = taxonomy_node_get_terms_by_vocabulary($nid, $vid); + $term = array_shift($terms); + $tid = $term->tid; + } else { + $tid = NULL; + } + + return $tid; } \ No newline at end of file Index: /home/obarton/workspace/jcause/modules/contrib-5/views_argument_api/modules/views_argument_api_user.inc =================================================================== --- /home/obarton/workspace/jcause/modules/contrib-5/views_argument_api/modules/views_argument_api_user.inc (revision 6) +++ /home/obarton/workspace/jcause/modules/contrib-5/views_argument_api/modules/views_argument_api_user.inc (working copy) @@ -3,7 +3,7 @@ /** * @file - * This include file implements views_argument_api functionality on + * This include file implements views_argument_api functionality on * behalf of user.module */ @@ -15,113 +15,113 @@ * Hook to define ways to handle user argument form elements. */ function user_views_argument_api_argument_elements() { - $qs = db_query("SELECT u.uid, u.name FROM {users} u"); - while($obj = db_fetch_object($qs)) { - if(empty($obj->name)) { - $name = t('Anonymous'); - } else { - $name = $obj->name; - } - $user_options[$obj->uid] = $name; - } - - $elements = array(); - - // Uid - $elements['uid'] = array(); - - $elements['uid']['uid_select'] = array( - 'name' => 'uid_select', - 'label' => t('User: Select a pre-defined user'), - 'handler' => 'views_argument_api_handler_default_form_value', - 'element' => array( - '#options' => $user_options, - '#type' => 'select', - '#title' => t('User'), - '#description' => t('Choose a user from which to display nodes.'), - ), - ); - - $elements['uid']['uid_current'] = array( - 'name' => 'uid_current', - 'label' => t('User: Based on current user'), - 'handler' => 'user_views_argument_api_handler_current', - 'element' => array( - '#type' => 'checkbox', - '#default_value' => TRUE, - '#title' => t('Use the current user to filter nodes.'), - '#disabled' => TRUE, - '#description' => t('Pass the current user\'s ID to the view.'), - ), - ); - - $elements['uid']['uid_node'] = array( - 'name' => 'uid_node', - 'label' => t('User: Based on current node\'s author'), - 'handler' => 'user_views_argument_api_handler_node', - 'element' => array( - '#type' => 'checkbox', - '#default_value' => TRUE, - '#title' => t('Use the current node\'s author to filter nodes.'), - '#disabled' => TRUE, - '#description' => t('Pass the current node\'s author to the view.'), - ), - ); - - // Uidtouch - $elements['uidtouch'] = array(); - $elements['uidtouch']['uidtouch_select'] = array( - 'name' => 'uidtouch_select', - 'label' => t('User: Select a pre-defined user'), - 'handler' => 'views_argument_api_handler_default_form_value', - 'element' => array( - '#options' => $user_options, - '#type' => 'select', - '#title' => t('User'), - '#description' => t('Choose a user from which to display touched nodes.'), - ), - ); - - $elements['uidtouch']['uidtouch_current'] = array( - 'name' => 'uidtouch_current', - 'label' => t('User: Based on current user'), - 'handler' => 'user_views_argument_api_handler_current', - 'element' => array( - '#type' => 'checkbox', - '#default_value' => TRUE, - '#title' => t('Use the current user to filter for touched nodes.'), - '#disabled' => TRUE, - '#description' => t('Pass the current user\'s ID to the view to filter for touched nodes.'), - ), - ); - - $elements['uidtouch']['uidtouch_node'] = array( - 'name' => 'uidtouch_node', - 'label' => t('User: Based on current node\'s author'), - 'handler' => 'user_views_argument_api_handler_node', - 'element' => array( - '#type' => 'checkbox', - '#default_value' => TRUE, - '#title' => t('Use the current node\'s author to filter for touched nodes.'), - '#disabled' => TRUE, - '#description' => t('Pass the current node\'s author to the view to filter for touched nodes.'), - ), - ); + $qs = db_query("SELECT u.uid, u.name FROM {users} u"); + while($obj = db_fetch_object($qs)) { + if(empty($obj->name)) { + $name = t('Anonymous'); + } else { + $name = $obj->name; + } + $user_options[$obj->uid] = $name; + } + + $elements = array(); + + // Uid + $elements['uid'] = array(); + + $elements['uid']['uid_select'] = array( + 'name' => 'uid_select', + 'label' => t('User: Select a pre-defined user'), + 'handler' => 'views_argument_api_handler_default_form_value', + 'element' => array( + '#options' => $user_options, + '#type' => 'select', + '#title' => t('User'), + '#description' => t('Choose a user from which to display nodes.'), + ), + ); + + $elements['uid']['uid_current'] = array( + 'name' => 'uid_current', + 'label' => t('User: Based on current user'), + 'handler' => 'user_views_argument_api_handler_current', + 'element' => array( + '#type' => 'checkbox', + '#default_value' => TRUE, + '#title' => t('Use the current user to filter nodes.'), + '#disabled' => TRUE, + '#description' => t('Pass the current user\'s ID to the view.'), + ), + ); + + $elements['uid']['uid_node'] = array( + 'name' => 'uid_node', + 'label' => t('User: Based on current node\'s author'), + 'handler' => 'user_views_argument_api_handler_node', + 'element' => array( + '#type' => 'checkbox', + '#default_value' => TRUE, + '#title' => t('Use the current node\'s author to filter nodes.'), + '#disabled' => TRUE, + '#description' => t('Pass the current node\'s author to the view.'), + ), + ); + + // Uidtouch + $elements['uidtouch'] = array(); + $elements['uidtouch']['uidtouch_select'] = array( + 'name' => 'uidtouch_select', + 'label' => t('User: Select a pre-defined user'), + 'handler' => 'views_argument_api_handler_default_form_value', + 'element' => array( + '#options' => $user_options, + '#type' => 'select', + '#title' => t('User'), + '#description' => t('Choose a user from which to display touched nodes.'), + ), + ); + + $elements['uidtouch']['uidtouch_current'] = array( + 'name' => 'uidtouch_current', + 'label' => t('User: Based on current user'), + 'handler' => 'user_views_argument_api_handler_current', + 'element' => array( + '#type' => 'checkbox', + '#default_value' => TRUE, + '#title' => t('Use the current user to filter for touched nodes.'), + '#disabled' => TRUE, + '#description' => t('Pass the current user\'s ID to the view to filter for touched nodes.'), + ), + ); + + $elements['uidtouch']['uidtouch_node'] = array( + 'name' => 'uidtouch_node', + 'label' => t('User: Based on current node\'s author'), + 'handler' => 'user_views_argument_api_handler_node', + 'element' => array( + '#type' => 'checkbox', + '#default_value' => TRUE, + '#title' => t('Use the current node\'s author to filter for touched nodes.'), + '#disabled' => TRUE, + '#description' => t('Pass the current node\'s author to the view to filter for touched nodes.'), + ), + ); - //Username - $elements['username'] = array(); - $elements['username']['username_textfield'] = array( - 'name' => 'username_textfield', - 'label' => t('User: Enter a pre-defined username'), - 'handler' => 'views_argument_api_handler_default_form_value', - 'element' => array( - '#type' => 'textfield', - '#title' => t('Username'), - '#description' => t('Enter a username from which to display nodes.'), - ), - ); - - return $elements; + //Username + $elements['username'] = array(); + $elements['username']['username_textfield'] = array( + 'name' => 'username_textfield', + 'label' => t('User: Enter a pre-defined username'), + 'handler' => 'views_argument_api_handler_default_form_value', + 'element' => array( + '#type' => 'textfield', + '#title' => t('Username'), + '#description' => t('Enter a username from which to display nodes.'), + ), + ); + + return $elements; } /********************************************************************* @@ -132,29 +132,29 @@ * Pass the current user's uid to the view. */ function user_views_argument_api_handler_current($value) { - global $user; - return $user->uid; + global $user; + return $user->uid; } /** * Pass the current node's author's uid to the view. */ function user_views_argument_api_handler_node($value) { - $nid = explode('node/', substr(urldecode(drupal_get_destination()), 12)); - if(count($nid) < 2) { - return NULL; - } - - $nid = $nid[1]; - $nid = explode('/', $nid); - $nid = array_shift($nid); - - if(is_numeric($nid)) { - $node = node_load($nid); - $uid = $node->uid; - } else { - $uid = NULL; - } - - return $uid; + $nid = explode('node/', substr(urldecode(drupal_get_destination()), 12)); + if(count($nid) < 2) { + return NULL; + } + + $nid = $nid[1]; + $nid = explode('/', $nid); + $nid = array_shift($nid); + + if(is_numeric($nid)) { + $node = node_load($nid); + $uid = $node->uid; + } else { + $uid = NULL; + } + + return $uid; } \ No newline at end of file