Fix autosuggest
--- a/about.php
+++ b/about.php
@@ -1,6 +1,55 @@
+<?php
+
+
+include('./lib/common.inc.php');
+include_header("Map");
+?>
+
+<div class="msg_list">
+<p class="msg_head">Header-1 </p>
+<div class="msg_body">
+orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
+</div>
+<p class="msg_head">Header-2</p>
+<div class="msg_body">
+orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
+</div>
+<p class="msg_head">Header-3</p>
+<div class="msg_body">
+orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit
+</div>
+</div>
+
sourced from austender
Government Agency Information (2009-07-10): National Archives of Australia, http://www.naa.gov.au under Creative Commons - Attribution 2.5 Australia (CC-BY)
jpgraph for php
ABR
Redhat Liberation fonts
-
+
+
+<?php
+include_once("./lib/common.inc.php");
+$query = "SELECT DATE(importDate) as importday, count(*) as count, min(publishDate) as start, max(publishDate) as end
+FROM `contractnotice` WHERE childCN = 0 AND parentCN = 0 AND DATE(importDate) in (select * from (SELECT DATE(importDate)
+FROM `contractnotice` ORDER BY `importDate` DESC limit 1) alias)";
+$result = mysql_query($query);
+echo "<div>";
+$stats = mysql_fetch_array($result, MYSQL_BOTH);
+echo $stats["count"] . " new records in period " . $stats["start"] . " to " . $stats["end"] ."<br>";
+
+
+$query = "SELECT DATE(importDate) as importday, count(*) as count, min(publishDate) as start, max(publishDate) as end
+FROM `contractnotice` WHERE (childCN != 0 OR parentCN != 0) AND DATE(importDate) in (select * from (SELECT DATE(importDate)
+FROM `contractnotice` ORDER BY `importDate` DESC limit 1) alias)";
+$result = mysql_query($query);
+echo "<div>";
+$stats = mysql_fetch_array($result, MYSQL_BOTH);
+echo $stats["count"] . " updated records in period " . $stats["start"] . " to " . $stats["end"] ."<br>";
+
+
+echo "Last updated: ". $stats["importday"]."<br>";
+/* Check for null Procurement method and 0 ABN when not ABN exempt */
+
+
+include_footer();
+?>
--- a/admin/updateUNSPSC.php
+++ b/admin/updateUNSPSC.php
@@ -1,11 +1,7 @@
<?php
error_reporting(E_ALL);
-$link = mysql_connect('localhost', 'team7', 'wlUsnD2xu9');
-if (!$link) {
- die('Could not connect: ' . mysql_error());
-}
-@mysql_select_db("team7") or die("Unable to select database");
+include_once("../lib/common.inc.php");
$unspscresult = mysql_query ("select * from UNSPSCcategories;");
while ($row = mysql_fetch_assoc($unspscresult)) {
--- a/displayAgency.php
+++ b/displayAgency.php
@@ -23,7 +23,9 @@
Histograph, overlaying number value reported per week over X years
Compliance statistics: amendments, delay in reporting average and number completely late*/
} else {
-
+ /*
+ split by portfolio
+ */
include_header("Agencies");
$query = "SELECT SUM(value), agencyName
FROM `contractnotice`
--- a/displayCalendar.php
+++ b/displayCalendar.php
@@ -1,9 +1,12 @@
<?php
include_once("./lib/common.inc.php");
-
+/*
+ split by year
+ */
/*
todo:
-Year/Month drilldown - largest contracts, agencies, suppliers*/
+Year/Month drilldown - largest contracts, agencies, suppliers
+big picture graphs?*/
include_header("Months and Years");
--- a/displayCategory.php
+++ b/displayCategory.php
@@ -24,7 +24,9 @@
echo "</table>";
mysql_free_result($result);
} else {
-
+ /*
+ split by main categories
+ */
include_header("Categories");
$query = "SELECT sum(value), category
FROM `contractnotice`
--- a/lib/common.inc.php
+++ b/lib/common.inc.php
@@ -6,6 +6,8 @@
require_once ('jpgraph/jpgraph_pie.php');
require_once ('jpgraph/jpgraph_bar.php');
require_once ('jpgraph/jpgraph_date.php');
+
+error_reporting(E_ALL ^ E_NOTICE);
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
@@ -54,8 +56,24 @@
<title>Contract Dashboard - <?=$title?></title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.0r4/build/reset-fonts-grids/reset-fonts-grids.css">
<link type="text/css" rel="stylesheet" href="style.css">
+ <script type="text/javascript" src="lib/bsn.AutoSuggest_2.1.3_comp.js" charset="utf-8"></script>
+
+<link rel="stylesheet" href="autosuggest_inquisitor.css" type="text/css" media="screen" charset="utf-8" />
+ <script type="text/javascript" src="lib/jquery.js"></script>
+<script type="text/javascript">
+$(document).ready(function()
+{
+ //hide the all of the element with class msg_body
+ $(".msg_body").hide();
+ //toggle the componenet with class msg_body
+ $(".msg_head").click(function()
+ {
+ $(this).next(".msg_body").slideToggle(600);
+ });
+});
+</script>
</head>
-<body><div id="doc3" class="yui-t4"/>
+<body><div id="doc3" class="yui-t4">
<div id="hd">
<h1> contract dashboard</h1>
</div>
@@ -69,7 +87,21 @@
<a href="displayConfidentialities.php">contractual confidentiality</a>
<a href="displayConsultancies.php">consultancies</a>
<a href="displayMap.php">postcodes</a>
- <div id="search"> search <form><input type="text" id="searchKeywords"/></form></div>
+ <div id="search"><form method="post" action="search.php" class="asholder">
+ <label for="searchKeyword">search</label>
+ <input type="text" id="searchKeyword" name="searchKeyword" value="" style="width:150px" />
+ <input type="hidden" id="searchID" name="searchID" value=""/><input type="submit" value="submit" />
+</form></div>
+ <script type="text/javascript">
+
+ var options_xml = {
+ script: function (input) { return "search_autosuggest.php?input="+input; },
+ varname:"input",
+ callback: function (obj) { document.getElementById('searchID').value = obj.id; }
+ };
+ var as_xml = new bsn.AutoSuggest('searchKeyword', options_xml);
+</script>
+
</div>
<div id="bd" role="main">
<div id="yui-main">
--- a/lib/jquery.js
+++ b/lib/jquery.js
--- a/search.php
+++ b/search.php
@@ -1,8 +1,31 @@
-search ABNs
+<?php
+/*
+ search ABNs
search agency name
search categories
search supplier names
--search supplier postcodes/suburbs/cities--
search CN number
search description full text
+*/
+include('./lib/common.inc.php');
+if ($_REQUEST['searchID']) {
+$searchIDParts = explode("-",$_REQUEST['searchID']);
+$type = array_shift($searchIDParts);
+$host = $_SERVER['HTTP_HOST'];
+$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
+
+if ($type == "agency") {
+header("Location: http://$host$uri/displayAgency.php?agency=".implode("-",$searchIDParts));
+}
+if ($type == "supplier") {
+header("Location: http://$host$uri/displaySupplier.php?supplier=".implode("-",$searchIDParts));
+}
+exit;
+} else {
+include_header("Search Results");
+print_r($_REQUEST);
+include_footer();
+}
+?>
--- a/search_autosuggest.php
+++ b/search_autosuggest.php
@@ -6,7 +6,7 @@
$aResults = array();
$count = 0;
if ($len) {
- $query = "SELECT supplierName as info, supplierABN as id, supplierName as value, count(*) as count
+ $query = "SELECT supplierName, supplierABN, supplierName, count(*) as count
FROM `contractnotice`
WHERE supplierName LIKE '$input%'
GROUP BY supplierName
@@ -17,12 +17,12 @@
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
$count++;
$aResults[] = array(
- "id" => "supplier-".$row['id'],
- "value" => htmlspecialchars($row['value']) ,
+ "id" => "supplier-".$row['supplierABN'].'-'.$row['supplierName'],
+ "value" => htmlspecialchars($row['supplierName']) ,
"info" => htmlspecialchars("Supplier - ". $row['count']." records")
);
}
- $query = "SELECT agencyName as info, agencyName as id, agencyName as value, count(*) as count
+ $query = "SELECT agencyName, count(*) as count
FROM `contractnotice`
WHERE agencyName LIKE '$input%'
GROUP BY agencyName
@@ -32,8 +32,8 @@
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
$count++;
$aResults[] = array(
- "id" => "agency-".$row['id'],
- "value" => htmlspecialchars($row['value']) ,
+ "id" => "agency-".$row['agencyName'],
+ "value" => htmlspecialchars($row['agencyName']) ,
"info" => htmlspecialchars("Government Agency - ". $row['count']." records")
);
}
--- a/style.css
+++ b/style.css
@@ -11,17 +11,22 @@
}
#search, form {
-display: inline;
float: right;
margin-top: -1px;
}
#sitenav {
+
width: 99%;
text-align: left;
padding: 5px;
border-top:1px solid black;
border-bottom:1px solid black;
+}
+
+#sitenav.a {
+
+display: inline;
}
#content {
@@ -40,3 +45,25 @@
#ft {
font-size: 66%;
}
+
+// div collapse from http://roshanbh.com.np/2008/03/expandable-collapsible-toggle-pane-jquery.html
+p {
+padding: 0 0 1em;
+}
+.msg_list {
+margin: 0px;
+padding: 0px;
+width: 383px;
+}
+.msg_head {
+padding: 5px 10px;
+cursor: pointer;
+position: relative;
+background-color:#FFCCCC;
+margin:1px;
+}
+.msg_body {
+padding: 5px 10px 15px;
+background-color:#F4F4F8;
+}
+// div collapse