diff options
Diffstat (limited to 'sca-cpp')
36 files changed, 1080 insertions, 526 deletions
diff --git a/sca-cpp/trunk/.gitignore b/sca-cpp/trunk/.gitignore index bad323b21d..e399629c54 100644 --- a/sca-cpp/trunk/.gitignore +++ b/sca-cpp/trunk/.gitignore @@ -55,6 +55,7 @@ m4/ config.guess config.sub config.status +config.js depcomp install-sh ltmain.sh @@ -125,6 +126,7 @@ scribe-cat js-test js-eval file-test +test-start xml-value value-xml json-value diff --git a/sca-cpp/trunk/modules/edit/apps.py b/sca-cpp/trunk/modules/edit/apps.py index 233202040f..4add10a239 100644 --- a/sca-cpp/trunk/modules/edit/apps.py +++ b/sca-cpp/trunk/modules/edit/apps.py @@ -31,6 +31,7 @@ def mkapplink(id): os.symlink('../../../../../nuvem/nuvem-parallel/nuvem', 'apps/' + car(id) + '/nuvem') os.symlink('../../../../components', 'apps/' + car(id) + '/lib') os.mkdir('apps/' + car(id) + '/htdocs') + os.symlink('../../../htdocs/cache-manifest.cmf', 'apps/' + car(id) + '/htdocs/cache-manifest.cmf'); os.symlink('../../../htdocs/login', 'apps/' + car(id) + '/htdocs/login'); os.symlink('../../../htdocs/logout', 'apps/' + car(id) + '/htdocs/logout'); os.symlink('../../../htdocs/public', 'apps/' + car(id) + '/htdocs/public'); diff --git a/sca-cpp/trunk/modules/edit/htdocs/app/cache-manifest.cmf b/sca-cpp/trunk/modules/edit/htdocs/app/cache-manifest.cmf new file mode 100644 index 0000000000..24c05d717b --- /dev/null +++ b/sca-cpp/trunk/modules/edit/htdocs/app/cache-manifest.cmf @@ -0,0 +1,32 @@ +CACHE-MANIFEST + +# Common resources +atomutil.js +component.js +elemutil.js +jsconfig.js +jsonutil.js +scdl.js +ui.css +ui.js +util.js +xmlutil.js + +# App resources +app.html +data/index.html +index.html +favicon.ico +login/index.html +logout/index.html +public/app.png +public/grid72.png +public/iframe.html +public/img.png +public/notauth.html +public/notfound.html +public/notyet.html +public/oops.html +public/touchicon.png +robots.txt + diff --git a/sca-cpp/trunk/modules/edit/htdocs/app/index.html b/sca-cpp/trunk/modules/edit/htdocs/app/index.html index 458ba4c00e..f147f729ac 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/app/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/app/index.html @@ -1,22 +1,22 @@ <!-- - * 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. + * 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> +<html manifest="cache-manifest.cmf"> <head> <title>App</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0"/> @@ -27,6 +27,7 @@ document.title = window.location.hostname.split('.')[0]; </script> <link rel="apple-touch-icon" href="/public/touchicon.png"/> <link rel="stylesheet" type="text/css" href="/ui.css"/> +<script type="text/javascript" src="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/elemutil.js"></script> <script type="text/javascript" src="/xmlutil.js"></script> @@ -52,9 +53,10 @@ if (ui.isIE()) $('bodydiv').style.right = -20; /** * Page, every and location components. */ -var pagecomp = sca.httpclient('page', '/page'); +var appstartcomp = sca.httpclient('appstart', '/appstart'); +var appstopcomp = sca.httpclient('appstop', '/appstop'); var everycomp = sca.httpclient('every', '/every'); -var locationcomp = sca.httpclient('location', '/location'); +var geolocationcomp = sca.httpclient('geolocation', '/geolocation'); /** * Find a named value in a tree of elements. @@ -66,7 +68,6 @@ function datavalue(l, id) { // Element matches id segment if (car(id) == elementName(e)) { - log('match', car(id)); // Found element matching the whole id path if (isNil(cdr(id))) @@ -100,9 +101,11 @@ function inputvalue(e) { return car(childElements(e)).value; } if (e.className == 'checkbox') { + if (!car(childElements(e)).checked) + return null; return car(childElements(e)).value; } - if (e.className == 'list') { + if (e.className == 'select') { return car(childElements(car(childElements(e)))).value; } return null; @@ -114,7 +117,10 @@ function inputvalue(e) { function setwidgetvalue(e, dv) { function datatext(dv) { - return elementHasValue(dv)? elementValue(dv) : ''; + if (!elementHasValue(dv)) + return ''; + var t = elementValue(dv); + return t == null? '' : t; } if (e.className == 'h1' || e.className == 'h2' || e.className == 'text' || e.className == 'section') { @@ -138,15 +144,20 @@ function setwidgetvalue(e, dv) { map(function(n) { if (n.nodeName == "SPAN") n.innerHTML = t; return n; }, nodeList(e.childNodes)); return t; } - if (e.className == 'list') { + if (e.className == 'select') { var t = datatext(dv); var ce = car(childElements(car(childElements(e)))); ce.value = t; ce.innerHTML = t; return t; } + if (e.className == 'list') { + var t = ui.datalist(mklist(dv)); + car(childElements(e)).innerHTML = t; + return t; + } if (e.className == 'table') { - var t = ui.datatable(elementChildren(dv)); + var t = ui.datatable(mklist(dv)); car(childElements(e)).innerHTML = t; return t; } @@ -159,7 +170,8 @@ function setwidgetvalue(e, dv) { } if (e.className == 'img') { var t = datatext(dv); - car(childElements(e)).src = t; + var img = car(childElements(e)); + img.setAttribute('src', t); return t; } if (e.className == 'iframe') { @@ -220,7 +232,7 @@ function bindwidgethandler(e) { car(childElements(e)).name = e.id; return e; } - if (e.className == 'list') { + if (e.className == 'select') { var ce = car(childElements(car(childElements(e)))); ce.name = e.id; return e; @@ -241,7 +253,13 @@ function fixupwidget(e) { e.style.width = '100%'; return e; } + if (e.className == 'list') { + car(childElements(e)).innerHTML = ''; + car(childElements(e)).style.width = '100%'; + return e; + } if (e.className == 'table') { + car(childElements(e)).innerHTML = ''; car(childElements(e)).style.width = '100%'; return e; } @@ -266,7 +284,6 @@ function getpagedata() { // Eval a component init script function evalcompinit(doc) { - log('comp init', doc); if (isNil(doc)) return true; var js = car(json.readJSON(mklist(doc))); @@ -283,8 +300,7 @@ function getpagedata() { } // Get the component app data - var doc = pagecomp.get(window.location.search, function(doc) { - log('page return', doc); + var doc = appstartcomp.get(window.location.search, function(doc) { try { $('app').innerHTML = $('appFrame').contentDocument.body.innerHTML; @@ -296,11 +312,11 @@ function getpagedata() { // Get and eval the optional timer and location watch setup scripts everycomp.get('setup', evalcompinit); - locationcomp.get('setup', evalcompinit); + geolocationcomp.get('setup', evalcompinit); return true; } catch(e) { - log('exception on pagecomp.get()', e); + log('exception on appstartcomp.get()', e); } }); @@ -315,7 +331,6 @@ function getpagedata() { */ function getcompdata(comp, qs) { var doc = comp.get(qs, function(doc) { - log('comp data', doc); return displaydoc(doc); }); return true; @@ -329,7 +344,11 @@ function compquery() { return e.id + '=' + inputvalue(e); } - var args = map(queryarg, filter(function(e) { return !isNil(e.id) && !isNil(inputvalue(e)); }, nodeList(ui.elementByID($('app'), 'page').childNodes))); + function childrenList(n) { + return append(nodeList(n.childNodes), reduce(append, mklist(), map(childrenList, nodeList(n.childNodes)))); + } + + var args = map(queryarg, filter(function(e) { return !isNil(e.id) && !isNil(inputvalue(e)); }, childrenList(ui.elementByID($('app'), 'page')))); // Append current location properties if known if (!isNil(geoposition)) { @@ -367,9 +386,9 @@ function intervalHandler() { /** * Setup an interval timer. */ -function setupIntervalHandler(sec) { +function setupIntervalHandler(msec) { try { - return setInterval(intervalHandler, sec); + return setInterval(intervalHandler, msec); } catch(e) { log('exception in setupIntervalHandler()', e); } @@ -378,20 +397,26 @@ function setupIntervalHandler(sec) { /** * Handle a location watch event. */ -var geoposition; +var locationWatch = null; +var geoposition = null; function locationHandler(pos) { - log('location pos', pos); try { geoposition = pos; - return getcompdata(locationcomp, compquery()); + return getcompdata(geolocationcomp, compquery()); } catch(e) { - log('exception in locationHandler()', e); + locationErrorHandler(e); } } function locationErrorHandler(e) { log('location error', e); + if (!isNil(locationWatch)) { + try { + navigator.geolocation.clearWatch(locationWatch); + } catch(e) {} + locationWatch = null; + } return true; } @@ -399,13 +424,18 @@ function locationErrorHandler(e) { * Setup a location watch handler. */ function setupLocationHandler() { - log('setup location'); - try { - navigator.geolocation.getCurrentPosition(locationHandler, locationErrorHandler); - navigator.geolocation.watchPosition(locationHandler, locationErrorHandler); - } catch(e) { - log('exception in setupLocationHandler()', e); + function installLocationHandler() { + if (!isNil(locationWatch)) + return true; + try { + locationWatch = navigator.geolocation.watchPosition(locationHandler, locationErrorHandler); + } catch(e) { + log('exception in installLocationHandler()', e); + } } + + installLocationHandler(); + setInterval(installLocationHandler, 10000); return true; } diff --git a/sca-cpp/trunk/modules/edit/htdocs/cache-manifest.cmf b/sca-cpp/trunk/modules/edit/htdocs/cache-manifest.cmf new file mode 100644 index 0000000000..5761c8cf11 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/htdocs/cache-manifest.cmf @@ -0,0 +1,47 @@ +CACHE-MANIFEST + +# Common resources +atomutil.js +component.js +elemutil.js +jsconfig.js +jsonutil.js +scdl.js +ui.css +ui.js +util.js +xmlutil.js + +# App resources +app/index.html +dash/dashboard.html +dash/index.html +data/index.html +favicon.ico +graph/graph.html +graph/graph.js +graph/index.html +home.png +index.html +login/index.html +logout/index.html +main.html +menu.html +page/index.html +page/page.html +page/page.js +props/index.html +props/props.html +public/app.png +public/grid72.png +public/iframe.html +public/img.png +public/notauth.html +public/notfound.html +public/notyet.html +public/oops.html +public/touchicon.png +robots.txt +store/index.html +store/store.html + diff --git a/sca-cpp/trunk/modules/edit/htdocs/dash/dashboard.html b/sca-cpp/trunk/modules/edit/htdocs/dash/dashboard.html index 44a971fb14..97b5e37a7b 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/dash/dashboard.html +++ b/sca-cpp/trunk/modules/edit/htdocs/dash/dashboard.html @@ -1,24 +1,25 @@ <!-- - * 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. + * 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="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/elemutil.js"></script> <script type="text/javascript" src="/xmlutil.js"></script> @@ -91,7 +92,7 @@ function getapps(sync) { function display(doc) { var apps = '<table style="width: 100%;">'; apps += '<tr><th class="thl thr" style="width: 20px; padding-top: 4px; padding-right: 4px;">App</th>' + - '<th class="thr thl" style="width: 20px;">Domain</th>' + + '<th class="thr thl" style="width: 20px;">URL</th>' + '<th class="thr thl">Category</th>' + '<th class="thr thl" style="width: 100%;">Title</th>' + '<th class="thr thl">Updated</th>' + @@ -103,7 +104,7 @@ function getapps(sync) { var entry = entries[i]; var title = cadr(assoc("'title", entry)) var name = cadr(assoc("'id", entry)) - var editlink = '<a href=\"' + '/graph/?app=' + name + '\" target=\"_parent\">'; + var editlink = '<a href=\"' + '/page/?app=' + name + '\" target=\"_parent\">'; var domainlink = '<a href=\"' + applink(name) + '\" target=\"' + '_blank' + '\">' + name + '.' + window.location.hostname + '</a>'; var category = 'coolapps'; var updated = 'Feb 4, 2011'; diff --git a/sca-cpp/trunk/modules/edit/htdocs/dash/index.html b/sca-cpp/trunk/modules/edit/htdocs/dash/index.html index a2f317175d..52b97b7271 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/dash/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/dash/index.html @@ -1,20 +1,20 @@ <!-- - * 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. + * 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> @@ -24,6 +24,7 @@ <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.css"/> +<script type="text/javascript" src="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/ui.js"></script> </head> @@ -40,7 +41,7 @@ // Load the menu bar ui.loadwidget('menu', '/menu.html', ui.showbody); -$('h1').innerHTML = domaintitle(window.location.hostname); +$('h1').innerHTML = hometitle(window.location.hostname); // Load the dashboard $('dashboard').innerHTML = diff --git a/sca-cpp/trunk/modules/edit/htdocs/data/index.html b/sca-cpp/trunk/modules/edit/htdocs/data/index.html index 6f5db2ba8b..2682acde07 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/data/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/data/index.html @@ -1,20 +1,20 @@ <!-- - * 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. + * 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> @@ -28,6 +28,7 @@ document.title = 'View - ' + window.location.hostname.split('.')[0] + '/' + cn; <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.css"> +<script type="text/javascript" src="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/elemutil.js"></script> <script type="text/javascript" src="/xmlutil.js"></script> @@ -81,9 +82,7 @@ function mkdoctable(doc) { * Get and display the contents of the current component. */ function getdata() { - log('comp', comp.uri); comp.get('', function(doc) { - log('doc', doc); if (json.isJSON(mklist(doc))) return display(datatable(json.readJSON(mklist(doc)))); diff --git a/sca-cpp/trunk/modules/edit/htdocs/graph/graph.html b/sca-cpp/trunk/modules/edit/htdocs/graph/graph.html index 7d9d472856..1b927de48d 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/graph/graph.html +++ b/sca-cpp/trunk/modules/edit/htdocs/graph/graph.html @@ -1,24 +1,25 @@ <!-- - * 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. + * 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="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/elemutil.js"></script> <script type="text/javascript" src="/xmlutil.js"></script> @@ -161,7 +162,6 @@ $('saveButton').onclick = function(e) { * Save the current composite. */ function save() { - log('saving'); $('saveButton').value = 'Saving'; savedcomposxml = car(writeXML(composite, false)); var entry = '<entry xmlns="http://www.w3.org/2005/Atom">' + @@ -178,15 +178,18 @@ function save() { /** * Handle a composite change event. */ -function oncomposchange() { +function oncomposchange(prop) { if (savedcomposxml == car(writeXML(composite, false))) return false; $('saveButton').value = 'Save now'; - // Autosave after 3 seconds + // Save property changes right away + if (prop) + return save(); + + // Autosave other changes after 3 seconds + $('saveButton').value = 'Save now'; setTimeout(function() { - log('savedcomposxml', savedcomposxml); - log('newddcomposxml', car(writeXML(composite, false))); if (savedcomposxml == car(writeXML(composite, false))) return false; return save(); @@ -281,12 +284,12 @@ $('autoplayButton').onclick = function(e) { if (autoplay) { autoplay = false; showData(''); - $('autoplayButton').value = 'Autorun is off'; + $('autoplayButton').value = 'Preview is off'; return true; } autoplay = true; showData(compname); - $('autoplayButton').value = 'Autorun is on'; + $('autoplayButton').value = 'Preview is on'; return true; }; @@ -299,11 +302,11 @@ var bg = graph.mkgroup(graph.mkpath()); // Install the palettes var gpalettes = new Array(); -var spalette = 'event'; +var spalette = 'control'; var pos = graph.mkpath(); -installpalette('event', pos.rmove(0,0), g, bg, spalette, gpalettes); -installpalette('value', pos.rmove(0,40), g, bg, spalette, gpalettes); -installpalette('list', pos.rmove(0, 40), g, bg, spalette, gpalettes); +installpalette('control', pos.rmove(0,0), g, bg, spalette, gpalettes); +installpalette('values', pos.rmove(0,40), g, bg, spalette, gpalettes); +installpalette('lists', pos.rmove(0, 40), g, bg, spalette, gpalettes); installpalette('transform', pos.rmove(0, 40), g, bg, spalette, gpalettes); installpalette('text', pos.rmove(0, 40), g, bg, spalette, gpalettes); installpalette('http', pos.rmove(0, 40), g, bg, spalette, gpalettes); diff --git a/sca-cpp/trunk/modules/edit/htdocs/graph/graph.js b/sca-cpp/trunk/modules/edit/htdocs/graph/graph.js index 13543b4d61..38909756dc 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/graph/graph.js +++ b/sca-cpp/trunk/modules/edit/htdocs/graph/graph.js @@ -47,6 +47,8 @@ graph.colors.blue1 = '#00c3c9'; graph.colors.red1 = '#d03f41'; graph.colors.yellow1 = '#fcee21'; graph.colors.magenta1 = '#c0688a'; +graph.colors.cyan1 = '#d5dcf9'; +graph.colors.lightgray1 = '#dcdcdc' /** * Default positions and sizes. @@ -55,10 +57,11 @@ var palcx = 250; var trashcx = 230; var proxcx = 20; var proxcy = 20; -var buttoncx = 70; +var buttoncx = 65; var buttoncy = 30; var curvsz = 6; var tabsz = 2; +var fontsz = ''; /** * Base path class. @@ -134,6 +137,8 @@ if (ui.isIE()) { // Track element dragging and selection graph.dragging = null; graph.selected = null; + cname.disabled = true; + pvalue.disabled = true; /** * Find the first draggable element in a hierarchy of elements. @@ -159,7 +164,9 @@ if (ui.isIE()) { // Reset current selection cname.value = ''; + cname.disabled = true; pvalue.value = ''; + pvalue.disabled = true; // Trigger component select event vmlg.oncompselect(''); @@ -187,7 +194,9 @@ if (ui.isIE()) { // Update the component name and property value fields cname.value = graph.selected.id; + cname.disabled = false; pvalue.value = graph.property(graph.selected.comp); + pvalue.disabled = !graph.hasproperty(graph.selected.comp); // Trigger component select event vmlg.oncompselect(vmlg.appname, graph.selected.id); @@ -237,14 +246,16 @@ if (ui.isIE()) { // Reset current selection graph.selected = null; cname.value = ''; + cname.disabled = true; pvalue.value = ''; + pvalue.disabled = true; // Trigger component select event vmlg.oncompselect(''); } // Trigger composite change event - vmlg.oncomposchange(); + vmlg.oncomposchange(false); } // Forget current dragged component @@ -292,6 +303,7 @@ if (ui.isIE()) { // Change component name and refactor references to it var compos = scdl.composite(vmlg.compos); cname.value = graph.ucid(cname.value, compos); + cname.disabled = false; graph.selected.id = cname.value; setElement(compos, graph.renamecomp(graph.selected.comp, compos, cname.value)); @@ -302,7 +314,7 @@ if (ui.isIE()) { graph.refresh(vmlg); // Trigger composite change event - vmlg.oncomposchange(); + vmlg.oncomposchange(true); return false; }; @@ -313,12 +325,13 @@ if (ui.isIE()) { // Change the component property value graph.setproperty(graph.selected.comp, pvalue.value); pvalue.value = graph.property(graph.selected.comp); + pvalue.disabled = !graph.hasproperty(graph.selected.comp); // Refresh the composite graph.refresh(vmlg); // Trigger composite change event - vmlg.oncomposchange(); + vmlg.oncomposchange(true); return false; }; @@ -326,15 +339,20 @@ if (ui.isIE()) { // component, reference and property titles graph.comptitlewidthdiv = document.createElement('span'); graph.comptitlewidthdiv.style.visibility = 'hidden' + if (fontsz != '') + graph.comptitlewidthdiv.style.fontSize = fontsz; div.appendChild(graph.comptitlewidthdiv); graph.reftitlewidthdiv = document.createElement('span'); graph.reftitlewidthdiv.style.visibility = 'hidden' + if (fontsz != '') + graph.comptitlewidthdiv.style.fontSize = fontsz; div.appendChild(graph.reftitlewidthdiv); graph.proptitlewidthdiv = document.createElement('span'); graph.proptitlewidthdiv.style.visibility = 'hidden' - graph.proptitlewidthdiv.style.fontWeight = 'bold' + if (fontsz != '') + graph.comptitlewidthdiv.style.fontSize = fontsz; div.appendChild(graph.proptitlewidthdiv); return vmlg; @@ -379,14 +397,16 @@ if (ui.isIE()) { /** * Return an element representing a title. */ - graph.mktitle = function(t, bold, pos) { + graph.mktitle = function(t, style, pos) { var title = document.createElement('v:textbox'); title.style.position = 'absolute'; title.style.left = pos.xpos() + 2; title.style.top = pos.ypos(); title.inset = '' + 6 + 'px ' + pos.ypos() + 'px 0px 0px'; - if (bold) - title.style.fontWeight = 'bold'; + if (style != '') + title.style.cssText = style; + if (fontsz != '') + title.style.fontSize = fontsz; var tnode = document.createTextNode(t); title.appendChild(tnode); return title; @@ -399,7 +419,7 @@ if (ui.isIE()) { var tsvcs = graph.tsvcs(comp); var lsvcs = graph.lsvcs(comp); var pos = graph.mkpath().move(isNil(lsvcs)? tabsz : (tabsz * 5), isNil(tsvcs)? tabsz : (tabsz * 5)); - return graph.mktitle(graph.title(comp), false, pos); + return graph.mktitle(graph.title(comp), graph.compstyle(comp), pos); }; /** @@ -420,16 +440,16 @@ if (ui.isIE()) { var tsvcs = graph.tsvcs(comp); var lsvcs = graph.lsvcs(comp); var pos = graph.mkpath().move(graph.comptitlewidth(comp) + 7 + (isNil(lsvcs)? tabsz : (tabsz * 5)), isNil(tsvcs)? tabsz : (tabsz * 5)); - return graph.mktitle(graph.property(comp), true, pos); + return graph.mktitle(graph.propertytitle(comp), graph.propstyle(comp), pos); }; /** * Return the width of the value of a property. */ graph.proptitlewidth = function(comp) { - var t = graph.property(comp); + var t = graph.proptitle(comp); graph.proptitlewidthdiv.innerHTML = t; - var twidth = graph.proptitlewidthdiv.offsetWidth + 2; + var twidth = graph.proptitlewidthdiv.offsetWidth + 4; graph.proptitlewidthdiv.innerHTML = ''; return twidth; }; @@ -438,7 +458,7 @@ if (ui.isIE()) { * Return an element representing the title of a reference. */ graph.reftitle = function(ref) { - return graph.mktitle(graph.title(ref), false, graph.mkpath().move(25,25)); + return graph.mktitle(graph.title(ref), graph.refstyle(ref), graph.mkpath().move(25,25)); }; /** @@ -527,7 +547,7 @@ if (ui.isIE()) { graph.mkbutton = function(t, pos) { // Make the title element - var title = graph.mktitle(t, true, graph.mkpath().move(4,4)); + var title = graph.mktitle(t, '', graph.mkpath().move(4,4)); // Compute the path of the button shape var path = graph.buttonpath().str(); @@ -616,6 +636,8 @@ if (ui.isIE()) { // Track element dragging and selection graph.dragging = null; graph.selected = null; + cname.disabled = true; + pvalue.disabled = true; /** * Find the first draggable element in a hierarchy of elements. @@ -644,7 +666,9 @@ if (ui.isIE()) { // Reset current selection cname.value = ''; + cname.disabled = true; pvalue.value = ''; + pvalue.disabled = true; // Trigger component select event svg.oncompselect(''); @@ -672,7 +696,9 @@ if (ui.isIE()) { // Update the component name and property value fields cname.value = graph.selected.id; + cname.disabled = false; pvalue.value = graph.property(graph.selected.comp); + pvalue.disabled = !graph.hasproperty(graph.selected.comp); // Trigger component select event svg.oncompselect(svg.appname, graph.selected.id); @@ -725,7 +751,9 @@ if (ui.isIE()) { // Reset current selection graph.selected = null; cname.value = ''; + cname.disabled = true; pvalue.value = ''; + pvalue.disabled = true; // Trigger component select event svg.oncompselect(''); @@ -739,7 +767,7 @@ if (ui.isIE()) { graph.refresh(svg); // Trigger composite change event - svg.oncomposchange(); + svg.oncomposchange(false); return false; }; @@ -808,7 +836,7 @@ if (ui.isIE()) { graph.refresh(svg); // Trigger composite change event - svg.oncomposchange(); + svg.oncomposchange(true); return false; }; @@ -819,12 +847,13 @@ if (ui.isIE()) { // Change the component property value graph.setproperty(graph.selected.comp, pvalue.value); pvalue.value = graph.property(graph.selected.comp); + pvalue.disabled = !graph.hasproperty(graph.selected.comp); // Refresh the composite graph.refresh(svg); // Trigger composite change event - svg.oncomposchange(); + svg.oncomposchange(true); return false; }; @@ -878,13 +907,15 @@ if (ui.isIE()) { /** * Return an element representing a title. */ - graph.mktitle = function(t, bold) { + graph.mktitle = function(t, style) { var title = document.createElementNS(graph.svgns, 'text'); - title.setAttribute('text-anchor', 'start'); title.setAttribute('x', 5); title.setAttribute('y', 15); - if (bold) - title.style.fontWeight = 'bold'; + title.setAttribute('text-anchor', 'start'); + if (style != '') + title.style.cssText = style; + if (fontsz != '') + title.style.fontSize = fontsz; title.appendChild(document.createTextNode(t)); return title; }; @@ -893,7 +924,7 @@ if (ui.isIE()) { * Return an element representing the title of a component. */ graph.comptitle = function(comp) { - return graph.mktitle(graph.title(comp), false); + return graph.mktitle(graph.title(comp), graph.compstyle(comp)); }; /** @@ -911,7 +942,7 @@ if (ui.isIE()) { * Return an element representing the title of a reference. */ graph.reftitle = function(ref) { - return graph.mktitle(graph.title(ref), false); + return graph.mktitle(graph.title(ref), graph.refstyle(ref)); }; /** @@ -929,7 +960,7 @@ if (ui.isIE()) { * Return an element representing the value of a property. */ graph.proptitle = function(comp) { - var title = graph.mktitle(graph.property(comp), true); + var title = graph.mktitle(graph.propertytitle(comp), graph.propstyle(comp)); title.setAttribute('x', graph.comptitlewidth(comp) + 7); return title; }; @@ -940,7 +971,7 @@ if (ui.isIE()) { graph.proptitlewidth = function(comp) { var title = graph.proptitle(comp); graph.titlewidthsvg.appendChild(title); - var width = title.getBBox().width + 2; + var width = title.getBBox().width + 4; graph.titlewidthsvg.removeChild(title); return width; }; @@ -1006,7 +1037,7 @@ if (ui.isIE()) { graph.mkbutton = function(t, pos) { // Make the button title - var title = graph.mktitle(t, true); + var title = graph.mktitle(t, ''); // Compute the path of the button shape var path = graph.buttonpath().str(); @@ -1085,7 +1116,9 @@ graph.title = function(e) { return '>' if (t == 'lt') return '<'; - if (t.indexOf('{') == -1) + if (t.indexOf('{propval}') != -1) + return ''; + if (t.indexOf('{compname}') == -1) return t; return t.replace('{compname}', scdl.name(e)); } @@ -1093,6 +1126,14 @@ graph.title = function(e) { }; /** + * Return the display style of an SCDL component or reference. + */ +graph.compstyle = graph.refstyle = function(e) { + var s = scdl.style(e); + return isNil(s)? '' : s; +}; + +/** * Return the property value of a SCDL component. */ graph.property = function(e) { @@ -1101,7 +1142,44 @@ graph.property = function(e) { return ''; if (scdl.visible(car(p)) == 'false') return ''; - return scdl.propertyValue(car(p)); + var pv = scdl.propertyValue(car(p)); + return pv; +}; + +/** + * Return the title of a property of a SCDL component. + */ +graph.propertytitle = function(e) { + var pv = graph.property(e); + var t = scdl.title(e); + if (t.indexOf('{propval}') == -1) + return pv; + return t[0] == ' '? t.substr(1).replace('{propval}', pv) : t.replace('{propval}', pv); +}; + +/** + * Return true if a SCDL component has a property. + */ +graph.hasproperty = function(e) { + var p = scdl.properties(e); + if (isNil(p)) + return false; + if (scdl.visible(car(p)) == 'false') + return false; + return true; +}; + +/** + * Return the display style of the property of an SCDL component. + */ +graph.propstyle = function(e) { + var p = scdl.properties(e); + if (isNil(p)) + return ''; + if (scdl.visible(car(p)) == 'false') + return ''; + var s = scdl.style(car(p)); + return isNil(s)? '' : s; }; /** diff --git a/sca-cpp/trunk/modules/edit/htdocs/graph/index.html b/sca-cpp/trunk/modules/edit/htdocs/graph/index.html index f9daa45770..c86b1ef6c1 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/graph/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/graph/index.html @@ -1,52 +1,67 @@ <!-- - * 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. + * 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>Composition</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"/> <link rel="apple-touch-icon" href="/public/touchicon.png"/> <link rel="stylesheet" type="text/css" href="/ui.css"/> +<script type="text/javascript" src="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/ui.js"></script> </head> <body class="delayed"> <div id="menu"></div> -<h1><span id="h1"></span> <span id="appNameHeader" style="font-weight: normal;"></span></h1> +<h1><span id="h1"></span><span id="appNameHeader"></span></h1> <br/> <div id="graph"></div> <script type="text/javascript"> +/** + * 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; +} + // Get the app name var appname = ui.queryParams()['app']; +// Update the window title +document.title = windowtitle(window.location.hostname) + ' - ' + (isNil(config.compose)? 'Composition' : config.compose) + ' - ' + appname; +$('h1').innerHTML = hometitle(window.location.hostname); +$('appNameHeader').innerHTML = ' - <a href=\"' + applink(appname) + '\" target=\"' + '_blank' + '\">' + appname + '</a>'; + // Load the menu bar ui.loadwidget('menu', '/menu.html?app=' + appname, ui.showbody); -$('h1').innerHTML = domaintitle(window.location.hostname); -document.title = 'Composition - ' + appname; -$('appNameHeader').innerHTML = ' - ' + appname; - /** * Display the editor for an app. */ diff --git a/sca-cpp/trunk/modules/edit/htdocs/index.html b/sca-cpp/trunk/modules/edit/htdocs/index.html index 7ff2bc7e9f..266c696267 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/index.html @@ -1,22 +1,22 @@ <!-- - * 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. + * 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> +<html manifest="cache-manifest.cmf"> <head> <title>Home</title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0"/> @@ -24,9 +24,10 @@ <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.css"/> +<script type="text/javascript" src="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript"> -document.title = domaintitle(window.location.hostname); +document.title = windowtitle(window.location.hostname); </script> <script type="text/javascript" src="/ui.js"></script> </head> @@ -40,11 +41,11 @@ document.title = domaintitle(window.location.hostname); <script type="text/javascript"> +$('h1').innerHTML = hometitle(window.location.hostname); + // Load the menu bar ui.loadwidget('menu', '/menu.html', ui.showbody); -$('h1').innerHTML = domaintitle(window.location.hostname); - // Load the main page ui.loadiframe('main', 'main.html'); diff --git a/sca-cpp/trunk/modules/edit/htdocs/login/index.html b/sca-cpp/trunk/modules/edit/htdocs/login/index.html index 2cbb389718..165838be82 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/login/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/login/index.html @@ -1,22 +1,21 @@ <!-- - 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. + * 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>Sign in</title> @@ -25,6 +24,7 @@ <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.css"/> +<script type="text/javascript" src="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/ui.js"></script> </head> diff --git a/sca-cpp/trunk/modules/edit/htdocs/logout/index.html b/sca-cpp/trunk/modules/edit/htdocs/logout/index.html index e17b325eb3..84aa08ef80 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/logout/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/logout/index.html @@ -1,22 +1,21 @@ <!-- - 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. + * 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>Sign out</title> @@ -25,6 +24,7 @@ <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.css"/> +<script type="text/javascript" src="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/ui.js"></script> </head> diff --git a/sca-cpp/trunk/modules/edit/htdocs/main.html b/sca-cpp/trunk/modules/edit/htdocs/main.html index c9cdf37145..9555e8a54d 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/main.html +++ b/sca-cpp/trunk/modules/edit/htdocs/main.html @@ -1,24 +1,25 @@ <!-- - * 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. + * 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="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/ui.js"></script> </head> @@ -27,19 +28,23 @@ <div id="bodydiv" style="position: absolute; top: 0px; left: 0px; right: 0px;"> <div style="margin-left: auto; margin-right: auto; text-align: center;"> -<br/><br/><br/> -<a href="/dash/" target="_parent"><img src="home.png" width="426" height="145" style="width: 426px; height: 145px;"/></a> +<h2><span id="maintitle"><span></h2> +<br/><br/><br/><br/> +<!-- +<a href="/dash/" target="_parent"><img src="home.png" width="426" height="145" style="width: 426px; height: 145px;"/></a> <br/><br/> +--> + +<div id="maindiagram"></div> +<br/><br/><br/><br/> -<h1><a href="/dash/" target="_parent">Get Started</a></h1> +<h1><a id="getstarted" href="">Get Started</a></h1> <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> -<br/> -<div>Works with Safari, Chrome and Firefox. Doesn't work with IE.</div> +<div>Safari, Chrome, Firefox only for now.</div> + </div> </div> @@ -47,6 +52,10 @@ <script type="text/javascript"> if (ui.isIE()) $('bodydiv').style.right = -20; +$('maintitle').innerHTML = isNil(config.maintitle)? 'Simple App Builder' : config.maintitle; +$('maindiagram').innerHTML = isNil(config.maindiagram)? '<< insert diagram here >>' : config.maindiagram; +$('getstarted').href = ui.href('/store/', '_parent'); + ui.showbody(); </script> diff --git a/sca-cpp/trunk/modules/edit/htdocs/menu.html b/sca-cpp/trunk/modules/edit/htdocs/menu.html index fe3e228c62..8cdeddb1dc 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/menu.html +++ b/sca-cpp/trunk/modules/edit/htdocs/menu.html @@ -1,24 +1,25 @@ <!-- - * 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. + * 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="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/ui.js"></script> <script type="text/javascript" src="/component.js"></script> @@ -38,7 +39,8 @@ var user = sca.defun(sca.reference(menuWidget, "user"), "id"); function userMenu() { function UserMenu() { this.content = function() { - return '<span><b>' + user.id() + '</b></span>'; + u = user.id() + return '<span>' + u + '</span>'; }; } return new UserMenu(); @@ -51,26 +53,18 @@ function appname() { return ui.queryParams()['app']; } -/** - * 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; -} - // Display the menu bar var mdiv = $('menu'); var name = appname(); + mdiv.innerHTML = ui.menubar( - 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), ui.menu(name + '.' + window.location.hostname, applink(name), '_blank'))), - mklist(userMenu(), ui.menu('Account', '/account/'), ui.menu('Sign out', '/logout/'))); + append(mklist(ui.menu('Home', '/'), ui.menu('Store', '/store/')), + (isNil(name) || name == 'undefined')? + mklist() : + mklist(ui.menu('Page', '/page/?app=' + name), + ui.menu(isNil(config.compose)? 'Composition' : config.compose, '/graph/?app=' + name), + ui.menu('Stats', '/props/?app=' + name))), + mklist(ui.menu('Account', '/public/notyet.html'), 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 e26231475e..bcda316504 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/page/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/page/index.html @@ -1,20 +1,20 @@ <!-- - * 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. + * 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> @@ -24,30 +24,44 @@ <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.css"/> +<script type="text/javascript" src="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/ui.js"></script> </head> <body class="delayed"> <div id="menu"></div> -<h1><span id="h1"></span> <span id="appNameHeader" style="font-weight: normal;"></span></h1> +<h1><span id="h1"></span><span id="appNameHeader"></span></h1> <br/> <div id="page"></div> <script type="text/javascript"> +/** + * 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; +} + // Get the app name var appname = ui.queryParams()['app']; +// Update the window title +document.title = windowtitle(window.location.hostname) + ' - Page - ' + appname; +$('h1').innerHTML = hometitle(window.location.hostname); +$('appNameHeader').innerHTML = ' - <a href=\"' + applink(appname) + '\" target=\"' + '_blank' + '\">' + appname + '</a>'; + // Load the menu bar ui.loadwidget('menu', '/menu.html?app=' + appname, ui.showbody); -// Display the editor for the current app -document.title = 'Page - ' + appname; -$('h1').innerHTML = domaintitle(window.location.hostname); -$('appNameHeader').innerHTML = ' - ' + appname; - /** * Display the page editor for an app. */ diff --git a/sca-cpp/trunk/modules/edit/htdocs/page/page.html b/sca-cpp/trunk/modules/edit/htdocs/page/page.html index 2766fe6bfa..87cdd7edb8 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/page/page.html +++ b/sca-cpp/trunk/modules/edit/htdocs/page/page.html @@ -1,24 +1,25 @@ <!-- - * 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. + * 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="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/elemutil.js"></script> <script type="text/javascript" src="/xmlutil.js"></script> @@ -49,28 +50,36 @@ <tr style="height: 5000px;"><td class="tdl"></td><td class="tdr" colspan="2"></td></tr> </table> +<div id="bigscreen" style="position: absolute; left: 250px; top: 40px; right: 0px; bottom: 0px; border:1px; border-style: solid; border-color: #a2bae7; background: url(/public/grid72.png);"></div> +<div id="iosportraitscreen" class="guide" style="position: absolute; left: 250px; top: 40px; width: 320px; height: 460px;"></div> +<div id="ioslandscapescreen" class="guide" style="position: absolute; left: 250px; top: 40px; width: 480px; height: 300px;"></div> +<div id="ipadportraitscreen" class="guide" style="position: absolute; left: 250px; top: 40px; width: 768px; height: 911px;"></div> +<div id="ipadlandscapescreen" class="guide" style="position: absolute; left: 250px; top: 40px; width: 1024px; height: 655px;"></div> + <div id="page" style="position: absolute; top: 40px; left: 0px; width: 5000px; height: 5000px;"> <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: 35px;"><h2>Header2</h2></span> <span class="section" id="palette:section" style="position: absolute; left: 0px; top: 70px; width: 200px;"><span class="section">section</span></span> <span class="button" id="palette:button" style="position: absolute; left: 0px; top: 100px;"><input type="button" value="button"/></span> -<span class="entry" id="palette:entry" style="position: absolute; left: 0px; top: 130px;"><input type="text" value="field" size="20"/></span> +<span class="entry" id="palette:entry" style="position: absolute; left: 0px; top: 130px;"><input type="text" value="field" size="20" autocapitalize="off"/></span> <span class="password" id="palette:password" style="position: absolute; left: 0px; top: 160px;"><input type="password" value="password" size="20"/></span> <span class="checkbox" id="palette:checkbox" style="position: absolute; left: 0px; top: 190px;"><input type="checkbox" value="checkbox"/><span>checkbox</span></span> -<span class="list" id="palette:list" style="position: absolute; left: 0px; top: 220px;"><select><option value="list">list</option></select></span> -<span class="table" id="palette:table" style="position: absolute; left: 0px; top: 250px; width: 200px;"> +<span class="select" id="palette:select" style="position: absolute; left: 0px; top: 220px;"><select><option value="select">select</option></select></span> +<span class="list" id="palette:list" style="position: absolute; left: 0px; top: 250px; width: 200px;"> +<table class="datatable" style="width: 200px;"><tr><td class="datatd">list</td></tr><tr><td class="datatd">...</td></tr></table> +</span> +<span class="table" id="palette:table" style="position: absolute; left: 0px; top: 300px; 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> -<span class="link" id="palette:link" style="position: absolute; left: 0px; top: 300px;"><a href="/"><span>link</span></a></span> -<span class="text" id="palette:text" style="position: absolute; left: 0px; top: 330px;"><span>text</span></span> -<span class="iframe fakeframe" id="palette:iframe" style="position: absolute; left: 0px; top: 360px; width: 200px;"><a href="/public/iframe.html"><span class="fakeframe"><span>frame ...</span></span></a></span> -<span class="img" id="palette:img" style="position: absolute; left: 0px; top: 390px;"><img src="/public/img.png"/></span> +<span class="link" id="palette:link" style="position: absolute; left: 0px; top: 350px;"><a href="/"><span>link</span></a></span> +<span class="text" id="palette:text" style="position: absolute; left: 0px; top: 380px;"><span>text</span></span> +<span class="iframe fakeframe" id="palette:iframe" style="position: absolute; left: 0px; top: 410px; width: 200px;"><a href="/public/iframe.html"><span class="fakeframe"><span>frame ...</span></span></a></span> +<span class="img" id="palette:img" style="position: absolute; left: 0px; top: 430px;"><img src="/public/img.png"/></span> </div> -<div id="buffer" style="visibility: hidden; width: 0px; height: 0px"> -</div> +<div id="buffer" style="visibility: hidden; width: 0px; height: 0px"></div> </div> @@ -114,17 +123,17 @@ function getpage(name, edit) { // Convert the page to XHTML and place it in a hidden buffer var buffer = $('buffer'); var el = atompage(doc); - if (isNil(el)) { - // Create a default empty page if necessary + // Create a default empty page if necessary + if (isNil(el)) buffer.innerHTML = '<DIV id="page">\n</DIV>\n'; - } else { + else buffer.innerHTML = writeStrings(writeXML(atompage(doc), false)); - } // Append page nodes to editor map(function(e) { - e.style.left = ui.csspos(e.style.left) + 250; + if (!isNil(e.style)) + e.style.left = ui.csspos(e.style.left) + 250; edit.appendChild(e); return page.cover(e); }, nodeList(buffer.childNodes[0].childNodes)); @@ -204,12 +213,16 @@ function save() { /** * Handle a page change event */ -function onpagechange() { +function onpagechange(prop) { if (savedpagexhtml == pagexhtml()) return false; $('saveButton').value = 'Save now'; - // Autosave after 3 seconds + // Save property changes right away + if (prop) + return save(); + + // Autosave other changes after 3 seconds setTimeout(function() { if (savedpagexhtml == pagexhtml()) return false; diff --git a/sca-cpp/trunk/modules/edit/htdocs/page/page.js b/sca-cpp/trunk/modules/edit/htdocs/page/page.js index 54b3751900..7ecf5c148e 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/page/page.js +++ b/sca-cpp/trunk/modules/edit/htdocs/page/page.js @@ -38,6 +38,8 @@ if (ui.isIE()) { // Track element dragging and selection page.dragging = null; page.selected = null; + wname.disabled = true; + wtext.disabled = true; // Trigger page change events page.onpagechange = onchange; @@ -55,7 +57,9 @@ if (ui.isIE()) { // Reset current selection wname.value = ''; + wname.disabled = true; wtext.value = ''; + wtext.disabled = true; return false; } @@ -75,7 +79,9 @@ if (ui.isIE()) { // Update the widget name and text fields wname.value = page.selected.id; + wname.disabled = false; wtext.value = page.text(page.selected); + wtext.disabled = !page.hastext(page.selected); return false; }; @@ -86,6 +92,17 @@ if (ui.isIE()) { if (page.dragging == null) return false; + // Snap to grid + var newX = page.gridsnap(ui.csspos(page.dragging.style.left)); + var newY = page.gridsnap(ui.csspos(page.dragging.style.top)); + page.dragging.style.left = newX; + page.dragging.style.top = newY; + page.dragging.cover.style.left = newX; + page.dragging.cover.style.top = newY; + + // Fixup widget style + page.fixupwidget(page.dragging); + // Discard element dragged out of page area if (ui.csspos(page.dragging.style.left) < palcx && page.dragging.id.substring(0, 8) != 'palette:') { if (ui.csspos(page.dragging.style.left) >= trashcx) { @@ -99,7 +116,9 @@ if (ui.isIE()) { // Reset current selection page.selected = null; wname.value = ''; + wname.disabled = true; wtext.value = ''; + wtext.disabled = true; } } @@ -108,7 +127,7 @@ if (ui.isIE()) { elem.releaseCapture(); // Trigger page change event - page.onpagechange(); + page.onpagechange(false); return false; }; @@ -150,7 +169,7 @@ if (ui.isIE()) { page.selected.id = wname.value; // Trigger page change event - page.onpagechange(); + page.onpagechange(true); return false; }; @@ -160,7 +179,7 @@ if (ui.isIE()) { page.settext(page.selected, wtext.value); // Trigger page change event - page.onpagechange(); + page.onpagechange(true); return false; }; @@ -181,6 +200,8 @@ if (ui.isIE()) { // Track element dragging and selection page.dragging = null; page.selected = null; + wname.disabled = true; + wtext.disabled = true; // Trigger page change events page.onpagechange = onchange; @@ -201,7 +222,9 @@ if (ui.isIE()) { // Reset current selection wname.value = ''; + wname.disabled = true; wtext.value = ''; + wtext.disabled = true; return false; } @@ -221,7 +244,9 @@ if (ui.isIE()) { // Update the widget name and text fields wname.value = page.selected.id; + wname.disabled = false; wtext.value = page.text(page.selected); + wtext.disabled = !page.hastext(page.selected); return false; }; @@ -235,6 +260,17 @@ if (ui.isIE()) { if (page.dragging == null) return false; + // Snap to grid + var newX = page.gridsnap(ui.csspos(page.dragging.style.left)); + var newY = page.gridsnap(ui.csspos(page.dragging.style.top)); + page.dragging.style.left = newX; + page.dragging.style.top = newY; + page.dragging.cover.style.left = newX; + page.dragging.cover.style.top = newY; + + // Fixup widget style + page.fixupwidget(page.dragging); + // Discard element dragged out of page area if (ui.csspos(page.dragging.style.left) < palcx && page.dragging.id.substring(0, 8) != 'palette:') { if (ui.csspos(page.dragging.style.left) >= trashcx) { @@ -248,7 +284,9 @@ if (ui.isIE()) { // Reset current selection page.selected = null; wname.value = ''; + wname.disabled = true; wtext.value = ''; + wtext.disabled = true; } } @@ -256,7 +294,7 @@ if (ui.isIE()) { page.dragging = null; // Trigger page change event - page.onpagechange(); + page.onpagechange(false); return false; }; @@ -309,7 +347,7 @@ if (ui.isIE()) { page.selected.id = wname.value; // Trigger page change event - page.onpagechange(); + page.onpagechange(true); return false; }; @@ -319,7 +357,7 @@ if (ui.isIE()) { page.settext(page.selected, wtext.value); // Trigger page change event - page.onpagechange(); + page.onpagechange(true); return false; }; @@ -341,7 +379,7 @@ page.text = function(e) { return car(childElements(e)).value; if (e.className == 'entry' || e.className == 'password') return car(childElements(e)).defaultValue; - if (e.className == 'list') + if (e.className == 'select') return car(childElements(car(childElements(e)))).value; if (e.className == 'link') { var hr = car(childElements(e)).href; @@ -354,12 +392,39 @@ page.text = function(e) { } if (e.className == 'iframe') return car(childElements(e)).href; + if (e.className == 'list') + return ''; if (e.className == 'table') return ''; return ''; }; /** + * Return true if a widget has editable text. + */ +page.hastext = function(e) { + if (e.className == 'h1' || e.className == 'h2' || e.className == 'text' || e.className == 'section') + return true; + if (e.className == 'button' || e.className == 'checkbox') + 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') + return false; + return false; +}; + +/** * Set the text of a widget. */ page.settext = function(e, t) { @@ -376,12 +441,15 @@ page.settext = function(e, t) { map(function(n) { if (n.nodeName == "SPAN") n.innerHTML = t; return n; }, nodeList(e.childNodes)); return t; } - if (e.className == 'list') { + if (e.className == 'select') { var ce = car(childElements(car(childElements(e)))); ce.value = t; ce.innerHTML = t; return t; } + if (e.className == 'list') { + return ''; + } if (e.className == 'table') { return ''; } @@ -404,6 +472,30 @@ page.settext = function(e, t) { }; /** + * Initial fixup of a widget. + */ +page.fixupwidget = function(e) { + 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') { + car(childElements(e)).style.width = '100%'; + return e; + } + if (e.className == 'table') { + car(childElements(e)).style.width = '100%'; + return e; + } + return e; +} + +/** * Find a draggable element in a hierarchy of elements. */ page.draggable = function(n, e) { @@ -417,6 +509,13 @@ page.draggable = function(n, e) { } /** + * Align a pos along a 9pixel grid. + */ +page.gridsnap = function(x) { + return Math.round(x / 9) * 9; +} + +/** * Bring an element and its parent to the top. */ page.bringtotop = function(n) { diff --git a/sca-cpp/trunk/modules/edit/htdocs/props/index.html b/sca-cpp/trunk/modules/edit/htdocs/props/index.html index 8236c77153..a6a8bc92fe 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/props/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/props/index.html @@ -1,52 +1,67 @@ <!-- - * 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. + * 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>Settings</title> +<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.css"/> +<script type="text/javascript" src="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/ui.js"></script> </head> <body class="delayed"> <div id="menu"></div> -<h1><span id="h1"></span> <span id="appNameHeader" style="font-weight: normal;"></span></h1> +<h1><span id="h1"></span><span id="appNameHeader"></span></h1> <br/> <div id="props"></div> <script type="text/javascript"> +/** + * 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; +} + // Get the app name var appname = ui.queryParams()['app']; +// Update the window title +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 ui.loadwidget('menu', '/menu.html?app=' + appname, ui.showbody); -document.title = 'Settings - ' + appname; -$('h1').innerHTML = domaintitle(window.location.hostname); -$('appNameHeader').innerHTML = ' - ' + appname; - /** * Display the properties editor for an app. */ diff --git a/sca-cpp/trunk/modules/edit/htdocs/props/props.html b/sca-cpp/trunk/modules/edit/htdocs/props/props.html index 698dfb2b57..93910a2022 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/props/props.html +++ b/sca-cpp/trunk/modules/edit/htdocs/props/props.html @@ -1,24 +1,25 @@ <!-- - * 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. + * 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="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/elemutil.js"></script> <script type="text/javascript" src="/xmlutil.js"></script> @@ -33,7 +34,7 @@ <table style="width: 100%;"> <tr> -<th class="thl thr" style="padding-top: 4px; padding-bottom: 4px;">Settings</th> +<th class="thl thr" style="padding-top: 4px; padding-bottom: 4px;">Stats</th> <th class="thl thr" style="padding-top: 0px; padding-bottom: 0px; padding-right: 0px; text-align: right;"> <input type="button" id="saveButton" title="Save the app" style="font-weight: bold;" Value="Saved"/> diff --git a/sca-cpp/trunk/modules/edit/htdocs/public/grid72.png b/sca-cpp/trunk/modules/edit/htdocs/public/grid72.png Binary files differnew file mode 100644 index 0000000000..cf6008171a --- /dev/null +++ b/sca-cpp/trunk/modules/edit/htdocs/public/grid72.png diff --git a/sca-cpp/trunk/modules/edit/htdocs/public/iframe.html b/sca-cpp/trunk/modules/edit/htdocs/public/iframe.html index 8c5bc03a91..cc44f5d428 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/public/iframe.html +++ b/sca-cpp/trunk/modules/edit/htdocs/public/iframe.html @@ -1,20 +1,20 @@ <!-- - * 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. + * 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> diff --git a/sca-cpp/trunk/modules/edit/htdocs/public/notauth.html b/sca-cpp/trunk/modules/edit/htdocs/public/notauth.html index c34f4b1f03..a283b3e89e 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/public/notauth.html +++ b/sca-cpp/trunk/modules/edit/htdocs/public/notauth.html @@ -1,20 +1,20 @@ <!-- - * 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. + * 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> @@ -23,6 +23,7 @@ <meta name="apple-mobile-web-app-capable" content="yes"/> <meta name="apple-mobile-web-app-status-bar-style" content="black"/> <link rel="stylesheet" type="text/css" href="/ui.css"/> +<script type="text/javascript" src="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/ui.js"></script> </head> @@ -32,7 +33,7 @@ <h1 id="h1"></h1> <br/> -<div class="hd1">Sorry, you're not authorized to view this page.</div> +<div class="hd2">Sorry, you're not authorized to view this page.</div> <form name="signout" action="/public/notauth.html" method="GET"> </form> @@ -43,7 +44,7 @@ if (!issubdomain(window.location.hostname)) ui.loadwidget('menu', '/menu.html', ui.showbody); -$('h1').innerHTML = domaintitle(window.location.hostname); +$('h1').innerHTML = hometitle(window.location.hostname); if (issubdomain(window.location.hostname)) ui.showbody(); diff --git a/sca-cpp/trunk/modules/edit/htdocs/public/notfound.html b/sca-cpp/trunk/modules/edit/htdocs/public/notfound.html index ecd0a160fd..da56789a66 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/public/notfound.html +++ b/sca-cpp/trunk/modules/edit/htdocs/public/notfound.html @@ -1,20 +1,20 @@ <!-- - * 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. + * 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> @@ -23,6 +23,7 @@ <meta name="apple-mobile-web-app-capable" content="yes"/> <meta name="apple-mobile-web-app-status-bar-style" content="black"/> <link rel="stylesheet" type="text/css" href="/ui.css"/> +<script type="text/javascript" src="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/ui.js"></script> </head> @@ -32,7 +33,7 @@ <h1 id="h1"></h1> <br/> -<div class="hd1">Sorry, that page was not found.</div> +<div class="hd2">Sorry, that page was not found.</div> <div>You may have clicked an expired link or mistyped the address.</div> <script type="text/javascript"> @@ -41,7 +42,7 @@ if (!issubdomain(window.location.hostname)) ui.loadwidget('menu', '/menu.html', ui.showbody); -$('h1').innerHTML = domaintitle(window.location.hostname); +$('h1').innerHTML = hometitle(window.location.hostname); if (issubdomain(window.location.hostname)) ui.showbody(); diff --git a/sca-cpp/trunk/modules/edit/htdocs/public/notyet.html b/sca-cpp/trunk/modules/edit/htdocs/public/notyet.html new file mode 100644 index 0000000000..7a6a82ded6 --- /dev/null +++ b/sca-cpp/trunk/modules/edit/htdocs/public/notyet.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>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"/> +<link rel="stylesheet" type="text/css" href="/ui.css"/> +<script type="text/javascript" src="/config.js"></script> +<script type="text/javascript" src="/util.js"></script> +<script type="text/javascript" src="/ui.js"></script> +</head> +<body class="delayed"> +<div id="menu"></div> + +<h1 id="h1"></h1> +<br/> + +<div class="hd2">Sorry, that page is still under construction.</div> +<div>Please check back later.</div> + +<script type="text/javascript"> + +// Load the menu bar +if (!issubdomain(window.location.hostname)) + ui.loadwidget('menu', '/menu.html', ui.showbody); + +$('h1').innerHTML = hometitle(window.location.hostname); + +if (issubdomain(window.location.hostname)) + ui.showbody(); +</script> + +</body> +</html> diff --git a/sca-cpp/trunk/modules/edit/htdocs/public/oops.html b/sca-cpp/trunk/modules/edit/htdocs/public/oops.html index bd1e488c5e..4c926ac6d2 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/public/oops.html +++ b/sca-cpp/trunk/modules/edit/htdocs/public/oops.html @@ -1,20 +1,20 @@ <!-- - * 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. + * 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> @@ -23,6 +23,7 @@ <meta name="apple-mobile-web-app-capable" content="yes"/> <meta name="apple-mobile-web-app-status-bar-style" content="black"/> <link rel="stylesheet" type="text/css" href="/ui.css"/> +<script type="text/javascript" src="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/ui.js"></script> </head> @@ -32,7 +33,7 @@ <h1 id="h1"></h1> <br/> -<div class="hd1">Oops, something went wrong...</div> +<div class="hd2">Oops, something went wrong...</div> <script type="text/javascript"> @@ -40,7 +41,7 @@ if (!issubdomain(window.location.hostname)) ui.loadwidget('menu', '/menu.html', ui.showbody); -$('h1').innerHTML = domaintitle(window.location.hostname); +$('h1').innerHTML = hometitle(window.location.hostname); if (issubdomain(window.location.hostname)) ui.showbody(); diff --git a/sca-cpp/trunk/modules/edit/htdocs/store/index.html b/sca-cpp/trunk/modules/edit/htdocs/store/index.html index 6037746383..596f2e00c8 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/store/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/store/index.html @@ -1,31 +1,35 @@ <!-- - * 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. + * 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> +<title>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"/> <link rel="apple-touch-icon" href="/public/touchicon.png"/> <link rel="stylesheet" type="text/css" href="/ui.css"/> +<script type="text/javascript" src="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/ui.js"></script> +<script type="text/javascript"> +document.title = windowtitle(window.location.hostname) + ' - Store'; +</script> </head> <body class="delayed"> <div id="menu"></div> @@ -40,12 +44,12 @@ // Load the menu bar ui.loadwidget('menu', '/menu.html', ui.showbody); -$('h1').innerHTML = domaintitle(window.location.hostname); +$('h1').innerHTML = hometitle(window.location.hostname); // Get the store category var category = ui.queryParams()['category']; if (isNil(category)) - category = 'new'; + category = 'myapps'; // Load the store $('store').innerHTML = diff --git a/sca-cpp/trunk/modules/edit/htdocs/store/store.html b/sca-cpp/trunk/modules/edit/htdocs/store/store.html index 33285d9145..c074cc24c2 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/store/store.html +++ b/sca-cpp/trunk/modules/edit/htdocs/store/store.html @@ -1,24 +1,25 @@ <!-- - * 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. + * 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="/config.js"></script> <script type="text/javascript" src="/util.js"></script> <script type="text/javascript" src="/elemutil.js"></script> <script type="text/javascript" src="/xmlutil.js"></script> @@ -44,24 +45,24 @@ if (ui.isIE()) $('bodydiv').style.right = -20; */ var category = ui.queryParams()['category']; if (isNil(category)) - category = 'new'; + category = 'myapps'; +log('category', category); /** * Build store menu bar */ function catmenu() { function catmenuitem(name, cat) { - var c = cat == category? "smenu" : "amenu"; + var c = cat == category? 'smenu' : 'amenu'; return '<th class="thl thr" style="width: 30px; padding-top: 4px; padding-bottom: 4px; padding-right: 10px;">' - + '<a href="/store/?category=' + cat + '" target="_parent"><span class="' + c + '">' + name + '</span></a></th>'; + + ui.ahref('/store/?category=' + cat, '_parent', '<span class="' + c + '">' + name + '</span>') + '</th>'; } var m = '<table style="width: 100%;"><tr>'; + m += catmenuitem('My Apps', 'myapps'); m += catmenuitem('New Apps', 'new'); m += catmenuitem('Top Charts', 'top'); m += catmenuitem('Featured', 'featured'); - m += catmenuitem('Services', 'services'); - m += catmenuitem('Tests', 'tests'); m += '<th class="thl thr" style="width: 100%;"></th></tr></table>'; return m; } @@ -74,6 +75,7 @@ $('catmenu').innerHTML = catmenu(); */ var editWidget = sca.component("EditWidget"); var store = sca.reference(editWidget, "store"); +var dashboard = sca.reference(editWidget, "dashboard"); /** * Return the link to an app. @@ -89,31 +91,49 @@ function applink(appname) { } /** + * Edit an app. + */ +function editApp(appname) { + return window.open('/page?app=' + appname, '_parent'); +} + +/** + * Clone an app. + */ +function cloneApp(appname) { + return window.open('/public/notyet.html', '_parent'); +} + +/** * Get and display list of apps. */ -function getapps(category, sync) { +function getapps(category) { 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=\"' + '_blank' + '\">'; + var title = cadr(assoc("'title", entry)) + var name = cadr(assoc("'id", entry)) + var author = 'joe@localhost'; + var clone = isNil(config.clone)? 'Clone' : config.clone; 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" width="50" height="50" 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 += '<div>' + ui.ahref(applink(name), '_blank', '<img src="/public/app.png" width="50" height="50" style="height: 50px; width: 50px; vertical-align: top; margin-right: 10px; margin-bottom: 5px;"></img>') + '</div>'; + apps += '<div><input type="button" id="cloneApp" value="' + clone + '" title="' + clone + ' this app" onclick="cloneApp(\'' + name + '\');"></div>'; + if (category == 'myapps') + apps += '<div><input type="button" id="editApp" value="Edit" title="Edit this app" onclick="editApp(\'' + name + '\');"></div>'; apps += '</td>'; apps += '<td class="tdw">'; - apps += '<div style="font-weight: bold">' + hreflink + name + '</a></div>'; + apps += '<div style="font-weight: bold">' + ui.ahref(applink(name), '_blank', name) + '</div>'; apps += '<div>' + 'by ' + '<span style="font-weight: bold;">' + author + '</span></div>'; + apps += '<div>Feb 4, 2011</div>'; apps += '<br/>'; apps += '<div>' + title + '</div>'; + apps += '<br/>'; apps += '</td>'; apps += '</tr></table>'; apps += '</div>'; @@ -125,17 +145,20 @@ function getapps(category, sync) { ui.showbody(); } - if (sync) { - display(store.get(category)); - } else { - store.get(category, function(doc) { + if (category == 'myapps') { + dashboard.get('', function(doc) { display(doc); }); + return true; } + store.get(category, function(doc) { + display(doc); + }); + return true; } // Get and display the list of apps -getapps(category, true); +getapps(category); </script> </body> diff --git a/sca-cpp/trunk/modules/edit/mkapplinks b/sca-cpp/trunk/modules/edit/mkapplinks index ac7baf4f17..7d30f1002f 100755 --- a/sca-cpp/trunk/modules/edit/mkapplinks +++ b/sca-cpp/trunk/modules/edit/mkapplinks @@ -33,6 +33,7 @@ done for n in `ls apps | awk '{ printf "apps/%s/htdocs\n", $1 }'`; do if [ ! -e "$n" ]; then mkdir "$n" + ln -s ../../../htdocs/cache-manifest.cmf "$n/cache-manifest.cmf" ln -s ../../../htdocs/login "$n/login" ln -s ../../../htdocs/logout "$n/logout" ln -s ../../../htdocs/public "$n/public" diff --git a/sca-cpp/trunk/modules/http/conf/mime.types b/sca-cpp/trunk/modules/http/conf/mime.types index 4279f51bca..c0dba0ef86 100644 --- a/sca-cpp/trunk/modules/http/conf/mime.types +++ b/sca-cpp/trunk/modules/http/conf/mime.types @@ -539,6 +539,7 @@ multipart/related multipart/report multipart/signed multipart/voice-message +text/cache-manifest cmf text/calendar ics ifb text/css css text/directory diff --git a/sca-cpp/trunk/modules/js/htdocs/scdl.js b/sca-cpp/trunk/modules/js/htdocs/scdl.js index b2e1464b9e..417bb37dfc 100644 --- a/sca-cpp/trunk/modules/js/htdocs/scdl.js +++ b/sca-cpp/trunk/modules/js/htdocs/scdl.js @@ -90,6 +90,13 @@ scdl.title = function(l) { }; /** + * Returns the display style of a component, componentType, reference or property. + */ +scdl.style = function(l) { + return namedAttributeValue("'t:style", l); +}; + +/** * Returns the color of a component or componentType. */ scdl.color = function(l) { diff --git a/sca-cpp/trunk/modules/js/htdocs/ui.css b/sca-cpp/trunk/modules/js/htdocs/ui.css index 7800217060..ca1f42fa0f 100644 --- a/sca-cpp/trunk/modules/js/htdocs/ui.css +++ b/sca-cpp/trunk/modules/js/htdocs/ui.css @@ -53,6 +53,11 @@ border-style: solid; border-top-color: #a2bae7; border-bottom-color: #d1d3d4; bo overflow: hidden; } +.text { +padding-top: 3px; padding-bottom: 4px; vertical-align: text-top; +vertical-align: text-top; +} + .thl { border-left: 0px; } @@ -81,6 +86,10 @@ border-left: 1px; border-style: solid; border-color: #a2bae7; padding-left: 2px; padding-top: 2px; padding-right: 8px; white-space: normal; vertical-align: text-top; } +.datatd { +border-top: 1px; border-bottom: 1px; border-style: solid; border-color: #dcdcdc; width: 10px; vertical-align: top; +} + .datatdl { border-right: 1px; border-top: 1px; border-bottom: 1px; border-style: solid; border-color: #dcdcdc; width: 10px; vertical-align: top; } @@ -100,6 +109,10 @@ opacity: .6; filter: alpha(opacity=60); } +.guide { +border: 1px; border-style: solid; border-color: #c0c0c0; +} + iframe { border: 0px; margin: 0px; padding: 0px; } @@ -177,17 +190,22 @@ cursor: pointer; cursor: hand; } .tbar { -margin: 0px; +margin: 0px; width: 100%; padding-top: 0px; padding-left: 0px; padding-right: 0px; padding-bottom: 3px; border-bottom: 1px solid #a2bae7; border-collapse: separate; } .ltbar { -padding-left: 0px; padding-top: 0px; padding-right: 8px; white-space: nowrap; vertical-align: top; +padding-left: 0px; padding-top: 0px; padding-right: 6px; white-space: nowrap; vertical-align: top; +} + +.dtbar { +padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: nowrap; vertical-align: top; +text-align: right; } .rtbar { -padding-left: 8px; padding-right: 0px; padding-top: 0px; white-space: nowrap; vertical-align: top; +padding-left: 6px; padding-right: 0px; padding-top: 0px; white-space: nowrap; vertical-align: top; text-align: right; } diff --git a/sca-cpp/trunk/modules/js/htdocs/ui.js b/sca-cpp/trunk/modules/js/htdocs/ui.js index 5c1f45e244..20b2cd0579 100644 --- a/sca-cpp/trunk/modules/js/htdocs/ui.js +++ b/sca-cpp/trunk/modules/js/htdocs/ui.js @@ -34,6 +34,20 @@ ui.isIE = function() { }; /** + * Build a portable href attribute. + */ +ui.href = function(loc, target) { + return 'javascript:window.open(\'' + loc + '\', \'' + target + '\');'; +}; + +/** + * Build a portable <a href> tag. + */ +ui.ahref = function(loc, target, html) { + return '<a href="' + ui.href(loc, target) + '">' + html + '</a>'; +}; + +/** * Build a menu bar. */ ui.menu = function(name, href, target) { @@ -55,23 +69,23 @@ ui.menu = function(name, href, target) { } if (complete(this.href) != complete(window.top.location.pathname)) - return '<a href="' + this.href + '" target="' + this.target + '"><span class=amenu>' + this.name + '</span></a>'; - return '<a href="' + this.href + '" target="' + this.target + '"><span class=smenu>' + this.name + '</span></a>'; + return ui.ahref(this.href, this.target, '<span class="amenu">' + this.name + '</span>'); + return ui.ahref(this.href, this.target, '<span class="smenu">' + this.name + '</span>'); }; } return new Menu(name, href, target); }; ui.menubar = function(left, right) { - var bar = '<table cellpadding="0" cellspacing="0" width="100%" class=tbar><tr>' + - '<td class=ltbar><table border="0" cellspacing="0" cellpadding="0"><tr>'; + var bar = '<table cellpadding="0" cellspacing="0" width="100%" class="tbar"><tr>' + + '<td class="dtbar"><table border="0" cellspacing="0" cellpadding="0"><tr>'; for (i in left) - bar = bar + '<td class=ltbar>' + left[i].content() + '</td>' + bar = bar + '<td class="ltbar">' + left[i].content() + '</td>' bar = bar + '</tr></table></td>' + - '<td class=rtbar><table border="0" cellpadding="0" cellspacing="0" align="right"><tr>'; + '<td class="dtbar"><table border="0" cellpadding="0" cellspacing="0" align="right"><tr>'; for (i in right) - bar = bar + '<td class=rtbar>' + right[i].content() + '</td>' + bar = bar + '<td class="' + (i == 0? 'dtbar' : 'rtbar') + '">' + right[i].content() + '</td>' bar = bar + '</tr></table></td></tr></table>'; return bar; @@ -135,7 +149,7 @@ ui.suggest = function(input, suggestFunction) { if (values[i].indexOf(this.value) == -1) continue; if (items.length == 0) - items += '<table class=suggestTable>'; + items += '<table class="suggestTable">'; items += '<tr><td class="suggestItem" ' + 'onmouseover="ui.hilightSuggestion(this, true)" onmouseout="ui.hilightSuggestion(this, false)" ' + 'onmousedown="ui.selectSuggestion(this, \'' + values[i] + '\')">' + values[i] + '</td></tr>'; @@ -321,7 +335,7 @@ ui.datatable = function(l) { var v = elementValue(e); if (!isList(v)) { return '<tr><td class="datatdl">' + indent(i) + elementName(e).slice(1) + '</td>' + - '<td class="datatdr tdw">' + v + '</td></tr>' + + '<td class="datatdr tdw">' + (v != null? v : '') + '</td></tr>' + rows(cdr(l), i); } @@ -338,3 +352,39 @@ ui.datatable = function(l) { return '<table class="datatable ' + (window.name == 'dataFrame'? ' databg' : '') + '" style="width: 100%;">' + rows(l, 0) + '</table>'; } +/** + * Convert a list of elements to an HTML single column table. + */ +ui.datalist = function(l) { + + function rows(l, i) { + if (isNil(l)) + return ''; + var e = car(l); + + // Convert a list of simple values into a list of name value pairs + if (!isList(e)) + return rows(expandElementValues("'value", l), i); + + // Convert a list of complex values into a list of name value pairs + if (isList(car(e))) + return rows(expandElementValues("'value", l), i); + + // Generate table row for a simple element value + if (elementHasValue(e)) { + var v = elementValue(e); + if (!isList(v)) { + return '<tr><td class="datatd tdw">' + (v != null? v : '') + '</td></tr>' + + rows(cdr(l), i); + } + + return rows(expandElementValues(elementName(e), v), i) + rows(cdr(l), i); + } + + // Generate rows for an element's children + return rows(elementChildren(e), i + 1) + rows(cdr(l), i); + } + + return '<table class="datatable ' + (window.name == 'dataFrame'? ' databg' : '') + '" style="width: 100%;">' + rows(l, 0) + '</table>'; +} + diff --git a/sca-cpp/trunk/modules/js/htdocs/uicyan.css b/sca-cpp/trunk/modules/js/htdocs/uicyan.css index d3089c8ff3..ca1f42fa0f 100644 --- a/sca-cpp/trunk/modules/js/htdocs/uicyan.css +++ b/sca-cpp/trunk/modules/js/htdocs/uicyan.css @@ -53,6 +53,11 @@ border-style: solid; border-top-color: #a2bae7; border-bottom-color: #d1d3d4; bo overflow: hidden; } +.text { +padding-top: 3px; padding-bottom: 4px; vertical-align: text-top; +vertical-align: text-top; +} + .thl { border-left: 0px; } @@ -81,6 +86,10 @@ border-left: 1px; border-style: solid; border-color: #a2bae7; padding-left: 2px; padding-top: 2px; padding-right: 8px; white-space: normal; vertical-align: text-top; } +.datatd { +border-top: 1px; border-bottom: 1px; border-style: solid; border-color: #dcdcdc; width: 10px; vertical-align: top; +} + .datatdl { border-right: 1px; border-top: 1px; border-bottom: 1px; border-style: solid; border-color: #dcdcdc; width: 10px; vertical-align: top; } @@ -100,6 +109,10 @@ opacity: .6; filter: alpha(opacity=60); } +.guide { +border: 1px; border-style: solid; border-color: #c0c0c0; +} + iframe { border: 0px; margin: 0px; padding: 0px; } @@ -177,17 +190,22 @@ cursor: pointer; cursor: hand; } .tbar { -margin: 0px; +margin: 0px; width: 100%; padding-top: 0px; padding-left: 0px; padding-right: 0px; padding-bottom: 3px; border-bottom: 1px solid #a2bae7; border-collapse: separate; } .ltbar { -padding-left: 0px; padding-top: 0px; padding-right: 8px; white-space: nowrap; vertical-align: top; +padding-left: 0px; padding-top: 0px; padding-right: 6px; white-space: nowrap; vertical-align: top; +} + +.dtbar { +padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: nowrap; vertical-align: top; +text-align: right; } .rtbar { -padding-left: 8px; padding-right: 0px; padding-top: 0px; white-space: nowrap; vertical-align: top; +padding-left: 6px; padding-right: 0px; padding-top: 0px; white-space: nowrap; vertical-align: top; text-align: right; } @@ -218,8 +236,10 @@ padding-left: 2px; padding-top: 0px; padding-bottom: 0px; padding-right: 2px; ve background-color: #598edd; color: #e5ecf9; } +/* v\: * { behavior:url(#default#VML); display:inline-block; } +*/ diff --git a/sca-cpp/trunk/modules/js/htdocs/util.js b/sca-cpp/trunk/modules/js/htdocs/util.js index 3719a9cecc..69359fa167 100644 --- a/sca-cpp/trunk/modules/js/htdocs/util.js +++ b/sca-cpp/trunk/modules/js/htdocs/util.js @@ -208,6 +208,13 @@ function debug(o) { } /** + * External build configuration. + */ +var config; +if (isNil(config)) + config = {} + +/** * Simple assert function. */ function AssertException() { @@ -301,9 +308,22 @@ function issubdomain(host) { } /** - * Convert a host name to a domain name title. + * Convert a host name to a home page title. + */ +function hometitle(host) { + if (!isNil(config.hometitle)) + return config.hometitle; + var h = reverse(host.split('.')); + var d = isNil(cdr(h))? car(h) : cadr(h); + return d.substr(0, 1).toUpperCase() + d.substr(1); +} + +/** + * Convert a host name to a window title. */ -function domaintitle(host) { +function windowtitle(host) { + if (!isNil(config.windowtitle)) + return config.windowtitle; var h = reverse(host.split('.')); var d = isNil(cdr(h))? car(h) : cadr(h); return d.substr(0, 1).toUpperCase() + d.substr(1); |