mirror of
https://github.com/apache/struts.git
synced 2026-09-12 17:15:02 +00:00
WW-4322 Uses jQuery instead of Dojo with DebuggingInterceptor
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<style>
|
||||
.debugTable {
|
||||
@@ -52,22 +53,9 @@
|
||||
background-color: #EEEEEE;
|
||||
}
|
||||
</style>
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
// Dojo configuration
|
||||
djConfig = {
|
||||
isDebug: false,
|
||||
bindEncoding: "UTF-8"
|
||||
,baseRelativePath: "${base}/struts/dojo/"
|
||||
,baseScriptUri: "${base}/struts/dojo/"
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script language="JavaScript" type="text/javascript" src="${base}/struts/dojo/dojo.js"></script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
||||
<script>
|
||||
dojo.require("dojo.io.*");
|
||||
|
||||
function expand(src, path) {
|
||||
var baseUrl = location.href;
|
||||
var i = baseUrl.indexOf("&object=");
|
||||
@@ -75,9 +63,7 @@
|
||||
if (baseUrl.indexOf("decorate") < 0) {
|
||||
baseUrl += "&decorate=false";
|
||||
}
|
||||
dojo.io.bind({
|
||||
url: baseUrl,
|
||||
load : function(type, data, evt) {
|
||||
jQuery.get(baseUrl, function(data) {
|
||||
var div = document.createElement("div");
|
||||
div.innerHTML = data;
|
||||
src.parentNode.appendChild(div);
|
||||
@@ -89,7 +75,6 @@
|
||||
src.parentNode.removeChild(div);
|
||||
src.onclick = oldonclick;
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript">
|
||||
var baseUrl = "<@s.url value="/struts" includeParams="none"/>";
|
||||
window.open(baseUrl+"/webconsole.html", 'OGNL Console','width=500,height=450,'+
|
||||
'status=no,toolbar=no,menubar=no');
|
||||
window.open(baseUrl+"/webconsole.html", 'OGNL Console','width=500,height=450,status=no,toolbar=no,menubar=no');
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -20,25 +20,25 @@
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="webconsole.css" />
|
||||
<script src="webconsole.js"></script>
|
||||
<script src="dojo/dojo.js"></script>
|
||||
<script src="dojo/src/event/__package__.js"></script>
|
||||
<title>OGNL Console</title>
|
||||
<link rel="stylesheet" type="text/css" href="webconsole.css"/>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
||||
<script src="webconsole.js"></script>
|
||||
<title>OGNL Console</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="shell" >
|
||||
<form onsubmit="return false" id="wc-form">
|
||||
<div class="wc-results" id="wc-result">
|
||||
Welcome to the OGNL console!
|
||||
<br />
|
||||
:->
|
||||
</div>
|
||||
<input type="hidden" name="debug" value="command" />
|
||||
<input name="expression" onkeyup="keyEvent(event)" class="wc-command" id="wc-command" type="text" />
|
||||
</form>
|
||||
<div id="shell">
|
||||
<form onsubmit="return false" id="wc-form">
|
||||
<div class="wc-results" id="wc-result">
|
||||
Welcome to the OGNL console!
|
||||
<br/>
|
||||
:->
|
||||
</div>
|
||||
<input type="hidden" name="debug" value="command"/>
|
||||
<input name="expression" onkeyup="keyEvent(event)" class="wc-command" id="wc-command" type="text"/>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -19,62 +19,57 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
function printResult(result_string)
|
||||
{
|
||||
var result_div = document.getElementById('wc-result');
|
||||
var result_array = result_string.split('\n');
|
||||
function printResult(result_string) {
|
||||
var result_div = document.getElementById('wc-result');
|
||||
var result_array = result_string.split('\n');
|
||||
|
||||
var new_command = document.getElementById('wc-command').value;
|
||||
result_div.appendChild(document.createTextNode(new_command));
|
||||
result_div.appendChild(document.createElement('br'));
|
||||
var new_command = document.getElementById('wc-command').value;
|
||||
result_div.appendChild(document.createTextNode(new_command));
|
||||
result_div.appendChild(document.createElement('br'));
|
||||
|
||||
for (var line_index in result_array) {
|
||||
var result_wrap = document.createElement('pre')
|
||||
line = document.createTextNode(result_array[line_index]);
|
||||
result_wrap.appendChild(line);
|
||||
result_div.appendChild(result_wrap);
|
||||
result_div.appendChild(document.createElement('br'));
|
||||
for (var line_index in result_array) {
|
||||
var result_wrap = document.createElement('pre')
|
||||
line = document.createTextNode(result_array[line_index]);
|
||||
result_wrap.appendChild(line);
|
||||
result_div.appendChild(result_wrap);
|
||||
result_div.appendChild(document.createElement('br'));
|
||||
|
||||
}
|
||||
result_div.appendChild(document.createTextNode(':-> '));
|
||||
|
||||
result_div.scrollTop = result_div.scrollHeight;
|
||||
document.getElementById('wc-command').value = '';
|
||||
}
|
||||
result_div.appendChild(document.createTextNode(':-> '));
|
||||
|
||||
function keyEvent(event, url)
|
||||
{
|
||||
switch(event.keyCode){
|
||||
case 13:
|
||||
var the_shell_command = document.getElementById('wc-command').value;
|
||||
if (the_shell_command) {
|
||||
commands_history[commands_history.length] = the_shell_command;
|
||||
history_pointer = commands_history.length;
|
||||
var the_url = url ? url : window.opener.location.pathname;
|
||||
dojo.io.bind({
|
||||
url: the_url,
|
||||
formNode: dojo.byId("wc-form"),
|
||||
load: function(type, data, evt){ printResult(data); },
|
||||
mimetype: "text/plain"
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 38: // this is the arrow up
|
||||
if (history_pointer > 0) {
|
||||
history_pointer--;
|
||||
document.getElementById('wc-command').value = commands_history[history_pointer];
|
||||
}
|
||||
break;
|
||||
case 40: // this is the arrow down
|
||||
if (history_pointer < commands_history.length - 1 ) {
|
||||
history_pointer++;
|
||||
document.getElementById('wc-command').value = commands_history[history_pointer];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
result_div.scrollTop = result_div.scrollHeight;
|
||||
document.getElementById('wc-command').value = '';
|
||||
}
|
||||
|
||||
function keyEvent(event, url) {
|
||||
switch (event.keyCode) {
|
||||
case 13:
|
||||
var the_shell_command = document.getElementById('wc-command').value;
|
||||
if (the_shell_command) {
|
||||
commands_history[commands_history.length] = the_shell_command;
|
||||
history_pointer = commands_history.length;
|
||||
var the_url = url ? url : window.opener.location.pathname;
|
||||
jQuery.post(the_url, jQuery("#wc-form").serialize(), function (data) {
|
||||
printResult(data);
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 38: // this is the arrow up
|
||||
if (history_pointer > 0) {
|
||||
history_pointer--;
|
||||
document.getElementById('wc-command').value = commands_history[history_pointer];
|
||||
}
|
||||
break;
|
||||
case 40: // this is the arrow down
|
||||
if (history_pointer < commands_history.length - 1) {
|
||||
history_pointer++;
|
||||
document.getElementById('wc-command').value = commands_history[history_pointer];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var commands_history = new Array();
|
||||
var history_pointer;
|
||||
var commands_history = [];
|
||||
var history_pointer;
|
||||
|
||||
Reference in New Issue
Block a user