source: Dev/branches/rest-dojo-ui/client/config/docs.json @ 406

Last change on this file since 406 was 406, checked in by hendrikvanantwerpen, 13 years ago

Lots of small fixes.

Make it possible to read survey answers (when a question code is
provided), it is now displayed in place of the survey. More to come.

Some whitespace fixes.

File size: 1.7 KB
Line 
1{
2    "_users/rft_admin": {
3        "__configAction": "ignore",
4        "_id": "org.couchdb.user:rft_admin",
5        "name": "rft_admin",
6        "password": "Welkom01",
7        "roles": [ "rft_admin" ],
8        "type": "user"
9    },
10    "rft/_security": {
11        "__configAction": "ignore",
12        "admins" : {
13            "names" : [],
14            "roles" : ["rft_admin"]
15        },
16        "readers" : {
17            "names" : [],
18            "roles" : ["rft_user"]
19        }
20    },
21    "rft/_design/default": {
22        "__configAction": "replace",
23        "_id": "_design/default",
24        "language": "javascript",
25        "validate_doc_update": "function(newDoc, oldDoc, userCtx, secObj) { if(oldDoc&&oldDoc.published){throw({forbidden:'Published documents cannot be modified.'});} if (!newDoc.type){throw({forbidden:'Documents must have a type field.'});} }",
26        "views": {
27            "by_type": {
28                "map": "function(doc){ emit(doc.type, doc); }"
29            },
30            "unpublished": {
31                "map": "function(doc){ if ( doc.type === 'Survey' && !doc.published ) { emit(doc._id, doc); } }"
32            },
33            "questions": {
34                "map": "function(doc){ if ( doc.type === 'Question' ) { if ( doc.categories && doc.categories.length > 0 ) { for (var i = 0; i < doc.categories.length; i++) { emit([doc.categories[i],doc.topic || null],1); } } else { emit([null,null],1); } } }",
35                "reduce": "function(keys,values) { return sum(values); }"
36            },
37            "topics": {
38                "map": "function(doc){ if ( doc.type === 'Question' ) { emit(doc.topic, 1); } }",
39                "reduce":   "function(keys, values) { return null; }"
40            }
41        }
42    }
43}
Note: See TracBrowser for help on using the repository browser.