From: Maxious Date: Tue, 20 Mar 2012 23:34:42 +0000 Subject: Add extra blank fields X-Git-Url: https://maxious.lambdacomplex.org/git/?p=disclosr.git&a=commitdiff&h=643eb40aa780444e54a30c26a98071ac0646605e --- Add extra blank fields Former-commit-id: a6c55876b5cd8b26bbb91de39e18f73ad1a36a86 --- --- a/getAgency.php +++ b/getAgency.php @@ -86,9 +86,14 @@ } else if ($schemas['agency']['properties'][$defaultField]['type'] == "array") { if (is_array($row[$defaultField])) { $row[$defaultField][] = ""; + $row[$defaultField][] = ""; + $row[$defaultField][] = ""; } else { $value = $row[$defaultField]; $row[$defaultField] = Array($value); + $row[$defaultField][] = ""; + $row[$defaultField][] = ""; + } } } @@ -102,7 +107,7 @@ // by name = startkey="Ham"&endkey="Ham\ufff0" // edit? - $row = $db->get($_REQUEST['id']); + $obj = $db->get($_REQUEST['id']); //print_r($row); if (sizeof($_POST) > 0) { //print_r($_POST); @@ -126,17 +131,19 @@ echo "Edited version was latest version, continue saving"; $newdoc = $_POST; $newdoc['metadata']['lastModified'] = time(); - $row = $db->save($newdoc); + $obj = $db->save($newdoc); } else { echo "ALERT doc revised by someone else while editing. Document not saved."; } } $mode = "edit"; + $rowArray = object_to_array($obj); +ksort($rowArray); if ($mode == "edit") { - $row = addDefaultFields(object_to_array($row)); + $row = addDefaultFields($rowArray); } else { - $row = object_to_array($row); + $row = $rowArray; } if ($mode == "view") { @@ -188,14 +195,14 @@ (isset($row->value->name) && $row->value->name != "" ? $row->value->name : "NO NAME " . $row->value->abn) . ''; } */ - $rows = $db->get_view("app", "byName")->rows; + $rows = $db->get_view("app", "byCanonicalName")->rows; //print_r($rows); echo '"; --- a/schemas/agency.json.php +++ b/schemas/agency.json.php @@ -17,6 +17,7 @@ "parentOrg" => Array("type" => "string", "required" => true, "x-title" => "Parent Organisation", "description" => "Parent organisation, usually a department of state"), "website" => Array("type" => "string", "required" => true, "x-title" => "Website", "x-property" => "schema:url foaf:homepage", "description" => "Website URL"), "abn" => Array("type" => "string", "required" => true, "x-title" => "Australian Business Number", "description" => "ABN from business register"), + "employees" => Array("type" => "string", "required" => true, "x-title" => "2010-2011 employees", "description" => "2010-2011 employees"), "contractListURL" => Array("type" => "string", "required" => true, "x-title" => "Contract Listing", "description" => "Departmental and agency contracts, mandated by the Senate" ), "budgetURL" => Array("type" => "string", "required" => true,"x-title" => "Budget", "description" => "Portfolio Budget Statements and Portfolio Additional Estimates Statements"), "grantsReportingURL" => Array("type" => "string", "required" => true, "x-title" => "Grants Awarded", @@ -49,6 +50,8 @@ "items" => Array("type" => "string")), "hasRestrictiveLicence" => Array("type" => "array","required" => true, "x-title" => "Has Restrictive Licence", "description" => "Has any page licenced under terms more restrictive than Crown Copyright", "items" => Array("type" => "string")), + "hasPermissiveLicence" => Array("type" => "array","required" => true, "x-title" => "Has Permissive Licence", "description" => "Has any page licenced under terms more permissive than Crown Copyright but not clear CCBY", + "items" => Array("type" => "string")), "hasCrownCopyright" => Array("type" => "array", "required" => true, "x-title" => "Has Standard Crown Copyright licence", "description" => "Has any page still licenced under the former Commonwealth Copyright Administration", "items" => Array("type" => "string")), ),