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