diff --git a/Source/Source.ViewAPI.php b/Source/Source.ViewAPI.php index 89834de..12a9084 100644 --- a/Source/Source.ViewAPI.php +++ b/Source/Source.ViewAPI.php @@ -33,6 +33,9 @@ foreach( $p_changesets as $t_changeset ) { $t_repo = $t_repos[ $t_changeset->repo_id ]; $t_changeset->load_files(); + + $t_author = Source_View_Author( $t_changeset, false ); + $t_committer = Source_View_Committer( $t_changeset, false ); ?> @@ -42,7 +45,9 @@ event_signal( 'EVENT_SOURCE_SHOW_CHANGESET', array( $t_repo, $t_changeset ) ) ) ?>
timestamp ) ?> -
author ) ?> +
+
+ committer ) { ?>
committer ) ?>
ported ? string_display_line( $t_changeset->ported ) : @@ -79,3 +84,57 @@ } } +/** + * Display the author information for a changeset. + * @param object Changeset object + * @param boolean Echo information + */ +function Source_View_Author( $p_changeset, $p_echo=true ) { + $t_author_name = !is_blank( $p_changeset->author ) ? string_display_line( $p_changeset->author ) : false; + $t_author_email = !is_blank( $p_changeset->author_email ) ? string_display_line( $p_changeset->author_email ) : false; + $t_author_username = $p_changeset->user_id > 0 ? string_display_line( user_get_name( $p_changeset->user_id ) ) : false; + + if ( $t_author_username ) { + $t_output = $t_author_username; + + } else if ( $t_author_name ) { + $t_output = $t_author_name; + + } else { + $t_output = $t_author_email; + } + + if ( $p_echo ) { + echo $t_output; + } else { + return $t_output; + } +} + +/** + * Display the committer information for a changeset. + * @param object Changeset object + * @param boolean Echo information + */ +function Source_View_Committer( $p_changeset, $p_echo=true ) { + $t_comitter_name = !is_blank( $p_changeset->comitter ) ? string_display_line( $p_changeset->comitter ) : false; + $t_comitter_email = !is_blank( $p_changeset->comitter_email ) ? string_display_line( $p_changeset->comitter_email ) : false; + $t_comitter_username = $p_changeset->user_id > 0 ? string_display_line( user_get_name( $p_changeset->user_id ) ) : false; + + if ( $t_comitter_username ) { + $t_output = $t_comitter_username; + + } else if ( $t_comitter_name ) { + $t_output = $t_comitter_name; + + } else { + $t_output = $t_comitter_email; + } + + if ( $p_echo ) { + echo $t_output; + } else { + return $t_output; + } +} + diff --git a/Source/lang/strings_english.txt b/Source/lang/strings_english.txt index 7989a13..b6d42b8 100644 --- a/Source/lang/strings_english.txt +++ b/Source/lang/strings_english.txt @@ -29,6 +29,7 @@ $s_plugin_Source_branch = 'Branch'; $s_plugin_Source_action = 'Action'; $s_plugin_Source_author = 'Author'; +$s_plugin_Source_committer = 'Committer'; $s_plugin_Source_username = 'Username'; $s_plugin_Source_timestamp = 'Timestamp'; $s_plugin_Source_parent = 'Parent'; diff --git a/Source/pages/view.php b/Source/pages/view.php index c0fb98c..5452e2c 100644 --- a/Source/pages/view.php +++ b/Source/pages/view.php @@ -14,6 +14,8 @@ access_ensure_global_level( plugin_config_get( 'view_threshold' ) ); $t_can_update = access_has_project_level( plugin_config_get( 'update_threshold' ) ); +require_once( config_get( 'plugin_path' ) . 'Source/Source.ViewAPI.php' ); + $f_changeset_id = gpc_get_int( 'id' ); $f_offset = gpc_get_int( 'offset', 0 ); @@ -50,7 +52,7 @@ $t_columns = ( $t_use_porting ? 1 : 0 ) + - 4; + 5; $t_update_form = $t_use_porting || false; @@ -80,6 +82,7 @@ + @@ -89,8 +92,8 @@ > -author ), - ( $t_changeset->author_email ? '
' . $t_changeset->author_email : '' ) ?> + + branch ) ?> timestamp ) ?> id, event_signal( 'EVENT_SOURCE_SHOW_CHANGESET', array( $t_repo, $t_changeset_parent ) ) ); } ?> @@ -121,8 +124,8 @@ - - + +