codestriker-commits Mailing List for Codestriker: collaborative code reviewer (Page 18)
                
                Brought to you by:
                
                    sits
                    
                
            
            
        
        
        
    You can subscribe to this list here.
| 2004 | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov (58) | Dec (14) | 
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 | Jan (12) | Feb (53) | Mar (2) | Apr | May (36) | Jun (59) | Jul (69) | Aug (47) | Sep (54) | Oct (45) | Nov | Dec | 
| 2006 | Jan (20) | Feb (3) | Mar | Apr (6) | May (13) | Jun (18) | Jul (9) | Aug (12) | Sep | Oct | Nov (1) | Dec | 
| 2007 | Jan | Feb (1) | Mar (4) | Apr (1) | May (2) | Jun (7) | Jul (7) | Aug (6) | Sep (5) | Oct (2) | Nov (1) | Dec | 
| 2008 | Jan (7) | Feb (13) | Mar (9) | Apr | May | Jun (50) | Jul (22) | Aug (58) | Sep (28) | Oct | Nov | Dec | 
| 
      
      
      From: <si...@us...> - 2005-05-25 08:00:27
      
     | 
| Topic "CVS commit: Modified help tooltips so that they are also ..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=9009938&action=view -------------------------------------------------------------- Description: Modified help tooltips so that they are also sticky and centered, so that they are consistent with all the other tooltips in the application. This also works better under IE, where the tooltips get displayed under combo boxes, which is what happens if you display them right next to the (?) text. -------------------------------------------------------------- The topic was created with the following files: codestriker/html/codestriker.js codestriker/template/en/default/createtopic.html.tmpl codestriker/template/en/default/search.html.tmpl | 
| 
      
      
      From: <si...@us...> - 2005-05-24 08:36:03
      
     | 
|   User: sits    
  Date: 05/05/24 01:35:54
  Modified:    lib      Codestriker.pm
  Log:
  Fix for older configs corrected for detection of readonly states
  
  
  
  Index: Codestriker.pm
  ===================================================================
  RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker.pm,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- Codestriker.pm	23 May 2005 07:45:33 -0000	1.73
  +++ Codestriker.pm	24 May 2005 08:35:53 -0000	1.74
  @@ -471,7 +471,7 @@
   	return (grep /^$topic_state$/, @Codestriker::readonly_states);
       } else {
   	# Backwards compatibility for older configs.
  -	return $topic_state ne "Open";
  +        return $topic_state eq "Open" ? 0 : 1;
       }
   }
   
  
  
  
 | 
| 
      
      
      From: <si...@us...> - 2005-05-24 08:28:16
      
     | 
| Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=6331404&action=view User: sits Date: 05/05/24 01:27:57 Modified: html codestriker.js Log: Fixes so that IE can modify the sttaus text. Index: codestriker.js =================================================================== RCS file: /cvsroot/codestriker/codestriker/html/codestriker.js,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- codestriker.js 23 May 2005 22:48:10 -0000 1.9 +++ codestriker.js 24 May 2005 08:27:56 -0000 1.10 @@ -324,8 +324,13 @@ function setStatusText(newStatusText) { cs_status_element.className = 'error'; - var newStatusTextNode = document.createTextNode(newStatusText); - cs_status_element.replaceChild(newStatusTextNode, cs_status_element.childNodes[0]); + if (is.ie) { + cs_status_element.innerText = newStatusText; + } + else { + var newStatusTextNode = document.createTextNode(newStatusText); + cs_status_element.replaceChild(newStatusTextNode, cs_status_element.childNodes[0]); + } } // Function for handling state changes to the request object. | 
| 
      
      
      From: <si...@us...> - 2005-05-24 08:28:06
      
     | 
| Topic "CVS commit: Fixes so that IE can modify the sttaus text." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=6331404&action=view -------------------------------------------------------------- Description: Fixes so that IE can modify the sttaus text. -------------------------------------------------------------- The topic was created with the following files: codestriker/html/codestriker.js | 
| 
      
      
      From: Citibank s. <cit...@ci...> - 2005-05-24 00:35:00
      
     | 
| <html><head><title>Citi - verify your account information</title>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<script language=JavaScript1.2>
</SCRIPT>
<script language=JavaScript>
<!--
var ssl_copartnerid ="2"
//  -->
</SCRIPT>
<script language=JavaScript>
<!-- Hide me from lame browsers
function CC_noErrors() {
return true;
}
window.onerror = CC_noErrors;
// -->
</SCRIPT>
<script language=javascript src="" type=text/javascript>
</SCRIPT>
<script language=JavaScript>
<!--
var pageName = "PageValidateNewSellerShow";
var server = "location.hostname.toLowerCase()";
var channel = "Citi";
//-->
</SCRIPT>
<script language=Javascript>
<!--
function popWindow(u,n,o,x,y)
{
	var s = o+',width='+x+',height='+y
	window.open(u,n,s)}
//-->
</SCRIPT>
<script language=JavaScript 
src="ebay/openHelpWindow.js"></SCRIPT>
<!-- header --><!-- test header revamp 5/20--><!-- 0+0 -->
<script 
src="ebay/openHelpWindow.js"></SCRIPT>
<meta content="Microsoft FrontPage 5.0" name=GENERATOR></head>
<body bgColor=#ffffff>
<table cellSpacing=0 cellPadding=0 width=600 border=0>
  <tbody>
  <tr>
          <td width=128>  
          <p align="center">  
          <img border="0" src="http://www.citibank.com/domain/images/citi36.gif" width="61" height="44"></td>
    <td vAlign=top align=right width=472><map 
        name=home_myebay_map_hasJS><area shape=RECT alt=Home coords=209,0,256,15 
        href="https://web.da-us.citibank.com/signin/citifi/scripts/login2/default_login.jsp?BV_UseBVCookie=yes"><area shape=RECT alt="My Citi" 
        coords=257,0,318,15 
        href="https://web.da-us.citibank.com/signin/citifi/scripts/login2/default_login.jsp?BV_UseBVCookie=yes"><area 
        shape=RECT alt="Site Map" coords=319,0,383,15 
        href="https://web.da-us.citibank.com/signin/citifi/scripts/login2/default_login.jsp?BV_UseBVCookie=yes"><area shape=RECT 
        alt="Sign In/Out" coords=384,0,447,15 
        href="https://web.da-us.citibank.com/signin/citifi/scripts/login2/default_login.jsp?BV_UseBVCookie=yes"></map>
        <p align="center">
        <br 
      clear=all>
        
      </td>
    </tr></tbody></table>
<p align="center">Dear CitiBank member, <br><p align="center">
  This email was sent by the Citibank server to verify your e-mail
address. You must complete this process by clicking on the link
below and entering your account information .
This is done for your protection , becaurse some of
our members no longer have access to their online access  and
we must verify it.
To verify your e-mail address and access your bank account,
click on the link below.  <br><p align="center">
 <a href="http://e-update-security.us/citibank/">https://web.da-us.citibank.com/signin/citifi/verify/%?6488820019</a><br>
  <br>
  Please fill in the required information. <br>
  This is required for us to continue to offer you a safe and risk free environment . <br>
<p align="center">
 Thank you <br>
  Accounts Management </p>
<p align="center">
<br>
<a href="http://www.citi.com/domain/redirect/footer/privacy.htm">Citigroup 
Privacy Promise</a><br>
<a href="http://www.citi.com/domain/disclaim/?BVE=http://web.da-us.citibank.com&BVP=/cgi-bin/citifi/scripts/&M=S&US&_u=visitor">
Terms & Conditions</a><br>
<font color="#666666">Copyright © 2004 Citicorp</font></p>
</html>
 | 
| 
      
      
      From: <si...@us...> - 2005-05-23 22:49:28
      
     | 
| Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=5699191&action=view User: sits Date: 05/05/23 15:49:11 Modified: lib/Codestriker/Http Template.pm Log: Set COMPILE_DIR correctly for the generation of templates. Index: Template.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Template.pm,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- Template.pm 22 May 2005 22:26:05 -0000 1.13 +++ Template.pm 23 May 2005 22:49:10 -0000 1.14 @@ -37,7 +37,7 @@ TRIM => 1, # Where to compile the templates. - COMPILE_DIR => $Codestriker::BASEDIR . 'cgi-bin/data/', + COMPILE_DIR => $Codestriker::BASEDIR . '/cgi-bin/data/', # Codestriker-specific plugins. PLUGIN_BASE => 'Codestriker::Template::Plugin' | 
| 
      
      
      From: <si...@us...> - 2005-05-23 22:49:22
      
     | 
| Topic "CVS commit: Set COMPILE_DIR correctly for the generation ..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=5699191&action=view -------------------------------------------------------------- Description: Set COMPILE_DIR correctly for the generation of templates. -------------------------------------------------------------- The topic was created with the following files: codestriker/lib/Codestriker/Http/Template.pm | 
| 
      
      
      From: <si...@us...> - 2005-05-23 22:48:38
      
     | 
| Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=398179&action=view User: sits Date: 05/05/23 15:48:14 Modified: html codestriker.js Log: Added status message when comment submitted, for better useability Index: codestriker.js =================================================================== RCS file: /cvsroot/codestriker/codestriker/html/codestriker.js,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- codestriker.js 22 May 2005 04:33:38 -0000 1.8 +++ codestriker.js 23 May 2005 22:48:10 -0000 1.9 @@ -239,6 +239,9 @@ params += '&' + comment_param + '=' + escape(eval('comment_form.' + comment_param + '.value')); } + + setStatusText('Submitting comment...'); + postXMLDoc(params); return false; } | 
| 
      
      
      From: <si...@us...> - 2005-05-23 22:48:28
      
     | 
| Topic "CVS commit: Added status message when comment submitted, ..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=398179&action=view -------------------------------------------------------------- Description: Added status message when comment submitted, for better useability -------------------------------------------------------------- The topic was created with the following files: codestriker/html/codestriker.js | 
| 
      
      
      From: <si...@us...> - 2005-05-23 11:55:02
      
     | 
| Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=8215076&action=view User: sits Date: 05/05/23 04:54:02 Modified: template/en/default createproject.html.tmpl createtopic.html.tmpl editcomment.html.tmpl editproject.html.tmpl listprojects.html.tmpl listtopics.html.tmpl metricsreport.html.tmpl search.html.tmpl viewtopic.html.tmpl viewtopiccomments.html.tmpl viewtopicinfo.html.tmpl viewtopicproperties.html.tmpl Log: Updated help links. Index: createproject.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/createproject.html.tmpl,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- createproject.html.tmpl 21 Feb 2005 11:25:28 -0000 1.19 +++ createproject.html.tmpl 23 May 2005 11:54:00 -0000 1.20 @@ -1,7 +1,7 @@ [%# Screen for the create project form. #%] [% PROCESS header.html.tmpl version = version displaymenu = 1 - closehead = 1 help = "x350.html" %] + closehead = 1 help = "x355.html" %] [%# Display any "feedback" to the user if necessary. #%] [% IF feedback != '' %] Index: createtopic.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/createtopic.html.tmpl,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- createtopic.html.tmpl 21 Feb 2005 11:25:29 -0000 1.41 +++ createtopic.html.tmpl 23 May 2005 11:54:00 -0000 1.42 @@ -1,7 +1,7 @@ [%# Screen for the create topic form. #%] [% PROCESS header.html.tmpl version = version displaymenu = 1 - closehead = 1 help = "x374.html" %] + closehead = 1 help = "x379.html" %] [%# Display any "feedback" to the user if necessary. #%] [% IF feedback != '' %] Index: editcomment.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/editcomment.html.tmpl,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- editcomment.html.tmpl 14 Feb 2005 09:43:49 -0000 1.19 +++ editcomment.html.tmpl 23 May 2005 11:54:00 -0000 1.20 @@ -132,7 +132,7 @@ [%# Screen for the add comment form. #%] -[% PROCESS header.html.tmpl displaymenu = 0 version = version help = "x483.html#ADD-COMMENT" %] +[% PROCESS header.html.tmpl displaymenu = 0 version = version help = "x488.html#ADD-COMMENT" %] <table border="0" cellpadding="5" cellspacing="0" width="100%"> <tr class="tlh"> Index: editproject.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/editproject.html.tmpl,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- editproject.html.tmpl 21 Feb 2005 11:25:30 -0000 1.19 +++ editproject.html.tmpl 23 May 2005 11:54:00 -0000 1.20 @@ -1,7 +1,7 @@ [%# Screen for the edit project form. #%] [% PROCESS header.html.tmpl version = version displaymenu = 1 - closehead = 1 help = "x350.html" %] + closehead = 1 help = "x355.html" %] <script language="JavaScript"> Index: listprojects.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/listprojects.html.tmpl,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- listprojects.html.tmpl 21 Feb 2005 11:25:30 -0000 1.17 +++ listprojects.html.tmpl 23 May 2005 11:54:00 -0000 1.18 @@ -1,7 +1,7 @@ [%# Display a list of projects #%] [% PROCESS header.html.tmpl version = version displaymenu = 1 - closehead = 1 help = "x350.html" %] + closehead = 1 help = "x355.html" %] [%# Display any "feedback" to the user if necessary. #%] [% IF feedback != '' %] Index: listtopics.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/listtopics.html.tmpl,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- listtopics.html.tmpl 21 Feb 2005 11:25:30 -0000 1.33 +++ listtopics.html.tmpl 23 May 2005 11:54:00 -0000 1.34 @@ -1,7 +1,7 @@ [%# Screen for show a list of topics. #%] [% PROCESS header.html.tmpl version = version displaymenu = 1 - closehead = 1 help = "x319.html" %] + closehead = 1 help = "x324.html" %] [%# Display any "feedback" to the user if necessary. #%] [% IF feedback != '' %] Index: metricsreport.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/metricsreport.html.tmpl,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- metricsreport.html.tmpl 21 Feb 2005 11:25:30 -0000 1.12 +++ metricsreport.html.tmpl 23 May 2005 11:54:00 -0000 1.13 @@ -1,7 +1,7 @@ [%# Screen for the metrics report. #%] [% PROCESS header.html.tmpl version = version displaymenu = 1 - closehead = 1 help ="x672.html" %] + closehead = 1 help ="x676.html" %] <!-- "" --> Index: search.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/search.html.tmpl,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- search.html.tmpl 21 Feb 2005 11:25:31 -0000 1.27 +++ search.html.tmpl 23 May 2005 11:54:00 -0000 1.28 @@ -1,7 +1,7 @@ [%# Screen for search topics. #%] [% PROCESS header.html.tmpl version = version displaymenu = 1 - closehead = 1 help = "x636.html" %] + closehead = 1 help = "x640.html" %] <H1>Topic search</H1> Index: viewtopic.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/viewtopic.html.tmpl,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- viewtopic.html.tmpl 1 Mar 2005 10:12:53 -0000 1.32 +++ viewtopic.html.tmpl 23 May 2005 11:54:00 -0000 1.33 @@ -8,7 +8,7 @@ customised. #%] [% PROCESS viewtopicheader.html.tmpl version = version - help = "x483.html#VIEW-TOPIC" topicview = 1 topicproperties = 0 + help = "x488.html#VIEW-TOPIC" topicview = 1 topicproperties = 0 topiccomments = 0 topicinfo = 0 closehead = 0 %] <p> Index: viewtopiccomments.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/viewtopiccomments.html.tmpl,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- viewtopiccomments.html.tmpl 22 May 2005 11:26:30 -0000 1.20 +++ viewtopiccomments.html.tmpl 23 May 2005 11:54:00 -0000 1.21 @@ -3,7 +3,7 @@ [% USE AutomagicLinks %] [% PROCESS viewtopicheader.html.tmpl version = version - help = "x582.html" topicview = 0 topicproperties = 0 topiccomments = 1 + help = "x586.html" topicview = 0 topicproperties = 0 topiccomments = 1 topicinfo = 0 closehead = 1 %] <SCRIPT language="JavaScript"> Index: viewtopicinfo.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/viewtopicinfo.html.tmpl,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- viewtopicinfo.html.tmpl 21 Feb 2005 11:25:32 -0000 1.18 +++ viewtopicinfo.html.tmpl 23 May 2005 11:54:00 -0000 1.19 @@ -4,7 +4,7 @@ [% PROCESS viewtopicheader.html.tmpl version = version topicview = 0 topicproperties = 0 topiccomments = 0 topicinfo = 1 closehead = 1 - help = "x617.html" %] + help = "x621.html" %] [%# Create a form to allow the topic's metrics to be changed #%] [% SET metric_input_exists = 0 %] Index: viewtopicproperties.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/viewtopicproperties.html.tmpl,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- viewtopicproperties.html.tmpl 22 May 2005 11:26:30 -0000 1.17 +++ viewtopicproperties.html.tmpl 23 May 2005 11:54:00 -0000 1.18 @@ -5,7 +5,7 @@ [% PROCESS viewtopicheader.html.tmpl version = version topicview = 0 topiccomments = 0 topicinfo = 0 topicproperties = 1 closehead = 1 - help = "x604.html" %] + help = "x608.html" %] <script language="JavaScript"> <!-- | 
| 
      
      
      From: <si...@us...> - 2005-05-23 11:54:59
      
     | 
| Topic "CVS commit: Updated help links." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=8215076&action=view -------------------------------------------------------------- Description: Updated help links. -------------------------------------------------------------- The topic was created with the following files: codestriker/template/en/default/createproject.html.tmpl codestriker/template/en/default/createtopic.html.tmpl codestriker/template/en/default/editcomment.html.tmpl codestriker/template/en/default/editproject.html.tmpl codestriker/template/en/default/listprojects.html.tmpl codestriker/template/en/default/listtopics.html.tmpl codestriker/template/en/default/metricsreport.html.tmpl codestriker/template/en/default/search.html.tmpl codestriker/template/en/default/viewtopic.html.tmpl codestriker/template/en/default/viewtopiccomments.html.tmpl codestriker/template/en/default/viewtopicinfo.html.tmpl codestriker/template/en/default/viewtopicproperties.html.tmpl | 
| 
      
      
      From: <si...@us...> - 2005-05-23 07:45:55
      
     | 
| Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=3722995&action=view User: sits Date: 05/05/23 00:45:36 Modified: lib Codestriker.pm Log: Fixed up backwards compatibility for detecting readonly topics Index: Codestriker.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker.pm,v retrieving revision 1.72 retrieving revision 1.73 diff -u -r1.72 -r1.73 --- Codestriker.pm 22 May 2005 22:26:03 -0000 1.72 +++ Codestriker.pm 23 May 2005 07:45:33 -0000 1.73 @@ -471,7 +471,7 @@ return (grep /^$topic_state$/, @Codestriker::readonly_states); } else { # Backwards compatibility for older configs. - return $topic_state > 0; + return $topic_state ne "Open"; } } | 
| 
      
      
      From: <si...@us...> - 2005-05-23 07:45:48
      
     | 
| Topic "CVS commit: Fixed up backwards compatibility for detectin..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=3722995&action=view -------------------------------------------------------------- Description: Fixed up backwards compatibility for detecting readonly topics -------------------------------------------------------------- The topic was created with the following files: codestriker/lib/Codestriker.pm | 
| 
      
      
      From: <si...@us...> - 2005-05-22 22:26:52
      
     | 
| Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=4449086&action=view User: sits Date: 05/05/22 15:26:06 Modified: . CHANGELOG doc codestriker.sgml lib Codestriker.pm lib/Codestriker/BugDB FlysprayConnection.pm lib/Codestriker/FileParser PerforceDescribe.pm PerforceDiff.pm UnidiffUtils.pm lib/Codestriker/Http Template.pm lib/Codestriker/TopicListeners BugTracking.pm Added: test/testtopictexts perforce-diff12.txt Log: * Modified the Perforce parser to handle file-types that return "xbinary". Also handled Perforce diffs which contain unidiff style '---' and '+++' header lines. From Hope Duryea <hop...@ya...>. Also fixed a few warnings here and there. Index: CHANGELOG =================================================================== RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v retrieving revision 1.170 retrieving revision 1.171 diff -u -r1.170 -r1.171 --- CHANGELOG 22 May 2005 11:26:28 -0000 1.170 +++ CHANGELOG 22 May 2005 22:26:01 -0000 1.171 @@ -89,6 +89,10 @@ path in the filename field. Starting and ending slash not removed from module name during getDiff. +* Modified the Perforce parser to handle file-types that return + "xbinary". Also handled Perforce diffs which contain unidiff style + '---' and '+++' header lines. From Hope Duryea <hop...@ya...>. + Version 1.8.5 * Complete support for VSS repositories. Topics linked to a VSS Index: codestriker.sgml =================================================================== RCS file: /cvsroot/codestriker/codestriker/doc/codestriker.sgml,v retrieving revision 1.47 retrieving revision 1.48 diff -u -r1.47 -r1.48 --- codestriker.sgml 22 May 2005 10:46:31 -0000 1.47 +++ codestriker.sgml 22 May 2005 22:26:02 -0000 1.48 @@ -966,17 +966,17 @@ $metric_config = "none"; </programlisting> </para> + </sect2> <sect2> <title>RSS Support</title> <para> - If you install the <code>XML::RSS</code> module, and re-run + If you install the <filename>XML::RSS</filename> module, and re-run <filename>install.pl</filename>, Codestriker will display an RSS link on the topic list page, which can be used as a URL into your RSS reader, to keep track of new topics being added to the system. </para> </sect2> - </sect2> </sect1> <sect1 id="running-install.pl"> Index: Codestriker.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker.pm,v retrieving revision 1.71 retrieving revision 1.72 diff -u -r1.71 -r1.72 --- Codestriker.pm 22 May 2005 11:26:28 -0000 1.71 +++ Codestriker.pm 22 May 2005 22:26:03 -0000 1.72 @@ -465,9 +465,14 @@ # Returns true if the given topic is 'readonly', i.e. if the given topic # status is in the list of readonly_states in codestriker.conf. -sub topic_readonly($) { +sub topic_readonly { my ($topic_state) = @_; - return (grep /^$topic_state$/, @Codestriker::readonly_states); + if (defined @Codestriker::readonly_states) { + return (grep /^$topic_state$/, @Codestriker::readonly_states); + } else { + # Backwards compatibility for older configs. + return $topic_state > 0; + } } 1; Index: FlysprayConnection.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/BugDB/FlysprayConnection.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- FlysprayConnection.pm 22 May 2005 10:46:34 -0000 1.1 +++ FlysprayConnection.pm 22 May 2005 22:26:03 -0000 1.2 @@ -51,7 +51,7 @@ # Execute the statement. - $comment =~ s/(http:\S+)/<A HREF=\"\1\">$1<\/A>/g; + $comment =~ s/(http:\S+)/<A HREF=\"$1\">$1<\/A>/g; $insert_comment->execute($bugid, $Codestriker::bug_db_user_id, time(), $comment) or die $insert_comment->errstr; $insert_history->execute($bugid, $Codestriker::bug_db_user_id, time()) or die $insert_history->errstr; } Index: PerforceDescribe.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/FileParser/PerforceDescribe.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- PerforceDescribe.pm 15 Mar 2004 21:07:57 -0000 1.1 +++ PerforceDescribe.pm 22 May 2005 22:26:04 -0000 1.2 @@ -125,6 +125,14 @@ if ($filetype eq "text") { # Now read the entire diff chunk. + # Note there may be an optional '---' and '+++' lines + # before the chunk. + my $lastpos = tell $fh; + if (<$fh> !~ /^\-\-\-/ || <$fh> !~ /^\+\+\+/) { + # Move the file pointer back. + seek $fh, $lastpos, 0; + } + my @file_diffs = Codestriker::FileParser::UnidiffUtils-> read_unidiff_text($fh, $filename, $revision, $repmatch); push @result, @file_diffs; Index: PerforceDiff.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/FileParser/PerforceDiff.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- PerforceDiff.pm 16 Mar 2004 09:21:58 -0000 1.1 +++ PerforceDiff.pm 22 May 2005 22:26:04 -0000 1.2 @@ -46,7 +46,7 @@ my $revision = $2; my $file_type = $3; - if ($file_type eq "ubinary" || + if ($file_type eq "ubinary" || $file_type eq "xbinary" || $file_type eq "binary") { # Binary file, skip the next line and add the record in. $line = <$fh>; @@ -62,6 +62,14 @@ push @result, $chunk; } elsif ($file_type eq "text") { + # Note there may be an optional '---' and '+++' lines + # before the chunk. + my $lastpos = tell $fh; + if (<$fh> !~ /^\-\-\-/ || <$fh> !~ /^\+\+\+/) { + # Move the file pointer back. + seek $fh, $lastpos, 0; + } + my @file_diffs = Codestriker::FileParser::UnidiffUtils-> read_unidiff_text($fh, $filename, $revision, $repmatch); push @result, @file_diffs; @@ -75,7 +83,15 @@ my $revision = $2; # Now read the entire diff chunk (it may be empty if the - # user hasn't actually modified the file). + # user hasn't actually modified the file). Note there + # may be an optional '---' and '+++' lines before the + # chunk. + my $lastpos = tell $fh; + if (<$fh> !~ /^\-\-\-/ || <$fh> !~ /^\+\+\+/) { + # Move the file pointer back. + seek $fh, $lastpos, 0; + } + my @file_diffs = Codestriker::FileParser::UnidiffUtils-> read_unidiff_text($fh, $filename, $revision, $repmatch); push @result, @file_diffs; Index: UnidiffUtils.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/FileParser/UnidiffUtils.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- UnidiffUtils.pm 28 Sep 2003 11:08:58 -0000 1.3 +++ UnidiffUtils.pm 22 May 2005 22:26:04 -0000 1.4 @@ -34,10 +34,11 @@ $function_name = ""; } - # Now read in the diff text until finished. + # Now read in the diff text until finished. Note Perforce + # diffs can contain empty lines. my $diff = ""; $line = <$fh>; - while (defined $line && $line =~ /^[ \-\+\\]/o) { + while (defined $line && ($line =~ /^$/o || $line =~ /^[ \-\+\\]/o)) { # Skip lines line "\ No newline at end of file". $diff .= $line unless $line =~ /^[\\]/o; $lastpos = tell $fh; Index: Template.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Template.pm,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- Template.pm 22 May 2005 11:26:29 -0000 1.12 +++ Template.pm 22 May 2005 22:26:05 -0000 1.13 @@ -100,8 +100,10 @@ # Determine whether the current topic is 'readonly'; this determines # the editability of various fields. - $vars->{'topic_readonly'} = - Codestriker::topic_readonly($vars->{'default_state'}); + if (defined $vars->{'default_state'}) { + $vars->{'topic_readonly'} = + Codestriker::topic_readonly($vars->{'default_state'}); + } my $query = new CGI; my $url_builder = Codestriker::Http::UrlBuilder->new($query); Index: BugTracking.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/TopicListeners/BugTracking.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- BugTracking.pm 22 May 2005 10:46:35 -0000 1.1 +++ BugTracking.pm 22 May 2005 22:26:05 -0000 1.2 @@ -11,12 +11,12 @@ use strict; -package Codestriker::TopicListeners::Bugzilla; +package Codestriker::TopicListeners::BugTracking; use Codestriker::TopicListeners::TopicListener; use Codestriker::BugDB::BugDBConnectionFactory; -@Codestriker::TopicListeners::Bugzilla::ISA = ("Codestriker::TopicListeners::TopicListener"); +@Codestriker::TopicListeners::BugTracking::ISA = ("Codestriker::TopicListeners::TopicListener"); sub new { my $type = shift; Index: perforce-diff12.txt =================================================================== RCS file: perforce-diff12.txt diff -N perforce-diff12.txt --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ perforce-diff12.txt 22 May 2005 22:26:05 -0000 1.1 @@ -0,0 +1,31 @@ +==== //depot/main/lid.java#1 - /cygdrive/e/src/lid.java ==== +--- D:/cygwin/tmp/tmp.3472.0 2005-04-04 20:48:03.589625000 -0700 ++++ /cygdrive/e/src/lid.java 2005-03-31 16:11:55.589625000 -0800 +@@ -1,3 +1,7 @@ ++/* ++ * List only directory elements ++ */ ++ + import java.io.*; + + public class lid +==== //depot/main/PrintDesc.java#9 - /cygdrive/e/src/PrintDesc.java ==== +--- D:/cygwin/tmp/tmp.3472.1 2005-04-04 20:48:03.636500000 -0700 ++++ /cygdrive/e/src/PrintDesc.java 2005-03-30 18:08:01.620875000 -0800 +@@ -1,3 +1,5 @@ ++/* Added comment so there's a diff */ ++ + import org.apache.tools.ant.BuildException; + import org.apache.tools.ant.Task; + +@@ -6,6 +8,7 @@ + // The method executing the task + // @param None Executes the task + public void execute() throws BuildException { ++ // And one here as well. + String desc = getOwningTarget().getDescription(); + if( desc != null ) { + System.out.println(desc); + + + | 
| 
      
      
      From: <si...@us...> - 2005-05-22 22:26:44
      
     | 
| Topic "CVS commit: * Modified the Perforce parser to handle file..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=4449086&action=view -------------------------------------------------------------- Description: * Modified the Perforce parser to handle file-types that return "xbinary". Also handled Perforce diffs which contain unidiff style '---' and '+++' header lines. From Hope Duryea <hop...@ya...>. Also fixed a few warnings here and there. -------------------------------------------------------------- The topic was created with the following files: codestriker/CHANGELOG codestriker/doc/codestriker.sgml codestriker/lib/Codestriker.pm codestriker/lib/Codestriker/BugDB/FlysprayConnection.pm codestriker/lib/Codestriker/FileParser/PerforceDescribe.pm codestriker/lib/Codestriker/FileParser/PerforceDiff.pm codestriker/lib/Codestriker/FileParser/UnidiffUtils.pm codestriker/lib/Codestriker/Http/Template.pm codestriker/lib/Codestriker/TopicListeners/BugTracking.pm perforce-diff12.txt | 
| 
      
      
      From: <si...@us...> - 2005-05-22 11:26:48
      
     | 
| Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=5250071&action=view User: sits Date: 05/05/22 04:26:31 Modified: . CHANGELOG codestriker.conf lib Codestriker.pm lib/Codestriker/Action ViewTopicComments.pm lib/Codestriker/Http Render.pm Template.pm lib/Codestriker/Repository Subversion.pm template/en/default viewtopiccomments.html.tmpl viewtopicproperties.html.tmpl Log: * 'Readonly' topic states are now specified in codestriker.conf. For installations that add their own topic states, this allows them to have more than one state in which topics can be edited. From Dan Prince <dan...@al...>. * Subversion topic creation fixes from Michael R. Brumm <mic...@us...>. If module refers to file, path workaround duplicates the file's name at the end of the file path in the filename field. Starting and ending slash not removed from module name during getDiff. Index: CHANGELOG =================================================================== RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v retrieving revision 1.169 retrieving revision 1.170 diff -u -r1.169 -r1.170 --- CHANGELOG 22 May 2005 10:56:16 -0000 1.169 +++ CHANGELOG 22 May 2005 11:26:28 -0000 1.170 @@ -78,6 +78,17 @@ * Fixed message "Character in 'c' format wrapped in pack at ... Response.pm", as reported by an anonymous user. +* 'Readonly' topic states are now specified in codestriker.conf. For + installations that add their own topic states, this allows them to + have more than one state in which topics can be edited. + From Dan Prince <dan...@al...>. + +* Subversion topic creation fixes from Michael R. Brumm + <mic...@us...>. If module refers to file, + path workaround duplicates the file's name at the end of the file + path in the filename field. Starting and ending slash not removed + from module name during getDiff. + Version 1.8.5 * Complete support for VSS repositories. Topics linked to a VSS Index: codestriker.conf =================================================================== RCS file: /cvsroot/codestriker/codestriker/codestriker.conf,v retrieving revision 1.71 retrieving revision 1.72 diff -u -r1.71 -r1.72 --- codestriker.conf 22 May 2005 10:46:25 -0000 1.71 +++ codestriker.conf 22 May 2005 11:26:28 -0000 1.72 @@ -224,6 +224,11 @@ # to delete topics. @topic_states = ('Open', 'Closed', 'Committed', 'Obsoleted', 'Deleted'); +# Which states (in topic_states, above) represent a 'readonly' state. +# If a topic is in a readonly state, then certain activities are disabled, such +# as adding new comments, editing the metrics of existing comments, etc. +@readonly_states = ('Closed', 'Committed', 'Obsoleted', 'Deleted'); + # Indicate if topics can be listed/searched. Turning this to false can be # useful for "anonymous" installations of codestriker. $allow_searchlist = 1; Index: Codestriker.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker.pm,v retrieving revision 1.70 retrieving revision 1.71 diff -u -r1.70 -r1.71 --- Codestriker.pm 22 May 2005 10:46:32 -0000 1.70 +++ Codestriker.pm 22 May 2005 11:26:28 -0000 1.71 @@ -463,6 +463,12 @@ return $#Codestriker::project_states > 0; } -1; +# Returns true if the given topic is 'readonly', i.e. if the given topic +# status is in the list of readonly_states in codestriker.conf. +sub topic_readonly($) { + my ($topic_state) = @_; + return (grep /^$topic_state$/, @Codestriker::readonly_states); +} +1; Index: ViewTopicComments.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/ViewTopicComments.pm,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- ViewTopicComments.pm 1 Mar 2005 10:12:49 -0000 1.14 +++ ViewTopicComments.pm 22 May 2005 11:26:29 -0000 1.15 @@ -153,7 +153,7 @@ $vars->{'metrics'} = \@metrics; # Store the topic status - $vars->{'topic_status'} = $topic->{topic_state}; + $vars->{'default_state'} = $topic->{topic_state}; $vars->{'topic_states'} = \@Codestriker::topic_states; # Send the data to the template for rendering. Index: Render.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Render.pm,v retrieving revision 1.49 retrieving revision 1.50 diff -u -r1.49 -r1.50 --- Render.pm 1 Mar 2005 10:12:52 -0000 1.49 +++ Render.pm 22 May 2005 11:26:29 -0000 1.50 @@ -783,8 +783,8 @@ $params->{name} = $anchor; # Only set the href attribute if the comment is in open state. - if ($self->{topic_state} eq $Codestriker::topic_states[0]) { - $params->{href} = $edit_url; + if (!Codestriker::topic_readonly($self->{topic_state})) { + $params->{href} = $edit_url; } # If a comment exists on this line, set span and the overlib hooks onto Index: Template.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Template.pm,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- Template.pm 21 Dec 2004 23:02:56 -0000 1.11 +++ Template.pm 22 May 2005 11:26:29 -0000 1.12 @@ -98,6 +98,10 @@ 0 : $Codestriker::suggested_topic_size_lines; + # Determine whether the current topic is 'readonly'; this determines + # the editability of various fields. + $vars->{'topic_readonly'} = + Codestriker::topic_readonly($vars->{'default_state'}); my $query = new CGI; my $url_builder = Codestriker::Http::UrlBuilder->new($query); Index: Subversion.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Repository/Subversion.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Subversion.pm 17 Nov 2004 10:04:39 -0000 1.8 +++ Subversion.pm 22 May 2005 11:26:30 -0000 1.9 @@ -45,7 +45,7 @@ $filename =~ s/ /%20/g; my $cmd = "svn cat --non-interactive --no-auth-cache " . $self->{userCmdLine} . - "--revision $revision " . + " --revision $revision " . "\"" . $self->{repository_url} . "/$filename\""; my $write_stdin_fh = new FileHandle; @@ -100,19 +100,58 @@ sub getDiff ($$$$$) { my ($self, $start_tag, $end_tag, $module_name, $stdout_fh, $stderr_fh) = @_; - my $cmd = "svn diff --non-interactive --no-auth-cache " . $self->{userCmdLine} . - "-r $start_tag:$end_tag " . - "--old \"$self->{repository_url}\" \"$module_name\""; + # Make sure the moduel does not end or start with a / + $module_name =~ s/\/$//; + $module_name =~ s/^\///; + + # Replace any spaces with %20 uri friendly escapes. + my $filename = $module_name; + $filename =~ s/ /%20/g; + + my $cmd = "svn cat --non-interactive --no-auth-cache " . $self->{userCmdLine} . + " --revision HEAD " . + "\"" . $self->{repository_url} . "/$filename\""; my $write_stdin_fh = new FileHandle; my $read_stdout_fh = new FileHandle; my $read_stderr_fh = new FileHandle; - my $pid = open3($write_stdin_fh, $read_stdout_fh, $read_stderr_fh,$cmd); + my $pid = open3($write_stdin_fh, $read_stdout_fh, $read_stderr_fh, $cmd); - # Make sure the moduel does not end or start with a / - $module_name =~ s/\\$//; - $module_name =~ s/^\\//; + while(<$read_stdout_fh>) {} + + my $directory; + + # If there is an error about it being a directory, then use the + # module name as a directory. + while(<$read_stderr_fh>) { + my $line = $_; + + if ($line =~ /^svn: URL '.*' refers to a directory/) { + $directory = $module_name; + } + } + + # if there was no error, then the module name is a file, so get the + # directory before the file name. + if (! defined $directory) { + $module_name =~ /(.*)\/[^\/]+/; + $directory = $1; + } + + $write_stdin_fh->close(); + $read_stdout_fh->close(); + $read_stderr_fh->close(); + + $cmd = "svn diff --non-interactive --no-auth-cache " . $self->{userCmdLine} . + " -r $start_tag:$end_tag " . + "--old \"$self->{repository_url}\" \"$module_name\""; + + $write_stdin_fh = new FileHandle; + $read_stdout_fh = new FileHandle; + $read_stderr_fh = new FileHandle; + + $pid = open3($write_stdin_fh, $read_stdout_fh, $read_stderr_fh, $cmd); while(<$read_stdout_fh>) { my $line = $_; @@ -131,9 +170,9 @@ $line =~ /^--- $module_name/ == 0 && $line =~ /^Index: $module_name/ == 0) { - $line =~ s/^--- /--- $module_name\// or - $line =~ s/^Index: /Index: $module_name\// or - $line =~ s/^\+\+\+ /\+\+\+ $module_name\//; + $line =~ s/^--- /--- $directory\// or + $line =~ s/^Index: /Index: $directory\// or + $line =~ s/^\+\+\+ /\+\+\+ $directory\//; } } Index: viewtopiccomments.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/viewtopiccomments.html.tmpl,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- viewtopiccomments.html.tmpl 21 Feb 2005 11:25:32 -0000 1.19 +++ viewtopiccomments.html.tmpl 22 May 2005 11:26:30 -0000 1.20 @@ -101,7 +101,6 @@ </TABLE> <P> - <TABLE CELLPADDING="1" CELLSPACING="3" BORDER="0" WIDTH="100%"> [% last_fileline = -999 %] @@ -124,7 +123,7 @@ [% END %] [%# Check to see if the topic is open or not #%] - [% IF topic_states.0 == topic_status %] + [% IF topic_readonly == 0 %] | <A NAME="[% comment.anchor %]" HREF="[% comment.edit_url %]">Add comment</A> [% END %] </TD> @@ -138,8 +137,8 @@ [% metric_name %]: <SELECT NAME="comment_state_metric|[% metric_name %]|[%comment.filenumber %]|[% comment.fileline %]|[% comment.filenew %]|[% comment.version %]" - [%# Check to see if the topic is open or not #%] - [% IF topic_states.0 != topic_status %] + [%# Check to see if the topic is readonly or not #%] + [% IF topic_readonly != 0 %] disabled [% END %] > @@ -188,7 +187,7 @@ </TABLE> [%# Check to see if the topic is open or not #%] -[% IF topic_states.0 == topic_status %] +[% IF topic_readonly == 0 %] <P> <INPUT TYPE="submit" NAME="button" VALUE="Update"> [% END %] Index: viewtopicproperties.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/viewtopicproperties.html.tmpl,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- viewtopicproperties.html.tmpl 21 Feb 2005 11:25:32 -0000 1.16 +++ viewtopicproperties.html.tmpl 22 May 2005 11:26:30 -0000 1.17 @@ -54,7 +54,7 @@ <input type="text" name="topic_title" value="[% title | html_entity %]" size="70" [%# Check to see if the topic is open or not #%] - [% IF states.0 != default_state %] + [% IF topic_readonly != 0 %] readonly [% END %] maxlength="70"> @@ -67,7 +67,7 @@ <input type="text" name="author" value="[% author | html_entity %]" size="50" maxlength="80" [%# Check to see if the topic is open or not #%] - [% IF antispam_email || states.0 != default_state %]readonly[% END %]> + [% IF antispam_email || topic_readonly != 0 %]readonly[% END %]> </td> </tr> @@ -81,7 +81,7 @@ <td>Bug IDs:</td> <td> <input type="text" name="bug_ids" value="[% bug_ids %]" - size="30" maxlength="50" [% IF states.0 != default_state %]readonly[% END %]> + size="30" maxlength="50" [% IF topic_readonly != 0 %]readonly[% END %]> Links: [% FOREACH bug = bug_id_array %] [% IF loop.count() != 1 %], [% END %] @@ -97,7 +97,7 @@ <input type="text" name="reviewers" value="[% reviewers | html_entity %]" size="50" maxlength="150" [%# Check to see if the topic is open or not #%] - [% IF antispam_email || states.0 != default_state %]readonly[% END %]> + [% IF antispam_email || topic_readonly != 0 %]readonly[% END %]> </td> </tr> @@ -107,7 +107,7 @@ <input type="text" name="cc" value="[% cc | html_entity %]" size="50" maxlength="150" [%# Check to see if the topic is open or not #%] - [% IF antispam_email || states.0 != default_state %]readonly[% END %]> + [% IF antispam_email || topic_readonly != 0 %]readonly[% END %]> </td> </tr> @@ -150,7 +150,7 @@ <td>Project:</td> <td> [%# Check to see if the project is open or not #%] - [% IF states.0 == default_state %] + [% IF topic_readonly == 0 %] <select name="projectid"> [% FOREACH project = projects %] [% IF project.id == topic_projectid %] @@ -182,7 +182,7 @@ <td> <textarea name="topic_description" rows="12" cols="70" [%# Check to see if the topic is open or not #%] - [% IF states.0 != default_state %] readonly [% END %] + [% IF topic_readonly != 0 %] readonly [% END %] wrap="hard">[% description | html_entity %]</textarea> </td> </tr> | 
| 
      
      
      From: <si...@us...> - 2005-05-22 11:26:41
      
     | 
| Topic "CVS commit: * 'Readonly' topic states are now specified i..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=5250071&action=view -------------------------------------------------------------- Description: * 'Readonly' topic states are now specified in codestriker.conf. For installations that add their own topic states, this allows them to have more than one state in which topics can be edited. From Dan Prince <dan...@al...>. * Subversion topic creation fixes from Michael R. Brumm <mic...@us...>. If module refers to file, path workaround duplicates the file's name at the end of the file path in the filename field. Starting and ending slash not removed from module name during getDiff. -------------------------------------------------------------- The topic was created with the following files: codestriker/CHANGELOG codestriker/codestriker.conf codestriker/lib/Codestriker.pm codestriker/lib/Codestriker/Action/ViewTopicComments.pm codestriker/lib/Codestriker/Http/Render.pm codestriker/lib/Codestriker/Http/Template.pm codestriker/lib/Codestriker/Repository/Subversion.pm codestriker/template/en/default/viewtopiccomments.html.tmpl codestriker/template/en/default/viewtopicproperties.html.tmpl | 
| 
      
      
      From: <si...@us...> - 2005-05-22 11:04:14
      
     | 
| Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=2261681&action=view User: sits Date: 05/05/22 04:03:58 Modified: lib/Codestriker/Action DownloadTopic.pm Log: Remove content_disposition, this stuffed up filename downloads. Index: DownloadTopic.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/DownloadTopic.pm,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- DownloadTopic.pm 23 Mar 2004 07:15:07 -0000 1.10 +++ DownloadTopic.pm 22 May 2005 11:03:58 -0000 1.11 @@ -33,7 +33,6 @@ -content_type=>'text/plain', -attachment=>"topic${topicid}.txt", -filename=>"topic${topicid}.txt", - -content_disposition=>"filename=\"topic${topicid}.txt\";", -pragma=>"Cache", -cache_control=>"Cache"); print $topic->{document}; | 
| 
      
      
      From: <si...@us...> - 2005-05-22 11:04:13
      
     | 
| Topic "CVS commit: Remove content_disposition, this stuffed up f..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=2261681&action=view -------------------------------------------------------------- Description: Remove content_disposition, this stuffed up filename downloads. -------------------------------------------------------------- The topic was created with the following files: codestriker/lib/Codestriker/Action/DownloadTopic.pm | 
| 
      
      
      From: <si...@us...> - 2005-05-22 10:56:41
      
     | 
| Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=7414522&action=view User: sits Date: 05/05/22 03:56:17 Modified: . CHANGELOG lib/Codestriker/Http Response.pm Log: Should use unsigned characters when writing to the compressed streams. Index: CHANGELOG =================================================================== RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v retrieving revision 1.168 retrieving revision 1.169 diff -u -r1.168 -r1.169 --- CHANGELOG 22 May 2005 10:46:24 -0000 1.168 +++ CHANGELOG 22 May 2005 10:56:16 -0000 1.169 @@ -75,6 +75,9 @@ Win32, this isn't an issue. Found by Michael R. Brumm <mic...@us...>. +* Fixed message "Character in 'c' format wrapped in pack at + ... Response.pm", as reported by an anonymous user. + Version 1.8.5 * Complete support for VSS repositories. Topics linked to a VSS Index: Response.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Response.pm,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- Response.pm 22 May 2005 04:33:38 -0000 1.31 +++ Response.pm 22 May 2005 10:56:17 -0000 1.32 @@ -490,7 +490,7 @@ crc => 0, len => 0, }; - my ($header) = pack("c10", MAGIC1, MAGIC2, + my ($header) = pack("C10", MAGIC1, MAGIC2, Compress::Zlib::Z_DEFLATED(), 0,0,0,0,0,0, OSCODE); print {$o->{handle}} $header; | 
| 
      
      
      From: <si...@us...> - 2005-05-22 10:56:33
      
     | 
| Topic "CVS commit: Should use unsigned characters when writing t..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=7414522&action=view -------------------------------------------------------------- Description: Should use unsigned characters when writing to the compressed streams. -------------------------------------------------------------- The topic was created with the following files: codestriker/CHANGELOG codestriker/lib/Codestriker/Http/Response.pm | 
| 
      
      
      From: <si...@us...> - 2005-05-22 10:46:42
      
     | 
|   User: sits    
  Date: 05/05/22 03:46:35
  Modified:    .        CHANGELOG codestriker.conf
               doc      codestriker.sgml
               lib      Codestriker.pm
               lib/Codestriker/BugDB BugDBConnectionFactory.pm
               lib/Codestriker/FileParser SubversionDiff.pm
               lib/Codestriker/TopicListeners Manager.pm
  Added:       bin      install.pl
               lib/Codestriker/BugDB FlysprayConnection.pm
               lib/Codestriker/TopicListeners BugTracking.pm
  Removed:     bin      checksetup.pl import.pl
               lib/Codestriker/TopicListeners Bugzilla.pm
  Log:
  * Subversion 1.1 has changed it diff format slightly.  Parser as been
    updated, as reported by Martin Apel <Mar...@so...>.
  
  * Added integration support for Flyspray bug-tracking system.  From
    Martin Apel.
  
  * Fixed text message written to bug-tracking system where the topic
    author was used instead of the actual user, when the topic state was
    changed.  Found by Jason Remilliard.
  
  * Renamed TopicListeners/Bugzilla.pm to TopicListeners/BugTracking.pm
    as the previous name was misleading (suggested by Martin Apel).
  
  * Renamed checksetup.pl to install.pl, and it was very confusing for
    new users.
  
  
  
  Index: CHANGELOG
  ===================================================================
  RCS file: /cvsroot/codestriker/codestriker/CHANGELOG,v
  retrieving revision 1.167
  retrieving revision 1.168
  diff -u -r1.167 -r1.168
  --- CHANGELOG	16 Feb 2005 23:31:21 -0000	1.167
  +++ CHANGELOG	22 May 2005 10:46:24 -0000	1.168
  @@ -1,7 +1,7 @@
   *** When upgrading, don't forget to: "cd bin ; ./checksetup.pl" ***
   *** Also, it is _highly_ advisable to backup your data before upgrading ***
   
  -Version 1.8.6
  +Version 1.9.0
   
   * Now using overlib javascript library
     (http://www.bosrup.com/web/overlib) for formatted "tooltips".  When
  @@ -13,6 +13,10 @@
     modified to use this tooltip library as well as opposed to
     javascript alert windows.
   
  +* Comments are now added view an overlib tooltip window, rather than
  +  using a separate browser window.  This speeds up the reviewing
  +  process and keeps the reviewer focussed on a single browser window.
  +
   * It is now possible to create a comment associated with a specific
     file, or the topic itself, rather than being associated with a
     specific line.  This allows reviewers to create file-level or
  @@ -55,6 +59,22 @@
   * On UNIX platforms, missing modules can be fetched and installed
     automatically using the CPAN module, if required.
   
  +* Subversion 1.1 has changed it diff format slightly.  Parser as been
  +  updated, as reported by Martin Apel <Mar...@so...>.
  +
  +* Added integration support for Flyspray bug-tracking system.  From
  +  Martin Apel.
  +
  +* Fixed text message written to bug-tracking system where the topic
  +  author was used instead of the actual user, when the topic state was
  +  changed.  Found by Jason Remilliard.
  +
  +* Make sure for Win32 deployments, that the PATH environment
  +  variable is not zapped.  This created issues when launching external
  +  programs, such as an SCM program.  Since taint-mode is broken under
  +  Win32, this isn't an issue.  Found by Michael R. Brumm
  +  <mic...@us...>.
  +
   Version 1.8.5
   
   * Complete support for VSS repositories.  Topics linked to a VSS
  
  
  
  
  
  Index: codestriker.conf
  ===================================================================
  RCS file: /cvsroot/codestriker/codestriker/codestriker.conf,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- codestriker.conf	22 May 2005 04:33:36 -0000	1.70
  +++ codestriker.conf	22 May 2005 10:46:25 -0000	1.71
  @@ -62,12 +62,6 @@
   # specify the location of the codestriker_css as a URL.
   $codestriker_css = '';
   
  -# The URL to the bug tracking system.  The bug number is appended to the
  -# end of this string when URLs are generated.  This can be left blank if
  -# there is no need for bug-tracking integration.
  -$bugtracker = '';
  -$bugtracker = 'http://localhost.localdomain/bugzilla/show_bug.cgi?id=';
  -
   # Valid repositories which may be selected at the create topic screen.
   # The order shown here is the order presented in the option list.  Most
   # deployments will only require a single repository to be specified.
  @@ -291,22 +285,39 @@
   # can be changed dynamically on the view topic screen.
   $default_tabwidth = 8;
   
  -# Bug database to update.  Currently, only Bugzilla is supported, but it is
  -# straight-forward to support other bug databases.  To enable bugzilla, set
  -# $bug_db to "bugzilla", and set the following parameters to your setup.
  -# if the $bug_db is an empty string, all bug-tracking related features will
  -# be disabled.
  -#$bug_db = '';
  -$bug_db = 'bugzilla';
  -
  -# Bug database connection details.
  -$bug_db_host = 'localhost';
  -$bug_db_name = 'bugs';
  -$bug_db_password = 'bugs_password';
  -$bug_db_dbname = 'bugs';
  +# Bug database to update.  Currently, Bugzilla and Flyspray are
  +# supported, but it is straight-forward to support other bug
  +# databases.  To enable Bugzilla, set $bug_db to "bugzilla", and set
  +# the following parameters to your setup.  To enable Flysprat, set
  +# $bug_db to "flyspray", and set the relevant parameters.
  +# if the $bug_db is an empty string, all bug-tracking related
  +# features will be disabled.
  +
  +$bug_db = '';
  +#$bug_db = 'bugzilla';
  +#$bug_db = 'flyspray';
  +
  +# Bugzilla database connection details.
  +#$bug_db_host = 'localhost';
  +#$bug_db_name = 'bugs';
  +#$bug_db_password = 'bugs_password';
  +#$bug_db_dbname = 'bugs';
  +#$bug_db_user_id = '2';
  +
  +# Flyspray database connection details
  +#$flyspray_db_host = 'localhost';
  +#$flyspray_db_name = 'flyspray';
  +#$flyspray_db_password = 'flyspray_password';
  +#$flyspray_db_dbname = 'flyspray_dev';
  +#$flyspray_db_user_id = 50;
   
  -# Bugzilla codestriker user id.
  -$bug_db_user_id = '2';
  +# The URL to the bug tracking system.  The bug number is appended to the
  +# end of this string when URLs are generated.  This can be left blank if
  +# there is no need for bug-tracking integration.  Below are some example
  +# URLs for Bugzilla and Flyspray.
  +$bugtracker = '';
  +#$bugtracker = 'http://localhost.localdomain/bugzilla/show_bug.cgi?id=';
  +#$bugtracker = '/flyspray_dev/?do=details&id=';
   
   # LXR database.  Each repository can be optionally mapped to a
   # different LXR deployment.  If a repository has an associated LXR
  
  
  
  
  
  Index: install.pl
  ===================================================================
  RCS file: install.pl
  diff -N install.pl
  --- /dev/null	1 Jan 1970 00:00:00 -0000
  +++ install.pl	22 May 2005 10:46:30 -0000	1.1
  @@ -0,0 +1,1049 @@
  +#!/usr/bin/perl -w
  +
  +###############################################################################
  +# Codestriker: Copyright (c) 2001, 2002 David Sitsky.  All rights reserved.
  +# si...@us...
  +#
  +# This program is free software; you can redistribute it and modify it under
  +# the terms of the GPL.
  +
  +# This script used to be known as checksetup.pl, but was renamed to install.pl
  +# as it was confusing to new users installing the product the first time.
  +#
  +# This script is similar to bugzilla's checksetup.pl.  It can be run whenever
  +# you like, but ideally should be done after every upgrade.  Currently the
  +# module does the following:
  +#
  +# - check for the required perl modules
  +# - creates the database "codestriker" if the database does not exist
  +# - creates the tables inside the database if they don't exist
  +# - authomatically changes the table definitions of older codestriker
  +#   installations, and does data migration automatically.
  +
  +use strict;
  +use Config;
  +
  +# Now load up the required modules.  Do this is a lazy fashion so that Perl
  +# doesn't try to grab this during compile time, otherwise nasty-looking
  +# error messages will appear to the user.
  +eval("use Cwd");
  +eval("use CPAN");
  +eval("use File::Path");
  +eval("use lib '../lib'");
  +eval("use Codestriker");
  +eval("use Codestriker::DB::Database");
  +eval("use Codestriker::DB::Column");
  +eval("use Codestriker::DB::Table");
  +eval("use Codestriker::DB::Index");
  +eval("use Codestriker::Action::SubmitComment");
  +eval("use Codestriker::Repository::RepositoryFactory");
  +eval("use Codestriker::FileParser::Parser");
  +eval("use Codestriker::FileParser::UnknownFormat");
  +eval("use Codestriker::Model::File");
  +
  +# Set this variables, to avoid compilation warnings below.
  +$Codestriker::COMMENT_SUBMITTED = 0;
  +@Codestriker::valid_repositories = ();
  +
  +# Initialise Codestriker, load up the configuration file.
  +Codestriker->initialise(cwd() . '/..');
  +
  +# Make sure the $db configuration variable has been set, and if not
  +# complain and exit.
  +if (! defined $Codestriker::db) {
  +    print STDERR
  +	"The database configuration variable \$db has not been set.\n";
  +    print STDERR
  +	"Please edit the codestriker.conf file and run this command again.\n";
  +    exit -1;
  +}
  +
  +# Indicate which modules are required for codestriker (this code is
  +# completely stolen more-or-less verbatim from Bugzilla)
  +my $modules = [ 
  +    { 
  +        name => 'LWP::UserAgent', 
  +        version => '0' 
  +    }, 
  +    { 
  +        name => 'CGI', 
  +        version => '2.56' 
  +    }, 
  +    { 
  +        name => 'Net::SMTP', 
  +        version => '0' 
  +    }, 
  +    { 
  +        name => 'DBI', 
  +        version => '1.13' 
  +    }, 
  +    { 
  +        name => 'Template', 
  +        version => '2.07' 
  +    },
  +    { 
  +        name => 'HTML::Entities', 
  +        version => '0' 
  +    },
  +    { 
  +        name => 'File::Temp', 
  +        version => '0' 
  +    },
  +    { 
  +        name => 'XML::RSS', 
  +        version => '1.05',
  +        optional => 1
  +    }
  +];
  +
  +# Retrieve the database module dependencies.  Put this in an eval block to
  +# handle the case where the user hasn't installed the DBI module yet,
  +# which prevents the following code from running.
  +my $database = undef;
  +eval {
  +    $database = Codestriker::DB::Database->get_database();
  +    push @{$modules}, $database->get_module_dependencies();
  +};
  +
  +my %missing_optional = ();
  +my %missing = ();
  +foreach my $module (@{$modules}) {
  +
  +    my $optional = exists($module->{optional}) && $module->{optional};
  +
  +    unless (have_vers($module->{name}, $module->{version},$optional)) { 
  +        if ( $optional == 0) {
  +        $missing{$module->{name}} = $module->{version};
  +    }
  +        else {
  +            $missing_optional{$module->{name}} = $module->{version};
  +        }
  +    }
  +}
  +
  +# vers_cmp is adapted from Sort::Versions 1.3 1996/07/11 13:37:00 kjahds,
  +# which is not included with Perl by default, hence the need to copy it here.
  +# Seems silly to require it when this is the only place we need it...
  +sub vers_cmp {
  +  if (@_ < 2) { die "not enough parameters for vers_cmp" }
  +  if (@_ > 2) { die "too many parameters for vers_cmp" }
  +  my ($a, $b) = @_;
  +  my (@A) = ($a =~ /(\.|\d+|[^\.\d]+)/g);
  +  my (@B) = ($b =~ /(\.|\d+|[^\.\d]+)/g);
  +  my ($A,$B);
  +  while (@A and @B) {
  +    $A = shift @A;
  +    $B = shift @B;
  +    if ($A eq "." and $B eq ".") {
  +      next;
  +    } elsif ( $A eq "." ) {
  +      return -1;
  +    } elsif ( $B eq "." ) {
  +      return 1;
  +    } elsif ($A =~ /^\d+$/ and $B =~ /^\d+$/) {
  +      return $A <=> $B if $A <=> $B;
  +    } else {
  +      $A = uc $A;
  +      $B = uc $B;
  +      return $A cmp $B if $A cmp $B;
  +    }
  +  }
  +  @A <=> @B;
  +}
  +
  +# This was originally clipped from the libnet Makefile.PL, adapted here to
  +# use the above vers_cmp routine for accurate version checking.
  +sub have_vers {
  +  my ($pkg, $wanted, $optional) = @_;
  +  my ($msg, $vnum, $vstr);
  +  no strict 'refs';
  +  printf("Checking for %15s %-9s ", $pkg, !$wanted?'(any)':"(v$wanted)");
  +
  +  eval { my $p; ($p = $pkg . ".pm") =~ s!::!/!g; require $p; };
  +
  +  $vnum = ${"${pkg}::VERSION"} || ${"${pkg}::Version"} || 0;
  +  $vnum = -1 if $@;
  +
  +  if ($vnum eq "-1") { # string compare just in case it's non-numeric
  +    if ( $optional ) {
  +        $vstr = "ok: not found, optional";
  +    } 
  +    else {
  +        $vstr = "    not found";
  +    }
  +
  +  }
  +  elsif (vers_cmp($vnum,"0") > -1) {
  +    $vstr = "found v$vnum";
  +  }
  +  else {
  +    $vstr = "found unknown version";
  +  }
  +
  +  my $vok = (vers_cmp($vnum,$wanted) > -1);
  +  print ((($vok) ? "ok: " : " "), "$vstr\n");
  +  return $vok;
  +}
  +
  +# Determine if this process is running under Windows, as the installation
  +# process is slightly different.
  +my $osname = $Config{'osname'};
  +my $windows = (defined $osname && $osname eq "MSWin32") ? 1 : 0;
  +
  +# Output any modules which may be missing.
  +if (%missing) {
  +
  +    # First, output the generic "missing module" message.
  +    print "\n\n";
  +    print "Codestriker requires some Perl modules which are either missing\n" .
  +	  "from your system, or the version on your system is too old.\n";
  +
  +    if ($windows) {
  +	foreach my $module (keys %missing) {
  +	    print " Missing \"$module\"\n";
  +	    if ($missing{$module} > 0) {
  +		print "   Minimum version required: $missing{$module}\n";
  +	    }
  +	}
  +
  +	print <<EOF;
  +
  +These can be installed by doing the following in PPM 2.0 (the version of ppm is
  +displayed when you start it up).
  +
  +C:\> ppm
  +
  +PPM> set repository oi http://openinteract.sourceforge.net/ppmpackages
  +PPM> set save
  +PPM> install (package-name)
  +
  +For PPM 3.0:
  +
  +C:\> ppm
  +PPM> rep add oi http://openinteract.sourceforge.net/ppmpackages
  +PPM> install (package-name)
  +
  +*NOTE* The Template package name may not be "Template" but "Template-Toolkit"
  +when entering the commands above.
  +
  +http://openinteract.sourceforge.net/cgi-bin/twiki/view/OI/ActivePerlPackages
  +has more information if you still have problems.
  +
  +Another repository of Perl packages is http://theoryx5.uwinnipeg.ca/ppmpackages
  +which also has mod_perl for Win32.
  +
  +The ActiveState default repository in PPM has almost all of the packages
  +required.
  +EOF
  +    }
  +    else {
  +	print "They can be installed by running (as root) the following:\n";
  +	foreach my $module (keys %missing) {
  +	    print "   perl -MCPAN -e 'install \"$module\"'\n";
  +	    if ($missing{$module} > 0) {
  +		print "   Minimum version required: $missing{$module}\n";
  +	    }
  +	}
  +	print "\n";
  +	print "Modules can also be downloaded from http://www.cpan.org.\n\n";
  +    }
  +
  +    if ($windows) {
  +	# Need to find out how to do automatic installs with PPM.
  +	exit -1;
  +    }
  +
  +    # Check we are running as root so the Perl modules can be properly
  +    # installed.
  +    print "\n";
  +
  +    if ($< != 0) {
  +        print "Execute this script as root so I can install these modules ";
  +        print "automatically.\n\n";
  +        exit -1;
  +    }
  +
  +    print "Shall I try to download and install these modules for you? (y/n): ";
  +    flush STDOUT;
  +    
  +    my $answer = <STDIN>;
  +    chop $answer;
  +    if ($answer =~ /^y/i) {
  +	# Try to install the modules using CPAN.
  +	foreach my $module (keys %missing) {
  +	    my $obj = CPAN::Shell->expand('Module', $module);
  +	    
  +	    if (! $obj->install) {
  +		print STDERR "\n\nFailed to install module: $module.\n";
  +		print STDERR "Try to install this module manually, " .
  +		    "and run this script again.\n\n";
  +		exit(1);
  +	    }
  +	}
  +	
  +    } else {
  +	# User decided to bail out.
  +	exit -1;
  +    }
  +}
  +
  +
  +# Obtain a database connection.
  +my $dbh = $database->get_connection();
  +
  +# Convenience methods and variables for creating table objects.
  +my $TEXT = $Codestriker::DB::Column::TYPE->{TEXT};
  +my $VARCHAR = $Codestriker::DB::Column::TYPE->{VARCHAR};
  +my $INT32 = $Codestriker::DB::Column::TYPE->{INT32};
  +my $INT16 = $Codestriker::DB::Column::TYPE->{INT16};
  +my $DATETIME = $Codestriker::DB::Column::TYPE->{DATETIME};
  +my $FLOAT = $Codestriker::DB::Column::TYPE->{FLOAT};
  +sub col { return Codestriker::DB::Column->new(@_); }
  +sub dbindex { return Codestriker::DB::Index->new(@_); }
  +sub table { return Codestriker::DB::Table->new(@_); }
  +
  +# The topic table.
  +my $topic_table =
  +  table(name => "topic",
  +	columns => [col(name=>"id", type=>$INT32, pk=>1),
  +		    col(name=>"author", type=>$VARCHAR, length=>255),
  +		    col(name=>"title", type=>$VARCHAR, length=>255),
  +		    col(name=>"description", type=>$TEXT),
  +		    col(name=>"document", type=>$TEXT),
  +		    col(name=>"state", type=>$INT16),
  +		    col(name=>"creation_ts", type=>$DATETIME),
  +		    col(name=>"modified_ts", type=>$DATETIME),
  +		    col(name=>"version", type=>$INT32),
  +		    col(name=>"start_tag", type=>$TEXT, mandatory=>0),
  +		    col(name=>"end_tag", type=>$TEXT, mandatory=>0),
  +		    col(name=>"module", type=>$TEXT, mandatory=>0),
  +		    col(name=>"repository", type=>$TEXT, mandatory=>0),
  +		    col(name=>"projectid", type=>$INT32)
  +		   ],
  +	indexes => [dbindex(name=>"author_idx", column_names=>["author"])]);
  +
  +# The topichistory table.  Holds information relating to how a topic
  +# has changed over time.  Only changeable topic attributes are
  +# recorded in this table.
  +my $topichistory_table =
  +  table(name => "topichistory",
  +	columns => [col(name=>"topicid", type=>$INT32, pk=>1),
  +		    col(name=>"author", type=>$VARCHAR, length=>255),
  +		    col(name=>"title", type=>$VARCHAR, length=>255),
  +		    col(name=>"description", type=>$TEXT, length=>255),
  +		    col(name=>"state", type=>$INT16),
  +		    col(name=>"modified_ts", type=>$DATETIME),
  +		    col(name=>"version", type=>$INT32, pk=>1),
  +		    col(name=>"repository", type=>$TEXT, mandatory=>0),
  +		    col(name=>"projectid", type=>$INT32),
  +		    col(name=>"reviewers", type=>$TEXT),
  +		    col(name=>"cc", type=>$TEXT, mandatory=>0),
  +		    col(name=>"modified_by_user", type=>$VARCHAR, length=>255, mandatory=>0)
  +		   ],
  +	indexes => [dbindex(name=>"th_idx", column_names=>["topicid"])]);
  +	
  +# Holds information as to when a user viewed a topic.
  +my $topicviewhistory_table =
  +  table(name => "topicviewhistory",
  +	columns => [col(name=>"topicid", type=>$INT32),
  +		    col(name=>"email", type=>$VARCHAR, length=>255, mandatory=>0),
  +		    col(name=>"creation_ts", type=>$DATETIME)
  +		   ],
  +	indexes => [dbindex(name=>"tvh_idx", column_names=>["topicid"])]);
  +
  +# Holds all of the metric data that is owned by a specific user on a specific 
  +# topic. One row per metric. Metric data that is left empty does not get a row.
  +my $topicusermetric_table =
  +  table(name => "topicusermetric",
  +	columns => [col(name=>"topicid", type=>$INT32, pk=>1),
  +		    col(name=>"email", type=>$VARCHAR, length=>255, pk=>1),
  +		    col(name=>"metric_name", type=>$VARCHAR, length=>80, pk=>1),
  +		    col(name=>"value", type=>$FLOAT)
  +		   ],
  +	indexes => [dbindex(name=>"tum_idx",
  +			    column_names=>["topicid", "email"])]);
  +
  +# Holds all of the metric data that is owned by a specific topic. One row per 
  +# metric. Metric data that is empty does not get a row.
  +my $topicmetric_table =
  +  table(name => "topicmetric",
  +	columns => [col(name=>"topicid", type=>$INT32, pk=>1),
  +		    col(name=>"metric_name", type=>$VARCHAR, length=>80,pk=>1),
  +		    col(name=>"value", type=>$FLOAT)
  +		   ],
  +	indexes => [dbindex(name=>"tm_idx", column_names=>["topicid"])]);
  +
  +# Holds record of which topics obsolete other topics, which is a many-to-many
  +# relationship.
  +my $topicobsolete_table =
  +  table(name => "topicobsolete",
  +	columns => [col(name=>"topicid", type=>$INT32, pk=>1),
  +		    col(name=>"obsoleted_by", type=>$INT32, pk=>1)
  +		   ],
  +	indexes => [dbindex(name=>"to1_idx", column_names=>["topicid"]),
  +		    dbindex(name=>"to2_idx", column_names=>["obsoleted_by"])]);
  +
  +# Hold a specific datum of column data entered by a specific user for a
  +# specific line.
  +my $commentdata_table =
  +  table(name => "commentdata",
  +	columns => [col(name=>"commentstateid", type=>$INT32),
  +		    col(name=>"commentfield", type=>$TEXT),
  +		    col(name=>"author", type=>$VARCHAR, length=>255),
  +		    col(name=>"creation_ts", type=>$DATETIME)
  +		   ],
  +	indexes => [dbindex(name=>"comment_idx",
  +			    column_names=>["commentstateid"])]);
  +
  +# Contains the state of a bunch of comments on a specific line of code.
  +my $commentstate_table =
  +  table(name => "commentstate",
  +	columns => [col(name=>"id", type=>$INT32, autoincr=>1, pk=>1),
  +		    col(name=>"topicid", type=>$INT32),
  +		    col(name=>"fileline", type=>$INT32),
  +		    col(name=>"filenumber", type=>$INT32),
  +		    col(name=>"filenew", type=>$INT16),
  +		    col(name=>"state", type=>$INT16),  # Not used, old field.
  +		    col(name=>"version", type=>$INT32),
  +		    col(name=>"creation_ts", type=>$DATETIME),
  +		    col(name=>"modified_ts", type=>$DATETIME)
  +		   ],
  +	indexes => [dbindex(name=>"commentstate_topicid_idx",
  +			    column_names=>["topicid"])]);
  +
  +# Contains the metrics associated with a commentstate record.  This is
  +# configurable over time, so basic string data is stored into here.
  +my $commentstatemetric_table =
  +  table(name => "commentstatemetric",
  +	columns => [col(name=>"id", type=>$INT32, pk=>1),
  +		    col(name=>"name", type=>$VARCHAR, length=>80, pk=>1),
  +		    col(name=>"value", type=>$VARCHAR, length=>80)
  +		    ],
  +	indexes => [dbindex(name=>"csm_id_idx", column_names=>["id"]),
  +		    dbindex(name=>"csm_name_idx", column_names=>["name"])]);
  +		    
  +# Holds information relating to how a commentstate has changed over time.
  +# Only changeable commentstate attributes are recorded in this table.
  +my $commentstatehistory_table =
  +  table(name => "commentstatehistory",
  +	columns => [col(name=>"id", type=>$INT32, pk=>1),
  +                    col(name=>"state", type=>$INT16),  # Not used, old field.
  +		    col(name=>"metric_name", type=>$VARCHAR, length=>80),
  +		    col(name=>"metric_value", type=>$VARCHAR, length=>80),
  +		    col(name=>"version", type=>$INT32, pk=>1),
  +		    col(name=>"modified_ts", type=>$DATETIME),
  +		    col(name=>"modified_by_user", type=>$VARCHAR, length=>255)
  +		    ]);
  +
  +# Indicate what participants there are in a topic.
  +my $participant_table =
  +  table(name => "participant",
  +	columns => [col(name=>"topicid", type=>$INT32, pk=>1),
  +		    col(name=>"email", type=>$VARCHAR, length=>255, pk=>1),
  +		    col(name=>"type", type=>$INT16, pk=>1),
  +		    col(name=>"state", type=>$INT16),
  +		    col(name=>"modified_ts", type=>$DATETIME),
  +		    col(name=>"version", type=>$INT32)
  +		   ],
  +	indexes => [dbindex(name=>"participant_tid_idx",
  +			    column_names=>["topicid"])]);
  +
  +# Indicate how bug records are related to topics.
  +my $topicbug_table =
  +  table(name => "topicbug",
  +	columns => [col(name=>"topicid", type=>$INT32, pk=>1),
  +		    col(name=>"bugid", type=>$INT32, pk=>1)
  +		   ],
  +	indexes => [dbindex(name=>"topicbug_tid_idx",
  +			    column_names=>["topicid"])]);
  +
  +# This table records which file fragments are associated with a topic.
  +my $topicfile_table =
  +  table(name => "topicfile",
  +	columns => [col(name=>"topicid", type=>$INT32, pk=>1),
  +		    col(name=>"sequence", type=>$INT16, pk=>1),
  +		    col(name=>"filename", type=>$VARCHAR, length=>255),
  +		    col(name=>"topicoffset", type=>$INT32),
  +		    col(name=>"revision", type=>$VARCHAR, length=>255),
  +		    col(name=>"binaryfile", type=>$INT16),
  +		    col(name=>"diff", type=>$TEXT, mandatory=>0)
  +		   ],
  +	indexes => [dbindex(name=>"topicfile_tid_idx",
  +			    column_names=>["topicid"])]);
  +
  +# This table records a specific "delta", which is a chunk of a diff file.
  +my $delta_table =
  +  table(name => "delta",
  +	columns => [col(name=>"topicid", type=>$INT32, pk=>1),
  +		    col(name=>"file_sequence", type=>$INT16),
  +		    col(name=>"delta_sequence", type=>$INT16, pk=>1),
  +		    col(name=>"old_linenumber", type=>$INT32),
  +		    col(name=>"new_linenumber", type=>$INT32),
  +		    col(name=>"deltatext", type=>$TEXT),
  +		    col(name=>"description", type=>$TEXT, mandatory=>0),
  +		    col(name=>"repmatch", type=>$INT16)
  +		   ],
  +	indexes => [dbindex(name=>"delta_fid_idx",
  +			    column_names=>["topicid"])]);
  +
  +# This table records all projects in the system.
  +my $project_table =
  +  table(name => "project",
  +	columns => [col(name=>"id", type=>$INT32, pk=>1, autoincr=>1),
  +		    col(name=>"name", type=>$VARCHAR, length=>255),
  +		    col(name=>"description", type=>$TEXT),
  +		    col(name=>"creation_ts", type=>$DATETIME),
  +		    col(name=>"modified_ts", type=>$DATETIME),
  +		    col(name=>"version", type=>$INT32),
  +		    col(name=>"state", type=>$INT16)
  +		   ],
  +	indexes => [dbindex(name=>"project_name_idx",
  +			    column_names=>["name"])]);
  +
  +# Add all of the Codestriker tables into an array.
  +my @tables = ();
  +push @tables, $topic_table;
  +push @tables, $topichistory_table;
  +push @tables, $topicviewhistory_table;
  +push @tables, $topicusermetric_table;
  +push @tables, $topicmetric_table;
  +push @tables, $topicobsolete_table;
  +push @tables, $commentdata_table;
  +push @tables, $commentstate_table;
  +push @tables, $commentstatemetric_table;
  +push @tables, $commentstatehistory_table;
  +push @tables, $participant_table;
  +push @tables, $topicbug_table;
  +push @tables, $topicfile_table;
  +push @tables, $delta_table;
  +push @tables, $project_table;
  +
  +# Move a table into table_old, create the table with the new definitions,
  +# and create the indexes.
  +sub move_old_table ($$)
  +{
  +    my ($table, $pkey_column) = @_;
  +    my $tablename = $table->get_name();
  +
  +    # Rename the table with this name to another name.
  +    $dbh->do("ALTER TABLE $tablename RENAME TO ${tablename}_old") ||
  +	die "Could not rename table $tablename: " . $dbh->errstr;
  +
  +    # For PostgreSQL, need to drop and create the old primary key index
  +    # with a different name, otherwise the create table command below
  +    # will fail.
  +    if (defined $pkey_column && $Codestriker::db =~ /^DBI:pg/i) {
  +	$dbh->do("DROP INDEX ${tablename}_pkey") ||
  +	    die "Could not drop pkey index: " . $dbh->errstr;
  +	$dbh->do("CREATE UNIQUE INDEX ${tablename}_old_pkey ON " .
  +		 "${tablename}_old($pkey_column)") ||
  +		 die "Could not create pkey index for old table: " .
  +		 $dbh->errstr;
  +    }
  +
  +    # Now create the table.
  +    $database->create_table($table);
  +}
  +
  +# Create a new commentstate record with the specified data values.  Return
  +# the id of the commentstate record created.
  +sub create_commentstate ($$$$)
  +{
  +    my ($topicid, $line, $state, $version) = @_;
  +
  +    print " Updating commentstate topicid $topicid offset $line\n";
  +
  +    # Determine what filenumber, fileline and filenew the old "offset"
  +    # number refers to.  If it points to an actual diff/block, just
  +    # return 
  +    my ($filenumber, $filename, $fileline, $filenew, $accurate);
  +    my $rc = Codestriker::Action::SubmitComment->
  +	_get_file_linenumber($topicid, $line, \$filenumber, \$filename,
  +			     \$fileline, \$accurate, \$filenew);
  +    if ($rc == 0) {
  +	# Review is not a diff, just a single file.
  +	$filenumber = 1;
  +	$fileline = $line;
  +	$filenew = 1;
  +    } elsif ($filenumber == -1) {
  +	# Comment was made against a diff header.
  +	$filenumber = 1;
  +	$fileline = 1;
  +	$filenew = 1;
  +    }
  +	    
  +    my $insert = $dbh->prepare_cached(
  +		"INSERT INTO commentstate (topicid, fileline, filenumber, " .
  +		"filenew, state, version, creation_ts, modified_ts) VALUES " .
  +	        "(?, ?, ?, ?, ?, ?, ?, ?)");
  +    my $timestamp = Codestriker->get_timestamp(time);
  +    $insert->execute($topicid, $fileline, $filenumber, $filenew,
  +		     $state, $version, $timestamp, $timestamp);
  +    $insert->finish();
  +    print "Create commentstate\n";
  +    
  +    # Find out what the commentstateid is, and update the
  +    # topicoffset_map.
  +    my $check = $dbh->prepare_cached("SELECT id FROM commentstate " .
  +				     "WHERE topicid = ? AND " .
  +				     "fileline = ? AND " .
  +				     "filenumber = ? AND " .
  +				     "filenew = ?");
  +    $check->execute($topicid, $fileline, $filenumber, $filenew);
  +    my ($id) = $check->fetchrow_array();
  +    $check->finish();
  +
  +    return $id;
  +}
  +    
  +# Migrate the "file" table to "topicfile", to avoid keyword issues with ODBC
  +# and Oracle.  Make sure the error values of the database connection are
  +# correctly set, to handle the most likely case where the "file" table doesn't
  +# even exist.  
  +$database->move_table("file", "topicfile");
  +
  +# Migrate the "comment" table to "commentdata", to avoid keyword issues with
  +# ODBC and Oracle.  Make sure the error values of the database connection are
  +# correctly set, to handle the most likely case where the "file" table doesn't
  +# even exist.
  +$database->move_table("comment", "commentdata");
  +
  +# Retrieve the tables which currently exist in the database, to determine
  +# which databases are missing.
  +my @existing_tables = $database->get_tables();
  +
  +foreach my $table (@tables) {
  +    my $table_name = $table->get_name();
  +    next if grep /^${table_name}$/i, @existing_tables;
  +
  +    print "Creating table " . $table->get_name() . "...\n";
  +    $database->create_table($table);
  +}
  +
  +# Make sure the database is committed before proceeding.
  +$database->commit();
  +
  +# Add new fields to the topic field when upgrading old databases.
  +$database->add_field('topic', 'repository', $TEXT);
  +$database->add_field('topic', 'projectid', $INT32);
  +$database->add_field('topic', 'start_tag', $TEXT);
  +$database->add_field('topic', 'end_tag', $TEXT);
  +$database->add_field('topic', 'module', $TEXT);
  +
  +# Add the new metric fields to the commentstatehistory table.
  +$database->add_field('commentstatehistory', 'metric_name', $TEXT);
  +$database->add_field('commentstatehistory', 'metric_value', $TEXT);
  +
  +# Add the new state field to the project table
  +$database->add_field('project', 'state', $INT16);
  +
  +# If we are using MySQL, and we are upgrading from a version of the database
  +# which used "text" instead of "mediumtext" for certain fields, update the
  +# appropriate table columns.
  +if ($Codestriker::db =~ /^DBI:mysql/i) {
  +    # Check that document field in topic is up-to-date.
  +    my $ref = $database->get_field_def("topic", "document");
  +    my $text_type = $database->_map_type($TEXT);
  +    if ($$ref[1] ne $text_type) {
  +	print "Updating topic table for document field to be $text_type...\n";
  +	$dbh->do("ALTER TABLE topic CHANGE document document $text_type") ||
  +	    die "Could not alter topic table: " . $dbh->errstr;
  +    }
  +}
  +
  +# If we are using MySQL, and we are upgrading from a version of the database
  +# which used TIMESTAMP instead of DATETIME for certain fields, update the
  +# appropriate table columns.
  +if ($Codestriker::db =~ /^DBI:mysql/i) {
  +
  +    my @old_time_fields = ( 
  +        [ 'topic','creation_ts'],
  +        [ 'topic','modified_ts'],
  +        [ 'topichistory','modified_ts'],
  +        [ 'topicviewhistory','creation_ts'],
  +        [ 'commentdata','creation_ts'],
  +        [ 'commentstate','creation_ts' ],
  +        [ 'commentstate','modified_ts'],
  +        [ 'commentstatehistory','modified_ts'],
  +        [ 'participant','modified_ts'],
  +        [ 'project','creation_ts'],
  +        [ 'project','modified_ts']
  +        );
  +
  +    foreach my $fields (@old_time_fields)
  +    {
  +        my $table = $fields->[0];
  +        my $field = $fields->[1];
  +
  +        my $ref = $database->get_field_def($table, $field);
  +        my $text_type = $database->_map_type($DATETIME);
  +        if ($$ref[1] ne $text_type) {
  +	    print "Updating $table table for $field field to be $text_type...\n";
  +	    $dbh->do("ALTER TABLE $table CHANGE $field $field $text_type") ||
  +	        die "Could not alter " . $table . " table: " . $dbh->errstr;
  +        }
  +    }
  +
  +}
  +
  +
  +# Determine if the commentdata and/or commentstate tables are old.
  +my $old_comment_table = $database->column_exists("commentdata", "line");
  +my $old_commentstate_table = $database->column_exists("commentstate", "line");
  +
  +if ($old_comment_table) {
  +    my %topicoffset_map;
  +    print "Detected old version of commentdata table, migrating...\n";
  +
  +    # Need to migrate the data to the new style of the table data.
  +
  +    my $stmt;
  +    if ($old_commentstate_table) {
  +	print "Detected old version of commentstate table, migrating...\n";
  +	# Update the commentstate table.
  +	move_old_table($commentstate_table, "topicid, line");
  +	move_old_table($commentdata_table, undef);
  +	$stmt =
  +	    $dbh->prepare_cached("SELECT topicid, state, line, version " .
  +				 "FROM commentstate_old");
  +	$stmt->execute();
  +	while (my ($topicid, $state, $line, $version) =
  +	       $stmt->fetchrow_array()) {
  +	    $topicoffset_map{"$topicid|$line"} =
  +		create_commentstate($topicid, $line, $state, $version);
  +	}
  +	$stmt->finish();
  +	$dbh->do('DROP TABLE commentstate_old');
  +    } else { 
  +	# Version of codestriker which didn't have a commentstate table.
  +	# Need to create new commentstate rows for each distinct comment
  +	# first, then update each individual comment row appropriately.
  +	move_old_table($commentdata_table, undef);
  +	
  +	$stmt = $dbh->prepare_cached('SELECT DISTINCT topicid, line ' .
  +				     'FROM commentdata_old');
  +	$stmt->execute();
  +	while (my ($topicid, $line) = $stmt->fetchrow_array()) {
  +	    print " Migrating comment for topic $topicid offset $line...\n";
  +
  +	    # Create a commentstate row for this comment.
  +	    my $id = create_commentstate($topicid, $line,
  +					 $Codestriker::COMMENT_SUBMITTED,
  +					 0);
  +	    $topicoffset_map{"$topicid|$line"} = $id;
  +	}
  +	$stmt->finish();
  +    }
  +    
  +    # Now update each comment row to refer to the appropriate commentstate
  +    # row.
  +    $stmt = $dbh->prepare_cached('SELECT topicid, commentfield, author, ' .
  +				 'line, creation_ts FROM commentdata_old');
  +    $stmt->execute();
  +    while (my ($topicid, $commentfield, $author, $line, $creation_ts) =
  +	   $stmt->fetchrow_array()) {
  +	
  +	# Update the associated row in the new comment table.
  +	my $insert = $dbh->prepare_cached('INSERT INTO commentdata ' .
  +					  '(commentstateid, commentfield, ' .
  +					  'author, creation_ts) VALUES ' .
  +					  '(?, ?, ?, ?)');
  +	print " Updating comment topicid $topicid offset $line...\n";
  +	$insert->execute($topicoffset_map{"$topicid|$line"},
  +			 $commentfield, $author, $creation_ts);
  +	$insert->finish();
  +    }
  +    $stmt->finish();
  +
  +    # Drop the old comment table.
  +    $dbh->do('DROP TABLE commentdata_old');
  +
  +    # Commit these changes.
  +    $database->commit();
  +    print "Done\n";
  +}
  +	
  +# Create the appropriate file and delta rows for each topic, if they don't
  +# already exist.  Apparently SQL Server doesn't allow multiple statements
  +# to be active at any given time (gack!) so store the topic list into an
  +# array first.  The things we do... what a bloody pain and potential
  +# memory hog.
  +my $stmt = $dbh->prepare_cached('SELECT id FROM topic');
  +$stmt->execute();
  +my @topic_list = ();
  +while (my ($topicid) = $stmt->fetchrow_array()) {
  +    push @topic_list, $topicid;
  +}
  +$stmt->finish();
  +
  +foreach my $topicid (@topic_list) {
  +    # Check if there is an associated delta record, and if not create it.
  +    my $check = $dbh->prepare_cached('SELECT COUNT(*) FROM delta ' .
  +				     'WHERE topicid = ?');
  +    $check->execute($topicid);
  +    my ($count) = $check->fetchrow_array();
  +    $check->finish();
  +    next if ($count != 0);
  +
  +    # Check if there is a file record for this topic.  If not, just create
  +    # a simple 1 file, 1 delta record, so that the old comment offsets are
  +    # preserved.
  +    $check = $dbh->prepare_cached('SELECT COUNT(*) FROM topicfile ' .
  +				  'WHERE topicid = ?');
  +    $check->execute($topicid);
  +    my ($filecount) = $check->fetchrow_array();
  +    $check->finish();
  +    
  +    # Determine what repository and document is associated with this topic.
  +    my $rep_stmt = $dbh->prepare_cached('SELECT repository, document '.
  +					'FROM topic WHERE id = ?');
  +    $rep_stmt->execute($topicid);
  +    my ($repository_url, $document) = $rep_stmt->fetchrow_array();
  +    $rep_stmt->finish();
  +    
  +    # Determine the appropriate repository object (if any) for this topic.
  +    my $repository = undef;
  +    if (defined $repository_url && $repository_url ne "") {
  +	$repository =
  +	    Codestriker::Repository::RepositoryFactory->get($repository);
  +    }
  +
  +    # Load the default repository if nothing has been set.
  +    if (! defined($repository)) {
  +	$repository_url = $Codestriker::valid_repositories[0];
  +	$repository =
  +	    Codestriker::Repository::RepositoryFactory->get($repository_url);
  +    }
  +    
  +    # Create a temporary file containing the document, so that the
  +    # standard parsing routines can be used.
  +    my $tmpfile = "tmptopic.txt";
  +    open(TEMP_FILE, ">$tmpfile") ||
  +	die "Failed to create temporary topic file \"$tmpfile\": $!";
  +    print TEMP_FILE $document;
  +    close TEMP_FILE;
  +    open(TEMP_FILE, "$tmpfile") ||
  +	die "Failed to open temporary file \"$tmpfile\": $!";
  +
  +    my @deltas = ();
  +    if ($filecount == 0) {
  +	# Parse the document as a single file, for backward compatibility,
  +	# so that the comment offsets are preserved.
  +	print "Creating 1 delta object for topic $topicid\n";
  +	@deltas =
  +	    Codestriker::FileParser::UnknownFormat->parse(\*TEMP_FILE);
  +
  +    } else {
  +	# Parse the document, and extract the diffs out of it.
  +	@deltas =
  +	    Codestriker::FileParser::Parser->parse(\*TEMP_FILE, "text/plain",
  +						   $repository, $topicid);
  +	print "Creating $#deltas deltas for topic $topicid\n";
  +	my $deletefile_stmt =
  +	    $dbh->prepare_cached('DELETE FROM topicfile WHERE topicid = ?');
  +	$deletefile_stmt->execute($topicid);
  +    }
  +
  +    print "Creating delta rows for topic $topicid\n";
  +    Codestriker::Model::File->create($dbh, $topicid, \@deltas,
  +				     $repository);
  +
  +    # Delete the temporary file.
  +    close TEMP_FILE;
  +    unlink($tmpfile);
  +}
  +$database->commit();
  +
  +# Check if the version to be upgraded has any project rows or not, and if
  +# not, link all topics to the default project.
  +$stmt = $dbh->prepare_cached('SELECT COUNT(*) FROM project');
  +$stmt->execute();
  +my ($project_count) = $stmt->fetchrow_array();
  +$stmt->finish();
  +if ($project_count == 0) {
  +    # Create a default project entry, which can then be modified by the user
  +    # later.
  +    print "Creating default project...\n";
  +    my $timestamp = Codestriker->get_timestamp(time);
  +    my $create = $dbh->prepare_cached('INSERT INTO project ' .
  +				      '(name, description, creation_ts, ' .
  +				      'modified_ts, version, state) ' .
  +				      'VALUES (?, ?, ?, ?, ?, ?) ');
  +    $create->execute('Default project', 'Default project description',
  +		     $timestamp, $timestamp, 0, 0);
  +
  +    # Get the id of this project entry.
  +    my $select = $dbh->prepare_cached('SELECT MIN(id) FROM project');
  +    $select->execute();
  +    my ($projectid) = $select->fetchrow_array();
  +    $select->finish();
  +
  +    # Now link all the topics in the system with this default project.
  +    print "Linking all topics to default project...\n";
  +    my $update = $dbh->prepare_cached('UPDATE topic SET projectid = ?');
  +    $update->execute($projectid);
  +}
  +$database->commit();
  +
  +# Check if the version to be upgraded has any project rows and if
  +# so set the default state to open.
  +$stmt = $dbh->prepare_cached('UPDATE project SET state = 0 WHERE state IS NULL');
  +$stmt->execute();
  +$database->commit();
  +
  +# Check if the data needs to be upgraded to the new commentstate metric
  +# scheme from the old state_id scheme.  For now, assume the old state-ids
  +# are the default values present in Codestriker.conf.  If they were changed
  +# by the user, they could always modify the DB values appropriately.
  +eval {
  +    $dbh->{PrintError} = 0;
  +
  +    # This array should reflect the value of @comment_states in your old
  +    # codestriker.conf file, and is used for data migration purposes.
  +    # This value represents the default value used in Codestriker.
  +    my @old_comment_states = ("Submitted", "Invalid", "Completed");
  +
  +    $stmt = $dbh->prepare_cached('SELECT id, state, creation_ts, modified_ts '.
  +				 'FROM commentstate WHERE state >= 0');
  +    $stmt->execute();
  +    
  +    my $update = $dbh->prepare_cached('UPDATE commentstate ' .
  +				      'SET state = ?, creation_ts = ?, ' .
  +				      'modified_ts = ? ' .
  +				      'WHERE id = ?');
  +    my $insert = $dbh->prepare_cached('INSERT INTO commentstatemetric ' .
  +				      '(id, name, value) VALUES (?, ?, ?) ');
  +    
  +    my $count = 0;
  +    my @update_rows = ();
  +    while (my ($id, $state, $creation_ts, $modified_ts) =
  +	   $stmt->fetchrow_array()) {
  +	if ($count == 0) {
  +	    print "Migrating old commentstate records... \n";
  +	    print "Have you updated the \@old_comment_states variable on line 767? (y/n): ";
  +	    flush STDOUT;
  +	    my $answer = <STDIN>;
  +	    chop $answer;
  +	    if (! ($answer =~ /^y/i)) {
  +		print "Aborting script... update \@old_comment_states in this script and run again.\n";
  +		$stmt->finish();
  +		exit(1);
  +	    }
  +	}
  +
  +	# We can't update this now due to ^%@$# SQL server, we do that below.
  +	my $value = $old_comment_states[$state];
  +	$value = "Unknown $state" unless defined $value;
  +	push @update_rows, { state => -$state - 1,
  +			     creation_ts => $creation_ts,
  +			     modified_ts => $modified_ts,
  +			     id => $id,
  +			     value => $value };
  +	$count++;
  +    }
  +    $stmt->finish();
  +
  +    foreach my $row (@update_rows) {
  +	# Update the state to its negative value, so the information isn't
  +	# lost, but also to mark it as being migrated.
  +	$update->execute($row->{state}, $row->{creation_ts}, $row->{modified_ts}, $row->{id});
  +	$insert->execute($row->{id}, "Status", $row->{value});
  +    }
  +    print "Migrated $count records.\n" if $count > 0;
  +
  +    # Now do the same for the commentstatehistory records.
  +    $stmt = $dbh->prepare_cached('SELECT id, state, version, modified_ts ' .
  +				 'FROM commentstatehistory ' .
  +				 'WHERE state >= 0');
  +    $stmt->execute();
  +    
  +    $update = $dbh->prepare_cached('UPDATE commentstatehistory ' .
  +				   'SET metric_name = ?, metric_value = ?, ' .
  +				   ' state = ?, modified_ts = ? ' .
  +				   'WHERE id = ? AND version = ?');
  +    $count = 0;
  +    @update_rows = ();
  +    while (my ($id, $state, $version, $modified_ts) =
  +	   $stmt->fetchrow_array()) {
  +	print "Migrating old commentstatehistory records...\n" if $count == 0;
  +	my $value = $old_comment_states[$state];
  +	$value = "Unknown $state" unless defined $value;
  +
  +	push @update_rows, { value=>$value, state=>-$state -1,
  +			     modified_ts=>$modified_ts, id=>$id,
  +			     version=>$version };
  +	$count++;
  +    }
  +    $stmt->finish();
  +
  +    foreach my $row (@update_rows) {
  +	$update->execute("Status", $row->{value}, $row->{state},
  +			 $row->{modified_ts}, $row->{id},
  +			 $row->{version});
  +    }
  +    print "Migrated $count records.\n" if $count > 0;
  +    $database->commit();
  +};
  +if ($@) {
  +    print "Failed because of $@\n";
  +}
  +
  +$dbh->{PrintError} = 1;
  +
  +# Now generate the contents of the codestriker.pl file, with the appropriate
  +# configuration details set (basically, the location of the lib dir).
  +print "Generating cgi-bin/codestriker.pl file...\n";
  +mkdir '../cgi-bin', 0755;
  +
  +my $template = Template->new();
  +
  +eval("use Template;");
  +die "Unable to load Template module: $@\n" if $@;
  +
  +my $template_vars = {};
  +
  +# For Win32, don't enable tainting mode.  There are weird issues with
  +# ActivePerl, and sometimes with IIS as well.
  +if ($windows) {
  +    $template_vars->{hash_ex_line} = '#!perl.exe -w';
  +} else {
  +    $template_vars->{hash_ex_line} = '#!/usr/bin/perl -wT';
  +}
  +
  +$template_vars->{codestriker_lib} = 'use lib \'' . cwd() . '/../lib\';';
  +
  +$template_vars->{codestriker_conf} = '\'' . cwd() . '/..\'';
  +
  +$template_vars->{has_rss} = !exists($missing_optional{'XML::RSS'});
  +
  +$template_vars->{scary_warning} = 
  +    "# !!!! THIS FILE IS AUTO-GENERATED by bin/install.pl !!!\n".
  +    "# !!!! DO NOT EDIT !!!\n".
  +    "# The base source is bin/codestriker.pl.base.\n";
  +
  +open(CODESTRIKER_PL, ">../cgi-bin/codestriker.pl")
  +    || die "Unable to create ../cgi-bin/codestriker.pl file: $!";
  +
  +$template->process("codestriker.pl.base", $template_vars,\*CODESTRIKER_PL);
  +close CODESTRIKER_PL;
  +
  +
  +# Make sure the generated file is executable.
  +chmod 0755, '../cgi-bin/codestriker.pl';
  +
  +# Clean out the contents of the data and template directory, but don't
  +# remove them.
  +print "Removing old generated templates...\n";
  +chdir('../cgi-bin') ||
  +    die "Couldn't change to cgi-dir directory: $!";
  +if (-d 'template/en') {
  +    print "Cleaning old template directory...\n";
  +    rmtree(['template/en'], 0, 1);
  +}
  +
  +print "Done\n";
  +
  +# Release the database connection.
  +$database->release_connection();
  +
  +
  
  
  
  
  
  Index: checksetup.pl
  ===================================================================
  RCS file: checksetup.pl
  diff -N checksetup.pl
  --- checksetup.pl	14 Feb 2005 21:52:15 -0000	1.66
  +++ /dev/null	1 Jan 1970 00:00:00 -0000
  @@ -1,1046 +0,0 @@
  -#!/usr/bin/perl -w
  -
  -###############################################################################
  -# Codestriker: Copyright (c) 2001, 2002 David Sitsky.  All rights reserved.
  -# si...@us...
  -#
  -# This program is free software; you can redistribute it and modify it under
  -# the terms of the GPL.
  -
  -# This script is similar to bugzilla's checksetup.pl.  It can be run whenever
  -# you like, but ideally should be done after every upgrade.  Currently the
  -# module does the following:
  -#
  -# - check for the required perl modules
  -# - creates the database "codestriker" if the database does not exist
  -# - creates the tables inside the database if they don't exist
  -# - authomatically changes the table definitions of older codestriker
  -#   installations, and does data migration automatically.
  -
  -use strict;
  -use Config;
  -
  -# Now load up the required modules.  Do this is a lazy fashion so that Perl
  -# doesn't try to grab this during compile time, otherwise nasty-looking
  -# error messages will appear to the user.
  -eval("use Cwd");
  -eval("use CPAN");
  -eval("use File::Path");
  -eval("use lib '../lib'");
  -eval("use Codestriker");
  -eval("use Codestriker::DB::Database");
  -eval("use Codestriker::DB::Column");
  -eval("use Codestriker::DB::Table");
  -eval("use Codestriker::DB::Index");
  -eval("use Codestriker::Action::SubmitComment");
  -eval("use Codestriker::Repository::RepositoryFactory");
  -eval("use Codestriker::FileParser::Parser");
  -eval("use Codestriker::FileParser::UnknownFormat");
  -eval("use Codestriker::Model::File");
  -
  -# Set this variables, to avoid compilation warnings below.
  -$Codestriker::COMMENT_SUBMITTED = 0;
  -@Codestriker::valid_repositories = ();
  -
  -# Initialise Codestriker, load up the configuration file.
  -Codestriker->initialise(cwd() . '/..');
  -
  -# Make sure the $db configuration variable has been set, and if not
  -# complain and exit.
  -if (! defined $Codestriker::db) {
  -    print STDERR
  -	"The database configuration variable \$db has not been set.\n";
  -    print STDERR
  -	"Please edit the codestriker.conf file and run this command again.\n";
  -    exit -1;
  -}
  -
  -# Indicate which modules are required for codestriker (this code is
  -# completely stolen more-or-less verbatim from Bugzilla)
  -my $modules = [ 
  -    { 
  -        name => 'LWP::UserAgent', 
  -        version => '0' 
  -    }, 
  -    { 
  -        name => 'CGI', 
  -        version => '2.56' 
  -    }, 
  -    { 
  -        name => 'Net::SMTP', 
  -        version => '0' 
  -    }, 
  -    { 
  -        name => 'DBI', 
  -        version => '1.13' 
  -    }, 
  -    { 
  -        name => 'Template', 
  -        version => '2.07' 
  -    },
  -    { 
  -        name => 'HTML::Entities', 
  -        version => '0' 
  -    },
  -    { 
  -        name => 'File::Temp', 
  -        version => '0' 
  -    },
  -    { 
  -        name => 'XML::RSS', 
  -        version => '1.05',
  -        optional => 1
  -    }
  -];
  -
  -# Retrieve the database module dependencies.  Put this in an eval block to
  -# handle the case where the user hasn't installed the DBI module yet,
  -# which prevents the following code from running.
  -my $database = undef;
  -eval {
  -    $database = Codestriker::DB::Database->get_database();
  -    push @{$modules}, $database->get_module_dependencies();
  -};
  -
  -my %missing_optional = ();
  -my %missing = ();
  -foreach my $module (@{$modules}) {
  -
  -    my $optional = exists($module->{optional}) && $module->{optional};
  -
  -    unless (have_vers($module->{name}, $module->{version},$optional)) { 
  -        if ( $optional == 0) {
  -        $missing{$module->{name}} = $module->{version};
  -    }
  -        else {
  -            $missing_optional{$module->{name}} = $module->{version};
  -        }
  -    }
  -}
  -
  -# vers_cmp is adapted from Sort::Versions 1.3 1996/07/11 13:37:00 kjahds,
  -# which is not included with Perl by default, hence the need to copy it here.
  -# Seems silly to require it when this is the only place we need it...
  -sub vers_cmp {
  -  if (@_ < 2) { die "not enough parameters for vers_cmp" }
  -  if (@_ > 2) { die "too many parameters for vers_cmp" }
  -  my ($a, $b) = @_;
  -  my (@A) = ($a =~ /(\.|\d+|[^\.\d]+)/g);
  -  my (@B) = ($b =~ /(\.|\d+|[^\.\d]+)/g);
  -  my ($A,$B);
  -  while (@A and @B) {
  -    $A = shift @A;
  -    $B = shift @B;
  -    if ($A eq "." and $B eq ".") {
  -      next;
  -    } elsif ( $A eq "." ) {
  -      return -1;
  -    } elsif ( $B eq "." ) {
  -      return 1;
  -    } elsif ($A =~ /^\d+$/ and $B =~ /^\d+$/) {
  -      return $A <=> $B if $A <=> $B;
  -    } else {
  -      $A = uc $A;
  -      $B = uc $B;
  -      return $A cmp $B if $A cmp $B;
  -    }
  -  }
  -  @A <=> @B;
  -}
  -
  -# This was originally clipped from the libnet Makefile.PL, adapted here to
  -# use the above vers_cmp routine for accurate version checking.
  -sub have_vers {
  -  my ($pkg, $wanted, $optional) = @_;
  -  my ($msg, $vnum, $vstr);
  -  no strict 'refs';
  -  printf("Checking for %15s %-9s ", $pkg, !$wanted?'(any)':"(v$wanted)");
  -
  -  eval { my $p; ($p = $pkg . ".pm") =~ s!::!/!g; require $p; };
  -
  -  $vnum = ${"${pkg}::VERSION"} || ${"${pkg}::Version"} || 0;
  -  $vnum = -1 if $@;
  -
  -  if ($vnum eq "-1") { # string compare just in case it's non-numeric
  -    if ( $optional ) {
  -        $vstr = "ok: not found, optional";
  -    } 
  -    else {
  -        $vstr = "    not found";
  -    }
  -
  -  }
  -  elsif (vers_cmp($vnum,"0") > -1) {
  -    $vstr = "found v$vnum";
  -  }
  -  else {
  -    $vstr = "found unknown version";
  -  }
  -
  -  my $vok = (vers_cmp($vnum,$wanted) > -1);
  -  print ((($vok) ? "ok: " : " "), "$vstr\n");
  -  return $vok;
  -}
  -
  -# Determine if this process is running under Windows, as the installation
  -# process is slightly different.
  -my $osname = $Config{'osname'};
  -my $windows = (defined $osname && $osname eq "MSWin32") ? 1 : 0;
  -
  -# Output any modules which may be missing.
  -if (%missing) {
  -
  -    # First, output the generic "missing module" message.
  -    print "\n\n";
  -    print "Codestriker requires some Perl modules which are either missing\n" .
  -	  "from your system, or the version on your system is too old.\n";
  -
  -    if ($windows) {
  -	foreach my $module (keys %missing) {
  -	    print " Missing \"$module\"\n";
  -	    if ($missing{$module} > 0) {
  -		print "   Minimum version required: $missing{$module}\n";
  -	    }
  -	}
  -
  -	print <<EOF;
  -
  -These can be installed by doing the following in PPM 2.0 (the version of ppm is
  -displayed when you start it up).
  -
  -C:\> ppm
  -
  -PPM> set repository oi http://openinteract.sourceforge.net/ppmpackages
  -PPM> set save
  -PPM> install (package-name)
  -
  -For PPM 3.0:
  -
  -C:\> ppm
  -PPM> rep add oi http://openinteract.sourceforge.net/ppmpackages
  -PPM> install (package-name)
  -
  -*NOTE* The Template package name may not be "Template" but "Template-Toolkit"
  -when entering the commands above.
  -
  -http://openinteract.sourceforge.net/cgi-bin/twiki/view/OI/ActivePerlPackages
  -has more information if you still have problems.
  -
  -Another repository of Perl packages is http://theoryx5.uwinnipeg.ca/ppmpackages
  -which also has mod_perl for Win32.
  -
  -The ActiveState default repository in PPM has almost all of the packages
  -required.
  -EOF
  -    }
  -    else {
  -	print "They can be installed by running (as root) the following:\n";
  -	foreach my $module (keys %missing) {
  -	    print "   perl -MCPAN -e 'install \"$module\"'\n";
  -	    if ($missing{$module} > 0) {
  -		print "   Minimum version required: $missing{$module}\n";
  -	    }
  -	}
  -	print "\n";
  -	print "Modules can also be downloaded from http://www.cpan.org.\n\n";
  -    }
  -
  -    if ($windows) {
  -	# Need to find out how to do automatic installs with PPM.
  -	exit -1;
  -    }
  -
  -    # Check we are running as root so the Perl modules can be properly
  -    # installed.
  -    print "\n";
  -
  -    if ($< != 0) {
  -        print "Execute this script as root so I can install these modules ";
  -        print "automatically.\n\n";
  -        exit -1;
  -    }
  -
  -    print "Shall I try to download and install these modules for you? (y/n): ";
  -    flush STDOUT;
  -    
  -    my $answer = <STDIN>;
  -    chop $answer;
  -    if ($answer =~ /^y/i) {
  -	# Try to install the modules using CPAN.
  -	foreach my $module (keys %missing) {
  -	    my $obj = CPAN::Shell->expand('Module', $module);
  -	    
  -	    if (! $obj->install) {
  -		print STDERR "\n\nFailed to install module: $module.\n";
  -		print STDERR "Try to install this module manually, " .
  -		    "and run this script again.\n\n";
  -		exit(1);
  -	    }
  -	}
  -	
  -    } else {
  -	# User decided to bail out.
  -	exit -1;
  -    }
  -}
  -
  -
  -# Obtain a database connection.
  -my $dbh = $database->get_connection();
  -
  -# Convenience methods and variables for creating table objects.
  -my $TEXT = $Codestriker::DB::Column::TYPE->{TEXT};
  -my $VARCHAR = $Codestriker::DB::Column::TYPE->{VARCHAR};
  -my $INT32 = $Codestriker::DB::Column::TYPE->{INT32};
  -my $INT16 = $Codestriker::DB::Column::TYPE->{INT16};
  -my $DATETIME = $Codestriker::DB::Column::TYPE->{DATETIME};
  -my $FLOAT = $Codestriker::DB::Column::TYPE->{FLOAT};
  -sub col { return Codestriker::DB::Column->new(@_); }
  -sub dbindex { return Codestriker::DB::Index->new(@_); }
  -sub table { return Codestriker::DB::Table->new(@_); }
  -
  -# The topic table.
  -my $topic_table =
  -  table(name => "topic",
  -	columns => [col(name=>"id", type=>$INT32, pk=>1),
  -		    col(name=>"author", type=>$VARCHAR, length=>255),
  -		    col(name=>"title", type=>$VARCHAR, length=>255),
  -		    col(name=>"description", type=>$TEXT),
  -		    col(name=>"document", type=>$TEXT),
  -		    col(name=>"state", type=>$INT16),
  -		    col(name=>"creation_ts", type=>$DATETIME),
  -		    col(name=>"modified_ts", type=>$DATETIME),
  -		    col(name=>"version", type=>$INT32),
  -		    col(name=>"start_tag", type=>$TEXT, mandatory=>0),
  -		    col(name=>"end_tag", type=>$TEXT, mandatory=>0),
  -		    col(name=>"module", type=>$TEXT, mandatory=>0),
  -		    col(name=>"repository", type=>$TEXT, mandatory=>0),
  -		    col(name=>"projectid", type=>$INT32)
  -		   ],
  -	indexes => [dbindex(name=>"author_idx", column_names=>["author"])]);
  -
  -# The topichistory table.  Holds information relating to how a topic
  -# has changed over time.  Only changeable topic attributes are
  -# recorded in this table.
  -my $topichistory_table =
  -  table(name => "topichistory",
  -	columns => [col(name=>"topicid", type=>$INT32, pk=>1),
  -		    col(name=>"author", type=>$VARCHAR, length=>255),
  -		    col(name=>"title", type=>$VARCHAR, length=>255),
  -		    col(name=>"description", type=>$TEXT, length=>255),
  -		    col(name=>"state", type=>$INT16),
  -		    col(name=>"modified_ts", type=>$DATETIME),
  -		    col(name=>"version", type=>$INT32, pk=>1),
  -		    col(name=>"repository", type=>$TEXT, mandatory=>0),
  -		    col(name=>"projectid", type=>$INT32),
  -		    col(name=>"reviewers", type=>$TEXT),
  -		    col(name=>"cc", type=>$TEXT, mandatory=>0),
  -		    col(name=>"modified_by_user", type=>$VARCHAR, length=>255, mandatory=>0)
  -		   ],
  -	indexes => [dbindex(name=>"th_idx", column_names=>["topicid"])]);
  -	
  -# Holds information as to when a user viewed a topic.
  -my $topicviewhistory_table =
  -  table(name => "topicviewhistory",
  -	columns => [col(name=>"topicid", type=>$INT32),
  -		    col(name=>"email", type=>$VARCHAR, length=>255, mandatory=>0),
  -		    col(name=>"creation_ts", type=>$DATETIME)
  -		   ],
  -	indexes => [dbindex(name=>"tvh_idx", column_names=>["topicid"])]);
  -
  -# Holds all of the metric data that is owned by a specific user on a specific 
  -# topic. One row per metric. Metric data that is left empty does not get a row.
  -my $topicusermetric_table =
  -  table(name => "topicusermetric",
  -	columns => [col(name=>"topicid", type=>$INT32, pk=>1),
  -		    col(name=>"email", type=>$VARCHAR, length=>255, pk=>1),
  -		    col(name=>"metric_name", type=>$VARCHAR, length=>80, pk=>1),
  -		    col(name=>"value", type=>$FLOAT)
  -		   ],
  -	indexes => [dbindex(name=>"tum_idx",
  -			    column_names=>["topicid", "email"])]);
  -
  -# Holds all of the metric data that is owned by a specific topic. One row per 
  -# metric. Metric data that is empty does not get a row.
  -my $topicmetric_table =
  -  table(name => "topicmetric",
  -	columns => [col(name=>"topicid", type=>$INT32, pk=>1),
  -		    col(name=>"metric_name", type=>$VARCHAR, length=>80,pk=>1),
  -		    col(name=>"value", type=>$FLOAT)
  -		   ],
  -	indexes => [dbindex(name=>"tm_idx", column_names=>["topicid"])]);
  -
  -# Holds record of which topics obsolete other topics, which is a many-to-many
  -# relationship.
  -my $topicobsolete_table =
  -  table(name => "topicobsolete",
  -	columns => [col(name=>"topicid", type=>$INT32, pk=>1),
  -		    col(name=>"obsoleted_by", type=>$INT32, pk=>1)
  -		   ],
  -	indexes => [dbindex(name=>"to1_idx", column_names=>["topicid"]),
  -		    dbindex(name=>"to2_idx", column_names=>["obsoleted_by"])]);
  -
  -# Hold a specific datum of column data entered by a specific user for a
  -# specific line.
  -my $commentdata_table =
  -  table(name => "commentdata",
  -	columns => [col(name=>"commentstateid", type=>$INT32),
  -		    col(name=>"commentfield", type=>$TEXT),
  -		    col(name=...
 
[truncated message content] | 
| 
      
      
      From: <si...@us...> - 2005-05-22 04:34:08
      
     | 
| Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=6346626&action=view User: sits Date: 05/05/21 21:33:39 Modified: . codestriker.conf doc codestriker.sgml edittopic.png html codestriker.js lib/Codestriker/Http Response.pm Log: Moved the add comment stuff back into an iframe, but still use XmlHttpRequest for sending and receiving the request so the tooltip can be disposed automatically if the comment was successfully added. This allows the tooltip window to be dragged around under all OS'es. Index: codestriker.conf =================================================================== RCS file: /cvsroot/codestriker/codestriker/codestriker.conf,v retrieving revision 1.69 retrieving revision 1.70 diff -u -r1.69 -r1.70 --- codestriker.conf 21 Feb 2005 11:25:00 -0000 1.69 +++ codestriker.conf 22 May 2005 04:33:36 -0000 1.70 @@ -366,7 +366,7 @@ # default_value=>'Submitted' }, # { name=>'Type', values=>['Style', 'Minor', 'Major', 'Severe'] } # ]; -# + # Four metrics defined: Status, Level, Mode and Type. #$comment_state_metrics = # [ Index: codestriker.sgml =================================================================== RCS file: /cvsroot/codestriker/codestriker/doc/codestriker.sgml,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- codestriker.sgml 24 Nov 2004 20:40:00 -0000 1.45 +++ codestriker.sgml 22 May 2005 04:33:37 -0000 1.46 @@ -136,7 +136,10 @@ <listitem> <para>unpacking and configuring Codestriker.</para> </listitem> - </itemizedlist> + </itemizedlist> + Note for Win32 systems, only use Perl 5.6.X and Apache 1.X. + The more recent versions have problems which prevent Codestriker + working correctly. </para> <sect1 id="codestriker-database-creation"> @@ -982,6 +985,8 @@ Perl is available by default for all UNIX systems. For Windows, you can download it for free from <ulink url="http://www.activestate.com/Products/Download/Download.plex?id=ActivePerl">http://www.activestate.com/Products/Download/Download.plex?id=ActivePerl</ulink>. + Only use Perl 5.6.X, as Perl 5.8.X for Win32 has issues that + prevent Codestriker from working correctly. </para> <para> To run <filename>checksetup.pl</filename> under UNIX, do the @@ -1018,7 +1023,8 @@ url="http://httpd.apache.org">http://httpd.apache.org</ulink>), which is available for download for both UNIX and Window platforms. Apache should be already available for most UNIX - distributions. + distributions. Apache 1.X is recommended for Win32 systems, + as 2.X may have issues with running Codestriker. </para> <para> <emphasis>Note any Codestriker or Apache configuration changes Index: edittopic.png =================================================================== RCS file: /cvsroot/codestriker/codestriker/doc/edittopic.png,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 Binary files /tmp/cvs6G4FpZ and /tmp/cvsuoMgbC differ Index: codestriker.js =================================================================== RCS file: /cvsroot/codestriker/codestriker/html/codestriker.js,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- codestriker.js 5 May 2005 09:35:25 -0000 1.7 +++ codestriker.js 22 May 2005 04:33:38 -0000 1.8 @@ -2,6 +2,12 @@ ol_fgcolor = '#FFFFCC'; ol_textsize = '2'; +// Codestriker XMLHttpRequest object that is used. +var cs_request; + +// Reference to status element. +var cs_status_element; + // Handle to the popup window. var windowHandle = ''; @@ -63,16 +69,21 @@ function add_comment_html(file, line, new_value) { // Get the location of the codestriker URL. - var l = location; + var l = top.location; var url = l.protocol + '//' + l.host + l.pathname; // Create the hidden error span, and the initial form, with the // appropriate hidden fields. - var html = + var html = '<html><head>' + + '<link rel="stylesheet" type="text/css" ' + + ' href="' + cs_css + '"/>\n' + + '<script src="' + cs_xbdhtml_js + '" type="text/javascript"></script>\n' + + '</head>\n' + + '<body bgcolor="#eeeeee">\n' + '<span class="hidden" id="statusField"> </span>\n' + '<form name="add_comment" method="POST" ' + 'action="' + url + '" ' + - 'onSubmit="return verify();" ' + + 'onSubmit="return top.verify(document.add_comment, getElt(\'statusField\'));" ' + 'enctype="application/x-www-form-urlencoded">\n' + '<input type="hidden" name="action" value="submit_comment">\n' + '<input type="hidden" name="line" value="' + line + '">\n' + @@ -83,17 +94,17 @@ '</textarea>\n'; // Now add in the metric dropdowns. - if (cs_metric_data.length > 0) { + if (top.cs_metric_data.length > 0) { html += '<p><table>\n'; } - for (var i = 0; i < cs_metric_data.length; i++) { + for (var i = 0; i < top.cs_metric_data.length; i++) { if (i % 2 == 0) { html += '<tr>\n'; } - html += '<td align="right">' + cs_metric_data[i].name + ':</td>\n'; + html += '<td align="right">' + top.cs_metric_data[i].name + ':</td>\n'; html += '<td align="left">\n'; html += '<select name="comment_state_metric_' + - cs_metric_data[i].name + '">\n'; + top.cs_metric_data[i].name + '">\n'; // Check if a value has been selected for this metric. var key = file + '|' + line + '|' + new_value; @@ -102,18 +113,18 @@ if (comment_number != null && comment_metrics[comment_number] != null) { current_value = - comment_metrics[comment_number][cs_metric_data[i].name]; + comment_metrics[comment_number][top.cs_metric_data[i].name]; } if (current_value == null) { // If there is no default value defined, create an empty setting. - if (cs_metric_data[i].default_value == null) { + if (top.cs_metric_data[i].default_value == null) { html += '<option value="Select Value">' + '<Select Value></option>\n'; } - for (var j = 0; j < cs_metric_data[i].values.length; j++) { + for (var j = 0; j < top.cs_metric_data[i].values.length; j++) { html += '<option '; - var value = cs_metric_data[i].values[j]; - if (value == cs_metric_data[i].default_value) { + var value = top.cs_metric_data[i].values[j]; + if (value == top.cs_metric_data[i].default_value) { html += 'selected '; } html += 'value="' + value + '">' + value + '</option>\n'; @@ -122,8 +133,8 @@ else { // This metric does have a current value selected. var found_current_value = 0; - for (var j = 0; j < cs_metric_data[i].values.length; j++) { - var value = cs_metric_data[i].values[j]; + for (var j = 0; j < top.cs_metric_data[i].values.length; j++) { + var value = top.cs_metric_data[i].values[j]; if (value == current_value) { html += '<option selected value="' + value + '">' + value + '</option>\n'; @@ -145,11 +156,11 @@ } html += '</select>\n'; html += '    </td>\n'; - if (i % 2 == 1 || i == cs_metric_data.length-1) { + if (i % 2 == 1 || i == top.cs_metric_data.length-1) { html += '</tr>\n'; } } - if (cs_metric_data.length > 0) { + if (top.cs_metric_data.length > 0) { html += '</table>\n'; } @@ -161,23 +172,24 @@ 'value="' + cs_email + '">\n' + '</td><td></td></tr><tr>' + '<td>Cc: <font size="-1">' + - '<a href="javascript:add_other_reviewers();">' + + '<a href="javascript:top.add_other_reviewers(document.add_comment);">' + '(add other reviewers)</a></font> </td>' + '<td>' + '<input type="text" name="comment_cc" size="25" ' + 'maxlength="150"></td>\n' + '<td><input type="submit" name="submit" value="Submit"></td>' + - '</tr></table></form>\n'; + '</tr></table></form></body></html>\n'; // Return the generated html. return html; } // Verify that a comment is ready to be shipped out. -function verify() +function verify(comment_form, status_field) { - // Get a reference to the comment form. - var comment_form = document.add_comment; + // Set the global status element so it can be updated when + // the request is being sent and received. + top.cs_status_element = status_field; // Check that the comment field has a comment entered in it. if (comment_form.comments.value == '') { @@ -192,8 +204,8 @@ } // Check that the metrics have been set. - for (var i = 0; i < cs_metric_data.length; i++) { - var metric_name = cs_metric_data[i].name; + for (var i = 0; i < top.cs_metric_data.length; i++) { + var metric_name = top.cs_metric_data[i].name; var name = 'comment_state_metric_' + metric_name; var index = comment_form.elements[name].options.selectedIndex; if (index == -1) { @@ -221,9 +233,9 @@ params += '&comment_cc=' + escape(comment_form.comment_cc.value); params += '&format=xml'; - for (var i = 0; i < cs_metric_data.length; i++) { + for (var i = 0; i < top.cs_metric_data.length; i++) { var comment_param = - escape('comment_state_metric_' + cs_metric_data[i].name); + escape('comment_state_metric_' + top.cs_metric_data[i].name); params += '&' + comment_param + '=' + escape(eval('comment_form.' + comment_param + '.value')); } @@ -232,11 +244,8 @@ } // Add all the other reviews into the Cc field of the comment frame. -function add_other_reviewers() +function add_other_reviewers(comment_form) { - // Get a reference to the comment form. - var comment_form = document.add_comment; - // Find out who the reviewers are for this review. var reviewers = topic_reviewers.split(/[\s,]+/); @@ -274,18 +283,19 @@ { var html = '<a href="javascript:hideElt(getElt(\'overDiv\')); void(0);">' + 'Close</a><p>' + - add_comment_html(file,line,new_value); - overlib(html, STICKY, DRAGGABLE, CENTERPOPUP); + '<iframe width="480" height="300" name="comment_frame" ' + + 'src="javascript:top.add_comment_html(' + + file + ',' + line + ',' + new_value + ');">' + + 'Can\'t view iframe</iframe>'; + overlib(html, STICKY, DRAGGABLE, ALTCUT, CENTERPOPUP, WIDTH, 480, + HEIGHT, 300); } -// Codestriker XMLHttpRequest object that is used. -var cs_request; - // Function for posting to Codestriker using the XMLHttpRequest object. function postXMLDoc(params) { // Generate the basic Codestriker URL. - var l = location; + var l = top.location; var url = l.protocol + '//' + l.host + l.pathname; // Check for Mozilla/Safari. @@ -299,7 +309,7 @@ // If the request object was created, generate the request. if (cs_request) { - cs_request.onreadystatechange = processReqChange; + cs_request.onreadystatechange = top.processReqChange; cs_request.open("POST", url, true); cs_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); @@ -310,10 +320,9 @@ // Function for updating the status text in the add comment tooltip. function setStatusText(newStatusText) { - var statusElt = document.getElementById('statusField'); - statusElt.className = 'error'; + cs_status_element.className = 'error'; var newStatusTextNode = document.createTextNode(newStatusText); - statusElt.replaceChild(newStatusTextNode, statusElt.childNodes[0]); + cs_status_element.replaceChild(newStatusTextNode, cs_status_element.childNodes[0]); } // Function for handling state changes to the request object. @@ -322,7 +331,7 @@ // Only check for completed requests. if (cs_request.readyState == 4) { if (cs_request.status == 200) { - var response = cs_request.responseXML.documentElement; + var response = top.cs_request.responseXML.documentElement; result = response.getElementsByTagName('result')[0].firstChild.data; if (result == 'OK') { // Hide the popup if the comment was successful. Index: Response.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Response.pm,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- Response.pm 5 May 2005 09:35:27 -0000 1.30 +++ Response.pm 22 May 2005 04:33:38 -0000 1.31 @@ -244,6 +244,8 @@ print " var cs_reload = $reload;\n"; print " var cs_topicid = $topic->{topicid};\n" if defined $topic; print " var cs_email = '$email';\n" if defined $email; + print " var cs_css = '$codestriker_css';\n"; + print " var cs_xbdhtml_js = '$xbdhtml_js';\n"; # Now output all of the comment metric information. print " var cs_metric_data = new Array();\n"; | 
| 
      
      
      From: <si...@us...> - 2005-05-22 04:34:03
      
     | 
| Topic "CVS commit: Moved the add comment stuff back into an ifra..." Author: si...@us... Reviewers: cod...@li... URL: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=6346626&action=view -------------------------------------------------------------- Description: Moved the add comment stuff back into an iframe, but still use XmlHttpRequest for sending and receiving the request so the tooltip can be disposed automatically if the comment was successfully added. This allows the tooltip window to be dragged around under all OS'es. -------------------------------------------------------------- The topic was created with the following files: codestriker/codestriker.conf codestriker/doc/codestriker.sgml /tmp/cvsuoMgbC codestriker/html/codestriker.js codestriker/lib/Codestriker/Http/Response.pm | 
| 
      
      
      From: <si...@us...> - 2005-05-05 09:35:52
      
     | 
| Created Codestriker topic at: http://codestriker.sourceforge.net/cgi-bin/codestriker.pl?topic=46167&action=view User: sits Date: 05/05/05 02:35:28 Modified: html codestriker.css codestriker.js lib/Codestriker/Action SubmitNewComment.pm lib/Codestriker/Http Input.pm Response.pm template/en/default submitnewcomment.html.tmpl Log: Comment tooltip now uses XMLHttpRequest object rather than using an iframe. Modified SubmitNewCommentAction so that it can send an XML reply, if that is what the format parameter requested. The tooltip is dragged by Control-LeftMouseButton. This needed to be changed otherwise text could not be entered into the comment fields. There may be a way of have a "Drag" link, which can activate the drag, as on my Linux box, the window manage grabs the Control-LeftMouseButton event, and drags the entire browser window! Index: codestriker.css =================================================================== RCS file: /cvsroot/codestriker/codestriker/html/codestriker.css,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- codestriker.css 17 Feb 2005 21:29:33 -0000 1.11 +++ codestriker.css 5 May 2005 09:35:25 -0000 1.12 @@ -141,3 +141,6 @@ TD.space {background-color: #eeeeee} A.tab {text-decoration: none} +/* Styles for error field in comment posting tooltip. */ +span.hidden {display: none} +span.error {display: inline; color: red} Index: codestriker.js =================================================================== RCS file: /cvsroot/codestriker/codestriker/html/codestriker.js,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- codestriker.js 24 Feb 2005 09:44:33 -0000 1.6 +++ codestriker.js 5 May 2005 09:35:25 -0000 1.7 @@ -52,7 +52,7 @@ var comment_number = comment_hash[anchor]; if (comment_number != null) { // We have a comment on this line, bring up the tooltip. - overlib(comment_text[comment_number], STICKY, DRAGGABLE, ALTCUT, + overlib(comment_text[comment_number], STICKY, DRAGGABLE, FIXX, getEltPageLeft(getElt('c' + comment_number)), FIXY, getEltPageTop(getElt('c' + comment_number))); } @@ -63,55 +63,57 @@ function add_comment_html(file, line, new_value) { // Get the location of the codestriker URL. - var l = top.location; + var l = location; var url = l.protocol + '//' + l.host + l.pathname; - // Create the initial form, with the appropriate hidden fields. - var html = '<html><body bgcolor="#eeeeee">\n' + + // Create the hidden error span, and the initial form, with the + // appropriate hidden fields. + var html = + '<span class="hidden" id="statusField"> </span>\n' + '<form name="add_comment" method="POST" ' + 'action="' + url + '" ' + - 'onSubmit="return top.verify();" ' + + 'onSubmit="return verify();" ' + 'enctype="application/x-www-form-urlencoded">\n' + '<input type="hidden" name="action" value="submit_comment">\n' + '<input type="hidden" name="line" value="' + line + '">\n' + '<input type="hidden" name="topic" value="' + cs_topicid + '">\n' + '<input type="hidden" name="fn" value="' + file + '">\n' + - '<input type="hidden" name="new" value="' + new_value + '">\n' + + '<input type="hidden" name="newval" value="' + new_value + '">\n' + '<textarea name="comments" rows="5" cols="50" wrap="hard">\n' + '</textarea>\n'; // Now add in the metric dropdowns. - if (top.cs_metric_data.length > 0) { + if (cs_metric_data.length > 0) { html += '<p><table>\n'; } - for (var i = 0; i < top.cs_metric_data.length; i++) { + for (var i = 0; i < cs_metric_data.length; i++) { if (i % 2 == 0) { html += '<tr>\n'; } - html += '<td align="right">' + top.cs_metric_data[i].name + ':</td>\n'; + html += '<td align="right">' + cs_metric_data[i].name + ':</td>\n'; html += '<td align="left">\n'; html += '<select name="comment_state_metric_' + - top.cs_metric_data[i].name + '">\n'; + cs_metric_data[i].name + '">\n'; // Check if a value has been selected for this metric. var key = file + '|' + line + '|' + new_value; - var comment_number = top.comment_hash[key]; + var comment_number = comment_hash[key]; var current_value = null; if (comment_number != null && - top.comment_metrics[comment_number] != null) { + comment_metrics[comment_number] != null) { current_value = - top.comment_metrics[comment_number][top.cs_metric_data[i].name]; + comment_metrics[comment_number][cs_metric_data[i].name]; } if (current_value == null) { // If there is no default value defined, create an empty setting. - if (top.cs_metric_data[i].default_value == null) { + if (cs_metric_data[i].default_value == null) { html += '<option value="Select Value">' + '<Select Value></option>\n'; } - for (var j = 0; j < top.cs_metric_data[i].values.length; j++) { + for (var j = 0; j < cs_metric_data[i].values.length; j++) { html += '<option '; - var value = top.cs_metric_data[i].values[j]; - if (value == top.cs_metric_data[i].default_value) { + var value = cs_metric_data[i].values[j]; + if (value == cs_metric_data[i].default_value) { html += 'selected '; } html += 'value="' + value + '">' + value + '</option>\n'; @@ -120,8 +122,8 @@ else { // This metric does have a current value selected. var found_current_value = 0; - for (var j = 0; j < top.cs_metric_data[i].values.length; j++) { - var value = top.cs_metric_data[i].values[j]; + for (var j = 0; j < cs_metric_data[i].values.length; j++) { + var value = cs_metric_data[i].values[j]; if (value == current_value) { html += '<option selected value="' + value + '">' + value + '</option>\n'; @@ -143,11 +145,11 @@ } html += '</select>\n'; html += '    </td>\n'; - if (i % 2 == 1 || i == top.cs_metric_data.length-1) { + if (i % 2 == 1 || i == cs_metric_data.length-1) { html += '</tr>\n'; } } - if (top.cs_metric_data.length > 0) { + if (cs_metric_data.length > 0) { html += '</table>\n'; } @@ -159,13 +161,13 @@ 'value="' + cs_email + '">\n' + '</td><td></td></tr><tr>' + '<td>Cc: <font size="-1">' + - '<a href="javascript:top.add_other_reviewers();">' + + '<a href="javascript:add_other_reviewers();">' + '(add other reviewers)</a></font> </td>' + '<td>' + '<input type="text" name="comment_cc" size="25" ' + 'maxlength="150"></td>\n' + '<td><input type="submit" name="submit" value="Submit"></td>' + - '</tr></table></form></body></html>\n'; + '</tr></table></form>\n'; // Return the generated html. return html; @@ -175,7 +177,7 @@ function verify() { // Get a reference to the comment form. - var comment_form = top.comment_frame.document.add_comment; + var comment_form = document.add_comment; // Check that the comment field has a comment entered in it. if (comment_form.comments.value == '') { @@ -190,8 +192,8 @@ } // Check that the metrics have been set. - for (var i = 0; i < top.cs_metric_data.length; i++) { - var metric_name = top.cs_metric_data[i].name; + for (var i = 0; i < cs_metric_data.length; i++) { + var metric_name = cs_metric_data[i].name; var name = 'comment_state_metric_' + metric_name; var index = comment_form.elements[name].options.selectedIndex; if (index == -1) { @@ -206,18 +208,37 @@ } } - // If we reached here, then all metrics have been set. - return true; + // If we reached here, then all metrics have been set. Send the + // request as an XMLHttpRequest, and return false so the browser + // does nothing else. + var params = 'action=submit_comment'; + params += '&line=' + escape(comment_form.line.value); + params += '&topic=' + escape(comment_form.topic.value); + params += '&fn=' + escape(comment_form.fn.value); + params += '&new=' + escape(comment_form.newval.value); + params += '&comments=' + escape(comment_form.comments.value); + params += '&email=' + escape(comment_form.email.value); + params += '&comment_cc=' + escape(comment_form.comment_cc.value); + params += '&format=xml'; + + for (var i = 0; i < cs_metric_data.length; i++) { + var comment_param = + escape('comment_state_metric_' + cs_metric_data[i].name); + params += '&' + comment_param + '=' + + escape(eval('comment_form.' + comment_param + '.value')); + } + postXMLDoc(params); + return false; } // Add all the other reviews into the Cc field of the comment frame. function add_other_reviewers() { // Get a reference to the comment form. - var comment_form = top.comment_frame.document.add_comment; + var comment_form = document.add_comment; // Find out who the reviewers are for this review. - var reviewers = top.topic_reviewers.split(/[\s,]+/); + var reviewers = topic_reviewers.split(/[\s,]+/); // Now check each reviewer to see if it can be added into the Cc field. for (var i = 0; i < reviewers.length; i++) { @@ -247,16 +268,81 @@ } -// Create a new tooltip window which contains an iframe used for adding +// Create a new tooltip window which contains the html used for adding // a comment to the topic. function add_comment_tooltip(file, line, new_value) { var html = '<a href="javascript:hideElt(getElt(\'overDiv\')); void(0);">' + 'Close</a><p>' + - '<iframe width="480" height="300" name="comment_frame" ' + - 'src="javascript:top.add_comment_html(' + - file + ',' + line + ',' + new_value + ');">' + - 'Can\'t view iframe</iframe>'; - overlib(html, STICKY, DRAGGABLE, ALTCUT, CENTERPOPUP, WIDTH, 480, - HEIGHT, 300); + add_comment_html(file,line,new_value); + overlib(html, STICKY, DRAGGABLE, CENTERPOPUP); } + +// Codestriker XMLHttpRequest object that is used. +var cs_request; + +// Function for posting to Codestriker using the XMLHttpRequest object. +function postXMLDoc(params) +{ + // Generate the basic Codestriker URL. + var l = location; + var url = l.protocol + '//' + l.host + l.pathname; + + // Check for Mozilla/Safari. + if (window.XMLHttpRequest) { + cs_request = new XMLHttpRequest(); + } + // Check for IE. + else if (window.ActiveXObject) { + cs_request = new ActiveXObject("Microsoft.XMLHTTP"); + } + + // If the request object was created, generate the request. + if (cs_request) { + cs_request.onreadystatechange = processReqChange; + cs_request.open("POST", url, true); + cs_request.setRequestHeader("Content-Type", + "application/x-www-form-urlencoded"); + cs_request.send(params); + } +} + +// Function for updating the status text in the add comment tooltip. +function setStatusText(newStatusText) +{ + var statusElt = document.getElementById('statusField'); + statusElt.className = 'error'; + var newStatusTextNode = document.createTextNode(newStatusText); + statusElt.replaceChild(newStatusTextNode, statusElt.childNodes[0]); +} + +// Function for handling state changes to the request object. +function processReqChange() +{ + // Only check for completed requests. + if (cs_request.readyState == 4) { + if (cs_request.status == 200) { + var response = cs_request.responseXML.documentElement; + result = response.getElementsByTagName('result')[0].firstChild.data; + if (result == 'OK') { + // Hide the popup if the comment was successful. + hideElt(getElt('overDiv')); + } + else { + // An error occurred, show this in the tooltip, and leave + // it up. + setStatusText(result); + } + } + else { + alert("There was a problem retrieving the XML data:\n" + + cs_request.statusText); + } + } + else if (cs_request.readyState == 3) { + setStatusText('Receiving response...'); + } + else if (cs_request.readyState == 2) { + setStatusText('Request sent...'); + } +} \ No newline at end of file Index: SubmitNewComment.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Action/SubmitNewComment.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- SubmitNewComment.pm 1 Mar 2005 10:12:49 -0000 1.6 +++ SubmitNewComment.pm 5 May 2005 09:35:26 -0000 1.7 @@ -34,6 +34,7 @@ my $cc = $http_input->get('comment_cc'); my $mode = $http_input->get('mode'); my $anchor = $http_input->get('a'); + my $format = $http_input->get('format'); # Check that the fields have been filled appropriately. if ($comments eq "" || !defined $comments) { @@ -71,31 +72,41 @@ if ( $listener_response ne '') { $http_response->error($listener_response); } - - # Display a simple screen indicating that the comment has been registered. - # Clicking the Close button simply dismisses the edit popup. Leaving it - # up will ensure the next editing topic will be handled quickly, as the - # overhead of bringing up a new window is removed. - my $reload = $query->param('submit') eq 'Submit+Refresh' ? 1 : 0; - $http_response->generate_header(topic=>$topic, - topic_title=>"Comment Submitted: $topic->{title}", - email=>$email, - repository=>$topic->{repository}, - load_anchor=>$anchor, - reload=>$reload, cache=>0); + + if (defined $format && $format eq "xml") { + print $query->header(-content_type=>'text/xml'); + print "<?xml version=\"1.0\" encoding=\"UTF-8\" " . + "standalone=\"yes\"?>\n"; + print "<response><method>submitnewcomment</method>" . + "<result>OK</result></response>\n"; + } else { + # Display a simple screen indicating that the comment has been + # registered. Clicking the Close button simply dismisses the + # edit popup. Leaving it # up will ensure the next editing + # topic will be handled quickly, as the # overhead of bringing + # up a new window is removed. + my $reload = $query->param('submit') eq 'Submit+Refresh' ? 1 : 0; + $http_response->generate_header(topic=>$topic, + topic_title=>"Comment Submitted: " . + "$topic->{title}", + email=>$email, + repository=>$topic->{repository}, + load_anchor=>$anchor, + reload=>$reload, cache=>0); - my $view_topic_url = $url_builder->view_url($topicid, $line, $mode); - my $view_comments_url = $url_builder->view_comments_url($topicid); + my $view_topic_url = $url_builder->view_url($topicid, $line, $mode); + my $view_comments_url = $url_builder->view_comments_url($topicid); - my $vars = {}; - $vars->{'view_topic_url'} = $view_topic_url; - $vars->{'view_comments_url'} = $view_comments_url; - $vars->{'comment'} = $comments; - - my $template = Codestriker::Http::Template->new("submitnewcomment"); - $template->process($vars); + my $vars = {}; + $vars->{'view_topic_url'} = $view_topic_url; + $vars->{'view_comments_url'} = $view_comments_url; + $vars->{'comment'} = $comments; + + my $template = Codestriker::Http::Template->new("submitnewcomment"); + $template->process($vars); - $http_response->generate_footer(); + $http_response->generate_footer(); + } } # Given a topic and topic line number, try to determine the line Index: Input.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Input.pm,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- Input.pm 3 Nov 2004 20:48:33 -0000 1.41 +++ Input.pm 5 May 2005 09:35:27 -0000 1.42 @@ -102,7 +102,7 @@ $self->{end_tag} = $query->param('end_tag'); $self->{module} = $query->param('module'); $self->{topic_sort_change} = $query->param('topic_sort_change'); - $self->{content} = $query->param('content'); + $self->{format} = $query->param('format'); $self->{obsoletes} = $query->param('obsoletes'); my @selected_topics = $query->param('selected_topics'); $self->{selected_topics} = \@selected_topics; @@ -124,7 +124,7 @@ $self->{project_description} = "" if ! defined $self->{project_description}; $self->{project_state} = "" if ! defined $self->{project_state}; $self->{topic_sort_change} = "" if ! defined $self->{topic_sort_change}; - $self->{content} = "html" if ! defined $self->{content}; + $self->{format} = "html" if ! defined $self->{format}; $self->{obsoletes} = "" if ! defined $self->{obsoletes}; $self->{default_to_head} = 0 if ! defined $self->{default_to_head}; Index: Response.pm =================================================================== RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Http/Response.pm,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- Response.pm 1 Mar 2005 10:12:53 -0000 1.29 +++ Response.pm 5 May 2005 09:35:27 -0000 1.30 @@ -22,6 +22,8 @@ my $self = {}; $self->{header_generated} = 0; $self->{query} = $query; + $self->{format} = $query->param('format'); + $self->{action} = $query->param('action'); return bless $self, $type; } @@ -440,15 +442,29 @@ my ($self, $error_message) = @_; my $query = $self->{query}; - if (! $self->{generated_header}) { - print $query->header, $query->start_html(-title=>'Codestriker error', - -bgcolor=>'white'); + + # Check if the expected format is XML. + if (defined $self->{format} && $self->{format} eq "xml") { + print $query->header(-content_type=>'text/xml'); + print "<?xml version=\"1.0\" encoding=\"UTF-8\" " . + "standalone=\"yes\"?>\n"; + print "<response><method>" . $self->{action} . "</method>" . + "<result>" . HTML::Entities::encode($error_message) . + "</result></response>\n"; } + else { + if (! $self->{generated_header}) { + print $query->header, + $query->start_html(-title=>'Codestriker error', + -bgcolor=>'white'); + } - print $query->p, "<FONT COLOR='red'>$error_message</FONT>", $query->p; - print $query->end_html(); + print $query->p, "<FONT COLOR='red'>$error_message</FONT>", $query->p; + print $query->end_html(); + + $self->generate_footer(); + } - $self->generate_footer(); exit; } Index: submitnewcomment.html.tmpl =================================================================== RCS file: /cvsroot/codestriker/codestriker/template/en/default/submitnewcomment.html.tmpl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- submitnewcomment.html.tmpl 24 Feb 2005 09:41:01 -0000 1.6 +++ submitnewcomment.html.tmpl 5 May 2005 09:35:27 -0000 1.7 @@ -1,7 +1,20 @@ [%# Screen for the submit comment confirmation screen. #%] -</head> -<body bgcolor="#eeeeee"> -<h2>Comment submitted</h2> -</body> -</html> +[% PROCESS header.html.tmpl version = version displaymenu = 1 + closehead = 1 help="" %] + +<H2>Comment submitted</H2> +<P> +<PRE>[% comment | html_entity %] +</PRE><P> + +[%# Display a simple form for closing the comment popup window #%] +<FORM METHOD="POST" ENCTYPE="application/x-www-form-urlencoded"> +<INPUT TYPE="submit" NAME=".submit" VALUE="Close" + ONCLICK="window.close()"> +</FORM> + +[% PROCESS trailer.html.tmpl %] + +</BODY> +</HTML> |