blob: e928401056628a3bca953a366c1fed3a3aab2ea0 [file] [log] [blame]
<!--
* 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.
-->
<!DOCTYPE html>
<html>
<head>
<script src="CodeMirror-0.8/js/codemirror.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="CodeMirror-0.8/css/docs.css"/>
<link rel="stylesheet" type="text/css" href="/container/gadgets.css"/>
<style type="text/css">
body {
padding:20px;
font-family:Helvetica;
}
h1 {
border-bottom:1px solid #ddd;
font-size:120%;
}
.gadgets-render {
padding-top: 15px;
padding-bottom: 15px;
}
#gadget iframe {
margin: 5px;
border: none;
height: 300px;
width: 300px;
}
</style>
</head>
<body>
<h1>OpenSocial Gadget Editor</h1>
<div class="border">
<textarea id="code" cols="110" rows="30">
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Example">
</ModulePrefs>
<Content>
<![CDATA[
Hello World?
]]>
</Content>
</Module>
</textarea>
</div>
<div class="gadgets-render">
<input type="button" value="Render Gadget" onclick="render();">
</div>
<div class="gadgets-gadget-chrome">
<div class="gadgets-gadget-title-bar">
<span class="gadgets-gadget-title">Rendered Gadget</span>
</div>
<div id="gadget" class="gadgets-gadget-content">
<form id="form" target="frame" method="post">
<input type="hidden" name="rawxml" value="" id="rawxml"></input>
</form>
<iframe id="frame" name="frame" src=""></iframe>
</div>
</div>
<script type="text/javascript">
var editor = CodeMirror.fromTextArea('code', {
height: "160px",
parserfile: "/parsexml.js",
stylesheet: "CodeMirror-0.8/css/xmlcolors.css",
path: "CodeMirror-0.8/js/",
continuousScanning: 500,
initCallback: render
});
function render() {
document.getElementById('rawxml').value = editor.getCode();
var url = '/gadgets/ifr?url=http://example.org';
var form = document.getElementById('form');
form.action = url;
form.submit();
}
</script>
</body>
</html>