diff options
Diffstat (limited to 'sca-cpp/trunk/modules/edit/htdocs/stats/index.html')
-rw-r--r-- | sca-cpp/trunk/modules/edit/htdocs/stats/index.html | 166 |
1 files changed, 166 insertions, 0 deletions
diff --git a/sca-cpp/trunk/modules/edit/htdocs/stats/index.html b/sca-cpp/trunk/modules/edit/htdocs/stats/index.html new file mode 100644 index 0000000000..737bb0bef4 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/htdocs/stats/index.html @@ -0,0 +1,166 @@ +<!DOCTYPE html> +<!-- + * 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>Stats</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"/> +<link rel="apple-touch-icon" href="/public/touchicon.png"/> +<link rel="stylesheet" type="text/css" href="/ui-min.css"/> +<script type="text/javascript" src="/config.js"></script> +<script type="text/javascript" src="/all-min.js"></script> +<script type="text/javascript" src="/menu.js"></script> +</head> +<body class="delayed" onorientationchange="ui.reload();"> +<div id="bodydiv" class="devicewidth"> + +<div id="menu"></div> + +<table style="width: 100%;"> +<tr> +<td><h1><span id="h1"></span><span id="appNameHeader"></span></h1></td> +<td style="vertical-align: middle; text-align: right;"><span id="saveStatus" style="font-weight: bold; color: #808080;">Saved</span></td> +</tr> +</table> + +<table style="width: 100%;"> +<tr> +<th class="thl thr" style="padding-top: 4px; padding-bottom: 4px;">Stats</th> +</tr> +</table> + +<form id="appForm" style="position: absolute; top: 90px; left: 0px;"> +<table style="width: 100%;"> +<tr><tr><td><b>App Icon:</b></td></tr> +<tr><td><img src="/public/app.png" style="width: 50px; height: 50px; vertical-align: top;"></td></tr> +<tr><tr><td style="padding-top: 6px;"><b>Sharing:</b></td></tr> +<tr><td><input type="checkbox" value="shared"/><span>Shared</span></td></tr> +<tr><tr><td style="padding-top: 6px;"><b>App Title:</b></td></tr> +<tr><td><input type="text" id="appTitle" size="30" placeholder="Enter the title of your app" style="width: 300px;"/></td></tr> +<tr><tr><td style="padding-top: 6px;"><b>Updated:</b></td></tr> +<tr><td><span id="appUpdated"></span></td></tr> +<tr><tr><td style="padding-top: 6px;"><b>Description:</b></td></tr> +<tr><td><textarea id="appDescription" cols="40" rows="3" placeholder="Enter a short description of your app" style="width: 300px;"></textarea></td></tr> +</table> +</form> + +</div> + +<script type="text/javascript"> +// Get the app name +var appname = ui.queryParams()['app']; +if (isNil(appname)) + window.open('/', '_self'); + +/** + * 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 + '/'; + return link; +} + +// Set page titles +document.title = windowtitle(window.location.hostname) + ' - Stats - ' + appname; +$('h1').innerHTML = hometitle(window.location.hostname); +$('appNameHeader').innerHTML = ' - <a href=\"' + applink(appname) + '\" target=\"' + '_blank' + '\">' + appname + '</a>'; + +// Load the menu bar +displaymenu(); + +// Show the page +ui.showbody(); + +// Init service references +var editWidget = sca.component("EditWidget"); +var dashboard = sca.reference(editWidget, "dashboard"); + +/** + * The current app entry and corresponding saved XML content. + */ +var appentry; +var savedappentryxml = ''; + +/** + * Get and display an app. + */ +function getapp(name) { + if (isNil(name)) + return false; + return dashboard.get(name, function(doc) { + appentry = doc != null? car(elementsToValues(atom.readATOMEntry(mklist(doc)))) : mklist("'entry", mklist("'title", ''), mklist("'id", name)); + var title = cadr(assoc("'title", cdr(appentry))); + $('appTitle').value = title; + $('appUpdated').innerHTML = 'Apr 24, 2011' + $('appDescription').innerHTML = ''; + savedappentryxml = car(atom.writeATOMEntry(valuesToElements(mklist(appentry)))); + return true; + }); +} + +/** + * Save the current app. + */ +function save(entryxml) { + $('saveStatus').innerHTML = 'Saving'; + savedappentryxml = entryxml; + dashboard.put(appname, savedappentryxml); + $('saveStatus').innerHTML = 'Saved'; + return true; +} + +/** + * Handle a change event + */ +function onappchange() { + var title = $('appTitle').value; + var appentry = mklist("'entry", mklist("'title", title != ''? title : appname), mklist("'id", appname)); + var entryxml = car(atom.writeATOMEntry(valuesToElements(mklist(appentry)))); + if (savedappentryxml == entryxml) + return false; + $('saveStatus').innerHTML = 'Modified'; + return save(entryxml); +} + +$('appTitle').onchange = onappchange; +$('appDescription').onchange = onappchange; + +/** + * Handle a form submit event. + */ +$('appForm').onsubmit = function() { + onappchange(); + return false; +}; + +// Get the current app +getapp(appname); + +</script> + +</body> +</html> + |