Changeset 56

Show
Ignore:
Timestamp:
02/24/05 14:03:32
Author:
tobias
Message:

Added some comment test cases to test form - javascript required; don't have any trackback samples

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plugins/spamlookup/spamlookup.pl

    r55 r56  
    220220    my $pdata; 
    221221    my $cache = {}; 
     222    # ignore previously cached results if we perform a 'Test' 
     223    $data->{caching_enabled}=0 if $method eq 'Test'; 
    222224    if ($data->{caching_enabled} && $data->{cache_limit}) { 
    223225        $pdata = MT::PluginData->load({ 
  • trunk/plugins/spamlookup/tmpl/slheader.tmpl

    r54 r56  
    2525} 
    2626</script> 
     27 
     28<TMPL_IF NAME=NAV_TEST><script type="text/javascript"> 
     29var commentCases=new Array ( 
     30        new Array ( 
     31                "5 URLs in the comment body", 
     32                "", "", "", "",  
     33                "http://www.google.com/ http://www.google.com/ http://www.google.com/ http://www.google.com/ http://www.google.com/" 
     34        ), 
     35        new Array ( 
     36                "10 URLs in the comment body", 
     37                "", "", "", "",  
     38                "http://www.google.com/ http://www.google.com/ http://www.google.com/ http://www.google.com/ http://www.google.com/ http://www.google.com/ http://www.google.com/ http://www.google.com/ http://www.google.com/ http://www.google.com/" 
     39        ), 
     40        new Array ( 
     41                "pillgrowth.com - matching on blacklist at bsb.empty.us", 
     42                "", "", "http://www.pillgrowth.com/", "", "http://www.pillgrowth.com/" 
     43        ), 
     44        new Array ( 
     45                "148.244.150.58 - matching on blacklist at bsb.empty.us", 
     46                "148.244.150.58", "", "", "", "<a href=\"http://www.levitra-cheap.com/\">Levitra</a> - <a href=\"http://www.levitra-cheap.com/\">Buy Levitra" 
     47        ), 
     48        new Array ( 
     49                "67.84.184.9 - matching on blacklist at opm.blitzed.org", 
     50                "67.84.184.9", "", "", "", "<a href=\"http://alania.100free.com/sexkontakte-freiburg.html\">sexkontakte freiburg</a>" 
     51        ) 
     52 
     53); 
     54var trackbackCases = new Array ( 
     55        new Array ( 
     56                "Trackback Sample 1", 
     57                "IP address 1", "Name 1", "URL 1", "Email 1", "Message 1" 
     58        ), 
     59        new Array ( 
     60                "Trackback Sample 2", 
     61                "IP address 2", "Name 2", "URL 2", "Email 2", "Message 2" 
     62        ) 
     63); 
     64 
     65function setCommentForm(formid,value) 
     66{ 
     67        if(value == 0) { 
     68                return; 
     69        } 
     70        var f = document.getElementById(formid); 
     71        f.comment_ip.value = commentCases[value-1][1]; 
     72        f.comment_name.value = commentCases[value-1][2]; 
     73        f.comment_url.value = commentCases[value-1][3]; 
     74        f.comment_email.value = commentCases[value-1][4]; 
     75        f.comment_message.value = commentCases[value-1][5]; 
     76} 
     77function setTBForm(formid,value) 
     78{ 
     79        if(value == 0) { 
     80                return; 
     81        } 
     82        var f = document.getElementById(formid); 
     83        f.tb_ip.value = trackbackCases[value-1][1]; 
     84        f.tb_name.value = trackbackCases[value-1][2]; 
     85        f.tb_url.value = trackbackCases[value-1][3]; 
     86        f.tb_title.value = trackbackCases[value-1][4]; 
     87        f.tb_message.value = trackbackCases[value-1][5]; 
     88} 
     89 
     90</script></TMPL_IF> 
     91 
    2792<style type="text/css"> 
    2893.sub a#nav-despam-comments { background-image: url(<TMPL_VAR NAME=STATIC_URI>images/nav-search.gif); } 
  • trunk/plugins/spamlookup/tmpl/test.tmpl

    r55 r56  
    4343    <h4>Comment Test Form</h4> 
    4444 
    45 <form method="post" action="<TMPL_VAR NAME=SCRIPT_URL>"> 
     45<form id="comment_form" method="post" action="<TMPL_VAR NAME=SCRIPT_URL>"> 
     46 
     47<script type="text/javascript"> 
     48        document.write("<p>Select a known test case: <select name='samples' onChange=\"setCommentForm('comment_form',document.getElementById('comment_form').samples.selectedIndex);\">"); 
     49        document.write("<option selected>- choose a test case -</option>"); 
     50        for(i=0;i<commentCases.length;i++) { 
     51                document.write("<option>" + commentCases[i][0] + "</option>"); 
     52        } 
     53        document.write("</select>"); 
     54        document.write("</p>"); 
     55</script> 
     56 
    4657    <input type="hidden" name="__mode" value="test" /> 
    4758    <input type="hidden" name="_type" value="comment" /> 
     
    7586    <h4>TrackBack Test Form</h4> 
    7687 
    77 <form method="post" action="<TMPL_VAR NAME=SCRIPT_URL>"> 
     88<form id="tb_form" method="post" action="<TMPL_VAR NAME=SCRIPT_URL>"> 
    7889    <input type="hidden" name="__mode" value="test" /> 
    7990    <input type="hidden" name="_type" value="ping" /> 
     91 
     92<script type="text/javascript"> 
     93        document.write("<p>Select a known test case: <select name='samples' onChange=\"setTBForm('tb_form',document.getElementById('tb_form').samples.selectedIndex);\">"); 
     94        document.write("<option selected>- choose a test case -</option>"); 
     95        for(i=0;i<trackbackCases.length;i++) { 
     96                document.write("<option>" + trackbackCases[i][0] + "</option>"); 
     97        } 
     98        document.write("</select>"); 
     99        document.write("</p>"); 
     100</script> 
     101 
    80102    <p> 
    81103    Simulated originating IP: