fixed debugger, thanks Mariano and Paolo
This commit is contained in:
2
VERSION
2
VERSION
@@ -1 +1 @@
|
||||
Version 2.4.1-alpha.2+timestamp.2012.12.26.11.43.58
|
||||
Version 2.4.1-alpha.2+timestamp.2012.12.26.11.54.07
|
||||
|
||||
@@ -180,9 +180,16 @@ function doToggleBreakpoint(filename, url) {
|
||||
if (json.error) {
|
||||
window.location.href=json.redirect;
|
||||
} else {
|
||||
// mark the breakpoint if ok=True
|
||||
// remove mark if ok=False
|
||||
// do nothing if ok = null
|
||||
if (json.ok==true && window.mirror) {
|
||||
// mark the breakpoint if ok=True
|
||||
editor.setMarker(json.lineno-1,
|
||||
"<span style='color: red'>●</span> %N%")
|
||||
} else if (json.ok==false && window.mirror) {
|
||||
// remove mark if ok=False
|
||||
editor.setMarker(json.lineno-1, "%N%")
|
||||
} else {
|
||||
// do nothing if ok = null
|
||||
}
|
||||
// alert(json.ok + json.lineno);
|
||||
}
|
||||
} catch(e) { on_error(); }
|
||||
|
||||
@@ -1,114 +1,137 @@
|
||||
{{extend 'layout.html'}}
|
||||
|
||||
{{block sectionclass}}debug{{end}}
|
||||
|
||||
<style>
|
||||
table.sortable {
|
||||
border-spacing:0px;
|
||||
}
|
||||
table.sortable td, table.sortable th {
|
||||
padding: 2px 5px 2px 5px;
|
||||
}
|
||||
table.sortable thead {
|
||||
background-color:#eee;
|
||||
color:#666666;
|
||||
font-weight: bold;
|
||||
cursor: default;
|
||||
}
|
||||
tr.error_ticket:hover {
|
||||
background-color: #eee;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script language="JavaScript">
|
||||
function check(){
|
||||
for (var i = 0; i < document.myform.elements.length; i++) {
|
||||
var e = document.myform.elements[i];
|
||||
if (e.type == 'checkbox') e.checked = true;
|
||||
}
|
||||
}
|
||||
function uncheck(){
|
||||
for (var i = 0; i < document.myform.elements.length; i++) {
|
||||
var e = document.myform.elements[i];
|
||||
if (e.type == 'checkbox') e.checked = false;
|
||||
}
|
||||
}
|
||||
jQuery(document).ready(function() { jQuery('.sourcecode').hide(); });
|
||||
</script>
|
||||
|
||||
<div class="applist f60">
|
||||
<div class="applist_inner">
|
||||
|
||||
<h2>{{=T("Breakpoints")}}</h2>
|
||||
|
||||
<div class="errorform">
|
||||
<form name="myform" method="post">
|
||||
<input name="CheckAll" value="{{=T('check all')}}"
|
||||
onclick="check()" type="button">
|
||||
<input name="CheckAll" value="{{=T('uncheck all')}}"
|
||||
onclick="uncheck()" type="button">
|
||||
<input value="{{=T('delete all checked')}}" type="submit"><br><br>
|
||||
|
||||
<table id="trck_breakpoints" class="sortable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{=T("Delete")}}</th>
|
||||
<th>{{=T("Filename")}}</th>
|
||||
<th>{{=T("LineNo")}}</th>
|
||||
<th>{{=T("Temporary")}}</th>
|
||||
<th>{{=T("Condition")}}</th>
|
||||
<th>{{=T("Hits")}}</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{for bp in breakpoints:}}
|
||||
<tr class="breakpoint">
|
||||
<td><input type="checkbox" name="delete_{{=bp['number']}}" /></td>
|
||||
<td>{{=bp['filename']}}</td>
|
||||
<td>{{=A(bp['lineno'],_href="#",_onclick="collapse('%s');" % bp['number'])}}</td>
|
||||
<td>{{=bp['temporary']}}</td>
|
||||
<td>{{=bp['condition']}}</td>
|
||||
<td>{{=bp['hits']}}</td>
|
||||
</tr>
|
||||
<tr id="{{=bp['number']}}" class="sourcecode">
|
||||
<td colspan="6">
|
||||
<div>
|
||||
{{=CODE(open(bp['path']).read(), language='python',
|
||||
link=None, highlight_line=bp['lineno'], context_lines=10)}}
|
||||
{{
|
||||
frm_trs = form.elements('tr')
|
||||
tbl_rows = []
|
||||
for frm_tr in frm_trs:
|
||||
if frm_tr['_id'] != 'submit_record__row':
|
||||
fld_label = frm_tr.element('td.w2p_fl')
|
||||
fld_widget = frm_tr.element('td.w2p_fw')[0]
|
||||
fld_comment = frm_tr.element('td.w2p_fc')[0]
|
||||
lbls = fld_label.elements('label')
|
||||
lbl = ''
|
||||
if len(lbls) > 0:
|
||||
lbl = fld_label.elements('label')[0]
|
||||
lbl['_class'] = 'control-label'
|
||||
pass
|
||||
if fld_widget['_type'] == 'checkbox':
|
||||
fld_widget = LABEL(fld_widget, _class='checkbox')
|
||||
else:
|
||||
fld_widget = CAT(fld_widget, SPAN('', _class='help-inline'))
|
||||
pass
|
||||
if isinstance(fld_widget, SPAN):
|
||||
fld_widget['_role'] = 'asinput'
|
||||
pass
|
||||
tbl_row = DIV(lbl, DIV(fld_widget,
|
||||
TAG['SMALL'](fld_comment,
|
||||
_class='help-block'),
|
||||
_class='controls'), _class='control-group')
|
||||
tbl_rows.append(tbl_row)
|
||||
else:
|
||||
smt_btn = frm_tr.element('td.w2p_fw')
|
||||
btn = smt_btn.elements('input')[0]
|
||||
btn['_class'] = 'btn btn-primary'
|
||||
tbl_rows.append(DIV(btn, _class='controls'))
|
||||
pass
|
||||
pass
|
||||
form.element('table', replace=CAT(*tbl_rows))
|
||||
form['_class'] = 'form-horizontal well well-small'
|
||||
import re
|
||||
if form.errors:
|
||||
for key, value in form.errors.iteritems():
|
||||
inpt = form.element(_name=key)
|
||||
inpt_wrapper = inpt.parent
|
||||
if inpt_wrapper['_class'] == None or \
|
||||
not "controls" in inpt_wrapper['_class']:
|
||||
inpt_wrapper = inpt_wrapper.parent
|
||||
pass
|
||||
inpt_wrapper.parent['_class'] += ' error'
|
||||
inpt_wrapper.element(_class=re.compile('help-inline'),
|
||||
replace=lambda me:SPAN(value, _class=me['_class']))
|
||||
pass
|
||||
form.errors.clear()
|
||||
pass
|
||||
}}
|
||||
<!-- begin "debug" block -->
|
||||
<div class="row-fluid">
|
||||
<div class="applist f60 span7" style="padding-bottom:20px;">
|
||||
<div class="applist_inner">
|
||||
<h2>{{=T("Breakpoints")}}</h2>
|
||||
<div class="errorform">
|
||||
<form name="myform" method="post">
|
||||
<div class="tablebar">
|
||||
<input value="{{=T('delete all checked')}}" type="submit" class="btn"/>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span12 errors">
|
||||
<table id="trck_breakpoints" class="sortable table table-hover table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="column1 cbcentered"><input type="checkbox" name="delete_all}" /></th>
|
||||
<th class="column2">{{=T("Filename")}}</th>
|
||||
<th class="column3">{{=T("Line Nr")}}</th>
|
||||
<th>{{=T("Temporary")}}</th>
|
||||
<th>{{=T("Condition")}}</th>
|
||||
<th class="columnN">{{=T("Hits")}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{for bp in breakpoints:}}
|
||||
<tr class="breakpoint">
|
||||
<td class="cbcentered"><input type="checkbox" name="delete_{{=bp['number']}}" /></td>
|
||||
<td>{{=bp['filename']}}</td>
|
||||
<td>{{=A(bp['lineno'],_href="#",_onclick="collapse('%s');" % bp['number'])}}</td>
|
||||
<td>{{=bp['temporary']}}</td>
|
||||
<td>{{=bp['condition']}}</td>
|
||||
<td>{{=bp['hits']}}</td>
|
||||
</tr>
|
||||
<tr id="{{=bp['number']}}" class="sourcecode traceback">
|
||||
<td colspan="6">
|
||||
<div class="ticket_code">
|
||||
{{=CODE(open(bp['path']).read(), language='python',
|
||||
link=None, highlight_line=bp['lineno'], context_lines=10)}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{pass}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</form><!-- /errorform -->
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{pass}}
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div><!-- /applist -->
|
||||
<div class="sidebar fl60 span5">
|
||||
<div class="sidebar_inner controls" style="margin:0;">
|
||||
<div class="box">
|
||||
<h3>{{=T("Add breakpoint")}}</h3>
|
||||
{{=form}}
|
||||
<div class="row-fluid">
|
||||
<div class="help span12 alert alert-block alert-info">
|
||||
<ul class="unstyled">
|
||||
<li>{{=T("You can also set and remove breakpoint in the edit window, using the Toggle Breakpoint button")}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="help">
|
||||
<ul>
|
||||
<li>{{=T("You can also set and remove breakpoint in the edit window, using the Toggle Breakpoint button")}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="sidebar fl60">
|
||||
<div class="sidebar_inner controls">
|
||||
|
||||
<div class="box">
|
||||
|
||||
<h3>{{=T("Add breakpoint")}}</h3>
|
||||
|
||||
{{=form}}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('.sourcecode').hide();
|
||||
jQuery("#trck_breakpoints thead tr th:first input[type=checkbox]").click(function() {
|
||||
var checkedStatus = this.checked;
|
||||
jQuery("#trck_breakpoints tbody tr td:first-child input[type=checkbox]").each(function() {
|
||||
this.checked = checkedStatus;
|
||||
});
|
||||
});
|
||||
jQuery("#trck_breakpoints tbody tr td:first-child input[type=checkbox]").change(function() {
|
||||
var allchecked = jQuery("#trck_breakpoints tbody tr td:first-child input[type=checkbox]:checked").length == jQuery("#trck_breakpoints tbody tr td:first-child input[type=checkbox]").length;
|
||||
jQuery("#trck_breakpoints thead tr th:first input[type=checkbox]").prop('checked', allchecked);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!-- end "debug" block -->
|
||||
|
||||
@@ -1,246 +1,191 @@
|
||||
{{extend 'layout.html'}}
|
||||
|
||||
{{block sectionclass}}debug{{end}}
|
||||
<style type="text/css">
|
||||
|
||||
.prompt, #output {
|
||||
width: 45em;
|
||||
height: 1em;
|
||||
border: 1px solid #CCCCCC;
|
||||
font-size: 10pt;
|
||||
margin: 0.5em;
|
||||
padding: 0.5em;
|
||||
padding-right: 0em;
|
||||
overflow: auto;
|
||||
wrap: hard;
|
||||
}
|
||||
|
||||
#output {
|
||||
height:150px;overflow:auto;
|
||||
}
|
||||
|
||||
#toolbar {
|
||||
margin-left: 0.5em;
|
||||
padding-left: 0.5em;
|
||||
}
|
||||
|
||||
#caret {
|
||||
width: 2.5em;
|
||||
margin-right: 0px;
|
||||
padding-right: 0px;
|
||||
border-right: 0px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#statement {
|
||||
width: 43em;
|
||||
margin-left: 1em;
|
||||
padding-left: 0px;
|
||||
border-left: 0px;
|
||||
background-position: top right;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.processing {
|
||||
background-image: url("{{=URL('static','images/spinner.gif')}}");
|
||||
}
|
||||
|
||||
#ajax-status {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.message {
|
||||
color: #8AD;
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: #F44;
|
||||
}
|
||||
|
||||
.username {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script src="{{=URL('static', 'js/autoscroll.js')}}"></script>
|
||||
|
||||
<div class="applist f60">
|
||||
<div class="applist_inner">
|
||||
<h2>{{=T("web2py online debugger")}}</h2>
|
||||
|
||||
{{if filename:}}
|
||||
<h3>{{=T("Interaction at %s line %s") % (filename, lineno)}}</h3>
|
||||
<!-- begin "debug" block -->
|
||||
<div class="row-fluid">
|
||||
<div class="applist f60 span7" style="padding-bottom:20px;">
|
||||
<div class="applist_inner">
|
||||
<h2>{{=T("web2py online debugger")}}</h2>
|
||||
{{if filename:}}
|
||||
<h3 style="word-wrap:break-word;">{{=T("Interaction at %s line %s") % (filename, lineno)}}</h3>
|
||||
{{if exception:}}
|
||||
<h3 class="exception">{{=T("Exception %s", exception['title'])}}</h3>
|
||||
{{pass}}
|
||||
<h5>{{=T("Code listing")}}</h5>
|
||||
{{if lines:}}<div class="inspect" style="width:100%;overflow:auto;background-color:whiteSmoke;margin-bottom:20px;">
|
||||
<pre>{{=CODE('\n'.join([x[1] for x in sorted(lines.items(),key=lambda x: x[0])]),
|
||||
language='python', link=None, counter=min(lines.keys()),
|
||||
highlight_line=lineno, context_lines=10)}}</pre></div>
|
||||
{{pass}}
|
||||
<div class="row-fluid">
|
||||
<div class="help span7 alert alert-block alert-info">
|
||||
<ul class="unstyled">
|
||||
<li>{{=T("Your application will be blocked until you click an action button (next, step, continue, etc.)")}}</li>
|
||||
<li>{{=T("Your can inspect variables using the console below")}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<h3>{{=T("Interactive console")}}</h3>
|
||||
<div class="shell"><div id="wrapper">
|
||||
<div class="row-fluid">
|
||||
<div class="output-wrapper span11">
|
||||
<textarea id="output" readonly="readonly">{{=data}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<form id="form" action="{{=URL(r=request, f='callback', args=app)}}" method="get" class="span11">
|
||||
<div id="shellwrapper">
|
||||
<div class="prompt-wrapper">
|
||||
<div class="prompt-container">
|
||||
<textarea class="prompt" name="statement" id="statement"></textarea>
|
||||
</div>
|
||||
<a href="#" rel="tooltip" data-placement="right" data-original-title="{{=T('Type some Python code in here and hit Return (Enter) to execute it.')}}">
|
||||
{{=helpicon()}}
|
||||
<span>Type some Python code in here and hit Return (Enter) to execute it.</span>
|
||||
</a>
|
||||
</div>
|
||||
<div id="caret"><span>>>></span></div>
|
||||
<div id="autoscroll">autoscroll</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div></div>
|
||||
{{elif request.env.get('wsgi_multiprocess') or not request.env.get('wsgi_multithread'):}}
|
||||
<h3 class="not_paused">{{=T("Unsupported webserver working mode: %s", request.env.get('server_software', ''))}}</h3>
|
||||
<div class="help span7 alert alert-block alert-info">
|
||||
<ul class="unstyled">
|
||||
<li><b>{{=T("WARNING:")}} </b>{{=T("This debugger may not work properly if you don't have a threaded webserver or you're using multiple daemon processes.")}}</li>
|
||||
<li>{{=T("In development, use the default Rocket webserver that is currently supported by this debugger.")}}</li>
|
||||
<li>{{=T("On production, you'll have to configure your webserver to use one process and multiple threads to use this debugger.")}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
{{#=BEAUTIFY(request.env)}}
|
||||
{{else:}}
|
||||
<h3 class="not_paused">{{=T("No Interaction yet")}}</h3>
|
||||
<div class="help span7 alert alert-block alert-info">
|
||||
<ul class="unstyled">
|
||||
<li>{{=T("You need to set up and reach a")}} {{=A(T("breakpoint"), _href=URL('breakpoints'))}} {{=T('to use the debugger!')}}</li>
|
||||
<li>{{=T('To emulate a breakpoint programatically, write:')}}
|
||||
{{=CODE("from gluon.debug import dbg\n"
|
||||
"dbg.set_trace() # stop here!\n",
|
||||
counter=None)}}</li>
|
||||
<li>{{=T('Please')}} {{=A(T("refresh"), _href=URL('interact'))}} {{=T('this page to see if a breakpoint was hit and debug interaction is required.')}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
{{pass}}
|
||||
</div>
|
||||
</div> <!-- /applist -->
|
||||
<div class="sidebar fl60 span5">
|
||||
<div class="sidebar_inner controls" style="margin:0;">
|
||||
<span class="pwdchange pull-right">
|
||||
{{if filename:}}
|
||||
{{=sp_button(URL('step'), T("step"))}}
|
||||
{{=sp_button(URL('next'), T("next"))}}
|
||||
{{=sp_button(URL('ret'), T("return"))}}
|
||||
{{=sp_button(URL('cont'), T("continue"))}}
|
||||
{{=sp_button(URL('stop'), T("stop"))}}
|
||||
{{pass}}
|
||||
{{=button(URL('breakpoints'), T("breakpoints"))}}
|
||||
</span>
|
||||
|
||||
{{if exception:}}
|
||||
<h3 class="exception">{{=T("Exception %s", exception['title'])}}</h3>
|
||||
{{pass}}
|
||||
|
||||
<h5>{{=T("Code listing")}}</h5>
|
||||
{{if lines:}}
|
||||
<pre>{{=CODE('\n'.join([x[1] for x in sorted(lines.items(),key=lambda x: x[0])]),
|
||||
language='python', link=None, counter=min(lines.keys()),
|
||||
highlight_line=lineno, context_lines=10)}}</pre>
|
||||
{{pass}}
|
||||
|
||||
<div class="help">
|
||||
<ul>
|
||||
<li>{{=T("Your application will be blocked until you click an action button (next, step, continue, etc.)")}}</li>
|
||||
<li>{{=T("Your can inspect variables using the console bellow")}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<h3>{{=T("Interactive console")}}</h3>
|
||||
<textarea id="output" readonly="readonly">{{=data}}</textarea>
|
||||
|
||||
<form id="form" action="{{=URL(r=request,f='execute',args=app)}}" method="get">
|
||||
<div id="shellwrapper">
|
||||
<div id="caret">>>></div>
|
||||
<div id="autoscroll" style="cursor:pointer;float:right;">autoscroll</div>
|
||||
<div class="tooltip">
|
||||
<textarea class="prompt" name="statement" id="statement"></textarea>
|
||||
<span>{{=T("Type python statement in here and hit Return (Enter) to execute it.")}}</span>
|
||||
<div class="box">
|
||||
<h3>{{=T('Exception %(extype)s: %(exvalue)s', dict(extype=exception['extype'], exvalue=exception['exvalue']))}}</h3>
|
||||
<div class="formfield">
|
||||
{{=CODE((exception['request']), counter=None)}}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{{elif request.env.get('wsgi_multiprocess') or not request.env.get('wsgi_multithread'):}}
|
||||
<h3 class="not_paused">{{=T("Unsupported webserver working mode: %s", request.env.get('server_software', ''))}}</h3>
|
||||
<div class="help">
|
||||
<li><b>{{=T("WARNING:")}} </b>{{=T("This debugger may not work properly if you don't have a threaded webserver or you're using multiple daemon processes.")}}</li>
|
||||
<li>{{=T("In development, use the default Rocket webserver that is currently supported by this debugger.")}}</li>
|
||||
<li>{{=T("On production, you'll have to configure your webserver to use one process and multiple threads to use this debugger.")}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
{{#=BEAUTIFY(request.env)}}
|
||||
{{else:}}
|
||||
<h3 class="not_paused">{{=T("No Interaction yet")}}</h3>
|
||||
<div class="help">
|
||||
<ul>
|
||||
<li>{{=T("You need to set up and reach a")}} {{=A(T("breakpoint"), _href=URL('breakpoints'))}} {{=T('to use the debugger!')}}</li>
|
||||
<li>{{=T('To emulate a breakpoint programatically, write:')}}
|
||||
{{=CODE("from gluon.debug import dbg\n"
|
||||
"dbg.set_trace() # stop here!\n",
|
||||
counter=None)}}</li>
|
||||
<li>{{=T('Please')}} {{=A(T("refresh"), _href=URL('interact'))}} {{=T('this page to see if a breakpoint was hit and debug interaction is required.')}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
{{pass}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="sidebar fl60">
|
||||
<div class="sidebar_inner controls">
|
||||
<span class="pwdchange">
|
||||
{{if filename:}}
|
||||
{{=sp_button(URL('step'), T("step"))}}
|
||||
{{=sp_button(URL('next'), T("next"))}}
|
||||
{{=sp_button(URL('ret'), T("return"))}}
|
||||
{{=sp_button(URL('cont'), T("continue"))}}
|
||||
{{=sp_button(URL('stop'), T("stop"))}}
|
||||
{{pass}}
|
||||
{{=button(URL('breakpoints'), T("breakpoints"))}}
|
||||
</span>
|
||||
|
||||
{{if exception:}}
|
||||
<div class="box">
|
||||
<h3>{{=T('Exception %(extype)s: %(exvalue)s', dict(extype=exception['extype'], exvalue=exception['exvalue']))}}</h3>
|
||||
<h3>{{=T('Locals##debug')}}</h3>
|
||||
<div class="formfield">
|
||||
{{=CODE((exception['request']), counter=None)}}
|
||||
{{=BEAUTIFY(f_locals)}}
|
||||
</div>
|
||||
</div>
|
||||
{{pass}}
|
||||
<div class="box">
|
||||
<h3>{{=T('Globals##debug')}}</h3>
|
||||
<div class="formfield">
|
||||
{{=BEAUTIFY(f_globals)}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box">
|
||||
<h3>{{=T('Locals##debug')}}</h3>
|
||||
<div class="formfield">
|
||||
{{=BEAUTIFY(f_locals)}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
<h3>{{=T('Globals##debug')}}</h3>
|
||||
<div class="formfield">
|
||||
{{=BEAUTIFY(f_globals)}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="{{=URL('static', 'js/autoscroll.js')}}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var bShellScrolling=0
|
||||
jQuery(document).ready(function(){
|
||||
jQuery('#statement').focus();
|
||||
|
||||
jQuery('#statement').keyup(function(event){
|
||||
var t=jQuery(this),
|
||||
s=t.val(),
|
||||
o=jQuery('#output'),
|
||||
RETURN = 38;
|
||||
if(s=='\n') t.val('');
|
||||
if(s.length>1 && s.substr(s.length-1,1)=='\n' && s.substr(s.length-2,1)!=':' &&
|
||||
(s.indexOf(':\n ')<0 || s.substr(s.length-2,1)=='\n')) {
|
||||
t.val('');
|
||||
jQuery.post("{{=URL(r=request,f='execute',args=app)}}",
|
||||
{statement:s},function(data){o.html(o.html()+data).attr('scrollTop',o.attr('scrollHeight'));});
|
||||
} else { };
|
||||
if(event.keyCode==RETURN){
|
||||
var i=s.length
|
||||
if(i==0){
|
||||
var s=o.find('table:last pre:first').text();
|
||||
bShellScrolling=o.find('table').length;
|
||||
}else if(bShellScrolling){
|
||||
var i=bShellScrolling
|
||||
if(i<1){
|
||||
return
|
||||
}else{
|
||||
i--
|
||||
var s=o.find('table:nth-child('+(i)+') pre:first').text();
|
||||
bShellScrolling=i
|
||||
}
|
||||
}else if(s.indexOf('\n')<0){
|
||||
var oo=o.find('tr:first-child pre:contains("'+s+'")')
|
||||
if(oo.length==0){
|
||||
return
|
||||
}else if(oo.length==1){
|
||||
s=oo.text();
|
||||
}else{
|
||||
sVar=oo.text();
|
||||
o.html(o.html()+'<dd>'+s+' ?</dd><dt>'+sVar+'</dt>').attr('scrollTop',o.attr('scrollHeight'))
|
||||
return
|
||||
}
|
||||
}else{
|
||||
//multistring expr
|
||||
return;
|
||||
}
|
||||
// if(s.slice(s.length-1)=='\n'){
|
||||
s=s.slice(0,s.length-1)
|
||||
// }
|
||||
t.val(s);
|
||||
}
|
||||
if(bShellScrolling && event.keyCode==40){
|
||||
var i=bShellScrolling
|
||||
i++
|
||||
var s=o.find('table:nth-child('+i+') tr:first-child pre').text();
|
||||
if(s){
|
||||
s=s.slice(0,s.length-1)
|
||||
t.val(s);
|
||||
bShellScrolling=i
|
||||
}else{
|
||||
bShellScrolling=0
|
||||
t.val('')
|
||||
}
|
||||
};
|
||||
if(bShellScrolling && (event.keyCode==37 || event.keyCode==39)){
|
||||
bShellScrolling=0;
|
||||
};
|
||||
if(event.keyCode==27){
|
||||
bShellScrolling=0;
|
||||
t.val('');
|
||||
};
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var bShellScrolling=0
|
||||
jQuery(document).ready(function(){
|
||||
jQuery('#statement').focus();
|
||||
|
||||
jQuery('#statement').keyup(function(event){
|
||||
var t=jQuery(this),
|
||||
s=t.val(),
|
||||
o=jQuery('#output'),
|
||||
RETURN = 38;
|
||||
if(s=='\n') t.val('');
|
||||
if(s.length>1 && s.substr(s.length-1,1)=='\n' && s.substr(s.length-2,1)!=':' &&
|
||||
(s.indexOf(':\n ')<0 || s.substr(s.length-2,1)=='\n')) {
|
||||
t.val('');
|
||||
jQuery.post("{{=URL(r=request,f='execute',args=app)}}",
|
||||
{statement:s},function(data){o.html(o.html()+data).attr('scrollTop',o.attr('scrollHeight'));});
|
||||
} else { };
|
||||
if(event.keyCode==RETURN){
|
||||
var i=s.length
|
||||
if(i==0){
|
||||
var s=o.find('table:last pre:first').text();
|
||||
bShellScrolling=o.find('table').length;
|
||||
}else if(bShellScrolling){
|
||||
var i=bShellScrolling
|
||||
if(i<1){
|
||||
return
|
||||
}else{
|
||||
i--
|
||||
var s=o.find('table:nth-child('+(i)+') pre:first').text();
|
||||
bShellScrolling=i
|
||||
}
|
||||
}else if(s.indexOf('\n')<0){
|
||||
var oo=o.find('tr:first-child pre:contains("'+s+'")')
|
||||
if(oo.length==0){
|
||||
return
|
||||
}else if(oo.length==1){
|
||||
s=oo.text();
|
||||
}else{
|
||||
sVar=oo.text();
|
||||
o.html(o.html()+'<dd>'+s+' ?</dd><dt>'+sVar+'</dt>').attr('scrollTop',o.attr('scrollHeight'))
|
||||
return
|
||||
}
|
||||
}else{
|
||||
//multistring expr
|
||||
return;
|
||||
}
|
||||
// if(s.slice(s.length-1)=='\n'){
|
||||
s=s.slice(0,s.length-1)
|
||||
// }
|
||||
t.val(s);
|
||||
}
|
||||
if(bShellScrolling && event.keyCode==40){
|
||||
var i=bShellScrolling
|
||||
i++
|
||||
var s=o.find('table:nth-child('+i+') tr:first-child pre').text();
|
||||
if(s){
|
||||
s=s.slice(0,s.length-1)
|
||||
t.val(s);
|
||||
bShellScrolling=i
|
||||
}else{
|
||||
bShellScrolling=0
|
||||
t.val('')
|
||||
}
|
||||
};
|
||||
if(bShellScrolling && (event.keyCode==37 || event.keyCode==39)){
|
||||
bShellScrolling=0;
|
||||
};
|
||||
if(event.keyCode==27){
|
||||
bShellScrolling=0;
|
||||
t.val('');
|
||||
};
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- end "debug" block -->
|
||||
|
||||
Reference in New Issue
Block a user