Add public ranking listing, link charts better
Add public ranking listing, link charts better


Former-commit-id: 889d2d51a7712e7454f582b671b6142d619ad672

file:a/about.php -> file:b/about.php
--- a/about.php
+++ b/about.php
@@ -5,6 +5,10 @@
 <div class="foundation-header">
     <h1><a href="about.php">About/FAQ</a></h1>
 </div>
+<a href="http://thenounproject.com/noun/document-dump/">Document Dump icon designed by  Iconathon,  2013</a>
+Contact us: maxious@lambdacomplex.org
+
+Exports: <a href="admin/exportAll.csv.php">All Agencies</a> <a href="admin/exportEmployees.csv.php">Agency Employee Headcounts</a>
 <h2> Attributions </h2>
 National Archives of Australia, Australian Governments’ Interactive Functions Thesaurus, 2nd edition, September 2005, published at http://www.naa.gov.au/recordkeeping/thesaurus/index.htm <br/>
 data.gov.au http://data.gov.au/dataset/directory-gov-au-full-data-export/ <br/>

file:a/charts.php (deleted)
--- a/charts.php
+++ /dev/null
@@ -1,133 +1,1 @@
-<?php
-include_once('include/common.inc.php');
-include_header('Charts');
-$db = $server->get_db('disclosr-agencies');
-?>
-<div class="foundation-header">
-    <h1><a href="about.php">Charts</a></h1>
-    <h4 class="subheader">Lorem ipsum.</h4>
-</div>
-<div id="scores" style="width:900px;height:500px;"></div>
-<div id="employees" style="width:1000px;height:900px;"></div>
-<script id="source">
-    window.onload = function() {
-        $(document).ready(function() {
-            var d1 = [];
-            var scorelabels = [];
-    <?php
-    try {
-        $rows = $db->get_view("app", "scoreHas?group=true", null, true)->rows;
 
-
-        $dataValues = Array();
-        foreach ($rows as $row) {
-            $dataValues[$row->value] = $row->key;
-        }
-        $i = 0;
-        ksort($dataValues);
-        foreach ($dataValues as $value => $key) {
-
-            echo "       d1.push([$i, $value]);" . PHP_EOL;
-            echo "        scorelabels.push('$key');" . PHP_EOL;
-            $i++;
-        }
-    } catch (SetteeRestClientException $e) {
-        setteErrorHandler($e);
-    }
-    ?>
-                function scoretrackformatter(obj) {
-                    if (scorelabels[Math.floor(obj.x)]) {
-                        return (scorelabels[Math.floor(obj.x)])+"="+obj.y;
-                     
-                    } else {
-                        return "";
-                    }
-                }
-                function scoretickformatter(val, axis) {
-                    if (scorelabels[Math.floor(val)]) {
-                        return '<p style="margin-top:8em;-webkit-transform:rotate(-90deg);">'+(scorelabels[Math.floor(val)])+"</b>";
-                     
-                    } else {
-                        return "";
-                    }
-                }
-                Flotr.draw(document.getElementById("scores"), [ {data: d1}], {
-                    HtmlText: true,
-                    bars : {
-                        show : true
-                    },
-                    mouse : {
-                        track : true,
-                        relative : true,
-                        trackFormatter: scoretrackformatter
-                    },yaxis: {
-                        autoscaling: true
-                    },
-                    xaxis: {
-                    autoscaling: true,
-                        minorTickFreq: 0.6,
-                        noTicks : scorelabels.length,
-                        tickFormatter: scoretickformatter
-                    }
-                });
-                
-                
-                
-                
-                
-                
-                
-                
-var emplabels = [];
-function emptrackformatter(obj) {
-                   
-                        return (obj.series.label)+" = "+obj.y+" in "+emplabels[Math.floor(obj.x)];
-                     
-                }
-                function emptickformatter(val, axis) {
-                    if (emplabels[Math.floor(val)]) {
-                        return '<p style="margin-top:8em;-webkit-transform:rotate(-90deg);">'+(emplabels[Math.floor(val)])+"</b>";
-                     
-                    } else {
-                        return "";
-                    }
-                }
-function onDataReceived(series) {
-    emplabels = series.labels;
-                       Flotr.draw(document.getElementById("employees"), series.data, {
-                    mouse : {
-                        track : true,
-                        relative : true,
-                    trackFormatter: emptrackformatter
-                    },yaxis: {
-                        max: 10000,
-                        scaling: 'logarithmic'
-                    },
-                    xaxis: {
-                    minorTickFreq: 1,
-                    noTicks: emplabels.length,
-                    showMinorLabels: true,
-                        tickFormatter: emptickformatter
-                    },
-                    legend: {
-                        show: false
-                    }
-                });
-                }
-        
-                $.ajax({
-                    url: "admin/exportEmployees.csv.php?format=json",
-                    method: 'GET',
-                    dataType: 'json',
-                    success: onDataReceived
-                });
-
-    
-            });
-        };
- 
-</script>
-
-<?php
-include_footer();
-?>

--- a/documents/charts.php
+++ b/documents/charts.php
@@ -13,10 +13,10 @@
 ?>
 <div class="foundation-header">
     <h1><a href="about.php">Charts</a></h1>
-    <h4 class="subheader">Lorem ipsum.</h4>
+    <h4 class="subheader"></h4>
 </div>
 <div id="bydate" style="width:1000px;height:300px;"></div>
-<div id="byagency" style="width:1200px;height:300px;"></div>
+<div id="byagency" style="width:1200px;height:800px;"></div>
 <script id="source">
     window.onload = function () {
         $(document).ready(function () {
@@ -59,7 +59,7 @@
                     mode: 'x'
                 },
                 HtmlText: false,
-                title: 'Time'
+                title: 'Disclosure Log entries added by Date'
             };
 
             // Draw graph with default options, overwriting with passed options
@@ -98,12 +98,12 @@
     var agencylabels = [];
     function agencytrackformatter(obj) {
 
-        return agencylabels[Math.floor(obj.x)] + " = " + obj.y;
+        return agencylabels[Math.floor(obj.y)] + " = " + obj.x;
 
     }
     function agencytickformatter(val, axis) {
         if (agencylabels[Math.floor(val)]) {
-            return '<p style="margin-top:8em;-webkit-transform:rotate(-90deg);">' + (agencylabels[Math.floor(val)]) + "</b>";
+            return  (agencylabels[Math.floor(val)]) ;
 
         } else {
             return "";
@@ -117,7 +117,7 @@
             $dataValues = Array();
             $i = 0;
             foreach ($rows as $row) {
-                echo "       d2.push([".$i.", $row->value]);" . PHP_EOL;
+                echo "       d2.push([ $row->value,$i]);" . PHP_EOL;
                 echo "       agencylabels.push(['".str_replace("'","",$idtoname[$row->key])."']);" . PHP_EOL;
 
                 $i++;
@@ -131,9 +131,10 @@
         document.getElementById("byagency"),
         [d2],
         {
+            title: "Disclosure Log entries by Agency",
             bars: {
                 show: true,
-                horizontal: false,
+                horizontal: true,
                 shadowSize: 0,
                 barWidth: 0.5
             },
@@ -143,14 +144,14 @@
                 trackFormatter: agencytrackformatter
             },
             yaxis: {
-                min: 0,
-                autoscaleMargin: 1
-            },
-            xaxis: {
                 minorTickFreq: 1,
                 noTicks: agencylabels.length,
                 showMinorLabels: true,
                 tickFormatter: agencytickformatter
+            },
+            xaxis: {
+                min: 0,
+                autoscaleMargin: 1
             },
             legend: {
                 show: false

--- a/documents/template.inc.php
+++ b/documents/template.inc.php
@@ -58,11 +58,11 @@
     <div class="navbar navbar-inverse navbar-fixed-top">
         <div class="navbar-inner">
             <div class="container-fluid">
-                <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
+                <!--<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                     <span class="icon-bar"></span>
                     <span class="icon-bar"></span>
                     <span class="icon-bar"></span>
-                </a>
+                </a>    -->
                 <a class="brand" href="#">Australian Disclosure Logs</a>
 
                 <div class="nav-collapse collapse">
@@ -79,6 +79,7 @@
                         <li><a href="agency.php">By Agency</a></li>
                         <li><a href="date.php">By Date</a></li>
                         <li><a href="disclogsList.php">List of Disclosure Logs</a></li>
+                        <li><a href="charts.php">Charts</a></li>
                         <li><a href="about.php">About</a></li>
 
                     </ul>

--- /dev/null
+++ b/employees-fail.php
@@ -1,1 +1,134 @@
+<?php
+include_once('include/common.inc.php');
+include_header('Charts');
+$db = $server->get_db('disclosr-agencies');
+?>
+<div class="foundation-header">
+    <h1><a href="about.php">Charts</a></h1>
+    <h4 class="subheader">Lorem ipsum.</h4>
+</div>
+<div id="scores" style="width:900px;height:500px;"></div>
+<script id="source">
+    window.onload = function() {
+        $(document).ready(function() {
+            var d1 = [];
+            var scorelabels = [];
+    <?php
+    try {
+        $rows = $db->get_view("app", "scoreHas?group=true", null, true)->rows;
 
+
+        $dataValues = Array();
+        foreach ($rows as $row) {
+            $dataValues[$row->value] = $row->key;
+        }
+        $i = 0;
+        ksort($dataValues);
+        foreach ($dataValues as $value => $key) {
+
+            echo "       d1.push([$i, $value]);" . PHP_EOL;
+            echo "        scorelabels.push('$key');" . PHP_EOL;
+            $i++;
+        }
+    } catch (SetteeRestClientException $e) {
+        setteErrorHandler($e);
+    }
+    ?>
+                function scoretrackformatter(obj) {
+                    if (scorelabels[Math.floor(obj.x)]) {
+                        return (scorelabels[Math.floor(obj.x)])+"="+obj.y;
+                     
+                    } else {
+                        return "";
+                    }
+                }
+                function scoretickformatter(val, axis) {
+                    if (scorelabels[Math.floor(val)]) {
+                        return '<p style="margin-top:8em;-webkit-transform:rotate(-90deg);">'+(scorelabels[Math.floor(val)])+"</b>";
+                     
+                    } else {
+                        return "";
+                    }
+                }
+                Flotr.draw(document.getElementById("scores"), [ {data: d1}], {
+                    HtmlText: true,
+                    bars : {
+                        show : true
+                    },
+                    mouse : {
+                        track : true,
+                        relative : true,
+                        trackFormatter: scoretrackformatter
+                    },yaxis: {
+                        autoscaling: true
+                    },
+                    xaxis: {
+                    autoscaling: true,
+                        minorTickFreq: 0.6,
+                        noTicks : scorelabels.length,
+                        tickFormatter: scoretickformatter
+                    }
+                });
+                
+                
+                
+                
+                
+                
+                
+                
+<div id="employees" style="width:1000px;height:900px;"></div>
+var emplabels = [];
+function emptrackformatter(obj) {
+                   
+                        return (obj.series.label)+" = "+obj.y+" in "+emplabels[Math.floor(obj.x)];
+                     
+                }
+                function emptickformatter(val, axis) {
+                    if (emplabels[Math.floor(val)]) {
+                        return '<p style="margin-top:8em;-webkit-transform:rotate(-90deg);">'+(emplabels[Math.floor(val)])+"</b>";
+                     
+                    } else {
+                        return "";
+                    }
+                }
+function onDataReceived(series) {
+    emplabels = series.labels;
+                       Flotr.draw(document.getElementById("employees"), series.data, {
+                    mouse : {
+                        track : true,
+                        relative : true,
+                    trackFormatter: emptrackformatter
+                    },yaxis: {
+                        max: 10000,
+                        scaling: 'logarithmic'
+                    },
+                    xaxis: {
+                    minorTickFreq: 1,
+                    noTicks: emplabels.length,
+                    showMinorLabels: true,
+                        tickFormatter: emptickformatter
+                    },
+                    legend: {
+                        show: false
+                    }
+                });
+                }
+        
+                $.ajax({
+                    url: "admin/exportEmployees.csv.php?format=json",
+                    method: 'GET',
+                    dataType: 'json',
+                    success: onDataReceived
+                });
+
+    
+            });
+        };
+ 
+</script>
+
+<?php
+include_footer();
+?>
+

--- a/getAgency.php
+++ b/getAgency.php
@@ -2,11 +2,12 @@
 
 include_once('include/common.inc.php');
 
-function displayValue($key, $value, $mode) {
+function displayValue($key, $value, $mode)
+{
     global $db, $schemas;
-    $ignoreKeys = Array("metadata" ,"metaTags", "statistics","rtkURLs","rtkDescriptions");
+    $ignoreKeys = Array("metadata", "metaTags", "statistics", "rtkURLs", "rtkDescriptions");
     if ($mode == "view") {
-        if (strpos($key, "_") === 0 || in_array($key,$ignoreKeys))
+        if (strpos($key, "_") === 0 || in_array($key, $ignoreKeys))
             return;
         echo "<tr>";
 
@@ -22,7 +23,8 @@
                 echo "<li ";
                 if (isset($schemas['agency']["properties"][$key]['x-property'])) {
                     echo ' property="' . $schemas['agency']["properties"][$key]['x-property'] . '" ';
-                } if (isset($schemas['agency']["properties"][$key]['x-itemprop'])) {
+                }
+                if (isset($schemas['agency']["properties"][$key]['x-itemprop'])) {
                     echo ' itemprop="' . $schemas['agency']["properties"][$key]['x-itemprop'] . '" ';
                 }
                 echo " >";
@@ -62,7 +64,7 @@
 					</div>";
         } else {
             if (strpos($key, "_") === 0) {
-                echo"<input type='hidden' id='$key' name='$key' value='$value'/>";
+                echo "<input type='hidden' id='$key' name='$key' value='$value'/>";
             } else if ($key == "parentOrg") {
                 echo "<label for='$key'>$key</label><select  id='$key' name='$key'><option value=''> Select... </option>";
                 $rows = $db->get_view("app", "byDeptStateName")->rows;
@@ -70,7 +72,7 @@
                 foreach ($rows as $row) {
                     echo "<option value='{$row->value}'" . (($row->value == $value) ? "SELECTED" : "") . " >" . str_replace("Department of ", "", $row->key) . "</option>";
                 }
-                echo" </select>";
+                echo " </select>";
             } else {
                 echo "<label>$key</label><input  class='input-text' type='text' id='$key' name='$key' value='$value'/>";
                 if ((strpos($key, "URL") > 0 || $key == 'website') && $value != "") {
@@ -85,7 +87,8 @@
 // 
 }
 
-function addDefaultFields($row) {
+function addDefaultFields($row)
+{
     global $schemas;
     $defaultFields = array_keys($schemas['agency']['properties']);
     foreach ($defaultFields as $defaultField) {
@@ -119,103 +122,103 @@
 // by name = startkey="Ham"&endkey="Ham\ufff0"
 // edit?
 
-    $obj = $db->get($_REQUEST['id']);
-    include_header(isset($obj->name) ? $obj->name : "");
+$obj = $db->get($_REQUEST['id']);
+include_header(isset($obj->name) ? $obj->name : "");
 //print_r($row);
-    if (sizeof($_POST) > 0) {
+if (sizeof($_POST) > 0) {
 //print_r($_POST);
-        foreach ($_POST as $postkey => $postvalue) {
-            if ($postvalue == "") {
+    foreach ($_POST as $postkey => $postvalue) {
+        if ($postvalue == "") {
+            unset($_POST[$postkey]);
+        }
+        if (is_array($postvalue)) {
+            if (count($postvalue) == 1 && $postvalue[0] == "") {
                 unset($_POST[$postkey]);
-            }
-            if (is_array($postvalue)) {
-                if (count($postvalue) == 1 && $postvalue[0] == "") {
-                    unset($_POST[$postkey]);
-                } else {
-                    foreach ($_POST[$postkey] as $key => &$value) {
-                        if ($value == "") {
-                            unset($_POST[$postkey][$key]);
-                        }
+            } else {
+                foreach ($_POST[$postkey] as $key => &$value) {
+                    if ($value == "") {
+                        unset($_POST[$postkey][$key]);
                     }
                 }
             }
         }
-        if (isset($_POST['_id']) && $db->get_rev($_POST['_id']) == $_POST['_rev']) {
-            echo "Edited version was latest version, continue saving";
-            $newdoc = $_POST;
-            $newdoc['metadata']['lastModified'] = time();
-            $obj = $db->save($newdoc);
-        } else {
-            echo "ALERT doc revised by someone else while editing. Document not saved.";
-        }
-    }
-
-    $mode = "view";
-    $rowArray = object_to_array($obj);
-    ksort($rowArray);
-    if ($mode == "edit") {
-        $row = addDefaultFields($rowArray);
+    }
+    if (isset($_POST['_id']) && $db->get_rev($_POST['_id']) == $_POST['_rev']) {
+        echo "Edited version was latest version, continue saving";
+        $newdoc = $_POST;
+        $newdoc['metadata']['lastModified'] = time();
+        $obj = $db->save($newdoc);
     } else {
-        $row = $rowArray;
-    }
-
-    if ($mode == "view") {
-            echo ' <div class="container-fluid">
+        echo "ALERT doc revised by someone else while editing. Document not saved.";
+    }
+}
+
+$mode = "view";
+$rowArray = object_to_array($obj);
+ksort($rowArray);
+if ($mode == "edit") {
+    $row = addDefaultFields($rowArray);
+} else {
+    $row = $rowArray;
+}
+
+if ($mode == "view") {
+    echo ' <div class="container-fluid">
       <div class="row-fluid">
         <div class="span3">
           <div class="well sidebar-nav">
             <ul class="nav nav-list">
               <li class="nav-header">Statistics</li>';
-            
-             if (isset($row['statistics']['employees'])) {
-                echo '<div><i class="icon-user" style="float:left"></i><p style="margin-left:16px;">';
-                $keys = array_keys($row['statistics']['employees']);
-                $lastkey = $keys[count($keys)-1];
-                echo $row['statistics']['employees'][$lastkey]['value'].' employees <small>('.$lastkey.')</small>';
-                echo '</div>';
-            }
-        if (isset($row['statistics']['budget'])) {
-            echo '<div><i class="icon-shopping-cart" style="float:left"></i><p style="margin-left:16px;">';
-            $keys = array_keys($row['statistics']['budget']);
-            $lastkey = $keys[count($keys)-1];
-            echo "$".number_format(floatval($row['statistics']['budget'][$lastkey]['value'])).' <small>('.$lastkey.' budget)</small>';
-            echo '</div>';
-        }
+
+    if (isset($row['statistics']['employees'])) {
+        echo '<div><i class="icon-user" style="float:left"></i><p style="margin-left:16px;">';
+        $keys = array_keys($row['statistics']['employees']);
+        $lastkey = $keys[count($keys) - 1];
+        echo $row['statistics']['employees'][$lastkey]['value'] . ' employees <small>(' . $lastkey . ')</small>';
+        echo '</div>';
+    }
+    if (isset($row['statistics']['budget'])) {
+        echo '<div><i class="icon-shopping-cart" style="float:left"></i><p style="margin-left:16px;">';
+        $keys = array_keys($row['statistics']['budget']);
+        $lastkey = $keys[count($keys) - 1];
+        echo "$" . number_format(floatval($row['statistics']['budget'][$lastkey]['value'])) . ' <small>(' . $lastkey . ' budget)</small>';
+        echo '</div>';
+    }
     echo '  </ul>
           </div><!--/.well -->
         </div><!--/span-->
         <div class="span9">';
-        echo '<div itemscope itemtype="http://schema.org/GovernmentOrganization" typeof="schema:GovernmentOrganization" about="#' . $row['_id'] . '">';
-        echo '<div class="hero-unit">
+    echo '<div itemscope itemtype="http://schema.org/GovernmentOrganization" typeof="schema:GovernmentOrganization" about="#' . $row['_id'] . '">';
+    echo '<div class="hero-unit">
             <h1 itemprop="name">' . $row['name'] . '</h1>';
-            if (isset($row['description'])) {
-                echo '<p>'.$row['description'].'</p>';
-            }
-        echo '</div><table width="100%">';
-        echo "<tr><th>Field Name</th><th>Field Value</th></tr>";
-    }
-    if ($mode == "edit") {
-        ?>
-        <input  id="addfield" type="button" value="Add Field"/>
-        <script>
-            window.onload = function() {
-                $(document).ready(function() {
-                    // put all your jQuery goodness in here.
-                    // http://charlie.griefer.com/blog/2009/09/17/jquery-dynamically-adding-form-elements/
-                    $('#addfield').click(function() {
-                        var field_name=window.prompt("fieldname?","");
-                        if (field_name !="") {
-                            $('#submitbutton').before($('<span></span>')
-                            .append("<label>"+field_name+"</label>")
-                            .append("<input  class='input-text' type='text' id='"+field_name+"' name='"+field_name+"'/>")
-                        );
-                        }
-                    });
-                });
-            };
-        </script>
-        <form id="editform" class="nice" method="post">
-        <?php
+    if (isset($row['description'])) {
+        echo '<p>' . $row['description'] . '</p>';
+    }
+    echo '</div><table width="100%">';
+    echo "<tr><th>Field Name</th><th>Field Value</th></tr>";
+}
+if ($mode == "edit") {
+?>
+<input id="addfield" type="button" value="Add Field"/>
+<script>
+    window.onload = function () {
+        $(document).ready(function () {
+            // put all your jQuery goodness in here.
+            // http://charlie.griefer.com/blog/2009/09/17/jquery-dynamically-adding-form-elements/
+            $('#addfield').click(function () {
+                var field_name = window.prompt("fieldname?", "");
+                if (field_name != "") {
+                    $('#submitbutton').before($('<span></span>')
+                        .append("<label>" + field_name + "</label>")
+                        .append("<input  class='input-text' type='text' id='" + field_name + "' name='" + field_name + "'/>")
+                    );
+                }
+            });
+        });
+    };
+</script>
+<form id="editform" class="nice" method="post">
+    <?php
 
     }
     foreach ($row as $key => $value) {
@@ -223,7 +226,7 @@
     }
     if ($mode == "view") {
         echo "</table></div>";
-              echo '         </div><!--/span-->
+        echo '         </div><!--/span-->
           </div><!--/row-->
         </div><!--/span-->
       </div><!--/row-->';
@@ -231,16 +234,16 @@
     if ($mode == "edit") {
         echo '<input id="submitbutton" type="submit"/></form>';
     }
-} else {
+    } else {
 // show all list
-    include_header('Agencies');
-    echo ' <div class="container-fluid">
+        include_header('Agencies');
+        echo ' <div class="container-fluid">
       <div class="row-fluid">
         <div class="span3">
           <div class="well sidebar-nav">
             <ul class="nav nav-list">
               <li class="nav-header">Sidebar</li>';
-    echo '  </ul>
+        echo '  </ul>
           </div><!--/.well -->
         </div><!--/span-->
         <div class="span9">
@@ -251,28 +254,28 @@
           </div>
           <div class="row-fluid">
             <div class="span4">';
-    try {
-        $rows = $db->get_view("app", "byCanonicalName")->rows;
-        //print_r($rows);
-        $rowCount = count($rows);
-        foreach ($rows as $i => $row) {
-            if ($i % ($rowCount/3) == 0 && $i != 0 && $i != $rowCount -2 ) echo '</div><div class="span4">';
-            //   print_r($row);
-            echo '<span itemscope itemtype="http://schema.org/GovernmentOrganization" typeof="schema:GovernmentOrganization foaf:Organization" about="getAgency.php?id=' . $row->value->_id . '">
+        try {
+            $rows = $db->get_view("app", "byCanonicalName")->rows;
+            //print_r($rows);
+            $rowCount = count($rows);
+            foreach ($rows as $i => $row) {
+                if ($i % ($rowCount / 3) == 0 && $i != 0 && $i != $rowCount - 2) echo '</div><div class="span4">';
+                //   print_r($row);
+                echo '<span itemscope itemtype="http://schema.org/GovernmentOrganization" typeof="schema:GovernmentOrganization foaf:Organization" about="getAgency.php?id=' . $row->value->_id . '">
 <a href="getAgency.php?id=' . $row->value->_id . '" rel="schema:url foaf:page" property="schema:name foaf:name" itemprop="url"><span itemprop="name">' .
-            (isset($row->value->name) ? $row->value->name : "ERROR NAME MISSING") 
-            . '</span></a></span><br><br>';
-        }
-      
-    } catch (SetteeRestClientException $e) {
-        setteErrorHandler($e);
-    }
-      echo '         </div><!--/span-->
+                    (isset($row->value->name) ? $row->value->name : "ERROR NAME MISSING")
+                    . '</span></a></span><br><br>';
+            }
+
+        } catch (SetteeRestClientException $e) {
+            setteErrorHandler($e);
+        }
+        echo '         </div><!--/span-->
           </div><!--/row-->
         </div><!--/span-->
       </div><!--/row-->';
-}
-
-include_footer();
-?>
-
+    }
+
+    include_footer();
+    ?>
+

--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -19,7 +19,7 @@
 
 Requests::register_autoloader();
 $ENV = "DEV";
-if (isset($_SERVER['SERVER_NAME']) && $_SERVER['SERVER_NAME'] != 'localhost') {
+if (false && isset($_SERVER['SERVER_NAME']) && $_SERVER['SERVER_NAME'] != 'localhost') {
 
     require $basePath."lib/amon-php/amon.php";
     Amon::config(array('address'=> 'http://127.0.0.1:2464', 

--- a/include/couchdb.inc.php
+++ b/include/couchdb.inc.php
@@ -14,8 +14,8 @@
     } else
         if (php_uname('n') == "ikurt-20") {
 
-            $serverAddr = 'http://192.168.1.113:5984/';
-            //$serverAddr = 'http://127.0.0.1:5984/';
+            //$serverAddr = 'http://192.168.1.113:5984/';
+            $serverAddr = 'http://127.0.0.1:5984/';
         } else {
             $serverAddr = 'http://127.0.0.1:5984/';
         }

--- a/include/template.inc.php
+++ b/include/template.inc.php
@@ -28,6 +28,9 @@
                 .sidebar-nav {
                     padding: 9px 0;
                 }
+                .flotr-dummy-div {
+                    margin-left: -999px;
+                }
             </style>
             <link href="<?php echo $basePath ?>css/bootstrap-responsive.min.css" rel="stylesheet">
             <!--[if lt IE 9]>
@@ -54,6 +57,7 @@
                         <div class="nav-collapse collapse">
                             <ul class="nav">
                                 <li><a href="getAgency.php">Agencies</a></li>