Commit 0153d886 authored by Eirik Alvær's avatar Eirik Alvær

Initial commit.

parent 6331e072
components
.idea
.settings
.classpath
.project
tags
*.swp
*.iml
*.sublime-project
*.sublime-workspace
config/config.js
Nesstar Touch
=============
This is the front end part of a mobile web app for accessing Nesstar
repositories. It depends on the NesstarDrop project as the backend.
To get it up and running
------------------------
$ Install bower (With NPM: `npm install -g bower`)
$ Install dependencies: `bower install`
$ rename `config/config.js.example` to `config.js` and edit to suit your setup
$ open index.html in you favourite broser (preferrably Chrome ;)
If your REST server expects a namespace on the URL path (such as
`/api/study/list` instead of `/study/list`), add it to the
`config/config.js`file. You can specify either a namespace (`/api`) or a URL
(`http://my-host:8080/api`).
{
"name": "NesstarTouch",
"version": "0.0.1",
"ignore": [
"**/.*",
"node_modules",
"components"
],
"dependencies": {
"dojo": "1.9.0rc2",
"dojox": "1.9.0rc2",
"dijit": "1.9.0rc2"
}
}
window.config = {
baseUrl: 'http://129.177.92.208/api/',
useAlternativeConsole: false
}
@charset 'UTF-8';
.pageOverlay {
position: absolute;
width: 100%;
z-index: 1001;
display: block;
top: 0; left: 0; right: 0; bottom: 0;
}
#splash {
background: #fff url('../components/dijit/themes/claro/images/loadingAnimation.gif') no-repeat 50% 50%;
}
#splash p {
position: absolute;
bottom: 40%;
font-family: Helvetica, Arial, verdana, sans-serif;
width: 100%;
text-align: center;
color: #999;
}
@charset 'UTF-8';
.scrollable-view {
overflow: auto;
-webkit-overflow-scrolling: touch;
}
.search-enabled-list {
display: block;
float: none;
margin-top: 2.5em;
}
.text-view {
padding: 0 0.25em;
}
#table {
margin: 18px;
}
#table table, #table td {
border: 1px solid #333;
border-collapse: collapse;
}
#table .stub {
text-align: left;
}
#table .header {
text-align: center;
}
#table .cell {
text-align: right;
}
#table td {
padding: 4px;
}
.dragging-avatar {
position: fixed;
height: 43px;
line-height: 43px;
font-weight: bold;
padding-left: 1em;
background-color: #fff;
border: 1px solid #adaaad;
border-radius: 8px;
box-shadow: 4px 4px 4px #888;
}
.droppable {
border-color: blue;
}
.hovered {
border-color: #51cbee;
}
.disabled {
color: #ddd;
}
.positionIndicator {
height: 1px;
background-color: #51cbee;
list-style-type: none;
@include box-shadow(0 0 2px #51cbee);
@include transition(all, 0.30s, ease-in-out);
}
.search-box {
font-size: 1.2em;
width: 100%;
}
.search-box-pane {
position: relative;
padding: 0.6em;
display: block;
}
.moreButton {
display: block;
width: 12em;
margin: 1em auto;
}
.variableMetadataText {
width: 100%;
table-layout: fixed;
}
.variableMetadataText th {
font-weight: normal;
text-align: left;
}
.variableMetadataText, .variableMetadataText td {
border: none;
}
.variableMetadataText td {
text-overflow: ellipsis;
overflow: hidden;
}
.variableMetadataText th, .variableMetadataText td {
padding: .1em .5em .1em 0;
}
.variableMetadataText td {
white-space: nowrap;
}
.variableMetadataText .catValu {
width: 15%;
}
.variableMetadataText .catStat {
width: 15%;
text-align: right;
}
.variableMetadataText .labl {
max-width: 60%;
}
.variableMetadataText .bars {
width: 40%;
}
.variableMetadataText .bar-wrapper {
font-size: 80%;
}
.variableMetadataText .bar {
display: block;
float: left;
margin-right: .1em;
background-color: rgb(40,130,190);
border-bottom: 1px solid #555;
border-right: 1px solid #555;
border-top: 1px solid #eee;
border-left: 1px solid #eee;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;
height: 1em;
}
table.metadataText, table.metadataText th{
border: 1px solid grey;
border-collapse: collapse;
text-align: center;
}
table.metadataText td {
border: 1px solid grey;
border-collapse: collapse;
text-align: left;
padding: .1em;
}
table.metadataText th {
background-color: #dedede;
padding: .1em;
}
img.mblListItemRightIcon {
border-left: 1px solid grey;
margin: 0;
}
.mblRoundRectCategory {
white-space : normal;
margin-left: 2px;
}
.text-view .mblRoundRectCategory {
margin-left: 0;
}
.mblAccordionTitle {
height: 2.7em;
line-height: 2.7em;
}
#studyListData .mblVariableHeight {
padding: 0 0 0 8px;
}
#variables .mblListItem {
padding: 0 0 0 8px;
}
#gototop {
visibility: hidden;
z-index: 1;
position: fixed;
left: 10px;
bottom: 10px;
text-decoration: none;
color: #bbb;
/* transition */
-webkit-transition: 1s;
-moz-transition: 1s;
transition: 1s;
padding: 10px;
}
/* arrow icon (span tag) */
#gototop span {
width: 70px;
height: 70px;
display: block;
margin-bottom: 7px;
background: #ddd url(../images/up-arrow.png) no-repeat center center;
/* rounded corners */
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
/* transition */
-webkit-transition: 1s;
-moz-transition: 1s;
transition: 1s;
}
\ No newline at end of file
This diff is collapsed.
/*global define */
define(['dojo/_base/declare',
'dojo/_base/array',
'dojo/topic',
'dojox/mobile/ListItem',
'dojox/mobile/RoundRectList'], function (declare, arrayUtils, topic, ListItem, RoundRectList) {
return declare('nesstartouch.AnalysisTypeList', [RoundRectList], {
startup: function () {
this.inherited(arguments);
arrayUtils.forEach(this._types, function (someType, index) {
var checked = index === this._defaultType,
item = {
'label': someType,
'moveTo': '#settings',
'transitionDir': -1,
'noArrow': true,
'checked': checked,
'analysisType': someType,
onClick: function (obj) {
obj.checked = true;
window.nesstartouch.analysisType = this.analysisType;
}
};
this.addChild(new ListItem(item));
}, this);
},
markSelectedAnalysisType: function () {
console.log("marking analysis type");
var selectedType = window.nesstartouch.analysisType;
if (selectedType === undefined) {
return;
}
arrayUtils.forEach(this.getChildren(), function (child) {
if (child.analysisType === selectedType) {
console.log("marked", child);
child.checked = true;
}
});
},
getDefaultAnalysisType: function () {
return this._types[this._defaultType];
},
_defaultType : 0, // tabulation
_types : ['Tabulation', 'Regression', 'Correlation']
});
});
/*global define */
define(['dojo/_base/declare',
'dojo/_base/array',
'dojox/lang/functional',
'dojox/mobile/RoundRectCategory',
'dojo/dom-construct',
'nesstartouch/_RestMixin',
"dojox/charting/axis2d/Default"], function (declare, arrayUtil, functional, RoundRectCategory, domConstruct, _RestMixin) {
"use strict";
return declare('nesstartouch.CorrelationBuilder', [_RestMixin], {
html: "",
rowVariables: [],
columnVariables: [],
idLabelMaps: [],
displayOptions: [],
constructor: function (correlationData, idLabelMaps, displayOptions) {
var table = domConstruct.create("table");
this.idLabelMaps = idLabelMaps;
this.displayOptions = displayOptions;
this.rowVariables = [];
this.columnVariables = [];
this._extractRowColumnVariables(correlationData.resultValuesMap);
this._createCorrelationTable(correlationData.resultValuesMap, table);
this.html = table.outerHTML;
},
_extractRowColumnVariables: function (data) {
var self = this;
functional.forIn(data, function (value, key) {
self._divideVariablesInKey(key);
});
},
_divideVariablesInKey: function (key) {
var variable = key.split("|");
if (-1 === this.rowVariables.indexOf(variable[0])) {
this.rowVariables.push(variable[0]);
}
if (-1 === this.columnVariables.indexOf(variable[1])) {
this.columnVariables.push(variable[1]);
}
},
_createCorrelationTable: function (correlationData, table) {
this._createCorrelationTableHead(table);
this._createCorrelationTableBody(correlationData, table);
},
_createCorrelationTableHead: function (table) {
var tr = domConstruct.create("tr", null, table),
self = this;
domConstruct.create("td", null, tr);
if (0 !== this.displayOptions.length) {
domConstruct.create("td", null, tr);
}
arrayUtil.forEach(this.rowVariables, function (variableId) {
domConstruct.create("td", {innerHTML: self.idLabelMaps[variableId], 'class': 'header label'}, tr);
});
},
_createCorrelationTableBody: function (correlationData, table) {
var self = this;
arrayUtil.forEach(this.columnVariables, function (variableId) {
self._createOneColumnTable(correlationData, variableId, table);
});
},
_createOneColumnTable: function (correlationData, variableId, table) {
var tr = domConstruct.create("tr", null, table),
self = this;
domConstruct.create("td", {innerHTML: this.idLabelMaps[variableId], rowspan: this.displayOptions.length + 1, 'class': 'stub label'}, tr);
if (0 !== this.displayOptions.length) {
domConstruct.create("td", {innerHTML: "Correlation", 'class': 'stub label'}, tr);
}
this._createOneOptionColumn(correlationData, variableId, "Correlation", tr);
arrayUtil.forEach(this.displayOptions, function (option) {
var extraTr = domConstruct.create("tr", null, table);
domConstruct.create("td", {innerHTML: option, 'class': 'stub label'}, extraTr);
self._createOneOptionColumn(correlationData, variableId, option, extraTr);
});
},
_createOneOptionColumn: function (correlationData, variableId, option, tr) {
var self = this;
arrayUtil.forEach(this.rowVariables, function (rowVariableId) {
var temp = correlationData[rowVariableId + "|" + variableId];
if (undefined !== temp) {
domConstruct.create("td", {innerHTML: self._showFourDigits(temp[self._types[option]]), 'class': 'cell'}, tr);
} else {
domConstruct.create("td", {innerHTML: "-", 'class': 'cell'}, tr);
}
});
},
_showFourDigits: function (value) {
var res;
if (!this.isIntAndString(value)) {
res = value.toFixed(4);
} else {
res = value;
}
return res;
},
isIntAndString: function (n) {
return (typeof n === 'number' && n % 1 === 0) || (typeof n === 'string');
},
_types: {
"Correlation": "correlationCoefficient",
"Significance": "significance",
"Count": "caseCount",
},
});
});
/*global define */
define(['dojo/_base/declare',
'dojo/_base/array',
'dijit/registry',
'dojox/mobile/ListItem',
'dojox/mobile/RoundRectList'], function (declare, arrayUtils, registry, ListItem, RoundRectList) {
return declare('nesstartouch.correlationDisplayOptions', [RoundRectList], {
startup: function () {
var self = this,
parent = this.getParent();
this.inherited(arguments);
arrayUtils.forEach(this._types, function (someType, index) {
var item = {
'label': someType,
'noArrow': true,
'displayOption': someType,
onClick: function (obj) {
obj.checked = true;
if (!window.nesstartouch.correlation) {
window.nesstartouch.correlation = {};
}
}
};
this.addChild(new ListItem(item));
}, this);
parent.onBeforeTransitionIn = function () {
self.markSelectedAnalysisType();
};
parent.onBeforeTransitionOut = function () {
window.nesstartouch.correlation.displayOptions = [];
var displayOptions = window.nesstartouch.correlation.displayOptions;
arrayUtils.forEach(self.getChildren(), function (child) {
if (child.checked) {
displayOptions.push(child.label);
}
});
};
},
markSelectedAnalysisType: function () {
var displayOptions = window.nesstartouch.correlation.displayOptions;
if (displayOptions === undefined) {
return;
}
arrayUtils.forEach(this.getChildren(), function (child) {
if (-1 !== displayOptions.indexOf(child.displayOption)) {
child.checked = true;
}
});
},
_types : ['Significance', 'Count'],
});
});
This diff is collapsed.
/*global define */
define(['dojo/_base/declare',
'dojo/dom-geometry',
'dojo/dom',
'dojo/dom-construct',
'dojo/dom-style',
'dojo/dom-class',
'dojo/query',
'dojo/_base/window'], function (declare, geometry, dom, domConstruct, style, domClass, query, win) {
"use strict";
return declare('nesstartouch.Avatar', null, {
constructor: function (node) {
var nodeInfo = geometry.position(node),
label = this._createLabel(node);
this.avatar = domConstruct.create("div", { innerHTML: label });
domClass.add(this.avatar, 'dragging-avatar');
style.set(this.avatar, 'width', nodeInfo.w.toString() + 'px');
this.move({'x': nodeInfo.x.toString(), 'y': nodeInfo.y.toString()});
domConstruct.place(this.avatar, win.body());
domClass.add(node, 'disabled');
},
move: function (pos) {
style.set(this.avatar, 'left', pos.x + 'px');
style.set(this.avatar, 'top', pos.y + 'px');
},
getPosition: function () {
return geometry.position(this.avatar);
},
destroy: function () {
domConstruct.destroy(this.avatar);
},
_createLabel: function (node) {
var labelNode = query(".mblListItemLabel", node),
label;
if (labelNode && labelNode.length > 0) {
label = labelNode[0].innerHTML;
} else {
label = node.innerHTML;
}
return label;
},
});
});
/*global define */
define(['dojo/_base/declare',
'dojo/_base/array',
'dojox/mobile/ListItem',
'dojox/mobile/RoundRectList'], function (declare, arrayUtils, ListItem, RoundRectList) {
return declare('nesstartouch.MeasureTypeList', [RoundRectList], {
startup: function () {
this.inherited(arguments);
arrayUtils.forEach(this._types, function (someType, index) {
var checked = index === this._defaultType,
item = {
'label': someType.label,
'moveTo': '#settings',
'transitionDir': -1,
'noArrow': true,
'checked': checked,
'measureType': someType,
onClick: function (obj) {
obj.checked = true;
window.nesstartouch.tabulation.measure.type = this.measureType;
}
};
this.addChild(new ListItem(item));
}, this);
},
markSelectedMeasureType: function () {
console.log("marking");
var selectedType = window.nesstartouch.tabulation.measure.type;
if (selectedType === undefined) {
return;
}
arrayUtils.forEach(this.getChildren(), function (child) {
if (child.measureType.id === selectedType.id) {
console.log("marked", child);
child.checked = true;
}
});
},
getDefaultType: function () {
return this._types[this._defaultType];
},
_defaultType : 5, // sum
_types : [
{
'label': 'Mean',
'id': 'MEAN'
},
{
'label': 'Median',
'id': 'MEDIAN'
},
{
'label': 'Standard deviation',
'id': 'STDDEV'
},
{
'label': 'Minimum',
'id': 'MIN'
},
{
'label': 'Maximum',
'id': 'MAX'
},
{
'label': 'Sum of values',
'id': 'SUM'
},
{
'label': 'Number of cases',
'id': 'COUNT'
},
{
'label': 'Lower 95 confidence interval',
'id': 'CI95MIN'
},
{
'label': 'Higher 95 confidence interval',
'id': 'CI95MAX'
},
{
'label': 'Lower 99 confidence interval',
'id': 'CI99MIN'
},
{
'label': 'Higher 99 confidence interval',