add RTK import
add RTK import


Former-commit-id: a6b6a0a350cf467915ec023c9e41421df3fcb83d

[submodule "couchdb/couchdb-lucene"] [submodule "couchdb/couchdb-lucene"]
path = couchdb/couchdb-lucene path = couchdb/couchdb-lucene
url = https://github.com/rnewson/couchdb-lucene.git url = https://github.com/rnewson/couchdb-lucene.git
[submodule "couchdb/settee"] [submodule "couchdb/settee"]
path = couchdb/settee path = couchdb/settee
url = https://github.com/inadarei/settee.git url = https://github.com/inadarei/settee.git
[submodule "lib/php-diff"] [submodule "lib/php-diff"]
path = lib/php-diff path = lib/php-diff
url = https://github.com/chrisboulton/php-diff.git url = https://github.com/chrisboulton/php-diff.git
[submodule "lib/Requests"] [submodule "lib/Requests"]
path = lib/Requests path = lib/Requests
url = https://github.com/rmccue/Requests.git url = https://github.com/rmccue/Requests.git
[submodule "javascripts/flotr2"] [submodule "js/flotr2"]
path = javascripts/flotr2 path = js/flotr2
url = https://github.com/HumbleSoftware/Flotr2.git url = https://github.com/HumbleSoftware/Flotr2.git
[submodule "lib/phpquery"] [submodule "lib/phpquery"]
path = lib/phpquery path = lib/phpquery
url = https://github.com/TobiaszCudnik/phpquery.git url = https://github.com/TobiaszCudnik/phpquery.git
[submodule "javascripts/sigma"] [submodule "js/sigma"]
path = javascripts/sigma path = js/sigma
url = https://github.com/jacomyal/sigma.js.git url = https://github.com/jacomyal/sigma.js.git
[submodule "javascripts/bubbletree"] [submodule "js/bubbletree"]
path = javascripts/bubbletree path = js/bubbletree
url = https://github.com/okfn/bubbletree.git url = https://github.com/okfn/bubbletree.git
  [submodule "lib/querypath"]
  path = lib/querypath
  url = https://github.com/technosophos/querypath.git
   
file:b/admin/agls.php (new)
  <?php
 
  include_once('include/common.inc.php');
  include_header('Webserver and Accessiblity');
 
  echo "<table>
  <tr><th>name</th><th>function</th></tr>";
  $db = $server->get_db('disclosr-agencies');
  try {
  $agencies = $db->get_view("app", "byCanonicalName", null, true)->rows;
 
 
  if ($agencies) {
  foreach ($agencies as $row) {
 
  echo "<tr><td>" . $row->value->name . "</td>";
  if (isset($row->value->metaTags)) {
  if (is_array($row->value->metaTags)) {
  $tags =$row->value->metaTags;
  } else {
  $tags = object_to_array($row->value->metaTags);
  }
  if (isset($tags['AGLS.Function'])) {
  echo "<td>" . $tags['AGLS.Function'] . "</td>";
  }
  }
  echo "</tr>";
  }
  }
  } catch (SetteeRestClientException $e) {
  setteErrorHandler($e);
  }
  include_footer();
  ?>
 
<?php <?php
   
include_once('../include/common.inc.php'); include_once('../include/common.inc.php');
include_header(); include_header('Fix Conflicts');
require_once '../lib/php-diff/lib/Diff.php'; require_once '../lib/php-diff/lib/Diff.php';
require_once '../lib/php-diff/lib/Diff/Renderer/Html/SideBySide.php'; require_once '../lib/php-diff/lib/Diff/Renderer/Html/SideBySide.php';
   
$db = $server->get_db('disclosr-agencies'); $db = $server->get_db('disclosr-agencies');
   
try { try {
$rows = $db->get_view("app", "getConflicts", null, true)->rows; $rows = $db->get_view("app", "getConflicts", null, true)->rows;
//print_r($rows); //print_r($rows);
foreach ($rows as $row) { foreach ($rows as $row) {
echo "<h2>".$row->id."</h2>"; echo "<h2>".$row->id."</h2>";
$request = Requests::get($serverAddr."disclosr-agencies/".$row->id); $request = Requests::get($serverAddr."disclosr-agencies/".$row->id);
$origSort = object_to_array(json_decode($request->body)); $origSort = object_to_array(json_decode($request->body));
ksort($origSort); ksort($origSort);
$origDoc = explode(",",json_encode($origSort)); $origDoc = explode(",",json_encode($origSort));
foreach($row->value as $conflictRev) { foreach($row->value as $conflictRev) {
$conflictURL = $serverAddr."disclosr-agencies/".$row->id."?rev=".$conflictRev; $conflictURL = $serverAddr."disclosr-agencies/".$row->id."?rev=".$conflictRev;
$request = Requests::get($conflictURL); $request = Requests::get($conflictURL);
$conflictSort = object_to_array(json_decode($request->body)); $conflictSort = object_to_array(json_decode($request->body));
ksort($conflictSort); ksort($conflictSort);
$conflictDoc = explode(",",json_encode($conflictSort)); $conflictDoc = explode(",",json_encode($conflictSort));
echo "curl -X DELETE ".$conflictURL."<br>".PHP_EOL; echo "curl -X DELETE ".$conflictURL."<br>".PHP_EOL;
// Options for generating the diff // Options for generating the diff
$options = array( $options = array(
//'ignoreWhitespace' => true, //'ignoreWhitespace' => true,
//'ignoreCase' => true, //'ignoreCase' => true,
); );
   
// Initialize the diff class // Initialize the diff class
$diff = new Diff($conflictDoc, $origDoc, $options); $diff = new Diff($conflictDoc, $origDoc, $options);
   
// Generate a side by side diff // Generate a side by side diff
$renderer = new Diff_Renderer_Html_SideBySide; $renderer = new Diff_Renderer_Html_SideBySide;
echo $diff->Render($renderer); echo $diff->Render($renderer);
} }
die(); die();
} }
} catch (SetteeRestClientException $e) { } catch (SetteeRestClientException $e) {
setteErrorHandler($e); setteErrorHandler($e);
} }
   
include_footer(); include_footer();
?> ?>
   
  <?php
 
  include_once("../include/common.inc.php");
  require($basePath . 'lib/phpquery/phpQuery/phpQuery.php');
 
  setlocale(LC_CTYPE, 'C');
 
 
  $db = $server->get_db('disclosr-agencies');
 
  try {
  $agencies = $db->get_view("app", "byCanonicalName", null, true)->rows;
  //print_r($rows);
  foreach ($agencies as $agency) {
  //echo $agency->value->name . " ".$agency->value->website."<br />\n";
  // print_r($agency);
  //hasRestricitiveLicence" hasRestrictiveLicense -> has Restrictive Licence
  // "hasYoutube" -> Tube
  // "comment" -> "comments"
  if (!isset($agency->value->metaTags) && isset($agency->value->website)) {
  echo $agency->value->name . " ".$agency->value->website."<br />\n";
  $agency->value->metaTags = Array();
  $request = Requests::get($agency->value->website);
  $html = phpQuery::newDocumentHTML($request->body);
  phpQuery::selectDocument($html);
  foreach (pq('meta')->elements as $meta) {
  $tagName = $meta->getAttribute('name');;
  $content = $meta->getAttribute('content');
  if ($tagName != "") {
  echo "$tagName == $content <br>\n";
  $agency->value->metaTags[$tagName] = $content;
  }
  }
  //print_r($agency->value->metaTags);
  $db->save($agency->value);
  echo "<hr>";
  flush();
  }
  }
  } catch (SetteeRestClientException $e) {
  setteErrorHandler($e);
  }
  ?>
 
  <?php
 
  require_once '../include/common.inc.php';
 
  $db = $server->get_db('disclosr-agencies');
  $rows = $db->get_view("app", "byName")->rows;
  $nametoid = Array();
  $accounts = Array();
  foreach ($rows as $row) {
  $nametoid[trim($row->key)] = $row->value;
  }
 
  function extractCSVAccounts($url, $nameField, $accountField, $filter) {
  global $accounts, $nametoid;
  $request = Requests::get($url);
  echo $url;
  $Data = str_getcsv($request->body, "\n"); //parse the rows
  $headers = Array();
  foreach ($Data as $num => $line) {
  $Row = str_getcsv($line, ",");
  if ($num == 0) {
  $headers = $Row;
  print_r($headers);
  } else {
  if (isset($Row[array_search($nameField, $headers)])) {
  $agencyName = $Row[array_search($nameField, $headers)];
  if (!in_array(trim($agencyName), array_keys($nametoid))) {
  echo "$agencyName missing" . PHP_EOL;
  } else {
  echo $Row[array_search($nameField, $headers)] . PHP_EOL;
  $accounts[$nametoid[trim($agencyName)]]["rtkURLs"][$agencyName] = 'http://www.righttoknow.org.au/body/'.$Row[array_search($accountField, $headers)];
  }
  } else {
  echo "error finding any agency" . $line . PHP_EOL;
  }
  }
  }
  }
 
  extractCSVAccounts("http://www.righttoknow.org.au/body/all-authorities.csv","Agency","URL name");
  print_r($accounts);
  /* foreach ($accounts as $id => $accountTypes) {
  echo $id . "<br>" . PHP_EOL;
  $doc = object_to_array($db->get($id));
  // print_r($doc);
 
  foreach ($accountTypes as $accountType => $accounts) {
  if (!isset($doc["has" . $accountType]) || !is_array($doc["has" . $accountType])) {
  $doc["has" . $accountType] = Array();
  }
  $doc["has" . $accountType] = array_unique(array_merge($doc["has" . $accountType], $accounts));
  }
  $db->save($doc);
  }*/
  ?>
 
   
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"> "http://www.w3.org/TR/html4/loose.dtd">
<html> <html>
<head> <head>
<title>Demo of the tree layout in D3.js</title> <title>Demo of the tree layout in D3.js</title>
<!-- source: http://blog.pixelingene.com/demos/d3_tree/ <!-- source: http://blog.pixelingene.com/demos/d3_tree/
http://javadude.wordpress.com/2012/06/20/d3-js-from-tree-to-cluster-and-radial-projection/ http://javadude.wordpress.com/2012/06/20/d3-js-from-tree-to-cluster-and-radial-projection/
http://bl.ocks.org/1249394--> http://bl.ocks.org/1249394-->
<style> <style>
g.node { g.node {
font-family: Verdana, Helvetica; font-family: Verdana, Helvetica;
font-size: 12px; font-size: 12px;
font-weight: bold; font-weight: bold;
} }
circle.node-dot { circle.node-dot {
fill: lightsalmon; fill: lightsalmon;
stroke: red; stroke: red;
stroke-width: 1px; stroke-width: 1px;
} }
   
path.link { path.link {
fill: none; fill: none;
stroke: gray; stroke: gray;
} }
</style> </style>
</head> </head>
<body> <body>
   
<div id="tree-container"></div> <div id="tree-container"></div>
<div id="viz"></div> <div id="viz"></div>
   
<script type="text/javascript" src="../javascripts/jquery-1.6.2.min.js"></script> <script type="text/javascript" src="../js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../javascripts/d3.min.js"></script> <script type="text/javascript" src="../js/d3.min.js"></script>
<script type="text/javascript" src="../javascripts/d3.layout.min.js"></script> <script type="text/javascript" src="../js/d3.layout.min.js"></script>
   
<script> <script>
/** /**
* Created by JetBrains RubyMine. * Created by JetBrains RubyMine.
* User: pavanpodila * User: pavanpodila
* Date: 7/17/11 * Date: 7/17/11
* Time: 4:30 PM * Time: 4:30 PM
* To change this template use File | Settings | File Templates. * To change this template use File | Settings | File Templates.
*/ */
   
var treeData = var treeData =
<?php <?php
// $json = file_get_children('naa-agift.json'); // $json = file_get_children('naa-agift.json');
// $raw = json_decode($json); // $raw = json_decode($json);
// echo $json; // echo $json;
// print_r($raw); // print_r($raw);
$raw = json_decode('[ $raw = json_decode('[
"Home", "Home",
"index.htm", "index.htm",
[ [
"BUSINESS SUPPORT AND REGULATION", "BUSINESS SUPPORT AND REGULATION",
"000411.htm", "000411.htm",
[ [
"Association registration", "Association registration",
"000396.htm" "000396.htm"
], ],
[ [
"Business process auditing", "Business process auditing",
"000413.htm" "000413.htm"
], ],
[ [
"Business registration and licensing", "Business registration and licensing",
"000414.htm" "000414.htm"
], ],
[ [
"Business sponsorship", "Business sponsorship",
"001371.htm" "001371.htm"
], ],
[ [
"Consumer protection", "Consumer protection",
"000439.htm" "000439.htm"
], ],
[ [
"Fair trading compliance", "Fair trading compliance",
"000482.htm", "000482.htm",
[ [
"Prices surveillance", "Prices surveillance",
"000533.htm" "000533.htm"
], ],
[ [
"Product safety", "Product safety",
"000534.htm" "000534.htm"
], ],
[ [
"Trade practices compliance", "Trade practices compliance",
"000583.htm" "000583.htm"
] ]
], ],
[ [
"Financial institutions regulation", "Financial institutions regulation",
"000485.htm" "000485.htm"
], ],
[ [
"Government procurement regulation", "Government procurement regulation",
"000491.htm" "000491.htm"
], ],
[ [
"Industry assistance schemes", "Industry assistance schemes",
"000499.htm" "000499.htm"
], ],
[ [
"Industry development", "Industry development",
"000500.htm" "000500.htm"
], ],
[ [
"Insurance regulation", "Insurance regulation",
"000501.htm", "000501.htm",
[ [
"General insurance", "General insurance",
"000489.htm" "000489.htm"
], ],
[ [
"Life insurance", "Life insurance",
"000505.htm" "000505.htm"
] ]
], ],
[ [
"Professional accreditation", "Professional accreditation",
"000535.htm" "000535.htm"
], ],
[ [
"Small business services", "Small business services",
"000565.htm", "000565.htm",
[ [
"Small business advocacy", "Small business advocacy",