diff options
Diffstat (limited to '')
24 files changed, 788 insertions, 130 deletions
diff --git a/sca-cpp/trunk/modules/edit/htdocs/app/index.html b/sca-cpp/trunk/modules/edit/htdocs/app/index.html index 633031b2b3..29f9efae65 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/app/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/app/index.html @@ -18,46 +18,132 @@ --> <html> <head> -<title>App Settings</title> +<title>App</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0"/> <meta name="apple-mobile-web-app-capable" content="yes"/> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/> <link rel="stylesheet" type="text/css" href="/ui.css"/> <script type="text/javascript" src="/util.js"></script> +<script type="text/javascript" src="/elemutil.js"></script> +<script type="text/javascript" src="/xmlutil.js"></script> +<script type="text/javascript" src="/atomutil.js"></script> +<script type="text/javascript" src="/jsonutil.js"></script> +<script type="text/javascript" src="/scdl.js"></script> <script type="text/javascript" src="/ui.js"></script> +<script type="text/javascript" src="/component.js"></script> </head> -<body> -<div id="menu"></div> +<body class="delayed"> +<div id="app"></div> +<span id="appFrame"></span> <script type="text/javascript"> +if (ui.isIE()) $('bodydiv').style.right = -20; -// Get the app name -var appname = ui.queryParams()['app']; +/** + * The main page component. + */ +var comp = sca.component('page'); -// Load the menu bar -ui.loadwidget('menu', '/menu.html?app=' + appname); -</script> +/** + * Returns the text value of a data element. + */ +function datatext(dv) { + return elementHasValue(dv)? elementValue(dv) : ''; +} -<h1>App Edit <span id="appNameHeader" style="font-weight: normal;"></span></h1> -<br/> +/** + * Set a data value into a widget. + */ +function setwidgetvalue(e, dv) { + if (e.className == 'h1' || e.className == 'h2' || e.className == 'text' || e.className == 'section') { + car(childElements(e)).innerHTML = datatext(dv); + return t; + } + if (e.className == 'button' || e.className == 'entry' || e.className == 'password') { + car(childElements(e)).value = datatext(dv); + return t; + } + if (e.className == 'checkbox') { + var t = datatext(dv); + car(childElements(e)).value = t; + map(function(n) { if (n.nodeName == "SPAN") n.innerHTML = t; return n; }, nodeList(e.childNodes)); + return t; + } + if (e.className == 'list') { + var t = datatext(dv); + var ce = car(childElements(car(childElements(e)))); + ce.value = t; + ce.innerHTML = t; + return t; + } + if (e.className == 'link') { + var t = datatext(dv); + var ce = car(childElements(car(childElements(e)))); + ce.href = t; + ce.innerHTML = t; + return t; + } + if (e.className == 'table') { + var t = ui.datatable(mklist(dv)); + car(childElements(e)).innerHTML = t; + return t; + } + return ''; +}; -<div id="app"></div> +/** + * Display data on the app page. + */ +function display(l) { + if (isNil(l)) + return false; + var v = car(l); -<script type="text/javascript"> + // For each widget in the app page, look for a data element with the widget id + // then set the data value into the widget + function datavalue(id) { + var dv = namedElementChild("'" + id, v); + return dv; + } + + function updatewidget(e) { + var dv = datavalue(e.id); + if (dv == null || isNil(dv)) + return e; + setwidgetvalue(e, dv); + return e; + } + + var e = map(updatewidget, filter(function(e) { return !isNil(e.id); }, nodeList(ui.elementByID($('app'), 'page').childNodes))); + + // Make the page visible + ui.showbody(); + return true; +} /** - * Display the page editor for an app. + * Get the contents of the main page component. */ -function editapp(name) { - if (isNil(name)) - return; - ui.loadiframe('app', 'app.html?app=' + name); +function getdata() { + $('app').innerHTML = $('appFrame').contentDocument.body.innerHTML; + + var doc = comp.get('', function(doc) { + + if (json.isJSON(mklist(doc))) + return display(json.readJSON(mklist(doc))); + + if (atom.isATOMEntry(mklist(doc))) + return display(atom.readATOMEntry(mklist(doc))); + + if (atom.isATOMFeed(mklist(doc))) + return display(atom.readATOMFeed(mklist(doc))); + + return display(doc); + }); } -// Display the editor for the current app -document.title = 'App - ' + appname; -$('appNameHeader').innerHTML = ' - ' + appname; -editapp(appname); +// Load the app frame +$('app').innerHTML = '<iframe id="appFrame" class="widgetFrame" src="app.html" onload="getdata()"></iframe>'; </script> </body> diff --git a/sca-cpp/trunk/modules/edit/htdocs/dash/dashboard.html b/sca-cpp/trunk/modules/edit/htdocs/dash/dashboard.html index a261f75057..89091c0517 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/dash/dashboard.html +++ b/sca-cpp/trunk/modules/edit/htdocs/dash/dashboard.html @@ -33,13 +33,13 @@ <div id="apps"></div> <br/> -<input type="button" id="createAppButton" value="Create App"/> +<input type="button" id="createAppButton" value="Create App" title="Create a new app"/> <br/> <br/> <div id="newApp" style="visibility: hidden; height: 100%;"> <table style="width: 100%;"> -<tr><th id="newAppHeader" class="thl thr" style="border-style: none;">Create an App</th></tr> +<tr><th id="newAppHeader" class="thl thr" style="padding-top: 4px; padding-bottom:4px; border-style: none;">Create an App</th></tr> <tr><td></td></tr> </table> <br/> @@ -48,13 +48,13 @@ <tr><td><b>App Name:</b></td></tr> <tr><td><input type="text" id="appName" size="10"/></td></tr> <tr><tr><td><b>App Title:</b></td></tr> -<tr><td><input type="text" id="appTitle" size="30"/></td></tr> +<tr><td><input type="text" id="appTitle" size="80"/></td></tr> <tr><tr><td><b>Category:</b></td></tr> <tr><td><input type="text" id="appCategory" size="15" value="Cool Apps"/></td></tr> <tr><tr><td><b>Description:</b></td></tr> -<tr><td><textarea id="appDescription" cols="30" rows="5">Enter a short description of your app here</textarea></td></tr> +<tr><td><textarea id="appDescription" cols="80" rows="5">Enter a short description of your app here</textarea></td></tr> <tr><td> -<input id="createAppOKButton" type="button" style="font-weight: bold;" value="Create"/> +<input id="createAppOKButton" type="submit" style="font-weight: bold;" value="Create" title="Create the app"/> <input id="createAppCancelButton" type="button" value="Cancel"/> </td></tr> </table> @@ -77,9 +77,9 @@ var dashboard = sca.reference(editWidget, "dashboard"); function getapps(sync) { function display(doc) { var apps = '<table style="width: 100%;">'; - apps += '<tr><th class="thl thr">App</th>' + - '<th class="thr thl">Title</th>' + - '<th class="thr thl" style="padding-top: 4px; padding-bottom: 4px; padding-right: 2px; text-align: right;"></th></tr>'; + apps += '<tr><th class="thl thr" style="width: 225px; min-width: 225px; padding-top: 4px; padding-right: 4px;">App</th>' + + '<th class="thr thl" style="width: 100%;">Title</th>' + + '<th class="thl thr" style="width: 30px;">Sharing</th></tr>'; var feed = car(elementsToValues(atom.readATOMFeed(mklist(doc)))); var entries = cadr(assoc("'entry", cdr(feed))); @@ -87,10 +87,14 @@ function getapps(sync) { var entry = entries[i]; title = cadr(assoc("'title", entry)) name = cadr(assoc("'id", entry)) - - apps += '<tr>'; - apps += '<td><a href=\"' + '/graph/?app=' + name + '\" target=\"_parent\">' + name + '</a></td>'; - apps += '<td class="tdw" colspan="2">' + title + '</td>'; + hreflink = '<a href=\"' + '/graph/?app=' + name + '\" target=\"_parent\">'; + sharing = 'Shared with everybody'; + + apps += '<tr class="trb"><td>'; + apps += hreflink + '<img src="/public/app.png" style="width: 50px; height: 50px; margin-right: 10px; vertical-align: middle;"></img>' + '</a>'; + apps += ' ' + hreflink + name + '</a></td>'; + apps += '<td class="tdw">' + title + '</td>'; + apps += '<td>' + sharing + '</td>'; apps += '</tr>'; } apps += '</table>'; diff --git a/sca-cpp/trunk/modules/edit/htdocs/dash/index.html b/sca-cpp/trunk/modules/edit/htdocs/dash/index.html index 308afdb13a..281e2afff2 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/dash/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/dash/index.html @@ -26,13 +26,13 @@ <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/ui.js"></script> </head> -<body> +<body class="delayed"> <div id="menu"></div> <script type="text/javascript"> // Load the menu bar -ui.loadwidget('menu', '/menu.html'); +ui.loadwidget('menu', '/menu.html', ui.showbody); </script> <h1>App Edit</h1> diff --git a/sca-cpp/trunk/modules/edit/htdocs/data/index.html b/sca-cpp/trunk/modules/edit/htdocs/data/index.html new file mode 100644 index 0000000000..9fe5b1b5a0 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/htdocs/data/index.html @@ -0,0 +1,89 @@ +<!-- + * 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. +--> +<html> +<head> +<title>Results</title> +<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0"/> +<meta name="apple-mobile-web-app-capable" content="yes"/> +<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/> +<link rel="stylesheet" type="text/css" href="/ui.css"> +<script type="text/javascript" src="/util.js"></script> +<script type="text/javascript" src="/elemutil.js"></script> +<script type="text/javascript" src="/xmlutil.js"></script> +<script type="text/javascript" src="/atomutil.js"></script> +<script type="text/javascript" src="/jsonutil.js"></script> +<script type="text/javascript" src="/scdl.js"></script> +<script type="text/javascript" src="/ui.js"></script> +<script type="text/javascript" src="/component.js"></script> +</head> +<body> + +<div id="bodydiv" style="position: absolute; top: 0px; left: 0px; right: 0px;"> + +</div> + +<script type="text/javascript"> +if (ui.isIE()) $('bodydiv').style.right = -20; + +/** + * The current component. + */ +var cname = ui.queryParams()['component']; +var comp = sca.component(cname); + +/** + * Display an HTML element. + */ +function display(e) { + $('bodydiv').innerHTML = e; + return true; +} + +/** + * Wrap a document in an HTML table. + */ +function mkdoctable(doc) { + var tr = '<tr><td class="datatdl">' + 'value' + '</td>' + '<td class="datatdr">' + doc + '</td></tr>'; + return '<table class="datatable ' + (window.name == 'dataFrame'? ' databg' : '') + '" style="width: 100%;">' + tr + '</table>'; +} + +/** + * Get and display the contents of the current component. + */ +function getdata() { + comp.get('', function(doc) { + + if (json.isJSON(mklist(doc))) + return display(ui.datatable(json.readJSON(mklist(doc)))); + + if (atom.isATOMEntry(mklist(doc))) + return display(ui.datatable(atom.readATOMEntry(mklist(doc)))); + + if (atom.isATOMFeed(mklist(doc))) + return display(ui.datatable(atom.readATOMFeed(mklist(doc)))); + + return display(mkdoctable(doc)); + }); +} + +getdata(); + +</script> +</body> +</html> diff --git a/sca-cpp/trunk/modules/edit/htdocs/graph/graph.html b/sca-cpp/trunk/modules/edit/htdocs/graph/graph.html index 4a973a1ed6..0e2a1bf2d2 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/graph/graph.html +++ b/sca-cpp/trunk/modules/edit/htdocs/graph/graph.html @@ -37,19 +37,25 @@ <th class="thl" style="width: 225px; min-width: 225px;">Palette</th> <th class="thr" style="padding-left: 4px; padding-top: 0px; padding-bottom: 0px;"> -<input id="compName" type="text" value="component name" style="position: relative; width: 200px;"/> -<input id="propValue" type="text" value="property value" style="position: relative; width: 300px;"/> -<span id="compValue" style="position: relative"></span> +<input id="compName" type="text" value="component name" title="Component name" style="position: relative; width: 200px;"/> +<input id="propValue" type="text" value="property value" title="Component property value" style="position: relative; width: 300px;"/> +<input type="button" id="autoplayButton" title="Turn autoplay on/off" style="font-weight: bold;" Value="Autoplay is on"/> +<span id="compValue" style="position: relative; font-weight: normal;"></span><br/> </th> <th class="thl thr" style="padding-top: 0px; padding-bottom: 0px; padding-right: 0px; text-align: right;"> -<input type="button" id="saveButton" style="font-weight: bold;" Value="Saved"/> +<input type="button" id="saveButton" title="Save the app" style="font-weight: bold;" Value="Saved"/> </th> </tr> -<tr style="height: 5000px;"><td class="tdl"></td><td class="tdr" colspan="2"></td></tr> +<tr style="height: 5000px;"><td class="tdl"></td><td class="tdr" colspan="2"> +</td></tr> </table> +<div style="position:absolute; top: 40px; left: 240px; right: 0px; height: 5000px;"> +<iframe id="dataFrame" class="databg" style="position: relative; height: 5000px; width: 100%; border: 0px;" scrolling="no" frameborder="0"></iframe> +</div> + </div> <script type="text/javascript"> @@ -63,9 +69,10 @@ var apps = sca.reference(editWidget, "apps"); //rconsole = sca.defun(sca.reference(editWidget, "log"), "log"); /** - * The current app name. + * The current app and component names. */ var appname = ui.queryParams()['app']; +var compname = ''; /** * The current app composite and corresponding saved XML content. @@ -103,7 +110,7 @@ function getapp(name, g) { '</composite>'; composite = readXML(mklist(x)); } - graph.edit(name, composite, graph.composite(composite, graph.mkpath().move(palcx,0)), oncomposchange, g); + graph.edit(name, composite, graph.composite(composite, graph.mkpath().move(palcx,0)), oncomposchange, oncompselect, g); // Track the saved composite XML savedcomposxml = car(writeXML(composite, false)); @@ -164,7 +171,7 @@ function save() { } /** - * Handle a composite change event + * Handle a composite change event. */ function oncomposchange() { if (savedcomposxml == car(writeXML(composite, false))) @@ -180,8 +187,72 @@ function oncomposchange() { return true; } +/** + * Return the link to a component value. + */ +function compvaluelink(appname, cname) { + if (cname == '' || isNil(cname)) + return ''; + var protocol = window.location.protocol; + var host = window.location.hostname; + var port = ':' + window.location.port; + if (port == ':80' || port == ':443' || port == ':') + port = ''; + var link = protocol + '//' + appname + '.' + host + port + '/data/?component=' + cname; + return link; +} + +/** + * Track whether we're always showing the result data of the selected component. + */ +var autoplay = true; + +/** + * Show the result data of a component. + */ +function showData(cname) { + var rframe = $('dataFrame'); + if (cname == '') { + rframe.src = ''; + return true; + } + rframe.src = compvaluelink(appname, cname); + return true; +} + +/** + * Handle a component select event. + */ +function oncompselect(appname, cname) { + if (cname == compname) + return true; + compname = cname; + var link = compvaluelink(appname, cname); + $('compValue').innerHTML = link != ''? '<a href="' + link + '" target="_blank">' + 'Results' + '</a>' : ''; + + if (autoplay) + return showData(cname); + return true; +} + +/** + * Handle autoplay on/off click event. + */ +$('autoplayButton').onclick = function(e) { + if (autoplay) { + autoplay = false; + showData(''); + $('autoplayButton').value = 'Autoplay is off'; + return true; + } + autoplay = true; + showData(compname); + $('autoplayButton').value = 'Autoplay is on'; + return true; +}; + // Create editor graph area -var g = graph.mkgraph(graph.mkpath().move(0,40), $('compName'), $('propValue'), $('compValue')); +var g = graph.mkgraph(graph.mkpath().move(0,40), $('compName'), $('propValue')); var bg = graph.mkgroup(graph.mkpath()); // Install the palettes diff --git a/sca-cpp/trunk/modules/edit/htdocs/graph/graph.js b/sca-cpp/trunk/modules/edit/htdocs/graph/graph.js index 724720b19f..3535dce0df 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/graph/graph.js +++ b/sca-cpp/trunk/modules/edit/htdocs/graph/graph.js @@ -114,7 +114,7 @@ if (ui.isIE()) { /** * Make a VML graph. */ - graph.mkgraph = function(pos, cname, pvalue, cvalue) { + graph.mkgraph = function(pos, cname, pvalue) { // Create div element to host the graph var div = document.createElement('div'); @@ -160,7 +160,9 @@ if (ui.isIE()) { // Reset current selection cname.value = ''; pvalue.value = ''; - cvalue.innerHTML = ''; + + // Trigger component select event + vmlg.oncompselect(''); return false; } @@ -186,7 +188,9 @@ if (ui.isIE()) { // Update the component name and property value fields cname.value = graph.selected.id; pvalue.value = graph.property(graph.selected.comp); - cvalue.innerHTML = graph.compvaluelink(vmlg.appname, graph.selected.id); + + // Trigger component select event + vmlg.oncompselect(vmlg.appname, graph.selected.id); return false; }; @@ -234,7 +238,9 @@ if (ui.isIE()) { graph.selected = null; cname.value = ''; pvalue.value = ''; - cvalue.innerHTML = ''; + + // Trigger component select event + vmlg.oncompselect(''); } // Trigger composite change event @@ -287,9 +293,11 @@ if (ui.isIE()) { var compos = scdl.composite(vmlg.compos); cname.value = graph.ucid(cname.value, compos); graph.selected.id = cname.value; - cvalue.innerHTML = graph.compvaluelink(vmlg.appname, graph.selected.id); setElement(compos, graph.renamecomp(graph.selected.comp, compos, cname.value)); + // Trigger component select event + vmlg.oncompselect(vmlg.appname, graph.selected.id); + // Refresh the composite graph.refresh(vmlg); @@ -588,7 +596,7 @@ if (ui.isIE()) { /** * Make an SVG graph. */ - graph.mkgraph = function(pos, cname, pvalue, cvalue) { + graph.mkgraph = function(pos, cname, pvalue) { // Create a div element to host the graph var div = document.createElement('div'); @@ -637,7 +645,9 @@ if (ui.isIE()) { // Reset current selection cname.value = ''; pvalue.value = ''; - cvalue.innerHTML =''; + + // Trigger component select event + svg.oncompselect(''); return false; } @@ -663,7 +673,9 @@ if (ui.isIE()) { // Update the component name and property value fields cname.value = graph.selected.id; pvalue.value = graph.property(graph.selected.comp); - cvalue.innerHTML = graph.compvaluelink(svg.appname, graph.selected.id); + + // Trigger component select event + svg.oncompselect(svg.appname, graph.selected.id); return false; }; @@ -714,7 +726,9 @@ if (ui.isIE()) { graph.selected = null; cname.value = ''; pvalue.value = ''; - cvalue.innerHTML = ''; + + // Trigger component select event + svg.oncompselect(''); } } @@ -785,9 +799,11 @@ if (ui.isIE()) { var compos = scdl.composite(svg.compos); cname.value = graph.ucid(cname.value, compos); graph.selected.id = cname.value; - cvalue.innerHTML = graph.compvaluelink(svg.appname, graph.selected.id); setElement(compos, graph.renamecomp(graph.selected.comp, compos, cname.value)); + // Trigger component select event + svg.oncompselect(svg.appname, graph.selected.id); + // Refresh the composite graph.refresh(svg); @@ -946,6 +962,7 @@ if (ui.isIE()) { var shape = document.createElementNS(graph.svgns, 'path'); shape.setAttribute('d', d); shape.setAttribute('fill', graph.color(comp)); + shape.setAttribute('fill-opacity', '0.60'); // Create an overlay contour shape var contour = document.createElementNS(graph.svgns, 'path'); @@ -998,6 +1015,7 @@ if (ui.isIE()) { var shape = document.createElementNS(graph.svgns, 'path'); shape.setAttribute('d', path); shape.setAttribute('fill', graph.colors.lightgray); + shape.setAttribute('fill-opacity', '0.60'); // Create an overlay contour shape var contour = document.createElementNS(graph.svgns, 'path'); @@ -1855,6 +1873,16 @@ graph.display = function(nodes, g) { }; /** + * Hide a graph. + */ +graph.hide = function(g) { + + // Remove nodes from the graph + map(function(n) { if (!isNil(n.comp) && n.id.substr(0, 8) != 'palette:') { g.removeChild(n); } return n; }, nodeList(g.childNodes)); + return g; +}; + +/** * Refresh a graph. */ graph.refresh = function(g) { @@ -1869,28 +1897,17 @@ graph.refresh = function(g) { * Display and enable editing of a composite and the graphical * nodes that represent it. */ -graph.edit = function(appname, compos, nodes, onchange, g) { +graph.edit = function(appname, compos, nodes, onchange, onselect, g) { // Store the appname and composite in the graphical canvas g.appname = appname; g.compos = compos; + + // Store event listeners g.oncomposchange = onchange; + g.oncompselect = onselect; // Display the composite nodes return graph.display(nodes, g); }; -/** - * Return the link to a component value. - */ -graph.compvaluelink = function(appname, cname) { - var protocol = window.location.protocol; - var host = window.location.hostname; - var port = ':' + window.location.port; - if (port == ':80' || port == ':443' || port == ':') - port = ''; - var link = protocol + '//' + appname + '.' + host + port + '/components/' + cname; - return '<a href="' + link + '">' + link + '</a>'; - -}; - diff --git a/sca-cpp/trunk/modules/edit/htdocs/graph/index.html b/sca-cpp/trunk/modules/edit/htdocs/graph/index.html index ac9cf2f3b1..9484946f72 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/graph/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/graph/index.html @@ -26,7 +26,7 @@ <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/ui.js"></script> </head> -<body> +<body class="delayed"> <div id="menu"></div> <script type="text/javascript"> @@ -35,7 +35,7 @@ var appname = ui.queryParams()['app']; // Load the menu bar -ui.loadwidget('menu', '/menu.html?app=' + appname); +ui.loadwidget('menu', '/menu.html?app=' + appname, ui.showbody); </script> <h1>App Edit <span id="appNameHeader" style="font-weight: normal;"></span></h1> diff --git a/sca-cpp/trunk/modules/edit/htdocs/home.png b/sca-cpp/trunk/modules/edit/htdocs/home.png Binary files differnew file mode 100644 index 0000000000..e091b99c9f --- /dev/null +++ b/sca-cpp/trunk/modules/edit/htdocs/home.png diff --git a/sca-cpp/trunk/modules/edit/htdocs/index.html b/sca-cpp/trunk/modules/edit/htdocs/index.html index 6a4c055295..eb331ea406 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/index.html @@ -26,13 +26,13 @@ <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/ui.js"></script> </head> -<body> +<body class="delayed"> <div id="menu"></div> <script type="text/javascript"> // Load the menu bar -ui.loadwidget('menu', '/menu.html'); +ui.loadwidget('menu', '/menu.html', ui.showbody); </script> <h1>App Edit</h1> diff --git a/sca-cpp/trunk/modules/edit/htdocs/login/index.html b/sca-cpp/trunk/modules/edit/htdocs/login/index.html index 816046be82..8ba796643f 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/login/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/login/index.html @@ -23,11 +23,22 @@ <meta name="apple-mobile-web-app-capable" content="yes"/> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/> <link rel="stylesheet" type="text/css" href="/ui.css"/> +<script type="text/javascript" src="/util.js"></script> +<script type="text/javascript" src="/ui.js"></script> </head> <body> <h1>Sign in</h1> <br/> +<form name="formSignin" method="POST" action="/login/dologin"> +<table border="0"> +<tr><td>Username:</td><td><input type="text" id="httpd_username" name="httpd_username" value=""/></td></tr> +<tr><td>Password:</td><td><input type="password" name="httpd_password" value=""/></td></tr> +<tr><td><input type="submit" onclick="submitFormSignin()" value="Sign in"/></td><td></td></tr> +</table> +<input type="hidden" name="httpd_location" value="/"/> +</form> + <script type="text/javascript"> function queryParams() { qp = new Array(); @@ -62,16 +73,9 @@ function submitFormSignin() { document.formSignin.httpd_location.value = oauthReferrer(); document.formSignin.submit(); } -</script> -<form name="formSignin" method="POST" action="/login/dologin"> -<table border="0"> -<tr><td>Username:</td><td><input type="text" name="httpd_username" value=""/></td></tr> -<tr><td>Password:</td><td><input type="password" name="httpd_password" value=""/></td></tr> -<tr><td><input type="button" onclick="submitFormSignin()" value="Sign in"/></td><td></td></tr> -</table> -<input type="hidden" name="httpd_location" value="/"/> -</form> +$('httpd_username').focus(); +</script> </body> </html> diff --git a/sca-cpp/trunk/modules/edit/htdocs/logout/index.html b/sca-cpp/trunk/modules/edit/htdocs/logout/index.html index 81991aa7c1..ff27f5a8cb 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/logout/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/logout/index.html @@ -23,19 +23,26 @@ <meta name="apple-mobile-web-app-capable" content="yes"/> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/> <link rel="stylesheet" type="text/css" href="/ui.css"/> +<script type="text/javascript" src="/util.js"></script> +<script type="text/javascript" src="/ui.js"></script> </head> <body> <h1>Sign out</h1> <br/> <form name="signout" action="/login" method="GET"> +<input type="submit" onclick="submitSignout()" id="signOut" value="Sign out"/> +</form> + <script type="text/javascript"> function submitSignout() { document.cookie = 'TuscanyOpenAuth=;expires=' + new Date(1970,01,01).toGMTString() + ';path=/;secure=TRUE'; document.signout.submit(); return true; } + +$('signOut').focus(); </script> -<input type="button" onclick="submitSignout()" value="Sign out"/> -</form> -</body></html> + +</body> +</html> diff --git a/sca-cpp/trunk/modules/edit/htdocs/main.html b/sca-cpp/trunk/modules/edit/htdocs/main.html index ddd89b6bab..ee9f0d3fd6 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/main.html +++ b/sca-cpp/trunk/modules/edit/htdocs/main.html @@ -26,21 +26,19 @@ <div id="bodydiv" style="position: absolute; top: 0px; left: 0px; right: 0px;"> -<div>This module implements simple App editing tools to help you create Tuscany apps.</div> -<div>The user interface is minimalistic, by design.</div> -<br/> +<div style="margin-left: auto; margin-right: auto; text-align: center;"> +<br/><br/><br/> -<h2>App Dashboard</h2> -<p>Try the <a href="dash" target="_parent">App Dashboard</a> to manage your collection of apps.</p> +<a href="dash" target="_parent"><img src="home.png" style="width: 426px; height: 145px;"></img></a> -<h2>Composition Editor</h2> -<p>Try the <a href="graph/?app=testvalues" target="_parent">Composition Editor</a> to compose the logic of an app.</p> +<br/><br/> -<h2>Page Editor</h2> -<p>Try the <a href="page/?app=testvalues" target="_parent">Page Editor</a> to draw an app page.</p> +<h1><a href="dash" target="_parent">Get Started</a></h1> -<h2>App Settings Editor</h2> -<p>Try the <a href="app/?app=testvalues" target="_parent">App Settings Editor</a> to edit the settings of app.</p> +<br/><br/><br/> +<div>This module implements a simple App store to help you create and share Tuscany apps.</div> +<div>The user interface is minimalistic, by design.</div> +</div> </div> diff --git a/sca-cpp/trunk/modules/edit/htdocs/menu.html b/sca-cpp/trunk/modules/edit/htdocs/menu.html index d60d80b1cb..6346075df3 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/menu.html +++ b/sca-cpp/trunk/modules/edit/htdocs/menu.html @@ -55,9 +55,9 @@ function appname() { var mdiv = $('menu'); var name = appname(); mdiv.innerHTML = ui.menubar( - append(mklist(ui.menu('Home', '/'), ui.menu('Dashboard', '/dash')), - (isNil(name) || name == 'undefined')? mklist() : mklist(ui.menu('Composition', '/graph/?app=' + name), ui.menu('Page', '/page/?app=' + name), ui.menu('Settings', '/app/?app=' + name))), - mklist(userMenu(), ui.menu('Sign out', '/logout'))); + append(mklist(ui.menu('Home', '/'), ui.menu('Store', '/store'), ui.menu('Dashboard', '/dash')), + (isNil(name) || name == 'undefined')? mklist() : mklist(ui.menu('Composition', '/graph/?app=' + name), ui.menu('Page', '/page/?app=' + name), ui.menu('Settings', '/props/?app=' + name))), + mklist(userMenu(), ui.menu('Account', '/account'), ui.menu('Sign out', '/logout'))); </script> </body> diff --git a/sca-cpp/trunk/modules/edit/htdocs/page/index.html b/sca-cpp/trunk/modules/edit/htdocs/page/index.html index 23aeeb9e2a..a328998177 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/page/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/page/index.html @@ -26,7 +26,7 @@ <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/ui.js"></script> </head> -<body> +<body class="delayed"> <div id="menu"></div> <script type="text/javascript"> @@ -35,7 +35,7 @@ var appname = ui.queryParams()['app']; // Load the menu bar -ui.loadwidget('menu', '/menu.html?app=' + appname); +ui.loadwidget('menu', '/menu.html?app=' + appname, ui.showbody); </script> <h1>App Edit <span id="appNameHeader" style="font-weight: normal;"></span></h1> diff --git a/sca-cpp/trunk/modules/edit/htdocs/page/page.html b/sca-cpp/trunk/modules/edit/htdocs/page/page.html index 297e5c5a69..6cd828ea74 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/page/page.html +++ b/sca-cpp/trunk/modules/edit/htdocs/page/page.html @@ -34,15 +34,15 @@ <table style="width: 100%;"> <tr> -<th class="thl" style="width: 225px; min-width: 225px;">Palette</th> +<th class="thl" style="width: 225px; min-width: 225px; padding-top: 4px; padding-bottom: 4px;">Palette</th> <th class="thr" style="padding-left: 4px; padding-top: 0px; padding-bottom: 0px;"> -<input id="widgetName" type="text" value="widget name" style="position: relative; width: 200px;"/> -<input id="widgetText" type="text" value="widget text" style="position: relative; width: 300px;"/> +<input id="widgetName" type="text" value="widget name" title="Widget name" style="position: relative; width: 200px;"/> +<input id="widgetText" type="text" value="widget text" title="Widget text" style="position: relative; width: 300px;"/> </th> <th class="thl thr" style="padding-top: 0px; padding-bottom: 0px; padding-right: 0px; text-align: right;"> -<input type="button" id="saveButton" style="font-weight: bold;" Value="Saved"/> +<input type="button" id="saveButton" title="Save the page" style="font-weight: bold;" Value="Saved"/> </th> </tr> @@ -53,14 +53,18 @@ <span class="h1" id="palette:h1" style="position: absolute; left: 0px; top: 0px;"><h1>Header1</h1></span> <span class="h2" id="palette:h2" style="position: absolute; left: 0px; top: 40px;"><h2>Header2</h2></span> -<span class="button" id="palette:button" style="position: absolute; left: 0px; top: 80px;"><input type="button" value="button"/></span> -<span class="entry" id="palette:entry" style="position: absolute; left: 0px; top: 120px;"><input type="text" value="field" size="5"/></span> -<span class="password" id="palette:password" style="position: absolute; left: 0px; top: 160px;"><input type="password" value="password" size="5"/></span> -<span class="checkbox" id="palette:checkbox" style="position: absolute; left: 0px; top: 200px;"><input type="checkbox" value="checkbox"/><span>checkbox</span></span> -<span class="list" id="palette:list" style="position: absolute; left: 0px; top: 240px;"><select><option value="list">list</option></select></span> -<span class="link" id="palette:link" style="position: absolute; left: 0px; top: 280px;"><a href="/"><span>link</span></a></span> -<span class="text" id="palette:text" style="position: absolute; left: 0px; top: 320px;"><span>text</span></span> -<span class="img" id="palette:img" style="position: absolute; left: 0px; top: 360px;"><img src=""/></span> +<span class="section" id="palette:section" style="position: absolute; left: 0px; top: 80px;"><span class="section">section</span></span> +<span class="button" id="palette:button" style="position: absolute; left: 0px; top: 120px;"><input type="button" value="button"/></span> +<span class="entry" id="palette:entry" style="position: absolute; left: 0px; top: 160px;"><input type="text" value="field" size="5"/></span> +<span class="password" id="palette:password" style="position: absolute; left: 0px; top: 200px;"><input type="password" value="password" size="5"/></span> +<span class="checkbox" id="palette:checkbox" style="position: absolute; left: 0px; top: 240px;"><input type="checkbox" value="checkbox"/><span>checkbox</span></span> +<span class="list" id="palette:list" style="position: absolute; left: 0px; top: 280px;"><select><option value="list">list</option></select></span> +<span class="table" id="palette:table" style="position: absolute; left: 0px; top: 320px;"> +<table class="datatable"><tr><td class="datatdl">name</td><td class="datatdr">value</td></tr><tr><td class="datatdl">name</td><td class="datatdr">value</td></tr></table> +</span> +<span class="link" id="palette:link" style="position: absolute; left: 0px; top: 380px;"><a href="/"><span>link</span></a></span> +<span class="text" id="palette:text" style="position: absolute; left: 0px; top: 420px;"><span>text</span></span> +<span class="img" id="palette:img" style="position: absolute; left: 0px; top: 460px;"><img src=""/></span> </div> diff --git a/sca-cpp/trunk/modules/edit/htdocs/page/page.js b/sca-cpp/trunk/modules/edit/htdocs/page/page.js index 6e886fb774..1fb136236b 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/page/page.js +++ b/sca-cpp/trunk/modules/edit/htdocs/page/page.js @@ -335,14 +335,16 @@ if (ui.isIE()) { * Return the text of a widget. */ page.text = function(e) { - if (e.className == 'h1' || e.className == 'h2' || e.className == 'text') - return e.childNodes[0].innerHTML; + if (e.className == 'h1' || e.className == 'h2' || e.className == 'text' || e.className == 'section') + return car(childElements(e)).innerHTML; if (e.className == 'button' || e.className == 'entry' || e.className == 'password' || e.className == 'checkbox') - return e.childNodes[0].value; + return car(childElements(e)).value; if (e.className == 'list') - return e.childNodes[0].childNodes[0].value; + return car(childElements(car(childElements(e)))).value; if (e.className == 'link') - return e.childNodes[0].childNodes[0].innerHTML; + return car(childElements(car(childElements(e)))).innerHTML; + if (e.className == 'table') + return ''; return ''; }; @@ -350,29 +352,34 @@ page.text = function(e) { * Set the text of a widget. */ page.settext = function(e, t) { - if (e.className == 'h1' || e.className == 'h2' || e.className == 'text') { - e.childNodes[0].innerHTML = t; + if (e.className == 'h1' || e.className == 'h2' || e.className == 'text' || e.className == 'section') { + car(childElements(e)).innerHTML = t; return t; } if (e.className == 'button' || e.className == 'entry' || e.className == 'password') { - e.childNodes[0].value = t; + car(childElements(e)).value = t; return t; } if (e.className == 'checkbox') { - e.childNodes[0].value = t; + car(childElements(e)).value = t; map(function(n) { if (n.nodeName == "SPAN") n.innerHTML = t; return n; }, nodeList(e.childNodes)); return t; } if (e.className == 'list') { - e.childNodes[0].childNodes[0].value = t; - e.childNodes[0].childNodes[0].innerHTML = t; + var ce = car(childElements(car(childElements(e)))); + ce.value = t; + ce.innerHTML = t; return t; } if (e.className == 'link') { - e.childNodes[0].childNodes[0].href = t; - e.childNodes[0].childNodes[0].innerHTML = t; + var ce = car(childElements(car(childElements(e)))); + ce.href = t; + ce.innerHTML = t; return t; } + if (e.className == 'table') { + return ''; + } return ''; }; diff --git a/sca-cpp/trunk/modules/edit/htdocs/props/index.html b/sca-cpp/trunk/modules/edit/htdocs/props/index.html new file mode 100644 index 0000000000..650c68a350 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/htdocs/props/index.html @@ -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. +--> +<html> +<head> +<title>App Settings</title> +<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0"/> +<meta name="apple-mobile-web-app-capable" content="yes"/> +<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/> +<link rel="stylesheet" type="text/css" href="/ui.css"/> +<script type="text/javascript" src="/util.js"></script> +<script type="text/javascript" src="/ui.js"></script> +</head> +<body class="delayed"> +<div id="menu"></div> + +<script type="text/javascript"> + +// Get the app name +var appname = ui.queryParams()['app']; + +// Load the menu bar +ui.loadwidget('menu', '/menu.html?app=' + appname, ui.showbody); +</script> + +<h1>App Edit <span id="appNameHeader" style="font-weight: normal;"></span></h1> +<br/> + +<div id="props"></div> + +<script type="text/javascript"> + +/** + * Display the properties editor for an app. + */ +function editapp(name) { + if (isNil(name)) + return; + ui.loadiframe('props', 'props.html?app=' + name); +} + +// Display the editor for the current app +document.title = 'App - ' + appname; +$('appNameHeader').innerHTML = ' - ' + appname; +editapp(appname); + +</script> +</body> +</html> + diff --git a/sca-cpp/trunk/modules/edit/htdocs/app/app.html b/sca-cpp/trunk/modules/edit/htdocs/props/props.html index faf0372179..36d4e075ad 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/app/app.html +++ b/sca-cpp/trunk/modules/edit/htdocs/props/props.html @@ -33,10 +33,10 @@ <table style="width: 100%;"> <tr> -<th class="thl thr">Settings</th> +<th class="thl thr" style="padding-top: 4px; padding-bottom: 4px;">Settings</th> <th class="thl thr" style="padding-top: 0px; padding-bottom: 0px; padding-right: 0px; text-align: right;"> -<input type="button" id="saveButton" style="font-weight: bold;" Value="Saved"/> +<input type="button" id="saveButton" title="Save the app" style="font-weight: bold;" Value="Saved"/> </th> </tr> </table> @@ -46,13 +46,13 @@ <form id="appForm"> <table style="width: 100%;"> <tr><tr><td><b>App Title:</b></td></tr> -<tr><td><input type="text" id="appTitle" size="30"/></td></tr> +<tr><td><input type="text" id="appTitle" size="80"/></td></tr> <tr><tr><td><b>Category:</b></td></tr> <tr><td><input type="text" id="appCategory" size="15"/></td></tr> <tr><tr><td><b>Updated:</b></td></tr> <tr><td><span id="appUpdated"></span></td></tr> <tr><tr><td><b>Description:</b></td></tr> -<tr><td><textarea id="appDescription" cols="30" rows="5"></textarea></td></tr> +<tr><td><textarea id="appDescription" cols="80" rows="5"></textarea></td></tr> </table> </form> </div> diff --git a/sca-cpp/trunk/modules/edit/htdocs/public/app.png b/sca-cpp/trunk/modules/edit/htdocs/public/app.png Binary files differnew file mode 100644 index 0000000000..bae5415d0c --- /dev/null +++ b/sca-cpp/trunk/modules/edit/htdocs/public/app.png diff --git a/sca-cpp/trunk/modules/edit/htdocs/public/notauth.html b/sca-cpp/trunk/modules/edit/htdocs/public/notauth.html new file mode 100644 index 0000000000..f49c914057 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/htdocs/public/notauth.html @@ -0,0 +1,56 @@ +<!-- + * 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. +--> +<html> +<head> +<title>App Edit - Sorry</title> +<meta name="viewport" content="width=device-width user-scalable=no initial-scale=1.0"/> +<meta name="apple-mobile-web-app-capable" content="yes"/> +<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/> +<link rel="stylesheet" type="text/css" href="/ui.css"/> +<script type="text/javascript" src="/util.js"></script> +<script type="text/javascript" src="/ui.js"></script> +</head> +<body class="delayed"> +<div id="menu"></div> + +<script type="text/javascript"> + +// Load the menu bar +ui.loadwidget('menu', '/menu.html', ui.showbody); +</script> + +<h1>App Edit</h1> +<br/> +<div class="hd1">Sorry, you're not authorized to view this page.</div> + +<form name="signout" action="/public/notauth.html" method="GET"> +<script type="text/javascript"> +function submitSignout() { + document.cookie = 'TuscanyOpenAuth=;expires=' + new Date(1970,01,01).toGMTString() + ';path=/;secure=TRUE'; + document.signout.submit(); + return true; +} + +if (window.top.location.pathname != '/public/notauth.html') + submitSignout(); +</script> +</form> + +</body> +</html> diff --git a/sca-cpp/trunk/modules/edit/htdocs/public/notfound.html b/sca-cpp/trunk/modules/edit/htdocs/public/notfound.html new file mode 100644 index 0000000000..980d1e1960 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/htdocs/public/notfound.html @@ -0,0 +1,44 @@ +<!-- + * 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. +--> +<html> +<head> +<title>App Edit - Page not found</title> +<meta name="viewport" content="width=device-width user-scalable=no initial-scale=1.0"/> +<meta name="apple-mobile-web-app-capable" content="yes"/> +<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/> +<link rel="stylesheet" type="text/css" href="/ui.css"/> +<script type="text/javascript" src="/util.js"></script> +<script type="text/javascript" src="/ui.js"></script> +</head> +<body class="delayed"> +<div id="menu"></div> + +<script type="text/javascript"> + +// Load the menu bar +ui.loadwidget('menu', '/menu.html', ui.showbody); +</script> + +<h1>App Edit</h1> +<br/> +<div class="hd1">Sorry, that page was not found.</div> +<div>You may have clicked an expired link or mistyped the address.</div> + +</body> +</html> diff --git a/sca-cpp/trunk/modules/edit/htdocs/public/oops.html b/sca-cpp/trunk/modules/edit/htdocs/public/oops.html new file mode 100644 index 0000000000..f4f23d2f60 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/htdocs/public/oops.html @@ -0,0 +1,43 @@ +<!-- + * 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. +--> +<html> +<head> +<title>App Edit - Oops</title> +<meta name="viewport" content="width=device-width user-scalable=no initial-scale=1.0"/> +<meta name="apple-mobile-web-app-capable" content="yes"/> +<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/> +<link rel="stylesheet" type="text/css" href="/ui.css"/> +<script type="text/javascript" src="/util.js"></script> +<script type="text/javascript" src="/ui.js"></script> +</head> +<body class="delayed"> +<div id="menu"></div> + +<script type="text/javascript"> + +// Load the menu bar +ui.loadwidget('menu', '/menu.html', ui.showbody); +</script> + +<h1>App Edit</h1> +<br/> +<div class="hd1">Oops, something went wrong...</div> + +</body> +</html> diff --git a/sca-cpp/trunk/modules/edit/htdocs/store/index.html b/sca-cpp/trunk/modules/edit/htdocs/store/index.html new file mode 100644 index 0000000000..f425c0117a --- /dev/null +++ b/sca-cpp/trunk/modules/edit/htdocs/store/index.html @@ -0,0 +1,52 @@ +<!-- + * 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. +--> +<html> +<head> +<title>App Store</title> +<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0"/> +<meta name="apple-mobile-web-app-capable" content="yes"/> +<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/> +<link rel="stylesheet" type="text/css" href="/ui.css"/> +<script type="text/javascript" src="/util.js"></script> +<script type="text/javascript" src="/ui.js"></script> +</head> +<body class="delayed"> +<div id="menu"></div> + +<script type="text/javascript"> + +// Load the menu bar +ui.loadwidget('menu', '/menu.html', ui.showbody); +</script> + +<h1>App Edit</h1> +<br/> + +<div id="store"></div> + +<script type="text/javascript"> + +// Load the store +$('store').innerHTML = + '<iframe id="storeFrame" style="height: 5000px; width: 100%; border: 0px;" scrolling="no" frameborder="0" src="store.html"></iframe>'; + +</script> +</body> +</html> + diff --git a/sca-cpp/trunk/modules/edit/htdocs/store/store.html b/sca-cpp/trunk/modules/edit/htdocs/store/store.html new file mode 100644 index 0000000000..d8b0f44e01 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/htdocs/store/store.html @@ -0,0 +1,111 @@ +<!-- + * 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. +--> +<html> +<head> +<link rel="stylesheet" type="text/css" href="/ui.css"> +<script type="text/javascript" src="/util.js"></script> +<script type="text/javascript" src="/elemutil.js"></script> +<script type="text/javascript" src="/xmlutil.js"></script> +<script type="text/javascript" src="/atomutil.js"></script> +<script type="text/javascript" src="/scdl.js"></script> +<script type="text/javascript" src="/ui.js"></script> +<script type="text/javascript" src="/component.js"></script> +</head> +<body> + +<div id="bodydiv" style="position: absolute; top: 0px; left: 0px; right: 0px;"> + +<table style="width: 100%;"> +<tr> +<th class="thl thr" style="padding-top: 4px; padding-bottom: 4px;">Cool Apps</th> +</tr> +</table> + +<div id="apps"></div> +<br/> + +<script type="text/javascript"> +if (ui.isIE()) $('bodydiv').style.right = -20; + +// Init service references +var editWidget = sca.component("EditWidget"); +var store = sca.reference(editWidget, "store"); + +/** + * Return the link to an app. + */ +function applink(appname) { + var protocol = window.location.protocol; + var host = window.location.hostname; + var port = ':' + window.location.port; + if (port == ':80' || port == ':443' || port == ':') + port = ''; + var link = protocol + '//' + appname + '.' + host + port + '/index.html'; + return link; +} + +/** + * Get and display list of apps. + */ +function getapps(sync) { + function display(doc) { + var apps = '<div>'; + var feed = car(elementsToValues(atom.readATOMFeed(mklist(doc)))); + var entries = cadr(assoc("'entry", cdr(feed))); + for (var i = 0; i < length(entries); i++) { + var entry = entries[i]; + title = cadr(assoc("'title", entry)) + name = cadr(assoc("'id", entry)) + author = 'joe@localhost'; + hreflink = '<a href=\"' + applink(name) + '\" target=\"_parent\">'; + + apps += '<div class="box" style="width: 250px; display: inline-block; border: 1px; border-style: solid; border-color: #dcdcdc; border-collapse: collapse; margin: 5px; padding: 10px; vertical-align: top;">' + apps += '<table><tr>'; + apps += '<td>'; + apps += '<div>' + hreflink + '<img src="/public/app.png" style="height: 50px; width: 50px; vertical-align: top; margin-right: 10px; margin-bottom: 5px;"></img>' + '</a></div>'; + apps += '<div><input type="button" id="cloneApp" value="Clone" title="Clone this app"></div>'; + apps += '</td>'; + apps += '<td class="tdw">'; + apps += '<div style="font-weight: bold">' + hreflink + name + '</a></div>'; + apps += '<div>' + 'by ' + '<span style="font-weight: bold;">' + author + '</span></div>'; + apps += '<br/>'; + apps += '<div>' + title + '</div>'; + apps += '</td>'; + apps += '</tr></table>'; + apps += '</div>'; + } + apps += '</div>'; + $('apps').innerHTML = apps; + } + + if (sync) { + display(store.get('coolapps')); + } else { + store.get('coolapps', function(doc) { + display(doc); + }); + } +} + +// Get and display the list of apps +getapps(true); + +</script> +</body> +</html> |