Software Freedom Law Center

Changeset 13

Show
Ignore:
Timestamp:
01/16/06 17:56:11 (3 years ago)
Author:
orion
Message:

trying for more browser compatibility with sarissa

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/agree.pl

    r11 r13  
    4545if (($name, $pass) = split(/:/, decode_base64(cookie('__ac')))) { 
    4646     $name =~ s/\"//g; 
    47      $server = Frontier::Client->new(url => "http://gplv3.fsf.org:8800/launch/acl_users/Users/acl_users"
     47     $server = Frontier::Client->new(url => 'http://stet_auth:fai1Iegh@gplv3.fsf.org:8800/launch/acl_users/Users/acl_users'
    4848                                    username => "stet_auth", 
    4949                                    password =>  "fai1Iegh"); 
     
    7171#print Dumper($values); 
    7272#print "ticket has ".$values->count." customfieldvalues\n"; 
    73 if ($opn =~ /unagree/) { 
     73# this is trusting the user input, but it really needs to check the values 
     74if (($opn =~ /unagree/) && ($values->HasEntry($name))) { 
    7475    ($bool, $message) = $Ticket->DeleteCustomFieldValue(Field => "7", Value => $name); 
    7576    $agreebool = "unagree"; 
     
    7879 
    7980else { 
    80     ($bool, $message) = $Ticket->AddCustomFieldValue(Field => "7", Value => $name); 
    81     print STDERR "AddCustomFieldValue said $bool, $message\n"; 
    82     $agreebool = "agree"; 
     81    if  (!$values->HasEntry($name)) { 
     82        ($bool, $message) = $Ticket->AddCustomFieldValue(Field => "7", Value => $name); 
     83        print STDERR "AddCustomFieldValue said $bool, $message\n"; 
     84        $agreebool = "agree"; 
     85    } 
    8386} 
     87if (!$agreebool) { $agreebool = "stop it"; } 
    8488# } 
    8589# } 
     
    9498 
    9599# if (${$resp} == 0) { 
     100if ($agreebool =~ /agree/) { 
    96101print header('text/xml'); 
    97102 
     
    100105 <response> 
    101106  <agreement> 
     107    <cs>You now $agreebool with <a href="/comments/rt/readsay.html?id=$id">$id</a>.  <a href=\"/rt/NoAuth/changeshown.html\">change shown comments</a></cs> 
    102108    <id>$id</id> 
    103109    <b>$agreebool</b> 
     
    106112 
    107113EOF 
     114} 
     115elsif ($agreebool =~ "stop it") { 
     116print header('text/xml'); 
     117 
     118    print <<"EOF"; 
     119<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
     120 <response> 
     121  <agreement> 
     122    <cs>Hmm, I'm confused about your agreement.  Try again later, or reload to toggle your opinion.  <a href=\"/rt/NoAuth/changeshown.html\">change shown comments</a></cs> 
     123    <id>$id</id> 
     124    <b>$agreebool</b> 
     125  </agreement> 
     126 </response> 
     127 
     128EOF 
     129} 
     130 
    108131#} 
    109132 
  • trunk/lincoln-thanksgiving.xml

    r9 r13  
    11<?xml version="1.0" encoding="UTF-8"?> 
    22<?xml-stylesheet href="selectxpath.xsl" type="text/xsl" ?> 
    3 <!DOCTYPE annot SYSTEM "annot.dtd"> 
     3<!DOCTYPE annot SYSTEM "gpl3.dtd"> 
    44 
    55<!-- $Id: lincoln-thanksgiving.xml 41 2005-12-13 21:35:10Z orion $ --> 
  • trunk/rt-test.pl

    r11 r13  
    2626use lib '/usr/share/request-tracker3.4/lib/'; 
    2727use lib '/etc/request-tracker3.4/'; 
     28use RT::Interface::CLI qw(CleanEnv GetCurrentUser GetMessageContent); 
    2829 
    29 use lib '/usr/share/request-tracker3.2/lib/'; 
    30 use lib '/etc/request-tracker3.2/'; 
    31  
    32 use MIME::Base64; 
    33 use Frontier::Client; 
    34  
    35  
    36 use RT::Interface::CLI qw(CleanEnv GetCurrentUser GetMessageContent); 
    37 use RT::Interface::Web; 
    3830 
    3931use RT; 
     
    4537use RT::CustomField; 
    4638use Data::Dumper; 
     39my $CurrentUser = RT::Interface::CLI::GetCurrentUser(); 
     40my $CustomFieldObj = RT::CustomField->new($CurrentUser); 
     41#my $Query= " Requestor.EmailAddress LIKE 'moglen' "; 
     42my $Query; 
     43 if(param()) { 
    4744 
    48 sub debug { 
    49     print STDERR @_ . "\n"; 
     45     $NoteUrl = param('NoteUrl'); 
     46#     $Query = " CustomFields.NoteUrl LIKE '$NoteUrl' "; 
     47 } 
     48# else { 
     49    $Query= " Requestor.EmailAddress LIKE 'moglen' "; 
     50#} 
    5051 
    51 
    52  
    53 $printargs = "default (20 most recent comments)"; 
    54  
    55 if (($name, $pass) = split(/:/, decode_base64(cookie('__ac')))) { 
    56  
    57     $name =~ s/\"//g; 
    58     $server = Frontier::Client->new(url => "http://gplv3.fsf.org:8800/launch/acl_users/Users/acl_users", 
    59                                     username => "stet_auth", 
    60                                     password =>  "fai1Iegh"); 
    61      
    62      
    63     $resp = $server->call('authRemoteUser',$name,$pass); 
    64 
    65 else { 
    66     ${$resp} = 0; 
    67 
    68  
    69 if (${$resp} == 0) { 
    70     print STDERR "auth boolean was 0\n"; 
    71 
    72  
    73  
    74 #my $CurrentUser = RT::Interface::CLI::GetCurrentUser(); 
    75 #my $CustomFieldObj = RT::CustomField->new($CurrentUser); 
    76  
    77 #my $Query; 
    78 #if(param()) { 
    79 #    $NoteUrl = param('NoteUrl'); 
    80 # } 
    81 my $CurrentUser = $RT::SystemUser; 
    82 my $TicketObj = new RT::Tickets( $CurrentUser ); 
    83 if (param('WatcherOp') == "LIKE") { 
    84     $arg = "%".param('ValueOfWatcher')."%"; 
    85 
    86 else { 
    87     $arg = param('ValueOfWatcher'); 
    88 
    89 $Query = param('WatcherField')." ".param('WatcherOp'). 'Requestor.Name LIKE "%'.param('ValueOfWatcher').'%"' 
     52my $TicketObj = new RT::Tickets( $RT::SystemUser ); 
    9053$TicketObj->FromSQL($Query); 
    91 %session = ''; 
    92 # as a result of next line, searches are *not* sticky. 
    93  
    94 %ARGS = param(); 
    9554$TicketObj->Query(); 
    96 &LimitByArgs; 
    97  
    98  
    99  
    100  
    101 # $TicketObj->FromSQL($Query); 
    102  
    103 # $TicketObj->LimitCustomField( 
    104 #                            CUSTOMFIELD => 3, 
    105 #                            VALUE => $NoteUrl, 
    106 #                            OPERATOR => "=" 
    107 #                            ); 
    108  
    109  
     55$TicketObj->LimitCustomField( 
     56     CUSTOMFIELD => 3, 
     57     VALUE => $NoteUrl, 
     58     OPERATOR => "=" 
     59); 
    11060$count = $TicketObj->CountAll(); 
    111 print STDERR $TicketObj->loc("Found [quant,_1,annotation].\n",$count); 
     61#print $TicketObj->loc("Found [quant,_1,annotation].\n",$count); 
    11262 
    11363print header('text/xml'); 
     
    11868my $annotation; 
    11969while (my $item = $TicketObj->Next) { 
    120     $annotation = ""; 
     70$annotation = ""; 
    12171    my $Transactions = $item->Transactions; 
    122     while (my $Transaction = $Transactions->Next) { 
    123         next unless ($Transaction->Type =~ /^(Create|Correspond|Comment$)/); 
    124                       
    125         my $attachments = $Transaction->Attachments; 
    126 #    my $CustomFields = $item->QueueObj->TicketCustomFields(); 
    127         my $CustomFields = $item->QueueObj->CustomFields(); 
    128         $attachments->GotoFirstItem; 
    129         my $message = $attachments->Next; 
    130         $annotation .= $message->Content; 
    131     } 
     72  while (my $Transaction = $Transactions->Next) { 
     73          next unless ($Transaction->Type =~ /^(Create|Correspond|Comment$)/); 
    13274 
    133         $showagree = '';         
    134         $agr_vals = $item->CustomFieldValues(7); 
    135         if ($$resp == 1) { 
    136  
    137             while ($value = $agr_vals->Next) { 
    138                 if (($name) && ($value->Content eq $name)) { 
    139                     print STDERR "the user agrees with ".$item->id."\n"; 
    140 #                   $showagree = "<a label=\"you have indicated that you agree with this\" name=\"you have indicated that you agree with this\">unagree</a>"; 
    141                     $showagree = "unagree"; 
    142                 } 
    143             } 
    144             if (!$showagree) { 
    145                 $showagree = "agree"; 
    146             } 
    147         } 
    148         else { 
    149             $showagree = "<a href=\"gplv3.fsf.org:8800/launch/login_form\">login</a> to agree"; 
    150              
    151         } 
    152          
    153 #print "ticket has ".$values->count." customfieldvalues\n"; 
    154  
     75    my $attachments = $Transaction->Attachments; 
     76     my $CustomFields = $item->QueueObj->TicketCustomFields(); 
     77    $attachments->GotoFirstItem; 
     78    my $message = $attachments->Next; 
     79    $annotation .= $message->Content; 
     80
    15581# 
    15682#    my $Attachs = $item->TransactionObj->Attachments->First; 
     
    15884# while (my $CustomField = $CustomFields->Next()) { 
    15985# my $CustomFieldValues=$Ticket->CustomFieldValues($CustomField->Id); 
    160         $returnme .= "<cs>Currently showing: $printargs.  <a href=\"javascript:newQuery()\">change</a></cs>\n"; 
    161           $returnme .= "<annotation>\n"; 
     86    $returnme .= "<annotation>\n"; 
    16287#    $returnme .= " <url>" . $item->FirstCustomFieldValue('NoteUrl') . "</url>\n"; 
    16388#    $returnme .= " <dompath>" . $item->FirstCustomFieldValue('NoteDomPath') . "</dompath>\n"; 
    164           $returnme .= " <n>$annotation</n>\n"; 
    165           $returnme .= " <e>" . $item->FirstCustomFieldValue('NoteEndNodeId') . "</e>\n"; 
    166           $noteSelection = $item->FirstCustomFieldValue('NoteSelection'); 
    167           $noteSelection =~ s/</&lt;/g; 
    168           $noteSelection =~ s/>/&gt;/g; 
    169           $returnme .= " <s>" . $noteSelection . "</s>\n";  
    170           $returnme .= " <i>" . $item->FirstCustomFieldValue('NoteStartNodeId') . "</i>\n"; 
    171           $returnme .= " <u>" . $item->Requestors->MemberEmailAddressesAsString . "</u>\n"; 
    172           $returnme .= " <ua>" . $showagree . "</ua>\n"; 
    173           $returnme .= " <at>" . $agr_vals->count . "</at>\n"; 
     89    $returnme .= " <n>$annotation</n>\n"; 
     90    $returnme .= " <e>" . $item->FirstCustomFieldValue('NoteEndNodeId') . "</e>\n"; 
     91    $returnme .= " <s>" . $item->FirstCustomFieldValue('NoteSelection') . "</s>\n";  
     92    $returnme .= " <i>" . $item->FirstCustomFieldValue('NoteStartNodeId') . "</i>\n"; 
     93 
    17494          $returnme .= " <id>" . $item->id . "</id>\n"; 
    175          $returnme .= "</annotation>\n"; 
    176            
    177 #    print STDERR Dumper($item); 
    178 #         print STDERR $item->requestors; 
     95    $returnme .= "</annotation>\n"; 
     96 
     97#    print Dumper($content); 
     98 
    17999    } 
    180100 
     
    184104print $returnme; 
    185105#print Dumper($TicketObj); 
    186  
    187 # LimitByArgs adapted from $RT/lib/Interface/Web.pm's ProcessSearchQuery 
    188 # (out of desperation) 
    189  
    190 sub LimitByArgs { 
    191  
    192     # {{{ Limit priority 
    193     if ( param('ValueOfPriority') ne '' ) { 
    194         $TicketObj->LimitPriority( 
    195             VALUE    => param('ValueOfPriority'), 
    196             OPERATOR => param('PriorityOp') 
    197         ); 
    198         debug('limiting by '.param('ValueOfPriority')); 
    199     } 
    200  
    201     # }}} 
    202     # {{{ Limit owner 
    203     if ( param('ValueOfOwner') ne '' ) { 
    204         $TicketObj->LimitOwner( 
    205             VALUE    => param('ValueOfOwner'), 
    206             OPERATOR => param('OwnerOp') 
    207         ); 
    208         debug('limiting by '.param('ValueOfOwner')); 
    209     } 
    210  
    211     # }}} 
    212     # {{{ Limit requestor email 
    213      if ( param('ValueOfWatcher') ne '' ) { 
    214          my ($field, $property) = split(/\./,param('WatcherField')); 
    215          $TicketObj->LimitWatcher( 
    216 #             TYPE     => $field, 
    217              VALUE    => param('ValueOfWatcher'), 
    218              OPERATOR => param('WatcherOp'), 
    219  
    220         ); 
    221         debug('limiting by '.param('ValueOfWatcher')); 
    222     } 
    223  
    224     # }}} 
    225     # {{{ Limit Queue 
    226     if ( param('ValueOfQueue') ne '' ) { 
    227         $TicketObj->LimitQueue( 
    228             VALUE    => param('ValueOfQueue'), 
    229             OPERATOR => param('QueueOp') 
    230         ); 
    231         debug('limiting by '.param('ValueOfQueue')); 
    232     } 
    233  
    234     # }}} 
    235     # {{{ Limit Status 
    236     if ( param('ValueOfStatus') ne '' ) { 
    237         if ( ref( param('ValueOfStatus') ) ) { 
    238             foreach my $value ( @{ param('ValueOfStatus') } ) { 
    239                 $TicketObj->LimitStatus( 
    240                     VALUE    => $value, 
    241                     OPERATOR => param('StatusOp'), 
    242                 ); 
    243             } 
    244             debug('limiting by '.@{param('ValueOfStatus')}[0]); 
    245         } 
    246         else { 
    247             $TicketObj->LimitStatus( 
    248                 VALUE    => param('ValueOfStatus'), 
    249                 OPERATOR => param('StatusOp'), 
    250             ); 
    251             debug('limiting by '.param('ValueOfStatus')); 
    252         } 
    253  
    254     } 
    255  
    256     # }}} 
    257     # {{{ Limit Subject 
    258     if ( param('ValueOfSubject') ne '' ) { 
    259             my $val = param('ValueOfSubject'); 
    260         if (param('SubjectOp') =~ /like/) { 
    261             $val = "%".$val."%"; 
    262         } 
    263         $TicketObj->LimitSubject( 
    264             VALUE    => $val, 
    265             OPERATOR => param('SubjectOp'), 
    266         ); 
    267         debug('limiting by '.$val); 
    268     } 
    269  
    270     # }}}     
    271     # {{{ Limit Dates 
    272     if ( param('ValueOfDate') ne '' ) { 
    273         my $date = ParseDateToISO( param('ValueOfDate') ); 
    274         ARGS{'DateType'} =~ s/_Date$//; 
    275  
    276         if ( ARGS{'DateType'} eq 'Updated' ) { 
    277             $TicketObj->LimitTransactionDate( 
    278                                             VALUE    => $date, 
    279                                             OPERATOR => param('DateOp'), 
    280             ); 
    281         } 
    282         else { 
    283             $TicketObj->LimitDate( FIELD => ARGS{'DateType'}, 
    284                                             VALUE => $date, 
    285                                             OPERATOR => param('DateOp'), 
    286             ); 
    287         } 
    288     } 
    289  
    290     # }}}     
    291     # {{{ Limit Content 
    292     if ( param('ValueOfAttachmentField') ne '' ) { 
    293         my $val = param('ValueOfAttachmentField'); 
    294         if (param('AttachmentFieldOp') =~ /like/) { 
    295             $val = "%".$val."%"; 
    296         } 
    297         $TicketObj->Limit( 
    298             FIELD   => param('AttachmentField'), 
    299             VALUE    => $val, 
    300             OPERATOR => param('AttachmentFieldOp'), 
    301         ); 
    302     } 
    303  
    304     # }}}    
    305  
    306  # {{{ Limit CustomFields 
    307  
    308     foreach my $arg ( keys %ARGS ) { 
    309         my $id; 
    310         if ( $arg =~ /^CustomField(\d+)$/ ) { 
    311             $id = $1; 
    312         } 
    313         else { 
    314             next; 
    315         } 
    316         next unless ( param($arg) ); 
    317  
    318         my $form = param($arg); 
    319         my $oper = param->{ "CustomFieldOp" . $id }; 
    320         foreach my $value ( ref($form) ? @{$form} : ($form) ) { 
    321             my $quote = 1; 
    322             if ($oper =~ /like/i) { 
    323                 $value = "%".$value."%"; 
    324             } 
    325             if ( $value =~ /^null$/i ) { 
    326  
    327                 #Don't quote the string 'null' 
    328                 $quote = 0; 
    329  
    330                 # Convert the operator to something apropriate for nulls 
    331                 $oper = 'IS'     if ( $oper eq '=' ); 
    332                 $oper = 'IS NOT' if ( $oper eq '!=' ); 
    333             } 
    334             $TicketObj->LimitCustomField( CUSTOMFIELD => $id, 
    335                                                    OPERATOR    => $oper, 
    336                                                    QUOTEVALUE  => $quote, 
    337                                                    VALUE       => $value ); 
    338         } 
    339     } 
    340  
    341  
    342 } 
    343 # {{{ sub ParseDateToISO 
    344  
    345 =head2 ParseDateToISO 
    346  
    347 Takes a date in an arbitrary format. 
    348 Returns an ISO date and time in GMT 
    349  
    350 =cut 
    351  
    352 sub ParseDateToISO { 
    353     my $date = shift; 
    354  
    355     my $date_obj = RT::Date->new($session{'CurrentUser'}); 
    356     $date_obj->Set( 
    357         Format => 'unknown', 
    358         Value  => $date 
    359     ); 
    360     return ( $date_obj->ISO ); 
    361 } 
    362  
    363 # }}} 
    364  
    365  
    366  
    367 =cut 
    368  
    369 # http://gplv3.fsf.org/stet/rt-test.pl?SearchId=new 
    370 Query= 
    371 Format=%27+++%3Cb%3E%3Ca+href%3D%22%2Frt%2FTicket%2FDisplay.html%3Fid%3D__id__%22%3E__id__%3C%2Fa%3E%3C%2Fb%3E%2FTITLE%3A%23%27%2C+%0D%0A%27%3Cb%3E%3Ca+href%3D%22%2Frt%2FTicket%2FDisplay.html%3Fid%3D__id__%22%3E__Subject__%3C%2Fa%3E%3C%2Fb%3E%2FTITLE%3ASubject%27%2C+%0D%0A%27__Status__%27%2C+%0D%0A%27__QueueName__%27%2C+%0D%0A%27__OwnerName__%27%2C+%0D%0A%27__Priority__%27%2C+%0D%0A%27__NEWLINE__%27%2C+%0D%0A%27%27%2C+%0D%0A%27%3Csmall%3E__Requestors__%3C%2Fsmall%3E%27%2C+%0D%0A%27%3Csmall%3E__CreatedRelative__%3C%2Fsmall%3E%27%2C+%0D%0A%27%3Csmall%3E__ToldRelative__%3C%2Fsmall%3E%27%2C+%0D%0A%27%3Csmall%3E__LastUpdatedRelative__%3C%2Fsmall%3E%27%2C+%0D%0A%27%3Csmall%3E__TimeLeft__%3C%2Fsmall%3E%27 
    372 AndOr=AND 
    373 AttachmentField=Subject 
    374 AttachmentOp=LIKE 
    375 ValueOfAttachment= 
    376 QueueOp=%3D 
    377 ValueOfQueue= 
    378 StatusOp=%3D 
    379 ValueOfStatus= 
    380 ActorField=Owner 
    381 ActorOp=%3D 
    382 ValueOfActor= 
    383 WatcherField=Requestor.Name 
    384 WatcherOp=LIKE 
    385 ValueOfWatcher=orion 
    386 DateField=Created 
    387 DateOp=%3C 
    388 ValueOfDate= 
    389 TimeField=TimeWorked 
    390 TimeOp=%3C 
    391 ValueOfTime= 
    392 PriorityField=Priority 
    393 PriorityOp=%3C 
    394 ValueOfPriority= 
    395 LinksField=HasMember 
    396 LinksOp=%3D 
    397 ValueOfLinks= 
    398 idOp=%3C 
    399 ValueOfid= 
    400 %27CF.NoteSelection%27Op=LIKE 
    401 ValueOf%27CF.NoteSelection%27= 
    402 %27CF.NoteDomPath%27Op=LIKE 
    403 ValueOf%27CF.NoteDomPath%27= 
    404 %27CF.NoteUrl%27Op=LIKE 
    405 ValueOf%27CF.NoteUrl%27= 
    406 %27CF.NoteStartNodeId%27Op=LIKE 
    407 ValueOf%27CF.NoteStartNodeId%27= 
    408 %27CF.NoteEndNodeId%27Op=LIKE 
    409 ValueOf%27CF.NoteEndNodeId%27= 
    410 %27CF.NoteText%27Op=LIKE 
    411 ValueOf%27CF.NoteText%27= 
    412 %27CF.Agreeers%27Op=LIKE 
    413 ValueOf%27CF.Agreeers%27= 
    414 AddClause=Add 
    415 Owner=RT%3A%3AUser-12 
    416 Description= 
    417 LoadSavedSearch= 
    418 Link=None 
    419 Title= 
    420 Size= 
    421 Face= 
    422 OrderBy=id 
    423 Order=ASC 
    424 RowsPerPage=50 
  • trunk/searchhi.js

    r11 r13  
    1 /* The MIT Licence, for code from kryogenix.org 
    2 ** 
    3 ** Code downloaded from the Browser Experiments section of kryogenix.org 
    4 ** is licenced under the so-called MIT licence. The licence is below. 
    5 ** 
     1/*  
     2** Copyright (c) 2005, 2006   Software Freedom Law Center, Inc. 
    63** Copyright (c) 1997-2005 Stuart Langridge 
    74** 
     
    2421/* http://www.kryogenix.org/code/browser/searchhi/ */ 
    2522/* Modified 20021006 to fix query string parsing and add case insensitivity */ 
     23/*    Modified-On-Behalf-of-SFLC-By: Orion Montoya <orion@mdcclv.com>   */ 
    2624 
    27 function highlightWord(node,word,tooltip,rtid,altClass) { 
    28   var haveHighlighted = false; 
    29   dump("doing highlightword of "+word+"\n"); 
    30   if (node.hasChildNodes) { 
    31     var iCN; 
    32     dump("this node has "+node.childNodes.length+" childNodes\n"); 
    33     for (iCN=0;iCN<node.childNodes.length;iCN++) { 
    34       dump("going in to "+node.childNodes[iCN].nodeName+"\nfor "+word+" iCN="+iCN+"\n"); 
    35       highlightWord(node.childNodes[iCN],word,tooltip,rtid); 
     25function highlightWord(node,word,tooltip,altClass) { 
     26    var haveHighlighted = false; 
     27 
     28    // Iterate into this node's childNodes 
     29    if (!haveHighlighted) { 
     30    if (node.hasChildNodes) { 
     31      //      dump("iterating into child nodes\n"); 
     32      var hi_cn; 
     33      for (hi_cn=0;hi_cn<node.childNodes.length;hi_cn++) { 
     34        //                dump("going in to "+node.childNodes[hi_cn].nodeName+"\nfor "+word+"\n"); 
     35        highlightWord(node.childNodes[hi_cn],word,tooltip); 
     36      } 
     37      //      dump("done with child nodes\n"); 
     38      } 
     39 
    3640    } 
    37   } 
    38   if (node.nodeType == 3) { // text node 
    39       dump("node is "+node.nodeName+"\n"); 
    40     if (!haveHighlighted) { 
    41       dump("haven't highlighted\n"); 
    42     paragraph = node.parentNode.parentNode; 
    43     paragraphString = (new XMLSerializer).serializeToString(paragraph); 
    44     paragraphString.replace(/\s+/g,' '); 
    45     tempNodeVal = paragraphString; 
    46     tempWordVal = word; 
    47     tempWordVal = tempWordVal.replace(/\W+/g,'[\\W\\s]+(<[^>]+>)?'); 
    48  
    49         var re = new RegExp(tempWordVal, 'mi'); 
    50         //    var re = new RegExp("software", 'mig'); 
    51     dump("re is "+re+"\n"); 
    52             tooltipString = (new XMLSerializer).serializeToString(tooltip); 
    53             var ticketLink = rtid ? '<a href="/rt/Ticket/Display.html?id='+rtid+'">[+]</a>' : '[reload for ticket link]'; 
    54  
    55     paragraphString = paragraphString.replace(re,'<span class="highlight">$&<span class="annotation">'+tooltipString+ticketLink+' </span></span>'); 
    56     //     dump("replaced on "+$&+"\n"); 
    57     dump("pString is now "+paragraphString+"\n"); 
    58     node.parentNode.parentNode.innerHTML = paragraphString; 
    5941     
    60     //    haveHighlighted=true; 
    61     } 
    62   } 
    63 
    64  
    65 /*      if ((ni = tempNodeVal.search(re)) && (ni != -1)) { 
     42    // And do this node itself 
     43    if (node.nodeType == 3) { // text node 
     44      if (!haveHighlighted) { 
     45      //tempNodeVal = escape(node.nodeValue.toLowerCase()); 
     46      //tempWordVal = escape(word.toLowerCase()); 
     47      node.nodeValue = node.nodeValue.replace(/\s+/g,' '); 
     48       
     49      tempNodeVal = node.nodeValue; 
     50      tempWordVal = word; 
     51      tempWordVal = tempWordVal.replace(/\W+/g,'[\\W\\s]+'); 
     52      //tempWordVal = tempWordVal.replace(/\W+/g,' '); 
     53      //      dump('trying with\n'+escape(tempWordVal)+'\non\n'+escape(tempNodeVal)+"\n"); 
     54      var re = new RegExp(tempWordVal, 'mi'); 
     55      if ((ni = tempNodeVal.search(re)) && (ni != -1)) { 
    6656        //if (tempNodeVal.indexOf(tempWordVal) != -1) { 
    67               dump(tempWordVal+' matched!\n'); 
     57        //    dump(tempWordVal+' matched!\n'); 
    6858        pn = node.parentNode; 
    69         //     if (pn.className != "highlight") { 
     59        if (pn.className != "highlight") { 
    7060          // word has not already been highlighted! 
    7161          //                            nv = escape(node.nodeValue); 
    72           nv = paragraphString
     62          nv = node.nodeValue
    7363          //ni = tempNodeVal.indexOf(tempWordVal); 
    7464          // Create a load of replacement nodes 
     
    7868          hiwordtext = document.createTextNode(docWordVal); 
    7969          hiword = document.createElement("span"); 
    80 //        if (altClass) { dump("altClass is "+altClass+"\n"); } 
    81 //        hiword.className = altClass ? altClass : "highlight"; 
    82           hiword.className = "highlight"; 
    83           //      tooltiptext = document.createTextNode(tooltip); 
    84             tooltipString = (new XMLSerializer).serializeToString(tooltip); 
    85           hiword.title = tooltipString; 
    86           //      dump('tooltiptext is '+tooltiptext.+"\n"); 
     70          if (altClass) { dump("altClass is "+altClass+"\n"); } 
     71          hiword.className = altClass ? altClass : "highlight"; 
     72          hiword.title = tooltip; 
    8773          hiword.appendChild(hiwordtext); 
    8874          if (tooltip) { 
    8975            annote = document.createElement("span"); 
    9076            annote.className = "annotation"; 
    91             linkToTkt = document.createElement("a"); 
    92             linkToTkt.href = '/rt/Ticket/Display.html?id='+rtid; 
    93             linkToTkt.appendChild(document.createTextNode('[+]')); 
    94             annoteText = document.createElement('span'); 
    95             annoteText.innerHTML = tooltipString; 
    96 //          annoteText.appendChild(tooltiptext); 
     77            annoteText = document.createTextNode(tooltip); 
    9778            annote.appendChild(annoteText); 
    98             //      annote.appendChild(tooltipString); 
    99             annote.appendChild(linkToTkt); 
    10079            hiword.appendChild(annote); 
    10180          } 
    102           dump(before); 
    103           //      pn.innerHTML=""; 
    10481          pn.insertBefore(before,node); 
    10582          pn.insertBefore(hiword,node); 
    10683          pn.insertBefore(after,node); 
    10784          pn.removeChild(node); 
     85          haveHighlighted = true; 
     86        } 
     87        else if (pn.className == "noteLive") { 
     88          pn.setAttribute("class","highlight"); 
     89        } 
     90        } 
    10891      } 
    109           haveHighlighted = true; 
     92      /*                else { */ 
     93      /*                  highlightWord(node.parentNode,word,tooltip); */ 
     94      /*                } */ 
     95       
     96    } 
    11097 
    111           //    } 
    112           //    else if (pn.className == "noteLive") { 
    113           //      pn.setAttribute("class","highlight"); 
    114           //    } 
    115         } 
    116   } 
    11798} 
    11899 
    119 */ 
     100function XPointerHighlight() { 
     101//      if (!document.createElement) return; 
     102//      ref = document.referrer; 
     103//      if (ref.indexOf('?') == -1) return; 
     104//      qs = ref.substr(ref.indexOf('?')+1); 
     105//      qsa = qs.split('&'); 
     106//      for (i=0;i<qsa.length;i++) { 
     107//              qsip = qsa[i].split('='); 
     108//              if (qsip.length == 1) continue; 
     109//              if (qsip[0] == 'q' || qsip[0] == 'p') { // q= for Google, p= for Yahoo 
    120110 
    121 window.onload = loadXMLDoc('http://localhost/cgi-bin/rt-test.pl?NoteUrl='+location.href); 
     111//              hardcoded = 'copying, distribution and modification'; 
     112//              hardid = 'terms.0.p2.s1'; 
     113 
     114//                      words = unescape(qsip[1].replace(/\+/g,' ')).split(/\s+/); 
     115//                      for (w=0;w<words.length;w++) { 
     116 
     117 
     118//                              highlightWord(document.getElementsByTagName("body")[0],words[w]); 
     119//                              highlightWord(document.getElementById(hardid),hardcoded); 
     120//                              highlightWord(document.getElementsByTagName("body")[0],hardcoded); 
     121 
     122 
     123 
     124 //                     } 
     125//              } 
     126//      } 
     127
     128 
     129//window.onload = XPointerHighlight; 
     130window.onload = loadXMLDoc('http://localhost/cgi-bin/rt-test.pl'); 
  • trunk/selectxpath.xsl

    r12 r13  
    3333        <title><xsl:value-of select="//head/title"/></title> 
    3434        <script type="text/javascript" src="stet.js"/> 
     35        <script type="text/javascript" language="javascript"> 
     36window.onload = initPage(); 
     37</script> 
     38 
    3539        <link rel="stylesheet" type="text/css" href="stet.css"/> 
    3640      </head> 
    3741      <body onkeypress="checkKeyPressed(event);" bgcolor="#FFFFFF"> 
    3842<div id="topbar" class="topbar"> 
    39 <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> 
     43<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 yet.  You may need to <a href="/comments/email.html">email your comments</a> instead, or try another recent Gecko-based browser.</span>         <span id="querydiv" style="display:none"></span> 
    4044          <span id="login" class="login"></span> 
    4145</div> 
     46      <div class="portlet" id="portlet-dogear"> 
     47        <div class="portletBody"> 
     48          <img alt="" src="http://gplv3.fsf.org/dogear.png" /> 
     49        </div> 
     50      </div> 
     51 
     52   <h1 id="portal-logo"> 
     53     <a href="http://gplv3.fsf.org" accesskey="1">GPLv3</a> 
     54</h1> 
     55 
     56    <ul id="portal-globalnav"> 
     57        <li class="plain"> 
     58            <a href="http://gplv3.fsf.org">Home</a></li> 
     59        <li class="selected"> 
     60            <a href="http://gplv3.fsf.org/comments/">Comments</a></li> 
     61        <li class="plain"> 
     62            <a href="http://gplv3.fsf.org/wiki/">Wiki</a></li> 
     63        <li class="plain"> 
     64            <a href="http://gplv3.fsf.org/press">Press</a></li> 
     65    </ul> 
     66 
     67<ul id="portal-personaltools"> 
     68</ul> 
     69           
     70 
     71 
    4272        <div id="maintext"> 
    4373          <xsl:apply-templates/> 
     
    5888 
    5989  <xsl:template match="//head"> 
    60     <section id="title"><p id="title.0"><sent id="title.0.0"><h1><xsl:value-of select="title"/></h1></sent></p
     90    <section id="title"><h1><p id="title.0"><sent id="title.0.0"><xsl:value-of select="title"/></sent></p></h1
    6191    <p id="title.1"><sent id="title.1.0"><xsl:value-of select="pubdate"/></sent></p> 
    6292    <p id="status.0"><sent id="status.0.0"><strong><xsl:value-of select="status"/></strong></sent></p> 
     
    84114  <xsl:template match="//body"> 
    85115    <p><a href="javascript:XpathSel()">select some text and then type "c" to submit comments.</a></p> 
    86  
    87 <!--    <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> 
    88  
    89         <p><strong>Notes 2006-01-06</strong> 
    90         <ul> 
    91         <li>You can now agree with a comment, or once you've agreed you may revoke your agreement if you change your mind.</li> 
    92         <li>Comments are now excerpted if they're long.  Toggle them by clicking anywhere on them, or on the [+]</li> 
    93         <li>agreement/disagreement/ticketlink are all behind the [+] now</li> 
    94         <li>Comments now ask you to put a subject or summary: a change in presumption, from presuming brevity to presuming lengthiness.</li> 
    95         </ul> 
    96         </p> 
    97  
    98     <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> 
    99  
    100 --> 
    101116<!--    <p>Toggle display of <a href="javascript:toggle('add')">additions</a> | <a href="javascript:toggle('del')">deletions</a> [none yet on these documents]</p> --> 
    102117 
    103118    <xsl:for-each select="section"> 
    104       <h3><xsl:value-of select="title"/></h3> 
    105119      <section id="{@id}" name="{@id}"> 
     120       <p class="sectTitle" id="{@id}.0"><sent id="{@id}.0.0"><xsl:value-of select="title"/></sent></p> 
     121       <p class="sectTitle sub" id="{@id}.0.0.0"><sent id="{@id}.0.0.0.0"><xsl:value-of select="subtitle"/></sent></p> 
    106122        <xsl:for-each select="p"> 
    107123          <p id="{@id}" name="{@id}"> 
  • trunk/stet-submit.pl

    r11 r13  
    2626use Data::Dumper; 
    2727 
    28 use MIME::Base64; 
    29 use Frontier::Client; 
    30  
    31 use lib '/usr/share/request-tracker3.2/lib'; 
    32 use lib '/usr/share/request-tracker3.2/libexec'; 
    33  
    3428use lib '/usr/share/request-tracker3.4/lib'; 
    3529use lib '/usr/share/request-tracker3.4/libexec'; 
    36  
    3730#use RT::Interface::CLI; 
    3831use RT; 
    39 use RT::Ticket; 
    40 use RT::CurrentUser; 
    41 use RT::Queues; 
    42 require "/var/www/stet/stetsubs.pl"; 
    43 RT::LoadConfig(); 
    44 RT::Init(); 
    4532 
    4633print header('text/xml'); 
    4734 
     35my $returnme; 
    4836if(param()) { 
     37     
     38$url = param('NoteUrl'); 
     39$dompath = param('DomPath'); 
     40$selectedtext = param('Selection'); 
     41$start = param('StartNode'); 
     42$startid = param('StartNodeId'); 
     43$end = param('EndNode'); 
     44$endid = param('EndNodeId'); 
     45$notetext = param('NoteText'); 
    4946 
    50 $url = param('NoteUrl'); 
    51  
    52 $urlpath = $url; 
    53 $urlpath =~ s/http:\/\/([^\/]+)(\/.*)\?/$2/; 
    54  
    55 $url =~ s/.*\/([^\/]+)/$1/; 
    56  
    57 $dompath = param('DomPath'); 
    58 $selectedtext = URI::Escape::uri_unescape(param('Selection')); 
    59 $notesubj = URI::Escape::uri_unescape(param('NoteSubj')); 
    60 # $start = param('StartNode'); 
    61 $startid = param('StartNodeId'); 
    62 # $end = param('EndNode'); 
    63 $endid = param('EndNodeId'); 
    64 $notetext = URI::Escape::uri_unescape(param('NoteText')); 
    65  
    66 } 
    67  
    68 our $name; 
    69 my ($CurrentUser, $resp) = getUser(); 
    70  
    71 print STDERR "auth boolean for $name was $resp\n"; 
    72 if ($resp == 0) { 
    73  
    74 print <<"EOF"; 
    75 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
    76 <response> 
    77  <cs>Your comment was not submitted because you could not be authenticated.  <a href=\"changeshown.html\">change query</a></cs> 
    78  <annotation> 
    79   <u>Authentication error</u> 
    80   <i>$startid</i> 
    81   <e>$endid</e> 
    82   <n>Your comment was not saved.  You need to <a href="http://gplv3.fsf.org:8800/launch/login_form?came_from=$urlpath">login</a> in order to make comments.  The text of your comment was:<br/> <strong>Subject:</strong>$notesubj<br/>$notetext</n> 
    83   <s>$selectedtext</s> 
    84   <id>x</id> 
    85   <ua>x</ua> 
    86   <at>x</at> 
    87  </annotation> 
    88 </response> 
    89 EOF 
    90 } 
    91  
    92  
    93 elsif ($resp == 1) { 
    94  
    95 param('queue') ? $queue = param('queue') : $queue = "Inbox"; 
    96  
    97 #my $CurrentUser = RT::CurrentUser->new(); 
    98 #$CurrentUser->LoadByName($name); 
    99  
    100 my $ThisQueue = RT::Queue->new($CurrentUser); 
    101   $ThisQueue->Load($queue); 
    102   if ($CurrentUser->HasRight( Right => 'SeeQueue', Object => $ThisQueue )) { 
    103       $realqueue = $queue; 
    104   } 
    105   else { 
    106       $realqueue = "Inbox"; 
    107   } 
    108      
    109 my $returnme; 
    11047$returnme .=  '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'."\n"; 
    11148$returnme .= "<response>\n"; 
    112 $returnme .= "<cs>Your comment was submitted.  <a href=\"javascript:newQuery()\">change query</a></cs>\n"; 
     49 
    11350$returnme .= "<annotation>\n"; 
    11451$returnme .= " <n>$notetext</n>\n"; 
     
    11653$returnme .= " <s>$selectedtext</s>\n";  
    11754$returnme .= " <i>$startid</i>\n"; 
    118 # two more come after we submit to RT... 
    119  
    120  
    121 #print STDERR ref($resp) ? $resp->value : "Error: $resp"; 
    122  
    123 #print STDERR Dumper($resp); 
    12455 
    12556 
    12657 
     58#    print Dumper($content); 
     59 
     60} 
     61 
     62 
     63 
     64 
     65 
     66RT::LoadConfig(); 
     67RT::Init(); 
     68use RT::Ticket; 
     69use RT::CurrentUser; 
     70my $CurrentUser = RT::SystemUser(); 
     71 
    12772use MIME::Entity; 
    12873 
    129 print STDERR "stet-submit name is '$name'\n"
     74  print STDERR "Have extra data '$j'\n" if $j
    13075  my $ticket = new RT::Ticket($CurrentUser); 
    13176  my $ticket_body = MIME::Entity->build(Data => $notetext, 
    13277                                       Type => 'text/plain'); 
    133   my %ticket_vals = ( Queue => $realqueue
    134                       Subject => $notesubj
    135 #                      Owner => 'Nobody', 
    136                       Requestor => \$CurrentUser, #$name
    137                       #InitialPriority => '11', 
    138                       #FinalPriority => '20', 
     78  my %ticket_vals = ( Queue => 'General'
     79                      Subject => $selectedtext
     80                      Owner => 'root', 
     81                      Requestor => 'moglen@columbia.edu'
     82                      InitialPriority => '11', 
     83                      FinalPriority => '20', 
    13984                      MIMEObj => $ticket_body, 
    14085                      'CustomField-1' => $selectedtext, 
     
    14489                      'CustomField-5' => $endid, 
    14590                      'CustomField-6' => $notetext, 
    146                       'CustomField-7' => $name, 
    147                       ); 
     91                    ); 
    14892  my ($id, $transaction_object, $err) = $ticket->Create(%ticket_vals); 
    14993  print STDERR $err . "\n" if $err; 
    15094 
    15195$returnme .= " <id>$id</id>\n"; 
    152 $returnme .= " <u>$name</u>\n"; 
    153 $returnme .= " <ua>unagree</ua>\n"; 
    154   $returnme .= " <at>1</at>\n"; 
    15596 
    15697$returnme .= "</annotation>\n"; 
    15798$returnme .= "</response>\n"; 
    15899print $returnme; 
    159  
    160  
    161 } 
    162  
  • trunk/stet.css

    r12 r13  
    2222/* along with this software.  If not, see <http://www.gnu.org/licenses/>. */ 
    2323 
     24body { 
     25    font: 94% Verdana, Lucida, Helvetica, Arial, sans-serif; 
     26} 
    2427em.del {  
    2528      font-style: normal; 
     
    7881    line-height: normal; 
    7982}