├── .bluemix └── 5b7c92b5f7b9bf9a788a9678253f381a4a2cb50c36b2a03c069cd59756260499.json ├── .cfignore ├── .gitignore ├── LICENSE.txt ├── README.md ├── admin.js ├── app.js ├── fieldwork-app-graphics.png ├── manifest.yml ├── mapconfig.json ├── package.json ├── public ├── css │ ├── bootstrap.css │ ├── bootstrap.css.map │ ├── images │ │ ├── cloudant_ibm.png │ │ ├── layers-2x.png │ │ ├── layers.png │ │ ├── pushpin-2x.png │ │ ├── pushpin.png │ │ ├── spritesheet-2x.png │ │ └── spritesheet.png │ ├── leaflet.css │ ├── leaflet.draw.css │ ├── main.css │ └── style.css ├── index.html └── js │ ├── bootbox.min.js │ ├── bootstrap.min.js │ ├── images │ ├── layers-2x.png │ ├── layers.png │ ├── marker-icon-2x.png │ ├── marker-icon.png │ ├── marker-red.png │ ├── marker-shadow.png │ └── marker-yellow.png │ ├── jquery-1.11.1.min.js │ ├── layers.js │ ├── leaflet.draw.js │ ├── leaflet.js │ ├── leaflet.pouch.js │ ├── pouchdb-4.0.0.min.js │ ├── pouchdb.min.js │ └── webapp.js └── testdata.js /.bluemix/5b7c92b5f7b9bf9a788a9678253f381a4a2cb50c36b2a03c069cd59756260499.json: -------------------------------------------------------------------------------- 1 | {"target":{"org":{"name":"rrsingh@us.ibm.com","guid":"9e660926-2014-425d-a236-66f8f14f1d08"},"space":{"name":"dev","guid":"03576a35-d3d5-42b0-9fd2-44d84c5b3ecd"},"app":{"name":"fieldwork","guid":"66b7267a-3783-4a46-9b1a-6edfd171edf6"},"domain":{"name":"mybluemix.net","guid":"f4b90d7e-2cd3-4d30-b200-f28bbaf6be20"}}} -------------------------------------------------------------------------------- /.cfignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | launchConfigurations 4 | project.json 5 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | 3 | Version 2.0, January 2004 4 | 5 | http://www.apache.org/licenses/ 6 | 7 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 8 | 9 | 1. Definitions. 10 | 11 | "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. 16 | 17 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. 18 | 19 | "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. 20 | 21 | "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. 22 | 23 | "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). 24 | 25 | "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. 26 | 27 | "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." 28 | 29 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 30 | 31 | 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 32 | 33 | 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 34 | 35 | 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: 36 | 37 | You must give any other recipients of the Work or Derivative Works a copy of this License; and 38 | You must cause any modified files to carry prominent notices stating that You changed the files; and 39 | You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and 40 | If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. 41 | 42 | You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 43 | 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 44 | 45 | 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 46 | 47 | 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 48 | 49 | 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 50 | 51 | 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. 52 | 53 | END OF TERMS AND CONDITIONS -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Field Work 2 | 3 | **Field Work** is a web application that supports offline editing and mapping of geospatial data. This app: 4 | 5 | - downloads and saves geospatial data locally for offline use by Cloudant Geo or Lucene Geo query 6 | - has a UI that supports editing of points, lines, and polygons 7 | - syncs locally-edited data back to an [IBM Cloudant](https://cloudant.com/) database 8 | 9 | Many field-based industries whose personnel are disconnected from communications networks—often in remote areas or even underground—can benefit from this kind of offline-first mobile application. This demonstration is designed for utilities repair personnel who need to capture events in work orders. 10 | 11 | ![Bluemix Deployments](https://deployment-tracker.mybluemix.net/stats/5995ba4616bcc1cfbc56ab72f0c152ea/badge.svg) 12 | 13 | ## Related Resources 14 | - [Blog post: Better infrastructure maintenance with offline mobile maps](https://developer.ibm.com/clouddataservices/2016/03/07/better-infrastructure-maintenance-with-offline-mobile-maps/) 15 | 16 | - [Presentation: Field Work: Map-centric mobile apps with Cloudant Geo and LeafletJS ](http://www.slideshare.net/rajrsingh/field-work-mapcentric-mobile-apps-with-cloudant-geo-and-leafletjs) 17 | 18 | 19 | 20 | ## Try it 21 | 22 | [Play with the live demo version of this app](http://fieldwork.mybluemix.net/). To get started: 23 | 24 | 25 | 1. Drag the map to an area you want to see. 26 | 2. Click the **Load Data** button. 27 | 3. On the upper right of the map, choose the data types you want to see. 28 | 4. In the left pane, click the **Edit Pins** button. 29 | Pushpins appear on the map. 30 | 5. On the left side of the map, use the controls that appear to edit and add pins. (Hover over a control for guidance.) 31 | 32 | ![fieldwork demo](http://developer.ibm.com/clouddataservices/wp-content/uploads/sites/47/2016/03/fieldwork.png) 33 | 34 | 35 | ## Architecture 36 | 37 | ![field work architecture](./fieldwork-app-graphics.png) 38 | 39 | This an architectural overview of the components that make this app run. 40 | 41 | 42 | ## Deploy to IBM Bluemix 43 | 44 | The fastest way to deploy this application to Bluemix is to click this **Deploy to Bluemix** button. If you prefer instead to deploy manually to Bluemix then skip ahead to the **Manual Development** section. 45 | 46 | [![Deploy to Bluemix](https://deployment-tracker.mybluemix.net/stats/5995ba4616bcc1cfbc56ab72f0c152ea/button.svg)](https://bluemix.net/deploy?repository=https://github.com/ibm-cds-labs/fieldwork.git) 47 | 48 | **Don't have a Bluemix account?** If you haven't already, you'll be prompted to [sign up](http://www.ibm.com/cloud-computing/bluemix/) for a Bluemix account when you click the button. Sign up, verify your email address, then return here and click the the **Deploy to Bluemix** button again. Your new credentials let you deploy to the platform and also to code online with Bluemix and Git. If you have questions about working in Bluemix, find answers in the [Bluemix Docs](https://www.ng.bluemix.net/docs/). 49 | 50 | ### (Optional) Customize the app URL 51 | 52 | Bluemix creates a random, unique URL for your app, each time you deploy. If you want to customize and set a static URL, you can do so in the [IBM Bluemix DevOps Services](https://hub.jazz.net/) project created for you when you deployed. 53 | 54 | 1. On the Bluemix Deployment Successful screen, click the **Edit Code** button. 55 | 2. Find and open the `manifest.yml` file. 56 | 2. Change the line `random-route: true` to `host: my-unique-app-name` 57 | 58 | On the next deployment, the URL for your app will be `my-unique-app-name.mybluemix.net` 59 | 60 | If you plan to modify the code for this app, and want to use GitHub's code repository ([instead of IBM Bluemix DevOps Services](https://hub.jazz.net/)), follow the instructions in the next section. 61 | 62 | ### Manual Development 63 | 64 | 1. Fork the repo 65 | Click the **Fork** button in the top right corner of this repository 66 | 67 | 1. Create a Bluemix Account 68 | 69 | [Sign up](http://www.ibm.com/cloud-computing/bluemix/) for Bluemix, or use an existing account. 70 | 71 | 2. Download and install the [Cloud-foundry CLI](https://www.ng.bluemix.net/docs/#starters/install_cli.html) tool. 72 | 73 | 3. Clone the app to your local environment from your terminal using the following command 74 | 75 | ``` 76 | git clone https://github.com/ibm-cds-labs/fieldwork 77 | ``` 78 | 79 | 4. cd into your newly created directory. 80 | 81 | 5. Edit the `manifest.yml` file and change the `` to something unique. 82 | 83 | ``` 84 | --- 85 | declared-services: 86 | cloudant-fieldwork-db: 87 | label: cloudantNoSQLDB 88 | plan: Shared 89 | applications: 90 | - name: fieldwork 91 | host: fieldwork-gr8one 92 | memory: 128M 93 | disk_quota: 512M 94 | path: . 95 | domain: mybluemix.net 96 | instances: 1 97 | services: 98 | - cloudant-fieldwork-db 99 | ``` 100 | The host you use determines your application url initially, e.g. `.mybluemix.net`. 101 | 102 | 1. Connect to Bluemix in your command-line tool and follow the prompts to log in. 103 | 104 | ``` 105 | $ cf api https://api.ng.bluemix.net 106 | $ cf login 107 | ``` 108 | 109 | 1. Create the Cloudant service in Bluemix. 110 | ``` 111 | $ cf create-service cloudantNoSQLDB Shared cloudant-fieldwork-db 112 | ``` 113 | 114 | ### Manual deployment 115 | 116 | To deploy to Bluemix, simply: 117 | 118 | ``` 119 | $ cf push 120 | ``` 121 | 122 | ## Privacy notice 123 | The **Field Work** sample web application includes code to track deployments to Bluemix and other Cloud Foundry platforms. The following information is sent to a [Deployment Tracker](https://github.com/cloudant-labs/deployment-tracker) service on each deployment: 124 | 125 | * Application Name (application_name) 126 | * Space ID (space_id) 127 | * Application Version (application_version) 128 | * Application URIs (application_uris) 129 | 130 | This data is collected from the VCAP_APPLICATION environment variable in IBM Bluemix and other Cloud Foundry platforms. This data is used by IBM to track metrics around deployments of sample applications to IBM Bluemix. Only deployments of sample applications that include code to ping the Deployment Tracker service will be tracked. 131 | 132 | ## Disabling Deployment Tracking 133 | 134 | You can disable deployment tracking by removing `./admin.js track && ` from the `install` line of the `scripts` sections within `package.json`. 135 | 136 | ## License 137 | 138 | Licensed under the [Apache License, Version 2.0](LICENSE.txt). 139 | 140 | 141 | Field Work is a sample application created for the purpose of demonstrating an offline geographic data sync and editing application. The program is provided as-is with no warranties of any kind, express or implied. 142 | -------------------------------------------------------------------------------- /admin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // Licensed under the Apache 2.0 License. See footer for details. 3 | 4 | var express = require('express'), 5 | http = require('http'), 6 | path = require('path'), 7 | cloudant = require('cloudant'), 8 | program = require('commander'), 9 | dotenv = require('dotenv'), 10 | crypto = require('crypto'), 11 | pkg = require(path.join(__dirname, 'package.json')); 12 | 13 | http.post = require('http-post'); 14 | 15 | dotenv.load(); 16 | 17 | var app = express(); 18 | 19 | (function(app) { 20 | if (process.env.VCAP_SERVICES) { 21 | var vcapServices = JSON.parse(process.env.VCAP_SERVICES); 22 | app.set('vcapServices', vcapServices); 23 | if (vcapServices.cloudantNoSQLDB && vcapServices.cloudantNoSQLDB.length > 0) { 24 | var service = vcapServices.cloudantNoSQLDB[0]; 25 | if (service.credentials) { 26 | app.set('cloudant-fieldwork-db', cloudant({ 27 | username: service.credentials.username, 28 | password: service.credentials.password, 29 | account: service.credentials.username 30 | })); 31 | } 32 | } 33 | } 34 | })(app); 35 | 36 | program.version(pkg.version); 37 | 38 | program 39 | .command('db ') 40 | .description('Create (put) or delete the database') 41 | .action(function(method, options) { 42 | var fieldworkDb = app.get('cloudant-fieldwork-db'); 43 | if (!fieldworkDb) { 44 | console.error('No database configured'); 45 | return; 46 | } 47 | // set up CORS for web app access 48 | fieldworkDb.set_cors({ 49 | enable_cors: true, 50 | allow_credentials: true, 51 | // origins: [ "http://*.mybluemix.net","https://*.mybluemix.net"] 52 | origins: [ "*"] 53 | }, 54 | function(err, data) { 55 | console.log(err, data); 56 | }); 57 | 58 | switch (method) { 59 | case 'put': 60 | fieldworkDb.db.create('fieldedits', function(err, body) { 61 | if (!err) { 62 | console.log('Fieldedits database created'); 63 | } else { 64 | if (412 == err.statusCode) { 65 | console.log('Fieldedits database already exists'); 66 | } else { 67 | console.error('Error creating fieldedits database'); 68 | } 69 | } 70 | }); 71 | break; 72 | case 'delete': 73 | fieldworkDb.db.destroy('fieldedits', function(err, body) { 74 | if (!err) { 75 | console.log('Fieldedits database deleted'); 76 | } else { 77 | if (404 == err.statusCode) { 78 | console.log('Fieldedits database does not exist'); 79 | } else { 80 | console.error('Error deleting Fieldedits database'); 81 | } 82 | } 83 | }); 84 | break; 85 | } 86 | }).on('--help', function() { 87 | console.log(' Examples:'); 88 | console.log(); 89 | console.log(' $ db put'); 90 | console.log(' $ db delete'); 91 | console.log(); 92 | }); 93 | 94 | program 95 | .command('ddoc ') 96 | .description('Create (put) or delete design documents') 97 | .action(function(method, options) { 98 | var fieldworkDb = app.get('cloudant-fieldwork-db'); 99 | if (!fieldworkDb) { 100 | console.error('No database configured'); 101 | return; 102 | } 103 | var fieldeditsDb = fieldworkDb.use('fieldedits'); 104 | switch (method) { 105 | case 'put': 106 | // TODO: Allow this to handle migrations 107 | var ddoc = { 108 | _id: '_design/SpatialView', 109 | "st_indexes": { 110 | "spatial": { 111 | "crs": { 112 | "type": "name", 113 | "properties": { 114 | "name": "urn:ogc:def:crs:OGC:1.3:CRS84" 115 | } 116 | }, 117 | "index": "function(doc){\n if (doc.geometry) { st_index(doc.geometry); }\n}" 118 | } 119 | } 120 | }; 121 | fieldeditsDb.insert(ddoc, function(err, body) { 122 | if (!err) { 123 | console.log('Design document created'); 124 | } else { 125 | if (409 == err.statusCode) { 126 | fieldeditsDb.get(ddoc._id, function(err, body) { 127 | var rev = body._rev; 128 | delete body._rev; 129 | ddocHash = crypto.createHash('md5').update(JSON.stringify(ddoc)).digest('hex'); 130 | bodyHash = crypto.createHash('md5').update(JSON.stringify(body)).digest('hex'); 131 | if (ddocHash != bodyHash) { 132 | ddoc._rev = rev; 133 | fieldeditsDb.insert(ddoc, function(err, body) { 134 | if (!err) { 135 | console.log('Design document updated'); 136 | } else { 137 | console.error('Error updating design document database'); 138 | } 139 | }); 140 | } else { 141 | console.log('Design document already exists and does not need updating'); 142 | } 143 | }); 144 | } else { 145 | console.error('Error creating design document database'); 146 | } 147 | } 148 | }); 149 | break; 150 | case 'delete': 151 | eventsDb.get('_design/SpatialView', function(err, doc) { 152 | if (!err) { 153 | eventsDb.destroy('_design/SpatialView', doc._rev, function(err, body) { 154 | if (!err) { 155 | console.log('Design document deleted'); 156 | } else { 157 | if (404 == err.statusCode) { 158 | console.log('Design document does not exist'); 159 | } else { 160 | console.error('Error deleting design document'); 161 | } 162 | } 163 | }); 164 | } else { 165 | if (404 == err.statusCode) { 166 | console.log('Design document does not exist'); 167 | } else { 168 | console.error('Error getting design document'); 169 | } 170 | } 171 | }); 172 | break; 173 | } 174 | }).on('--help', function() { 175 | console.log(' Examples:'); 176 | console.log(); 177 | console.log(' $ ddoc put'); 178 | console.log(' $ ddoc delete'); 179 | console.log(); 180 | }); 181 | 182 | program 183 | .command('track') 184 | .description('Track application deployments') 185 | .action(function(options) { 186 | require('cf-deployment-tracker-client').track(); 187 | }).on('--help', function() { 188 | console.log(' Examples:'); 189 | console.log(); 190 | console.log(' $ track'); 191 | console.log(); 192 | }); 193 | 194 | program.parse(process.argv); 195 | 196 | //------------------------------------------------------------------------------- 197 | // Copyright IBM Corp. 2015 198 | // 199 | // Licensed under the Apache License, Version 2.0 (the "License"); 200 | // you may not use this file except in compliance with the License. 201 | // You may obtain a copy of the License at 202 | // 203 | // http://www.apache.org/licenses/LICENSE-2.0 204 | // 205 | // Unless required by applicable law or agreed to in writing, software 206 | // distributed under the License is distributed on an "AS IS" BASIS, 207 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 208 | // See the License for the specific language governing permissions and 209 | // limitations under the License. 210 | //------------------------------------------------------------------------------- -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | // Licensed under the Apache 2.0 License. See footer for details. 2 | 3 | var express = require('express'), 4 | // cookieParser = require('cookie-parser'), 5 | http = require('http'), 6 | path = require('path'), 7 | cloudant = require('cloudant'), 8 | program = require('commander'), 9 | compression = require('compression'), 10 | url = require('url'); 11 | require('dotenv').load(); 12 | 13 | var app = express(); 14 | app.use(compression()); 15 | 16 | (function(app) { 17 | if (process.env.VCAP_SERVICES) { 18 | var vcapServices = JSON.parse(process.env.VCAP_SERVICES); 19 | app.set('vcapServices', vcapServices); 20 | if (vcapServices.cloudantNoSQLDB && vcapServices.cloudantNoSQLDB.length > 0) { 21 | var service = vcapServices.cloudantNoSQLDB[0]; 22 | if (service.credentials) { 23 | app.set('cloudant-fieldwork-db', cloudant({ 24 | username: service.credentials.username, 25 | password: service.credentials.password, 26 | account: service.credentials.username 27 | })); 28 | } 29 | } 30 | } 31 | })(app); 32 | 33 | // Set the port number based on a command line switch, an environment variable, or a default value 34 | app.set('port', program.port || process.env.PORT || 3000); 35 | // Serve config file 36 | app.get('/mapconfig', function(req, res) { 37 | var fs = require('fs'); 38 | var mapconfig = JSON.parse(fs.readFileSync('./mapconfig.json', 'utf8')) 39 | var editlayer = { 40 | name: 'fieldedits', 41 | account: 'example.cloudant.com', 42 | geopath: '_design/SpatialView/_geo/spatial', 43 | type: 'GeometryCollection', 44 | key: '', 45 | password: '', 46 | style: { 47 | radius: 12, 48 | fillColor: '#ff0000', 49 | fillOpacity: 4, 50 | color: '#ff0000' 51 | } 52 | }; 53 | 54 | var vcapServices = app.get('vcapServices'); 55 | if (vcapServices && vcapServices.cloudantNoSQLDB && vcapServices.cloudantNoSQLDB.length > 0) { 56 | var service = vcapServices.cloudantNoSQLDB[0]; 57 | if (service.credentials) { 58 | editlayer.account = service.credentials.host; 59 | editlayer.key = service.credentials.username; 60 | editlayer.password = service.credentials.password; 61 | console.log("Got fieldedit credentials for " + editlayer.account + " from vcapServices"); 62 | } 63 | } else { 64 | editlayer.account = process.env.CLOUDANT_USER + '.cloudant.com'; 65 | editlayer.key = process.env.CLOUDANT_USER; 66 | editlayer.password = process.env.CLOUDANT_PASSWORD; 67 | console.log("Got fieldedit credentials for " + editlayer.account + " from user environment"); 68 | } 69 | mapconfig.editlayer = editlayer; 70 | res.send(mapconfig); 71 | }); 72 | // Serve static assets 73 | app.use(express.static(path.join(__dirname, 'public'))); 74 | // Create the HTTP server 75 | http.createServer(app).listen(app.get('port'), function() { 76 | console.log('Express server listening on port ' + app.get('port')); 77 | }); 78 | 79 | //------------------------------------------------------------------------------- 80 | // Copyright IBM Corp. 2015 81 | // 82 | // Licensed under the Apache License, Version 2.0 (the "License"); 83 | // you may not use this file except in compliance with the License. 84 | // You may obtain a copy of the License at 85 | // 86 | // http://www.apache.org/licenses/LICENSE-2.0 87 | // 88 | // Unless required by applicable law or agreed to in writing, software 89 | // distributed under the License is distributed on an "AS IS" BASIS, 90 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 91 | // See the License for the specific language governing permissions and 92 | // limitations under the License. 93 | //------------------------------------------------------------------------------- -------------------------------------------------------------------------------- /fieldwork-app-graphics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-watson-data-lab/fieldwork/bcbe93662e77b1952d791e7e2aff09a4fd7ef757/fieldwork-app-graphics.png -------------------------------------------------------------------------------- /manifest.yml: -------------------------------------------------------------------------------- 1 | declared-services: 2 | cloudant-fieldwork-db: 3 | label: cloudantNoSQLDB 4 | plan: Shared 5 | applications: 6 | - name: fieldwork 7 | random-route: false 8 | memory: 128M 9 | disk_quota: 512M 10 | path: . 11 | domain: mybluemix.net 12 | instances: 1 13 | services: 14 | - cloudant-fieldwork-db 15 | -------------------------------------------------------------------------------- /mapconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "geodata": [ 3 | { "name": "boston_buildings", "account": "opendata.cloudant.com", 4 | "geopath": "_design/SpatialView/_geo/spatial", "type": "Polygon", 5 | "style": {"width": 1, "color": "#9B6D10"} }, 6 | { "name": "mbtabusroutes", "account": "opendata.cloudant.com", 7 | "geopath": "_design/SpatialView/_geo/spatial", "type": "LineString", 8 | "style": {"width": 2, "fillOpacity": 0.9, "color": "#C42323"} } 9 | ], 10 | "editlayer": { 11 | "name": "fieldedits", 12 | "account": "rajsingh.cloudant.com", 13 | "geopath": "_design/SpatialView/_geo/spatial", 14 | "type": "GeometryCollection", 15 | "key": "", 16 | "password": "", 17 | "style": {"radius": 12, "fillColor": "#ff0000", "fillOpacity": 4, "color": "#ff0000"} 18 | } 19 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cloudant-fieldwork", 3 | "version": "1.0.0", 4 | "description": "A web application that supports offline editing and mapping of geospatial data. It downloads and saves geospatial data locally for offline use using Cloudant Geo or Lucene Geo query, has a UI that supports editing of points, lines and polygons, and syncs locally edited data back to an IBM Cloudant database", 5 | "main": "app.js", 6 | "scripts": { 7 | "install": "./admin.js track && ./admin.js db put && ./admin.js ddoc put", 8 | "start": "node app.js", 9 | "test": "echo no tests yet" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/ibm-cds-labs/fieldwork.git" 14 | }, 15 | "keywords": ["PouchDB", "Node.js", "Bootstrap", "Cloudant", "HTML5", "JavaScript", "geospatial"], 16 | "author": "Raj Singh (https://cloudant.com/)", 17 | "license": "Apache 2.0", 18 | "bugs": { 19 | "url": "https://github.com/ibm-cds-labs/fieldwork/issues" 20 | }, 21 | "homepage": "https://github.com/ibm-cds-labs/fieldwork", 22 | "dependencies": { 23 | "body-parser": "^1.11.0", 24 | "cf-deployment-tracker-client": "^0.x", 25 | "cloudant": "^1.0.0-beta3", 26 | "commander": "^2.6.0", 27 | "cookie-parser": "^1.3.4", 28 | "compression": "^1.6.2", 29 | "dotenv": "^0.5.1", 30 | "express": "^4.11.1", 31 | "http-post": "^0.1.1" 32 | } 33 | } -------------------------------------------------------------------------------- /public/css/images/cloudant_ibm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-watson-data-lab/fieldwork/bcbe93662e77b1952d791e7e2aff09a4fd7ef757/public/css/images/cloudant_ibm.png -------------------------------------------------------------------------------- /public/css/images/layers-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-watson-data-lab/fieldwork/bcbe93662e77b1952d791e7e2aff09a4fd7ef757/public/css/images/layers-2x.png -------------------------------------------------------------------------------- /public/css/images/layers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-watson-data-lab/fieldwork/bcbe93662e77b1952d791e7e2aff09a4fd7ef757/public/css/images/layers.png -------------------------------------------------------------------------------- /public/css/images/pushpin-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-watson-data-lab/fieldwork/bcbe93662e77b1952d791e7e2aff09a4fd7ef757/public/css/images/pushpin-2x.png -------------------------------------------------------------------------------- /public/css/images/pushpin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-watson-data-lab/fieldwork/bcbe93662e77b1952d791e7e2aff09a4fd7ef757/public/css/images/pushpin.png -------------------------------------------------------------------------------- /public/css/images/spritesheet-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-watson-data-lab/fieldwork/bcbe93662e77b1952d791e7e2aff09a4fd7ef757/public/css/images/spritesheet-2x.png -------------------------------------------------------------------------------- /public/css/images/spritesheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibm-watson-data-lab/fieldwork/bcbe93662e77b1952d791e7e2aff09a4fd7ef757/public/css/images/spritesheet.png -------------------------------------------------------------------------------- /public/css/leaflet.css: -------------------------------------------------------------------------------- 1 | /* required styles */ 2 | 3 | .leaflet-map-pane, 4 | .leaflet-tile, 5 | .leaflet-marker-icon, 6 | .leaflet-marker-shadow, 7 | .leaflet-tile-pane, 8 | .leaflet-tile-container, 9 | .leaflet-overlay-pane, 10 | .leaflet-shadow-pane, 11 | .leaflet-marker-pane, 12 | .leaflet-popup-pane, 13 | .leaflet-overlay-pane svg, 14 | .leaflet-zoom-box, 15 | .leaflet-image-layer, 16 | .leaflet-layer { 17 | position: absolute; 18 | left: 0; 19 | top: 0; 20 | } 21 | .leaflet-container { 22 | overflow: hidden; 23 | -ms-touch-action: none; 24 | } 25 | .leaflet-tile, 26 | .leaflet-marker-icon, 27 | .leaflet-marker-shadow { 28 | -webkit-user-select: none; 29 | -moz-user-select: none; 30 | user-select: none; 31 | -webkit-user-drag: none; 32 | } 33 | .leaflet-marker-icon, 34 | .leaflet-marker-shadow { 35 | display: block; 36 | } 37 | /* map is broken in FF if you have max-width: 100% on tiles */ 38 | .leaflet-container img { 39 | max-width: none !important; 40 | } 41 | /* stupid Android 2 doesn't understand "max-width: none" properly */ 42 | .leaflet-container img.leaflet-image-layer { 43 | max-width: 15000px !important; 44 | } 45 | .leaflet-tile { 46 | filter: inherit; 47 | visibility: hidden; 48 | } 49 | .leaflet-tile-loaded { 50 | visibility: inherit; 51 | } 52 | .leaflet-zoom-box { 53 | width: 0; 54 | height: 0; 55 | } 56 | /* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */ 57 | .leaflet-overlay-pane svg { 58 | -moz-user-select: none; 59 | } 60 | 61 | .leaflet-tile-pane { z-index: 2; } 62 | .leaflet-objects-pane { z-index: 3; } 63 | .leaflet-overlay-pane { z-index: 4; } 64 | .leaflet-shadow-pane { z-index: 5; } 65 | .leaflet-marker-pane { z-index: 6; } 66 | .leaflet-popup-pane { z-index: 7; } 67 | 68 | .leaflet-vml-shape { 69 | width: 1px; 70 | height: 1px; 71 | } 72 | .lvml { 73 | behavior: url(#default#VML); 74 | display: inline-block; 75 | position: absolute; 76 | } 77 | 78 | 79 | /* control positioning */ 80 | 81 | .leaflet-control { 82 | position: relative; 83 | z-index: 7; 84 | pointer-events: auto; 85 | } 86 | .leaflet-top, 87 | .leaflet-bottom { 88 | position: absolute; 89 | z-index: 1000; 90 | pointer-events: none; 91 | } 92 | .leaflet-top { 93 | top: 0; 94 | } 95 | .leaflet-right { 96 | right: 0; 97 | } 98 | .leaflet-bottom { 99 | bottom: 0; 100 | } 101 | .leaflet-left { 102 | left: 0; 103 | } 104 | .leaflet-control { 105 | float: left; 106 | clear: both; 107 | } 108 | .leaflet-right .leaflet-control { 109 | float: right; 110 | } 111 | .leaflet-top .leaflet-control { 112 | margin-top: 10px; 113 | } 114 | .leaflet-bottom .leaflet-control { 115 | margin-bottom: 10px; 116 | } 117 | .leaflet-left .leaflet-control { 118 | margin-left: 10px; 119 | } 120 | .leaflet-right .leaflet-control { 121 | margin-right: 10px; 122 | } 123 | 124 | 125 | /* zoom and fade animations */ 126 | 127 | .leaflet-fade-anim .leaflet-tile, 128 | .leaflet-fade-anim .leaflet-popup { 129 | opacity: 0; 130 | -webkit-transition: opacity 0.2s linear; 131 | -moz-transition: opacity 0.2s linear; 132 | -o-transition: opacity 0.2s linear; 133 | transition: opacity 0.2s linear; 134 | } 135 | .leaflet-fade-anim .leaflet-tile-loaded, 136 | .leaflet-fade-anim .leaflet-map-pane .leaflet-popup { 137 | opacity: 1; 138 | } 139 | 140 | .leaflet-zoom-anim .leaflet-zoom-animated { 141 | -webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1); 142 | -moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1); 143 | -o-transition: -o-transform 0.25s cubic-bezier(0,0,0.25,1); 144 | transition: transform 0.25s cubic-bezier(0,0,0.25,1); 145 | } 146 | .leaflet-zoom-anim .leaflet-tile, 147 | .leaflet-pan-anim .leaflet-tile, 148 | .leaflet-touching .leaflet-zoom-animated { 149 | -webkit-transition: none; 150 | -moz-transition: none; 151 | -o-transition: none; 152 | transition: none; 153 | } 154 | 155 | .leaflet-zoom-anim .leaflet-zoom-hide { 156 | visibility: hidden; 157 | } 158 | 159 | 160 | /* cursors */ 161 | 162 | .leaflet-clickable { 163 | cursor: pointer; 164 | } 165 | .leaflet-container { 166 | cursor: -webkit-grab; 167 | cursor: -moz-grab; 168 | } 169 | .leaflet-popup-pane, 170 | .leaflet-control { 171 | cursor: auto; 172 | } 173 | .leaflet-dragging .leaflet-container, 174 | .leaflet-dragging .leaflet-clickable { 175 | cursor: move; 176 | cursor: -webkit-grabbing; 177 | cursor: -moz-grabbing; 178 | } 179 | 180 | 181 | /* visual tweaks */ 182 | 183 | .leaflet-container { 184 | background: #ddd; 185 | outline: 0; 186 | } 187 | .leaflet-container a { 188 | color: #0078A8; 189 | } 190 | .leaflet-container a.leaflet-active { 191 | outline: 2px solid orange; 192 | } 193 | .leaflet-zoom-box { 194 | border: 2px dotted #38f; 195 | background: rgba(255,255,255,0.5); 196 | } 197 | 198 | 199 | /* general typography */ 200 | .leaflet-container { 201 | font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif; 202 | } 203 | 204 | 205 | /* general toolbar styles */ 206 | 207 | .leaflet-bar { 208 | box-shadow: 0 1px 5px rgba(0,0,0,0.65); 209 | border-radius: 4px; 210 | } 211 | .leaflet-bar a, 212 | .leaflet-bar a:hover { 213 | background-color: #fff; 214 | border-bottom: 1px solid #ccc; 215 | width: 26px; 216 | height: 26px; 217 | line-height: 26px; 218 | display: block; 219 | text-align: center; 220 | text-decoration: none; 221 | color: black; 222 | } 223 | .leaflet-bar a, 224 | .leaflet-control-layers-toggle { 225 | background-position: 50% 50%; 226 | background-repeat: no-repeat; 227 | display: block; 228 | } 229 | .leaflet-bar a:hover { 230 | background-color: #f4f4f4; 231 | } 232 | .leaflet-bar a:first-child { 233 | border-top-left-radius: 4px; 234 | border-top-right-radius: 4px; 235 | } 236 | .leaflet-bar a:last-child { 237 | border-bottom-left-radius: 4px; 238 | border-bottom-right-radius: 4px; 239 | border-bottom: none; 240 | } 241 | .leaflet-bar a.leaflet-disabled { 242 | cursor: default; 243 | background-color: #f4f4f4; 244 | color: #bbb; 245 | } 246 | 247 | .leaflet-touch .leaflet-bar a { 248 | width: 30px; 249 | height: 30px; 250 | line-height: 30px; 251 | } 252 | 253 | 254 | /* zoom control */ 255 | 256 | .leaflet-control-zoom-in, 257 | .leaflet-control-zoom-out { 258 | font: bold 18px 'Lucida Console', Monaco, monospace; 259 | text-indent: 1px; 260 | } 261 | .leaflet-control-zoom-out { 262 | font-size: 20px; 263 | } 264 | 265 | .leaflet-touch .leaflet-control-zoom-in { 266 | font-size: 22px; 267 | } 268 | .leaflet-touch .leaflet-control-zoom-out { 269 | font-size: 24px; 270 | } 271 | 272 | 273 | /* layers control */ 274 | 275 | .leaflet-control-layers { 276 | box-shadow: 0 1px 5px rgba(0,0,0,0.4); 277 | background: #fff; 278 | border-radius: 5px; 279 | } 280 | .leaflet-control-layers-toggle { 281 | background-image: url(images/layers.png); 282 | width: 36px; 283 | height: 36px; 284 | } 285 | .leaflet-retina .leaflet-control-layers-toggle { 286 | background-image: url(images/layers-2x.png); 287 | background-size: 26px 26px; 288 | } 289 | .leaflet-touch .leaflet-control-layers-toggle { 290 | width: 44px; 291 | height: 44px; 292 | } 293 | .leaflet-control-layers .leaflet-control-layers-list, 294 | .leaflet-control-layers-expanded .leaflet-control-layers-toggle { 295 | display: none; 296 | } 297 | .leaflet-control-layers-expanded .leaflet-control-layers-list { 298 | display: block; 299 | position: relative; 300 | } 301 | .leaflet-control-layers-expanded { 302 | padding: 6px 10px 6px 6px; 303 | color: #333; 304 | background: #fff; 305 | } 306 | .leaflet-control-layers-selector { 307 | margin-top: 2px; 308 | position: relative; 309 | top: 1px; 310 | } 311 | .leaflet-control-layers label { 312 | display: block; 313 | } 314 | .leaflet-control-layers-separator { 315 | height: 0; 316 | border-top: 1px solid #ddd; 317 | margin: 5px -10px 5px -6px; 318 | } 319 | 320 | 321 | /* attribution and scale controls */ 322 | 323 | .leaflet-container .leaflet-control-attribution { 324 | background: #fff; 325 | background: rgba(255, 255, 255, 0.7); 326 | margin: 0; 327 | } 328 | .leaflet-control-attribution, 329 | .leaflet-control-scale-line { 330 | padding: 0 5px; 331 | color: #333; 332 | } 333 | .leaflet-control-attribution a { 334 | text-decoration: none; 335 | } 336 | .leaflet-control-attribution a:hover { 337 | text-decoration: underline; 338 | } 339 | .leaflet-container .leaflet-control-attribution, 340 | .leaflet-container .leaflet-control-scale { 341 | font-size: 11px; 342 | } 343 | .leaflet-left .leaflet-control-scale { 344 | margin-left: 5px; 345 | } 346 | .leaflet-bottom .leaflet-control-scale { 347 | margin-bottom: 5px; 348 | } 349 | .leaflet-control-scale-line { 350 | border: 2px solid #777; 351 | border-top: none; 352 | line-height: 1.1; 353 | padding: 2px 5px 1px; 354 | font-size: 11px; 355 | white-space: nowrap; 356 | overflow: hidden; 357 | -moz-box-sizing: content-box; 358 | box-sizing: content-box; 359 | 360 | background: #fff; 361 | background: rgba(255, 255, 255, 0.5); 362 | } 363 | .leaflet-control-scale-line:not(:first-child) { 364 | border-top: 2px solid #777; 365 | border-bottom: none; 366 | margin-top: -2px; 367 | } 368 | .leaflet-control-scale-line:not(:first-child):not(:last-child) { 369 | border-bottom: 2px solid #777; 370 | } 371 | 372 | .leaflet-touch .leaflet-control-attribution, 373 | .leaflet-touch .leaflet-control-layers, 374 | .leaflet-touch .leaflet-bar { 375 | box-shadow: none; 376 | } 377 | .leaflet-touch .leaflet-control-layers, 378 | .leaflet-touch .leaflet-bar { 379 | border: 2px solid rgba(0,0,0,0.2); 380 | background-clip: padding-box; 381 | } 382 | 383 | 384 | /* popup */ 385 | 386 | .leaflet-popup { 387 | position: absolute; 388 | text-align: center; 389 | } 390 | .leaflet-popup-content-wrapper { 391 | padding: 1px; 392 | text-align: left; 393 | border-radius: 12px; 394 | } 395 | .leaflet-popup-content { 396 | margin: 13px 19px; 397 | line-height: 1.4; 398 | } 399 | .leaflet-popup-content p { 400 | margin: 18px 0; 401 | } 402 | .leaflet-popup-tip-container { 403 | margin: 0 auto; 404 | width: 40px; 405 | height: 20px; 406 | position: relative; 407 | overflow: hidden; 408 | } 409 | .leaflet-popup-tip { 410 | width: 17px; 411 | height: 17px; 412 | padding: 1px; 413 | 414 | margin: -10px auto 0; 415 | 416 | -webkit-transform: rotate(45deg); 417 | -moz-transform: rotate(45deg); 418 | -ms-transform: rotate(45deg); 419 | -o-transform: rotate(45deg); 420 | transform: rotate(45deg); 421 | } 422 | .leaflet-popup-content-wrapper, 423 | .leaflet-popup-tip { 424 | background: white; 425 | 426 | box-shadow: 0 3px 14px rgba(0,0,0,0.4); 427 | } 428 | .leaflet-container a.leaflet-popup-close-button { 429 | position: absolute; 430 | top: 0; 431 | right: 0; 432 | padding: 4px 4px 0 0; 433 | text-align: center; 434 | width: 18px; 435 | height: 14px; 436 | font: 16px/14px Tahoma, Verdana, sans-serif; 437 | color: #c3c3c3; 438 | text-decoration: none; 439 | font-weight: bold; 440 | background: transparent; 441 | } 442 | .leaflet-container a.leaflet-popup-close-button:hover { 443 | color: #999; 444 | } 445 | .leaflet-popup-scrolled { 446 | overflow: auto; 447 | border-bottom: 1px solid #ddd; 448 | border-top: 1px solid #ddd; 449 | } 450 | 451 | .leaflet-oldie .leaflet-popup-content-wrapper { 452 | zoom: 1; 453 | } 454 | .leaflet-oldie .leaflet-popup-tip { 455 | width: 24px; 456 | margin: 0 auto; 457 | 458 | -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)"; 459 | filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678); 460 | } 461 | .leaflet-oldie .leaflet-popup-tip-container { 462 | margin-top: -1px; 463 | } 464 | 465 | .leaflet-oldie .leaflet-control-zoom, 466 | .leaflet-oldie .leaflet-control-layers, 467 | .leaflet-oldie .leaflet-popup-content-wrapper, 468 | .leaflet-oldie .leaflet-popup-tip { 469 | border: 1px solid #999; 470 | } 471 | 472 | 473 | /* div icon */ 474 | 475 | .leaflet-div-icon { 476 | background: #fff; 477 | border: 1px solid #666; 478 | } 479 | -------------------------------------------------------------------------------- /public/css/leaflet.draw.css: -------------------------------------------------------------------------------- 1 | /* ================================================================== */ 2 | /* Toolbars 3 | /* ================================================================== */ 4 | 5 | .leaflet-draw-section { 6 | position: relative; 7 | } 8 | 9 | .leaflet-draw-toolbar { 10 | margin-top: 12px; 11 | } 12 | 13 | .leaflet-draw-toolbar-top { 14 | margin-top: 0; 15 | } 16 | 17 | .leaflet-draw-toolbar-notop a:first-child { 18 | border-top-right-radius: 0; 19 | } 20 | 21 | .leaflet-draw-toolbar-nobottom a:last-child { 22 | border-bottom-right-radius: 0; 23 | } 24 | 25 | .leaflet-draw-toolbar a { 26 | background-image: url('images/spritesheet.png'); 27 | background-repeat: no-repeat; 28 | } 29 | 30 | .leaflet-retina .leaflet-draw-toolbar a { 31 | background-image: url('images/spritesheet-2x.png'); 32 | background-size: 270px 30px; 33 | } 34 | 35 | .leaflet-draw a { 36 | display: block; 37 | text-align: center; 38 | text-decoration: none; 39 | } 40 | 41 | /* ================================================================== */ 42 | /* Toolbar actions menu 43 | /* ================================================================== */ 44 | 45 | .leaflet-draw-actions { 46 | display: none; 47 | list-style: none; 48 | margin: 0; 49 | padding: 0; 50 | position: absolute; 51 | left: 26px; /* leaflet-draw-toolbar.left + leaflet-draw-toolbar.width */ 52 | top: 0; 53 | white-space: nowrap; 54 | } 55 | 56 | .leaflet-touch .leaflet-draw-actions { 57 | left: 32px; 58 | } 59 | 60 | .leaflet-right .leaflet-draw-actions { 61 | right:26px; 62 | left:auto; 63 | } 64 | 65 | .leaflet-touch .leaflet-right .leaflet-draw-actions { 66 | right:32px; 67 | left:auto; 68 | } 69 | 70 | .leaflet-draw-actions li { 71 | display: inline-block; 72 | } 73 | 74 | .leaflet-draw-actions li:first-child a { 75 | border-left: none; 76 | } 77 | 78 | .leaflet-draw-actions li:last-child a { 79 | -webkit-border-radius: 0 4px 4px 0; 80 | border-radius: 0 4px 4px 0; 81 | } 82 | 83 | .leaflet-right .leaflet-draw-actions li:last-child a { 84 | -webkit-border-radius: 0; 85 | border-radius: 0; 86 | } 87 | 88 | .leaflet-right .leaflet-draw-actions li:first-child a { 89 | -webkit-border-radius: 4px 0 0 4px; 90 | border-radius: 4px 0 0 4px; 91 | } 92 | 93 | .leaflet-draw-actions a { 94 | background-color: #919187; 95 | border-left: 1px solid #AAA; 96 | color: #FFF; 97 | font: 11px/19px "Helvetica Neue", Arial, Helvetica, sans-serif; 98 | line-height: 28px; 99 | text-decoration: none; 100 | padding-left: 10px; 101 | padding-right: 10px; 102 | height: 28px; 103 | } 104 | 105 | .leaflet-touch .leaflet-draw-actions a { 106 | font-size: 12px; 107 | line-height: 30px; 108 | height: 30px; 109 | } 110 | 111 | .leaflet-draw-actions-bottom { 112 | margin-top: 0; 113 | } 114 | 115 | .leaflet-draw-actions-top { 116 | margin-top: 1px; 117 | } 118 | 119 | .leaflet-draw-actions-top a, 120 | .leaflet-draw-actions-bottom a { 121 | height: 27px; 122 | line-height: 27px; 123 | } 124 | 125 | .leaflet-draw-actions a:hover { 126 | background-color: #A0A098; 127 | } 128 | 129 | .leaflet-draw-actions-top.leaflet-draw-actions-bottom a { 130 | height: 26px; 131 | line-height: 26px; 132 | } 133 | 134 | /* ================================================================== */ 135 | /* Draw toolbar 136 | /* ================================================================== */ 137 | 138 | .leaflet-draw-toolbar .leaflet-draw-draw-polyline { 139 | background-position: -2px -2px; 140 | } 141 | 142 | .leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-polyline { 143 | background-position: 0 -1px; 144 | } 145 | 146 | .leaflet-draw-toolbar .leaflet-draw-draw-polygon { 147 | background-position: -31px -2px; 148 | } 149 | 150 | .leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-polygon { 151 | background-position: -29px -1px; 152 | } 153 | 154 | .leaflet-draw-toolbar .leaflet-draw-draw-rectangle { 155 | background-position: -62px -2px; 156 | } 157 | 158 | .leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-rectangle { 159 | background-position: -60px -1px; 160 | } 161 | 162 | .leaflet-draw-toolbar .leaflet-draw-draw-circle { 163 | background-position: -92px -2px; 164 | } 165 | 166 | .leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-circle { 167 | background-position: -90px -1px; 168 | } 169 | 170 | .leaflet-draw-toolbar .leaflet-draw-draw-marker { 171 | background-position: -122px -2px; 172 | } 173 | 174 | .leaflet-touch .leaflet-draw-toolbar .leaflet-draw-draw-marker { 175 | background-position: -120px -1px; 176 | } 177 | 178 | /* ================================================================== */ 179 | /* Edit toolbar 180 | /* ================================================================== */ 181 | 182 | .leaflet-draw-toolbar .leaflet-draw-edit-edit { 183 | background-position: -152px -2px; 184 | } 185 | 186 | .leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-edit { 187 | background-position: -150px -1px; 188 | } 189 | 190 | .leaflet-draw-toolbar .leaflet-draw-edit-remove { 191 | background-position: -182px -2px; 192 | } 193 | 194 | .leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-remove { 195 | background-position: -180px -1px; 196 | } 197 | 198 | .leaflet-draw-toolbar .leaflet-draw-edit-edit.leaflet-disabled { 199 | background-position: -212px -2px; 200 | } 201 | 202 | .leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-edit.leaflet-disabled { 203 | background-position: -210px -1px; 204 | } 205 | 206 | .leaflet-draw-toolbar .leaflet-draw-edit-remove.leaflet-disabled { 207 | background-position: -242px -2px; 208 | } 209 | 210 | .leaflet-touch .leaflet-draw-toolbar .leaflet-draw-edit-remove.leaflet-disabled { 211 | background-position: -240px -2px; 212 | } 213 | 214 | /* ================================================================== */ 215 | /* Drawing styles 216 | /* ================================================================== */ 217 | 218 | .leaflet-mouse-marker { 219 | background-color: #fff; 220 | cursor: crosshair; 221 | } 222 | 223 | .leaflet-draw-tooltip { 224 | background: rgb(54, 54, 54); 225 | background: rgba(0, 0, 0, 0.5); 226 | border: 1px solid transparent; 227 | -webkit-border-radius: 4px; 228 | border-radius: 4px; 229 | color: #fff; 230 | font: 12px/18px "Helvetica Neue", Arial, Helvetica, sans-serif; 231 | margin-left: 20px; 232 | margin-top: -21px; 233 | padding: 4px 8px; 234 | position: absolute; 235 | visibility: hidden; 236 | white-space: nowrap; 237 | z-index: 6; 238 | } 239 | 240 | .leaflet-draw-tooltip:before { 241 | border-right: 6px solid black; 242 | border-right-color: rgba(0, 0, 0, 0.5); 243 | border-top: 6px solid transparent; 244 | border-bottom: 6px solid transparent; 245 | content: ""; 246 | position: absolute; 247 | top: 7px; 248 | left: -7px; 249 | } 250 | 251 | .leaflet-error-draw-tooltip { 252 | background-color: #F2DEDE; 253 | border: 1px solid #E6B6BD; 254 | color: #B94A48; 255 | } 256 | 257 | .leaflet-error-draw-tooltip:before { 258 | border-right-color: #E6B6BD; 259 | } 260 | 261 | .leaflet-draw-tooltip-single { 262 | margin-top: -12px 263 | } 264 | 265 | .leaflet-draw-tooltip-subtext { 266 | color: #f8d5e4; 267 | } 268 | 269 | .leaflet-draw-guide-dash { 270 | font-size: 1%; 271 | opacity: 0.6; 272 | position: absolute; 273 | width: 5px; 274 | height: 5px; 275 | } 276 | 277 | /* ================================================================== */ 278 | /* Edit styles 279 | /* ================================================================== */ 280 | 281 | .leaflet-edit-marker-selected { 282 | background: rgba(254, 87, 161, 0.1); 283 | border: 4px dashed rgba(254, 87, 161, 0.6); 284 | -webkit-border-radius: 4px; 285 | border-radius: 4px; 286 | } 287 | 288 | .leaflet-edit-move { 289 | cursor: move; 290 | } 291 | 292 | .leaflet-edit-resize { 293 | cursor: pointer; 294 | } 295 | 296 | /* ================================================================== */ 297 | /* Old IE styles 298 | /* ================================================================== */ 299 | 300 | .leaflet-oldie .leaflet-draw-toolbar { 301 | border: 1px solid #999; 302 | } -------------------------------------------------------------------------------- /public/css/main.css: -------------------------------------------------------------------------------- 1 | /* 2 | global styles 3 | */ 4 | 5 | html, body { 6 | height:100%; 7 | } 8 | body { 9 | background-image: none !important; 10 | padding-top: 70px; 11 | } 12 | h1 { 13 | border-bottom: 1px solid #ccc; 14 | color: #000 !important; 15 | font-size: 1.4em !important; 16 | margin: 0 0 30px 0 !important; 17 | padding: 0 0 20px 0 !important; 18 | } 19 | h2 { 20 | font-size: 1.2em; 21 | margin-bottom: 20px; 22 | } 23 | section { 24 | margin: 40px 0; 25 | } 26 | .page-content { 27 | min-height: -webkit-calc(100% - 64px); 28 | min-height: -moz-calc(100% - 64px); 29 | min-height: calc(100% - 64px); 30 | padding: 30px 40px; 31 | } 32 | .no-float2 { 33 | float: none; /* thanks baxabbit */ 34 | } 35 | .sprite { 36 | background-image: url("/img/sprite.png") !important; 37 | } 38 | .sidebar { 39 | background: none repeat scroll 0 0 #343031; 40 | border-right: 1px solid #eee; 41 | bottom: 0; 42 | display: block; 43 | left: 0; 44 | overflow-x: hidden; 45 | overflow-y: auto; 46 | padding: 50px 20px 20px; 47 | position: fixed; 48 | top: 0; 49 | } 50 | .sidebar-title { 51 | color: #eee; 52 | padding: 20px 0 20px 0px; 53 | font-size: 1.4em; 54 | } 55 | .nav-sidebar { 56 | margin-bottom: 20px; 57 | } 58 | .sidebar li { 59 | margin-left: -20px; 60 | } 61 | .nav-sidebar > li > a { 62 | /*padding: 20px 20px 20px 30px;*/ 63 | color: #999999 !important; 64 | } 65 | .nav-sidebar > .active > a, 66 | .nav-sidebar > .active > a:hover, 67 | .nav-sidebar > .active > a:focus { 68 | background-color: #111111 !important; 69 | color: #fff !important; 70 | } 71 | .nav-sidebar > li > a:hover, 72 | .nav-sidebar > li > a:focus { 73 | background-color: #666666; 74 | color: #FFFFFF !important; 75 | } 76 | .popover { 77 | position: absolute; 78 | top: 0; 79 | left: 0; 80 | z-index: 1060; 81 | display: none; 82 | max-width: 400px; 83 | max-height: 400px; 84 | padding: 1px; 85 | text-align: left; 86 | background-color: #ffffff; 87 | background-clip: padding-box; 88 | border: 1px solid #cccccc; 89 | border: 1px solid rgba(0, 0, 0, 0.2); 90 | border-radius: 200px; 91 | -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); 92 | box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); 93 | white-space: normal; 94 | } 95 | -------------------------------------------------------------------------------- /public/css/style.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | font-family: "HelveticaNeue","Helvetica Neue",Helvetica,Arial,sans-serif; 3 | font-size: 12pt; 4 | background-color: #333; 5 | color: #777; 6 | font-weight: 300; 7 | } 8 | h1, h2 { 9 | color: #999; 10 | font-weight: 400; 11 | margin: 0.2em 0 0.2em 0; 12 | } 13 | 14 | .navbar-brand { 15 | color: #fff !important; 16 | font-size: 16pt; 17 | font-weight: 400; 18 | } 19 | .navbar-brand a { color: #fff !important; text-decoration: none;} 20 | .ibm { 21 | color: #00b1ee; 22 | font-weight: 200; 23 | } 24 | .dev { 25 | color: #00b1ee; 26 | font-size: 8pt; 27 | text-transform: uppercase; 28 | vertical-align: super; 29 | } 30 | 31 | #map { 32 | width: 100%; 33 | height: 484px; 34 | } 35 | 36 | .appwindow { 37 | color: #fff; 38 | /*background-color: #fff;*/ /*#22537A;*/ 39 | /*padding:12px;*/ 40 | /*border-radius: 12px;*/ 41 | /*-moz-border-radius: 12px;*/ 42 | } 43 | 44 | div.leaflet-popup-content { 45 | color: #22537A; 46 | } 47 | 48 | .caption { 49 | font-size: 75%; 50 | line-height: 1em; 51 | font-style: italic; 52 | } 53 | 54 | #content { 55 | line-height: 1.5em; 56 | padding-top: 2em; 57 | padding-left: 25%; 58 | padding-right: 15%; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Field Work | IBM CDS 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 31 | 32 |
33 |
34 | 35 | 129 | 130 | 131 |
132 |
133 |
134 |
135 | 136 | 137 | Fork me on GitHub 139 | 140 |
141 | 142 | 143 |
144 | 145 | 146 | 147 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | -------------------------------------------------------------------------------- /public/js/bootbox.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * bootbox.js v4.3.0 3 | * 4 | * http://bootboxjs.com/license.txt 5 | */ 6 | !function(a,b){"use strict";"function"==typeof define&&define.amd?define(["jquery"],b):"object"==typeof exports?module.exports=b(require("jquery")):a.bootbox=b(a.jQuery)}(this,function a(b,c){"use strict";function d(a){var b=q[o.locale];return b?b[a]:q.en[a]}function e(a,c,d){a.stopPropagation(),a.preventDefault();var e=b.isFunction(d)&&d(a)===!1;e||c.modal("hide")}function f(a){var b,c=0;for(b in a)c++;return c}function g(a,c){var d=0;b.each(a,function(a,b){c(a,b,d++)})}function h(a){var c,d;if("object"!=typeof a)throw new Error("Please supply an object of options");if(!a.message)throw new Error("Please specify a message");return a=b.extend({},o,a),a.buttons||(a.buttons={}),a.backdrop=a.backdrop?"static":!1,c=a.buttons,d=f(c),g(c,function(a,e,f){if(b.isFunction(e)&&(e=c[a]={callback:e}),"object"!==b.type(e))throw new Error("button with key "+a+" must be an object");e.label||(e.label=a),e.className||(e.className=2>=d&&f===d-1?"btn-primary":"btn-default")}),a}function i(a,b){var c=a.length,d={};if(1>c||c>2)throw new Error("Invalid argument length");return 2===c||"string"==typeof a[0]?(d[b[0]]=a[0],d[b[1]]=a[1]):d=a[0],d}function j(a,c,d){return b.extend(!0,{},a,i(c,d))}function k(a,b,c,d){var e={className:"bootbox-"+a,buttons:l.apply(null,b)};return m(j(e,d,c),b)}function l(){for(var a={},b=0,c=arguments.length;c>b;b++){var e=arguments[b],f=e.toLowerCase(),g=e.toUpperCase();a[f]={label:d(g)}}return a}function m(a,b){var d={};return g(b,function(a,b){d[b]=!0}),g(a.buttons,function(a){if(d[a]===c)throw new Error("button key "+a+" is not allowed (options are "+b.join("\n")+")")}),a}var n={dialog:"",header:"",footer:"",closeButton:"",form:"
",inputs:{text:"",textarea:"",email:"",select:"",checkbox:"
",date:"",time:"",number:"",password:""}},o={locale:"en",backdrop:!0,animate:!0,className:null,closeButton:!0,show:!0,container:"body"},p={};p.alert=function(){var a;if(a=k("alert",["ok"],["message","callback"],arguments),a.callback&&!b.isFunction(a.callback))throw new Error("alert requires callback property to be a function when provided");return a.buttons.ok.callback=a.onEscape=function(){return b.isFunction(a.callback)?a.callback():!0},p.dialog(a)},p.confirm=function(){var a;if(a=k("confirm",["cancel","confirm"],["message","callback"],arguments),a.buttons.cancel.callback=a.onEscape=function(){return a.callback(!1)},a.buttons.confirm.callback=function(){return a.callback(!0)},!b.isFunction(a.callback))throw new Error("confirm requires a callback");return p.dialog(a)},p.prompt=function(){var a,d,e,f,h,i,k;if(f=b(n.form),d={className:"bootbox-prompt",buttons:l("cancel","confirm"),value:"",inputType:"text"},a=m(j(d,arguments,["title","callback"]),["cancel","confirm"]),i=a.show===c?!0:a.show,a.message=f,a.buttons.cancel.callback=a.onEscape=function(){return a.callback(null)},a.buttons.confirm.callback=function(){var c;switch(a.inputType){case"text":case"textarea":case"email":case"select":case"date":case"time":case"number":case"password":c=h.val();break;case"checkbox":var d=h.find("input:checked");c=[],g(d,function(a,d){c.push(b(d).val())})}return a.callback(c)},a.show=!1,!a.title)throw new Error("prompt requires a title");if(!b.isFunction(a.callback))throw new Error("prompt requires a callback");if(!n.inputs[a.inputType])throw new Error("invalid prompt type");switch(h=b(n.inputs[a.inputType]),a.inputType){case"text":case"textarea":case"email":case"date":case"time":case"number":case"password":h.val(a.value);break;case"select":var o={};if(k=a.inputOptions||[],!k.length)throw new Error("prompt with select requires options");g(k,function(a,d){var e=h;if(d.value===c||d.text===c)throw new Error("given options in wrong format");d.group&&(o[d.group]||(o[d.group]=b("").attr("label",d.group)),e=o[d.group]),e.append("")}),g(o,function(a,b){h.append(b)}),h.val(a.value);break;case"checkbox":var q=b.isArray(a.value)?a.value:[a.value];if(k=a.inputOptions||[],!k.length)throw new Error("prompt with checkbox requires options");if(!k[0].value||!k[0].text)throw new Error("given options in wrong format");h=b("
"),g(k,function(c,d){var e=b(n.inputs[a.inputType]);e.find("input").attr("value",d.value),e.find("label").append(d.text),g(q,function(a,b){b===d.value&&e.find("input").prop("checked",!0)}),h.append(e)})}return a.placeholder&&h.attr("placeholder",a.placeholder),a.pattern&&h.attr("pattern",a.pattern),f.append(h),f.on("submit",function(a){a.preventDefault(),a.stopPropagation(),e.find(".btn-primary").click()}),e=p.dialog(a),e.off("shown.bs.modal"),e.on("shown.bs.modal",function(){h.focus()}),i===!0&&e.modal("show"),e},p.dialog=function(a){a=h(a);var c=b(n.dialog),d=c.find(".modal-dialog"),f=c.find(".modal-body"),i=a.buttons,j="",k={onEscape:a.onEscape};if(g(i,function(a,b){j+="",k[a]=b.callback}),f.find(".bootbox-body").html(a.message),a.animate===!0&&c.addClass("fade"),a.className&&c.addClass(a.className),"large"===a.size&&d.addClass("modal-lg"),"small"===a.size&&d.addClass("modal-sm"),a.title&&f.before(n.header),a.closeButton){var l=b(n.closeButton);a.title?c.find(".modal-header").prepend(l):l.css("margin-top","-10px").prependTo(f)}return a.title&&c.find(".modal-title").html(a.title),j.length&&(f.after(n.footer),c.find(".modal-footer").html(j)),c.on("hidden.bs.modal",function(a){a.target===this&&c.remove()}),c.on("shown.bs.modal",function(){c.find(".btn-primary:first").focus()}),c.on("escape.close.bb",function(a){k.onEscape&&e(a,c,k.onEscape)}),c.on("click",".modal-footer button",function(a){var d=b(this).data("bb-handler");e(a,c,k[d])}),c.on("click",".bootbox-close-button",function(a){e(a,c,k.onEscape)}),c.on("keyup",function(a){27===a.which&&c.trigger("escape.close.bb")}),b(a.container).append(c),c.modal({backdrop:a.backdrop,keyboard:!1,show:!1}),a.show&&c.modal("show"),c},p.setDefaults=function(){var a={};2===arguments.length?a[arguments[0]]=arguments[1]:a=arguments[0],b.extend(o,a)},p.hideAll=function(){return b(".bootbox").modal("hide"),p};var q={br:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Sim"},cs:{OK:"OK",CANCEL:"Zrušit",CONFIRM:"Potvrdit"},da:{OK:"OK",CANCEL:"Annuller",CONFIRM:"Accepter"},de:{OK:"OK",CANCEL:"Abbrechen",CONFIRM:"Akzeptieren"},el:{OK:"Εντάξει",CANCEL:"Ακύρωση",CONFIRM:"Επιβεβαίωση"},en:{OK:"OK",CANCEL:"Cancel",CONFIRM:"OK"},es:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Aceptar"},et:{OK:"OK",CANCEL:"Katkesta",CONFIRM:"OK"},fi:{OK:"OK",CANCEL:"Peruuta",CONFIRM:"OK"},fr:{OK:"OK",CANCEL:"Annuler",CONFIRM:"D'accord"},he:{OK:"אישור",CANCEL:"ביטול",CONFIRM:"אישור"},id:{OK:"OK",CANCEL:"Batal",CONFIRM:"OK"},it:{OK:"OK",CANCEL:"Annulla",CONFIRM:"Conferma"},ja:{OK:"OK",CANCEL:"キャンセル",CONFIRM:"確認"},lt:{OK:"Gerai",CANCEL:"Atšaukti",CONFIRM:"Patvirtinti"},lv:{OK:"Labi",CANCEL:"Atcelt",CONFIRM:"Apstiprināt"},nl:{OK:"OK",CANCEL:"Annuleren",CONFIRM:"Accepteren"},no:{OK:"OK",CANCEL:"Avbryt",CONFIRM:"OK"},pl:{OK:"OK",CANCEL:"Anuluj",CONFIRM:"Potwierdź"},pt:{OK:"OK",CANCEL:"Cancelar",CONFIRM:"Confirmar"},ru:{OK:"OK",CANCEL:"Отмена",CONFIRM:"Применить"},sv:{OK:"OK",CANCEL:"Avbryt",CONFIRM:"OK"},tr:{OK:"Tamam",CANCEL:"İptal",CONFIRM:"Onayla"},zh_CN:{OK:"OK",CANCEL:"取消",CONFIRM:"确认"},zh_TW:{OK:"OK",CANCEL:"取消",CONFIRM:"確認"}};return p.init=function(c){return a(c||b)},p}); -------------------------------------------------------------------------------- /public/js/bootstrap.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.2.0 (http://getbootstrap.com) 3 | * Copyright 2011-2014 Twitter, Inc. 4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5 | */ 6 | if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.2.0",d.prototype.close=function(b){function c(){f.detach().trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",c).emulateTransitionEnd(150):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.2.0",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),d[e](null==f[b]?this.options[b]:f[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),c.preventDefault()})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b).on("keydown.bs.carousel",a.proxy(this.keydown,this)),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.2.0",c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},c.prototype.keydown=function(a){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.to=function(b){var c=this,d=this.getItemIndex(this.$active=this.$element.find(".item.active"));return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=e[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:g});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,f&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(e)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:g});return a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one("bsTransitionEnd",function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger(m)),f&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b);!e&&f.toggle&&"show"==b&&(b=!b),e||d.data("bs.collapse",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};c.VERSION="3.2.0",c.DEFAULTS={toggle:!0},c.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},c.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var c=a.Event("show.bs.collapse");if(this.$element.trigger(c),!c.isDefaultPrevented()){var d=this.$parent&&this.$parent.find("> .panel > .in");if(d&&d.length){var e=d.data("bs.collapse");if(e&&e.transitioning)return;b.call(d,"hide"),e||d.data("bs.collapse",null)}var f=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[f](0),this.transitioning=1;var g=function(){this.$element.removeClass("collapsing").addClass("collapse in")[f](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return g.call(this);var h=a.camelCase(["scroll",f].join("-"));this.$element.one("bsTransitionEnd",a.proxy(g,this)).emulateTransitionEnd(350)[f](this.$element[0][h])}}},c.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},c.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var d=a.fn.collapse;a.fn.collapse=b,a.fn.collapse.Constructor=c,a.fn.collapse.noConflict=function(){return a.fn.collapse=d,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(c){var d,e=a(this),f=e.attr("data-target")||c.preventDefault()||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),g=a(f),h=g.data("bs.collapse"),i=h?"toggle":e.data(),j=e.attr("data-parent"),k=j&&a(j);h&&h.transitioning||(k&&k.find('[data-toggle="collapse"][data-parent="'+j+'"]').not(e).addClass("collapsed"),e[g.hasClass("in")?"addClass":"removeClass"]("collapsed")),b.call(g,i)})}(jQuery),+function(a){"use strict";function b(b){b&&3===b.which||(a(e).remove(),a(f).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))}))}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.2.0",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('