@ -0,0 +1,59 @@
|
|||||||
|
<%
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var uri = request.getRequestURI();
|
||||||
|
var uriMatcher = new URIMatcher(String(uri));
|
||||||
|
|
||||||
|
var log = new Log("api/device-api.jag");
|
||||||
|
|
||||||
|
var constants = require("/modules/constants.js");
|
||||||
|
var dcProps = require('/config/dc-props.js').config();
|
||||||
|
var downloadModule = require("/modules/download.js").downloadModule;
|
||||||
|
var utility = require("/modules/utility.js").utility;
|
||||||
|
|
||||||
|
var result;
|
||||||
|
|
||||||
|
if (uriMatcher.match("/{context}/api/device/sketch/")) {
|
||||||
|
sketchType = request.getParameter("type");
|
||||||
|
log.error("#################");
|
||||||
|
log.error(sketchType);
|
||||||
|
if(!sketchType){log.error("Sketch Type is empty");}
|
||||||
|
|
||||||
|
var user = session.get(constants.USER_SESSION_KEY);
|
||||||
|
if(!user){
|
||||||
|
response.sendRedirect(dcProps.appContext + "login?#login-required");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sketchType=="arduino"){
|
||||||
|
downloadModule.downloadSketch("arduino-sketch.hbs",response, {"{{self.publicURL}}":"####"});
|
||||||
|
}else if(sketchType=="raspberry"){
|
||||||
|
downloadModule.downloadSketch("raspberry-sketch.hbs",response, {"{{self.publicURL}}":"####"});
|
||||||
|
}else{
|
||||||
|
log.error("Sketch type `"+sketchType+"` not found");
|
||||||
|
response.sendRedirect(uri + "?#sketch-failed");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// returning the result.
|
||||||
|
if (result) {
|
||||||
|
print(result);
|
||||||
|
}
|
||||||
|
%>
|
@ -1,27 +1,16 @@
|
|||||||
{
|
{
|
||||||
"appContext" : "/mdm/",
|
"appContext" : "/iot/",
|
||||||
"apiContext" : "api",
|
"apiContext" : "api",
|
||||||
"httpsURL": "%https.ip%",
|
"httpsURL": "%https.ip%",
|
||||||
"httpURL": "%http.ip%",
|
"httpURL": "%http.ip%",
|
||||||
"iOSConfigRoot": "%https.ip%/ios/",
|
|
||||||
"device": {
|
|
||||||
"ios": {
|
|
||||||
"location": "%http.ip%/mdm/public/asset-download-agent/asset/ios-agent.ipa",
|
|
||||||
"bundleid": "org.wso2.carbon.mdm.mobileservices.ios.agent.iOSMDMAgent",
|
|
||||||
"version": "1.0",
|
|
||||||
"appname": "MDM Agent"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"androidAgentApp" : "android-agent.apk",
|
|
||||||
"windowsConfigRoot": "http://10.10.10.198:9763/mdm-windows-api/services/federated/bst/authentication",
|
|
||||||
"ssoConfiguration": {
|
"ssoConfiguration": {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"issuer": "mdm",
|
"issuer": "iot",
|
||||||
"appName": "mdm",
|
"appName": "iot",
|
||||||
"identityProviderURL": "%https.ip%/sso/samlsso.jag",
|
"identityProviderURL": "%https.ip%/sso/samlsso.jag",
|
||||||
"responseSigningEnabled": "true",
|
"responseSigningEnabled": "true",
|
||||||
"keyStorePassword": "wso2carbon",
|
"keyStorePassword": "wso2carbon",
|
||||||
"identityAlias": "wso2carbon",
|
"identityAlias": "wso2carbon",
|
||||||
"keyStoreName": "/repository/resources/security/wso2carbon.jks"
|
"keyStoreName": "/repository/resources/security/wso2carbon.jks"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var config = function () {
|
||||||
|
var conf = application.get("PINCH_CONFIG");
|
||||||
|
if (!conf) {//if not in cache
|
||||||
|
var pinch = require('/modules/pinch.min.js').pinch;
|
||||||
|
var server = require('carbon').server;
|
||||||
|
var config = require('/config/config.json');
|
||||||
|
pinch(config, /^/, function (path, key, value) {
|
||||||
|
if ((typeof value === 'string') && value.indexOf('%https.ip%') > -1) {
|
||||||
|
return value.replace('%https.ip%', server.address("https"));
|
||||||
|
} else if ((typeof value === 'string') && value.indexOf('%http.ip%') > -1) {
|
||||||
|
return value.replace('%http.ip%', server.address("http"));
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
});
|
||||||
|
application.put("PINCH_CONFIG", config);//caching
|
||||||
|
conf = config;
|
||||||
|
}
|
||||||
|
return conf;
|
||||||
|
};
|
@ -0,0 +1,29 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>
|
||||||
|
{{ defineZone "title"}}
|
||||||
|
</title>
|
||||||
|
{{ defineZone "topLibCss"}}
|
||||||
|
{{ defineZone "topCss"}}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container col-lg-12 col-md-12 col-sm-12">
|
||||||
|
<!-- header -->
|
||||||
|
<header>
|
||||||
|
<div class="row wr-global-header">
|
||||||
|
<div class="col-sm-8 app-logo">
|
||||||
|
{{ defineZone "brand"}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<!-- /header -->
|
||||||
|
{{ defineZone "body"}}
|
||||||
|
</div>
|
||||||
|
{{ defineZone "bottomjquery" }}
|
||||||
|
{{ defineZone "bottomLibJs" }}
|
||||||
|
{{ defineZone "bottomJs" }}
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,22 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
|
||||||
|
<title>{{ defineZone "title"}}</title>
|
||||||
|
{{ defineZone "topLibCss"}}
|
||||||
|
{{ defineZone "topCss"}}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<section class="content-wrapper">
|
||||||
|
<!-- header -->
|
||||||
|
{{ defineZone "header"}}
|
||||||
|
<!-- /header -->
|
||||||
|
{{ defineZone "body"}}
|
||||||
|
</section>
|
||||||
|
{{ defineZone "bottomLibJs" }}
|
||||||
|
{{ defineZone "bottomJs" }}
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,50 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>{{ defineZone "title"}}</title>
|
||||||
|
{{ defineZone "topCss"}}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
|
||||||
|
<div class="container-liquid">
|
||||||
|
<div class="navbar-header">
|
||||||
|
<a class="navbar-brand" href="#">{{defineZone "brand"}}</a>
|
||||||
|
</div>
|
||||||
|
<div class="navbar-collapse collapse">
|
||||||
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<li><a href="/login">Login</a></li>
|
||||||
|
{{ defineZone "upperRight"}}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="wrap">
|
||||||
|
<div class="container-fluid">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-2">
|
||||||
|
{{ defineZone "left"}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-10">
|
||||||
|
{{ defineZone "content"}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- /container -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="footer">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
{{ defineZone "footer"}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,49 @@
|
|||||||
|
<%
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var dataConfig = require('/config/dc-props.js').config();
|
||||||
|
var sso = require('/modules/sso.js').sso;
|
||||||
|
var constants = require('/modules/constants.js');
|
||||||
|
var carbonModule = require("carbon");
|
||||||
|
var log = new Log();
|
||||||
|
var keyStoreParams = {
|
||||||
|
keyStoreName: dataConfig.ssoConfiguration.keyStoreName,
|
||||||
|
keyStorePassword: dataConfig.ssoConfiguration.keyStorePassword,
|
||||||
|
identityAlias: dataConfig.ssoConfiguration.identityAlias
|
||||||
|
};
|
||||||
|
sso.configure(dataConfig.ssoConfiguration.issuer,
|
||||||
|
dataConfig.ssoConfiguration.appName,
|
||||||
|
keyStoreParams, dataConfig.ssoConfiguration.identityProviderURL);
|
||||||
|
sso.acs(
|
||||||
|
function(loggedInUser) {
|
||||||
|
var carbonUser = carbonModule.server.tenantUser(loggedInUser);
|
||||||
|
session.put(constants.USER_SESSION_KEY, carbonUser);
|
||||||
|
var username = carbonUser.username;
|
||||||
|
if(log.isDebugEnabled()){
|
||||||
|
log.debug("User logged in: "+username);
|
||||||
|
}
|
||||||
|
response.sendRedirect(dataConfig.appContext);
|
||||||
|
}, function() {
|
||||||
|
if(log.isDebugEnabled()){
|
||||||
|
log.debug("User logged out");
|
||||||
|
}
|
||||||
|
response.sendRedirect(dataConfig.appContext);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
%>
|
@ -0,0 +1,210 @@
|
|||||||
|
//public function declarations
|
||||||
|
var route;
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
|
||||||
|
//public
|
||||||
|
/**
|
||||||
|
* front controller entity point. acts as the main function for every request.
|
||||||
|
*/
|
||||||
|
route = function () {
|
||||||
|
//lets assume URL looks like https://my.domain.com/app/{one}/{two}/{three}/{four}
|
||||||
|
var uri = request.getRequestURI(); // = app/{one}/{two}/{three}/{four}
|
||||||
|
var parts = splitFirst(uri);
|
||||||
|
fuseState.appName = parts.head;
|
||||||
|
var path = parts.tail; // = /{one}/{two}/{three}/{four}
|
||||||
|
var handled = false;
|
||||||
|
|
||||||
|
parts = splitFirst(path);
|
||||||
|
if (parts.head == 'public') { // {one} == 'public'
|
||||||
|
parts = splitFirst(parts.tail);
|
||||||
|
if (splitFirst(parts.tail).head == 'less') { // {three} == 'less'
|
||||||
|
handled = renderLess(parts.head, parts.tail); // renderLess({two},{three}/{four})
|
||||||
|
} else {
|
||||||
|
handled = renderStatic(parts.head, parts.tail);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
handled = renderPage(path);
|
||||||
|
if (!handled) {
|
||||||
|
handled = renderUnit(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!handled) {
|
||||||
|
response.sendError(404, 'Requested resource not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//private
|
||||||
|
var log = new Log('fuse.router');
|
||||||
|
|
||||||
|
var getMime = function (path) {
|
||||||
|
var index = path.lastIndexOf('.') + 1;
|
||||||
|
var knowMime = {
|
||||||
|
'js': 'application/javascript',
|
||||||
|
'html': 'text/html',
|
||||||
|
'htm': 'text/html',
|
||||||
|
'woff': 'application/x-font-woff',
|
||||||
|
"png": "image/png",
|
||||||
|
"css": "text/css",
|
||||||
|
"hbs": "text/x-handlebars-template",
|
||||||
|
"apk": "application/vnd.android.package-archive",
|
||||||
|
"ipa": "application/octet-stream"
|
||||||
|
};
|
||||||
|
var mime;
|
||||||
|
if (index >= 0) {
|
||||||
|
mime = knowMime[path.substr(index)];
|
||||||
|
}
|
||||||
|
return mime || 'text/plain';
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* '/a/b/c/d' -> {'a','b/c/d'}
|
||||||
|
* @param path URI part, should start with '/'
|
||||||
|
* @returns {{head: string, tail: string}}
|
||||||
|
*/
|
||||||
|
var splitFirst = function (path) {
|
||||||
|
var firstSlashPos = path.indexOf('/', 1);
|
||||||
|
var head = path.substring(1, firstSlashPos);
|
||||||
|
var tail = path.substring(firstSlashPos);
|
||||||
|
return {head: head, tail: tail};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param str
|
||||||
|
* @param prefix
|
||||||
|
* @returns {boolean} true iif str starts with prefix
|
||||||
|
*/
|
||||||
|
var startsWith = function (str, prefix) {
|
||||||
|
return (str.lastIndexOf(prefix, 0) === 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
var renderStatic = function (unit, path) {
|
||||||
|
log.debug('[' + requestId + '] for unit "' + unit + '" a request received for a static file "' + path + '"');
|
||||||
|
var staticFile = fuse.getFile(unit, 'public' + path);
|
||||||
|
if (staticFile.isExists() && !staticFile.isDirectory()) {
|
||||||
|
response.addHeader('Content-type', getMime(path));
|
||||||
|
response.addHeader('Cache-Control', 'public,max-age=12960000');
|
||||||
|
staticFile.open('r');
|
||||||
|
var stream = staticFile.getStream();
|
||||||
|
print(stream);
|
||||||
|
staticFile.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
var renderPage = function (path) {
|
||||||
|
var jagFile;
|
||||||
|
if (path.indexOf('/', path.length - 1) !== -1) {
|
||||||
|
jagFile = new File('/pages' + path + 'index.jag');
|
||||||
|
} else {
|
||||||
|
jagFile = new File('/pages' + path + '.jag');
|
||||||
|
}
|
||||||
|
if (jagFile.isExists()) {
|
||||||
|
include(jagFile.getPath());
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var renderUnit = function (path) {
|
||||||
|
var mainUnit = null;
|
||||||
|
var matchedUnits = fuse.getMatchedUnitDefinitions();
|
||||||
|
fuse.addDependencies(matchedUnits);
|
||||||
|
var zones = fuseState.zones;
|
||||||
|
|
||||||
|
// A map of maps. this is used to ensure same zone is not render twice in to same definition.
|
||||||
|
// zonesAdded = { titleZone : { zoneFromA : true, zoneFromB : true } }
|
||||||
|
var zonesAdded = {};
|
||||||
|
|
||||||
|
for (var i = 0; i < matchedUnits.length; i++) {
|
||||||
|
var definition = matchedUnits[i];
|
||||||
|
|
||||||
|
for (var j = 0; j < definition.zones.length; j++) {
|
||||||
|
var zone = definition.zones[j];
|
||||||
|
if (!zones[zone.name]) {
|
||||||
|
zones[zone.name] = [];
|
||||||
|
zonesAdded[zone.name] = {};
|
||||||
|
}
|
||||||
|
var zoneKey = zone.origin + ':' + zone.name; // temp unique key to identify zone form a given unit.
|
||||||
|
if (!zonesAdded[zone.name][zoneKey]) {
|
||||||
|
var zoneInfo = {unitName: definition.name};
|
||||||
|
if (zone.origin != definition.name) {
|
||||||
|
zoneInfo.originUnitName = zone.origin;
|
||||||
|
}
|
||||||
|
zones[zone.name].push(zoneInfo);
|
||||||
|
zonesAdded[zone.name][zoneKey] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var layout = fuseState.layout;
|
||||||
|
if (layout !== null) {
|
||||||
|
log.debug(
|
||||||
|
'[' + requestId + '] request for "' + path + '" will be rendered using layout "' +
|
||||||
|
layout + '" (defined in "' + mainUnit + '") and zones ' +
|
||||||
|
stringify(zones)
|
||||||
|
);
|
||||||
|
|
||||||
|
var output = handlebars.Handlebars.compileFile(fuse.getLayoutPath(layout))({});
|
||||||
|
response.addHeader('Content-type', 'text/html');
|
||||||
|
print(output);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
log.debug(
|
||||||
|
'[' + requestId + '] request for "' + path + '" will can\'t be rendered, since no layout is defined' +
|
||||||
|
'in any of the units ' + stringify(zones));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function fileToString(path) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* convert less file to css and print to output. add '?nocache=true' to force regenerate.
|
||||||
|
* @param unit name of the unit
|
||||||
|
* @param path the path to the less file relative to unit root (should start with slash)
|
||||||
|
* @returns {boolean} is successfully rendered.
|
||||||
|
*/
|
||||||
|
function renderLess(unit, path) {
|
||||||
|
//TODO: fix - incorrect less files makes it respond the old less even if it is nocahce.
|
||||||
|
log.debug('[' + requestId + '] for unit "' + unit + '" a request received for a less file "' + path + '"');
|
||||||
|
var cacheKey = '/tmp/cached_' + unit + path.replace(/[^\w\.-]/g, '_');
|
||||||
|
fuseState.currentUnit = unit;
|
||||||
|
var cachedCss = new File(cacheKey);
|
||||||
|
|
||||||
|
//TODO: move this check to caller function ??
|
||||||
|
if (fuseDebug || request.getParameter('nocache') == 'true' || !cachedCss.isExists()) {
|
||||||
|
var parts = splitFirst(path);
|
||||||
|
var lessPath = '/public/less' + parts.tail.replace(/\.css$/, '') + '.less';
|
||||||
|
var lessFile = fuse.getFile(unit, lessPath);
|
||||||
|
|
||||||
|
if (lessFile.isExists()) {
|
||||||
|
var x = require('less-rhino-1.7.5.js');
|
||||||
|
x.compile([lessFile.getPath(), cacheKey]);
|
||||||
|
log.debug('[' + requestId + '] for unit "' + unit + '" request for "' + path + '" is cached as "' + cacheKey + '"');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (cachedCss.isExists()) {
|
||||||
|
response.addHeader('Content-type', 'text/css');
|
||||||
|
response.addHeader('Cache-Control', 'public,max-age=12960000');
|
||||||
|
cachedCss.open('r');
|
||||||
|
var stream = cachedCss.getStream();
|
||||||
|
print(stream);
|
||||||
|
cachedCss.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
})();
|
@ -0,0 +1,29 @@
|
|||||||
|
<%
|
||||||
|
|
||||||
|
//global object to pass request stat among fuse framework files.
|
||||||
|
var fuseState = {
|
||||||
|
zones: {},
|
||||||
|
appName: '',
|
||||||
|
zoneStack: [],
|
||||||
|
currentUnit: null
|
||||||
|
};
|
||||||
|
|
||||||
|
var requestId = function makeId() {
|
||||||
|
var text = "";
|
||||||
|
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
for (var i = 0; i < 5; i++)
|
||||||
|
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}();
|
||||||
|
var fuseDebug = false;
|
||||||
|
//var fuseDebug = true;
|
||||||
|
|
||||||
|
var handlebars = require('handlebars-helpers.js');
|
||||||
|
var fuseRouter = require('fuse-router.js');
|
||||||
|
var fuse = require('fuse.js');
|
||||||
|
|
||||||
|
|
||||||
|
fuseRouter.route();
|
||||||
|
|
||||||
|
%>
|
@ -0,0 +1,417 @@
|
|||||||
|
//public function declarations
|
||||||
|
var getHbsFile, getFile, toRelativePath, cleanupAncestors,
|
||||||
|
getUnitPath, getMatchedUnitDefinitions, getZoneDefinition, getUnitDefinition,
|
||||||
|
getUnitDefinitions, getLayoutPath;
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
//private
|
||||||
|
var log = new Log('fuse.core');
|
||||||
|
var lookUpTable = null;
|
||||||
|
var definitions = null;
|
||||||
|
|
||||||
|
var initLookUp = function (definitions) {
|
||||||
|
if (lookUpTable === null) {
|
||||||
|
lookUpTable = {};
|
||||||
|
for (var i = 0; i < definitions.length; i++) {
|
||||||
|
var definition = definitions[i];
|
||||||
|
lookUpTable[definition.name] = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var isMatched = function (definition, layout) {
|
||||||
|
var urlMatch = function (pattern) {
|
||||||
|
var uriMatcher = new URIMatcher(request.getRequestURI());
|
||||||
|
return Boolean(uriMatcher.match('/{appName}' + pattern));
|
||||||
|
};
|
||||||
|
var permission = function (permissionStr) {
|
||||||
|
var carbonModule = require("carbon");
|
||||||
|
var carbonServer = application.get("carbonServer");
|
||||||
|
var carbonUser = session.get("USER");
|
||||||
|
if (carbonUser) {
|
||||||
|
var userManager = new carbonModule.user.UserManager(carbonServer, carbonUser.tenantId);
|
||||||
|
var user = new carbonModule.user.User(userManager, carbonUser.username);
|
||||||
|
return user.isAuthorized(permissionStr, "ui.execute");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
var config = {'theme': 'default'};
|
||||||
|
var predicateStr = definition.definition.predicate;
|
||||||
|
if (predicateStr) {
|
||||||
|
var js = 'function(config,urlMatch,permission,layout){ return ' + predicateStr + ';}';
|
||||||
|
return Boolean(eval(js)(config, urlMatch,permission, layout ? layout : NaN));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
var getAncestorModels = function (unit) {
|
||||||
|
var unitModel = getUnitDefinition(unit);
|
||||||
|
var ancestors = [unitModel];
|
||||||
|
var parentName;
|
||||||
|
while ((parentName = unitModel.definition.extends) != null) {
|
||||||
|
unitModel = getUnitDefinition(parentName);
|
||||||
|
ancestors.push(unitModel);
|
||||||
|
}
|
||||||
|
return ancestors;
|
||||||
|
};
|
||||||
|
|
||||||
|
addDependencies = function (unitModels) {
|
||||||
|
var resolved = {};
|
||||||
|
for (var i = 0; i < unitModels.length; i++) {
|
||||||
|
resolved[unitModels[i].name] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < unitModels.length; i++) {
|
||||||
|
var unitModel = unitModels[i];
|
||||||
|
var dependencies = unitModel.definition.dependencies;
|
||||||
|
if (dependencies) {
|
||||||
|
for (var j = 0; j < dependencies.length; j++) {
|
||||||
|
var dependencyName = dependencies[j];
|
||||||
|
unitModels.push(getUnitDefinition(dependencyName));
|
||||||
|
resolved[dependencyName] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//public
|
||||||
|
getMatchedUnitDefinitions = function () {
|
||||||
|
//TODO: return map not list
|
||||||
|
var unitDefinitions = getUnitDefinitions();
|
||||||
|
var matched = [];
|
||||||
|
var unMatched = [];
|
||||||
|
var layout = null;
|
||||||
|
var mainUnit = null;
|
||||||
|
|
||||||
|
var addToMatched = function (model) {
|
||||||
|
matched.push(model);
|
||||||
|
if (model.layout) {
|
||||||
|
if (layout == null) {
|
||||||
|
layout = model.layout;
|
||||||
|
mainUnit = model.name;
|
||||||
|
} else {
|
||||||
|
log.warn(
|
||||||
|
'[' + requestId + '] multiple layouts ' + mainUnit + ':' +
|
||||||
|
layout + ' vs ' + model.name + ':' + model.layout
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// first pass
|
||||||
|
for (var i = 0; i < unitDefinitions.length; i++) {
|
||||||
|
var unitDefinition = unitDefinitions[i];
|
||||||
|
if (isMatched(unitDefinition)) {
|
||||||
|
addToMatched(unitDefinition);
|
||||||
|
} else {
|
||||||
|
unMatched.push(unitDefinition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fuseState.layout = layout;
|
||||||
|
|
||||||
|
// second pass : we have to do this two passes since we don't know the layout
|
||||||
|
// first time around
|
||||||
|
if (layout) {
|
||||||
|
for (i = 0; i < unMatched.length; i++) {
|
||||||
|
unitDefinition = unMatched[i];
|
||||||
|
if (isMatched(unitDefinition, layout)) {
|
||||||
|
addToMatched(unitDefinition)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var toDelete = [];
|
||||||
|
|
||||||
|
for (i = 0; i < matched.length; i++) {
|
||||||
|
var ancestors = getAncestorModels(matched[i].name);
|
||||||
|
for (var j = 1; j < ancestors.length; j++) {
|
||||||
|
var ancestor = ancestors[j];
|
||||||
|
toDelete.push(ancestor.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (i = matched.length - 1; i >= 0; i--) {
|
||||||
|
//log.info(matched[i].name);
|
||||||
|
if (toDelete.indexOf(matched[i].name) >= 0) {
|
||||||
|
matched.splice(i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return matched;
|
||||||
|
};
|
||||||
|
|
||||||
|
getUnitDefinition = function (unit) {
|
||||||
|
var definitions = getUnitDefinitions();
|
||||||
|
initLookUp(definitions);
|
||||||
|
var model = definitions[lookUpTable[unit]];
|
||||||
|
if (!model) {
|
||||||
|
log.warn('[' + requestId + '] unit "' + unit + '" does not exits');
|
||||||
|
throw '[' + requestId + '] unit "' + unit + '" does not exits';
|
||||||
|
}
|
||||||
|
return model;
|
||||||
|
};
|
||||||
|
|
||||||
|
var flattenAllInheritance = function (unitModels) {
|
||||||
|
var hasFlattend = {};
|
||||||
|
for (var i = 0; i < unitModels.length; i++) {
|
||||||
|
var model = unitModels[i];
|
||||||
|
if (!hasFlattend[model]) {
|
||||||
|
var ancestors = getAncestorModels(model.name);
|
||||||
|
for (var j = ancestors.length - 1; j >= 1; j--) {
|
||||||
|
flattenInheritance(ancestors[j], ancestors[j - 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var flattenInheritance = function (parent, child) {
|
||||||
|
var parentZones = parent.zones;
|
||||||
|
for (var i = 0; i < parentZones.length; i++) {
|
||||||
|
var parentZone = parentZones[i];
|
||||||
|
child.zones.push(parentZone);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
getUnitDefinitions = function () {
|
||||||
|
if (definitions !== null) {
|
||||||
|
return definitions;
|
||||||
|
} else {
|
||||||
|
definitions = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
var unitDirs = new File('/units').listFiles();
|
||||||
|
for (var i = 0; i < unitDirs.length; i++) {
|
||||||
|
var unitDir = unitDirs[i];
|
||||||
|
if (unitDir.isDirectory()) {
|
||||||
|
|
||||||
|
var unitName = unitDir.getName();
|
||||||
|
var unitModel = {
|
||||||
|
name: unitName,
|
||||||
|
path: unitDir.getPath()
|
||||||
|
};
|
||||||
|
|
||||||
|
// unit definition is read form is the <unit name>.json file.
|
||||||
|
// if doesn't exits it will be an empty json.
|
||||||
|
var definitionFile = new File(fuse.getUnitPath(unitName) + '/' + unitName + '.json');
|
||||||
|
if (definitionFile.isExists() && !definitionFile.isDirectory()) {
|
||||||
|
var path = definitionFile.getPath();
|
||||||
|
log.debug('[' + requestId + '] reading file "' + path + '"');
|
||||||
|
unitModel.definition = require(path);
|
||||||
|
} else {
|
||||||
|
log.warn('[' + requestId + '] for unit "' + unitName + '", unable to find a definition file');
|
||||||
|
unitModel.definition = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the information derived by parsing hbs file to the same model
|
||||||
|
var hbsMetadata = getHbsMetadata(unitModel);
|
||||||
|
unitModel.zones = hbsMetadata.zones;
|
||||||
|
if (hbsMetadata.layout) {
|
||||||
|
unitModel.layout = hbsMetadata.layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
definitions.push(unitModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addPageUnitDefinitions(definitions);
|
||||||
|
|
||||||
|
initLookUp(definitions);
|
||||||
|
flattenAllInheritance(definitions);
|
||||||
|
|
||||||
|
return definitions;
|
||||||
|
};
|
||||||
|
|
||||||
|
addPageUnitDefinitions = function (unitModels, dir) {
|
||||||
|
var pageFiles = new File(dir || '/pages').listFiles();
|
||||||
|
for (var i = 0; i < pageFiles.length; i++) {
|
||||||
|
var pageFile = pageFiles[i];
|
||||||
|
var fileName = pageFile.getName();
|
||||||
|
if (pageFile.isDirectory()) {
|
||||||
|
addPageUnitDefinitions(unitModels, pageFile.getPath())
|
||||||
|
} else if (fileName.indexOf('.hbs', fileName.length - 4) !== -1) { // File name ends with '.hbs'
|
||||||
|
|
||||||
|
var isLeaf = true;
|
||||||
|
//path relative to app root
|
||||||
|
var relativePath = pageFile.getPath()
|
||||||
|
.substring(6 + pageFile.getPath().indexOf('/pages/'), pageFile.getPath().length - 4);
|
||||||
|
|
||||||
|
if (relativePath.match(/\/index$/)) {
|
||||||
|
relativePath = relativePath.replace(/\/index$/, '');
|
||||||
|
var parentFile = new File(pageFile.getPath().substr(0, pageFile.getPath().lastIndexOf('/')));
|
||||||
|
var hasSiblings = parentFile.listFiles().length != 1;
|
||||||
|
if (hasSiblings) {
|
||||||
|
isLeaf = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//this will be used as a name for the virtual unit, useful for debugging purposes.
|
||||||
|
var unitName = (relativePath == '' ? 'index' : relativePath.substr(1).replace(/\//, '-') ) + '-page';
|
||||||
|
|
||||||
|
var predicate = "urlMatch('" + relativePath + "')";
|
||||||
|
// leaf is page that can handle multiple URLs. in this case it should have a wildcard at end.
|
||||||
|
// but since our current matcher doesn't support {/wildcard*} patten, "OR" ( || ) is used
|
||||||
|
if (isLeaf) {
|
||||||
|
predicate += " || urlMatch('" + relativePath + "/{+wildcard}')";
|
||||||
|
}
|
||||||
|
var unitModel = {
|
||||||
|
name: unitName,
|
||||||
|
|
||||||
|
path: pageFile.getPath(),
|
||||||
|
definition: {predicate: predicate}
|
||||||
|
};
|
||||||
|
var hbsMetadata = getHbsMetadata(unitModel);
|
||||||
|
unitModel.zones = hbsMetadata.zones;
|
||||||
|
if (hbsMetadata.layout) {
|
||||||
|
unitModel.layout = hbsMetadata.layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
unitModels.push(unitModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
getLayoutPath = function (layout) {
|
||||||
|
return '/layouts/' + layout + '.hbs';
|
||||||
|
};
|
||||||
|
|
||||||
|
getHbsFile = function (unit) {
|
||||||
|
// we determining if it's page unit or a proper unit
|
||||||
|
// by checking if path ends with '.hbs'
|
||||||
|
// TODO: improve getFile to do include this logic
|
||||||
|
if (unit.path.indexOf('.hbs', unit.path.length - 4) !== -1) {
|
||||||
|
return new File(unit.path);
|
||||||
|
} else {
|
||||||
|
return new File(unit.path + '/' + unit.name + '.hbs');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var getHbsMetadata = function (unit) {
|
||||||
|
var zoneDef = {'zones': []};
|
||||||
|
var hbsFile = getHbsFile(unit);
|
||||||
|
if (!hbsFile.isExists()) {
|
||||||
|
return zoneDef;
|
||||||
|
}
|
||||||
|
var output = handlebars.Handlebars.compileFile(hbsFile)({});
|
||||||
|
var zonesAndLayouts = output.trim().split(/\s+/gm);
|
||||||
|
for (var i = 0; i < zonesAndLayouts.length; i++) {
|
||||||
|
var name = zonesAndLayouts[i];
|
||||||
|
if (name.lastIndexOf('zone_', 0) === 0) {
|
||||||
|
zoneDef.zones.push({name: name.substr(5), origin: unit.name});
|
||||||
|
} else if (name.lastIndexOf('layout_', 0) === 0) {
|
||||||
|
zoneDef.layout = name.substr(7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return zoneDef;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
getUnitPath = function (unit) {
|
||||||
|
return '/units/' + unit;
|
||||||
|
};
|
||||||
|
|
||||||
|
cleanupAncestors = function (units) {
|
||||||
|
var toDelete = {};
|
||||||
|
var len = units.length;
|
||||||
|
for (var i = 0; i < len; i++) {
|
||||||
|
var unit = units[i];
|
||||||
|
if (!toDelete[unit]) {
|
||||||
|
var ancestors = getAncestorModels(unit.name);
|
||||||
|
for (var j = 1; j < ancestors.length; j++) {
|
||||||
|
toDelete[ancestors[j].name] = unit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (len--) {
|
||||||
|
if (toDelete[units[len]]) {
|
||||||
|
log.debug(
|
||||||
|
'[' + requestId + '] unit "' + units[len] +
|
||||||
|
'" is overridden by "' + toDelete[units[len]] + '"'
|
||||||
|
);
|
||||||
|
units.splice(len, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
toRelativePath = function (path) {
|
||||||
|
var start = 0;
|
||||||
|
if (path.lastIndexOf('/units/', 0) == 0) {
|
||||||
|
start = 7; // len('/units/')
|
||||||
|
}
|
||||||
|
var slashPos = path.indexOf('/', 7);
|
||||||
|
return {
|
||||||
|
unit: path.substring(start, slashPos),
|
||||||
|
path: path.substr(slashPos)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a file inside a unit by relative path. if the file is not available in the given unit,
|
||||||
|
* the closest ancestor's file will be returned. if an optional suffix is used the relative path is
|
||||||
|
* calculated as ( path + < unit name > + opt_suffix ). if no such a file exists a returned file object will
|
||||||
|
* point to provided unit's non-existing file location (not to any ancestors).
|
||||||
|
*
|
||||||
|
* @param unitName name of the unit
|
||||||
|
* @param path path relative to unit root.
|
||||||
|
* @param opt_suffix
|
||||||
|
* @returns {File}
|
||||||
|
*/
|
||||||
|
getFile = function (unitName, path, opt_suffix) {
|
||||||
|
var slashPath = ((path[0] === '/') ? '' : '/') + path;
|
||||||
|
var selfFileName = '';
|
||||||
|
var fileName = '';
|
||||||
|
if (opt_suffix) {
|
||||||
|
selfFileName = unitName + opt_suffix;
|
||||||
|
slashPath = slashPath + ((slashPath[slashPath.length - 1] === '/') ? '' : '/');
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: remove this hack that makes in page-unit, any file is same
|
||||||
|
var unitDef = getUnitDefinition(unitName);
|
||||||
|
if (unitDef.path.indexOf('.hbs', unitDef.path.length - 4) !== -1) {
|
||||||
|
if (opt_suffix.indexOf('.hbs', opt_suffix.length - 4) !== -1) {
|
||||||
|
return new File(unitDef.path);
|
||||||
|
} else {
|
||||||
|
return new File(unitDef.path.replace(/.hbs$/, opt_suffix));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var selfFile = new File(getUnitPath(unitName) + slashPath + selfFileName);
|
||||||
|
if (selfFile.isExists()) {
|
||||||
|
log.debug(
|
||||||
|
'[' + requestId + '] for unit "' + unitName + '" file resolved : "'
|
||||||
|
+ slashPath + selfFileName + '" -> "' + selfFile.getPath() + '"'
|
||||||
|
);
|
||||||
|
|
||||||
|
return selfFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ancestors = getAncestorModels(unitName);
|
||||||
|
for (var i = 1; i < ancestors.length; i++) {
|
||||||
|
var ancestorName = ancestors[i].name;
|
||||||
|
if (opt_suffix) {
|
||||||
|
fileName = ancestorName + opt_suffix;
|
||||||
|
}
|
||||||
|
var file = new File(getUnitPath(ancestorName) + slashPath + fileName);
|
||||||
|
if (file.isExists()) {
|
||||||
|
log.debug(
|
||||||
|
'[' + requestId + '] for unit "' + unitName + '" file resolved : "'
|
||||||
|
+ slashPath + selfFileName + '" -> "' + file.getPath() + '"'
|
||||||
|
);
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.debug(
|
||||||
|
'[' + requestId + '] for unit "' + unitName + '" (non-excising) file resolved : "'
|
||||||
|
+ slashPath + selfFileName + '" -> "' + selfFile.getPath() + '"'
|
||||||
|
);
|
||||||
|
return selfFile;
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
@ -0,0 +1,194 @@
|
|||||||
|
var log = new Log('fuse.handlebars');
|
||||||
|
//TODO: create a different set of helpers for init parsing
|
||||||
|
|
||||||
|
var Handlebars = require('handlebars-v2.0.0.js').Handlebars;
|
||||||
|
var USER_SESSION_KEY = "USER";
|
||||||
|
var getScope = function (unit,configs) {
|
||||||
|
var jsFile = fuse.getFile(unit, '', '.js');
|
||||||
|
var templateConfigs = configs || {};
|
||||||
|
var script;
|
||||||
|
var onRequestCb = function(){}; //Assume that onRequest function will not be defined by the user
|
||||||
|
var viewModel = {};
|
||||||
|
var cbResult;
|
||||||
|
if (jsFile.isExists()) {
|
||||||
|
script = require(jsFile.getPath());
|
||||||
|
//Eagerly make the viewModel the template configs
|
||||||
|
viewModel = templateConfigs;
|
||||||
|
//Check if the unit author has specified an onRequest
|
||||||
|
//callback
|
||||||
|
if(script.hasOwnProperty('onRequest')){
|
||||||
|
script.app = {
|
||||||
|
url: '/' + fuseState.appName,
|
||||||
|
publicURL: '/' + fuseState.appName + '/public/' + unit,
|
||||||
|
"class": unit + '-unit'
|
||||||
|
};
|
||||||
|
onRequestCb = script.onRequest;
|
||||||
|
cbResult = onRequestCb(templateConfigs);
|
||||||
|
log.info("passing configs to unit "+unit+" configs: "+stringify(templateConfigs));
|
||||||
|
//If the execution does not yield an object we will print
|
||||||
|
//a warning as the unit author may have forgotten to return a data object
|
||||||
|
if(cbResult===undefined){
|
||||||
|
cbResult = {}; //Give an empty data object
|
||||||
|
log.warn('[' + requestId + '] unit "' + unit + '" has a onRequest method which does not return a value.This may lead to the '
|
||||||
|
+'unit not been rendered correctly.');
|
||||||
|
}
|
||||||
|
viewModel = cbResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
//If there is no script then the view should get the configurations
|
||||||
|
//passed in the unit call
|
||||||
|
viewModel = templateConfigs;
|
||||||
|
}
|
||||||
|
viewModel.app = {
|
||||||
|
url: '/' + fuseState.appName
|
||||||
|
};
|
||||||
|
viewModel.self = {
|
||||||
|
publicURL: '/' + fuseState.appName + '/public/' + unit,
|
||||||
|
"class": unit + '-unit'
|
||||||
|
};
|
||||||
|
return viewModel;
|
||||||
|
};
|
||||||
|
|
||||||
|
Handlebars.innerZones = [];
|
||||||
|
Handlebars.innerZonesFromUnit = null;
|
||||||
|
|
||||||
|
Handlebars.registerHelper('defineZone', function (zoneName, zoneContent) {
|
||||||
|
var result = '';
|
||||||
|
var zone = Handlebars.Utils.escapeExpression(zoneName);
|
||||||
|
fuseState.zoneStack.push(zone);
|
||||||
|
var unitsToRender = fuseState.zones[zone] || [];
|
||||||
|
|
||||||
|
if (Handlebars.innerZones.length > 0) {
|
||||||
|
unitsToRender = fuseState.zones[Handlebars.innerZones[0]] || [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// if there is no one overriding, then display inline zone
|
||||||
|
if (zoneContent['fn'] && unitsToRender.length == 0) {
|
||||||
|
return zoneContent.fn(this).trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < unitsToRender.length; i++) {
|
||||||
|
var unit = unitsToRender[i];
|
||||||
|
if (Handlebars.innerZonesFromUnit == null || Handlebars.innerZonesFromUnit.unitName == unit.unitName) {
|
||||||
|
var template = fuse.getFile(unit.originUnitName || unit.unitName, '', '.hbs');
|
||||||
|
log.debug('[' + requestId + '] for zone "' + zone + '" including template :"' + template.getPath() + '"');
|
||||||
|
result += Handlebars.compileFile(template)(getScope(unit.unitName, zoneContent.data.root));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// we go to inner zones if result is empty, what we should really do it
|
||||||
|
// if matched zone is fully made of sub-zones. this is a hack to
|
||||||
|
// make it easy to implement.
|
||||||
|
if (result.trim().length == 0 && zoneContent['fn']) {
|
||||||
|
Handlebars.innerZones.push(zoneName);
|
||||||
|
for (i = 0; i < unitsToRender.length; i++) {
|
||||||
|
unit = unitsToRender[i];
|
||||||
|
Handlebars.innerZonesFromUnit = unit;
|
||||||
|
result += zoneContent.fn(this).trim();
|
||||||
|
Handlebars.innerZonesFromUnit = null;
|
||||||
|
}
|
||||||
|
Handlebars.innerZones.pop();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
fuseState.zoneStack.pop();
|
||||||
|
return new Handlebars.SafeString(result);
|
||||||
|
});
|
||||||
|
|
||||||
|
Handlebars.registerHelper('zone', function (zoneName, zoneContent) {
|
||||||
|
var currentZone = fuseState.zoneStack[fuseState.zoneStack.length - 1];
|
||||||
|
if (currentZone == null) {
|
||||||
|
return 'zone_' + zoneName + ' ';
|
||||||
|
}
|
||||||
|
|
||||||
|
// if it's exact zone match or if any in inner zone matches we render zone.
|
||||||
|
// this second condition is a hack. what we should really do is to keep another stack,
|
||||||
|
// and only match with the peek of that stack and always fill it with next in innerZone stack.
|
||||||
|
if (zoneName == currentZone || Handlebars.innerZones.indexOf(zoneName) >= 0) {
|
||||||
|
return zoneContent.fn(this).trim();
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Handlebars.registerHelper('layout', function (layoutName) {
|
||||||
|
var currentZone = fuseState.zoneStack[fuseState.zoneStack.length - 1];
|
||||||
|
if (currentZone == null) {
|
||||||
|
return 'layout_' + layoutName;
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Handlebars.registerHelper('authorized', function () {
|
||||||
|
var currentZone = fuseState.zoneStack[fuseState.zoneStack.length - 1];
|
||||||
|
if (currentZone == null) {
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
var loggedUser = session.get(USER_SESSION_KEY);
|
||||||
|
if(loggedUser == null){
|
||||||
|
response.sendRedirect("/"+ fuseState.appName + "/login");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Handlebars.registerHelper('unit', function (unitName,options) {
|
||||||
|
var unitDef = fuse.getUnitDefinition(unitName);
|
||||||
|
var baseUnit = null;
|
||||||
|
var templateConfigs = options.hash || {};
|
||||||
|
for (var i = 0; i < unitDef.zones.length; i++) {
|
||||||
|
var zone = unitDef.zones[i];
|
||||||
|
if (zone.name == 'main') {
|
||||||
|
baseUnit = zone.origin;
|
||||||
|
} else {
|
||||||
|
var golbalZone = fuseState.zones[zone.name];
|
||||||
|
if (!golbalZone) {
|
||||||
|
fuseState.zones[zone.name] = [{"unitName": unitName}];
|
||||||
|
} else {
|
||||||
|
fuseState.zones[zone.name].push({"unitName": unitName});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (baseUnit == null) {
|
||||||
|
log.error('unit does not have a main zone');
|
||||||
|
}
|
||||||
|
//TODO warn when unspecified decencies are included.
|
||||||
|
fuseState.zoneStack.push('main');
|
||||||
|
var template = fuse.getFile(baseUnit, '', '.hbs');
|
||||||
|
log.info('[' + requestId + '] including "' + baseUnit + '"'+" with configs "+stringify(templateConfigs));
|
||||||
|
var result = new Handlebars.SafeString(Handlebars.compileFile(template)(getScope(baseUnit,templateConfigs)));
|
||||||
|
fuseState.zoneStack.pop();
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
|
||||||
|
Handlebars.compileFile = function (file) {
|
||||||
|
//TODO: remove this overloaded argument
|
||||||
|
var f = (typeof file === 'string') ? new File(file) : file;
|
||||||
|
|
||||||
|
if (!Handlebars.cache) {
|
||||||
|
Handlebars.cache = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Handlebars.cache[f.getPath()] != null) {
|
||||||
|
return Handlebars.cache[f.getPath()];
|
||||||
|
}
|
||||||
|
|
||||||
|
f.open('r');
|
||||||
|
log.debug('[' + requestId + '] reading file "' + f.getPath() + '"');
|
||||||
|
var content = f.readAll().trim();
|
||||||
|
f.close();
|
||||||
|
var compiled = Handlebars.compile(content);
|
||||||
|
Handlebars.cache[f.getPath()] = compiled;
|
||||||
|
return compiled;
|
||||||
|
};
|
||||||
|
Handlebars.registerHelper('equal', function(lvalue, rvalue, options) {
|
||||||
|
if (arguments.length < 3)
|
||||||
|
throw new Error("Handlebars Helper equal needs 2 parameters");
|
||||||
|
if( lvalue!=rvalue ) {
|
||||||
|
return options.inverse(this);
|
||||||
|
} else {
|
||||||
|
return options.fn(this);
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var downloadModule;
|
||||||
|
var Handlebars = require('../lib/handlebars-v2.0.0.js').Handlebars;
|
||||||
|
downloadModule = function () {
|
||||||
|
var log = new Log("modules/download.js");
|
||||||
|
|
||||||
|
var constants = require("/modules/constants.js");
|
||||||
|
|
||||||
|
var publicMethods = {};
|
||||||
|
var privateMethods = {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Downloading a specified sketch file.
|
||||||
|
*
|
||||||
|
* @param file File name or file object of the downloading file
|
||||||
|
* @param replaceParams
|
||||||
|
*/
|
||||||
|
publicMethods.downloadSketch = function (file, response, replaceParams) {
|
||||||
|
var file = new File("../sketch/" + file);
|
||||||
|
|
||||||
|
file.open('r');
|
||||||
|
log.debug("Reading file '" + file.getPath() + "'");
|
||||||
|
var content = file.readAll().trim();
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
var downloadFile = privateMethods.allReplace(content,replaceParams);
|
||||||
|
|
||||||
|
response.contentType = "application/octet-stream";
|
||||||
|
response.addHeader("Content-Disposition", "attachment; filename='sketch.hbs'");
|
||||||
|
response.addHeader("Content-Length", String(downloadFile.length));
|
||||||
|
response.content = downloadFile;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find and replace all occurrences.
|
||||||
|
* @param inStr input string
|
||||||
|
* @param replaceParams key value array
|
||||||
|
* @returns retStr replaced string
|
||||||
|
*/
|
||||||
|
privateMethods.allReplace = function (inStr, replaceParams) {
|
||||||
|
var retStr = inStr;
|
||||||
|
for (var x in replaceParams) {
|
||||||
|
retStr = retStr.replace(new RegExp(x, 'g'), replaceParams[x])
|
||||||
|
}
|
||||||
|
return retStr;
|
||||||
|
};
|
||||||
|
|
||||||
|
return publicMethods;
|
||||||
|
}();
|
||||||
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2011 František Hába <hello@frantisekhaba.com>
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the 'Software'), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to use,
|
||||||
|
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
||||||
|
* Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*
|
||||||
|
* Reference:- https://github.com/Baggz/Pinch
|
||||||
|
* Pinch is a small JavaScript utility which is able to replace any data in a JavaScript object (or JSON).
|
||||||
|
* */
|
||||||
|
(function(){var k=function(a,c){return a.length!==c.length?!1:a.every(function(a,b){return c[b]===a})},j=function(a,c,d){var b,e;if("[object Array]"===Object.prototype.toString.call(a)){b=0;for(e=a.length;b<e;b++)c.apply(d,[b,a[b],a])}else for(b in a)a.hasOwnProperty(b)&&c.apply(d,[b,a[b],a])},h=function(a){for(var c=[],d=!1,b=0,e=a.length,f="",g=function(){f&&(c.push(f),f="")};b<e;b++)a[b].match(/\[|\]/)?(g(),d="]"===a[b]?!1:!0):'"'!==a[b]&&"'"!==a[b]&&("."===a[b]&&!d?g():f+=a[b]),b===e-1&&g();return c},
|
||||||
|
g=function(a,c,d){var b=-1!==["string","object"].indexOf(typeof a),e="string"===typeof c||c&&c.test&&c.exec,f=-1!==["string","object","function"].indexOf(typeof d);b&&e&&f&&("string"===typeof a?(this.instance=JSON.parse(a),this.json=!0):this.instance=a,this.pattern="string"===typeof c?c.replace(/'/g,'"'):c,this.replacement=d,this.createIndex(this.instance))};g.prototype.createIndex=function(a,c){var d=this;this.index=this.index||[];c=c||"";j(a,function(a,e){var f,a=a+"";f=a.match(/^[a-zA-Z]+$/)?c?
|
||||||
|
c+"."+a:a:a.match(/\d+/)?c+"["+a+"]":c+'["'+a+'"]';d.index.push(f);"object"===typeof e&&d.createIndex(e,f)})};g.prototype.replace=function(){var a=this;j(this.index,function(c,d){if(a.pattern&&a.pattern.test&&a.pattern.exec&&d.match(a.pattern))return a.replaceValue(d);if("string"===typeof a.pattern){var b=h(d),e=h(a.pattern);if(k(b,e))return a.replaceValue(d)}});return this.json?JSON.stringify(this.instance):this.instance};g.prototype.replaceValue=function(a){var c=this,d=h(a);d.reduce(function(b,
|
||||||
|
e,f){if(f===d.length-1)f="function"===typeof c.replacement?c.replacement(a,e,b[e]):c.replacement,b[e]=f;else return b[e]},this.instance)};var i=function(a,c,d,b){a=(new g(a,c,d)).replace();return"function"===typeof b?b(null,a):a};"undefined"!==typeof module&&module.exports?module.exports=i:"undefined"!==typeof define?define(function(){return i}):this.pinch=i})();
|
@ -1,9 +0,0 @@
|
|||||||
{{authorized}}
|
|
||||||
{{layout "fluid"}}
|
|
||||||
{{#zone "title"}}
|
|
||||||
WSO2 Device Cloud | Add User
|
|
||||||
{{/zone}}
|
|
||||||
{{#zone "body"}}
|
|
||||||
{{unit "appbar"}}
|
|
||||||
{{unit "add-user"}}
|
|
||||||
{{/zone}}
|
|
@ -0,0 +1,8 @@
|
|||||||
|
{{layout "fluid"}}
|
||||||
|
{{#zone "title"}}
|
||||||
|
WSO2 DC | Arduino
|
||||||
|
{{/zone}}
|
||||||
|
{{#zone "body"}}
|
||||||
|
{{unit "appbar"}}
|
||||||
|
{{unit "arduino"}}
|
||||||
|
{{/zone}}
|
@ -1,19 +1,8 @@
|
|||||||
{{authorized}}
|
|
||||||
{{layout "fluid"}}
|
{{layout "fluid"}}
|
||||||
{{#zone "title"}}
|
{{#zone "title"}}
|
||||||
WSO2 MDM | Device Management
|
WSO2 DC | Device Cloud
|
||||||
{{/zone}}
|
{{/zone}}
|
||||||
{{#zone "body"}}
|
{{#zone "body"}}
|
||||||
{{unit "appbar"}}
|
{{unit "appbar"}}
|
||||||
{{unit "extended-search-box"}}
|
{{unit "showcase"}}
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<!-- content -->
|
|
||||||
<div class="container col-md-12 col-centered wr-content">
|
|
||||||
{{unit "operation-bar"}}
|
|
||||||
{{unit "device-listing"}}
|
|
||||||
</div>
|
|
||||||
<!-- /content -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{/zone}}
|
{{/zone}}
|
@ -1,7 +1,8 @@
|
|||||||
{{layout "fluid"}}
|
{{layout "fluid"}}
|
||||||
{{#zone "title"}}
|
{{#zone "title"}}
|
||||||
WSO2 Mobile Device Manager | Login
|
WSO2 Device Cloud | Login
|
||||||
{{/zone}}
|
{{/zone}}
|
||||||
{{#zone "body"}}
|
{{#zone "body"}}
|
||||||
|
{{unit "appbar"}}
|
||||||
{{unit "login"}}
|
{{unit "login"}}
|
||||||
{{/zone}}
|
{{/zone}}
|
@ -1,9 +0,0 @@
|
|||||||
{{authorized}}
|
|
||||||
{{layout "fluid"}}
|
|
||||||
{{#zone "title"}}
|
|
||||||
User Management
|
|
||||||
{{/zone}}
|
|
||||||
{{#zone "body"}}
|
|
||||||
{{unit "appbar"}}
|
|
||||||
{{unit "user-listing"}}
|
|
||||||
{{/zone}}
|
|
@ -0,0 +1,30 @@
|
|||||||
|
<div class="container container-bg white">
|
||||||
|
<h1 class="white">Arduino Uno</h1><hr>
|
||||||
|
<p>Connect your Arduino Uno device to the IBM Internet of Things Foundation.</p>
|
||||||
|
<img src="{{self.publicURL}}/images/arduino-board.png" alt="Arduino UNO Board" width="300" height="253"/><br/>
|
||||||
|
<h2>Prepare</h2>
|
||||||
|
<h6>Get your device ready</h6>
|
||||||
|
<ul>
|
||||||
|
<li>Mount the Ethernet / Wifi shield on the Arduino Uno device.</li>
|
||||||
|
<li>Connect the Arduino Uno to the USB of your computer.</li>
|
||||||
|
<li>Connect an Ethernet cable to the Ethernet / WiFi Shield.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2>Connect (Quickstart)</h2>
|
||||||
|
<h6>Internet of Things Foundation Quickstart connection</h6>
|
||||||
|
<ul>
|
||||||
|
<li>Use the following command to download the installer from GitHub:</li>
|
||||||
|
<li>curl -LO https://github.com/ibm-messaging/iot-arduino.git</li>
|
||||||
|
<li>Download the Sketch installer from the Arduino website http://arduino.cc/en/Main/Software</li>
|
||||||
|
<li>Install the Sketch program</li>
|
||||||
|
<li>Use the Sketch program to open the samples code samples/quickstart/quickstart.ino</li>
|
||||||
|
<li>View the lower part of the Sketch pad window to check that the COM connection is shown as active</li>
|
||||||
|
<li>Compile and deploy the sample code to the Arduino Uno device</li>
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
|
<form method="POST" class="form-login-box" action="{{sketchPath}}">
|
||||||
|
<input type="hidden" name="type" value="arduino" />
|
||||||
|
<button class="blue-btn">Create Sketch</button>
|
||||||
|
</form>
|
||||||
|
<br/><br/><br/>
|
||||||
|
</div>
|
@ -1,12 +0,0 @@
|
|||||||
<%
|
|
||||||
var userModule = require("/modules/user.js").userModule;
|
|
||||||
userModule.addPermissions([{key: "device-mgt/", name: "Device Management"}], "");
|
|
||||||
userModule.addPermissions([{key: "device-mgt/admin", name: "Device Management Admin"}], "");
|
|
||||||
userModule.addPermissions([{key: "device-mgt/user", name: "Device Management User"}], "");
|
|
||||||
|
|
||||||
userModule.addPermissions([{key: "devices", name: "Device"}], "device-mgt/admin");
|
|
||||||
userModule.addPermissions([{key: "devices", name: "Device"}], "device-mgt/user");
|
|
||||||
userModule.addPermissions([{key: "devices/list", name: "List all Devices"}], "device-mgt/admin");
|
|
||||||
userModule.addPermissions([{key: "devices/list", name: "List own Devices"}], "device-mgt/user");
|
|
||||||
new Log().info(userModule.isAuthorized("/permission/device-mgt/admin/devices/list"));
|
|
||||||
%>
|
|
@ -1,56 +0,0 @@
|
|||||||
{{#zone "main"}}
|
|
||||||
<!-- content/body -->
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<!-- content -->
|
|
||||||
<div class="container col-centered wr-content">
|
|
||||||
<div class="wr-form">
|
|
||||||
<h1 class="wr-title">Add User</h1>
|
|
||||||
Please note that * sign represents required fields of data.
|
|
||||||
<hr />
|
|
||||||
<span class="wr-validation-summary hidden">
|
|
||||||
<p></p>
|
|
||||||
</span>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-8">
|
|
||||||
<label class="wr-input-label">User Name *</label>
|
|
||||||
<div class="wr-input-control">
|
|
||||||
<input type="text" id="username" value="" placeholder="input text"/>
|
|
||||||
</div>
|
|
||||||
<label class="wr-input-label">First Name *</label>
|
|
||||||
<div class="wr-input-control">
|
|
||||||
<input type="text" id="firstname" value="" placeholder="input text"/>
|
|
||||||
</div>
|
|
||||||
<label class="wr-input-label">Last Name *</label>
|
|
||||||
<div class="wr-input-control">
|
|
||||||
<input type="text" id="lastname" value="" placeholder="input text"/>
|
|
||||||
</div>
|
|
||||||
<label class="wr-input-label">Email Address *</label>
|
|
||||||
<div class="wr-input-control">
|
|
||||||
<input type="email" id="email" value="" placeholder="input text"/>
|
|
||||||
</div>
|
|
||||||
<label class="wr-input-label">
|
|
||||||
User Roles
|
|
||||||
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
|
|
||||||
</label>
|
|
||||||
<div class="wr-input-control">
|
|
||||||
<select id="roles" class="form-control select2" multiple="multiple">
|
|
||||||
{{#each roles}}
|
|
||||||
<option>{{this}}</option>
|
|
||||||
{{/each}}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<button id="add-user-btn" class="wr-btn">Add User</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- /content -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- /content/body -->
|
|
||||||
{{/zone}}
|
|
||||||
{{#zone "bottomJs"}}
|
|
||||||
<script src="{{self.publicURL}}/js/bottomJs.js"></script>
|
|
||||||
{{/zone}}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
/**
|
|
||||||
* Returns the dynamic state to be populated by add-user page.
|
|
||||||
*
|
|
||||||
* @param context Object that gets updated with the dynamic state of this page to be presented
|
|
||||||
* @returns {*} A context object that returns the dynamic state of this page to be presented
|
|
||||||
*/
|
|
||||||
function onRequest(context) {
|
|
||||||
var carbon = require('carbon');
|
|
||||||
var tenantId = carbon.server.tenantId();
|
|
||||||
var url = carbon.server.address('https') + "/admin/services/";
|
|
||||||
var server = new carbon.server.Server(url);
|
|
||||||
var userManager = new carbon.user.UserManager(server, tenantId);
|
|
||||||
|
|
||||||
var allRoles = userManager.allRoles();
|
|
||||||
var i = 0;
|
|
||||||
var filteredRoles = [];
|
|
||||||
while (allRoles[i]) {
|
|
||||||
if (allRoles[i] != "Internal/subscriber" && allRoles[i] != "Internal/everyone") {
|
|
||||||
filteredRoles.push(allRoles[i]);
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
context.roles = filteredRoles;
|
|
||||||
return context;
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"predicate": false
|
|
||||||
}
|
|
@ -1,91 +0,0 @@
|
|||||||
$( document ).ready(function() {
|
|
||||||
$("select.select2").select2({
|
|
||||||
placeholder : "Select..."
|
|
||||||
});
|
|
||||||
|
|
||||||
$("select.select2[multiple=multiple]").select2({
|
|
||||||
placeholder : "Select...",
|
|
||||||
tags : true
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if an email address has the valid format or not.
|
|
||||||
*
|
|
||||||
* @param email Email address
|
|
||||||
* @returns {boolean} true if email has the valid format, otherwise false.
|
|
||||||
*/
|
|
||||||
var emailIsValid = function(email) {
|
|
||||||
var atPosition = email.indexOf("@");
|
|
||||||
var dotPosition = email.lastIndexOf(".");
|
|
||||||
return !(atPosition < 1 || ( dotPosition - atPosition < 2 ));
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Following click function would execute
|
|
||||||
* when a user clicks on "Add User" button
|
|
||||||
* on Add User page in WSO2 MDM Console.
|
|
||||||
*/
|
|
||||||
$("button#add-user-btn").click(function() {
|
|
||||||
var username = $("input#username").val();
|
|
||||||
var firstname = $("input#firstname").val();
|
|
||||||
var lastname = $("input#lastname").val();
|
|
||||||
var emailAddress = $("input#email").val();
|
|
||||||
var userRoles = $("select#roles").val();
|
|
||||||
|
|
||||||
if (!username) {
|
|
||||||
$(".wr-validation-summary p").text("Username is a required field. It cannot be empty.");
|
|
||||||
$(".wr-validation-summary").removeClass("hidden");
|
|
||||||
} else if (!firstname) {
|
|
||||||
$(".wr-validation-summary p").text("Firstname is a required field. It cannot be empty.");
|
|
||||||
$(".wr-validation-summary").removeClass("hidden");
|
|
||||||
} else if (!lastname) {
|
|
||||||
$(".wr-validation-summary p").text("Lastname is a required field. It cannot be empty.");
|
|
||||||
$(".wr-validation-summary").removeClass("hidden");
|
|
||||||
} else if (!emailAddress) {
|
|
||||||
$(".wr-validation-summary p").text("Email is a required field. It cannot be empty.");
|
|
||||||
$(".wr-validation-summary").removeClass("hidden");
|
|
||||||
} else if (!emailIsValid(emailAddress)) {
|
|
||||||
$(".wr-validation-summary p").text("Email is not valid. Please enter a correct email address.");
|
|
||||||
$(".wr-validation-summary").removeClass("hidden");
|
|
||||||
} else {
|
|
||||||
var addUserFormData = {};
|
|
||||||
addUserFormData.username = username;
|
|
||||||
addUserFormData.firstname = firstname;
|
|
||||||
addUserFormData.lastname = lastname;
|
|
||||||
addUserFormData.emailAddress = emailAddress;
|
|
||||||
addUserFormData.userRoles = userRoles;
|
|
||||||
|
|
||||||
var addUserAPI = "/mdm/api/users/add";
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
type : "POST",
|
|
||||||
url : addUserAPI,
|
|
||||||
contentType : "application/json",
|
|
||||||
data : JSON.stringify(addUserFormData),
|
|
||||||
success : function(data) {
|
|
||||||
if (data == 201) {
|
|
||||||
$(".wr-validation-summary p").text("User (" + username + ") was added. " +
|
|
||||||
"An invitation mail will also be sent to this user to initiate a device enrollment.");
|
|
||||||
// Clearing user input fields.
|
|
||||||
$("input#username").val("");
|
|
||||||
$("input#firstname").val("");
|
|
||||||
$("input#lastname").val("");
|
|
||||||
$("input#email").val("");
|
|
||||||
$("select#roles").select2("val", "");
|
|
||||||
} else if (data == 400) {
|
|
||||||
$(".wr-validation-summary p").text("Exception occurred at backend.");
|
|
||||||
} else if (data == 403) {
|
|
||||||
$(".wr-validation-summary p").text("Action was not permitted.");
|
|
||||||
} else if (data == 409) {
|
|
||||||
$(".wr-validation-summary p").text("Sorry, User already exists.");
|
|
||||||
}
|
|
||||||
$(".wr-validation-summary").removeClass("hidden");
|
|
||||||
},
|
|
||||||
error : function() {
|
|
||||||
$(".wr-validation-summary p").text("An unexpected error occurred.");
|
|
||||||
$(".wr-validation-summary").removeClass("hidden");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
@ -1,44 +1,159 @@
|
|||||||
{{#zone "main"}}
|
{{#zone "main"}}
|
||||||
|
|
||||||
<div id="nav" class="row wr-app-bar">
|
<header>
|
||||||
<div class="wr-action-container">
|
<div class="container container-fluid">
|
||||||
<div class="wr-action-btn-bar">
|
<!-- Static navbar -->
|
||||||
<!--<a href="javascript:history.go(-1)" class="cu-btn">
|
<nav class="navbar navbar-default">
|
||||||
<i class="wso2icon wso2-c-left-arrow"></i>Go Back
|
<div class=" margin-top">
|
||||||
</a>-->
|
<!-- Brand and toggle get grouped for better mobile display -->
|
||||||
{{#if permissions.ADD_USER}}
|
<div class="navbar-header">
|
||||||
<a href="/mdm/add-user" class="cu-btn">
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
|
||||||
<span class="wso2icon-stack">
|
<span class="sr-only">Toggle navigation</span>
|
||||||
<i class="wso2icon wso2-ring wso2icon-stack-2x"></i>
|
<span class="icon-bar"></span>
|
||||||
<i class="wso2icon wso2-add wso2icon-stack-1x"></i>
|
<span class="icon-bar"></span>
|
||||||
</span>
|
<span class="icon-bar"></span>
|
||||||
Add User
|
</button>
|
||||||
</a>
|
<a class="navbar-brand" href="#"><img src="{{self.publicURL}}/images/logo.png" </a>
|
||||||
{{/if}}
|
</div>
|
||||||
{{#if permissions.LIST_USERS}}
|
|
||||||
<a href="/mdm/users" class="cu-btn">
|
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||||
<span class="wso2icon-stack">
|
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||||
<i class="wso2icon wso2icon-stack-1x"></i>
|
<ul class="nav navbar-nav">
|
||||||
</span>
|
<li><a href="#"></a></li>
|
||||||
User Management
|
<li><a href="#">ARCHITECTURE</a></li>
|
||||||
</a>
|
<li><a href="#">GUIDE</a></li>
|
||||||
{{/if}}
|
<li><a href="#">SUPPORT</a></li>
|
||||||
{{#if permissions.LIST_DEVICES}}
|
<li><a href="#">COMMUNITY</a></li>
|
||||||
<a href="/mdm" class="cu-btn">
|
</ul>
|
||||||
<span class="wso2icon-stack">
|
|
||||||
<i class="wso2icon wso2icon-stack-1x"></i>
|
<ul class="nav navbar-nav navbar-right">
|
||||||
</span>
|
{{#if viewonly}}
|
||||||
Device Management
|
<li id="flip-login" data-type="login" class="blue sign-toggle-btn" > LOGIN </li>
|
||||||
</a>
|
<li id="flip" data-type="register" class="margin-top blue-btn sign-toggle-btn"> REGISTER </li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<a href="javascript:openNotificationbar()" class="cu-btn wr-notification-toggle-btn">
|
{{#if user}}
|
||||||
<span class="wso2icon-stack-md">
|
<li class="blue">
|
||||||
<i class="wso2icon wso2-bell wso2icon-stack-1-5x"></i>
|
<a href="#" data-toggle="dropdown">
|
||||||
</span>
|
<div class="auth-img">
|
||||||
<span class="wr-notification-bubble">0</span>
|
{{user.username}}
|
||||||
</a>
|
<span class="wso2icon-stack-md wso2icon-lg">
|
||||||
|
<i class="wso2icon wso2-user wso2icon-stack-1-5x"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="dropdown-menu" role="menu">
|
||||||
|
<div class="cu-arrow"></div>
|
||||||
|
<div class="dropdown-menu-content">
|
||||||
|
<a href="{{logoutURL}}" class="filter-item pull-right">Logout</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
|
<li >
|
||||||
|
<form class="navbar-form" role="search">
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" class="form-control" name="q">
|
||||||
|
<div class="input-group-btn">
|
||||||
|
<button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div><!-- /.navbar-collapse -->
|
||||||
|
|
||||||
|
</div><!-- /.container-fluid -->
|
||||||
|
</nav>
|
||||||
|
</div><!--container-->
|
||||||
|
<div class="sign-panel" data-type="register">
|
||||||
|
<div class="container padding margin-top-double ">
|
||||||
|
<h5 >Register </h5> <hr class="opacity">
|
||||||
|
|
||||||
|
<div class="form-group" align="center">
|
||||||
|
<span class="wr-validation-summary hidden">
|
||||||
|
<strong class="label label-danger"></strong>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-10 padding center ">
|
||||||
|
<div class="col-lg-5 right padding-top-double uppercase ">
|
||||||
|
First Name
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 ">
|
||||||
|
<input type="text right" id="first_name" placeholder="First Name">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-10 padding center ">
|
||||||
|
<div class="col-lg-5 right padding-top-double uppercase ">
|
||||||
|
Last Name
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 ">
|
||||||
|
<input type="text right" id="last_name" placeholder="Last Name">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-10 padding center ">
|
||||||
|
<div class="col-lg-5 right padding-top-double uppercase ">
|
||||||
|
Username
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 ">
|
||||||
|
<input type="text right" id="user_name" placeholder="Username ">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-10 padding center ">
|
||||||
|
<div class="col-lg-5 right padding-top-double uppercase ">
|
||||||
|
Email
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 ">
|
||||||
|
<input type="text right" id="email" placeholder="Email">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-10 padding center ">
|
||||||
|
<div class="col-lg-5 right padding-top-double uppercase ">
|
||||||
|
Password
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 ">
|
||||||
|
<input type="password" id="password" placeholder="Password">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-10 padding center ">
|
||||||
|
<div class="col-lg-5 right padding-top-double uppercase ">
|
||||||
|
Confirm Password
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 ">
|
||||||
|
<input type="password" id="password_confirmation" placeholder="Confirm Password">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-9 right padding-top-double padding-bottom-double margin-right-none">
|
||||||
|
<input type="checkbox" name="Agree" id="t_and_c" value="Bike"> <span class="italic">
|
||||||
|
I Agree by Clicking register, you agree to the Terms and Conditions set out by this site</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-lg-12 center padding-top-double padding-bottom-double">
|
||||||
|
<button id="add-user-btn" class="blue-action-btn uppercase margin"> Submit</button>
|
||||||
|
<button class="black-btn uppercase margin " > Cancel</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="sign-panel" data-type="login">
|
||||||
|
<form method="POST" class="form-login-box" action="{{loginPath}}">
|
||||||
|
<div class="container padding margin-top-double ">
|
||||||
|
<h5 >Login </h5> <hr class="opacity">
|
||||||
|
|
||||||
|
<div class="col-lg-3 padding ">
|
||||||
|
Username :<br> <input name="username" type="text" value="">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-3 padding ">
|
||||||
|
Password: <br> <input name="password" type="text" value="">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 padding-top-double padding-bottom-double padding-left-none">
|
||||||
|
<button class="blue-action-btn uppercase margin" onclick="document.location.href='home.html';"> Login</button>
|
||||||
|
<button class="black-btn uppercase margin " > Cancel</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
{{/zone}}
|
{{/zone}}
|
@ -1,16 +1,19 @@
|
|||||||
function onRequest(context) {
|
function onRequest(context){
|
||||||
var userModule = require("/modules/user.js").userModule;
|
var dcProps = require('/config/dc-props.js').config();
|
||||||
var permissions = {};
|
if (dcProps.ssoConfiguration.enabled) {
|
||||||
if (userModule.isAuthorized("/permission/device-mgt/admin/devices/list") ||
|
response.sendRedirect(dcProps.appContext + "sso/login");
|
||||||
userModule.isAuthorized("/permission/device-mgt/user/devices/list")) {
|
exit();
|
||||||
permissions.LIST_DEVICES = true;
|
}else{
|
||||||
|
context.loginPath = "api/user/login";
|
||||||
}
|
}
|
||||||
if (userModule.isAuthorized("/permission/device-mgt/admin/users/list")) {
|
|
||||||
permissions.LIST_USERS = true;
|
var constants = require("/modules/constants.js");
|
||||||
}
|
var localLogoutURL = dcProps.appContext + "api/user/logout";
|
||||||
if (userModule.isAuthorized("/permission/device-mgt/admin/users/add")) {
|
var ssoLogoutURL = dcProps.appContext + "sso/logout";
|
||||||
permissions.ADD_USER = true;
|
context.logoutURL = dcProps.ssoConfiguration.enabled? ssoLogoutURL : localLogoutURL;
|
||||||
}
|
context.user = session.get(constants.USER_SESSION_KEY);
|
||||||
context.permissions = permissions;
|
|
||||||
|
context.viewonly = !context.user;
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
After Width: | Height: | Size: 3.8 KiB |
@ -0,0 +1,32 @@
|
|||||||
|
{{#zone "main"}}
|
||||||
|
<div class="container container-bg white">
|
||||||
|
<h1 class="white">Arduino Uno</h1><hr>
|
||||||
|
<p>Connect your Arduino Uno device to the IBM Internet of Things Foundation.</p>
|
||||||
|
<img src="{{self.publicURL}}/images/arduino-board.png" alt="Arduino UNO Board" width="300" height="253"/><br/>
|
||||||
|
<h2>Prepare</h2>
|
||||||
|
<h6>Get your device ready</h6>
|
||||||
|
<ul>
|
||||||
|
<li>Mount the Ethernet / Wifi shield on the Arduino Uno device.</li>
|
||||||
|
<li>Connect the Arduino Uno to the USB of your computer.</li>
|
||||||
|
<li>Connect an Ethernet cable to the Ethernet / WiFi Shield.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2>Connect (Quickstart)</h2>
|
||||||
|
<h6>Internet of Things Foundation Quickstart connection</h6>
|
||||||
|
<ul>
|
||||||
|
<li>Use the following command to download the installer from GitHub:</li>
|
||||||
|
<li>curl -LO https://github.com/ibm-messaging/iot-arduino.git</li>
|
||||||
|
<li>Download the Sketch installer from the Arduino website http://arduino.cc/en/Main/Software</li>
|
||||||
|
<li>Install the Sketch program</li>
|
||||||
|
<li>Use the Sketch program to open the samples code samples/quickstart/quickstart.ino</li>
|
||||||
|
<li>View the lower part of the Sketch pad window to check that the COM connection is shown as active</li>
|
||||||
|
<li>Compile and deploy the sample code to the Arduino Uno device</li>
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
|
<form method="POST" class="form-login-box" action="{{sketchPath}}">
|
||||||
|
<input type="hidden" name="type" value="arduino" />
|
||||||
|
<button class="blue-btn" type="submit">Create Sketch</button>
|
||||||
|
</form>
|
||||||
|
<br/><br/><br/>
|
||||||
|
</div>
|
||||||
|
{{/zone}}
|
@ -0,0 +1,4 @@
|
|||||||
|
function onRequest(context){
|
||||||
|
context.sketchPath = "api/device/sketch";
|
||||||
|
return context;
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
}
|
After Width: | Height: | Size: 542 KiB |
@ -0,0 +1,22 @@
|
|||||||
|
{{#zone "main"}}
|
||||||
|
<div class="container container-bg">
|
||||||
|
<div data-type="login">
|
||||||
|
<div class="container padding margin-top-double ">
|
||||||
|
<form method="POST" class="white form-login-box" action="{{loginPath}}">
|
||||||
|
<h1 class="white">Login </h1> <hr>
|
||||||
|
|
||||||
|
<div class="col-lg-3 padding ">
|
||||||
|
Username :<br> <input name="username" type="text" value="" placeholder=""/>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-3 padding ">
|
||||||
|
Password: <br> <input name="password" type="password" value="" placeholder=""/>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 padding-top-double padding-bottom-double padding-left-none">
|
||||||
|
<button class="blue-action-btn uppercase margin" onclick="document.location.href='home.html';"> Login</button>
|
||||||
|
<button class="black-btn uppercase margin " > Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/zone}}
|
@ -0,0 +1,10 @@
|
|||||||
|
function onRequest(context){
|
||||||
|
var dcProps = require('/config/dc-props.js').config();
|
||||||
|
if (dcProps.ssoConfiguration.enabled) {
|
||||||
|
response.sendRedirect(dcProps.appContext + "sso/login");
|
||||||
|
exit();
|
||||||
|
}else{
|
||||||
|
context.loginPath = "api/user/login";
|
||||||
|
}
|
||||||
|
return context;
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
$( document ).ready(function() {
|
||||||
|
var currentHash = window.location.hash;
|
||||||
|
if(currentHash=="#auth-failed") {
|
||||||
|
$('.wr-validation-summary p').text("Sorry!, Please make sure to enter correct username and password");
|
||||||
|
$('.wr-validation-summary').removeClass("hidden");
|
||||||
|
}else if(currentHash=="#error"){
|
||||||
|
$('.wr-validation-summary p').text("Sorry!, Error occurred");
|
||||||
|
$('.wr-validation-summary').removeClass("hidden");
|
||||||
|
}
|
||||||
|
$('.btn-download-agent').click(function(){
|
||||||
|
$('.form-login-box').submit();
|
||||||
|
});
|
||||||
|
});
|
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 7.8 KiB |
@ -0,0 +1,143 @@
|
|||||||
|
|
||||||
|
var emailIsValid = function(email) {
|
||||||
|
var atPosition = email.indexOf("@");
|
||||||
|
var dotPosition = email.lastIndexOf(".");
|
||||||
|
return !(atPosition < 1 || ( dotPosition - atPosition < 2 ));
|
||||||
|
};
|
||||||
|
|
||||||
|
var validatePassword = function (psswd, conPass) {
|
||||||
|
var error = "";
|
||||||
|
var illegalChars = /[\W_]/; // allow only letters and numbers
|
||||||
|
|
||||||
|
if ((psswd.length < 5) || (psswd.length > 15)) {
|
||||||
|
error = "The password is of wrong length. Should be between 5 and 15 characters. \n";
|
||||||
|
$('.wr-validation-summary strong').text(error);
|
||||||
|
$('.wr-validation-summary').removeClass("hidden");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
} else if (illegalChars.test(psswd)) {
|
||||||
|
error = "The password contains illegal characters.\n";
|
||||||
|
$('.wr-validation-summary strong').text(error);
|
||||||
|
$('.wr-validation-summary').removeClass("hidden");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
} else if ( (psswd.search(/[a-zA-Z]+/)==-1) || (psswd.search(/[0-9]+/)==-1) ) {
|
||||||
|
error = "The password must contain at least one numeral and one character.\n";
|
||||||
|
$('.wr-validation-summary strong').text(error);
|
||||||
|
$('.wr-validation-summary').removeClass("hidden");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
} else if ( psswd != conPass ) {
|
||||||
|
error = "The password and confirm-password should match.\n";
|
||||||
|
$('.wr-validation-summary strong').text(error);
|
||||||
|
$('.wr-validation-summary').removeClass("hidden");
|
||||||
|
// return false;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
$("button#add-user-btn").click(function(){
|
||||||
|
//e.preventDefault();
|
||||||
|
var username = $("input#user_name").val();
|
||||||
|
var firstname = $("input#first_name").val();
|
||||||
|
var lastname = $("input#last_name").val();
|
||||||
|
var emailAddress = $("input#email").val();
|
||||||
|
var password = $("input#password").val();
|
||||||
|
var passwordConfirm = $("input#password_confirmation").val();
|
||||||
|
|
||||||
|
|
||||||
|
// var userRoles = $("select#roles").val();
|
||||||
|
|
||||||
|
if (!firstname) {
|
||||||
|
$('.wr-validation-summary strong').text("Firstname is a required field. It cannot be empty.");
|
||||||
|
$('.wr-validation-summary').removeClass("hidden");
|
||||||
|
// return false;
|
||||||
|
} else if (!lastname) {
|
||||||
|
$('.wr-validation-summary strong').text("Lastname is a required field. It cannot be empty.");
|
||||||
|
$('.wr-validation-summary').removeClass("hidden");
|
||||||
|
// return false;
|
||||||
|
} else if (!username) {
|
||||||
|
$('span.wr-validation-summary strong').text("Username is a required field. It cannot be empty.");
|
||||||
|
$('.wr-validation-summary').removeClass("hidden");
|
||||||
|
// return false;
|
||||||
|
}else if (!emailAddress) {
|
||||||
|
$('.wr-validation-summary strong').text("Email is a required field. It cannot be empty.");
|
||||||
|
$('.wr-validation-summary').removeClass("hidden");
|
||||||
|
// return false;
|
||||||
|
} else if (!emailIsValid(emailAddress)) {
|
||||||
|
$('.wr-validation-summary strong').text("Email is not valid. Please enter a correct email address.");
|
||||||
|
$('.wr-validation-summary').removeClass("hidden");
|
||||||
|
// return false;
|
||||||
|
} else if (!password) {
|
||||||
|
$('.wr-validation-summary strong').text("Please enter a user login password.");
|
||||||
|
$('.wr-validation-summary').removeClass("hidden");
|
||||||
|
// return false;
|
||||||
|
} else if (!passwordConfirm) {
|
||||||
|
$('.wr-validation-summary strong').text("Please re-type password");
|
||||||
|
$('.wr-validation-summary').removeClass("hidden");
|
||||||
|
// return false;
|
||||||
|
} else if (!validatePassword(password, passwordConfirm)) {
|
||||||
|
// return false;
|
||||||
|
} else if (!$('#t_and_c').is(':checked')) {
|
||||||
|
$('.wr-validation-summary strong').text("Please accept our terms and conditions");
|
||||||
|
$('.wr-validation-summary').removeClass("hidden");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
var addUserFormData = {};
|
||||||
|
addUserFormData.username = username;
|
||||||
|
addUserFormData.firstname = firstname;
|
||||||
|
addUserFormData.lastname = lastname;
|
||||||
|
addUserFormData.emailAddress = emailAddress;
|
||||||
|
addUserFormData.password = password;
|
||||||
|
addUserFormData.userRoles = null;
|
||||||
|
|
||||||
|
var addUserAPI = "/login/users/registration";
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type:'POST',
|
||||||
|
url:addUserAPI,
|
||||||
|
contentType:'application/json',
|
||||||
|
data:JSON.stringify(addUserFormData),
|
||||||
|
success:function(data){
|
||||||
|
if (data == 200) {
|
||||||
|
$('.wr-validation-summary strong').text("Successfully Submitted.");
|
||||||
|
$('.wr-validation-summary strong').removeClass("label-danger");
|
||||||
|
$('.wr-validation-summary strong').addClass("label-success");
|
||||||
|
} else if (data == 201) {
|
||||||
|
$('.wr-validation-summary strong').text("User created.");
|
||||||
|
$('.wr-validation-summary strong').removeClass("label-danger");
|
||||||
|
$('.wr-validation-summary strong').addClass("label-success");
|
||||||
|
} else if (data == 400) {
|
||||||
|
$('.wr-validation-summary strong').text("Exception at backend.");
|
||||||
|
$('.wr-validation-summary strong').removeClass("label-danger");
|
||||||
|
$('.wr-validation-summary strong').addClass("label-warning");
|
||||||
|
} else if (data == 403) {
|
||||||
|
$('.wr-validation-summary strong').text("Action not permitted.");
|
||||||
|
} else if (data == 409) {
|
||||||
|
$('.wr-validation-summary strong').text("User exists.");
|
||||||
|
$('.wr-validation-summary strong').removeClass("label-default");
|
||||||
|
$('.wr-validation-summary strong').addClass("label-success");
|
||||||
|
}
|
||||||
|
$('.wr-validation-summary').removeClass("hidden");
|
||||||
|
$('#password').val('');
|
||||||
|
$('#password_confirmation').val('');
|
||||||
|
// return true;
|
||||||
|
},
|
||||||
|
error:function(){
|
||||||
|
$('.wr-validation-summary strong').text("An unexpected error occurred.");
|
||||||
|
$('.wr-validation-summary').removeClass("hidden");
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,75 @@
|
|||||||
|
{{#zone "main"}}
|
||||||
|
|
||||||
|
<div class="container container-bg">
|
||||||
|
<div class=" margin-top-double padding-top-large ">
|
||||||
|
<div class="row padding-bottom-large">
|
||||||
|
<div class="col-xs-12 col-md-4 col-lg-4 center"><img src="{{self.publicURL}}/images/banner-img.png" class="img-responsive"> </div>
|
||||||
|
<div class="col-lg-8 margin-top-double">
|
||||||
|
<h1 class="white">Ready to connect a device or create an app?</h1>
|
||||||
|
<hr>
|
||||||
|
<p class="margin-bottom-double">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas
|
||||||
|
consectetur rutrum sapien. In ullamcorper nisi nisi, et interdum libero vestibulum at. </p>
|
||||||
|
<button class="blue-btn padding"> Quick Start</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 padding-top ">
|
||||||
|
<div class="product-wrapper rounded dark-grey center">
|
||||||
|
<div class="icon-wrapper">
|
||||||
|
<img src="{{self.publicURL}}/images/raspberry-pi.png" >
|
||||||
|
</div>
|
||||||
|
<h2 class="white center">RaspberryPi</h2>
|
||||||
|
<div class="text-wrapper">
|
||||||
|
Use a Raspberry Pi to connect to the ABC Foundation. Then you can visualize the data
|
||||||
|
generated by the Raspberry Pi. <br><br>
|
||||||
|
</div>
|
||||||
|
<button class="grey-btn">Learn</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 padding-top ">
|
||||||
|
<div class="product-wrapper rounded dark-grey center">
|
||||||
|
<div class="icon-wrapper">
|
||||||
|
<img src="{{self.publicURL}}/images/arduino-uno.png" >
|
||||||
|
</div>
|
||||||
|
<h2 class="white center">ArduinoUno</h2 >
|
||||||
|
<div class="text-wrapper">
|
||||||
|
Connect your Arduino Uno device to the ABC Foundation .<br><br><br><br>
|
||||||
|
</div>
|
||||||
|
<button class="grey-btn" onclick="document.location.href='arduino';">Learn</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class=" col-xs-12 col-sm-6 col-md-3 col-lg-3 padding-top ">
|
||||||
|
<div class="product-wrapper rounded dark-grey center">
|
||||||
|
<div class="icon-wrapper">
|
||||||
|
<img src="{{self.publicURL}}/images/beagle-bone.png" >
|
||||||
|
</div>
|
||||||
|
<h2 class="white center">BeagleBone</h2>
|
||||||
|
<div class="text-wrapper">
|
||||||
|
Use a BeagleBone Black board to visualize the data generated by the
|
||||||
|
SensorTag's temperature, agyroscope, and magnetometer sensors. <br><br>
|
||||||
|
</div>
|
||||||
|
<button class="grey-btn">Learn</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 padding-top ">
|
||||||
|
<div class="product-wrapper rounded dark-grey center">
|
||||||
|
<div class="icon-wrapper">
|
||||||
|
<img src="{{self.publicURL}}/images/intel.png" >
|
||||||
|
</div>
|
||||||
|
<h2 class="white center">IntelGalileo</h2>
|
||||||
|
<div class="text-wrapper">
|
||||||
|
Use an Intel® Galileo to connect to the ABC Foundation.
|
||||||
|
Then you can visualize the data generated by the on-board sensors.<br><br>
|
||||||
|
</div>
|
||||||
|
<button class="grey-btn">Learn</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{/zone}}
|
||||||
|
|
||||||
|
{{#zone "bottomJs"}}
|
||||||
|
<script src="{{self.publicURL}}/scripts/validate-register.js"></script>
|
||||||
|
{{/zone}}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"predicate": "true"
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
.navbar-default {
|
||||||
|
background-color: #2a2a2a;
|
||||||
|
border-color:#2a2a2a ;
|
||||||
|
}
|
||||||
|
.navbar-nav{color: #a5a5a5; font-weight:300; padding-top: 12px; padding-left:0px;}
|
||||||
|
.form-control {background-color: #121212; border: 0px;}
|
||||||
|
.btn-default {background-color: #121212; border: 1px solid #121212;}
|
||||||
|
.container { padding:0px;}
|
||||||
|
.container-fluid{padding-left:0px;}
|
||||||
|
.navbar-default .navbar-nav > li > a {color: #a5a5a5; font-size: 14px; font-weight: 500;}
|
||||||
|
.navbar-form .input-group > .form-control { height: 39px; margin-top: 0; }
|
||||||
|
.input-group-btn:last-child > .btn, .input-group-btn:last-child > .btn-group { height: 39px;}
|
||||||
|
.container-bg{background-image: url("../images/content-bg.png"); background-repeat: no-repeat; background-position: top left; min-height: 550px; overflow: hidden; padding: 0 15px;}
|
||||||
|
.navbar-default .navbar-nav > li > a :focus,.navbar-default .navbar-nav>li>a:hover{color:#ccc;background-color:transparent;}
|
||||||
|
.btn-default.active,
|
||||||
|
.btn-default.focus,
|
||||||
|
.btn-default:active,
|
||||||
|
.btn-default:focus,
|
||||||
|
.btn-default:hover,
|
||||||
|
.open>.dropdown-toggle.btn-default {
|
||||||
|
color: #ccc;
|
||||||
|
background-color: #121212;
|
||||||
|
border-color: #121212;
|
||||||
|
}
|
||||||
|
input {
|
||||||
|
background-color: #333;
|
||||||
|
border: 1px solid #2a2a2a;
|
||||||
|
border-radius: 3px;
|
||||||
|
height: 45px;
|
||||||
|
margin: 5px 0;
|
||||||
|
width: 100%;
|
||||||
|
padding-left: 10px;
|
||||||
|
}
|
||||||
|
input[type="checkbox"], input[type="radio"] {
|
||||||
|
line-height: normal;
|
||||||
|
margin-top: -3px;
|
||||||
|
width: 30px;
|
||||||
|
}
|
@ -0,0 +1,433 @@
|
|||||||
|
/* _____________________________________________________________________________
|
||||||
|
|
||||||
|
FONT
|
||||||
|
_____________________________________________________________________________ */
|
||||||
|
/* Regular */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Open Sans';
|
||||||
|
|
||||||
|
src: url('../fonts/OpenSans-Regular-webfont.eot');
|
||||||
|
src: url('../fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'),
|
||||||
|
url('../fonts/OpenSans-Regular-webfont.woff') format('woff'),
|
||||||
|
url('../fonts/OpenSans-Regular-webfont.ttf') format('truetype'),
|
||||||
|
url('../fonts/OpenSans-Regular-webfont.svg#OpenSansRegular') format('svg');
|
||||||
|
font-weight: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
font-style: normal;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Italic */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Open Sans';
|
||||||
|
src: url('../fonts/OpenSans-Italic-webfont.eot');
|
||||||
|
src: url('../fonts/OpenSans-Italic-webfont.eot?#iefix') format('embedded-opentype'),
|
||||||
|
url('../fonts/OpenSans-Italic-webfont.woff') format('woff'),
|
||||||
|
url('../fonts/OpenSans-Italic-webfont.ttf') format('truetype'),
|
||||||
|
url('../fonts/OpenSans-Italic-webfont.svg#OpenSansItalic') format('svg');
|
||||||
|
font-weight: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
font-style: italic;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Light */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Open Sans';
|
||||||
|
src: url('../fonts/OpenSans-Light-webfont.eot');
|
||||||
|
src: url('../fonts/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'),
|
||||||
|
url('../fonts/OpenSans-Light-webfont.woff') format('woff'),
|
||||||
|
url('../fonts/OpenSans-Light-webfont.ttf') format('truetype'),
|
||||||
|
url('../fonts/OpenSans-Light-webfont.svg#OpenSansLight') format('svg');
|
||||||
|
font-weight: 200;
|
||||||
|
font-style: normal;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Light Italic */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Open Sans';
|
||||||
|
src: url('../fonts/OpenSans-LightItalic-webfont.eot');
|
||||||
|
src: url('../fonts/OpenSans-LightItalic-webfont.eot?#iefix') format('embedded-opentype'),
|
||||||
|
url('../fonts/OpenSans-LightItalic-webfont.woff') format('woff'),
|
||||||
|
url('../fonts/OpenSans-LightItalic-webfont.ttf') format('truetype'),
|
||||||
|
url('../fonts/OpenSans-LightItalic-webfont.svg#OpenSansLightItalic') format('svg');
|
||||||
|
font-weight: 200;
|
||||||
|
font-style: italic;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Semibold */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Open Sans';
|
||||||
|
src: url('../fonts/OpenSans-Semibold-webfont.eot');
|
||||||
|
src: url('../fonts/OpenSans-Semibold-webfont.eot?#iefix') format('embedded-opentype'),
|
||||||
|
url('../fonts/OpenSans-Semibold-webfont.woff') format('woff'),
|
||||||
|
url('../fonts/OpenSans-Semibold-webfont.ttf') format('truetype'),
|
||||||
|
url('../fonts/OpenSans-Semibold-webfont.svg#OpenSansSemibold') format('svg');
|
||||||
|
font-weight: 500;
|
||||||
|
font-style: normal;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Semibold Italic */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Open Sans';
|
||||||
|
src: url('../fonts/OpenSans-SemiboldItalic-webfont.eot');
|
||||||
|
src: url('../fonts/OpenSans-SemiboldItalic-webfont.eot?#iefix') format('embedded-opentype'),
|
||||||
|
url('../fonts/OpenSans-SemiboldItalic-webfont.woff') format('woff'),
|
||||||
|
url('../fonts/OpenSans-SemiboldItalic-webfont.ttf') format('truetype'),
|
||||||
|
url('../fonts/OpenSans-SemiboldItalic-webfont.svg#OpenSansSemiboldItalic') format('svg');
|
||||||
|
font-weight: 500;
|
||||||
|
font-style: italic;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Bold */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Open Sans';
|
||||||
|
src: url('../fonts/OpenSans-Bold-webfont.eot');
|
||||||
|
src: url('../fonts/OpenSans-Bold-webfont.eot?#iefix') format('embedded-opentype'),
|
||||||
|
url('../fonts/OpenSans-Bold-webfont.woff') format('woff'),
|
||||||
|
url('../fonts/OpenSans-Bold-webfont.ttf') format('truetype'),
|
||||||
|
url('../fonts/OpenSans-Bold-webfont.svg#OpenSansBold') format('svg');
|
||||||
|
font-weight: bold;
|
||||||
|
font-weight: 700;
|
||||||
|
font-style: normal;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Bold Italic */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Open Sans';
|
||||||
|
src: url('../fonts/OpenSans-BoldItalic-webfont.eot');
|
||||||
|
src: url('../fonts/OpenSans-BoldItalic-webfont.eot?#iefix') format('embedded-opentype'),
|
||||||
|
url('../fonts/OpenSans-BoldItalic-webfont.woff') format('woff'),
|
||||||
|
url('../fonts/OpenSans-BoldItalic-webfont.ttf') format('truetype'),
|
||||||
|
url('../fonts/OpenSans-BoldItalic-webfont.svg#OpenSansBoldItalic') format('svg');
|
||||||
|
font-weight: bold;
|
||||||
|
font-weight: 700;
|
||||||
|
font-style: italic;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Extra Bold */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Open Sans';
|
||||||
|
src: url('../fonts/OpenSans-ExtraBold-webfont.eot');
|
||||||
|
src: url('../fonts/OpenSans-ExtraBold-webfont.eot?#iefix') format('embedded-opentype'),
|
||||||
|
url('../fonts/OpenSans-ExtraBold-webfont.woff') format('woff'),
|
||||||
|
url('../fonts/OpenSans-ExtraBold-webfont.ttf') format('truetype'),
|
||||||
|
url('../fonts/OpenSans-ExtraBold-webfont.svg#OpenSansExtrabold') format('svg');
|
||||||
|
font-weight: 900;
|
||||||
|
font-style: normal;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Extra Bold Italic */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Open Sans';
|
||||||
|
src: url('../fonts/OpenSans-ExtraBoldItalic-webfont.eot');
|
||||||
|
src: url('../fonts/OpenSans-ExtraBoldItalic-webfont.eot?#iefix') format('embedded-opentype'),
|
||||||
|
url('../fonts/OpenSans-ExtraBoldItalic-webfont.woff') format('woff'),
|
||||||
|
url('../fonts/OpenSans-ExtraBoldItalic-webfont.ttf') format('truetype'),
|
||||||
|
url('../fonts/OpenSans-ExtraBoldItalic-webfont.svg#OpenSansExtraboldItalic') format('svg');
|
||||||
|
font-weight: 900;
|
||||||
|
font-style: italic;
|
||||||
|
|
||||||
|
}
|
||||||
|
/* _____________________________________________________________________________
|
||||||
|
|
||||||
|
RESET
|
||||||
|
_____________________________________________________________________________ */
|
||||||
|
html, body, div, span, object, iframe,
|
||||||
|
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||||
|
abbr, address, cite, code,
|
||||||
|
del, dfn, em, img, ins, kbd, q, samp,
|
||||||
|
small, strong, sub, sup, var,
|
||||||
|
b, i,
|
||||||
|
dl, dt, dd, ol, ul, li,
|
||||||
|
fieldset, form, label, legend,
|
||||||
|
table, caption, tbody, tfoot, thead, tr, th, td,
|
||||||
|
article, aside, canvas, details, figcaption, figure,
|
||||||
|
footer, header, hgroup, menu, nav, section, summary,
|
||||||
|
time, mark, audio, video {
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
border:0;
|
||||||
|
outline:0;
|
||||||
|
font-size:100%;
|
||||||
|
vertical-align:baseline;
|
||||||
|
background:transparent;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
font-family: 'Open Sans';
|
||||||
|
line-height:1;
|
||||||
|
color:#141414;
|
||||||
|
line-height:1;
|
||||||
|
background:#676767;
|
||||||
|
margin: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
article,aside,details,figcaption,figure,
|
||||||
|
footer,header,hgroup,menu,nav,section {
|
||||||
|
display:block;
|
||||||
|
}
|
||||||
|
nav ul {
|
||||||
|
list-style:none;
|
||||||
|
}
|
||||||
|
blockquote, q {
|
||||||
|
quotes:none;
|
||||||
|
}
|
||||||
|
blockquote:before, blockquote:after,
|
||||||
|
q:before, q:after {
|
||||||
|
content:'';
|
||||||
|
content:none;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
font-size:100%;
|
||||||
|
vertical-align:baseline;
|
||||||
|
background:transparent;
|
||||||
|
}
|
||||||
|
/* change colours to suit your needs */
|
||||||
|
ins {
|
||||||
|
background-color:#ff9;
|
||||||
|
color:#000;
|
||||||
|
text-decoration:none;
|
||||||
|
}
|
||||||
|
/* change colours to suit your needs */
|
||||||
|
mark {
|
||||||
|
background-color:#ff9;
|
||||||
|
color:#000;
|
||||||
|
font-style:italic;
|
||||||
|
font-weight:bold;
|
||||||
|
}
|
||||||
|
del {
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
abbr[title], dfn[title] {
|
||||||
|
border-bottom:1px dotted;
|
||||||
|
cursor:help;
|
||||||
|
}
|
||||||
|
table {
|
||||||
|
border-collapse:collapse;
|
||||||
|
border-spacing:0;
|
||||||
|
}
|
||||||
|
/* change border colour to suit your needs */
|
||||||
|
hr {
|
||||||
|
display:block;
|
||||||
|
height:1px;
|
||||||
|
border:0;
|
||||||
|
border-top:1px solid #7f7f7f;
|
||||||
|
margin:1em 0;
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
input, select {
|
||||||
|
vertical-align:middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* _____________________________________________________________________________
|
||||||
|
|
||||||
|
TYPOGRAPHY
|
||||||
|
_____________________________________________________________________________ */
|
||||||
|
|
||||||
|
|
||||||
|
p{font-size:17px; line-height:24px; color:#c7c7c7;}
|
||||||
|
h1{ font-size:39px;font-weight:100; line-height:Auto; font-style: normal;}
|
||||||
|
h2{font-size:24px; line-height:Auto; font-weight: 300; }
|
||||||
|
h3{font-size:15px; line-height:Auto; font-weight: 400; }
|
||||||
|
h4{font-size:20px; line-height:Auto; font-weight: 400; }
|
||||||
|
h5{ font-size:30px;font-weight:100; line-height:Auto; font-style: normal; color: #929292;}
|
||||||
|
.font-small{font-size:12px;}
|
||||||
|
.font-medium{font-size:30px;}
|
||||||
|
.font-large{font-size:16px;}
|
||||||
|
.medium-weight{font-weight: 100;}
|
||||||
|
|
||||||
|
.uppercase{text-transform:uppercase;}
|
||||||
|
.capitalize{text-transform:capitalize;}
|
||||||
|
.lowercase{text-transform:lowercase;}
|
||||||
|
|
||||||
|
|
||||||
|
.light-blue{color:#3a9ecf;}
|
||||||
|
.black{color:#000;}
|
||||||
|
.grey{color:#333;}
|
||||||
|
.white{color:#FFF;}
|
||||||
|
.blue{color: #00979c;}
|
||||||
|
|
||||||
|
.bold{font-weight:bold;}
|
||||||
|
.no-underline{text-decoration:none;}
|
||||||
|
.italic{font-style: italic;}
|
||||||
|
|
||||||
|
.center{text-align:center;}
|
||||||
|
.right{text-align:right;}
|
||||||
|
.left{text-align:left;}
|
||||||
|
.justify{text-align:justify;}
|
||||||
|
|
||||||
|
.middle{vertical-align: middle;}
|
||||||
|
|
||||||
|
.top{vertical-align: top;}
|
||||||
|
.middle{vertical-align: middle;}
|
||||||
|
.bottom{vertical-align: bottom;}
|
||||||
|
.rounded{-webkit-border-radius: 5px;
|
||||||
|
-moz-border-radius: 5px;
|
||||||
|
border-radius: 5px;}
|
||||||
|
/* _____________________________________________________________________________
|
||||||
|
|
||||||
|
BACKGROUND
|
||||||
|
_____________________________________________________________________________ */
|
||||||
|
.grey-bg{ background-color:#f6f4f4;}
|
||||||
|
.light-grey-bg{ background-color:#f5f5f5 ; }
|
||||||
|
.white-bg{background-color:#fff;}
|
||||||
|
.off-white{background-color:#3a9ecf;}
|
||||||
|
.dark-grey{background-color: #2a2a2a;}
|
||||||
|
|
||||||
|
/* _____________________________________________________________________________
|
||||||
|
|
||||||
|
Main
|
||||||
|
_____________________________________________________________________________ */
|
||||||
|
|
||||||
|
body { margin: 0; }
|
||||||
|
header{background-color: #2a2a2a;}
|
||||||
|
.content-wrapper{background-color:#676767;}
|
||||||
|
|
||||||
|
.product-wrapper{ float: left; width:100%; min-height: 293px; -webkit-box-shadow: 5px 5px 5px 0px rgba(0,0,0,0.14);
|
||||||
|
-moz-box-shadow: 5px 5px 5px 0px rgba(0,0,0,0.14);
|
||||||
|
box-shadow: 5px 5px 5px 0px rgba(0,0,0,0.14);}
|
||||||
|
.icon-wrapper{min-height: 110px; padding-top: 12px; text-align: center; }
|
||||||
|
.text-wrapper{margin:15px; font-size:14px; border-top: 1px solid #404040; padding-top: 20px; color:#c6c5c5; line-height: 18px; text-align: center }
|
||||||
|
.sign-panel {background-color: #191919; width: 100%; height: auto; min-height: 150px; display: none; padding:15px; color: #a5a5a5; cursor:pointer;}
|
||||||
|
#flip-login{ font-weight: 500; font-size: 14px; padding: 20px; cursor:pointer;}
|
||||||
|
|
||||||
|
/* ____________________________________________________________________________
|
||||||
|
|
||||||
|
COLUMNS
|
||||||
|
_____________________________________________________________________________ */
|
||||||
|
|
||||||
|
.col-row{width:100%; height: 100px;}
|
||||||
|
.col-x-large{width:100%; }
|
||||||
|
.col-large{width:75%; }
|
||||||
|
.col-medium{width:50%; }
|
||||||
|
.col-small{width:24%; }
|
||||||
|
.col-x-small{width:10%; }
|
||||||
|
|
||||||
|
.opacity{opacity: 0.2;}
|
||||||
|
/* ____________________________________________________________________________
|
||||||
|
|
||||||
|
padding-margin
|
||||||
|
_____________________________________________________________________________ */
|
||||||
|
.padding-left {padding-left:10px;}
|
||||||
|
.padding-right {padding-right:10px;}
|
||||||
|
.padding-top {padding-top:10px;}
|
||||||
|
.padding-bottom {padding-bottom:10px;}
|
||||||
|
.padding{padding:10px;}
|
||||||
|
.padding-none{ padding:0px;}
|
||||||
|
.padding-left-none{ padding-left:0px;}
|
||||||
|
|
||||||
|
.padding-left-double {padding-left:20px;}
|
||||||
|
.padding-right-double {padding-right:20px;}
|
||||||
|
.padding-top-double {padding-top:20px;}
|
||||||
|
.padding-bottom-double {padding-bottom:20px;}
|
||||||
|
.padding-double{padding:20px;}
|
||||||
|
.padding-top-large{padding-top:60px;}
|
||||||
|
.padding-bottom-large{padding-bottom:60px;}
|
||||||
|
|
||||||
|
.margin-left {margin-left:10px;}
|
||||||
|
.margin-right {margin-right:10px;}
|
||||||
|
.margin-top {margin-top:10px;}
|
||||||
|
.margin-bottom {margin-bottom:10px;}
|
||||||
|
.margin{margin:10px;}
|
||||||
|
|
||||||
|
|
||||||
|
.margin-left-double {margin-left:20px;}
|
||||||
|
.margin-right-double {margin-right:20px;}
|
||||||
|
.margin-top-double {margin-top:20px;}
|
||||||
|
.margin-bottom-double {margin-bottom:20px;}
|
||||||
|
.margin-double{margin:20px;}
|
||||||
|
.margin-left-none{margin-left: 0px;}
|
||||||
|
.margin-right-none{margin-right: 0px;}
|
||||||
|
|
||||||
|
.float-left{float:left;}
|
||||||
|
.float-right{float:right;}
|
||||||
|
.clear{ clear:both;}
|
||||||
|
|
||||||
|
.inline-block{display: inline-block;}
|
||||||
|
.relative{ position:relative;}
|
||||||
|
|
||||||
|
.border-bottom{border-bottom: 1px solid #efefef;}
|
||||||
|
|
||||||
|
/* ____________________________________________________________________________
|
||||||
|
|
||||||
|
button
|
||||||
|
_____________________________________________________________________________ */
|
||||||
|
.blue-btn {
|
||||||
|
-webkit-border-radius: 5;
|
||||||
|
-moz-border-radius: 5;
|
||||||
|
border-radius: 5px;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 500;
|
||||||
|
background: #00979c;
|
||||||
|
padding: 10px 20px 10px 20px;
|
||||||
|
text-decoration: none;
|
||||||
|
border: 0px; cursor:pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blue-btn:hover {
|
||||||
|
background: #00787a;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.blue-action-btn {
|
||||||
|
-webkit-border-radius: 2px;
|
||||||
|
-moz-border-radius: 2px;
|
||||||
|
border-radius: 2px;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 500;
|
||||||
|
background: #00979c;
|
||||||
|
padding: 10px 30px;
|
||||||
|
height: 45px;
|
||||||
|
text-decoration: none;
|
||||||
|
border: 0px; cursor:pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blue-action-btn:hover {
|
||||||
|
background: #00787a;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.black-btn {
|
||||||
|
-webkit-border-radius: 2px;
|
||||||
|
-moz-border-radius: 2px;
|
||||||
|
border-radius: 2px;
|
||||||
|
color: #ccc;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 500;
|
||||||
|
background: #333333;
|
||||||
|
padding: 10px 30px;
|
||||||
|
height: 45px;
|
||||||
|
text-decoration: none;
|
||||||
|
border: 0px; cursor:pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.black-btn:hover {
|
||||||
|
background: #2a2a2a;
|
||||||
|
text-decoration: none; ;
|
||||||
|
}
|
||||||
|
.grey-btn {
|
||||||
|
-webkit-border-top-left-radius: 5px;
|
||||||
|
-webkit-border-top-right-radius: 5px;
|
||||||
|
-moz-border-radius-topleft: 5px;
|
||||||
|
-moz-border-radius-topright: 5px;
|
||||||
|
border-top-left-radius: 5px;
|
||||||
|
border-top-right-radius: 5px;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 300;
|
||||||
|
background: #1a1a1a;
|
||||||
|
padding: 10px 20px 10px 20px;
|
||||||
|
text-decoration: none;
|
||||||
|
border: 0px;
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 57 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 61 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 61 KiB |
After Width: | Height: | Size: 57 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 61 KiB |
After Width: | Height: | Size: 62 KiB |