Index: modules/views_user.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views/modules/views_user.inc,v retrieving revision 1.14.2.7 diff -u -p -r1.14.2.7 views_user.inc --- modules/views_user.inc 3 Mar 2007 22:31:27 -0000 1.14.2.7 +++ modules/views_user.inc 11 May 2007 20:38:59 -0000 @@ -34,12 +34,73 @@ function user_views_tables() { 'sortable' => false, 'help' => t('Display the user picture of the author.'), ), + 'mail' => array( + 'name' => t('User: Author Email'), + 'handler' => array ( + 'views_handler_field_email' => t('As mailto: link'), + 'views_handler_field_value' => t('As plain text'), + ), + 'sortable' => true, + 'help' => t('Display the email address of the user.'), + ), + 'status' => array( + 'name' => t('User: Author Status'), + 'handler' => 'views_handler_field_map', + 'extra' => array (0 => t('blocked'), 1 => t('active')), + 'sortable' => true, + 'help' => t('Display whether the author is active or blocked.'), + ), + 'created' => array( + 'name' => t('User: Author Account Created Time'), + 'sortable' => true, + 'handler' => views_handler_field_dates(), + 'option' => 'string', + 'help' => t('Display the registration time of the author.'), + ), + 'access' => array( + 'name' => t('User: Author Last Access Time'), + 'sortable' => true, + 'handler' => views_handler_field_dates(), + 'option' => 'string', + 'help' => t('Displays the last time the author visited the site.'), + ), + 'login' => array( + 'name' => t('User: Author Login Time'), + 'sortable' => true, + 'handler' => views_handler_field_dates(), + 'option' => 'string', + 'help' => t('Displays the last time the author logged into the site.'), + ), ), 'sorts' => array( 'name' => array( 'name' => t('Node: Author Name'), 'help' => t('This allows you to sort alphabetically by author.'), - ) + ), + 'uid' => array( + 'name' => t('User: Author\'s User ID'), + 'help' => t('Sort by user id.'), + ), + 'mail' => array( + 'name' => t('User: Author Email'), + 'help' => t('Sort alphabetically by email.'), + ), + 'status' => array( + 'name' => t('User: Author Status'), + 'help' => t('Sort by user status (active/blocked).'), + ), + 'created' => array( + 'name' => t('User: Author Account Created Time'), + 'help' => t('Sort by the registration time of a user.'), + ), + 'access' => array( + 'name' => t('User: Author Last Access Time'), + 'help' => t('Sort by the last access time of a user.'), + ), + 'login' => array( + 'name' => t('User: Author Last Login Time'), + 'help' => t('Sort by the last login time of a user.'), + ), ), 'filters' => array( 'uid' => array( @@ -49,6 +110,47 @@ function user_views_tables() { 'value-type' => 'array', 'help' => t('This allows you to filter by a particular user. You might not find this useful if you have a lot of users.'), ), + 'mail' => array( + 'name' => t('User: Email'), + 'operator' => 'views_handler_operator_like', + 'handler' => 'views_handler_filter_like', + 'help' => t('Filter by author email address.'), + ), + 'status' => array( + 'name' => t('User: Active'), + 'operator' => 'views_handler_operator_eqneq', + 'value' => array( + '#type' => 'select', + '#options' => array(0 => t('blocked'), 1 => t('active')), + '#multiple' => 'true', + ), + 'value-type' => 'array', + 'help' => t('Filter by author status (active/blocked).'), + ), + 'created' => array( + 'name' => t('User: Created Time'), + 'operator' => 'views_handler_operator_gtlt', + 'value' => views_handler_filter_date_value_form(), + 'handler' => 'views_handler_filter_timestamp', + 'option' => 'string', + 'help' => t('This filter allows nodes to be filtered by their author\'s account creation date. Enter dates in the format: CCYY-MM-DD HH:MM:SS. Enter \'now\' to use the current time. You may enter a delta (in seconds) to the option that will be added to the time; this is most useful when combined with now. If you have the jscalendar module from jstools installed, you can use a popup date picker here.'), + ), + 'access' => array( + 'name' => t('User: Last Access Time'), + 'operator' => 'views_handler_operator_gtlt', + 'value' => views_handler_filter_date_value_form(), + 'handler' => 'views_handler_filter_timestamp', + 'option' => 'string', + 'help' => t('This filter allows nodes to be filtered by their author\'s last access time. Enter dates in the format: CCYY-MM-DD HH:MM:SS. Enter \'now\' to use the current time. You may enter a delta (in seconds) to the option that will be added to the time; this is most useful when combined with now. If you have the jscalendar module from jstools installed, you can use a popup date picker here.'), + ), + 'login' => array( + 'name' => t('User: Last Login Time'), + 'operator' => 'views_handler_operator_gtlt', + 'value' => views_handler_filter_date_value_form(), + 'handler' => 'views_handler_filter_timestamp', + 'option' => 'string', + 'help' => t('This filter allows nodes to be filtered by their author\'s last login time. Enter dates in the format: CCYY-MM-DD HH:MM:SS. Enter \'now\' to use the current time. You may enter a delta (in seconds) to the option that will be added to the time; this is most useful when combined with now. If you have the jscalendar module from jstools installed, you can use a popup date picker here.'), + ), ) ); @@ -239,6 +341,35 @@ function views_handler_field_userpic($fi } } +/* + * Format as a field as a email address with a mailto: link + */ +function views_handler_field_email($fieldinfo, $fielddata, $value, $data) { + return l($value, 'mailto:'. $value); +} + +/* + * Format any field as a check_plain($value). + */ +function views_handler_field_value($fieldinfo, $fielddata, $value, $data) { + return check_plain($value); +} + +/** + * Format a field based on a map (e.g. an array of name => value pairs) for any field + * Pass in the map in the 'extra' key of your field definition. E.g. + * 'status' => array( + * 'name' => t('User: Author Status'), + * 'handler' => 'views_handler_field_map', + * 'extra' => array (0 => t('blocked'), 1 => t('active')), + * 'sortable' => true, + * 'help' => t('Display whether the author is active or blocked.'), + * ), + */ +function views_handler_field_map($fieldinfo, $fielddata, $value, $data) { + return $fieldinfo['extra'][$value]; // QUESTION: should value be check_plain()'d? +} + function views_handler_arg_uid($op, &$query, $argtype, $arg = '') { switch($op) { case 'summary': Index: modules/views_profile.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views/modules/views_profile.inc,v retrieving revision 1.3.2.4 diff -u -p -r1.3.2.4 views_profile.inc --- modules/views_profile.inc 5 May 2007 01:41:50 -0000 1.3.2.4 +++ modules/views_profile.inc 11 May 2007 20:38:59 -0000 @@ -212,13 +212,6 @@ function profile_views_add_filter(&$tabl /* FIELD HANDLER METHODS */ -/* - * Format as a field as a email address. - */ -function views_handler_field_email($fieldinfo, $fielddata, $value, $data) { - return l($value, 'mailto:' . $value); -} - /** * Display a profile field of type 'vocabulary' */