FELIX-3111 : Separate OBR Plugin
FELIX-3107 : Separate Shell Plugin
FELIX-3099 : Separate Deployment Admin plugin
FELIX-3100 : Separate SCR plugin

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1169777 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole-plugins/shell/src/main/resources/res/plugin.css b/webconsole-plugins/shell/src/main/resources/res/plugin.css
new file mode 100644
index 0000000..e164930
--- /dev/null
+++ b/webconsole-plugins/shell/src/main/resources/res/plugin.css
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#consoleframe {
+    font-family: monospace;
+    background-color: #f0f0f0;
+    height: 500px;
+    overflow: auto;
+}
+
+span.consolecommand {
+    white-space: pre;
+	font-weight: bold;
+}
+
+span.error {
+    color: #ff0000;
+}
+
+input.command {
+    font-family: monospace;
+    width: 80%;
+}
diff --git a/webconsole-plugins/shell/src/main/resources/res/plugin.html b/webconsole-plugins/shell/src/main/resources/res/plugin.html
new file mode 100644
index 0000000..c2b9b9b
--- /dev/null
+++ b/webconsole-plugins/shell/src/main/resources/res/plugin.html
@@ -0,0 +1,27 @@
+<script type="text/javascript" src="${pluginRoot}/res/plugin.js"></script>

+<script type="text/javascript">

+// <![CDATA[

+var shellDisabled = ${shell.disabled};

+// ]]>

+</script>

+<p class="statline">${shell.status}</p>

+

+<form id="shell_form" method="post" action="${pluginRoot}">

+	<!-- top header -->

+	<div class="ui-widget-header ui-corner-top buttonGroup">

+		<input id="help" value="${help}" type="button" />

+		<input id="clear" value="${shell.clear}" type="button" />

+	</div>

+

+	<!-- the console window -->

+	<div id="consoleframe">

+		<div id="console">

+			<!-- HERE COMES CONSOLE CONTENTS -->

+		</div><!-- console -->

+	</div><!-- consoleframe -->

+

+	<!-- bottom header -->

+	<div class="ui-widget-header ui-corner-bottom buttonGroup" style="text-align: left">

+		&nbsp;-&gt; <input id="command" name="command" class="command" autocomplete="off" type="text" />

+	</div>

+</form>

diff --git a/webconsole-plugins/shell/src/main/resources/res/plugin.js b/webconsole-plugins/shell/src/main/resources/res/plugin.js
new file mode 100644
index 0000000..7d34014
--- /dev/null
+++ b/webconsole-plugins/shell/src/main/resources/res/plugin.js
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// elements cache
+var consoleframe = false;
+var konsole = false;
+var command = false;
+
+function executeCommand(cmd) {
+	$.post(document.location.href, { 'command' : encodeURIComponent(cmd) },
+		function(result) {
+			konsole.removeClass('ui-helper-hidden').append(result);
+			consoleframe.attr('scrollTop', konsole.attr('scrollHeight'));
+			command.val('');
+			shellCommandFocus();
+		}, 'html');
+}
+
+function shellCommandFocus() { command.focus() }
+
+// automatically executed on load
+$(document).ready(function(){
+    
+    // disable the shell form if the shell service is not available
+    if (shellDisabled) {
+    
+        $('#shell_form').hide();
+    
+    } else {
+    
+    	// init cache
+    	consoleframe = $('#consoleframe').click(shellCommandFocus);
+    	konsole      = $('#console');
+    	command      = $('#command').focus();
+    
+    	// attach action handlers
+    	$('#clear').click(function() {
+    		konsole.addClass('ui-helper-hidden').html('');
+    		consoleframe.attr('scrollTop', 0);
+    		shellCommandFocus();
+    	});
+    	$('#help').click(function() {
+    		executeCommand('help');
+    	});
+    	$('form').submit(function() {
+    		executeCommand(command.val());
+    		return false;
+    	});
+    	
+	}
+});