Add hierarchical graph
[disclosr.git] / include / couchdb.inc.php
blob:a/include/couchdb.inc.php -> blob:b/include/couchdb.inc.php
--- a/include/couchdb.inc.php
+++ b/include/couchdb.inc.php
@@ -1,6 +1,8 @@
 <?php
 
-include "schemas/schemas.inc.php";
+include $basePath."schemas/schemas.inc.php";
+
+require ($basePath.'couchdb/settee/src/settee.php');
 
 function createAgencyDesignDoc() {
     global $db;
@@ -11,6 +13,11 @@
     $obj->views->byABN->map = "function(doc) {   emit(doc.abn, doc); };";
         $obj->views->byCanonicalName->map = "function(doc) {  
             if (doc.parentOrg || doc.orgType == 'FMA-DepartmentOfState') {
+        emit(doc.name, doc); 
+        }
+};";
+        $obj->views->byDeptStateName->map = "function(doc) {  
+            if (doc.orgType == 'FMA-DepartmentOfState') {
         emit(doc.name, doc._id); 
         }
 };";
@@ -27,6 +34,11 @@
 }
         }
 };";
+    
+   $obj->views->foiEmails->map = "function(doc) {  
+        emit(doc._id, doc.foiEmail);
+};";
+    
     $obj->views->byLastModified->map = "function(doc) {   emit(doc.metadata.lastModified, doc); }";
     $obj->views->getActive->map = 'function(doc) { if (doc.status == "active") {  emit(doc._id, doc); } };';
     $obj->views->getSuspended->map = 'function(doc) { if (doc.status == "suspended") {  emit(doc._id, doc); } };';
@@ -60,21 +72,19 @@
     return $db->save($obj, true);
 }
 
-require ('couchdb/settee/src/settee.php');
 
 if( php_uname('n') == "vanille") {
 
 $server = new SetteeServer('http://192.168.178.21:5984');
 } else 
-    if( php_uname('n') == "kyuubey") {
+    if( php_uname('n') == "KYUUBEY") {
 
-$server = new SetteeServer('http://192.168.1.8:5984');
+$server = new SetteeServer('http://192.168.1.148:5984');
 } else {
     $server = new SetteeServer('http://127.0.0.1:5984');
 }
 function setteErrorHandler($e) {
     echo $e->getMessage() . "<br>" . PHP_EOL;
 }
-
 ?>