diff options
Diffstat (limited to 'sca-cpp/trunk/modules/edit')
-rw-r--r-- | sca-cpp/trunk/modules/edit/edit.composite | 7 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/edit/htdocs/app/cache-manifest.cmf | 1 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/edit/htdocs/app/index.html | 59 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/edit/htdocs/clone/index.html | 20 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/edit/htdocs/create/index.html | 5 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/edit/htdocs/graph/index.html | 20 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/edit/htdocs/notauth/index.html | 2 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/edit/htdocs/notfound/index.html | 2 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/edit/htdocs/notyet/index.html | 2 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/edit/htdocs/oops/index.html | 2 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/edit/htdocs/page/index.html | 14 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/edit/htdocs/stats/index.html | 15 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/edit/htdocs/store/index.html | 15 | ||||
-rwxr-xr-x | sca-cpp/trunk/modules/edit/ssl-start | 66 | ||||
-rwxr-xr-x | sca-cpp/trunk/modules/edit/start | 51 |
15 files changed, 105 insertions, 176 deletions
diff --git a/sca-cpp/trunk/modules/edit/edit.composite b/sca-cpp/trunk/modules/edit/edit.composite index 85ae67d8b4..0e348fd105 100644 --- a/sca-cpp/trunk/modules/edit/edit.composite +++ b/sca-cpp/trunk/modules/edit/edit.composite @@ -48,6 +48,13 @@ <reference name="log" target="Log"/> </component> + <component name="AppWidget"> + <implementation.widget location="/app/index.html"/> + <reference name="user" target="User"/> + <reference name="pages" target="Pages"/> + <reference name="log" target="Log"/> + </component> + <component name="Accounts"> <implementation.python script="accounts.py"/> <service name="Accounts"> diff --git a/sca-cpp/trunk/modules/edit/htdocs/app/cache-manifest.cmf b/sca-cpp/trunk/modules/edit/htdocs/app/cache-manifest.cmf index 0be3e662d7..b478c7cd3d 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/app/cache-manifest.cmf +++ b/sca-cpp/trunk/modules/edit/htdocs/app/cache-manifest.cmf @@ -3,7 +3,6 @@ CACHE MANIFEST # Version 5 # App resources -/ /favicon.ico /notauth/ /notfound/ diff --git a/sca-cpp/trunk/modules/edit/htdocs/app/index.html b/sca-cpp/trunk/modules/edit/htdocs/app/index.html index 773d2adf90..97ea0a3f79 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/app/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/app/index.html @@ -17,7 +17,7 @@ * specific language governing permissions and limitations * under the License. --> -<html manifest="/cache-manifest.cmf"> +<html manifest="cache-manifest.cmf"> <head> <title></title> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"/> @@ -87,8 +87,13 @@ $('headdiv').appendChild(ui.declareScript(appcache.get('/headconfig-min.js'))); <script type="text/javascript"> -// Set the document title -document.title = location.hostname.split('.')[0]; +/** + * Get the app name + */ +var appname = location.pathname.split('/')[1]; + +// Set page title +document.title = appname; /** * The main page div. @@ -98,12 +103,13 @@ var contentdiv = $('content'); /** * Initialize the app HTTP clients. */ -var pagecomp = sca.httpclient('page', ''); -var startcomp = sca.httpclient('start', '/start'); -var stopcomp = sca.httpclient('stop', '/stop'); -var timercomp = sca.httpclient('timer', '/timer'); -var animationcomp = sca.httpclient('animation', '/animation'); -var locationcomp = sca.httpclient('location', '/location'); +var appWidget = sca.component('AppWidget'); +var pagecomp = sca.reference(appWidget, 'pages'); +var startcomp = sca.httpclient('start', '/' + appname + '/start'); +var stopcomp = sca.httpclient('stop', '/' + appname + '/stop'); +var timercomp = sca.httpclient('timer', '/' + appname + '/timer'); +var animationcomp = sca.httpclient('animation', '/' + appname + '/animation'); +var locationcomp = sca.httpclient('location', '/' + appname + '/location'); /** * Pre-fetch app resources. @@ -414,11 +420,11 @@ function docdata(doc) { /** * Bind a handler to a widget. */ -function bindwidgethandler(e) { +function bindwidgethandler(e, appname) { if (e.className == 'button') { var b = car(childElements(e)); b.name = e.id; - b.onclick = function() { return buttonClickHandler(b.value); }; + b.onclick = function() { return buttonClickHandler(b.value, appname); }; return e; } if (e.className == 'link') { @@ -427,7 +433,7 @@ function bindwidgethandler(e) { if (hr.substring(0, 5) == 'link:' && hr.indexOf('://') == -1) { var f = function(e) { e.preventDefault(); - return buttonClickHandler(hr.substring(5)); + return buttonClickHandler(hr.substring(5), appname); }; l.ontouchstart = l.onclick = f; l.href = 'javascript:void()'; @@ -528,7 +534,7 @@ function initwidget(e) { /** * Get app data from the main app page component. */ -function getpagedata() { +function getpagedata(appname) { try { // Display component data on the page @@ -552,7 +558,7 @@ function getpagedata() { function setupwidget(e) { initwidget(e); fixupwidget(e); - bindwidgethandler(e); + bindwidgethandler(e, appname); } // Setup the widgets @@ -634,10 +640,10 @@ function compquery() { /** * Handle a button click event. */ -function buttonClickHandler(id) { +function buttonClickHandler(id, appname) { try { var uri = compquery(); - return sca.component(id).get(uri, function(doc, e) { + return sca.component(id, appname).get(uri, function(doc, e) { if (isNil(doc)) { log('error on get(button, ' + uri + ')', e); return false; @@ -824,8 +830,21 @@ function setupLocationHandler() { return true; } +/** + * Return the page in an ATOM entry. + */ +function atompage(doc) { + var entry = atom.readATOMEntry(mklist(doc)); + if (isNil(entry)) + return mklist(); + var content = namedElementChild("'content", car(entry)); + if (content == null) + return mklist(); + return elementChildren(content); +} + // Load the app page -pagecomp.get('app.html', function(doc, e) { +pagecomp.get(appname, function(doc, e) { //log('page get'); if (isNil(doc)) { log('error getting app page', e); @@ -833,10 +852,12 @@ pagecomp.get('app.html', function(doc, e) { } // Set the app HTML page into the content div - contentdiv.innerHTML = doc; + //log('page', doc); + var el = atompage(doc); + contentdiv.innerHTML = writeStrings(writeXML(el, false)); // Merge in the app data - getpagedata(); + getpagedata(appname); }); /** diff --git a/sca-cpp/trunk/modules/edit/htdocs/clone/index.html b/sca-cpp/trunk/modules/edit/htdocs/clone/index.html index dd041e591e..3642634ed6 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/clone/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/clone/index.html @@ -35,7 +35,7 @@ <form id="cloneAppForm"> <table style="width: 100%;"> <tr><td><b>New App Name:</b></td></tr> -<tr><td><input type="text" id="appName" size="15" autocapitalize="off" placeholder="Your app name"/> <span id="appDomain"></span></td></tr> +<tr><td><input type="text" id="appName" size="15" autocapitalize="off" placeholder="Your app name"/></td></tr> <tr><tr><td style="padding-top: 6px;"><b>App Icon:</b></td></tr> <tr><td><img id="appimg" style="width: 50px; height: 50px; vertical-align: top;"></td></tr> <tr><tr><td style="padding-top: 6px;"><b>Sharing:</b></td></tr> @@ -56,23 +56,10 @@ // Get the app name var appname = ui.fragmentParams(location)['app']; -/** - * Return the link to an app. - */ -function applink(appname) { - var protocol = location.protocol; - var host = location.hostname; - var port = ':' + location.port; - if (port == ':80' || port == ':443' || port == ':') - port = ''; - var link = protocol + '//' + appname + '.' + host + port + '/'; - return link; -} - // Set page titles var tclone = isNil(config.clone)? 'Clone' : config.clone; document.title = ui.windowtitle(location.hostname) + ' - ' + tclone + ' - ' + appname; -$('appNameHeader').innerHTML = '<a href=\"' + applink(appname) + '\" target=\"' + '_blank' + '\">' + appname + '</a>'; +$('appNameHeader').innerHTML = '<a href=\"/' + appname + '/\" target=\"' + '_blank' + '\">' + appname + '</a>'; $('th').innerHTML = tclone + ' this App'; $('cloneAppOKButton').value = tclone; $('cloneAppOKButton').title = tclone + ' this app'; @@ -80,9 +67,6 @@ $('cloneAppOKButton').title = tclone + ' this app'; // Set images $('appimg').src = ui.b64img(appcache.get('/public/app.b64')); -// Init form -$('appDomain').innerHTML = '.' + location.hostname; - // Init service references var editWidget = sca.component("EditWidget"); var dashboards = sca.reference(editWidget, "dashboards"); diff --git a/sca-cpp/trunk/modules/edit/htdocs/create/index.html b/sca-cpp/trunk/modules/edit/htdocs/create/index.html index c74c00950d..6097053cd6 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/create/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/create/index.html @@ -35,7 +35,7 @@ <form id="createAppForm"> <table style="width: 100%;"> <tr><td><b>App Name:</b></td></tr> -<tr><td><input type="text" id="appName" size="15" autocapitalize="off" placeholder="Your app name"/> <span id="appDomain"></span></td></tr> +<tr><td><input type="text" id="appName" size="15" autocapitalize="off" placeholder="Your app name"/></td></tr> <tr><tr><td style="padding-top: 6px;"><b>App Icon:</b></td></tr> <tr><td><img id="appimg" style="width: 50px; height: 50px; vertical-align: top;"></td></tr> <tr><tr><td style="padding-top: 6px;"><b>Sharing:</b></td></tr> @@ -60,9 +60,6 @@ $('h1').innerHTML = ui.hometitle(location.hostname); // Set images $('appimg').src = ui.b64img(appcache.get('/public/app.b64')); -// Init form -$('appDomain').innerHTML = '.' + location.hostname; - // Init service references var editWidget = sca.component("EditWidget"); var dashboards = sca.reference(editWidget, "dashboards"); diff --git a/sca-cpp/trunk/modules/edit/htdocs/graph/index.html b/sca-cpp/trunk/modules/edit/htdocs/graph/index.html index 77fa1d4888..1732590079 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/graph/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/graph/index.html @@ -68,22 +68,9 @@ if (isNil(appname)) { ispalette = true; } -/** - * Return the link to an app. - */ -function applink(appname) { - var protocol = location.protocol; - var host = location.hostname; - var port = ':' + location.port; - if (port == ':80' || port == ':443' || port == ':') - port = ''; - var link = protocol + '//' + appname + '.' + host + port + '/'; - return link; -} - // Set page titles document.title = ui.windowtitle(location.hostname) + ' - ' + (isNil(config.compose)? 'Composition' : config.compose) + ' - ' + appname; -$('appNameHeader').innerHTML = '<a href=\"' + applink(appname) + '\" target=\"' + '_blank' + '\">' + appname + '</a>'; +$('appNameHeader').innerHTML = '<a href=\"/' + appname + '/\" target=\"' + '_blank' + '\">' + appname + '</a>'; /** * Component value field, add, delete and play buttons. @@ -2060,7 +2047,7 @@ function complink(appname, cname) { var port = ':' + location.port; if (port == ':80' || port == ':443' || port == ':') port = ''; - var link = protocol + '//' + appname + '.' + host + port + '/c/' + cname; + var link = protocol + '//' + host + port + '/' + appname + '/c/' + cname; return link; } @@ -2090,8 +2077,7 @@ function showdata(gcomp) { return true; if (isNil(gcomp)) return true; - var clink = complink(appname, gcomp.id); - cvalue.value = clink; + cvalue.value = complink(appname, gcomp.id); cplay.innerHTML = '<'; gvisible = false; pdiv.innerHTML = ''; diff --git a/sca-cpp/trunk/modules/edit/htdocs/notauth/index.html b/sca-cpp/trunk/modules/edit/htdocs/notauth/index.html index 4665e9f571..b44ccb26e9 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/notauth/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/notauth/index.html @@ -113,7 +113,7 @@ function showmenu(mdiv) { mklist(ui.menu('Account', '/#view=account', '_view', false), ui.menu('Sign out', '/logout/', '_self', false))); } -showmenu($('menu')); +showmenu(mdiv); cdiv.style.top = ui.pixpos(mdiv.offsetTop + mdiv.offsetHeight); /** diff --git a/sca-cpp/trunk/modules/edit/htdocs/notfound/index.html b/sca-cpp/trunk/modules/edit/htdocs/notfound/index.html index 8601fbfea6..6b3bb09824 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/notfound/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/notfound/index.html @@ -115,7 +115,7 @@ function showmenu(mdiv) { } showmenu(mdiv); -div.style.top = ui.pixpos(mdiv.offsetTop + mdiv.offsetHeight); +cdiv.style.top = ui.pixpos(mdiv.offsetTop + mdiv.offsetHeight); /** * Handle orientation change. diff --git a/sca-cpp/trunk/modules/edit/htdocs/notyet/index.html b/sca-cpp/trunk/modules/edit/htdocs/notyet/index.html index 60c774d8ea..d01e535299 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/notyet/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/notyet/index.html @@ -114,7 +114,7 @@ function showmenu(mdiv) { mklist(ui.menu('Account', '/#view=account', '_view', false), ui.menu('Sign out', '/logout/', '_self', false))); } -showmenu($('menu')); +showmenu(mdiv); cdiv.style.top = ui.pixpos(mdiv.offsetTop + mdiv.offsetHeight); /** diff --git a/sca-cpp/trunk/modules/edit/htdocs/oops/index.html b/sca-cpp/trunk/modules/edit/htdocs/oops/index.html index 67408d8d62..aeb5ae5d2c 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/oops/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/oops/index.html @@ -113,7 +113,7 @@ function showmenu(mdiv) { mklist(ui.menu('Account', '/#view=account', '_view', false), ui.menu('Sign out', '/logout/', '_self', false))); } -showmenu($('menu')); +showmenu(mdiv); cdiv.style.top = ui.pixpos(mdiv.offsetTop + mdiv.offsetHeight); /** diff --git a/sca-cpp/trunk/modules/edit/htdocs/page/index.html b/sca-cpp/trunk/modules/edit/htdocs/page/index.html index 7df8a1a1d9..9482cb4e32 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/page/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/page/index.html @@ -100,13 +100,13 @@ function applink(appname) { var port = ':' + location.port; if (port == ':80' || port == ':443' || port == ':') port = ''; - var link = protocol + '//' + appname + '.' + host + port + '/'; + var link = protocol + '//' + host + port + '/' + appname + '/'; return link; } // Set page titles document.title = ui.windowtitle(location.hostname) + ' - Page - ' + appname; -$('appNameHeader').innerHTML = '<a href=\"' + applink(appname) + '\" target=\"' + '_blank' + '\">' + appname + '</a>'; +$('appNameHeader').innerHTML = '<a href=\"/' + appname + '/\" target=\"' + '_blank' + '\">' + appname + '</a>'; /** * Page editor area, widget value field, add, delete and play page buttons. @@ -149,8 +149,8 @@ resizeFields(); window.onresize = resizeFields; // Init component references -var editWidget = sca.component("EditWidget"); -var pages = sca.reference(editWidget, "pages"); +var editWidget = sca.component('EditWidget'); +var pages = sca.reference(editWidget, 'pages'); /** * Page editing functions. @@ -763,7 +763,7 @@ function getpage(name, ediv) { if (isNil(el)) buffer.innerHTML = '<div id="page"></div>'; else - buffer.innerHTML = writeStrings(writeXML(atompage(doc), false)); + buffer.innerHTML = writeStrings(writeXML(el, false)); // Remove any existing page nodes from the editor div var fnodes = filter(function(e) { @@ -941,8 +941,8 @@ function playpage() { evisible = false; pdiv.style.visibility = 'visible'; pdiv.innerHTML = ''; - pdiv.innerHTML = '<iframe id="playappframe" style="position: relative; height: 5000px; width: 2500px; border: 0px;" scrolling="no" frameborder="0" src="' + - applink(appname) + '"></iframe>'; + pdiv.innerHTML = '<iframe id="playappframe" style="position: relative; height: 5000px; width: 2500px; border: 0px;" scrolling="no" frameborder="0" src="/' + + appname + '"></iframe>'; setTimeout(function() { ediv.style.visibility = 'hidden' }, 0); diff --git a/sca-cpp/trunk/modules/edit/htdocs/stats/index.html b/sca-cpp/trunk/modules/edit/htdocs/stats/index.html index f049bea8a5..81f06c95e4 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/stats/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/stats/index.html @@ -56,22 +56,9 @@ // Get the app name var appname = ui.fragmentParams(location)['app']; -/** - * Return the link to an app. - */ -function applink(appname) { - var protocol = location.protocol; - var host = location.hostname; - var port = ':' + location.port; - if (port == ':80' || port == ':443' || port == ':') - port = ''; - var link = protocol + '//' + appname + '.' + host + port + '/'; - return link; -} - // Set page titles document.title = ui.windowtitle(location.hostname) + ' - Stats - ' + appname; -$('appNameHeader').innerHTML = '<a href=\"' + applink(appname) + '\" target=\"' + '_blank' + '\">' + appname + '</a>'; +$('appNameHeader').innerHTML = '<a href=\"/' + appname + '/\" target=\"' + '_blank' + '\">' + appname + '</a>'; var tclone = isNil(config.clone)? 'Clone' : config.clone; $('cloneApp').value = tclone; $('cloneApp').title = tclone + ' this app'; diff --git a/sca-cpp/trunk/modules/edit/htdocs/store/index.html b/sca-cpp/trunk/modules/edit/htdocs/store/index.html index e82d675f22..bcb3ba7c85 100644 --- a/sca-cpp/trunk/modules/edit/htdocs/store/index.html +++ b/sca-cpp/trunk/modules/edit/htdocs/store/index.html @@ -78,19 +78,6 @@ var store = sca.reference(editWidget, "store"); var dashboards = sca.reference(editWidget, "dashboards"); /** - * Return the link to an app. - */ -function applink(appname) { - var protocol = location.protocol; - var host = location.hostname; - var port = ':' + location.port; - if (port == ':80' || port == ':443' || port == ':') - port = ''; - var link = protocol + '//' + appname + '.' + host + port + '/'; - return link; -} - -/** * Edit an app. */ function editApp(appname) { @@ -151,7 +138,7 @@ function getapps(category) { apps += '<div>' + ui.ahref('/#view=stats&app=' + name, '_view', '<img src="' + appimg + '" width="50" height="50" style="height: 50px; width: 50px; vertical-align: top; margin: 0px; padding: 0px;"></img>') + '</div>'; apps += '</td>'; apps += '<td class="tdw">'; - apps += '<div style="font-weight: bold">' + ui.ahref(applink(name), '_blank', name) + '</div>'; + apps += '<div style="font-weight: bold">' + ui.ahref('/' + name + '/', '_blank', name) + '</div>'; if (category == 'myapps') apps += '<div style="color: #808080;">Shared</div>'; else diff --git a/sca-cpp/trunk/modules/edit/ssl-start b/sca-cpp/trunk/modules/edit/ssl-start index 050de3e83c..919a19f4bb 100755 --- a/sca-cpp/trunk/modules/edit/ssl-start +++ b/sca-cpp/trunk/modules/edit/ssl-start @@ -17,8 +17,8 @@ # specific language governing permissions and limitations # under the License. -# For this module to work, add the app domains to your /etc/hosts as follows: -# 127.0.0.1 sca-store.com abc.sca-store.com xyz.sca-store.com ... +# For this module to work, add the sca-store.com domain to your /etc/hosts as follows: +# 127.0.0.1 sca-store.com here=`echo "import os; print os.path.realpath('$0')" | python`; here=`dirname $here` jsprefix=`echo "import os; print os.path.realpath('$here/../js')" | python` @@ -26,14 +26,11 @@ jsprefix=`echo "import os; print os.path.realpath('$here/../js')" | python` # Create SSL certificates ../../modules/http/ssl-ca-conf tmp sca-store.com ../../modules/http/ssl-cert-conf tmp sca-store.com server -../../modules/http/ssl-cert-conf tmp *.sca-store.com vhost -# Configure server with virtual hosting +# Configure server ../../modules/http/httpd-conf tmp sca-store.com 8090 htdocs ../../modules/http/httpd-event-conf tmp -../../modules/http/vhost-conf tmp apps htdocs ../../modules/http/httpd-ssl-conf tmp 8453 -../../modules/http/vhost-ssl-conf tmp # Configure authentication ../../modules/http/open-auth-conf tmp @@ -55,15 +52,6 @@ ErrorDocument 404 /notfound/ ErrorDocument 401 /notauth/ ErrorDocument 500 /oops/ -EOF - -# Configure app home pages -cat >>tmp/conf/dvhost-ssl.conf <<EOF -# App error pages -ErrorDocument 404 /notfound/ -ErrorDocument 401 /notauth/ -ErrorDocument 500 /oops/ - # Redirect www to main home page RewriteEngine on RewriteCond %{HTTP_HOST} ^www\.sca-store\.com [NC] @@ -74,17 +62,6 @@ RewriteRule .* https://sca-store.com%{REQUEST_URI} [L,R] EOF -cat >>tmp/conf/dvhost.conf <<EOF -# Redirect www to main home page -RewriteEngine on -RewriteCond %{HTTP_HOST} ^www\.sca-store\.com [NC] -RewriteCond %{SERVER_PORT} !^80$ -RewriteRule .* http://sca-store.com:%{SERVER_PORT}%{REQUEST_URI} [L,R] -RewriteCond %{HTTP_HOST} ^www\.sca-store\.com [NC] -RewriteRule .* http://sca-store.com%{REQUEST_URI} [L,R] - -EOF - # Configure SCA contributions cat >>tmp/conf/httpd.conf <<EOF @@ -98,7 +75,7 @@ SCAVirtualComposite app.composite EOF -# Configure main aliases +# Configure resource aliases cat >>tmp/conf/httpd.conf <<EOF Alias /home/home.png $here/htdocs/home/home.png @@ -109,24 +86,21 @@ EOF # Create app links and sub-directories if needed ./mkapplinks -# Configure app aliases -cat >>tmp/conf/dvhost-ssl.conf <<EOF -# Configure aliases -Alias /cache-manifest.cmf $here/htdocs/app/cache-manifest.cmf -Alias /data $here/htdocs/data -Alias /favicon.ico $here/htdocs/favicon.ico -Alias /footconfig.js $here/htdocs/footconfig.js -Alias /frame.html $here/htdocs/app/frame.html -Alias /headconfig.js $here/htdocs/headconfig.js -Alias /index.html $here/htdocs/app/index.html -Alias /login $here/htdocs/login -Alias /logout $here/htdocs/logout -Alias /notauth $here/htdocs/notauth -Alias /notfound $here/htdocs/notfound -Alias /notyet $here/htdocs/notyet -Alias /oops $here/htdocs/oops -Alias /public $here/htdocs/public -Alias /robots.txt $here/htdocs/robots.txt +# Configure app resource aliases +cat >>tmp/conf/svhost-ssl.conf <<EOF + +<Location /v> +RewriteEngine on + +# Map /v/<app-name>/<path> to htdocs/app/<path> +RewriteCond %{REQUEST_URI} ^/v/.+/.*$ +RewriteRule /v/(.+)/(.*)$ $here/htdocs/app/\$2 [L] + +# Redirect /v/<app-name> to /<app-name>/ +RewriteCond %{REQUEST_URI} ^/v/[^/]+$ +RewriteRule /v/([^/]+)$ /\$1/ [L,R] + +</Location> EOF @@ -137,5 +111,5 @@ mkdir -p tmp/appdata/filedb ../../components/cache/memcached-start # Start server -../../modules/http/httpd-start tmp +../http/httpd-start tmp diff --git a/sca-cpp/trunk/modules/edit/start b/sca-cpp/trunk/modules/edit/start index b9fe5953d6..b2608b245d 100755 --- a/sca-cpp/trunk/modules/edit/start +++ b/sca-cpp/trunk/modules/edit/start @@ -17,16 +17,15 @@ # specific language governing permissions and limitations # under the License. -# For this module to work, add the app domains to your /etc/hosts as follows: -# 127.0.0.1 sca-store.com abc.sca-store.com xyz.sca-store.com ... +# For this module to work, add the sca-store.com domain to your /etc/hosts as follows: +# 127.0.0.1 sca-store.com here=`echo "import os; print os.path.realpath('$0')" | python`; here=`dirname $here` jsprefix=`echo "import os; print os.path.realpath('$here/../js')" | python` -# Configure server with virtual hosting +# Configure server ../../modules/http/httpd-conf tmp sca-store.com 8090 htdocs ../../modules/http/httpd-event-conf tmp -../../modules/http/vhost-conf tmp apps htdocs # Configure Python component support ../server/server-conf tmp @@ -39,15 +38,6 @@ ErrorDocument 404 /notfound/ ErrorDocument 401 /notauth/ ErrorDocument 500 /oops/ -EOF - -# Configure app home pages -cat >>tmp/conf/dvhost.conf <<EOF -# App error pages -ErrorDocument 404 /notfound/ -ErrorDocument 401 /notauth/ -ErrorDocument 500 /oops/ - # Redirect www to main home page RewriteEngine on RewriteCond %{HTTP_HOST} ^www\.sca-store\.com [NC] @@ -70,7 +60,7 @@ SCAVirtualComposite app.composite EOF -# Configure main aliases +# Configure resource aliases cat >>tmp/conf/httpd.conf <<EOF Alias /home/home.png $here/htdocs/home/home.png @@ -81,24 +71,21 @@ EOF # Create app links and sub-directories if needed ./mkapplinks -# Configure app aliases -cat >>tmp/conf/dvhost.conf <<EOF -# Configure aliases -Alias /cache-manifest.cmf $here/htdocs/app/cache-manifest.cmf -Alias /data $here/htdocs/data -Alias /favicon.ico $here/htdocs/favicon.ico -Alias /footconfig.js $here/htdocs/footconfig.js -Alias /frame.html $here/htdocs/app/frame.html -Alias /headconfig.js $here/htdocs/headconfig.js -Alias /index.html $here/htdocs/app/index.html -Alias /login $here/htdocs/login -Alias /logout $here/htdocs/logout -Alias /notauth $here/htdocs/notauth -Alias /notfound $here/htdocs/notfound -Alias /notyet $here/htdocs/notyet -Alias /oops $here/htdocs/oops -Alias /public $here/htdocs/public -Alias /robots.txt $here/htdocs/robots.txt +# Configure app resource aliases +cat >>tmp/conf/svhost.conf <<EOF + +<Location /v> +RewriteEngine on + +# Map /v/<app-name>/<path> to htdocs/app/<path> +RewriteCond %{REQUEST_URI} ^/v/.+/.*$ +RewriteRule /v/(.+)/(.*)$ $here/htdocs/app/\$2 [L] + +# Redirect /v/<app-name> to /<app-name>/ +RewriteCond %{REQUEST_URI} ^/v/[^/]+$ +RewriteRule /v/([^/]+)$ /\$1/ [L,R] + +</Location> EOF |