diff --git a/Source/Source.php b/Source/Source.php index c02e6aa..320797b 100644 --- a/Source/Source.php +++ b/Source/Source.php @@ -36,6 +36,8 @@ function config() { return array( + 'show_repo_link' => ON, + 'show_search_link' => OFF, 'manage_threshold' => ADMINISTRATOR, 'view_threshold' => VIEWER, @@ -78,6 +80,7 @@ return array( 'EVENT_PLUGIN_INIT' => 'post_init', 'EVENT_LAYOUT_RESOURCES' => 'css', + 'EVENT_MENU_MAIN' => 'menu_main', ); } @@ -98,6 +101,24 @@ return ''; } + function menu_main() { + $t_links = array(); + + if ( plugin_config_get( 'show_repo_link' ) ) { + $t_page = plugin_page( 'index', false, 'Source' ); + $t_lang = plugin_lang_get( 'repositories', 'Source' ); + $t_links[] = "$t_lang"; + } + + if ( plugin_config_get( 'show_search_link' ) ) { + $t_page = plugin_page( 'search_page', false, 'Source' ); + $t_lang = plugin_lang_get( 'search', 'Source' ); + $t_links[] = "$t_lang"; + } + + return $t_links; + } + function schema() { return array( array( 'CreateTableSQL', array( plugin_table( 'repository' ), " diff --git a/Source/SourceIntegration.php b/Source/SourceIntegration.php index 088ec39..e0ea2d2 100644 --- a/Source/SourceIntegration.php +++ b/Source/SourceIntegration.php @@ -19,19 +19,11 @@ function hooks() { return array( - 'EVENT_MENU_MAIN' => 'menu_main', 'EVENT_VIEW_BUG_EXTRA' => 'display_bug', 'EVENT_DISPLAY_FORMATTED' => 'display_formatted', - 'EVENT_SOURCE_COMMIT' => 'commit', ); } - function menu_main() { - $t_page = plugin_page( 'index', false, 'Source' ); - $t_repos = plugin_lang_get( 'repositories', 'Source' ); - return "$t_repos"; - } - function display_bug( $p_event, $p_bug_id ) { require_once( 'Source.ViewAPI.php' ); diff --git a/Source/lang/strings_english.txt b/Source/lang/strings_english.txt index d23e1a8..6c33b5a 100644 --- a/Source/lang/strings_english.txt +++ b/Source/lang/strings_english.txt @@ -72,6 +72,9 @@ $s_plugin_Source_buglink_regex_1 = 'Bug Link PCRE Pass 1'; $s_plugin_Source_buglink_regex_2 = 'Bug Link PCRE Pass 2'; $s_plugin_Source_reset = 'Reset to default'; +$s_plugin_Source_menu_links = 'Main Menu Links'; +$s_plugin_Source_show_repo_link = 'Repositories'; +$s_plugin_Source_show_search_link = 'Search'; $s_plugin_Source_changeset_attached = 'Changeset attached'; $s_plugin_Source_changeset_removed = 'Changeset removed'; diff --git a/Source/pages/manage_config.php b/Source/pages/manage_config.php index 08907f8..7f1b5b8 100644 --- a/Source/pages/manage_config.php +++ b/Source/pages/manage_config.php @@ -18,6 +18,9 @@ $f_view_threshold = gpc_get_int( 'view_threshold' ); $f_manage_threshold = gpc_get_int( 'manage_threshold' ); +$f_show_repo_link = gpc_get_bool( 'show_repo_link', OFF ); +$f_show_search_link = gpc_get_bool( 'show_search_link', OFF ); + $f_buglink_regex_1 = gpc_get_string( 'buglink_regex_1' ); $f_buglink_reset_1 = gpc_get_string( 'buglink_reset_1', OFF ); $f_buglink_regex_2 = gpc_get_string( 'buglink_regex_2' ); @@ -56,6 +59,14 @@ plugin_config_set( 'manage_threshold', $f_manage_threshold ); } +if ( $f_show_repo_link != plugin_config_get( 'show_repo_link' ) ) { + plugin_config_set( 'show_repo_link', $f_show_repo_link ); +} + +if ( $f_show_search_link != plugin_config_get( 'show_search_link' ) ) { + plugin_config_set( 'show_search_link', $f_show_search_link ); +} + if ( ! $f_buglink_reset_1 ) { if ( $f_buglink_regex_1 != plugin_config_get( 'buglink_regex_1' ) ) { plugin_config_set( 'buglink_regex_1', $f_buglink_regex_1 ); diff --git a/Source/pages/manage_config_page.php b/Source/pages/manage_config_page.php index b625e43..3adf944 100644 --- a/Source/pages/manage_config_page.php +++ b/Source/pages/manage_config_page.php @@ -29,7 +29,7 @@
- + @@ -46,6 +46,16 @@ +> + + + + >
+ + +