View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0008281 | mantisbt | filters | public | 2007-08-20 15:04 | 2016-08-23 04:42 |
Reporter | DGtlRift | Assigned To | dregad | ||
Priority | normal | Severity | feature | Reproducibility | have not tried |
Status | closed | Resolution | no change required | ||
Product Version | 1.1.0a4 | ||||
Summary | 0008281: Add Mantis to search engines | ||||
Description | For installations of Mantis there should be a method to include mantis in Firefox's search engine list. | ||||
Additional Information | I'm not sure if it applies to IE, but I'm sure this would be a nice feature there as well. Since my installation is https based, I was unable to test this patch. NOTE: This will NOT work on https based installations according to the mozilla website. This was based on the code from victor: New Code/Files: mantis_search_src.php core/html_api.php core/utility_api.php images/mantis_search_src.ico javascript/common.js.php lang/strings_english.txt | ||||
Tags | patch | ||||
Attached Files | search_engine.2007-08-21.patch (7,231 bytes)
Index: config_defaults_inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/config_defaults_inc.php,v retrieving revision 1.355 diff -u -r1.355 config_defaults_inc.php --- config_defaults_inc.php 15 Aug 2007 02:57:07 -0000 1.355 +++ config_defaults_inc.php 21 Aug 2007 13:20:09 -0000 @@ -1883,4 +1883,12 @@ # The twitter account password. $g_twitter_password = ''; + + ############################# + # Browser Search Engine + ############################# + # Allow users to add a search engine for mantis to the search engine list + $g_search_engine_add_enabled = ON; + $g_search_engine_name = 'Mantis Search Engine'; + ?> Index: mantis_search_src.php =================================================================== RCS file: mantis_search_src.php diff -N mantis_search_src.php --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ mantis_search_src.php 21 Aug 2007 13:20:09 -0000 @@ -0,0 +1,32 @@ +<?php + # Mantis - a php based bugtracking system + # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org + # Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + # This program is distributed under the terms and conditions of the GPL + # See the README and LICENSE files for details + + # -------------------------------------------------------- + # $Id: mantis_search_src.php,v 1.3 2005/02/12 20:01:08 jlatour Exp $ + # -------------------------------------------------------- +?> +<?php + require_once( 'core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path.'utility_api.php' ); +?> + +# Mozilla/Mantis plug-in by Victor Boctor (http://www.futureware.biz) +# Modded for inlining in Mantis +<search + name=<?php echo '"Mantis ' . config_get( 'search_engine_name' ) . '"' . "\n"; ?> + description=<?php echo '"' . config_get( 'search_engine_name' ) . '"' . "\n"; ?> + method="GET" + action=<?php echo '"' . config_get( 'path' ) . 'view.php"' . "\n"; ?> + queryEncoding="utf-8" + queryCharset="utf-8"> + + <input name="id" user> + +</search> Index: core/html_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/html_api.php,v retrieving revision 1.211 diff -u -r1.211 html_api.php --- core/html_api.php 31 Jul 2007 07:51:16 -0000 1.211 +++ core/html_api.php 21 Aug 2007 13:20:11 -0000 @@ -260,6 +260,8 @@ if ( ON == config_get( 'use_javascript' ) ) { echo "\t" . '<script type="text/javascript" language="JavaScript" src="javascript/common.js">'; echo '</script>' . "\n"; + echo "\t" . '<script type="text/javascript" language="JavaScript" src="javascript/common.js.php">'; + echo '</script>' . "\n"; echo "\t" . '<script type="text/JavaScript" src="javascript/ajax.js">'; echo '</script>' . "\n"; @@ -601,6 +603,13 @@ PRINT '<input type="submit" class="button-small" value="' . lang_get( 'jump' ) . '" /> '; PRINT '</form>'; + if ( ( config_get('search_engine_add_enabled') ) && + ( ON == config_get( 'use_javascript' ) ) && + !is_server_protocol( 'https' ) ) { + PRINT '<a href="javascript:addEngine()">'; + PRINT '<img src="images/favicon.ico" alt="' . lang_get('search_engine_add') . '" style="border-style: none; margin: 5px; vertical-align: middle;" />'; + PRINT '</a>'; + } PRINT '</td>'; PRINT '</tr>'; PRINT '</table>'; Index: core/utility_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/utility_api.php,v retrieving revision 1.22 diff -u -r1.22 utility_api.php --- core/utility_api.php 21 Jul 2007 22:54:29 -0000 1.22 +++ core/utility_api.php 21 Aug 2007 13:20:11 -0000 @@ -216,5 +216,34 @@ function is_page_name( $p_string ) { return isset( $_SERVER['PHP_SELF'] ) && ( 0 < strpos( $_SERVER['PHP_SELF'], $p_string ) ); } - + + # -------------------- + # Return the domain of this webserver + # Taken from config_defaults_inc + function get_server_domain() { + $t_host = 'www.example.com'; + if ( isset( $_SERVER['HTTP_X_FORWARDED_HOST'] ) ) { // Support ProxyPass + $t_host = $_SERVER['HTTP_X_FORWARDED_HOST']; + } else if ( isset( $_SERVER['HTTP_HOST'] ) ) { + $t_host = $_SERVER['HTTP_HOST']; + } else if ( isset( $_SERVER['SERVER_NAME'] ) ) { + $t_host = $_SERVER['SERVER_NAME'] . $t_port; + } else if ( isset( $_SERVER['SERVER_ADDR'] ) ) { + $t_host = $_SERVER['SERVER_ADDR'] . $t_port; + } + return( $t_host ); + } + + # -------------------- + # Return the boolean that this session is using the specified protocol + # Taken from config_defaults_inc + function is_server_protocol( $p_protocol ) { + $t_protocol = 'http'; + if ( ( isset( $_SERVER['HTTPS'] ) ) && + ( 'off' != strtolower( $_SERVER['HTTPS'] ) ) ) { + $t_protocol = 'https'; + } + return( $t_protocol == $p_protocol ); + } + ?> Index: images/mantis_search_src.ico =================================================================== RCS file: images/mantis_search_src.ico diff -N images/mantis_search_src.ico Binary files /dev/null and mantis_search_src.ico differ Index: javascript/common.js.php =================================================================== RCS file: javascript/common.js.php diff -N javascript/common.js.php --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ javascript/common.js.php 21 Aug 2007 13:20:12 -0000 @@ -0,0 +1,35 @@ +/* + * Mantis - a php based bugtracking system + * Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org + * Copyright (C) 2002 - 2004 Mantis Team - mantisbt-dev@lists.sourceforge.net + * This program is distributed under the terms and conditions of the GPL + * See the README and LICENSE files for details + * + * ---------------------------------------------------------- + * $Id: common.js.php,v 1.9 2007/08/14 01:46:35 jhanley Exp $ + * ---------------------------------------------------------- + */ + +<?php + require_once( '../core.php' ); + + $t_core_path = config_get( 'core_path' ); + + require_once( $t_core_path.'utility_api.php' ); +?> + +function addEngine() +{ + if ((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function")) + { + window.sidebar.addSearchEngine( + <?php echo '"' . config_get( 'path' ) . '../mantis_search_src.php"'; ?>, /* engine URL */ + <?php echo '"' . config_get( 'path' ) . '../images/mantis_search_src.gif"'; ?>, /* icon URL */ + <?php echo '"' . get_server_domain() . '"'; ?>, /* engine name */ + "Web" ); /* category name */ + } + else + { + alert("Mozilla M15 or later is required to add a search engine."); + } +} Index: lang/strings_english.txt =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/lang/strings_english.txt,v retrieving revision 1.312 diff -u -r1.312 strings_english.txt --- lang/strings_english.txt 15 Aug 2007 16:25:29 -0000 1.312 +++ lang/strings_english.txt 21 Aug 2007 13:20:13 -0000 @@ -662,6 +662,7 @@ $s_older_news_link = 'Older News'; $s_archives = 'Archives'; $s_rss = 'RSS'; +$s_search_engine_add = 'Add Mantis to Search Engines'; # manage_create_new_user.php $s_created_user_part1 = 'Created user'; | ||||
Looks good. Following are my comments:
|
|
RE: Strange String
RE: order check
RE: Separate search page
|
|
If all the new patch look good and someone can peer review/test I'll check them in. |
|
Unassigned after having been assigned for almost 2 years without progress. |
|
I believe this is fully covered by the implemented opensearch functionality provided by browser_search_plugin.php page. |
|