View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005613 | mantisbt | feature | public | 2005-05-16 20:11 | 2017-02-09 10:45 |
Reporter | ryandesign | Assigned To | |||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | acknowledged | Resolution | open | ||
Product Version | 1.0.0a2 | ||||
Summary | 0005613: Support a really simple "view" URL | ||||
Description | I'd like Mantis to support an optional really simple "view" URL. I thought somebody would have requested this already, and I thought bug 0004137 ("Support a simple 'view' URL") would be it, but the definition of "simple" there is different than mine. I want to be able to have a Mantis installation for example at http://www.example.com/mantis/ and to be able to access bug 123 by visiting http://www.example.com/mantis/123 . I've already written a patch and would be happy to provide it. | ||||
Tags | patch | ||||
Attached Files | 5613-really-simple-url.patch (2,332 bytes)
Index: config_defaults_inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/config_defaults_inc.php,v retrieving revision 1.281 diff -u -r1.281 config_defaults_inc.php --- config_defaults_inc.php 7 Aug 2005 13:42:03 -0000 1.281 +++ config_defaults_inc.php 7 Aug 2005 17:38:16 -0000 @@ -1095,6 +1095,11 @@ # eg. for bugnote: a link would be bugnote:98 $g_bugnote_link_tag = '~'; + # --- Bug view URL --------------- + # if you want a shorter / different bug view URL you can change this + # and then write some appropriate mod_rewrite rules. + $g_bug_view_url = 'view.php?id=%d'; + # --- Bug Count Linking ---------- # this is the prefix to use when creating links to bug views from bug counts (eg. on the main # page and the summary page). Index: core/string_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/string_api.php,v retrieving revision 1.75 diff -u -r1.75 string_api.php --- core/string_api.php 7 Aug 2005 15:29:07 -0000 1.75 +++ core/string_api.php 7 Aug 2005 17:38:16 -0000 @@ -494,14 +494,14 @@ # return the name and GET parameters of a bug VIEW page for the given bug # account for the user preference and site override function string_get_bug_view_url( $p_bug_id, $p_user_id = null ) { - return 'view.php?id=' . $p_bug_id; + return sprintf( config_get( 'bug_view_url' ), $p_bug_id ); } # -------------------- # return the name and GET parameters of a bug VIEW page for the given bug # account for the user preference and site override function string_get_bugnote_view_url( $p_bug_id, $p_bugnote_id, $p_user_id = null ) { - return 'view.php?id=' . $p_bug_id . '#'. $p_bugnote_id; + return string_get_bug_view_url( $p_bug_id, $p_user_id ) . '#'. $p_bugnote_id; } # -------------------- @@ -510,7 +510,7 @@ # The returned url includes the fully qualified domain, hence it is suitable to be included # in emails. function string_get_bugnote_view_url_with_fqdn( $p_bug_id, $p_bugnote_id, $p_user_id = null ) { - return config_get( 'path' ) . string_get_bug_view_url( $p_bug_id, $p_user_id ).'#'.$p_bugnote_id; + return config_get( 'path' ) . string_get_bugnote_view_url( $p_bug_id, $p_bugnote_id, $p_user_id ); } # -------------------- | ||||
Please attach the patch to this issue and we will look into it. I would see this as a shortcut to the standward way of viewing issues (i.e. through view.php). Depending on how portable is the patch, we may decide to use it as more than just a shortcut. |
|
My my, how time flies. Here's the patch finally. Very simple. Merely exposes a config option that an administrator can modify if she wants a different bug-view URL. Then something like mod_rewrite is used to internally redirect that URL back to the view.php file. I should probably still write a patch for the documentation explaining the feature and giving an example. Like this: Add to config_inc.php:$g_bug_view_url = '%d'; Add to httpd.conf or .htaccess:RewriteEngine On We could potentially already include an .htaccess file with these directives (though it may not work until the administrator manually adds a RewriteBase directive specific to their installation). There are also still a few places hard-coded to use view.php (like in the RSS and relationship graph files); these will need to be changed to use the functions that exist for this purpose. |
|
Comments on whether the attached patch is acceptable to be committed are appreciated. |
|
The patch looks reasonable to me. |
|
This is not a universal solution. The way this is submitted will give a 'Apache httpd only' solution, notwithstanding that the patch looks OK and that it may be a nice feature. IMO it's a tricky feature, because it relies on URL rewriting. Also, as ryandesign mentions, it's not yet a complete patch. |
|
Ryan, Could you reattach the old patch if you still have it? Paul |
|
Unassigned after having been assigned for multiple years without progress. |
|
The patch should also include the docbook updates which would explain the new configuration option and the steps to do the necessary changes to .htaccess / config to achieve the simple/SEO friednly URLs. |
|
Sorry, what is the current status of this one? Is it planned for 2.0 to provide more convenient URLs? Thanks! |
|
@elensule, please look at fields "Status", "Assigned To" and "Target Version" of the issue. If you are interested in getting this feature in standard MantisBT: Submitting a patch is always a good idea, as it increases the chances of improvement eventually making it into MantisBT core. All contributions are welcome and greatly appreciated. Patch submissions can be made in several ways. In the order of preference:
Kindly avoid to upload entire modified PHP files. Please make sure that your submissions adhere to our Coding Guidelines [2], if they don't your patch might be rejected. [1] https://github.com/mantisbt/mantisbt |
|
Does the patch still work (even if it's not a universal fix and doesn't address docbook) ? |
|