Changeset 410 for Dev/branches/rest-dojo-ui/client/config/docs.js
- Timestamp:
- 09/07/12 16:59:14 (13 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/config/docs.js
r409 r410 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"] 1 define([],function(){ 2 return { 3 "_users/rft_admin": { 4 __configAction: "ignore", 5 _id: "org.couchdb.user:rft_admin", 6 name: "rft_admin", 7 password: "Welkom01", 8 roles: [ "rft_admin" ], 9 type: "user" 15 10 }, 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); }" 11 "rft/_security": { 12 __configAction: "ignore", 13 admins: { 14 names: [], 15 roles: ["rft_admin"] 29 16 }, 30 "unpublished": { 31 "map": "function(doc){ if ( doc.type === 'Survey' && !doc.published ) { emit(doc._id, doc); } }" 17 readers: { 18 names: [], 19 roles: ["rft_user"] 20 } 21 }, 22 "rft/_design/default": { 23 __configAction: "replace", 24 _id: "_design/default", 25 language: "javascript", 26 validate_doc_update: function(newDoc, oldDoc, userCtx, secObj) { 27 if ( oldDoc && oldDoc.publicationDate ) { throw({forbidden:'Published documents cannot be modified.'}); } 28 if ( !newDoc._deleted && !newDoc.type ) { throw({forbidden:'Documents must have a type field.'}); } 32 29 }, 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); }" 30 views: { 31 by_type: { 32 map: function(doc){ 33 emit(doc.type, doc); 34 } 35 } 36 } 37 }, 38 "rft/_design/questions": { 39 __configAction: "replace", 40 _id: "_design/questions", 41 language: "javascript", 42 validate_doc_update: function(newDoc, oldDoc, userCtx, secObj) { 43 if( newDoc._deleted || newDoc.type!=='Question' ){ return; } 44 if( !newDoc.code ){ throw({forbidden:'Question must have a code field.'});} 36 45 }, 37 "topics": { 38 "map": "function(doc){ if ( doc.type === 'Question' ) { emit(doc.topic, 1); } }", 39 "reduce": "function(keys, values) { return null; }" 46 views: { 47 all: { 48 map: function(doc){ 49 if ( doc.type !== 'Question' ) { return; } 50 if ( doc.categories && doc.categories.length > 0 ) { 51 for ( var i = 0; i < doc.categories.length; i++ ) { 52 emit([doc.categories[i],doc.topic||null],1); 53 } 54 } else { 55 emit([null,null],1); 56 } 57 }, 58 reduce: function(keys,values){ return sum(values); } 59 }, 60 published: { 61 map: function(doc){ 62 if ( doc.type!=='Question' || !doc.publicationDate ) { return; } 63 if ( doc.categories && doc.categories.length > 0 ) { 64 for ( var i = 0; i < doc.categories.length; i++ ) { 65 emit([doc.categories[i],doc.topic||null],1); 66 } 67 } else { 68 emit([null,null],1); 69 } 70 }, 71 reduce: function(keys,values){ return sum(values); } 72 }, 73 all_topics: { 74 map: function(doc){ 75 if( doc.type !== 'Question' ){ return; } 76 emit(doc.topic); 77 } 78 }, 79 published_topics: { 80 map: function(doc){ 81 if ( doc.type !== 'Question' || !doc.publicationDate ) { return; } 82 emit(doc.topic); 83 } 84 } 85 } 86 }, 87 "rft/_design/surveys": { 88 __configAction: "replace", 89 _id: "_design/surveys", 90 language: "javascript", 91 views: { 92 drafts: { 93 map: function(doc){ 94 if ( doc.type !== 'Survey' || doc.publicationDate ) { return; } 95 emit(doc._id,doc); 96 } 97 }, 98 published: { 99 map: function(doc){ 100 if ( doc.type !== 'Survey' || !doc.publicationDate ) { return; } 101 emit(doc._id,doc); 102 } 103 } 40 104 } 41 105 } 42 } 43 } 106 }; 107 });
Note: See TracChangeset
for help on using the changeset viewer.