Changeset 17884 for misc/runpugs

Show
Ignore:
Timestamp:
09/17/07 17:44:19 (14 months ago)
Author:
azawawi
Message:

[runpugs] fixed html escaping problem (my @a = <foo 1 2 3>)
[runpugs] fixed prompt not being taken from server
[runpugs] fixed duplicate prompt
[runpugs] updated html/css for cross-browser compatibility

Location:
misc/runpugs/htdocs
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • misc/runpugs/htdocs/runpugs.css

    r17872 r17884  
    11body { 
    2         font:14px arial,helvetica,clean,sans-serif; 
     2        font:13px arial,helvetica,clean,sans-serif; 
    33        width:100%; 
    44        margin-left:10%;margin-right:10%; margin-top: 0px;  
     
    104104.cc { 
    105105        font-family: 'Courier New', Monaco, Courier, monospace; 
    106         font-size: 14px; 
     106        font-size: 13px; 
    107107        color: white; 
    108108        background-color: black; 
    109         padding: 5px; 
    110         width:100%; 
     109        padding: 0px; 
     110        margin: 0px; 
     111        width: 100%; 
    111112        line-height:normal; 
    112113        height:24em; 
    113114        overflow: auto; 
    114         border: 1px solid white; 
     115        /*border: 1px solid white;*/ 
    115116} 
    116117pre { 
     
    154155span.cursorOn { 
    155156        font-family: 'Courier New', Monaco, Courier, monospace; 
    156         font-size: 14px; 
     157        font-size: 13px; 
    157158        display:inline; 
    158159        background: white; 
     
    170171span.cursorOff { 
    171172        font-family: 'Courier New', Monaco, Courier, monospace; 
    172         font-size: 14px; 
     173        font-size: 13px; 
    173174        display:inline; 
    174175        background: black; 
  • misc/runpugs/htdocs/runpugs/index.html

    r17872 r17884  
    3939                </div> 
    4040                <div id='status'></div> 
    41                 <div class='note' style='padding: 5px'> 
    42                     <p>This live web terminal runs the <a href="http://www.pugscode.org/">Pugs</a> 
     41                <div class='note' style='padding: 5px;'> 
     42                    This live web terminal runs the <a href="http://www.pugscode.org/">Pugs</a> 
    4343                    interpreter for <a href="http://dev.perl.org/perl6/">Perl&nbsp;6</a>. 
    4444                    This is the development version, featuring asynchronous jQuery AJAX, 
    45                     mod_perl and preloaded pugs sessions.</p> 
     45                    mod_perl and preloaded pugs sessions. 
    4646                    <h2>Instructions</h2> 
    47                     <p><code>runpugs</code> presents the pugs interactive shell. <code>runpugs</code>-specific commands:</p> 
     47                    <code>runpugs</code> presents the pugs interactive shell. <code>runpugs</code>-specific commands: 
    4848                    <dl> 
    4949                    <dt><code>help</code></dt><dd> displays the Pugs shell help (same as 
     
    5858                    </p> 
    5959                    <h2>Restrictions</h2> 
    60                     <p>Because this is a web terminal, a number of restrictions apply.  
    61                     Please <a href="http://feather.perl6.nl/%7Eandara/runpugs/">read the documentation</a> for more information.</p> 
    62                     <p class="copyright"> 
    63                     &copy; Copyright 2006 by Wim.Vanderbauwhede. Contact me @ gmail.com<br/> 
    64                     Enhanced web terminal by Ahmad.Zawawi. Contact me @ gmail.com 
    65                     </p> 
     60                    Because this is a web terminal, a number of restrictions apply.  
     61                    Please <a href="http://feather.perl6.nl/%7Eandara/runpugs/">read the documentation</a> for more information. 
     62                    <br/> 
    6663                </div> 
    6764            </form> 
    6865        </div> 
    69         <iframe src="/perl/runpugs.pl" id="scratch" name="scratch" style="visibility:hidden"  
    70         width="700px" height="1px" onLoad="getreply()"></iframe> 
     66        <span class="copyright">&copy; Copyright 2006 by Wim.Vanderbauwhede. Contact me @ gmail.com<br/> 
     67            Enhanced web terminal by Ahmad.Zawawi. Contact me @ gmail.com 
     68        </span> 
    7169        <hr/> 
    7270        <a href="http://validator.w3.org/check?uri=referer"> 
     
    7472                alt="Valid XHTML 1.0!" height="31" width="88" border="0" /> 
    7573        </a>         
     74        <iframe src="/perl/runpugs.pl" id="scratch" name="scratch" style="visibility:hidden"  
     75        width="700px" height="1px" onLoad="getreply()"></iframe> 
    7676    </body> 
    7777</html> 
  • misc/runpugs/htdocs/runpugs/runpugs.js

    r17872 r17884  
    122122    if(keyCode == 13) { 
    123123        //enter 
    124         var sessCmds=document.terminal.cmd.value + "\n" + prompt + cmd; 
    125         var tmpCmds=sessCmds.split('pugs> '); 
     124        var sessCmds=document.terminal.cmd.value + cmd; 
     125        var tmpCmds=sessCmds.split(prompt); 
    126126        var tmpCmd=tmpCmds[tmpCmds.length-1]; 
    127127        if($.trim(tmpCmd) != "") { 
     
    247247    sessionid=scratchpad.terminal.sessionid.value; 
    248248    document.terminal.cmd.value=reply; 
    249  
    250         cmds = reply.replace(/ /g,'&nbsp;').split(/\r\n|\n|\r/g); 
     249     
     250    if(scratchpad.terminal.prompt) { 
     251        //safely assign prompt... 
     252        var val = scratchpad.terminal.prompt.value; 
     253        if(val && val.length == 'pugs> '.length) { 
     254            prompt = val; 
     255        } 
     256    } 
     257     
     258    //escape html from whitespace and html entities 
     259    //and then split lines 
     260        cmds =  
     261        reply.replace(/&/g,'&amp;') 
     262        .replace(/ /g,'&nbsp;') 
     263        .replace(/</g,'&lt;') 
     264        .replace(/>/g,'&gt;') 
     265        .replace(/"/g,'&quot;') 
     266        .split(/\r\n|\n|\r/g); 
    251267    updateConsole(); 
    252268    cmd = ""; 
    253269    curpos=0; 
    254     moveCursor(); 
     270    //moveCursor(); 
    255271    showCmd(); 
    256272}