You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2012/05/28 18:49:38 UTC
svn commit: r1343316 [3/5] - in /tuscany/sca-cpp/trunk: ./ hosting/server/
hosting/server/htdocs/ hosting/server/htdocs/account/
hosting/server/htdocs/app/ hosting/server/htdocs/clone/
hosting/server/htdocs/create/ hosting/server/htdocs/delete/ hosting...
Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/login/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/login/index.html?rev=1343316&r1=1343315&r2=1343316&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/login/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/login/index.html Mon May 28 16:49:36 2012
@@ -24,49 +24,96 @@
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<base href="/login/"/>
-<link rel="stylesheet" type="text/css" href="/ui-min.css"/>
-<script type="text/javascript" src="/all-min.js"></script>
+<script type="text/javascript">
+
+window.appcache = {};
+
+/**
+ * Get and cache a resource.
+ */
+appcache.get = function(uri) {
+ var h = uri.indexOf('#');
+ var u = h == -1? uri : uri.substring(0, h);
+
+ // Get resource from local storage first
+ var ls = window.lstorage || localStorage;
+ var item = null;
+ try { item = ls.getItem(u); } catch(e) {}
+ if (item != null && item != '')
+ return item;
+
+ // Get resource from network
+ var http = new XMLHttpRequest();
+ http.open("GET", u, false);
+ http.setRequestHeader("Accept", "*/*");
+ http.send(null);
+ if (http.status == 200) {
+ if (http.getResponseHeader("X-Login") != null) {
+ if (debug) debug('http error', u, 'X-Login');
+ return null;
+ } else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
+ if (debug) debug('http error', u, 'No-Content');
+ return null;
+ }
+ try { ls.setItem(u, http.responseText); } catch(e) {}
+ return http.responseText;
+ }
+ if (debug) debug('http error', u, http.status, http.statusText);
+ return null;
+};
+
+// Load Javascript and CSS
+(function() {
+ var bootjs = document.createElement('script');
+ bootjs.type = 'text/javascript';
+ bootjs.text = appcache.get('/all-min.js');
+ document.head.appendChild(bootjs);
+ document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
+})();
+
+</script>
</head>
<body class="delayed" onload="onload();">
-<div id="bodydiv" class="bodydiv">
+<div id="mainbodydiv" class="bodydiv">
-<h1>Sign in</h1>
+<div id="headdiv" class="hsection">
+<script type="text/javascript">
+(function() {
+$('headdiv').appendChild(ui.declareScript(appcache.get('/public/config-min.js')));
+})();
+</script>
+</div>
-<form name="googleOpenIDForm">
-<table border="0">
-<tr><td><b>Sign in with your Google account (using OpenID)</b></td></tr>
-<tr><td><input type="button" value="Sign in" class="graybutton" style="font-weight: bold;" onclick="submitOpenIDSignin(withGoogleOpenID)"/></td></tr>
-</table>
-</form>
+<div id="menubackground" class="tbarbackground fixed"></div>
+<div id="menu" class="tbarmenu fixed"></div>
-<form name="facebookOAuth2Form">
-<table border="0">
-<tr><td><b>Sign in with your Facebook account (using OAuth)</b></td></tr>
-<tr><td><input type="button" value="Sign in" class="graybutton" style="font-weight: bold;" onclick="submitOAuth2Signin(withFacebook)"/></td></tr>
-</table>
-</form>
+<div id="viewheadbackground" class="viewheadbackground fixed"></div>
+<div id="viewhead" class="viewhead fixed">
+<span class="cmenu">Sign in</span>
+</div>
-<form name="googleOAuth2Form">
-<table border="0">
-<tr><td><b>Sign in with your Google account (using OAuth)</b></td></tr>
-<tr><td><input type="button" value="Sign in" class="graybutton" style="font-weight: bold;" onclick="submitOAuth2Signin(withGoogleOAuth)"/></td></tr>
-</table>
+<div id="viewcontainer">
+<div id="view">
+<div id="viewcontent" class="viewcontent" style="margin-left: auto; margin-right: auto; text-align: center;">
+
+<form name="facebookOAuth2Form" style="width: 100%;">
+<p style="font-size: 16px;">Sign in with your <span style="font-weight: bold;">Facebook</span> account</p>
+<p><input type="button" value="Sign in" class="graybutton bluebutton" style="font-size: 16px; line-height: 16px; padding: 6px; height: 32px" onclick="submitOAuth2Signin(withFacebook)"/></p>
</form>
-<form name="formSignin" method="POST" action="/login/dologin">
-<table border="0">
-<tr><td colspan="2"><b>Sign in with your user id and password</b></td></tr>
-<tr><td>User id:</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" class="graybutton" style="font-weight: bold;" onclick="submitFormSignin()" value="Sign in"/></td><td></td></tr>
-</table>
-</p>
-<input type="hidden" name="httpd_location" value="/"/>
+<form name="googleOAuth2Form" style="width: 100%;">
+<p style="font-size: 16px;">Sign in with your <span style="font-weight: bold;" >Google</span> account</p>
+<p><input type="button" value="Sign in" class="graybutton bluebutton" style="font-size: 16px; line-height: 16px; padding: 6px; height: 32px" onclick="submitOAuth2Signin(withGoogleOAuth)"/></p>
</form>
-<form name="openIDSignin" action="/" method="GET">
-<input type="hidden" name="openid_identifier" value=""/>
+<form name="formSignin" method="POST" action="/login/dologin" onsubmit="submitFormSignin()" style="width: 100%;">
+<p id="loginprompt" style="font-size: 16px;"></p>
+<p><input type="text" class="flatentry" name="httpd_username" value="" placeholder="User id"/></p>
+<p><input type="password" class="flatentry" name="httpd_password" value="" placeholder="Password"/></p>
+<p><input type="submit" class="graybutton bluebutton" style="font-size: 16px; line-height: 16px; padding: 6px; height: 32px" value="Sign in"/></p>
+<input type="hidden" name="httpd_location" value="/"/>
</form>
+<br/>
<form name="oauth2Signin" action="/oauth2/authorize/" method="GET">
<input type="hidden" name="oauth2_authorize" value=""/>
@@ -78,7 +125,37 @@
<input type="hidden" name="openauth_referrer" value=""/>
</form>
+</div>
+</div>
+</div>
+
<script type="text/javascript">
+
+// Init div variables
+var mbdiv = $('menubackground');
+var mdiv = $('menu');
+var hdiv = $('viewhead');
+var hbdiv = $('viewheadbackground');
+$('viewcontainer').className = ui.isMobile()? 'viewcontainer3d' : 'viewcontainer3dm';
+$('view').className = ui.isMobile()? 'viewloaded3d' : 'viewloaded3dm';
+$('loginprompt').innerHTML = config.loginprompt;
+
+// Set page titles
+document.title = ui.windowtitle(location.hostname) + ' - Sign in';
+$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle + '</span>';
+
+/**
+ * Build and show the menu bar.
+ */
+function showmenu(mdiv) {
+ mdiv.innerHTML = ui.menubar(mklist(ui.menu('Home', '/', '_self', false)), mklist(ui.menu('Sign in', '/login/', '_self', true)));
+}
+
+showmenu(mdiv);
+
+/**
+ * Parse the query parameeters.
+ */
function queryParams() {
var qp = new Array();
var qs = window.location.search.substring(1).split('&');
@@ -90,6 +167,9 @@ function queryParams() {
return qp;
}
+/**
+ * Return the referrer URL.
+ */
function openauthReferrer() {
var r = queryParams()['openauth_referrer'];
if (typeof(r) == 'undefined' || domainname(r) != domainname(window.location.hostname))
@@ -103,11 +183,11 @@ function openauthReferrer() {
/**
* Signin with OpenID.
*/
+/*
function submitOpenIDSignin(w) {
clearauthcookie();
- localStorage.removeItem('/r/EditWidget/accounts');
- localStorage.removeItem('/r/EditWidget/dashboards');
- //localStorage.clear();
+ lstorage.removeItem('/r/EditWidget/accounts');
+ lstorage.removeItem('/r/EditWidget/dashboards');
document.openIDSignin.openid_identifier.value = w();
document.openIDSignin.action = openauthReferrer();
document.openIDSignin.submit();
@@ -116,6 +196,7 @@ function submitOpenIDSignin(w) {
function withGoogleOpenID() {
return 'https://www.google.com/accounts/o8/id';
}
+*/
/**
* Signin with OAuth 2.0.
@@ -123,9 +204,8 @@ function withGoogleOpenID() {
function submitOAuth2Signin(w) {
parms = w();
clearauthcookie();
- localStorage.removeItem('/r/EditWidget/accounts');
- localStorage.removeItem('/r/EditWidget/dashboards');
- //localStorage.clear();
+ lstorage.removeItem('/r/EditWidget/accounts');
+ lstorage.removeItem('/r/EditWidget/dashboards');
document.oauth2Signin.oauth2_authorize.value = parms[0];
document.oauth2Signin.oauth2_access_token.value = parms[1];
document.oauth2Signin.oauth2_client_id.value = parms[2];
@@ -160,25 +240,24 @@ function submitFormSignin() {
* Handle orientation change.
*/
document.body.onorientationchange = function(e) {
- //log('onorientationchange');
-
- // Scroll to the top and hide the address bar
- window.scrollTo(0, 0);
+ //debug('onorientationchange');
+ ui.onorientationchange(e);
+ // Resize menu and view header
+ mdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
+ hdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
return true;
};
/**
- * Document load post processing.
+ * Load post processing.
*/
function onload() {
- //log('onload');
+ //debug('onload');
+ ui.onload();
// Show the page
document.body.style.visibility = 'visible';
-
- // Scroll to the top and hide the address bar
- window.scrollTo(0, 0);
return true;
}
Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/page/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/page/index.html?rev=1343316&r1=1343315&r2=1343316&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/page/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/page/index.html Mon May 28 16:49:36 2012
@@ -17,66 +17,50 @@
* specific language governing permissions and limitations
* under the License.
-->
-<div id="bodydiv" class="bodydiv" style="overflow: visible;">
+<div id="bodydiv" class="body">
-<table style="width: 100%;">
-<tr>
-<td><h2><span id="appNameHeader"></span></h2></td>
-<td style="vertical-align: middle; text-align: right; padding-right: 8px;"><span id="status" style="font-weight: bold; color: #808080;"></span></td>
-</tr>
-</table>
-
-<table id="widgetValueBackground" style="width: 2500px; position: absolute; top: 59px; left: 0px; z-index: -1;">
-<tr>
-<th class="thr thl"><span style="display: inline-block; padding-top: 0px; padding-bottom: 0px; height: 24px;"></span></th>
-</tr>
-</table>
-
-<table id="widgetValueTable" style="width: 100%;">
-<tr>
-<td class="thl thr" style="text-align: right; padding-right: 2px; vertical-align: top;">
-<span id="deleteWidgetButton" title="Delete a Widget" class="graybutton" style="font-weight: bold; font-size: 16px; color: #808080; display: inline-block; width: 24px; height: 20px; padding-top: 0px; padding-bottom: 0px; text-align: center; margin-left: 0px; margin-right: 0px;">-</span>
-
-<span id="copyWidgetButton" title="Copy a Widget" class="graybutton" style="font-weight: bold; font-size: 16px; color: #808080; display: inline-block; width: 24px; height: 20px; padding-top: 0px; padding-bottom: 0px; text-align: center; margin-left: 0px; margin-right: 0px;">c</span>
-
-<span id="addWidgetButton" title="Add a Widget" class="graybutton" style="font-weight: bold; font-size: 16px; display: inline-block; width: 24px; height: 20px; padding-top: 0px; padding-bottom: 0px; middle; text-align: center; margin-left: 0px; margin-right: 0px;">+</span>
-
-<span id="playPageButton" title="View page" class="graybutton" style="font-weight: bold; font-size: 16px; display: inline-block; width: 24px; height: 20px; padding-top: 0px; padding-bottom: 0px; middle; text-align: center; margin-left: 0px; margin-right: 0px;">></span>
-</td>
-
-<td class="thl thr" style="padding-left: 2px; padding-right: 2px; vertical-align: top; width: 100%;">
-<input id="widgetValue" type="text" value="" title="Widget value" autocapitalize="off" placeholder="Value" style="position: relative; visibility: hidden; width: 100%;"/>
-</td>
-</tr>
-</table>
-
-<div id="contentdiv" style="margin-top: 4px; width: 2500px;">
-<div id="editdiv" style="visibility: visible; position: relative; top: 0px; left: -2500px; width: 2500px; height: 5000px;">
+<div id="contentdiv" class="viewcontent" style="width: 2500px;">
+<div id="pagediv" class="pagediv" style="top: 0px; left: -2500px; width: 5000px; height: 5000px;">
-<div style="position: relative; left: 2500px; top: 0px; right: 0px; height: 5000px; border:1px; border-style: solid; border-color: #a2bae7;"><span id="editgrid"></span></div>
+<!--
<div class="guide" style="position: absolute; left: 2500px; top: 0px; width: 320px; height: 460px;"></div>
<div class="guide" style="position: absolute; left: 2500px; top: 0px; width: 480px; height: 300px;"></div>
<div class="guide" style="position: absolute; left: 2500px; top: 0px; width: 768px; height: 911px;"></div>
<div class="guide" style="position: absolute; left: 2500px; top: 0px; width: 1024px; height: 655px;"></div>
+-->
-<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: 30px;"><h2>Header2</h2></span>
-<span class="section" id="palette:section" style="position: absolute; left: 0px; top: 60px; width: 200px;"><span class="section">section</span></span>
-<span class="button" id="palette:button" style="position: absolute; left: 0px; top: 90px;"><input type="button" value="button" class="graybutton"/></span>
-<span class="entry" id="palette:entry" style="position: absolute; left: 0px; top: 120px;"><input type="text" value="field" size="20" autocapitalize="off"/></span>
-<span class="password" id="palette:password" style="position: absolute; left: 0px; top: 150px;"><input type="password" value="password" size="20"/></span>
-<span class="checkbox" id="palette:checkbox" style="position: absolute; left: 0px; top: 180px;"><input type="checkbox" value="checkbox"/><span>checkbox</span></span>
-<span class="select" id="palette:select" style="position: absolute; left: 0px; top: 210px;"><select><option value="select">select</option></select></span>
-<span class="list" id="palette:list" style="position: absolute; left: 0px; top: 240px; width: 200px;">
-<table class="datatable" style="width: 200px;"><tr><td class="datatd">list</td></tr><tr><td class="datatd">...</td></tr></table>
+<span class="h1" id="palette:h1" style="position: absolute; left: 0px; top: 0px;"><h1>Header Level 1</h1></span>
+<span class="h2" id="palette:h2" style="position: absolute; left: 0px; top: 30px;"><h2>Header Level 2</h2></span>
+<span class="section" id="palette:section" style="position: absolute; left: 0px; top: 60px; width: 220px;"><span class="Section">Section</span></span>
+<span class="text" id="palette:text" style="position: absolute; left: 0px; top: 90px;"><span>Some text</span></span>
+<span class="link" id="palette:link" style="position: absolute; left: 80px; top: 90px;"><a href="/"><span>Link</span></a></span>
+<span class="button" id="palette:graybutton" style="position: absolute; left: 0px; top: 120px;"><input type="button" value="Button" class="graybutton"/></span>
+<span class="button" id="palette:bluebutton" style="position: absolute; left: 80px; top: 120px;"><input type="button" value="Button" class="graybutton bluebutton"/></span>
+<span class="button" id="palette:redbutton" style="position: absolute; left: 160px; top: 120px;"><input type="button" value="Button" class="graybutton redbutton"/></span>
+<span class="entry" id="palette:entry" style="position: absolute; left: 0px; top: 160px;"><input type="text" value="Entry Field" class="flatentry" size="20" autocapitalize="off"/></span>
+<span class="password" id="palette:password" style="position: absolute; left: 0px; top: 190px;"><input type="password" value="Password" class="flatentry" size="20"/></span>
+<span class="checkbox" id="palette:checkbox" style="position: absolute; left: 0px; top: 220px;"><input type="checkbox" value="Checkbox" class="flatcheckbox"/><span>Checkbox</span></span>
+<!--
+<span class="select" id="palette:select" style="position: absolute; left: 80px; top: 220px;"><select><option value="select">Selection</option></select></span>
+-->
+<span class="list" id="palette:list" style="position: absolute; left: 0px; top: 250px; width: 220px;">
+<table class="datatable" style="width: 220px;">
+<tr><td class="datatd">List</td></tr>
+<tr><td class="datatd">List</td></tr>
+<tr><td class="datatd">List</td></tr>
+</table>
</span>
-<span class="table" id="palette:table" style="position: absolute; left: 0px; top: 290px; width: 200px;">
-<table class="datatable" style="width: 200px;"><tr><td class="datatdl">table</td><td class="datatdr">...</td></tr><tr><td class="datatdl">...</td><td class="datatdr">...</td></tr></table>
+<span class="table" id="palette:table" style="position: absolute; left: 0px; top: 320px; width: 220px;">
+<table class="datatable" style="width: 220px;">
+<tr><td class="datatdl">Table</td><td class="datatdr">Table</td></tr>
+<tr><td class="datatdl">Table</td><td class="datatdr">Table</td></tr>
+<tr><td class="datatdl">Table</td><td class="datatdr">Table</td></tr>
+</table>
</span>
-<span class="link" id="palette:link" style="position: absolute; left: 0px; top: 340px;"><a href="/"><span>link</span></a></span>
-<span class="text" id="palette:text" style="position: absolute; left: 0px; top: 370px;"><span>text</span></span>
-<span class="iframe fakeframe" id="palette:iframe" style="position: absolute; left: 0px; top: 400px; width: 200px;"><a href="/public/iframe-min.html"><span class="fakeframe"><span>frame ...</span></span></a></span>
-<span class="img" id="palette:img" style="position: absolute; left: 0px; top: 430px;"><img id="imgimg"/></span>
+<!--
+<span class="iframe fakeframe" id="palette:iframe" style="position: absolute; left: 0px; top: 380px; width: 200px;"><a href="/public/iframe-min.html"><span class="fakeframe"><span>Frame ...</span></span></a></span>
+-->
+<span class="img" id="palette:img" style="position: absolute; left: 0px; top: 410px;"><img id="imgimg"/></span>
</div>
<div id="playdiv" style="visibility: hidden; position: absolute; top: 0px; left: 0px; width: 2500px; height: 5000px;">
@@ -106,48 +90,39 @@ function applink(appname) {
// Set page titles
document.title = ui.windowtitle(location.hostname) + ' - Page - ' + appname;
-$('appNameHeader').innerHTML = '<a href=\"/' + appname + '/\" target=\"' + '_blank' + '\">' + appname + '</a>';
+
+// Set header div
+$('viewhead').innerHTML = '<span id="appTitle" class="cmenu">' + appname + '</span>' +
+'<input type="button" id="deleteWidgetButton" title="Delete a Widget" class="graybutton redbutton plusminus" style="position: absolute; top: 4px; left: 5px;" disabled="true" value="-"/>' +
+'<span style="position: absolute; top: 0px; left: 45px; right: 115px; padding: 0px; background: transparent;"><input id="widgetValue" type="text" value="" class="flatentry" title="Widget value" autocapitalize="off" placeholder="Value" style="position: absolute; left: 0px; top: 4px; width: 100%; visibility: hidden;" readonly="readonly"/></span>' +
+'<input type="button" id="playPageButton" title="View page" class="graybutton plusminus" style="position: absolute; top: 4px; right: 75px;" value=">"/>' +
+'<input type="button" id="copyWidgetButton" title="Copy a Widget" class="graybutton bluebutton" style="position: absolute; top: 4px; right: 40px; font-size: 16px;" disabled="true" value="C"/>' +
+'<input type="button" id="addWidgetButton" title="Add a Widget" class="graybutton bluebutton plusminus" style="position: absolute; top: 4px; right: 5px;" disabled="true" value="+"/>';
+
+/**
+ * Track the current page, author, and saved XHTML content.
+ */
+var author = '';
+var editable = false;
+var savedpagexhtml = '';
/**
* Page editor area, widget value field, add, delete and play page buttons.
*/
var cdiv = $('contentdiv');
-var ediv = $('editdiv');
+var pagediv = $('pagediv');
var evisible = true;
var pdiv = $('playdiv');
-var wvalue = $('widgetValue');
var wadd = $('addWidgetButton');
var wdelete = $('deleteWidgetButton');
var wcopy = $('copyWidgetButton');
+var wvalue = $('widgetValue');
+var atitle = $('appTitle');
var pplay = $('playPageButton');
// Set images
-$('editgrid').parentNode.style.background = 'url(\'' + ui.b64img(appcache.get('/public/grid72.b64')) + '\')';
$('imgimg').src = ui.b64img(appcache.get('/public/img.b64'));
-// Position edit and play divs inside the content div
-ediv.style.position = 'absolute';
-ediv.style.top = cdiv.offsetTop + 'px';
-pdiv.style.position = 'absolute';
-pdiv.style.top = cdiv.offsetTop + 'px';
-
-// Position background divs
-var wvbackground = $('widgetValueBackground');
-var wvtable = $('widgetValueTable');
-wvbackground.style.top = ui.pixpos(wvtable.offsetTop);
-
-/**
- * Adjust widget value field size.
- */
-function resizeFields() {
- wvalue.style.width = '0px';
- wvalue.style.width = ui.pixpos(wvalue.parentNode.clientWidth - 18);
- return true;
-}
-
-resizeFields();
-window.onresize = resizeFields;
-
// Init component references
var editWidget = sca.component('EditWidget');
var pages = sca.reference(editWidget, 'pages');
@@ -163,57 +138,75 @@ var page = {};
page.palcx = 2500;
/**
- * Init a page editor. Works with all browsers except IE.
+ * Init a page editor.
*/
-page.edit = function(elem, wvalue, wadd, wcopy, wdelete, onchange, onselect) {
+page.mkedit = function(pagediv, atitle, wvalue, wadd, wcopy, wdelete, onchange, onselect) {
// Track element dragging and selection
page.dragging = null;
page.selected = null;
- wvalue.disabled = true;
+ wvalue.readOnly = true;
wvalue.style.visibility = 'hidden';
+ atitle.style.visibility = 'visible';
+ page.mousemoved = false;
wcopy.disabled = true;
wdelete.disabled = true;
+ wadd.disabled = !editable;
// Trigger widget select and page change events
page.onpagechange = onchange;
- page.onwidgetselect = onselect;
+ page.onselectwidget = onselect;
/**
* Handle a mouse down event.
*/
- elem.onmousedown = function(e) {
-
- // On mouse controlled devices, engage the click component selection
- // logic right away
- if (typeof e.touches == 'undefined')
- elem.onclick(e);
+ function onmousedown(e) {
+ // On mouse controlled devices, run component selection logic right away
+ var selected = page.selected;
+ if (typeof e.touches == 'undefined') {
+ //debug('onmousedown-click');
+ onclick(e);
+ }
// Find a draggable element
- var dragging = page.draggable(e.target, elem);
+ var dragging = page.draggable(e.target, pagediv);
if (dragging == null || dragging != page.selected)
return true;
page.dragging = dragging;
// Remember mouse position
var pos = typeof e.touches != "undefined"? e.touches[0] : e;
+ page.mousemoved = false;
page.dragX = pos.screenX;
page.dragY = pos.screenY;
+ page.moveX = pos.screenX;
+ page.moveY = pos.screenY;
+ // Prevent default behavior on first click on a widget
if (e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
+
return true;
- };
+ }
- // Support touch devices
- elem.ontouchstart = elem.onmousedown;
+ if (!ui.isMobile()) {
+ pagediv.onmousedown = function(e) {
+ //debug('onmousedown');
+ return onmousedown(e);
+ };
+ } else {
+ pagediv.ontouchstart = function(e) {
+ //debug('ontouchstart');
+ return onmousedown(e);
+ };
+ }
/**
* Handle a mouse up event.
*/
- elem.onmouseup = function(e) {
+ function onmouseup(e) {
if (page.dragging == null)
return true;
@@ -222,87 +215,123 @@ page.edit = function(elem, wvalue, wadd,
var newY = page.gridsnap(ui.numpos(page.dragging.style.top));
page.dragging.style.left = ui.pixpos(newX);
page.dragging.style.top = ui.pixpos(newY);
- page.dragging.cover.style.left = ui.pixpos(newX);
- page.dragging.cover.style.top = ui.pixpos(newY);
// Fixup widget style
- page.fixupwidget(page.dragging);
+ page.initwidget(page.dragging);
// Forget dragged element
page.dragging = null;
// Trigger page change event
page.onpagechange(false);
+
+ // Simulate onclick event
+ onclick(e);
+
return true;
- };
+ }
- // Support touch devices
- elem.ontouchend = elem.onmouseup;
+ if (!ui.isMobile()) {
+ pagediv.onmouseup = function(e) {
+ //debug('onmouseup');
+ return onmouseup(e);
+ };
+ } else {
+ pagediv.ontouchend = function(e) {
+ //debug('ontouchend');
+ return onmouseup(e);
+ }
+ }
/**
* Handle a mouse move event.
*/
- window.onmousemove = function(e) {
+ function onmousemove(e) {
+
+ // Track mouse moves
+ page.mousemoved = true;
+
if (page.dragging == null)
return true;
- // Get the mouse position
- var pos = typeof e.touches != "undefined"? e.touches[0] : e;
- if (pos.screenX == page.dragX && pos.screenY == page.dragY)
+ // Ignore duplicate mouse move events
+ if (page.moveX == page.dragX && page.moveY == page.dragY)
return true;
// Compute position of dragged element
var curX = ui.numpos(page.dragging.style.left);
var curY = ui.numpos(page.dragging.style.top);
- var newX = curX + (pos.screenX - page.dragX);
- var newY = curY + (pos.screenY - page.dragY);
+ var newX = curX + (page.moveX - page.dragX);
+ var newY = curY + (page.moveY - page.dragY);
if (newX >= page.palcx)
- page.dragX = pos.screenX;
+ page.dragX = page.moveX;
else
newX = page.palcx;
if (newY >= 0)
- page.dragY = pos.screenY;
+ page.dragY = page.moveY;
else
newY = 0;
// Move the dragged element
page.dragging.style.left = ui.pixpos(newX);
page.dragging.style.top = ui.pixpos(newY);
- page.dragging.cover.style.left = ui.pixpos(newX);
- page.dragging.cover.style.top = ui.pixpos(newY);
+ page.constrainwidget(page.dragging);
+
return true;
- };
+ }
+
+ if (!ui.isMobile()) {
+ window.onmousemove = function(e) {
- // Support touch devices
- elem.ontouchmove = window.onmousemove;
+ // Remember mouse position
+ page.moveX = e.screenX;
+ page.moveY = e.screenY;
+
+ return onmousemove(e);
+ };
+ } else {
+ pagediv.ontouchmove = function(e) {
+
+ // Remember touch position
+ var pos = e.touches[0];
+ if (page.moveX == pos.screenX && page.moveY == pos.screenY)
+ return true;
+ page.moveX = pos.screenX;
+ page.moveY = pos.screenY;
+ if (page.moveX == page.dragX && page.moveY == page.dragY)
+ return true;
+
+ onmousemove(e);
+ };
+ }
/**
* Handle a mouse click event.
*/
- elem.onclick = function(e) {
+ function onclick(e) {
// Find selected element
- var selected = page.draggable(e.target, elem);
+ var selected = page.draggable(e.target, pagediv);
if (selected == null) {
if (page.selected != null) {
// Reset current selection
- page.widgetselect(page.selected, false, wvalue, wcopy, wdelete);
+ page.selectwidget(page.selected, false, atitle, wvalue, wcopy, wdelete);
page.selected = null;
// Trigger widget select event
- page.onwidgetselect(null);
+ page.onselectwidget(null);
}
// Dismiss the palette
- if (ui.numpos(elem.style.left) != (page.palcx * -1))
- elem.style.left = ui.pixpos(page.palcx * -1);
+ if (ui.numpos(pagediv.style.left) != (page.palcx * -1))
+ pagediv.style.left = ui.pixpos(page.palcx * -1);
return true;
}
// Deselect the previously selected element
- page.widgetselect(page.selected, false, wvalue, wcopy, wdelete);
+ page.selectwidget(page.selected, false, atitle, wvalue, wcopy, wdelete);
// Clone element dragged from palette
if (selected.id.substring(0, 8) == 'palette:') {
@@ -310,8 +339,9 @@ page.edit = function(elem, wvalue, wadd,
// Move into the editing area and hide the palette
page.selected.style.left = ui.pixpos(ui.numpos(page.selected.style.left) + page.palcx);
- page.selected.cover.style.left = ui.pixpos(ui.numpos(page.selected.cover.style.left) + page.palcx);
- elem.style.left = ui.pixpos(page.palcx * -1);
+ page.initwidget(page.selected);
+ pagediv.style.left = ui.pixpos(page.palcx * -1);
+ page.constrainwidget(page.selected);
// Bring it to the top
page.bringtotop(page.selected);
@@ -319,21 +349,40 @@ page.edit = function(elem, wvalue, wadd,
// Trigger page change event
page.onpagechange(true);
- } else {
+ // Select the element
+ page.selectwidget(page.selected, true, atitle, wvalue, wcopy, wdelete);
+
+ // Trigger widget select event
+ page.onselectwidget(page.selected);
+
+ return true;
- // Bring selected element to the top
- page.selected = selected;
- page.bringtotop(page.selected);
}
+ // Bring selected element to the top
+ page.selected = selected;
+ page.bringtotop(page.selected);
+
// Select the element
- page.widgetselect(page.selected, true, wvalue, wcopy, wdelete);
+ page.selectwidget(page.selected, true, atitle, wvalue, wcopy, wdelete);
// Trigger widget select event
- page.onwidgetselect(page.selected);
+ page.onselectwidget(page.selected);
return true;
- };
+ }
+
+ if (!ui.isMobile()) {
+ pagediv.onclick = function(e) {
+ //debug('onclick');
+ return onclick(e);
+ };
+ } else {
+ pagediv.onclick = function(e) {
+ //debug('onclick');
+ return onclick(e);
+ };
+ }
/**
* Handle field on change events.
@@ -342,8 +391,6 @@ page.edit = function(elem, wvalue, wadd,
if (page.selected == null)
return false;
page.settext(page.selected, wvalue.value);
- page.selected.cover.style.width = ui.pixpos(page.selected.clientWidth + 4);
- page.selected.cover.style.height = ui.pixpos(page.selected.clientHeight + 4);
// Trigger page change event
page.onpagechange(true);
@@ -354,7 +401,7 @@ page.edit = function(elem, wvalue, wadd,
wadd.onclick = function() {
// Show the palette
- elem.style.left = ui.pixpos(0);
+ pagediv.style.left = ui.pixpos(0);
return false;
};
@@ -364,15 +411,14 @@ page.edit = function(elem, wvalue, wadd,
return false;
// Reset current selection
- page.widgetselect(page.selected, false, wvalue, wcopy, wdelete);
+ page.selectwidget(page.selected, false, atitle, wvalue, wcopy, wdelete);
// Remove selected widget
page.selected.parentNode.removeChild(page.selected);
- page.selected.cover.parentNode.removeChild(page.selected.cover);
page.selected = null;
// Trigger widget select event
- page.onwidgetselect(null);
+ page.onselectwidget(null);
// Trigger page change event
page.onpagechange(true);
@@ -387,7 +433,7 @@ page.edit = function(elem, wvalue, wadd,
return false;
// Reset current selection
- page.widgetselect(page.selected, false, wvalue, wcopy, wdelete);
+ page.selectwidget(page.selected, false, atitle, wvalue, wcopy, wdelete);
// Clone selected widget
page.selected = page.clone(page.selected);
@@ -395,28 +441,23 @@ page.edit = function(elem, wvalue, wadd,
// Move 10 pixels down right
page.selected.style.left = ui.pixpos(ui.numpos(page.selected.style.left) + 10);
page.selected.style.top = ui.pixpos(ui.numpos(page.selected.style.top) + 10);
- page.selected.cover.style.left = ui.pixpos(ui.numpos(page.selected.cover.style.left) + 10);
- page.selected.cover.style.top = ui.pixpos(ui.numpos(page.selected.cover.style.top) + 10);
+ page.constrainwidget(page.selected);
// Bring it to the top
page.bringtotop(page.selected);
// Select the element
- page.widgetselect(page.selected, true, wvalue, wcopy, wdelete);
+ page.selectwidget(page.selected, true, atitle, wvalue, wcopy, wdelete);
// Trigger widget select event
- page.onwidgetselect(page.selected);
+ page.onselectwidget(page.selected);
// Trigger page change event
page.onpagechange(true);
return false;
};
- // Cover child elements with span elements to prevent
- // any input events to reach them
- map(page.cover, nodeList(elem.childNodes));
-
- return elem;
+ return pagediv;
};
/**
@@ -443,10 +484,12 @@ page.text = function(e) {
var t = car(childElements(e)).defaultValue;
return t == f? '' : t;
}
+ /*
if (e.className == 'select') {
var t = car(childElements(car(childElements(e)))).value;
return t == f? '' : t;
}
+ */
if (e.className == 'link') {
var lhr = car(childElements(e)).href;
var hr = lhr.substring(0, 5) == 'link:'? lhr.substring(5) : '';
@@ -457,10 +500,12 @@ page.text = function(e) {
var src = car(childElements(e)).src;
return src == location.href? '' : src;
}
+ /*
if (e.className == 'iframe') {
var hr = car(childElements(e)).href;
return hr == location.href? '' : hr;
}
+ */
if (e.className == 'list')
return '';
if (e.className == 'table')
@@ -483,14 +528,18 @@ page.hastext = function(e) {
return true;
if (e.className == 'entry' || e.className == 'password')
return true;
+ /*
if (e.className == 'select')
return false;
+ */
if (e.className == 'link')
return true;
if (e.className == 'img')
return true;
+ /*
if (e.className == 'iframe')
return true;
+ */
if (e.className == 'list')
return false;
if (e.className == 'table')
@@ -521,7 +570,11 @@ page.settext = function(e, t) {
car(childElements(e)).innerHTML = isNil(c)? f : car(c);
return t;
}
- if (e.className == 'button' || e.className == 'entry' || e.className == 'password') {
+ if (e.className == 'button') {
+ car(childElements(e)).value = isNil(c)? f : car(c);
+ return t;
+ }
+ if (e.className == 'entry' || e.className == 'password') {
car(childElements(e)).defaultValue = isNil(c)? f : car(c);
return t;
}
@@ -530,12 +583,14 @@ page.settext = function(e, t) {
map(function(n) { if (n.nodeName == "SPAN") n.innerHTML = isNil(c)? f : car(c); return n; }, nodeList(e.childNodes));
return t;
}
+ /*
if (e.className == 'select') {
var ce = car(childElements(car(childElements(e))));
ce.value = isNil(c)? f : car(c);
ce.innerHTML = isNil(c)? f : car(c);
return t;
}
+ */
if (e.className == 'list') {
e.innerHTML = '<table class="datatable" style="width: 100%;;"><tr><td class="datatd">' + (isNil(c)? f : car(c)) + '</td></tr><tr><td class="datatd">...</td></tr></table>';
return t;
@@ -554,34 +609,48 @@ page.settext = function(e, t) {
car(childElements(e)).src = isNil(c)? '/public/img.png' : car(c);
return t;
}
+ /*
if (e.className == 'iframe') {
car(childElements(e)).href = isNil(c)? '/public/iframe-min.html' : car(c);
return t;
}
+ */
return '';
};
/**
- * Initial fixup of a widget.
+ * Initialize a widget.
*/
-page.fixupwidget = function(e) {
+page.initwidget = function(e) {
+
+ // Add a Webkit transform to leverage hardware acceleration
+ e.style.setProperty('-webkit-transform', 'translate(0px, 0px)', null);
+
+ /*
if (e.className == 'iframe') {
var f = car(childElements(e));
//e.innerHTML = '<iframe src="' + f.href + '" frameborder="no" scrolling="no"></iframe>';
return e;
}
+ */
+
if (e.className == 'section') {
e.style.width = '100%';
return e;
}
- if (e.className == 'list') {
- e.style.width = '100%';
- car(childElements(e)).style.width = '100%';
+ if (e.className == 'text' || e.className == 'h1' || e.className == 'h2') {
return e;
}
- if (e.className == 'table') {
+ if (e.className == 'button') {
+ return e;
+ }
+ if (e.className == 'checkbox') {
+ return e;
+ }
+ if (e.className == 'list' || e.className == 'table') {
e.style.width = '100%';
- car(childElements(e)).style.width = '100%';
+ var t = car(childElements(e));
+ t.style.width = '100%';
return e;
}
if (e.className == 'img') {
@@ -590,6 +659,54 @@ page.fixupwidget = function(e) {
i.src = '/public/img.png';
return e;
}
+ if (e.className == 'entry' || e.className == 'password') {
+ var i = car(childElements(e));
+ i.readOnly = true;
+ i.style.cursor = 'default';
+ return e;
+ }
+ if (e.className == 'link') {
+ var l = car(childElements(e));
+ l.onclick = function(e) { return false; };
+ return e;
+ }
+ return e;
+}
+
+/**
+ * Enforce widget position and style constraints.
+ */
+page.constrainwidget = function(e) {
+ if (e.className == 'section' || e.className == 'list' || e.className == 'table') {
+ e.style.left = ui.pixpos(page.palcx);
+ return e;
+ }
+ return e;
+};
+
+/**
+ * Cleanup of a widget before saving it.
+ */
+page.cleanupwidget = function(e) {
+ //debug('cleanupwidget', e);
+
+ // Clear outline
+ e.style.outline = null;
+
+ // Clear the Webkit transform
+ e.style.removeProperty('-webkit-transform');
+
+ if (e.className == 'entry' || e.className == 'password') {
+ var i = car(childElements(e));
+ i.readOnly = false;
+ i.style.cursor = null;
+ return e;
+ }
+ if (e.className == 'link') {
+ var l = car(childElements(e));
+ l.onclick = null;
+ return e;
+ }
return e;
}
@@ -599,10 +716,8 @@ page.fixupwidget = function(e) {
page.draggable = function(n, e) {
if (n == e)
return null;
- if (n.id != '')
+ if (!isNil(n.id) && n.id != '')
return n;
- if (n.covered)
- return n.covered;
return page.draggable(n.parentNode, e);
}
@@ -618,65 +733,44 @@ page.gridsnap = function(x) {
*/
page.bringtotop = function(n) {
n.parentNode.appendChild(n);
- n.cover.parentNode.appendChild(n.cover);
}
/**
- * Draw widget selection.
+ * Select a widget.
*/
-page.widgetselect = function(n, s, wvalue, wcopy, wdelete) {
+page.selectwidget = function(n, s, atitle, wvalue, wcopy, wdelete) {
+ //debug('selectwidget', n, s);
if (isNil(n) || !s) {
// Clear the widget value field
wvalue.value = '';
- wvalue.disabled = true;
+ wvalue.readOnly = true;
wvalue.style.visibility = 'hidden';
+ atitle.style.visibility = 'visible';
wcopy.disabled = true;
wdelete.disabled = true;
// Clear the widget outline
if (!isNil(n))
- n.cover.style.borderWidth = '0px';
+ n.style.outline = null;
+
return true;
}
+ // Outline the widget
+ n.style.outline = '2px solid #598edd';
+
// Update the widget value field
wvalue.value = page.text(n);
- wvalue.disabled = false;
+ wvalue.readOnly = false || !editable;
wvalue.style.visibility = 'visible';
- wcopy.disabled = false;
- wdelete.disabled = false;
+ atitle.style.visibility = 'hidden';
+ wcopy.disabled = false || !editable;
+ wdelete.disabled = false || !editable;
- // Outline the widget
- n.cover.style.borderWidth = '2px';
return true;
};
/**
- * Cover a page element with a <span> element to prevent
- * any input events to reach it.
- */
-page.cover = function(e) {
- if (e.id == '' || isNil(e.style))
- return e;
- var cover = document.createElement('div');
- cover.style.position = 'absolute';
- cover.style.left = ui.pixpos(ui.numpos(e.style.left) - 2);
- cover.style.top = ui.pixpos(ui.numpos(e.style.top) - 2);
- cover.style.width = ui.pixpos(e.clientWidth + 4);
- cover.style.height = ui.pixpos(e.clientHeight + 4);
- cover.style.visibility = 'inherit';
- cover.style.borderStyle = 'solid';
- cover.style.borderWidth = '0px';
- cover.style.borderColor = '#598edd';
- cover.style.padding = '0px';
- cover.style.margin = '0px';
- cover.covered = e;
- e.cover = cover;
- e.parentNode.appendChild(cover);
- return e;
-}
-
-/**
* Clone a palette element.
*/
page.clone = function(e) {
@@ -695,7 +789,7 @@ page.clone = function(e) {
ne.innerHTML = e.innerHTML;
// Fixup the widget style
- page.fixupwidget(ne);
+ page.initwidget(ne);
return ne;
}
@@ -708,7 +802,6 @@ page.clone = function(e) {
ne.style.left = ui.pixpos(ui.numpos(e.style.left));
ne.style.top = ui.pixpos(ui.numpos(e.style.top));
e.parentNode.appendChild(ne);
- page.cover(ne);
return ne;
}
@@ -716,24 +809,6 @@ page.clone = function(e) {
};
/**
- * Return the page in an ATOM entry.
- */
-function atompage(doc) {
- var entry = atom.readATOMEntry(mklist(doc));
- if (isNil(entry))
- return mklist();
- var content = namedElementChild("'content", car(entry));
- if (content == null)
- return mklist();
- return elementChildren(content);
-}
-
-/**
- * Track the current page saved XHTML content.
- */
-var savedpagexhtml = '';
-
-/**
* Track the current widget.
*/
var widget = null;
@@ -741,7 +816,7 @@ var widget = null;
/**
* Get and display an app page.
*/
-function getpage(name, ediv) {
+function getpage(name, pagediv) {
if (isNil(name))
return false;
showStatus('Loading');
@@ -750,16 +825,15 @@ function getpage(name, ediv) {
// Stop now if we didn't get a page
if (doc == null) {
- showStatus('No data');
+ showError('App not available');
return false;
}
- showStatus(defaultStatus());
- // Convert the page to XHTML and place it in a hidden buffer
+ // Get the page from the ATOM entry, convert it to XHTML and place it in a hidden buffer
+ var pageentry = car(atom.readATOMEntry(mklist(doc)));
+ var content = namedElementChild("'content", pageentry);
+ var el = isNil(content)? mklist() : elementChildren(content);
var buffer = $('buffer');
- var el = atompage(doc);
-
- // Create a default empty page if necessary
if (isNil(el))
buffer.innerHTML = '<div id="page"></div>';
else
@@ -773,21 +847,29 @@ function getpage(name, ediv) {
if (x < 0 || ui.numpos(e.style.top) < 0)
return false;
return true;
- }, nodeList(ediv.childNodes));
+ }, nodeList(pagediv.childNodes));
map(function(e) {
- ediv.removeChild(e);
+ pagediv.removeChild(e);
}, fnodes);
// Append new page nodes to editor
map(function(e) {
- ediv.appendChild(e);
+ pagediv.appendChild(e);
if (!isNil(e.style))
e.style.left = ui.pixpos(ui.numpos(e.style.left) + 2500);
- return page.cover(e);
+ page.initwidget(e);
+ return e;
}, nodeList(buffer.childNodes[0].childNodes));
- savedpagexhtml = pagexhtml(ediv);
+ savedpagexhtml = pagexhtml(pagediv);
+
+ // Enable author to edit the page
+ author = elementValue(namedElementChild("'author", pageentry));
+ editable = author == username;
+ wadd.disabled = !editable;
+ showStatus(editable? defaultStatus() : 'Read only');
+
return true;
});
}
@@ -797,13 +879,13 @@ function getpage(name, ediv) {
*/
wadd.onclick = function(e) {
// Show the widget palette
- ediv.style.left = ui.pixpos(0);
+ pagediv.style.left = ui.pixpos(0);
};
/**
* Return the current page XHTML content.
*/
-function pagexhtml(ediv) {
+function pagexhtml(pagediv) {
// Copy page DOM to hidden buffer
var buffer = $('buffer');
@@ -811,7 +893,7 @@ function pagexhtml(ediv) {
var div = buffer.childNodes[0];
// Capture the nodes inside the page div
- div.innerHTML = ediv.innerHTML;
+ div.innerHTML = pagediv.innerHTML;
var nodes = nodeList(div.childNodes);
map(function(e) {
div.removeChild(e);
@@ -830,10 +912,11 @@ function pagexhtml(ediv) {
return true;
}, nodes);
- // Reposition nodes
+ // Reposition and cleanup nodes
map(function(e) {
var x = ui.numpos(e.style.left) - 2500;
e.style.left = ui.pixpos(x);
+ page.cleanupwidget(e);
return e;
}, fnodes);
@@ -873,8 +956,8 @@ function save(newxml) {
// Update the page ATOM entry
var entry = '<?xml version="1.0" encoding="UTF-8"?>\n' + '<entry xmlns="http://www.w3.org/2005/Atom">' +
- '<title type="text">' + appname + '</title><id>' + appname + '</id><content type="application/xml">' +
- newxml + '</content></entry>';
+ '<title type="text">' + appname + '</title><id>' + appname + '</id><author><email>' + author + '</email></author>' +
+ '<content type="application/xml">' + newxml + '</content></entry>';
pages.put(appname, entry, function(e) {
if (e) {
@@ -891,7 +974,10 @@ function save(newxml) {
* Handle a page change event
*/
function onpagechange(prop) {
- var newxml = pagexhtml(ediv);
+ if (!editable)
+ return false;
+
+ var newxml = pagexhtml(pagediv);
if (savedpagexhtml == newxml)
return false;
showStatus('Modified');
@@ -914,17 +1000,10 @@ function onpagechange(prop) {
/**
* Handle a widget select event.
*/
-function onwidgetselect(w) {
+function onselectwidget(w) {
if (w == widget)
return true;
widget = w;
-
- function updateButton(b, v) {
- b.style.color = v? '#000000' : '#808080';
- }
-
- updateButton(wdelete, !isNil(w));
- updateButton(wcopy, !isNil(w));
return true;
}
@@ -934,31 +1013,30 @@ function onwidgetselect(w) {
function playpage() {
if (!evisible)
return true;
- page.widgetselect(widget, false, wvalue, wcopy, wdelete);
+ page.selectwidget(widget, false, atitle, wvalue, wcopy, wdelete);
page.selected = null;
- wvalue.value = applink(appname);
- pplay.innerHTML = '<';
+ pplay.value = '<';
evisible = false;
pdiv.style.visibility = 'visible';
pdiv.innerHTML = '';
pdiv.innerHTML = '<iframe id="playappframe" style="position: relative; height: 5000px; width: 2500px; border: 0px;" scrolling="no" frameborder="0" src="/' +
appname + '"></iframe>';
setTimeout(function() {
- ediv.style.visibility = 'hidden'
+ pagediv.style.visibility = 'hidden'
}, 0);
return true;
}
/**
- * Show the page editor.
+ * Show the page editor.
*/
function showedit() {
if (evisible)
return true;
- pplay.innerHTML = '>';
- ediv.style.visibility = 'visible'
+ pplay.value = '>';
+ pagediv.style.visibility = 'visible'
evisible = true;
- page.widgetselect(widget, true, wvalue, wcopy, wdelete);
+ page.selectwidget(widget, true, atitle, wvalue, wcopy, wdelete);
page.selected = widget;
setTimeout(function() {
pdiv.style.visibility = 'hidden';
@@ -977,10 +1055,10 @@ pplay.onclick = function() {
}
// Initialize the page editor
-page.edit(ediv, wvalue, wadd, wcopy, wdelete, onpagechange, onwidgetselect);
+page.mkedit(pagediv, atitle, wvalue, wadd, wcopy, wdelete, onpagechange, onselectwidget);
// Get and display the current app page
-getpage(appname, ediv);
+getpage(appname, pagediv);
</script>
Copied: tuscany/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html (from r1343140, tuscany/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html)
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html?p2=tuscany/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html&p1=tuscany/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html&r1=1343140&r2=1343316&rev=1343316&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/proxy/public/oops/index.html Mon May 28 16:49:36 2012
@@ -23,7 +23,7 @@
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
-<base href="/public/oops/"/>
+<base href="/proxy/public/oops/"/>
<script type="text/javascript">
window.appcache = {};
@@ -36,26 +36,29 @@ appcache.get = function(uri) {
var u = h == -1? uri : uri.substring(0, h);
// Get resource from local storage first
- var item = localStorage.getItem(u);
+ var ls = window.lstorage || localStorage;
+ var item = null;
+ try { item = ls.getItem(u); } catch(e) {}
if (item != null && item != '')
return item;
// Get resource from network
var http = new XMLHttpRequest();
http.open("GET", u, false);
+ http.setRequestHeader("Accept", "*/*");
http.send(null);
if (http.status == 200) {
if (http.getResponseHeader("X-Login") != null) {
- if (log) log('http error', u, 'X-Login');
+ if (debug) debug('http error', u, 'X-Login');
return null;
} else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
- if (log) log('http error', u, 'No-Content');
+ if (debug) debug('http error', u, 'No-Content');
return null;
}
- localStorage.setItem(u, http.responseText);
+ try { ls.setItem(u, http.responseText); } catch(e) {}
return http.responseText;
}
- if (log) log('http error', u, http.status, http.statusText);
+ if (debug) debug('http error', u, http.status, http.statusText);
return null;
};
@@ -63,46 +66,52 @@ appcache.get = function(uri) {
(function() {
var bootjs = document.createElement('script');
bootjs.type = 'text/javascript';
- bootjs.text = appcache.get('/all-min.js');
+ bootjs.text = appcache.get('/proxy/all-min.js');
document.head.appendChild(bootjs);
- document.head.appendChild(ui.declareCSS(appcache.get('/ui-min.css')));
+ document.head.appendChild(ui.declareCSS(appcache.get('/proxy/ui-min.css')));
})();
</script>
</head>
<body class="delayed" onload="onload();">
-<div id="bodydiv" class="mainbodydiv">
+<div id="mainbodydiv" class="mainbodydiv">
<div id="headdiv" class="hsection">
<script type="text/javascript">
(function() {
-$('headdiv').appendChild(ui.declareScript(appcache.get('/public/config-min.js')));
+$('headdiv').appendChild(ui.declareScript(appcache.get('/proxy/public/config-min.js')));
})();
</script>
</div>
-<div id="menu"></div>
+<div id="menubackground" class="tbarbackground fixed"></div>
+<div id="menu" class="tbarmenu fixed"></div>
-<div id="content" class="viewloaded3d">
+<div id="viewheadbackground" class="viewheadbackground fixed"></div>
+<div id="viewhead" class="viewhead fixed"></div>
-<table style="width: 100%;">
-<tr><td><h2><span id="h1"></span></h2></td></tr>
-</table>
+<div id="viewcontainer">
+<div id="view">
+<div id="viewcontent" class="viewcontent" style="margin-left: auto; margin-right: auto; text-align: center;">
-<div style="margin-left: auto; margin-right: auto; text-align: center;">
+<br/>
<div class="hd2">Oops, something went wrong...</div>
-</div>
</div>
+</div>
+</div>
<script type="text/javascript">
-// Set page title
-$('h1').innerHTML = ui.hometitle(location.hostname);
-
// Init div variables
var mdiv = $('menu');
-var cdiv = $('content');
+var hdiv = $('viewhead');
+$('viewcontainer').className = ui.isMobile()? 'viewcontainer3d' : 'viewcontainer3dm';
+$('view').className = ui.isMobile()? 'viewloaded3d' : 'viewloaded3dm';
+
+// Set page title
+document.title = ui.windowtitle(location.hostname) + ' - Oops';
+$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle + '</span>';
/**
* Build and show the menu bar.
@@ -114,7 +123,6 @@ function showmenu(mdiv) {
}
showmenu(mdiv);
-cdiv.style.top = ui.pixpos(mdiv.offsetTop + mdiv.offsetHeight);
/**
* Log the current user out.
@@ -122,9 +130,8 @@ cdiv.style.top = ui.pixpos(mdiv.offsetTo
function logout() {
// Clear session cookie and user-specific local storage entries
clearauthcookie();
- localStorage.removeItem('/r/EditWidget/accounts');
- localStorage.removeItem('/r/EditWidget/dashboards');
- //localStorage.clear();
+ lstorage.removeItem('/r/EditWidget/accounts');
+ lstorage.removeItem('/r/EditWidget/dashboards');
document.location = '/login/';
return true;
}
@@ -133,11 +140,12 @@ function logout() {
* Handle orientation change.
*/
document.body.onorientationchange = function(e) {
- //log('onorientationchange');
-
- // Scroll to the top and hide the address bar
- window.scrollTo(0, 0);
+ //debug('onorientationchange');
+ ui.onorientationchange(e);
+ // Resize menu and view header
+ mdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
+ hdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
return true;
};
@@ -145,13 +153,11 @@ document.body.onorientationchange = func
* Load post processing.
*/
function onload() {
- //log('onload');
+ //debug('onload');
+ ui.onload();
// Show the page
document.body.style.visibility = 'visible';
-
- // Scroll to the top and hide the address bar
- window.scrollTo(0, 0);
return true;
}
Added: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/config.js
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/config.js?rev=1343316&view=auto
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/public/config.js (added)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/public/config.js Mon May 28 16:49:36 2012
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+if (isNil(config))
+ config = {};
+
+/**
+ * UI configuration.
+ */
+config.windowtitle = 'App Builder'
+config.pagetitle = '<span style="font-weight: bold;">App Builder</span>';
+config.loginprompt = '<span>Sign in with your userid and password</span>';
+
Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html?rev=1343316&r1=1343315&r2=1343316&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notauth/index.html Mon May 28 16:49:36 2012
@@ -36,26 +36,29 @@ appcache.get = function(uri) {
var u = h == -1? uri : uri.substring(0, h);
// Get resource from local storage first
- var item = localStorage.getItem(u);
+ var ls = window.lstorage || localStorage;
+ var item = null;
+ try { item = ls.getItem(u); } catch(e) {}
if (item != null && item != '')
return item;
// Get resource from network
var http = new XMLHttpRequest();
http.open("GET", u, false);
+ http.setRequestHeader("Accept", "*/*");
http.send(null);
if (http.status == 200) {
if (http.getResponseHeader("X-Login") != null) {
- if (log) log('http error', u, 'X-Login');
+ if (debug) debug('http error', u, 'X-Login');
return null;
} else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
- if (log) log('http error', u, 'No-Content');
+ if (debug) debug('http error', u, 'No-Content');
return null;
}
- localStorage.setItem(u, http.responseText);
+ try { ls.setItem(u, http.responseText); } catch(e) {}
return http.responseText;
}
- if (log) log('http error', u, http.status, http.statusText);
+ if (debug) debug('http error', u, http.status, http.statusText);
return null;
};
@@ -71,7 +74,7 @@ appcache.get = function(uri) {
</script>
</head>
<body class="delayed" onload="onload();">
-<div id="bodydiv" class="mainbodydiv">
+<div id="mainbodydiv" class="mainbodydiv">
<div id="headdiv" class="hsection">
<script type="text/javascript">
@@ -81,28 +84,35 @@ $('headdiv').appendChild(ui.declareScrip
</script>
</div>
-<div id="menu"></div>
+<div id="menubackground" class="tbarbackground fixed"></div>
+<div id="menu" class="tbarmenu fixed"></div>
-<div id="content" class="viewloaded3d">
+<div id="viewheadbackground" class="viewheadbackground fixed"></div>
+<div id="viewhead" class="viewhead fixed"></div>
-<table style="width: 100%;">
-<tr><td><h2><span id="h1"></span></h2></td></tr>
-</table>
+<div id="viewcontainer">
+<div id="view">
+<div id="viewcontent" class="viewcontent" style="margin-left: auto; margin-right: auto; text-align: center;">
-<div style="margin-left: auto; margin-right: auto; text-align: center;">
+<br/>
<div class="hd2">Sorry, you're not authorized to view this page.</div>
-</div>
</div>
+</div>
+</div>
<script type="text/javascript">
-// Set page title
-$('h1').innerHTML = ui.hometitle(location.hostname);
-
// Init div variables
var mdiv = $('menu');
-var cdiv = $('content');
+var hdiv = $('viewhead');
+$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle + '</span>';
+$('viewcontainer').className = ui.isMobile()? 'viewcontainer3d' : 'viewcontainer3dm';
+$('view').className = ui.isMobile()? 'viewloaded3d' : 'viewloaded3dm';
+
+// Set page title
+document.title = ui.windowtitle(location.hostname) + ' - Sorry';
+$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle + '</span>';
/**
* Build and show the menu bar.
@@ -114,7 +124,6 @@ function showmenu(mdiv) {
}
showmenu(mdiv);
-cdiv.style.top = ui.pixpos(mdiv.offsetTop + mdiv.offsetHeight);
/**
* Log the current user out.
@@ -122,9 +131,8 @@ cdiv.style.top = ui.pixpos(mdiv.offsetTo
function logout() {
// Clear session cookie and user-specific local storage entries
clearauthcookie();
- localStorage.removeItem('/r/EditWidget/accounts');
- localStorage.removeItem('/r/EditWidget/dashboards');
- //localStorage.clear();
+ lstorage.removeItem('/r/EditWidget/accounts');
+ lstorage.removeItem('/r/EditWidget/dashboards');
document.location = '/login/';
return true;
}
@@ -133,10 +141,12 @@ function logout() {
* Handle orientation change.
*/
document.body.onorientationchange = function(e) {
- //log('onorientationchange');
+ //debug('onorientationchange');
+ ui.onorientationchange(e);
- // Scroll to the top and hide the address bar
- window.scrollTo(0, 0);
+ // Resize menu and view header
+ mdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
+ hdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
return true;
};
@@ -145,13 +155,11 @@ document.body.onorientationchange = func
* Load post processing.
*/
function onload() {
- //log('onload');
+ //debug('onload');
+ ui.onload();
// Show the page
document.body.style.visibility = 'visible';
-
- // Scroll to the top and hide the address bar
- window.scrollTo(0, 0);
return true;
}
Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html?rev=1343316&r1=1343315&r2=1343316&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notfound/index.html Mon May 28 16:49:36 2012
@@ -36,26 +36,29 @@ appcache.get = function(uri) {
var u = h == -1? uri : uri.substring(0, h);
// Get resource from local storage first
- var item = localStorage.getItem(u);
+ var ls = window.lstorage || localStorage;
+ var item = null;
+ try { item = ls.getItem(u); } catch(e) {}
if (item != null && item != '')
return item;
// Get resource from network
var http = new XMLHttpRequest();
http.open("GET", u, false);
+ http.setRequestHeader("Accept", "*/*");
http.send(null);
if (http.status == 200) {
if (http.getResponseHeader("X-Login") != null) {
- if (log) log('http error', u, 'X-Login');
+ if (debug) debug('http error', u, 'X-Login');
return null;
} else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
- if (log) log('http error', u, 'No-Content');
+ if (debug) debug('http error', u, 'No-Content');
return null;
}
- localStorage.setItem(u, http.responseText);
+ try { ls.setItem(u, http.responseText); } catch(e) {}
return http.responseText;
}
- if (log) log('http error', u, http.status, http.statusText);
+ if (debug) debug('http error', u, http.status, http.statusText);
return null;
};
@@ -71,7 +74,7 @@ appcache.get = function(uri) {
</script>
</head>
<body class="delayed" onload="onload();">
-<div id="bodydiv" class="mainbodydiv">
+<div id="mainbodydiv" class="mainbodydiv">
<div id="headdiv" class="hsection">
<script type="text/javascript">
@@ -81,29 +84,35 @@ $('headdiv').appendChild(ui.declareScrip
</script>
</div>
-<div id="menu"></div>
+<div id="menubackground" class="tbarbackground fixed"></div>
+<div id="menu" class="tbarmenu fixed"></div>
-<div id="content" class="viewloaded3d">
+<div id="viewheadbackground" class="viewheadbackground fixed"></div>
+<div id="viewhead" class="viewhead fixed"></div>
-<table style="width: 100%;">
-<tr><td><h2><span id="h1"></span></h2></td></tr>
-</table>
+<div id="viewcontainer">
+<div id="view">
+<div id="viewcontent" class="viewcontent" style="margin-left: auto; margin-right: auto; text-align: center;">
-<div style="margin-left: auto; margin-right: auto; text-align: center;">
+<br/>
<div class="hd2">Sorry, that page was not found.</div>
<div>You may have clicked an expired link or mistyped the address.</div>
-</div>
</div>
+</div>
+</div>
<script type="text/javascript">
-// Set page title
-$('h1').innerHTML = ui.hometitle(location.hostname);
-
// Init div variables
var mdiv = $('menu');
-var cdiv = $('content');
+var hdiv = $('viewhead');
+$('viewcontainer').className = ui.isMobile()? 'viewcontainer3d' : 'viewcontainer3dm';
+$('view').className = ui.isMobile()? 'viewloaded3d' : 'viewloaded3dm';
+
+// Set page title
+document.title = ui.windowtitle(location.hostname) + ' - Page not found';
+$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle + '</span>';
/**
* Build and show the menu bar.
@@ -115,7 +124,6 @@ function showmenu(mdiv) {
}
showmenu(mdiv);
-cdiv.style.top = ui.pixpos(mdiv.offsetTop + mdiv.offsetHeight);
/**
* Log the current user out.
@@ -123,9 +131,8 @@ cdiv.style.top = ui.pixpos(mdiv.offsetTo
function logout() {
// Clear session cookie and user-specific local storage entries
clearauthcookie();
- localStorage.removeItem('/r/EditWidget/accounts');
- localStorage.removeItem('/r/EditWidget/dashboards');
- //localStorage.clear();
+ lstorage.removeItem('/r/EditWidget/accounts');
+ lstorage.removeItem('/r/EditWidget/dashboards');
document.location = '/login/';
return true;
}
@@ -134,11 +141,12 @@ function logout() {
* Handle orientation change.
*/
document.body.onorientationchange = function(e) {
- //log('onorientationchange');
-
- // Scroll to the top and hide the address bar
- window.scrollTo(0, 0);
+ //debug('onorientationchange');
+ ui.onorientationchange(e);
+ // Resize menu and view header
+ mdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
+ hdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
return true;
};
@@ -146,13 +154,11 @@ document.body.onorientationchange = func
* Load post processing.
*/
function onload() {
- //log('onload');
+ //debug('onload');
+ ui.onload();
// Show the page
document.body.style.visibility = 'visible';
-
- // Scroll to the top and hide the address bar
- window.scrollTo(0, 0);
return true;
}
Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html?rev=1343316&r1=1343315&r2=1343316&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/public/notyet/index.html Mon May 28 16:49:36 2012
@@ -36,26 +36,29 @@ appcache.get = function(uri) {
var u = h == -1? uri : uri.substring(0, h);
// Get resource from local storage first
- var item = localStorage.getItem(u);
+ var ls = window.lstorage || localStorage;
+ var item = null;
+ try { item = ls.getItem(u); } catch(e) {}
if (item != null && item != '')
return item;
// Get resource from network
var http = new XMLHttpRequest();
http.open("GET", u, false);
+ http.setRequestHeader("Accept", "*/*");
http.send(null);
if (http.status == 200) {
if (http.getResponseHeader("X-Login") != null) {
- if (log) log('http error', u, 'X-Login');
+ if (debug) debug('http error', u, 'X-Login');
return null;
} else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
- if (log) log('http error', u, 'No-Content');
+ if (debug) debug('http error', u, 'No-Content');
return null;
}
- localStorage.setItem(u, http.responseText);
+ try { ls.setItem(u, http.responseText); } catch(e) {}
return http.responseText;
}
- if (log) log('http error', u, http.status, http.statusText);
+ if (debug) debug('http error', u, http.status, http.statusText);
return null;
};
@@ -71,7 +74,7 @@ appcache.get = function(uri) {
</script>
</head>
<body class="delayed" onload="onload();">
-<div id="bodydiv" class="mainbodydiv">
+<div id="mainbodydiv" class="mainbodydiv">
<div id="headdiv" class="hsection">
<script type="text/javascript">
@@ -81,29 +84,35 @@ $('headdiv').appendChild(ui.declareScrip
</script>
</div>
-<div id="menu"></div>
+<div id="menubackground" class="tbarbackground fixed"></div>
+<div id="menu" class="tbarmenu fixed"></div>
-<div id="content" class="viewloaded3d">
+<div id="viewheadbackground" class="viewheadbackground fixed"></div>
+<div id="viewhead" class="viewhead fixed"></div>
-<table style="width: 100%;">
-<tr><td><h2><span id="h1"></span></h2></td></tr>
-</table>
+<div id="viewcontainer">
+<div id="view">
+<div id="viewcontent" class="viewcontent" style="margin-left: auto; margin-right: auto; text-align: center;">
-<div style="margin-left: auto; margin-right: auto; text-align: center;">
+<br/>
<div class="hd2">Sorry, that page is still under construction.</div>
<div>Please check back later.</div>
-</div>
</div>
+</div>
+</div>
<script type="text/javascript">
-// Set page title
-$('h1').innerHTML = ui.hometitle(location.hostname);
-
// Init div variables
var mdiv = $('menu');
-var cdiv = $('content');
+var hdiv = $('viewhead');
+$('viewcontainer').className = ui.isMobile()? 'viewcontainer3d' : 'viewcontainer3dm';
+$('view').className = ui.isMobile()? 'viewloaded3d' : 'viewloaded3dm';
+
+// Set page title
+document.title = ui.windowtitle(location.hostname) + ' - Page not found';
+$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle + '</span>';
/**
* Build and show the menu bar.
@@ -115,7 +124,6 @@ function showmenu(mdiv) {
}
showmenu(mdiv);
-cdiv.style.top = ui.pixpos(mdiv.offsetTop + mdiv.offsetHeight);
/**
* Log the current user out.
@@ -123,9 +131,8 @@ cdiv.style.top = ui.pixpos(mdiv.offsetTo
function logout() {
// Clear session cookie and user-specific local storage entries
clearauthcookie();
- localStorage.removeItem('/r/EditWidget/accounts');
- localStorage.removeItem('/r/EditWidget/dashboards');
- //localStorage.clear();
+ lstorage.removeItem('/r/EditWidget/accounts');
+ lstorage.removeItem('/r/EditWidget/dashboards');
document.location = '/login/';
return true;
}
@@ -134,11 +141,12 @@ function logout() {
* Handle orientation change.
*/
document.body.onorientationchange = function(e) {
- //log('onorientationchange');
-
- // Scroll to the top and hide the address bar
- window.scrollTo(0, 0);
+ //debug('onorientationchange');
+ ui.onorientationchange(e);
+ // Resize menu and view header
+ mdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
+ hdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
return true;
};
@@ -146,13 +154,11 @@ document.body.onorientationchange = func
* Load post processing.
*/
function onload() {
- //log('onload');
+ //debug('onload');
+ ui.onload();
// Show the page
document.body.style.visibility = 'visible';
-
- // Scroll to the top and hide the address bar
- window.scrollTo(0, 0);
return true;
}
Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html?rev=1343316&r1=1343315&r2=1343316&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/public/oops/index.html Mon May 28 16:49:36 2012
@@ -36,26 +36,29 @@ appcache.get = function(uri) {
var u = h == -1? uri : uri.substring(0, h);
// Get resource from local storage first
- var item = localStorage.getItem(u);
+ var ls = window.lstorage || localStorage;
+ var item = null;
+ try { item = ls.getItem(u); } catch(e) {}
if (item != null && item != '')
return item;
// Get resource from network
var http = new XMLHttpRequest();
http.open("GET", u, false);
+ http.setRequestHeader("Accept", "*/*");
http.send(null);
if (http.status == 200) {
if (http.getResponseHeader("X-Login") != null) {
- if (log) log('http error', u, 'X-Login');
+ if (debug) debug('http error', u, 'X-Login');
return null;
} else if (http.responseText == '' || http.getResponseHeader("Content-Type") == null) {
- if (log) log('http error', u, 'No-Content');
+ if (debug) debug('http error', u, 'No-Content');
return null;
}
- localStorage.setItem(u, http.responseText);
+ try { ls.setItem(u, http.responseText); } catch(e) {}
return http.responseText;
}
- if (log) log('http error', u, http.status, http.statusText);
+ if (debug) debug('http error', u, http.status, http.statusText);
return null;
};
@@ -71,7 +74,7 @@ appcache.get = function(uri) {
</script>
</head>
<body class="delayed" onload="onload();">
-<div id="bodydiv" class="mainbodydiv">
+<div id="mainbodydiv" class="mainbodydiv">
<div id="headdiv" class="hsection">
<script type="text/javascript">
@@ -81,28 +84,34 @@ $('headdiv').appendChild(ui.declareScrip
</script>
</div>
-<div id="menu"></div>
+<div id="menubackground" class="tbarbackground fixed"></div>
+<div id="menu" class="tbarmenu fixed"></div>
-<div id="content" class="viewloaded3d">
+<div id="viewheadbackground" class="viewheadbackground fixed"></div>
+<div id="viewhead" class="viewhead fixed"></div>
-<table style="width: 100%;">
-<tr><td><h2><span id="h1"></span></h2></td></tr>
-</table>
+<div id="viewcontainer">
+<div id="view">
+<div id="viewcontent" class="viewcontent" style="margin-left: auto; margin-right: auto; text-align: center;">
-<div style="margin-left: auto; margin-right: auto; text-align: center;">
+<br/>
<div class="hd2">Oops, something went wrong...</div>
-</div>
</div>
+</div>
+</div>
<script type="text/javascript">
-// Set page title
-$('h1').innerHTML = ui.hometitle(location.hostname);
-
// Init div variables
var mdiv = $('menu');
-var cdiv = $('content');
+var hdiv = $('viewhead');
+$('viewcontainer').className = ui.isMobile()? 'viewcontainer3d' : 'viewcontainer3dm';
+$('view').className = ui.isMobile()? 'viewloaded3d' : 'viewloaded3dm';
+
+// Set page title
+document.title = ui.windowtitle(location.hostname) + ' - Oops';
+$('viewhead').innerHTML = '<span class="bcmenu">' + config.pagetitle + '</span>';
/**
* Build and show the menu bar.
@@ -114,7 +123,6 @@ function showmenu(mdiv) {
}
showmenu(mdiv);
-cdiv.style.top = ui.pixpos(mdiv.offsetTop + mdiv.offsetHeight);
/**
* Log the current user out.
@@ -122,9 +130,8 @@ cdiv.style.top = ui.pixpos(mdiv.offsetTo
function logout() {
// Clear session cookie and user-specific local storage entries
clearauthcookie();
- localStorage.removeItem('/r/EditWidget/accounts');
- localStorage.removeItem('/r/EditWidget/dashboards');
- //localStorage.clear();
+ lstorage.removeItem('/r/EditWidget/accounts');
+ lstorage.removeItem('/r/EditWidget/dashboards');
document.location = '/login/';
return true;
}
@@ -133,11 +140,12 @@ function logout() {
* Handle orientation change.
*/
document.body.onorientationchange = function(e) {
- //log('onorientationchange');
-
- // Scroll to the top and hide the address bar
- window.scrollTo(0, 0);
+ //debug('onorientationchange');
+ ui.onorientationchange(e);
+ // Resize menu and view header
+ mdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
+ hdiv.style.width = ui.pixpos(document.documentElement.clientWidth);
return true;
};
@@ -145,13 +153,11 @@ document.body.onorientationchange = func
* Load post processing.
*/
function onload() {
- //log('onload');
+ //debug('onload');
+ ui.onload();
// Show the page
document.body.style.visibility = 'visible';
-
- // Scroll to the top and hide the address bar
- window.scrollTo(0, 0);
return true;
}
Modified: tuscany/sca-cpp/trunk/hosting/server/htdocs/stats/index.html
URL: http://svn.apache.org/viewvc/tuscany/sca-cpp/trunk/hosting/server/htdocs/stats/index.html?rev=1343316&r1=1343315&r2=1343316&view=diff
==============================================================================
--- tuscany/sca-cpp/trunk/hosting/server/htdocs/stats/index.html (original)
+++ tuscany/sca-cpp/trunk/hosting/server/htdocs/stats/index.html Mon May 28 16:49:36 2012
@@ -17,40 +17,27 @@
* specific language governing permissions and limitations
* under the License.
-->
-<div id="bodydiv" class="bodydiv">
+<div id="bodydiv" class="body">
-<table style="width: 100%;">
-<tr>
-<td><h2><span id="h1"></span><span id="appNameHeader"></span></h2></td>
-<td style="vertical-align: middle; text-align: right;"><span id="status" style="font-weight: bold; color: #808080;"></span></td>
-</tr>
-</table>
-
-<table style="width: 100%;">
-<tr>
-<th class="thl thr" style="padding-top: 4px; padding-bottom: 4px; padding-left: 2px; padding-right: 2px; ">Stats</th>
-
-<th class="thl thr" style="width: 100%; text-align: right; padding-right: 2px; padding-top: 0px; padding-bottom: 0px;">
-<input type="button" class="graybutton" style="font-weight: bold; margin-top: 0px; margin-bottom: 0px; height: 24px;" id="cloneApp" value="Clone" title="Clone this app"/>
-</th>
-</tr>
-</table>
+<div class="viewform">
<form id="appForm">
<table style="width: 100%;">
-<tr><tr><td><b>App Icon:</b></td></tr>
+<tr><tr><td><b>Icon:</b></td></tr>
<tr><td><img id="appimg" 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>Title:</b></td></tr>
+<tr><td><input type="text" class="flatentry" id="appTitle" size="30" readonly="readonly" placeholder="Enter the title of your app" style="width: 300px;"/></td></tr>
+<tr><tr><td style="padding-top: 6px;"><b>Author:</b></td></tr>
+<tr><td><span id="appAuthor"></span></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>
+<tr><td><textarea id="appDescription" class="flatentry" cols="40" rows="3" readonly="readonly" 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
@@ -58,24 +45,23 @@ var appname = ui.fragmentParams(location
// Set page titles
document.title = ui.windowtitle(location.hostname) + ' - Stats - ' + appname;
-$('appNameHeader').innerHTML = '<a href=\"/' + appname + '/\" target=\"' + '_blank' + '\">' + appname + '</a>';
-var tclone = isNil(config.clone)? 'Clone' : config.clone;
-$('cloneApp').value = tclone;
-$('cloneApp').title = tclone + ' this app';
+$('viewhead').innerHTML = '<span id="appname" class="cmenu">' + appname + '</span>' +
+'<input type="button" class="graybutton redbutton plusminus" style="position: absolute; top: 4px; left: 5px;" id="deleteApp" value="-" title="Delete the app" disabled="true"/>' +
+'<input type="button" class="graybutton bluebutton" style="position: absolute; top: 4px; right: 5px;" id="cloneApp" value="'+ config.clone +'" title="' + config.clone + ' this app"/>';
// Set images
$('appimg').src = ui.b64img(appcache.get('/public/app.b64'));
// Init service references
var editWidget = sca.component("EditWidget");
-var dashboards = sca.reference(editWidget, "dashboards");
var apps = sca.reference(editWidget, "apps");
/**
- * The current app entry and corresponding saved XML content.
+ * The current app entry, author and saved XML content.
*/
-var appentry;
var savedappentryxml = '';
+var author;
+var appentry;
/**
* Get and display an app.
@@ -89,17 +75,34 @@ function getapp(name) {
// Stop now if we didn't get the app
if (doc == null) {
- showStatus('No data');
+ showError('App not available');
return false;
}
- showStatus(defaultStatus());
- 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 = '';
+ appentry = car(elementsToValues(atom.readATOMEntry(mklist(doc))));
+ $('appTitle').value = cadr(assoc("'title", cdr(appentry)));
+ author = cadr(assoc("'author", cdr(appentry)));
+ $('appAuthor').innerHTML = author;
+ $('appUpdated').innerHTML = cadr(assoc("'updated", cdr(appentry)));
+ var content = cadr(assoc("'content", cdr(appentry)));
+ var description = assoc("'description", content);
+ $('appDescription').value = isNil(description) || isNil(cadr(description))? '' : cadr(description);
savedappentryxml = car(atom.writeATOMEntry(valuesToElements(mklist(appentry))));
+
+ // Enable author to edit and delete the app
+ if (username == author) {
+ $('appTitle').readOnly = false;
+ $('appDescription').readOnly = false;
+ $('deleteApp').disabled = false;
+ $('deleteApp').onclick = function() {
+ return ui.navigate('/#view=delete&app=' + appname, '_view');
+ }
+ showStatus(defaultStatus());
+ } else {
+ $('appTitle').placeholder = '';
+ $('appDescription').placeholder = '';
+ showStatus('Read only');
+ }
return true;
});
}
@@ -110,7 +113,7 @@ function getapp(name) {
function save(entryxml) {
showStatus('Saving');
savedappentryxml = entryxml;
- dashboards.put(appname, savedappentryxml, function(e) {
+ apps.put(appname, savedappentryxml, function(e) {
if (e) {
showStatus('Local copy');
return false;
@@ -126,8 +129,11 @@ function save(entryxml) {
* Handle a change event
*/
function onappchange() {
+ if (username != author)
+ return false;
var title = $('appTitle').value;
- var appentry = mklist("'entry", mklist("'title", title != ''? title : appname), mklist("'id", appname));
+ var description = $('appDescription').value;
+ appentry = mklist("'entry", mklist("'title", title != ''? title : appname), mklist("'id", appname), mklist("'content", mklist("'stats", mklist("'description", description))));
var entryxml = car(atom.writeATOMEntry(valuesToElements(mklist(appentry))));
if (savedappentryxml == entryxml)
return false;