Software Freedom Law Center

Changeset 10

Show
Ignore:
Timestamp:
12/22/05 16:03:07 (3 years ago)
Author:
orion
Message:

had to make some changes to some things in .../rt/NoAuth

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/searchhi.js

    r5 r10  
    11/* This is believed to be copyrighted by Stuart Langridge; the license is */ 
    22/* unkowning but we are clarifying with the author.  */ 
     3/* The MIT Licence, for code from kryogenix.org 
     4** 
     5** Code downloaded from the Browser Experiments section of kryogenix.org 
     6** is licenced under the so-called MIT licence. The licence is below. 
     7** 
     8** Copyright (c) 1997-2005 Stuart Langridge 
     9** 
     10** Permission is hereby granted, free of charge, to any person obtaining a 
     11** copy of this software and associated documentation files (the "Software"), 
     12** to deal in the Software without restriction, including without limitation 
     13** the rights to use, copy, modify, merge, publish, distribute, sublicense, 
     14** and/or sell copies of the Software, and to permit persons to whom the 
     15** Software is furnished to do so, subject to the following conditions: 
     16** 
     17** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     18** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     19** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     20** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     21** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
     22** FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
     23** DEALINGS IN THE SOFTWARE. 
     24*/ 
    325 
    426/* http://www.kryogenix.org/code/browser/searchhi/ */ 
  • trunk/selectxpath.xsl

    r7 r10  
    3030      </head> 
    3131      <body onkeypress="checkKeyPressed(event);" bgcolor="#FFFFFF"> 
     32<div id="topbar" class="topbar"> 
     33<span id="statustext" class="statustext">Loading comments.  If you're still reading this, it's a strong indication that we do not properly support your browser.  You may need to email your comments instead, or try another recent Gecko-based browser.</span>          <span id="querydiv" style="display:none"></span> 
     34          <span id="login" class="login"></span> 
     35</div> 
    3236        <div id="maintext"> 
    3337          <xsl:apply-templates/> 
     
    4852 
    4953  <xsl:template match="//head"> 
    50     <h1><xsl:value-of select="title"/></h1> 
    51     <p><xsl:value-of select="pubdate"/></p> 
    52     <p>Copyright (C) <xsl:value-of select="copyright/year"/>  
     54    <section id="title"><p id="title.0"><sent id="title.0.0"><h1><xsl:value-of select="title"/></h1></sent></p> 
     55    <p id="title.1"><sent id="title.1.0"><xsl:value-of select="pubdate"/></sent></p> 
     56    <p id="status.0"><sent id="status.0.0"><strong><xsl:value-of select="status"/></strong></sent></p> 
     57    <p id="copyright.0"><sent id="copyright.0.0">Copyright (C) <xsl:value-of select="copyright/year"/>  
     58     
    5359    <xsl:text> </xsl:text> 
    5460    <xsl:value-of select="copyright/holder"/> 
     
    6571    <br/> <br/> 
    6672    <xsl:value-of select="legalnotice/p"/> 
    67     </p> 
    68      
     73    </sent></p> 
     74    </section>     
     75 
    6976  </xsl:template> 
    7077   
    7178  <xsl:template match="//body"> 
    72     <p><a href="javascript:XpathSel()">select some text and then type "c" to submit comments.</a> 
    73     <p><a href="javascript:LimitQuery()">limit your query by various criteria.</a></p> 
    74   </p> 
    75     <p>Toggle display of <a href="javascript:toggle('add')">additions</a> | <a href="javascript:toggle('del')">deletions</a></p> 
     79    <p><a href="javascript:XpathSel()">select some text and then type "c" to submit comments.</a></p> 
     80 
     81<!--    <p><strong>Notes 2006-01-04</strong> I've broken through a few logjams that have been preventing many comments from displaying, and I'm glad to have exposed several other problems with my method for inserting these comments, but also to see all the comments that have been made so far.  The current implementation was already a plan B, and so now I need a plan C.  Also I see many of the &lt;em&gt; are not being closed.</p> 
     82 
     83        <p><strong>Notes 2006-01-06</strong> 
     84        <ul> 
     85        <li>You can now agree with a comment, or once you've agreed you may revoke your agreement if you change your mind.</li> 
     86        <li>Comments are now excerpted if they're long.  Toggle them by clicking anywhere on them, or on the [+]</li> 
     87        <li>agreement/disagreement/ticketlink are all behind the [+] now</li> 
     88        <li>Comments now ask you to put a subject or summary: a change in presumption, from presuming brevity to presuming lengthiness.</li> 
     89        </ul> 
     90        </p> 
     91 
     92    <p>Also, you now need to be <a href="http://gplv3.fsf.org:8800/launch/login_form">logged in</a> to the main gplv3.fsf.org site in order to make comments.  Alert box to this effect coming soon.</p> 
     93 
     94--> 
     95<!--    <p>Toggle display of <a href="javascript:toggle('add')">additions</a> | <a href="javascript:toggle('del')">deletions</a> [none yet on these documents]</p> --> 
    7696 
    7797    <xsl:for-each select="section"> 
    78       <h2><xsl:value-of select="title"/></h2
    79       <section id="{@id}"
     98      <h3><xsl:value-of select="title"/></h3
     99      <section id="{@id}" name="{@id}"
    80100        <xsl:for-each select="p"> 
    81           <p id="{@id}"
     101          <p id="{@id}" name="{@id}"
    82102            <xsl:for-each select="sent"> 
    83               <sent id="{@id}"
     103              <sent id="{@id}" name="{@id}"
    84104                <xsl:apply-templates select='node()|@*' /> 
    85105                <xsl:text>  </xsl:text> 
     
    106126      </section> 
    107127    </xsl:for-each> 
     128 
    108129  </xsl:template> 
    109130 
  • trunk/stet.css

    r9 r10  
    4343 } 
    4444 
     45 
     46#topbar { 
     47padding-left: 2%; 
     48padding-right: 2%; 
     49padding: 3px 2% 3px 2%; 
     50/* background: #CCCCCC; */ 
     51/* background: #dee7ec; */ 
     52background: #FFFFFF; 
     53/* position: fixed; */ 
     54width: 96%; 
     55font-size: smaller; 
     56/* left: 0; */ 
     57/* top: 0; */ 
     58z-index: 100; 
     59} 
     60 
     61#topbar { 
     62background-color: #dee7ec; 
     63} 
     64 
     65#portal-globalnav { 
     66    background-color: #FFFFFF; 
     67    padding: 0em 0em 0em 2em; 
     68    white-space: nowrap; 
     69    list-style: none; 
     70    margin: 0; 
     71    height: auto; 
     72    line-height: normal; 
     73} 
     74#portal-globalnav li { 
     75    display: inline; 
     76} 
     77 
     78 
     79#portal-globalnav li a { 
     80    /* The normal, unselected tabs. They are all links */ 
     81    background-color: #FFFFFF; 
     82    border-color: #8cacbb; 
     83    border-width: 1px; 
     84    border-style: solid solid none solid; 
     85    color: #436976; 
     86    height: auto; 
     87    margin-right: 0.5em; 
     88    padding: 0em 1.25em; 
     89    text-decoration: none; 
     90    text-transform: lowercase; 
     91} 
     92 
     93#portal-globalnav li.selected a { 
     94    /* The selected tab. There's only one of this */ 
     95    background-color: #dee7ec; 
     96    border: 1px solid #8cacbb; 
     97    border-bottom: #dee7ec 1px solid; 
     98    color: #436976; 
     99} 
     100 
     101#portal-globalnav li a:hover { 
     102    background-color: #dee7ec; 
     103    border-color: #8cacbb; 
     104    border-bottom-color: #dee7ec; 
     105    color: #436976; 
     106} 
     107 
     108 
     109/* help here from Eric Bednarz and his  
     110http://tagsoup.com/-dev/null-/css/fixed/legacy/fixed4all.css 
     111*/ 
     112 
     113div#topbar 
     114  { 
     115background: #dee7ec; 
     116/*  background: transparent; */ 
     117/* background: #FFFFFF; */ 
     118  position: absolute; 
     119  top: 0px; 
     120  left: 0px; 
     121  width: 96%; 
     122  } 
     123div#topbar p 
     124  { 
     125background: #dee7ec; 
     126/*   background: transparent; */ 
     127  margin: 0; 
     128  padding: 1em; 
     129  border: 1px solid #000; 
     130  color: #000; 
     131  background: #eee; 
     132  } 
     133@media screen 
     134  { 
     135  div#topbar 
     136    { 
     137    position: fixed; 
     138    } 
     139  /* Don't do this at home */ 
     140  * html 
     141    { 
     142    overflow-y: hidden; 
     143    } 
     144  * html body 
     145    { 
     146    overflow-y: auto; 
     147    height: 100%; 
     148    padding: 0 1em 0 14em; 
     149    font-size: 100%; 
     150    } 
     151  * html div#topbar 
     152    { 
     153    position: absolute;   
     154    } 
     155  /* All done. */ 
     156  } 
     157 
     158 
     159.statustext { 
     160background: #dee7ec; 
     161/*  background: transparent; */ 
     162float: left; 
     163} 
     164.login { 
     165background: #dee7ec; 
     166/*  background: transparent; */ 
     167float: right; 
     168} 
     169 
    45170.noteLive {  
    46171background: #ff99ff; 
     
    49174#maintext {  
    50175 
    51 float:left 
    52  
    53         position: absolute; 
     176float:left; 
     177 
     178/*        position: absolute; */ 
    54179        margin-left: 3em; 
    55         margin-top: 1em; 
     180        margin-top: 2em; 
    56181        float: left; 
    57 //        left: 0; 
    58 //        top: 0; 
    59 //     margin-right: 33%; 
    60 //        border: 1px dotted #666; 
     182/*         left: 0; */ 
     183/*         top: 0; */ 
     184/*     margin-right: 33%; */ 
     185/*         border: 1px dotted #666; */ 
    61186        width: 50%; 
    62187 } 
     
    64189 
    65190.noteify {  
    66 //        display: none; 
    67 //     float: left; 
    68 //     left: 80%; 
    69 //        top: 0; 
    70            width: 40%; 
     191/*         display: none; */ 
     192/*     float: left; */ 
     193/*     left: 80%; */ 
     194/*         top: 0; */ 
     195           width: 30%; 
    71196font-size: smaller; 
    72197left: 55%; 
    73198float: right; 
    74199position: absolute; 
    75 //margin-left: 68%; 
    76 //        border: 1px dotted #666; 
    77 z-index: 100; 
     200/* margin-left: 68%; */ 
     201/*         border: 1px dotted #666; */ 
     202z-index: 90; 
    78203background: #f0ecb3; 
    79204 } 
     
    82207font-size: smaller; 
    83208position: absolute; 
    84 //position: relative; 
    85 //float: right; 
    86 //margin-left: 100%; 
     209/* position: relative; */ 
     210/* float: right; */ 
     211/* margin-left: 100%; */ 
    87212left: 55%; 
    88 //right: -%; 
     213/* right: -%; */ 
    89214width: 40%; 
    90215border: 1px dotted #666; 
    91216background: #f0ecb3; 
    92 z-index: 10; 
    93 //clear: right; 
     217/* z-index: 10; */ 
     218/* clear: right; */ 
    94219 } 
    95220 
     
    98223background-color: #f0ecb3; 
    99224 } 
     225input.addnote {  
     226background-color: #f0ecb3; 
     227 } 
     228 
    100229 
    101230p {  
     
    106235background-color: #f0ecb3; 
    107236} 
     237 
     238.error { 
     239color: red; 
     240font-weight: bold; 
     241} 
     242 
     243.ontextLabel { 
     244font-weight: bold; 
     245font-size: smaller; 
     246} 
     247 
     248.ontextText { 
     249font-style: italic; 
     250font-size: smaller; 
     251} 
     252 
     253.onecomment { 
     254border: 1px dotted #666; 
     255padding: 2px; 
     256/* background: #ffffcc; */ 
     257} 
     258 
     259.onecomment a { 
     260text-decoration: none; 
     261} 
     262 
     263.inputcaption { 
     264font-size: smaller; 
     265font-color: #ffffcc; 
     266} 
     267 
     268.indent { 
     269margin-left: 4em; 
     270} 
  • trunk/stet.js

    r9 r10  
    2121//     You may copy, tweak, rewrite, sell or lease any code example on this site. 
    2222 
    23 // Copyright (C) 2005 Software Freedom Law Center 
    24 // Author: Orion Montoya <orion@mdcclv.com> 
    25  
     23/* Copyright (C) 2005 Software Freedom Law Center */ 
     24/* Author: Orion Montoya <orion@mdcclv.com>       */ 
     25 
     26var ticketObj = new Object; 
     27ticketObj.rtidsBySn = new Object; 
     28var status = new Object; 
     29status.msg = new Array; 
     30status.last = last; 
     31 
     32var base64Chars = new Array( 
     33                            'A','B','C','D','E','F','G','H', 
     34                            'I','J','K','L','M','N','O','P', 
     35                            'Q','R','S','T','U','V','W','X', 
     36                            'Y','Z','a','b','c','d','e','f', 
     37                            'g','h','i','j','k','l','m','n', 
     38                            'o','p','q','r','s','t','u','v', 
     39                            'w','x','y','z','0','1','2','3', 
     40                            '4','5','6','7','8','9','+','/' 
     41                            ); 
     42 
     43var reverseBase64Chars = new Array(); 
     44for (var i=0; i < base64Chars.length; i++){ 
     45  reverseBase64Chars[base64Chars[i]] = i; 
     46
     47 
     48 
     49function initPage() { 
     50  statusbox("Please wait while we load some comments."); 
     51  var filename = location.pathname.substring(location.pathname.lastIndexOf('/')+1,location.pathname.length);  
     52  if((!filename.length) || (filename.match(/index.html/))) { 
     53    filename = 'gplv3-draft-1'; 
     54  } 
     55 
     56if(window.location.search.length) { 
     57  //dump('loadxmldoc /rt/NoAuth/xmlresults.html?'+window.location.search.substring(1)+'\n'); 
     58  loadXMLDoc('/rt/NoAuth/xmlresults.html',window.location.search.substring(1)); 
     59
     60 else { 
     61   //dump('loadXMLDoc /rt/NoAuth/xmlresults.html?Query=+%27CF.NoteUrl%27+LIKE+%27'+filename+'%27+&RowsPerPage=25&Order=DESC'); 
     62   loadXMLDoc('/rt/NoAuth/xmlresults.html','Query=+%27CF.NoteUrl%27+LIKE+%27'+filename+'%27+&RowsPerPage=25&Order=ASC'); 
     63 } 
     64
     65 
     66window.onload = initPage(); 
     67 
     68 
     69// XpathSel adapted from http://www.quirksmode.org/js/selected.html 
    2670function XpathSel() { 
     71 
     72      if (!readCookie('__ac')) { 
     73        document.getElementById('login').setAttribute('style','color: red; font-weight: bold; font-size: 150%'); 
     74        return; 
     75      } 
     76 
     77 
    2778  var textObj = ''; 
    2879  var start = ''; 
     
    3182    { 
    3283      textObj = window.getSelection(); 
    33        
    3484    } 
    3585  else if (document.getSelection) 
     
    4191      textObj= document.selection.createRange().text; 
    4292    } 
    43   else return; 
     93   
     94  if(!textObj.length) { 
     95    document.getElementById('selectsome').setAttribute('class','error'); 
     96    return; 
     97  } 
    4498 
    4599      startNode = textObj.anchorNode.parentNode; 
     
    50104      endid = endnode.id; 
    51105      end = endnode.nodeName; 
    52    
    53  
    54     for (var oStr='' ; startNode && startNode.nodeName != '#document'; startNode=startNode.parentNode) {  
    55       if (startNode.nodeName!='#text') {  
    56         oStr = startNode.nodeName  
     106 
     107      if (!readCookie('__ac')) { 
     108        document.getElementById('login').setAttribute('style','color: red; font-weight: bold; font-size: 150%'); 
     109      } 
     110      else { 
     111 
     112        oStr = getDomPath(startNode); 
     113         
     114        myNoteIfy = createNoteDiv(); 
     115        textString = textObj.toString(); 
     116         
     117        thisNode = document.getElementById(startid); 
     118     
     119    if ((thisNode.previousSibling) && (thisNode.previousSibling.previousSibling) && (thisNode.previousSibling.previousSibling.appendChild)) { 
     120      thisNode.previousSibling.previousSibling.appendChild(myNoteIfy); 
     121    } 
     122    else  
     123      if ((thisNode.previousSibling) && (thisNode.previousSibling.appendChild)) { 
     124        thisNode.previousSibling.appendChild(myNoteIfy); 
     125      } 
     126      else { 
     127        thisNode.appendChild(myNoteIfy); 
     128      } 
     129    document.getElementById('DomPath').value = oStr; 
     130    document.getElementById('Selection').value = textString; 
     131    loadHTMLtoDiv('comment on: <strong>'+textString+'</strong>','SelectionTxt'); 
     132    //    document.getElementById('SelectionTxt').innerHTML = 'comment on: <strong>'+textString+'</strong>'; 
     133    document.getElementById('NoteSubj').value = 'Subject/summary [required]'; 
     134    document.getElementById('StartNodeId').value = startid; 
     135    document.getElementById('EndNodeId').value = endid; 
     136    document.getElementById('StartNode').value = start; 
     137    document.getElementById('EndNode').value = end; 
     138    document.getElementById('NoteUrl').value = location.href; 
     139 
     140    if(startid != endid) { 
     141      document.getElementById('NoteText').value = 'Your selection does not begin and end in the same sentence.  Please cancel and try again with a shorter selection.';       
     142      document.getElementById('submitNote').setAttribute('disabled','disabled'); 
     143      document.getElementById('NoteSubj').setAttribute('disabled','disabled'); 
     144      //document.getElementById('NoteText').setAttribute('disabled','disabled'); 
     145    } 
     146  } 
     147
     148 
     149 
     150function getDomPath(startNode) { 
     151  // helped here by http://www.howtocreate.co.uk/emails/FlorianSauvin.html 
     152  for (var oStr='' ; startNode && startNode.nodeName != '#document'; startNode=startNode.parentNode) {  
     153    if (startNode.nodeName!='#text') {  
     154      oStr = startNode.nodeName  
    57155        + (startNode.id?('[id='+startNode.id+']'):'') 
    58156        + (oStr?('/'+oStr):''); 
    59       } 
    60     } 
    61         myNoteIfy = createNoteDiv(); 
    62         textString = textObj.toString(); 
    63  
    64         //      highlightWord(startNode,textString,'','',''); 
    65  
    66         thisNode = document.getElementById(startid); 
    67  
    68         if ((thisNode.previousSibling) && (thisNode.previousSibling.previousSibling) && (thisNode.previousSibling.previousSibling.appendChild)) { 
    69         thisNode.previousSibling.previousSibling.appendChild(myNoteIfy); 
    70         } 
    71         else  
    72 if ((thisNode.previousSibling) && (thisNode.previousSibling.appendChild)) { 
    73         thisNode.previousSibling.appendChild(myNoteIfy); 
    74         } 
    75         else { 
    76         thisNode.appendChild(myNoteIfy); 
    77         } 
    78         document.getElementById('DomPath').value = oStr; 
    79 //      document.getElementById('DomPathTxt').innerHTML = 'xpath: <strong>'+oStr+'</strong>'; 
    80         document.getElementById('Selection').value = textString; 
    81         document.getElementById('SelectionTxt').innerHTML = 'comment on: <strong>'+textString+'</strong>'; 
    82 //      document.getElementById('NoteText').value = startid; 
    83         document.getElementById('StartNodeId').value = startid; 
    84         document.getElementById('EndNodeId').value = endid; 
    85         document.getElementById('StartNode').value = start; 
    86         document.getElementById('EndNode').value = end; 
    87         document.getElementById('NoteUrl').value = location.href; 
    88         //      document.getElementById('cancel').setAttribute('parent',startid); 
    89  
    90  
    91  
    92 //    location.href='http://localhost/cgi-bin/stet-submit.pl?url='+escape(location.href)+'&dompath='+oStr+'&selectedtext='+escape(textObj)+'&start='+escape(start)+'&startid='+escape(startid)+'&end='+escape(end)+'&endid='+escape(endid);; 
    93  
     157    } 
     158  } 
    94159} 
    95160 
    96161function submitComment() { 
    97  
    98 var form = document.getElementById('noteify'); 
    99  var noteText = form.NoteText.value; 
    100  form.NoteText.value = "OK, submitting..."; 
    101  form.NoteText.style.background = '#aaa'; 
    102  form.style.background = '#aaa'; 
    103  
    104 var params = encodeURI('DomPath='+form.DomPath.value+'&amp;Selection='+form.Selection.value+'&amp;NoteText='+noteText+'&amp;StartNode='+form.StartNode.value+'&amp;EndNode='+form.EndNode.value+'&amp;StartNodeId='+form.StartNodeId.value+'&amp;EndNodeId='+form.EndNodeId.value+'&amp;NoteUrl='+location.href); 
    105  
    106 var pyparams = encodeURI('custom_note_dom_path='+form.DomPath.value+'&amp;custom_note_selection='+form.Selection.value+'&amp;custom_start_node='+form.StartNode.value+'&amp;custom_end_node='+form.EndNode.value+'&amp;custom_note_start_node_id='+form.StartNodeId.value+'&amp;custom_note_end_node_id='+form.EndNodeId.value+'&amp;custom_note_url='+location.href+'&amp;description='+noteText+'&amp;summary='+form.Selection.value+'&amp;reporter=moglen@columbia.edu&amp;mode=newticket&amp;action=create&amp;status=new&amp;component=component1&amp;severity=normal&amp;submit=create'); 
    107  
    108  
    109  
    110 //oStr = document.getElementById('DomPath').value; 
    111 //textObj = document.getElementById('Selection').value; 
    112 //startid = document.getElementById('NoteText').value; 
    113 //noteSelection = document.getElementById('StartNodeId').value; 
    114 //endid = document.getElementById('EndNodeId').value; 
    115 //start = document.getElementById('StartNode').value; 
    116 //end = document.getElementById('EndNode').value; 
    117  
    118 //http://localhost/cgi-bin/stet-submit.pl?DomPath=&Selection=&NoteText=&StartNode=&EndNode=&StartNodeId=&EndNodeId&NoteUrl= 
    119  
    120 //var theUrl = 'http://localhost/cgi-bin/stet-submit.pl?NoteUrl='+escape(location.href)+'&DomPath='+oStr+'&Selection='+escape(textObj)+'&StartNode='+escape(start)+'&StartNodeId='+escape(startid)+'&EndNode='+escape(end)+'&EndNodeId='+escape(endid); 
    121 //dump('would open '+theUrl+"\n"); 
    122 var theUrl = 'http://localhost/cgi-bin/stet-submit.pl'+'?'+params; 
    123  
    124 //highlightWord(form.StartNode.value,form.Selection.value,noteText,''); 
    125 loadXMLDoc(theUrl); 
    126 //cancelNote("noteify") 
    127  
    128 //window.location = 'http://trac.localdomain.org/trac.cgi'+'?'+pyparams; 
    129 
    130  
    131 function toggle(myClass) { 
    132  
    133 var toggleUs = getElementsByClass(myClass); 
    134 for (var i=0; i < toggleUs.length; i++) { 
    135 //      if (toggleUs[i].style.display == 'inline') { 
    136                 toggleUs[i].style.display='none'; 
    137 //              } 
    138 //      else if (toggleUs[i].style.display == 'none') { 
    139 //              toggleUs[i].style.display='inline'; 
    140 //              } 
    141         } 
     162   
     163  if ((document.getElementById('NoteSubj').value == 'Subject/summary [required]') || (document.getElementById('NoteSubj').value == ' ')) { 
     164    //    document.getElementById('SelectionTxt').innerHTML = '<span class="error">Please enter a brief explanatory subject for this comment</span>'; 
     165 
     166    loadHTMLtoDiv('<span class="error">Please enter a brief explanatory subject for this comment</span>','SelectionTxt'); 
     167  } 
     168  else { 
     169   
     170  var form = document.getElementById('noteify'); 
     171  var noteText = form.NoteText.value; 
     172  loadHTMLtoDiv('Ok, submitting...','SelectionTxt'); 
     173  form.NoteText.style.background = '#aaa'; 
     174  form.NoteSubj.style.background = '#aaa'; 
     175  document.getElementById('submitNote').setAttribute('disabled','disabled'); 
     176  document.getElementById('cancel').setAttribute('disabled','disabled'); 
     177  form.style.background = '#aaa'; 
     178 
     179  var params = encodeURI('DomPath='+form.DomPath.value+'&amp;Selection='+encodeURIComponent(form.Selection.value)+'&amp;NoteSubj='+encodeURIComponent(form.NoteSubj.value)+'&amp;NoteText='+encodeURIComponent(noteText)+'&amp;StartNode='+form.StartNode.value+'&amp;EndNode='+form.EndNode.value+'&amp;StartNodeId='+form.StartNodeId.value+'&amp;EndNodeId='+form.EndNodeId.value+'&amp;NoteUrl='+location.href); 
     180   
     181   
     182 
     183  var theUrl = 'stet-submit.pl';  
     184  //highlightWord(form.StartNode.value,form.Selection.value,noteText,'');    
     185  loadXMLDoc(theUrl,params); 
     186  } 
    142187} 
    143188 
     
    148193  var        i; 
    149194  var        j; 
    150  
     195   
    151196  for (i = 0, j = 0; i < my_array.length; i++) 
    152  
    153     var c = " " + my_array[i].className + " "; 
    154     if (c.indexOf(" " + needle + " ") != -1) { 
    155       retvalue[j++] = my_array[i]; 
    156    
    157  
     197   
     198      var c = " " + my_array[i].className + " "; 
     199      if (c.indexOf(" " + needle + " ") != -1) { 
     200       retvalue[j++] = my_array[i]; 
     201     
     202   
    158203  return retvalue; 
    159204} 
     
    161206 
    162207// help from http://www.xml.com/pub/a/2005/02/09/xml-http-request.html 
    163  
    164208var req; 
    165  
    166 function loadXMLDoc(url)  
     209function loadXMLDoc(url,theData)  
    167210{ 
    168     // branch for native XMLHttpRequest object 
    169     if (window.XMLHttpRequest) { 
    170         req = new XMLHttpRequest(); 
    171         req.onreadystatechange = processReqChange; 
    172         //      netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); 
    173         req.open("GET", url, true); // true = asynchronous 
    174         req.send(null); 
    175     // branch for IE/Windows ActiveX version 
    176     } else if (window.ActiveXObject) { 
    177         req = new ActiveXObject('Microsoft.XMLHTTP'); 
    178         if (req) { 
    179             req.onreadystatechange = processReqChange; 
    180             req.open("GET", url, true); 
    181             req.send(); 
    182         } 
    183     } 
     211  dump('loading '+url+'?'+theData+'\n'); 
     212  // branch for native XMLHttpRequest object 
     213  if (window.XMLHttpRequest) { 
     214    req = new XMLHttpRequest(); 
     215  } else if (window.ActiveXObject) { 
     216    req = new ActiveXObject('Microsoft.XMLHTTP'); 
     217  } 
     218  req.onreadystatechange = processReqChange; 
     219   
     220  req.open("POST", url, true); 
     221  //  req.open("GET", url, false); 
     222  req.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
     223  req.setRequestHeader('X-Referer',document.location); 
     224  //  theData = encodeURI(theData); 
     225  req.send(theData); 
     226
     227 
     228function loadHTMLtoDiv(text,targetid,caller) { 
     229  // this won't work in Safari so we need a Safari case: 
     230  if(targetid) { 
     231  dump('targetid is '+targetid); 
     232  if(caller) { dump(', caller is '+caller);} 
     233  dump('\n'); 
     234  if (myElement = document.getElementById(targetid)) { 
     235        //      dump(e); 
     236        try {    
     237          myElement.innerHTML = text; 
     238        } 
     239        catch(e) { 
     240          var newDiv = document.createElement('span'); 
     241          newDiv.innerHTML = text; 
     242          myElement.appendChild(newDiv); 
     243        } 
     244  } 
     245  } 
     246
     247 
     248// thanks to http://www.mercurytide.com/knowledge/white-papers/issues-working-with-ajax 
     249function getXMLNodeSerialisation(xmlNode) { 
     250  var text = false; 
     251  try { 
     252    // Gecko-based browsers, Safari, Opera. 
     253    var serializer = new XMLSerializer(); 
     254    text = serializer.serializeToString(xmlNode); 
     255  } 
     256  catch (e) { 
     257    try { 
     258      // Internet Explorer. 
     259      text = xmlNode.xml; 
     260    } 
     261    catch (e) {} 
     262  } 
     263  return text; 
     264
     265 
     266function loadURLtoDiv(url,args,targetid) { 
     267  // branch for native XMLHttpRequest object 
     268  if (window.XMLHttpRequest) { 
     269    req = new XMLHttpRequest(); 
     270  } else if (window.ActiveXObject) { 
     271    req = new ActiveXObject('Microsoft.XMLHTTP'); 
     272  } 
     273  req.open('GET',url,false); 
     274  req.send(args); 
     275   
     276  loadHTMLtoDiv(req.responseText,targetid,"loadurltodiv"); 
     277  //  document.getElementById(targetid).innerHTML = req.responseText; 
     278 
     279 
    184280} 
    185281 
    186282function processReqChange()  
    187283{ 
    188     // only if req shows "complete" 
    189     if (req.readyState == 4) { 
    190         // only if "OK" 
    191         if (req.status == 200) { 
    192           cancelNote("noteify"); 
    193 //      dump(req.responseText); 
    194         response  = req.responseXML.documentElement; 
    195         //foo_arr = response.getElementsByTagName("annotation"); 
    196 //      dump(req.responseXML+"\n"); 
    197 //      dump(foo_arr + ' ' + foo_arr.length + ' ' + foo_arr.item(1)+"\n"); 
    198  
    199         selections_arr = response.getElementsByTagName("s"); 
    200 //      dump(selections_arr + ' ' + selections_arr.length + ' ' + selections_arr.item(0)+"\n"); 
    201         startnodes_arr = response.getElementsByTagName("i"); 
    202         annotations_arr = response.getElementsByTagName("n"); 
    203         rtids_arr = response.getElementsByTagName("id"); 
    204         for (i = 0; i < selections_arr.length; i++) { 
    205 //              dump("n "+i+"="+annotations_arr[i].firstChild.innerHTML+"\n"); 
    206                 startNode = startnodes_arr[i].firstChild.data; 
    207                 noteSelection = selections_arr[i].firstChild.data; 
    208                 annoteText = annotations_arr[i]; 
    209 //              if (annotations_arr[i].firstChild.nextSibling) { 
    210 //              annoteText += annotations_arr[i].firstChild.toString(); 
    211 //              } 
    212                  
    213                 rtid = rtids_arr[i] ? rtids_arr[i].firstChild.data : ""; 
    214  
    215                 //dump("highlighting "+startNode+' '+noteSelection+' '+annoteText+"\n"); // debug 
    216                 highlightWord(document.getElementById(startNode),noteSelection,annoteText,rtid); 
    217  
    218         //        eval(method + '(\'\', result)'); 
     284 
     285  // only if req shows "complete" 
     286  if (req.readyState == 4) { 
     287    // only if "OK" 
     288    if (req.status == 200) { 
     289/* <jag> [Exception... "Component returned failure code: 0x80040111 
     290      (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]"  nsresult: 
     291      "0x80040111 (NS_ERROR_NOT_AVAILABLE)"  location: "JS frame :: 
     292      http://gplv3.fsf.org/stet/stet.js :: processReqChange :: line 189" 
     293      data: no] 
     294 */ 
     295      cancelNote("noteify"); 
     296      //dump(req.responseText); 
     297      response  = req.responseXML.documentElement; 
     298      dump("pre processAnnot\n"); 
     299      var resp_arrN; 
     300      var resp_arrA; 
     301      var resp_arrF; 
     302      cs = response.getElementsByTagName("cs"); 
     303      statusbox(getXMLNodeSerialisation(cs[0])); 
     304 
     305      resp_arrN = response.getElementsByTagName("annotation"); 
     306      if(resp_arrN.length) { 
     307        dump("processAnnot\n") 
     308          processAnnotation(response); 
     309      } 
     310       
     311      else if (resp_arrF = response.getElementsByTagName("form")) { 
     312        dump("pre processNQ\n") 
     313          if(resp_arrF.length) { 
     314            dump("processNQ\n") 
     315              processNewQuery(response); 
     316          } 
     317      } 
     318      else if (resp_arrA = response.getElementsByTagName("agreement")) { 
     319        //      dump("pre processAgree\n"+resp_arr[0].firstChild.data+"\n"); 
     320 
     321        if(resp_arrA.length) { 
     322       dump("processAgree\n"); 
     323        processAgreement(response); 
     324      } 
     325           } 
     326      else { 
     327        statusbox("There was a problem retrieving the XML data:\n" + req.statusText+"\n"); //debug 
     328      } 
     329    } 
     330  } 
     331  //    else { dump("readyState was "+req.readyState+"\n"); } // debug 
     332
     333   
     334function onNoteifyMouseover() { 
     335  //this.onblur = onNoteifyBlur; 
     336   
     337
     338 
     339function processAnnotation(response) { 
     340  //    document.getElementById("statusbox").innerHTML = getXMLNodeSerialisation(cs[0]); 
     341  // dump("got an annotation\n"); 
     342  //  dump(req.responseXML+"\n"); 
     343  //    responseStringSer = getXMLNodeSerialisation(req.responseXML); 
     344  // dump(responseStringSer); 
     345  // dump(resp_arr + ' ' + resp_arr.length + ' ' + resp_arr.item(1)+"\n"); 
     346   
     347  selections_arr = response.getElementsByTagName("s"); 
     348  // dump(selections_arr + ' ' + selections_arr.length + ' ' + selections_arr.item(0)+"\n"); 
     349  startnodes_arr = response.getElementsByTagName("i"); 
     350  annotations_arr = response.getElementsByTagName("n"); 
     351  rtids_arr = response.getElementsByTagName("id"); 
     352  users_arr = response.getElementsByTagName("u"); 
     353  uagr_arr = response.getElementsByTagName("ua"); 
     354  agrtot_arr = response.getElementsByTagName("at"); 
     355        for (prI = 0; prI < selections_arr.length; prI++) { 
     356          rtids_arr[prI].firstChild.data ? rtid = rtids_arr[prI].firstChild.data : rtid = "error"; 
     357          tooltipString = getXMLNodeSerialisation(annotations_arr[prI]); 
     358          tooltipString.length > 165 ? tooltipSubString = tooltipString.substr(0,199) + '...' : tooltipSubString = tooltipString; 
     359 
     360          ticketObj[rtid] = new Object; 
     361 
     362          ticketObj[rtid].link = rtid ? '<a href="/rt/NoAuth/readsay.html?id='+rtid+'">read/say more</a> ' : '[problem with ticket link]'; 
     363          agreechild = uagr_arr[prI].firstChild.data 
     364          agreestr = getXMLNodeSerialisation(uagr_arr[prI]); 
     365          if ((agreechild == "agree") || (agreechild == "unagree")) { 
     366            ticketObj[rtid].link += '<a id="agree'+rtid+'" href="javascript:iAgree(\''+rtid+'\',\''+agreechild+'\')">'+agreechild+'</a> | '; 
     367          } 
     368          else { 
     369            ticketObj[rtid].link += ' '+agreestr+' | '; 
     370          } 
     371          if (agrtot_arr[prI].firstChild.data > 0) { 
     372            ticketObj[rtid].link += ' ['+agrtot_arr[prI].firstChild.data+' agree]'; 
     373          } 
     374          ticketObj[rtid].full = tooltipString; 
     375          ticketObj[rtid].excerpt = tooltipSubString; 
     376          ticketObj[rtid].user = users_arr[prI].firstChild ? users_arr[prI].firstChild.data : ""; 
     377          ticketObj[rtid].startnode = startnodes_arr[prI].firstChild.data; 
     378          if(!ticketObj.rtidsBySn[ticketObj[rtid].startnode]) { 
     379            ticketObj.rtidsBySn[ticketObj[rtid].startnode] = new Array(rtid); 
     380          } 
     381          else { 
     382            ticketObj.rtidsBySn[ticketObj[rtid].startnode].push(rtid); 
     383          } 
     384          ticketObj[rtid].ua = getXMLNodeSerialisation(uagr_arr[prI]); 
     385          startNode = startnodes_arr[prI].firstChild.data; 
     386          startNode = startNode.replace(/note\.[0-9]+\./,''); 
     387          noteSelection = selections_arr[prI].firstChild.data; 
     388          //            annoteText = users_arr[prI].firstChild.data+": "+ annotations_arr[prI].firstChild.data; 
     389          annoteText = annotations_arr[prI]; 
     390          //            if (annotations_arr[prI].firstChild.nextSibling) { 
     391          //            annoteText += annotations_arr[prI].firstChild.toString(); 
     392          //            } 
     393           
     394          rtid = rtids_arr[prI] ? rtids_arr[prI].firstChild.data : ""; 
     395          user = users_arr[prI].firstChild ? users_arr[prI].firstChild.data : ""; 
     396          //            dump(users_arr[prI].firstChild.data); 
     397          dump("\nhighlighting "+startNode+' '+noteSelection+' '+annoteText+' rt'+rtid+'\n'); 
     398          highlightWord(document.getElementById(startNode),noteSelection,annoteText,rtid,user); 
     399 
     400          // FIXME: couple bugs left in intense_annot,  
     401          // new comments are not getting highlighted upon submission 
     402          // and I want to sort out the rtidsBySn thing, so I can 
     403          // annote one paragraph at a time. 
     404          // also other distressing inconsistencies make the wack-ass 
     405          // highlightWord() a better choice for the moment. 
     406           
     407                  // fixme: currently crashes browser :) 
     408           
     409          //intense_annot(document.getElementById(startNode),noteSelection,rtid); 
     410 
    219411        } 
     412        //      dump('rtidsBySn for gpl3.preamble.p2.s1 are: '+ticketObj.rtidsBySn['gpl3.preamble.p2.s1']+'\n'); 
    220413        unOverlap("annotation",5); 
    221          
    222  
    223     } else { 
    224       //        dump("There was a problem retrieving the XML data:\n" + req.statusText+"\n"); //debug 
    225         } 
    226     } 
    227     //  else { dump("readyState was "+req.readyState+"\n"); } // debug 
    228  
    229 
    230  
    231  
    232  
    233 function postNote(xpath,selection,note) { 
    234  
    235  
    236  
    237  
    238 
    239  
    240 function onNoteifyMouseover() { 
    241 //this.onblur = onNoteifyBlur; 
    242  
    243 
    244  
     414
     415 
     416function processAgreement(response) { 
     417// dump("got an agreement\n"); 
     418        myId = response.getElementsByTagName("id")[0].firstChild.data; 
     419        myOpn = response.getElementsByTagName("b")[0].firstChild.data; 
     420// dump('id is '+rtids_arr[0].firstChild.data); 
     421        myLink = document.getElementById('agree'+myId); 
     422        myOpn == "agree" ? opOpn = "unagree" : opOpn = "agree"; 
     423        loadHTMLtoDiv(opOpn,'agree'+myId,"processagreement"); 
     424        //      myLink.innerHTML = opOpn; 
     425 
     426        myLink.href = 'javascript:iAgree(\''+rtid+'\',\''+opOpn+'\')'; 
     427      } 
     428 
     429 
     430function processNewQuery(response) { 
     431  dump("entering pNQ\n"); 
     432  dump(getXMLNodeSerialisation(response)); 
     433  statusbox(getXMLNodeSerialisation(response)); 
     434
     435   
    245436function onNoteifyBlur() { 
    246       noteNode = document.getElementById('noteify'); 
     437//    noteNode = document.getElementById('noteify'); 
    247438//      dump(noteNode); 
    248  
     439        submitComment(); 
    249440//  window.location = 'http://localhost/cgi-bin/stet-submit.pl?foo=bar'; 
    250441} 
     
    272463function createNoteDiv() { 
    273464 
     465  // this would be a lot more readable and maintainable if it were 
     466  // just a string. 
     467 
    274468var noteifyDiv = document.createElement('form'); 
    275 noteifyDiv.setAttribute('action','http://localhost/cgi-bin/stet-submit.pl'); 
     469noteifyDiv.setAttribute('action','stet-submit.pl'); 
    276470noteifyDiv.setAttribute('class','noteify'); 
    277471noteifyDiv.setAttribute('id','noteify'); 
    278472noteifyDiv.setAttribute('name','noteify'); 
     473noteifyDiv.setAttribute('onblur','onNoteifyBlur()'); 
    279474// noteifyDiv.style.z-index = '100'; 
    280475 
     
    287482DomPath.setAttribute('name','DomPath'); 
    288483DomPath.setAttribute('type','hidden'); 
     484DomPath.setAttribute('class','addnote'); 
    289485 
    290486var SelectionTxt = document.createElement('span'); 
     
    297493Selection.setAttribute('type','hidden'); 
    298494 
     495var NoteSubj = document.createElement('input'); 
     496NoteSubj.setAttribute('id','NoteSubj'); 
     497NoteSubj.setAttribute('name','NoteSubj'); 
     498NoteSubj.setAttribute('type','text'); 
     499NoteSubj.setAttribute('size','40'); 
     500NoteSubj.setAttribute('onfocus','if(this.value=="Subject/summary [required]") {this.value="";}'); 
     501NoteSubj.setAttribute('onblur','if(this.value==""){this.value="Subject/summary [required]";}'); 
     502NoteSubj.setAttribute('class','addnote'); 
     503 
    299504var NoteText = document.createElement('textarea'); 
    300505NoteText.setAttribute('id','NoteText'); 
    301506NoteText.setAttribute('name','NoteText'); 
    302507NoteText.setAttribute('rows','10'); 
    303 NoteText.setAttribute('cols','30'); 
     508NoteText.setAttribute('cols','40'); 
     509NoteText.setAttribute('class','addnote'); 
    304510 
    305511var StartNode = document.createElement('input'); 
     
    340546cancel.setAttribute('onClick','cancelNote("noteify")'); 
    341547cancel.setAttribute('class','annoteButton'); 
     548cancel.setAttribute('class','addnote'); 
    342549 
    343550var theBR = document.createElement('br'); 
     551var theBR1 = document.createElement('br'); 
     552var theBR2 = document.createElement('br'); 
     553var theBR3 = document.createElement('br'); 
     554var theBR4 = document.createElement('br'); 
    344555 
    345556var submit = document.createElement('input'); 
    346557submit.setAttribute('type','button'); 
     558submit.setAttribute('id','submitNote'); 
    347559submit.setAttribute('value','submit'); 
    348560//submit.onclick = 'dump("clicked submit")'; 
    349561submit.setAttribute('onClick','submitComment()'); 
    350562submit.setAttribute('class','annoteButton'); 
     563submit.setAttribute('class','addnote'); 
    351564 
    352565noteifyDiv.appendChild(DomPathTxt); 
    353566noteifyDiv.appendChild(DomPath); 
    354 noteifyDiv.appendChild(theBR); 
     567//noteifyDiv.appendChild(theBR); 
    355568noteifyDiv.appendChild(SelectionTxt); 
     569noteifyDiv.appendChild(theBR1); 
    356570noteifyDiv.appendChild(Selection); 
    357 noteifyDiv.appendChild(theBR); 
     571// noteifyDiv.appendChild(theBR2); 
     572noteifyDiv.appendChild(NoteSubj); 
     573noteifyDiv.appendChild(theBR3); 
    358574noteifyDiv.appendChild(NoteText); 
    359575noteifyDiv.appendChild(StartNode); 
     
    363579noteifyDiv.appendChild(NoteUrl); 
    364580noteifyDiv.appendChild(DocRevision); 
    365 noteifyDiv.appendChild(theBR); 
     581noteifyDiv.appendChild(theBR4); 
    366582noteifyDiv.appendChild(submit); 
    367583noteifyDiv.appendChild(cancel); 
     
    371587} 
    372588 
    373  
    374  
    375 function highlightWord(node,word,tooltip,rtid,altClass) { 
     589function intense_annot(root,selection,rtid) { 
     590var selecObj = new Array; 
     591var rootObj = new Array; 
     592 dump('selection is '+selection+'\n'); 
     593 dump('comment is '+ticketObj[rtid].excerpt+'\n'); 
     594 var selections = new Array(selection); 
     595// couple lines of html-ignoring help from 
     596// http://www.notestips.com/80256B3A007F2692/1/NAMO5RNV2S  
     597// by Mike Golding, 9/24/2003 
     598//Extract HTML Tags 
     599 regexp=/<[^<>]*>/ig; 
     600 // dump('node text is '+root.innerHTML+'\n'); 
     601&nbs