Skip to content

Commit

Permalink
Merge pull request #1 from ChakshuGautam/fix/local
Browse files Browse the repository at this point in the history
Fix/local
  • Loading branch information
ChakshuGautam authored May 11, 2022
2 parents c06dc37 + 85fe4e2 commit 1f8ae59
Show file tree
Hide file tree
Showing 173 changed files with 12,822 additions and 26,939 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v14.19.1
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
60 changes: 56 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,19 @@ Enketo has been used all around the world for a wide range of uses from needs as

![Screencast from 03-02-22 05_31_50 PM IST](https://user-images.githubusercontent.com/56133783/152341126-ac03baa3-258c-473a-956a-d0973682234a.gif)


## Requirements :scroll:

1. Your machine should have [Yarn](https://classic.yarnpkg.com/en/docs/install/#windows-stable) or [Npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), [Docker](https://docs.docker.com/get-docker/), [Python](https://www.python.org/downloads/) installed.

*Note: Preferable Npm version (6.14.15) and Node version(v14.18.1) and Ubuntu OS version(18.04)**

2. Check the node and npm version by running following commands.

```sh
node -v
npm -v
```


## Installation Steps :walking:

### 1. Fork it :fork_and_knife:
Expand Down Expand Up @@ -68,6 +67,7 @@ git remote -v
origin https://github.com/Your_Username/enketo.git (fetch)
origin https://github.com/Your_Username/enketo.git (push)
```

### 4. Run it :checkered_flag:

```sh
Expand Down Expand Up @@ -96,12 +96,64 @@ cd ../forms
python3 -m http.server
```

You can preview your form on http://localhost:8005/preview?xform=http://localhost:8000/sample.xml
You can preview your form on http://localhost:8005/preview?xform=http://localhost:8080/getForm/SOE

### 5. For integrating your backend
Customize the [submission url](https://github.com/Samagra-Development/enketo/blob/main/enketo-express/public/js/src/module/connection.js#L150) with your hosted backend.

Customize the [submission url](https://github.com/Samagra-Development/enketo/blob/main/enketo-express/public/js/src/module/connection.js#L150) with your hosted backend.

## Future Enhancements :rocket:

- [Encrypting query parameters on rendering the enketo form. ](https://github.com/Samagra-Development/enketo/issues/1)
- Writing a API for changing an XML form directly from it.
- add npm scripts for install

We are trying to an inversion of control here.

### For Get API

`curl --location --request GET 'http://localhost:3002/form/form2'`

### Form Prefill API

```sh
curl --location --request POST 'http://localhost:3002/prefill' \
--header 'Content-Type: application/json' \
--data-raw '{
"prefillSpec": {
"pf_name": "`${onFormSuccessData.name}`",
"pf_iti": "`${onFormSuccessData.itiByIti.name}`",
"pf_trade": "`${onFormSuccessData.tradeName}`",
"pf_batch": "`${onFormSuccessData.batch}`",
"pf_industry": "`${onFormSuccessData.industryByIndustry.name}`",
"ojt_month": "`${onFormSuccessData.industryByIndustry.schedules[0].is_industry === true ? 1 : 0}`"
},
"onFormSuccessData": {
"name": "DEVA",
"batch": "2021-2023",
"id": 8,
"DOB": "2005-03-04",
"affiliationType": "NCVT",
"registrationNumber": "ICA211021569832",
"tradeName": "Electrician",
"iti": 7,
"industry": 1,
"itiByIti": {
"id": 7,
"name": "GITI Nagina"
},
"industryByIndustry": {
"id": 1,
"name": "Kaushal Bhawan",
"latitude": 30.695753,
"longitude": 76.872025,
"schedules": [
{
"is_industry": true
}
]
}
},
"form": "form2"
}'
```
2 changes: 1 addition & 1 deletion enketo-core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion enketo-express/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2265,7 +2265,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Support for pulldata function in XForms that contain a reference to the external data in the model.

##### Fixed
- Form initialization issue in Android (samagra-x-enketo-core 4.0.2)
- Form initialization issue in Android (enketo-core 4.0.2)

[1.15.0] - 2015-08-28
------------------------
Expand Down
2 changes: 1 addition & 1 deletion enketo-express/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module.exports = grunt => {
},
watch: {
sass: {
files: [ '../samagra-x-enketo-core/**/*.scss', 'app/views/styles/**/*.scss', 'widget/**/*.scss', '!app/views/styles/component/_system_variables.scss' ],
files: [ '../enketo-core/**/*.scss', 'app/views/styles/**/*.scss', 'widget/**/*.scss', '!app/views/styles/component/_system_variables.scss' ],
tasks: [ 'shell:clean-css', 'sass' ],
options: {
spawn: false,
Expand Down
4 changes: 2 additions & 2 deletions enketo-express/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ _Send a message if you'd like to contribute! We use an easy web interface provid

### Funding

The development of this application was funded by [KoBo Toolbox (Harvard Humanitarian Initiative)](http://www.kobotoolbox.org), [iMMAP](http://immap.org), [OpenClinica](https://openclinica.com), [London School of Hygiene and Tropical Medicine](https://opendatakit.lshtm.ac.uk/), [DIAL Open Source Center](https://www.osc.dial.community/) and [Enketo LLC](https://www.linkedin.com/company/enketo-llc). The [samagra-x-enketo-core](https://github.com/enketo/samagra-x-enketo-core) library (the form engine + themes) used in this application obtained significant funding from [SEL (Columbia University)](http://modi.mech.columbia.edu/), the [Santa Fe Institute](http://www.santafe.edu/), [Ona](https://ona.io) and the [HRP project](http://www.who.int/reproductivehealth/topics/mhealth/en/).
The development of this application was funded by [KoBo Toolbox (Harvard Humanitarian Initiative)](http://www.kobotoolbox.org), [iMMAP](http://immap.org), [OpenClinica](https://openclinica.com), [London School of Hygiene and Tropical Medicine](https://opendatakit.lshtm.ac.uk/), [DIAL Open Source Center](https://www.osc.dial.community/) and [Enketo LLC](https://www.linkedin.com/company/enketo-llc). The [enketo-core](https://github.com/enketo/enketo-core) library (the form engine + themes) used in this application obtained significant funding from [SEL (Columbia University)](http://modi.mech.columbia.edu/), the [Santa Fe Institute](http://www.santafe.edu/), [Ona](https://ona.io) and the [HRP project](http://www.who.int/reproductivehealth/topics/mhealth/en/).


### License
Expand All @@ -27,7 +27,7 @@ See [the license document](https://github.com/enketo/enketo-express/blob/master/

Note that some of the libraries used in this app have a different license. In particular note [this one](https://github.com/enketo/enketo-xpathjs).

Note the 'Powered by Enketo' footer requirement as explained in [samagra-x-enketo-core](https://github.com/enketo/samagra-x-enketo-core#license). This requirement is applicable to all Enketo apps, including this one, unless an exemption was granted.
Note the 'Powered by Enketo' footer requirement as explained in [enketo-core](https://github.com/enketo/enketo-core#license). This requirement is applicable to all Enketo apps, including this one, unless an exemption was granted.

The Enketo logo and Icons are trademarked by [Enketo LLC](https://www.linkedin.com/company/enketo-llc) and should only be used for the 'Powered by Enketo' requirement mentioned above (if applicable). To prevent infringement simply replace the logo images in [/public/images](https://github.com/enketo/enketo-express/blob/master/public/images) with your own or contact [Enketo LLC](mailto:[email protected]) to discuss the use inside your app.

Expand Down
1 change: 1 addition & 0 deletions enketo-express/app/controllers/survey-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ function _renderWebform(req, res, next, options) {
console.log(JSON.stringify(req.query));
options.formId = req?.query?.id;
options.backendToken = req?.query?.token;
options.formSpec = req?.query?.formSpec;

res.cookie("backendToken", req?.query?.token, cookieOptions);
res.cookie("enketoFormId", req?.query?.id, cookieOptions);
Expand Down
2 changes: 1 addition & 1 deletion enketo-express/app/lib/readme.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Client-side samagra-x-enketo-core library is here and symlinked to /public with grunt because a future version of this app may very well do server-side form parsing too.
Client-side enketo-core library is here and symlinked to /public with grunt because a future version of this app may very well do server-side form parsing too.
1 change: 1 addition & 0 deletions enketo-express/app/views/layout.pug
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ html(lang=language, dir=dir(language))
meta(name="author", content="Martijn van de Rijdt (Enketo LLC)")
meta(name="formId" content=formId)
meta(name="backendToken" content=backendToken)
meta(name="formSpec" content=formSpec)
if !desktop
meta(name="viewport", content="width=device-width, initial-scale=1.0")

Expand Down
2 changes: 1 addition & 1 deletion enketo-express/app/views/styles/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
html {
// For some reason a height of 100% causes the body to not extend to the bottom
// of the form. Setting height to auto fixes this.
// Both samagra-x-enketo-core and foundation set this to 100%, which is the common approach.
// Both enketo-core and foundation set this to 100%, which is the common approach.
//height: auto; // to avoid revealing the side-slider in direction rtl when scrolling horizontally
height: 100%;
overflow-x: hidden;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ $offline-color: #d15200;

.offline-enabled {
// this vertical-aligns to the top, overruling the align-items rule on .form-header
align-self: flex-start; // this negates a padding set on the form-header in samagra-x-enketo-core _response.scss
align-self: flex-start; // this negates a padding set on the form-header in enketo-core _response.scss
margin-left: -16px;

.queue-length {
Expand Down
8 changes: 4 additions & 4 deletions enketo-express/app/views/styles/error.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@import "component/variables";
@import "../../../node_modules/samagra-x-enketo-core/src/sass/core/fonts";
@import "../../../node_modules/enketo-core/src/sass/core/fonts";
@import "component/fonts";
@import "../../../node_modules/samagra-x-enketo-core/src/sass/core/variables";
@import "../../../node_modules/samagra-x-enketo-core/src/sass/core/mixins";
@import "../../../node_modules/samagra-x-enketo-core/src/sass/formhub/mixins";
@import "../../../node_modules/enketo-core/src/sass/core/variables";
@import "../../../node_modules/enketo-core/src/sass/core/mixins";
@import "../../../node_modules/enketo-core/src/sass/formhub/mixins";

body {
@include font-normal;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/main";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/responsive";
@import "../../../../node_modules/enketo-core/src/sass/core/main";
@import "../../../../node_modules/enketo-core/src/sass/core/responsive";
@import "../component/widgets";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/dropdown";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/formhub/main";
@import "../../../../node_modules/enketo-core/src/sass/core/dropdown";
@import "../../../../node_modules/enketo-core/src/sass/formhub/main";
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/formhub/formhub-print";
@import "../../../../node_modules/enketo-core/src/sass/formhub/formhub-print";
@import "../component/print";
16 changes: 8 additions & 8 deletions enketo-express/app/views/styles/theme-formhub/theme-formhub.scss
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
// variables
@import "variables";
@import "../component/variables";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/formhub/variables";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/variables";
@import "../../../../node_modules/enketo-core/src/sass/formhub/variables";
@import "../../../../node_modules/enketo-core/src/sass/core/variables";

// fonts
@import "../component/fonts";

// mixins, in the right order
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/mixins";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/formhub/mixins";
@import "../../../../node_modules/enketo-core/src/sass/core/mixins";
@import "../../../../node_modules/enketo-core/src/sass/formhub/mixins";
@import "../component/mixins";

// reset
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/reset";
@import "../../../../node_modules/enketo-core/src/sass/core/reset";

// common styles
@import "../component/common-ui";

// utilities
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/utilities";
@import "../../../../node_modules/enketo-core/src/sass/core/utilities";

// icons
@import "../component/icons";
Expand All @@ -28,8 +28,8 @@
@import "../component/buttons";

// layout
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/layout";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/pages";
@import "../../../../node_modules/enketo-core/src/sass/core/layout";
@import "../../../../node_modules/enketo-core/src/sass/core/pages";

// components
@import "../component/side-slider";
Expand Down
8 changes: 4 additions & 4 deletions enketo-express/app/views/styles/theme-grid/_form-grid.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/main";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/responsive";
@import "../../../../node_modules/enketo-core/src/sass/core/main";
@import "../../../../node_modules/enketo-core/src/sass/core/responsive";
@import "../component/widgets";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/dropdown";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/grid/main";
@import "../../../../node_modules/enketo-core/src/sass/core/dropdown";
@import "../../../../node_modules/enketo-core/src/sass/grid/main";

.btn.remove {
margin-right: -26px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/grid/grid-print";
@import "../../../../node_modules/enketo-core/src/sass/grid/grid-print";
@import "../component/print";
20 changes: 10 additions & 10 deletions enketo-express/app/views/styles/theme-grid/theme-grid.scss
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
// variables
@import "../component/variables";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/grid/variables";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/formhub/variables";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/variables";
@import "../../../../node_modules/enketo-core/src/sass/grid/variables";
@import "../../../../node_modules/enketo-core/src/sass/formhub/variables";
@import "../../../../node_modules/enketo-core/src/sass/core/variables";

// fonts
@import "../component/fonts";

// mixins, in the right order
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/mixins";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/formhub/mixins";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/grid/mixins";
@import "../../../../node_modules/enketo-core/src/sass/core/mixins";
@import "../../../../node_modules/enketo-core/src/sass/formhub/mixins";
@import "../../../../node_modules/enketo-core/src/sass/grid/mixins";
@import "../component/mixins";

// reset
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/reset";
@import "../../../../node_modules/enketo-core/src/sass/core/reset";

// common styles
@import "../component/common-ui";

// utilities
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/utilities";
@import "../../../../node_modules/enketo-core/src/sass/core/utilities";

// icons
@import "../component/icons";
Expand All @@ -29,8 +29,8 @@
@import "../component/buttons";

// layout
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/layout";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/pages";
@import "../../../../node_modules/enketo-core/src/sass/core/layout";
@import "../../../../node_modules/enketo-core/src/sass/core/pages";

// components
@import "../component/side-slider";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/formhub/formhub-print";
@import "../../../../node_modules/enketo-core/src/sass/formhub/formhub-print";
@import "../component/print";
16 changes: 8 additions & 8 deletions enketo-express/app/views/styles/theme-kobo/theme-kobo.scss
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
// variables, in the right order
@import "variables";
@import "../component/variables";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/formhub/variables";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/variables";
@import "../../../../node_modules/enketo-core/src/sass/formhub/variables";
@import "../../../../node_modules/enketo-core/src/sass/core/variables";

// fonts
@import "../component/fonts";

// mixins, in the right order
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/mixins";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/formhub/mixins";
@import "../../../../node_modules/enketo-core/src/sass/core/mixins";
@import "../../../../node_modules/enketo-core/src/sass/formhub/mixins";
@import "../component/mixins";

// reset
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/reset";
@import "../../../../node_modules/enketo-core/src/sass/core/reset";

// common styles
@import "../component/common-ui";

// utilities
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/utilities";
@import "../../../../node_modules/enketo-core/src/sass/core/utilities";

// icons
@import "../component/icons";
Expand All @@ -28,8 +28,8 @@
@import "../component/buttons";

// layout
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/layout";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/pages";
@import "../../../../node_modules/enketo-core/src/sass/core/layout";
@import "../../../../node_modules/enketo-core/src/sass/core/pages";

// components
@import "../component/side-slider";
Expand Down
22 changes: 11 additions & 11 deletions enketo-express/app/views/styles/theme-plain/_form_plain.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/variables";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/mixins";
@import "../../../../node_modules/enketo-core/src/sass/core/variables";
@import "../../../../node_modules/enketo-core/src/sass/core/mixins";

@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/reset";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/utilities";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/icons";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/layout";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/buttons";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/main";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/pages";
@import "../../../../node_modules/enketo-core/src/sass/core/reset";
@import "../../../../node_modules/enketo-core/src/sass/core/utilities";
@import "../../../../node_modules/enketo-core/src/sass/core/icons";
@import "../../../../node_modules/enketo-core/src/sass/core/layout";
@import "../../../../node_modules/enketo-core/src/sass/core/buttons";
@import "../../../../node_modules/enketo-core/src/sass/core/main";
@import "../../../../node_modules/enketo-core/src/sass/core/pages";
@import "../component/widgets";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/dropdown";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/responsive";
@import "../../../../node_modules/enketo-core/src/sass/core/dropdown";
@import "../../../../node_modules/enketo-core/src/sass/core/responsive";
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/variables";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/mixins";
@import "../../../../node_modules/samagra-x-enketo-core/src/sass/core/print";
@import "../../../../node_modules/enketo-core/src/sass/core/variables";
@import "../../../../node_modules/enketo-core/src/sass/core/mixins";
@import "../../../../node_modules/enketo-core/src/sass/core/print";
@import "../component/print";
Loading

0 comments on commit 1f8ae59

Please sign in to comment.