Changeset 5913

Show
Ignore:
Timestamp:
07/05/08 09:22:54 (5 months ago)
Author:
p_lindheimer
Message:

#2881 Add links to tickets and changeset references in changelog in Module Admin - from groogs drupal filter code

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/htdocs/admin/page.modules.php

    r5723 r5913  
    284284} 
    285285 
     286/* Replace '#nnn', 'bug nnn', 'ticket nnn' type ticket numbers in changelog with a link, taken from Greg's drupal filter 
     287*/ 
     288function trac_replace_ticket($match) { 
     289  $baseurl = 'http://freepbx.org/trac/ticket/'; 
     290  return '<a target="tractickets" href="'.$baseurl.$match[1].'" title="ticket '.$match[0].'">'.$match[0].'</a>'; 
     291} 
     292 
     293/* Replace 'rnnn' changeset references to a link, taken from Greg's drupal filter 
     294*/ 
     295function trac_replace_changeset($match) { 
     296  $baseurl = 'http://freepbx.org/trac/changeset/'; 
     297  return '<a target="tractickets" href="'.$baseurl.$match[1].'" title="changeset '.$match[0].'">'.$match[0].'</a>'; 
     298}                                                                                                                                               
     299 
    286300//-------------------------------------------------------------------------------------------------------- 
    287301switch ($extdisplay) {  // process, confirm, or nothing 
     
    789803                                echo "\t\t\t\t<div class=\"tabbertab\" title=\""._("Changelog")."\">\n"; 
    790804                                echo "<h5>".sprintf(_("Change Log for version %s"), $modules[$name]['version'])."</h5>"; 
     805 
    791806                                // convert "1.x.x:" and "*1.x.x*" into bold, and do nl2br 
     807                                // TODO: need to fix this to convert 1.x.xbetax.x, 1.x.xalphax.x, 1.x.xrcx.x, 1.x.xRCx.x formats as well 
     808                                // 
    792809                                $changelog = nl2br($modules[$name]['changelog']); 
    793810                                $changelog = preg_replace('/(\d+(\.\d+)+):/', '<strong>$0</strong>', $changelog); 
    794811                                $changelog = preg_replace('/\*(\d+(\.\d+)+)\*/', '<strong>$1:</strong>', $changelog); 
     812 
     813                                // convert '#xxx', 'ticket xxx', 'bug xxx' to ticket links and rxxx to changeset links in trac 
     814                                // 
     815                                $changelog = preg_replace_callback('/(?<!\w)(?:#|bug |ticket )([^&]\d{3,4})(?!\w)/i', 'trac_replace_ticket', $changelog); 
     816                                $changelog = preg_replace_callback('/(?<!\w)r(\d+)(?!\w)/', 'trac_replace_changeset', $changelog); 
     817                                $changelog = preg_replace_callback('/(?<!\w)\[(\d+)\](?!\w)/', 'trac_replace_changeset', $changelog); 
     818 
    795819                                echo $changelog; 
    796820                                echo "\t\t\t\t</div>\n"; 
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads