fix sitemap
fix sitemap


Former-commit-id: ddc69719d5b15a16ac0ec2110cd9fdd9fb44cc0e

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:b/admin/logo.ai (new)
--- /dev/null
+++ b/admin/logo.ai
@@ -1,1 +1,206 @@

+1 0 obj
<</Metadata 2 0 R/OCProperties<</D<</ON[5 0 R 6 0 R]/Order 7 0 R/RBGroups[]>>/OCGs[5 0 R 6 0 R]>>/Pages 3 0 R/Type/Catalog>>
endobj
2 0 obj
<</Length 21938/Subtype/XML/Type/Metadata>>stream

+<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
+<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.0-c060 61.134777, 2010/02/12-17:32:00        ">
+   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+      <rdf:Description rdf:about=""
+            xmlns:xmp="http://ns.adobe.com/xap/1.0/"
+            xmlns:xmpGImg="http://ns.adobe.com/xap/1.0/g/img/">
+         <xmp:CreatorTool>Adobe Illustrator CS5</xmp:CreatorTool>
+         <xmp:CreateDate>2013-06-22T15:58:27+10:00</xmp:CreateDate>
+         <xmp:ModifyDate>2013-06-22T15:58:27+10:00</xmp:ModifyDate>
+         <xmp:MetadataDate>2013-06-22T15:58:27+10:00</xmp:MetadataDate>
+         <xmp:Thumbnails>
+            <rdf:Alt>
+               <rdf:li rdf:parseType="Resource">
+                  <xmpGImg:width>256</xmpGImg:width>
+                  <xmpGImg:height>196</xmpGImg:height>
+                  <xmpGImg:format>JPEG</xmpGImg:format>
+                  <xmpGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA&#xA;AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK&#xA;DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f&#xA;Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgAxAEAAwER&#xA;AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA&#xA;AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB&#xA;UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE&#xA;1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ&#xA;qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy&#xA;obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp&#xA;0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo&#xA;+DlJWWl5iZmpucnZ6fkqOkpaanqKm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zWSgYmi+iafU480eLHISCW5FvRel6TqmrXsdj&#xA;plrLeXkpokECF2PvQdh3PbDGJJoNWXNDHHimRGPm+nvyW/JL/Cjrr2vcJdfdCLe3WjJaqwIb4hs0&#xA;jA0JGw3Ar1zZafT8O55vAdudu/mP3eP+76n+d+x6/mW8y7FXYq7FWpI0kRo5FDI4KspFQQdiDiVY&#xA;Mv5fH9PkE/7iB+9Br8XX+68fp8PfMP8ALer+i5Pj+nzZyiIiKiKFRQFVRsABsABmY4zeKuxV2Kux&#xA;V2KuxVDal+jfqUv6T9H6jT9/9Z4elx/y+fw0+eA1W7Zi4+IcF8XlzeW3/wD0LV9af1/0J6tfi9Cn&#xA;Cvt6PwfdmMfB8noMf8q1t4lef7d2WeSf+VWV/wCdP/RXrcfi+pej9Y4/5dP3v/BZbj4P4addr/zn&#xA;+X46/pXX6mX5a6x2KuxV2KuxV2KuxV2KuxV2KuxV2KpV5k/wt+jj/iX6l+jq7/pH0vRrT/i74a0y&#xA;M+GvU5Ol8bi/dcXF/Ru/seaP/wBCy+q1f0Py5GvHlxrXtT4afLbMb9z5O+H8rV/lHoflL/BP1E/4&#xA;T/R31Pbn+jfR417c/S/a/wBbfMiHDXpp0ms/McX77j4v6V/pT3JuG7FXYq7FXYq7FXYq7FXYq//Z</xmpGImg:image>
+               </rdf:li>
+            </rdf:Alt>
+         </xmp:Thumbnails>
+      </rdf:Description>
+      <rdf:Description rdf:about=""
+            xmlns:xmpTPg="http://ns.adobe.com/xap/1.0/t/pg/"
+            xmlns:stDim="http://ns.adobe.com/xap/1.0/sType/Dimensions#"
+            xmlns:xmpG="http://ns.adobe.com/xap/1.0/g/">
+         <xmpTPg:NPages>1</xmpTPg:NPages>
+         <xmpTPg:HasVisibleTransparency>False</xmpTPg:HasVisibleTransparency>
+         <xmpTPg:HasVisibleOverprint>False</xmpTPg:HasVisibleOverprint>
+         <xmpTPg:MaxPageSize rdf:parseType="Resource">
+            <stDim:w>100.000000</stDim:w>
+            <stDim:h>100.000000</stDim:h>
+            <stDim:unit>Points</stDim:unit>
+         </xmpTPg:MaxPageSize>
+         <xmpTPg:PlateNames>
+            <rdf:Seq>
+               <rdf:li>Cyan</rdf:li>
+               <rdf:li>Magenta</rdf:li>
+               <rdf:li>Yellow</rdf:li>
+               <rdf:li>Black</rdf:li>
+            </rdf:Seq>
+         </xmpTPg:PlateNames>
+         <xmpTPg:SwatchGroups>
+            <rdf:Seq>
+               <rdf:li rdf:parseType="Resource">
+                  <xmpG:groupName>Default Swatch Group</xmpG:groupName>
+                  <xmpG:groupType>0</xmpG:groupType>
+               </rdf:li>
+            </rdf:Seq>
+         </xmpTPg:SwatchGroups>
+      </rdf:Description>
+      <rdf:Description rdf:about=""
+            xmlns:illustrator="http://ns.adobe.com/illustrator/1.0/">
+         <illustrator:Type>Document</illustrator:Type>
+      </rdf:Description>
+      <rdf:Description rdf:about=""
+            xmlns:dc="http://purl.org/dc/elements/1.1/">
+         <dc:format>application/pdf</dc:format>
+         <dc:title>
+            <rdf:Alt>
+               <rdf:li xml:lang="x-default">logo</rdf:li>
+            </rdf:Alt>
+         </dc:title>
+      </rdf:Description>
+      <rdf:Description rdf:about=""
+            xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/">
+         <xmpMM:RenditionClass>proof:pdf</xmpMM:RenditionClass>
+         <xmpMM:DocumentID>uuid:4fae17bc-59c6-9342-b6da-8cb94c264d4a</xmpMM:DocumentID>
+         <xmpMM:InstanceID>uuid:ecb84851-93a3-9547-b0ae-1dc3fa2c0ab0</xmpMM:InstanceID>
+      </rdf:Description>
+      <rdf:Description rdf:about=""
+            xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
+         <pdf:Producer>Adobe PDF library 9.90</pdf:Producer>
+      </rdf:Description>
+   </rdf:RDF>
+</x:xmpmeta>
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                           
+<?xpacket end="w"?>
endstream
endobj
3 0 obj
<</Count 1/Kids[8 0 R]/Type/Pages>>
endobj
8 0 obj
<</ArtBox[3.0 13.543 96.5889 84.2764]/BleedBox[0.0 0.0 100.0 100.0]/Contents 9 0 R/LastModified(D:20130622155827+10'00')/MediaBox[0.0 0.0 100.0 100.0]/Parent 3 0 R/PieceInfo<</Illustrator 10 0 R>>/Resources<</ExtGState<</GS0 11 0 R>>/Properties<</MC0 5 0 R/MC1 6 0 R>>>>/Thumb 12 0 R/TrimBox[0.0 0.0 100.0 100.0]/Type/Page>>
endobj
9 0 obj
<</Filter/FlateDecode/Length 1114>>stream







+8;VGJ_$pAe$j%5g#Y/8.G]f[^A#Q9pU$sJ@-BS$94,G-<WGQ8j'TDl!%+#tGRN2bX
+mZsjSF>#9J"p"S6@ES~>
endstream
endobj
13 0 obj
[/Indexed/DeviceRGB 255 14 0 R]
endobj
14 0 obj
<</Filter[/ASCII85Decode/FlateDecode]/Length 428>>stream

+8;X]O>EqN@%''O_@%e@?J;%+8(9e>X=MR6S?i^YgA3=].HDXF.R$lIL@"pJ+EP(%0
+b]6ajmNZn*!='OQZeQ^Y*,=]?C.B+\Ulg9dhD*"iC[;*=3`oP1[!S^)?1)IZ4dup`
+E1r!/,*0[*9.aFIR2&b-C#s<Xl5FH@[<=!#6V)uDBXnIr.F>oRZ7Dl%MLY\.?d>Mn
+6%Q2oYfNRF$$+ON<+]RUJmC0I<jlL.oXisZ;SYU[/7#<&37rclQKqeJe#,UF7Rgb1
+VNWFKf>nDZ4OTs0S!saG>GGKUlQ*Q?45:CI&4J'_2j<etJICj7e7nPMb=O6S7UOH<
+PO7r\I.Hu&e0d&E<.')fERr/l+*W,)q^D*ai5<uuLX.7g/>$XKrcYp0n+Xl_nU*O(
+l[$6Nn+Z_Nq0]s7hs]`XX1nZ8&94a\~>
endstream
endobj
5 0 obj
<</Intent 15 0 R/Name(docs)/Type/OCG/Usage 16 0 R>>
endobj
6 0 obj
<</Intent 17 0 R/Name(trunk)/Type/OCG/Usage 18 0 R>>
endobj
17 0 obj
[/View/Design]
endobj
18 0 obj
<</CreatorInfo<</Creator(Adobe Illustrator 15.0)/Subtype/Artwork>>>>
endobj
15 0 obj
[/View/Design]
endobj
16 0 obj
<</CreatorInfo<</Creator(Adobe Illustrator 15.0)/Subtype/Artwork>>>>
endobj
11 0 obj
<</AIS false/BM/Normal/CA 1.0/OP false/OPM 1/SA true/SMask/None/Type/ExtGState/ca 1.0/op false>>
endobj
10 0 obj
<</LastModified(D:20130622155827+10'00')/Private 19 0 R>>
endobj
19 0 obj
<</AIMetaData 20 0 R/AIPrivateData1 21 0 R/AIPrivateData2 22 0 R/ContainerVersion 11/CreatorVersion 15/NumBlock 2/RoundtripStreamType 1/RoundtripVersion 15>>
endobj
20 0 obj
<</Length 970>>stream

+%!PS-Adobe-3.0 
%%Creator: Adobe Illustrator(R) 15.0
%%AI8_CreatorVersion: 15.0.0
%%For: (Alex) ()
%%Title: (noun_project_15207.svg)
%%CreationDate: 22/06/13 3:58 PM
%%Canvassize: 16383
%%BoundingBox: 258 373 353 444
%%HiResBoundingBox: 258.5 373.0879 352.0889 443.8213
%%DocumentProcessColors: Cyan Magenta Yellow Black
%AI5_FileFormat 11.0
%AI12_BuildNumber: 399
%AI3_ColorUsage: Color
%AI7_ImageSettings: 0
%%RGBProcessColor: 0 0 0 ([Registration])
%AI3_Cropmarks: 255.5 359.5449 355.5 459.5449
%AI3_TemplateBox: 305.5 396.5 305.5 396.5
%AI3_TileBox: 26 29.5449 585 812.5449
%AI3_DocumentPreview: None
%AI5_ArtSize: 14400 14400
%AI5_RulerUnits: 2
%AI9_ColorModel: 1
%AI5_ArtFlags: 0 0 0 1 0 0 1 0 0
%AI5_TargetResolution: 800
%AI5_NumLayers: 2
%AI9_OpenToView: -491 815 1 1595 821 18 0 0 43 134 0 0 0 1 1 0 1 1 0 1
%AI5_OpenViewLayers: 77
%%PageOrigin:0 0
%AI7_GridSettings: 72 8 72 8 1 0 0.8 0.8 0.8 0.9 0.9 0.9
%AI9_Flatten: 1
%AI12_CMSettings: 00.MS
%%EndComments

endstream
endobj
21 0 obj
<</Length 16577>>stream

+%%BoundingBox: 258 373 353 444
%%HiResBoundingBox: 258.5 373.0879 352.0889 443.8213
%AI7_Thumbnail: 128 100 8
%%BeginData: 16428 Hex Bytes
%0000330000660000990000CC0033000033330033660033990033CC0033FF
%0066000066330066660066990066CC0066FF009900009933009966009999
%0099CC0099FF00CC0000CC3300CC6600CC9900CCCC00CCFF00FF3300FF66
%00FF9900FFCC3300003300333300663300993300CC3300FF333300333333
%3333663333993333CC3333FF3366003366333366663366993366CC3366FF
%3399003399333399663399993399CC3399FF33CC0033CC3333CC6633CC99
%33CCCC33CCFF33FF0033FF3333FF6633FF9933FFCC33FFFF660000660033
%6600666600996600CC6600FF6633006633336633666633996633CC6633FF
%6666006666336666666666996666CC6666FF669900669933669966669999
%6699CC6699FF66CC0066CC3366CC6666CC9966CCCC66CCFF66FF0066FF33
%66FF6666FF9966FFCC66FFFF9900009900339900669900999900CC9900FF
%9933009933339933669933999933CC9933FF996600996633996666996699
%9966CC9966FF9999009999339999669999999999CC9999FF99CC0099CC33
%99CC6699CC9999CCCC99CCFF99FF0099FF3399FF6699FF9999FFCC99FFFF
%CC0000CC0033CC0066CC0099CC00CCCC00FFCC3300CC3333CC3366CC3399
%CC33CCCC33FFCC6600CC6633CC6666CC6699CC66CCCC66FFCC9900CC9933
%CC9966CC9999CC99CCCC99FFCCCC00CCCC33CCCC66CCCC99CCCCCCCCCCFF
%CCFF00CCFF33CCFF66CCFF99CCFFCCCCFFFFFF0033FF0066FF0099FF00CC
%FF3300FF3333FF3366FF3399FF33CCFF33FFFF6600FF6633FF6666FF6699
%FF66CCFF66FFFF9900FF9933FF9966FF9999FF99CCFF99FFFFCC00FFCC33
%FFCC66FFCC99FFCCCCFFCCFFFFFF33FFFF66FFFF99FFFFCC110000001100
%000011111111220000002200000022222222440000004400000044444444
%550000005500000055555555770000007700000077777777880000008800
%000088888888AA000000AA000000AAAAAAAABB000000BB000000BBBBBBBB
%DD000000DD000000DDDDDDDDEE000000EE000000EEEEEEEE0000000000FF
%00FF0000FFFFFF0000FF00FFFFFF00FFFFFF
%524C45FD6BFFA8CAA7A7A0A7A1FD76FFA8A77CA17CA17CA17CA1A7FD74FF
%A1A17CA7A1A17CA7A1A17CA7FD72FFA77CA17CA17CA17CA17CA17CA17CA8
%FD6FFFCFA77CA7A1A7A0A7A1A7A0A7A1A7A0A7A1FD6EFFA8A17CA17CA17C
%A17CA17CA17CA17CA17CA1A7FD6CFFA8A17CA7A1A17CA7A1A17CA7A1A17C
%A7A1A17CA7FD6BFFA1A17CA17CA17CA17CA17CA17CA17CA17CA17CA17CA8
%FD69FFA7A1A1A7A0A7A1A7A0A7A1A7A0A7A1A7A0A7A1A7A0A7A1FD68FFA7
%A07CA17CA17CA17CA17CA17CA17CA17CA17CA17CA17CA1A7FD67FFCAA0A1
%7CA7A1A17CA7A1A17CA7A1A17CA7A1A17CA7A1A17CA7CFFD67FFA77CA17C
%A17CA17CA17CA17CA17CA17CA17CA17CA17CA17CA7FD68FFA7A0A7A1A7A0
%A7A1A7A0A7A1A7A0A7A1A7A0A7A1A7A0A7A0FD68FFA8A07CA17CA17CA17C
%A17CA17CA17CA17CA17CA17CA17CA1A7FD4EFFA8FD19FFA7A17CA7A1A17C
%A7A1A17CA7A1A17CA7A1A17CA7A1CAA8FD4FFFA17CA7A1A8A8FD15FF7CA1
%7CA17CA17CA17CA17CA17CA17CA17CA7A8FD52FFA0A7A0A17CA7A1A7A7FF
%CFFD10FFCF7CA7A1A7A0A7A1A7A0A7A1A7A0A7A7FD54FFA8A17CA17CA17C
%A17CA07CA1A1A7A7FFCFFD0CFFA77CA17CA17CA17CA17CA17CA1A8FD55FF
%CAA0A17CA7A1A17CA7A1A17CA7A0A17CA7A1A8A8FD0AFFA77CA7A1A17CA7
%A1A17CA7CAFD56FFA1A17CA17CA17CA17CA17CA17CA17CA17CA17CA17CA8
%FD08FFA8A07CA17CA17CA17CA1A8FD4CFFCFFFA8CFA7A8A1FD04FFA7A1A7
%A0A7A1A7A0A7A1A7A0A7A1A7A0A7A1A7A0A1A8FD09FFA7A7A1A7A0A7A0A7
%CFFD44FFA8FFA8A8A7A8A1A17CA17CA17CA17CA0A7FFFFCF7CA17CA17CA1
%7CA17CA17CA17CA17CA17CA17CA17CCFFD0AFF7CA17CA17CA1A8FD42FFA8
%A7A1A17CA1A0A17CA1A0A17CA7A1A17CA7A0A7FFFFA8A17CA7A1A17CA7A1
%A17CA7A1A17CA7A1A17CA7A0A7CFFD0BFF7CA7A0A1A8FD43FFCF7CA17CA1
%7CA17CA17CA17CA17CA17CA17CA17CCFFFA87CA17CA17CA17CA17CA17CA1
%A1A77CA17CA17CA1A1FD0CFFA87CA1A8FD45FFCAA0A7A0A7A1A7A0A7A1A7
%A0A7A1A7A0A7A1A1A8FFA1A1A0A7A1A7A0A7A1A77CA7A8FFA8A7A1A7A0A7
%A0CAFD0DFFA7A8FD46FFA8A17CA17CA17CA17CA17CA17CA17CA17CA17CA7
%A8A77CA17CA17CA17CA17CA1A8FFFFFF7CA17CA17CA1A8FD0DFFA8FD48FF
%A0A7A1A17CA7A1A17CA7A1A17CA7A1A17CA7A1CA7CA7A1A17CA7A1A17CCA
%FD05FFA77CA7A1A17CFD57FFA77CA17CA17CA17CA17CA17CA17CA17CA17C
%A1A1A17CA17CA17CA1A1FD07FFA8A07CA17CA1A8CFA8CAA8CACAFFFFFFA8
%FD4CFFA8A7A0A1A0A7A1A7A0A7A1A7A0A7A1A7A0A7A1A7A0A7A1A17CA7A8
%FD09FFA0A7A1A7A0A7A0A1A0A1A7FD04FFA7A0FD4CFFCACFA1A17CA17CA1
%7CA17CA17CA17CA17CA17CA17CA1A1A8FD06FFA1A8FFFFFFA77CA17CA17C
%A17CA17CFD04FFA77CA17CA8FD4DFFCFCAA1A1A0A17CA1A0A17CA1A0A17C
%A7A0A7A8FD06FFCFA1A1A1FFFFFFA8A17CA7A1A17CA7A0FD04FFCA7CA7A1
%A17CA7FD4FFFA8A8A1A7A1A7A1A7A1A7A1A8A8FD07FFA8A77CA17CA1A8FF
%FFFF7CA17CA17CA17CCAFD04FF7CA17CA17CA17CA1A8FD47FFBD9ACBFD16
%FFA7A7A0A7A0A7A0CAFFFFFFA7A0A7A1A77CCAFD04FFA1A1A0A7A1A7A0A7
%A0A1A7FD46FF688C6894A1FD11FFA8A87CA07CA17CA17CA1A1FFFFFFA7A0
%7CA17CA1A8FFFFFFA1A17CA17CA17CA17CA17CA0A1FD44FFA18C8C8C688C
%8DBDA8FD0BFFA8CFA7A17CA7A1A17CA7A1A17CA7FD04FFA0A17CA1A8FFFF
%FFA8A17CA7A1A17CA7A1A17CA7A1A1A0FD43FF93688C688C688C688C6FC3
%CAFD05FFA8A87CA076A17CA17CA17CA17CA17CA17CCAFFFFA8A77CA0A1FF
%FFFFA8A17CA17CA17CA17CA17CA17CA17CA17CA8FD40FFCA688D8C8D688D
%8C8D688C68939ACAFD06FFA8A7A0A1A0A7A1A7A0A7A1A7A0A7A7FFFFFFA7
%A1A1FD04FFA7A0A7A0A7A1A7A0A7A1A7A0A7A1A7A0A7A0A7FD3FFF9A8C68
%8C688C688C688C688C688C6893A1FD07FFA7A17CA17CA17CA17CA17CA1CF
%FFFFCF7CFD04FFA87CA17CA17CA17CA17CA17CA17CA17CA17CA17CA1A8FD
%3DFF938C8C688D8C8C688D8C8C688D8C8C688C8C9AA1FD06FFCAA1A7A0A1
%7CA7A1A17CCFFFFFCFCFFD04FFA0A17CA7A1A17CA7A1A17CA7A0A17CA7A1
%A17CA7A0A1A7FD3BFFC4688C688C688C688C688C688C688C688C688C688C
%69C3A8FD05FFA8A87CA07CA17CA0A1FD07FF7CA17CA17CA17CA17CA17CA1
%7CA7A8A87CA17CA17CA17CA0A1FD3AFF948C8C8D688D8C8D688D8C8D688D
%8C8D688D8C8D688C689394CAFD06FFA8A8A1A17CA7FD06FFA7A7A1A7A0A7
%A1A7A0A7A0A1A1FD04FFCAA0A7A0A7A1A77CA7FD39FFCA8C688C688C688C
%688C688C688C688C688C688C688C688C688C68939ACAFD06FFA7A17CCFFD
%04FFA8A07CA17CA17CA17CA17CA1A8FD06FFA77CA17CA17CA1A8FD39FFC3
%688C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688C8C9A
%A1FD06FFCAA8FFFFFFA8A7A0A17CA7A1A17CA1A0A8CFFD07FFCFA7A0A17C
%A1A8FD3AFF6F8C688C688C688C688C688C688C688C688C688C688C688C68
%8C688C688C688C689BA8FD08FFA17CA17CA17CA17CA07CCFFD05FFCAA8FF
%FFFFA8A17CA0A1FD3AFFCA8D8C8D688D8C8D688D8C8D688D8C8D688D8C8D
%688D8C8D688D8C8D688D8C8D688C688D93CAFD06FFA8CAA1A1A0A7A0A1A7
%FD06FFCA7CA7FD04FFA8A1A1FD3BFF9A688C688C688C688C688C688C688C
%688C688C688C688C688C688C688C688C688C688C688C68939ACAFD06FFA7
%A17CA7A8FD05FFA8A77CA17CA7FD04FFA7CAFD3BFF8D8C688D8C8C688D8C
%8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C68
%8C8C94A1FD06FFCFFD06FFA1A17CA7A1A17CA8FD3FFFA18C688C688C688C
%688C688C688C688C688C688C688C688C688C688C688C688C688C688C688C
%688C688C688C689AA8FD08FFA87CA17CA17CA17CA17CA8FD0EFFA8FD2FFF
%BC8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C
%8D688D8C8D688D8C8D688D8C8D688C688C93C3FD06FFA8CAA1A1A0A7A1A7
%A0A7A0CFFD0BFFCAA1A7FD2EFFCA688C688C688C688C688C688C688C688C
%688C688C688C688C688C688C688C688C688C688C688C688C688C688C688C
%688C68939ACAFD06FFA8A77CA17CA17CA17CCFFD07FFCAA1A17CA17CFD2E
%FFA18C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C
%8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688C8C93A1FD07FFFD
%04A17CA1A1FD05FFA7A7A0A17CA7A1A1A8FD2DFF93688C688C688C688C68
%8C688C688C688C688C688C688C688C688C688C688C688C688C688C688C68
%8C688C688C688C688C688C688C688C689AA1FD05FF7CA17CA17CA1A1FD04
%FFA77CA17CA17CA17CA8FD0FFFA1FD14CAFD08FFCA8C8C688D8C8D688D8C
%8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D68
%8D8C8D688D8C8D688D8C8D688D8C8D688D688C93C3CAFFFFCFA0A7A0A7A1
%A1A7FD04FFA8A0A7A0A7A1A1A7FD0DFFCA688C688C688C688C688C688C68
%8C688C688C688C688CA8FD07FF9A8C688C688C688C688C688C688C688C68
%8C688C688C688C688C688C688C688C688C688C688C688C688C688C688C68
%8C688C688C688C688C688C688C688C9BFFFFA77CA17CA17CA0A7FFFFFFA8
%A77CA17CA17CA7FD0CFFCA688C8C8C688C8C8C688C8C8C688C8C8C688C8C
%8C688C8CCAFD07FF93688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C68
%8D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C
%8C688D8C8C688D8C8C688CCAFFA8A1A1A17CA7A0A1A8FFFFFFA8A7A0A17C
%A7A1FD0BFFCA688C688C688C688C688C688C688C688C688C688C688C688C
%A8FD06FFC3688C688C688C688C688C688C688C688C688C688C688C688C68
%8C688C688C688C688C688C688C688C688C688C688C688C688C688C688C68
%8C688C688C688C689AFFFFA1A17CA17CA17CA1A8FFFFFFA8A17CA17CA1CA
%FD0AFF8C8C688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8CFD07
%FF938C688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C
%8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D68
%8D8C8D688D8CCAFFFFA0A7A0A7A1A77CA7FD04FFA8A1A0A7A1FD09FFCA68
%8C688C688C688C688C688C688C688C688C688C688C688C688CCAFD05FFA8
%8C688C688C688C688C688C688C688C688C688C688C688C688C688C688C68
%8C688C688C688C688C688C688C688C688C688C688C688C688C688C688C68
%8C688C688C93FFFFA87CA17CA17CA7A8FD05FFA7A17CA1A8FD08FF8C8C68
%8D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C68FD06FFC3688D
%8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C
%688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D
%8C8C688CA1FFCFA7A0A1A1FD09FFA1A17CCAFD06FFCB688C688C688C688C
%688C688C688C688C688C688C688C688C688C688CA8FD05FF938C688C688C
%688C688C688C688C688C688C688C688C688C688C688C688C688C688C688C
%688C688C688C688C688C688C688C688C688C688C688C688C688C688C688C
%6893CAFFA7A7A8FD07FFA8A77CA17CA0A1FD06FF8D8C8C8D688D8C8D688D
%8C8D688D8C8D688D8C8D688D8C8D688D8C8C8CFD05FFCA8C688D8C8D688D
%8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D
%688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D
%68C3FD08FFA8CAA1A17CA7A1A77CA8FD05FF8C8C688C688C688C688C688C
%688C688C688C688C688C688C688C688C688CA8FD04FF9A688C688C688C68
%8C688C688C688C688C688C688C688C688C688C688C688C688C688C688C68
%8C688C688C688C688C688C688C688C688C688C688C688C688C688C688C68
%8C68CAFD05FFCAA1A17CA17CA17CA17CA17CFD04FF8D8C8C8C688D8C8C68
%8D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688C8CCAFD04FFFD048C68
%8D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C
%8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C68
%8D8C8C688C9AFFFFFFCAA77CA1A1A17CA7A1A17CA7A0A1CFFFFF698C688C
%688C688C688C688C688C688C688C688C688C688C688C688C688C688CA8FF
%FFFFA18C688C688C688C688C688C688C688C688C688C688C688C688C688C
%688C688C688C688C688C688C688C688C688C688C688C688C688C688C688C
%688C688C688C688C688C688C688CA1FFA8A17CA17CA17CA17CA17CA17CA1
%7CCFFF938C688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D68
%8D8C8D688D8CFD04FF9A688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D
%688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D
%8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C94FFFFA7A1A0A7A1A7
%A0A7A1A7A0A7A1A1A8698C688C688C688C688C688C688C688C688C688C68
%8C688C688C688C688C688C688CCAFFFFCA688C688C688C688C688C688C68
%8C688C688C688C688C688C688C688C688C688C688C688C688C688C688C68
%8C688C688C688C688C688C688C688C688C688C688C688C688C688C688C68
%C3FFFF7CA17CA17CA17CA17CA17CA17CA88C688D8C8C688D8C8C688D8C8C
%688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C68FFFFFFCAC3938C688C
%8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C
%688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D
%8C8C688D8C8C688C93FFFFCAA0A17CA7A1A17CA7A1A17CA1A7688C688C68
%8C688C688C688C688C688C688C688C688C688C688C688C688C688C688CA8
%FD05FFA194688C688C688C688C688C688C688C688C688C688C688C688C68
%8C688C688C688C688C688C688C688C688C688C688C688C688C688C688C68
%8C688C688C688C688C688C688C688C9AFFA8A17CA17CA17CA17CA17CA17C
%A78D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D
%688D8C8C8CFD09FFA193688C8C8D688D8C8D688D8C8D688D8C8D688D8C8D
%688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D
%8C8D688D8C8D688D8C8D688D8C8D688D8C8DCAFFA8A1A0A7A1A7A0A7A1A1
%7CA7A1688C688C688C688C688C688C688C688C688C688C688C688C688C68
%8C688C688C688CA8FD0AFFCA938D688C688C688C688C688C688C688C688C
%688C688C688C688C688C688C688C688C688C688C688C688C688C688C688C
%688C688C688C688C688C688C688C688C688C689AFFFFA1A17CA17CA17CA1
%A0A7A7FF8D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C
%8C688D8C8C688C8CCAFD0CFFCAC3938C688C8C8C688D8C8C688D8C8C688D
%8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C
%688D8C8C688D8C8C688D8C8C688D8C8C688D8CCAFFFFA0A17CA7A1CAA8FD
%04FF688C688C688C688C688C688C688C688C688C688C688C688C688C688C
%688C688C688CA8FD0FFFA19A688C688C688C688C688C688C688C688C688C
%688C688C688C688C688C688C688C688C688C688C688C688C688C688C688C
%688C688C688C688C688C688C688C93FFFFCAA7CFA8FD07FF8D8C8D688D8C
%8D688D8C8D688D8C8D688D8C8D688D8C8C688C8C938C8D8C8C688D8CFD13
%FFA193688C8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D8C
%8C688D8C93688C688C688D8C8D688D8C8D688D8C8D688D8C8D688D8C8D68
%8D8C9AFD0DFF688C688C688C688C688C688C688C688C688C688C688C939A
%A1CACACAA1C39A93688CCAFD14FFCA9493688C688C688C688C688C688C68
%8C688C688C688C688C68939AC3A1CACACAA1C3938C688C688C688C688C68
%8C688C688C688C688C688C688CA1FD0DFF8C688D8C8C688D8C8C688D8C8C
%688D8C8C688C8C9AA8FD0AFFCA93CBFD16FFCAC3938C688C8C8C688D8C8C
%688D8C8C688D8C8C688C93CAFD0AFFCA9A688C8C8C688D8C8C688D8C8C68
%8D8C8C688D8C8C93FD0EFF688C688C688C688C688C688C688C688C688C68
%CAFD0EFFA8FD19FFA89A688C688C688C688C688C688C688C688C9AFD0EFF
%CA698C688C688C688C688C688C688C688C688C68A1FFFFA7CFFD0AFF8D68
%8D8C8D688D8C8D688D8C8D688D8C8C93FD07FFA1C4A1CACAFD21FFA19A68
%8C8C8D688D8C8D688D8C93CAFD05FFCBCAA1C4C3CBFD06FF9A8C688D8C8D
%688D8C8D688D8C8D688D8C8DCAFFA8A1A0A8A8FD08FF688C688C688C688C
%688C688C688C688C93FD05FFA193688C688C688C93C4FD21FFCA9A93688C
%688C688C6893CAFD04FFCA9393688C688C68939AFD05FF9A8C688C688C68
%8C688C688C688C688C93FFFFA77CA17CA1A1FD07FF8D8C8C688D8C8C688D
%8C8C688D8C8C8DFD04FFCA938C688C8C8C688D8C8C6894CAFD04FFC39AC3
%9ABD9AC39ABD9AC39ABD9AC39ABD9AC39ABD9BFD08FFCA938D688C8C8CA8
%FFFFFFCA9A688C688D8C8C688C688C8CCAFD04FF938C688D8C8C688D8C8C
%688D8C8C68CAFFFF7CA7A1A17CA1A1CFFD05FF688C688C688C688C688C68
%8C688C68CAFFFFFFC3688C688C688C688C688C688C688CA1FFFFFFA16868
%8C688C688C688C688C688C688C688C688C688C689AA1FD07FFA8A1688CA1
%FFFFFFA88C688C688C688C688C688C688C68A1FD04FF688C688C688C688C
%688C688C688DA8FFA7A07CA17CA17CA17CA8FD04FF8D8C8D688D8C8D688D
%8C8D688D68C3FFFFFFCA688C8C8D688D8C8D688D8C8D688D8C8CCAFFFFFF
%948C8C8D688D8C8D688D8C8D688D8C8D688D8C8D688D688C93C3CAFD07FF
%CAFFFFFFCA93688D8C8D688D8C8D688D8C8D688D68C3FFFFFFC3688D8C8D
%688D8C8D688D8C8C9AFFFFA7A0A7A1A7A0A7A1A17CCFFFFFFF688C688C68
%8C688C688C688C688DCAFFFFFF688C688C688C688C688C688C688C688C68
%93CAFFFFCA688C688C688C688C688C688C688C688C688C688C688C688C68
%8D93C4CAFD08FF93688C688C688C688C688C688C688C688C68CAFFFFFF93
%688C688C688C688C688C68CAFFCF7CA17CA17CA17CA17CA17CCAFFFF8C68
%8D8C8C688D8C8C688D8C8C9AFFFFFF948C8C8C688D8C8C688D8C8C688D8C
%8C688D68C3FFFFFF9A688D8C8C688D8C8C688D8C8C688D8C8C688D8C8C68
%8D8C8C688C68939ACAFD05FFC3688D8C8C688D8C8C688D8C8C688D8C8C68
%8C93FFFFFFA18C688D8C8C688D8C8C6893FFFFFD04A17CA7A1A17CA7A1A1
%7CCFFF688C688C688C688C688C688C68CAFFFFA88C688C688C688C688C68
%8C688C688C688C688C68FFFFFFA18C688C688C688C688C688C688C688C68
%8C688C688C688C688C688C688C6894A8FFFFFF8D8C688C688C688C688C68
%8C688C688C688C688CA1FFFFCA688C688C688C688C688C9AFFA8A17CA17C
%A17CA17CA17CA17CA17CCA8C688C8C8C688C8C8C688C8C93FFFFFFC3688D
%8C8D688D8C8D688D8C8D688D8C8D688D8C8CA1FFFFFF688C8C8C688C8C8C
%688C8C8C688C8C8C688C8C8C688C8C8C688C8C8C688C68CAFFFFCA8C688D
%8C8D688D8C8D688D8C8D688D8C8D688D68BDFFFFFF93688D8C8D688D8C8C
%8CFFFFCA7CA7A1A7A0A7A1A7A0A7A1A7A0A7A18D9368938D9368938D9368
%9393FFFFFF938C688C688C688C688C688C688C688C688C688C689AFFFFFF
%9368938D9368938D9368938D9368938D9368938D9368938D9368938D9368
%93CAFFFFC3688C688C688C688C688C688C688C688C688C688C93FFFFFF94
%8C688C688C688C689AFFFFA1A17CA17CA17CA17CA17CA17CA17CFD04FFCA
%FFFFFFCAFFFFFFCAFD04FF938C8C688D8C8C688D8C8C688D8C8C688D8C8C
%688C93FD05FFCAFFFFFFCAFFFFFFCAFFFFFFCAFFFFFFCAFFFFFFCAFFFFFF
%CAFFFFFFCAFFFFFF9A8C8C8C688D8C8C688D8C8C688D8C8C688D8C8C6893
%FFFFFFC3688C688D8C8C688CA1FFA8A1A1A17CA7A1A17CA7A1A17CA7A0CF
%FD11FF688C688C688C688C688C688C688C688C688C688C6894FD25FF9A68
%8C688C688C688C688C688C688C688C688C688C68FFFFFF9A8C688C688C68
%8C68FFFFA77CA17CA17CA17CA17CA17CA17CA8FD12FF938C8D688D8C8D68
%8D8C8D688D8C8D688D8C8D688C93FD25FF9A8C8C8D688D8C8D688D8C8D68
%8D8C8D688D8C8D6893FFFFFFC3688D688D8C8D68C3FFFFA0A7A1A7A0A7A1
%A7A0A7A1A77CCAFD13FF938C688C688C688C688C688C688C688C688C688C
%689AFD25FF9B688C688C688C688C688C688C688C688C688C688C68FFFFFF
%938C688C688C688CA2FFFFA77CA17CA17CA17CA17CA17CA1CAFD13FFBD68
%8D8C8C688D8C8C688D8C8C688D8C8C688D8C8CA1FD25FFA18C688D8C8C68
%8D8C8C688D8C8C688D8C8C688D689AFFFFFF9A688C8C8C688C93FD04FFCA
%7CA7A1A17CA7A1A17CA7CFFD14FFA18C688C688C688C688C688C688C688C
%688C688C68CAFD26FF688C688C688C688C688C688C688C688C688C688CA1
%FFFFFFCAC3938C688C68C3FD05FFA87CA17CA17CA17CA0A7FD16FF938C8C
%8D688D8C8D688D8C8D688D8C8D688D689AFD27FFBC688D8C8D688D8C8D68
%8D8C8D688D8C8D688C8CFD07FFCAC38D8DCAFD06FFCAA0A7A0A7A1A1A7FD
%17FFC4688C688C688C688C688C688C688C688C688CA8FD27FFCA8C688C68
%8C688C688C688C688C688C688C68C3FD0AFFA8FD07FFCFA77CA17CA1A1FD
%19FF9A688D8C8C688D8C8C688D8C8C688D8C8C9AFD29FFA18C688D8C8C68
%8D8C8C688D8C8C688D689AFD14FFCAA7A0A1A0FD1BFF93688C688C688C68
%8C688C688C688C94FD2BFF9A8C688C688C688C688C688C688C6893CAFD15
%FFA8A17CCAFD1CFFBD8C8C688D8C8D688D8C8C688C9BFD2DFFA18D688C68
%8D8C8D688D8C8C68BCFD18FFA7CAFD1EFFCA938C688C688C688C6893A1FD
%2FFFA89A688C688C688C688C93C3FD3BFFCAC3939A939A9ACAFD33FFCBA1
%9A939A94C3A1FDA5FFFF
%%EndData

endstream
endobj
22 0 obj
<</Length 21057>>stream


























































 








+0000000016 00000 n

+0000000156 00000 n

+0000022171 00000 n

+0000000000 00000 f

+0000024532 00000 n

+0000024599 00000 n

+0000064018 00000 n

+0000022222 00000 n

+0000022562 00000 n

+0000025012 00000 n

+0000024899 00000 n

+0000023745 00000 n

+0000023971 00000 n

+0000024019 00000 n

+0000024783 00000 n

+0000024814 00000 n

+0000024667 00000 n

+0000024698 00000 n

+0000025086 00000 n

+0000025260 00000 n

+0000026280 00000 n

+0000042909 00000 n

+0000064047 00000 n

+trailer
<</Size 24/Root 1 0 R/Info 23 0 R/ID[<A0B43D3BE9404E559B188985E5B021C8><89A09C775629479581326F0B9EF6E592>]>>
startxref
64215
%%EOF


file:b/admin/logo.svg (new)
--- /dev/null
+++ b/admin/logo.svg
@@ -1,1 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>

+<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->

+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="100px"

+	 height="100px" viewBox="0 -25.635 100 100" enable-background="new 0 -25.635 100 100" xml:space="preserve">

+<g id="docs">

+	<path fill="#C2A385" d="M86.108-9.909l5.229,9.952c0,0-1.832,0.083-5.297,1.95c-2.312,1.249-6.468,6.246-6.468,6.246L71.827-2.909

+		c0,0,4.201-3.996,6.513-5.242C81.805-10.022,86.108-9.909,86.108-9.909"/>

+	<path fill="#C2A385" d="M65.604,20.731l-3.152-9.868c0,0-5.441,3.56-8.017,4.074c-1.008,0.202-1.93,0.335-2.749,0.425

+		L65.604,20.731z"/>

+	<path fill="#C2A385" d="M72.326,23.321c0.268-0.226,0.537-0.44,0.804-0.616c3.104-2.054,6.139-3.685,6.268-3.755l1.882-1.005

+		l1.369,1.634l2.864,3.417l3.198-4.334L76.68,9.783l-8.74,11.847L72.326,23.321z"/>

+	<path fill="#C2A385" d="M39.918,10.823l4.825,1.86l3.33,0.212c0.04,0.001,0.269,0.015,0.652,0.015c0.91,0,2.798-0.072,5.196-0.551

+		c1.427-0.284,5.007-2.332,7.092-3.695l2.889-1.888l1.05,3.285l2.496,7.812l5.889-7.985l-4.625,0.163l1.348-6.225L55.133,0.593

+		l-2.095,9.667c-0.531-2.599-1.841-5.727-1.841-5.727L37.709,6.055c0,0,0.885,2.206,1.586,4.529L39.918,10.823z"/>

+	<path fill="#C2A385" d="M91.233,45.562c-1.102-0.691-2.323-1.142-3.415-1.433l-3.779,9.804c1.932,1.246,5.197,5.738,5.197,5.738

+		l7.336-9.206C96.572,50.466,93.162,46.771,91.233,45.562z"/>

+	<path fill="#C2A385" d="M93.192,32.166l-3.656,1.224c-0.019,0.007-1.779,0.613-4.117,2.069l2.817,4.868l0.626,1.08

+		c3.306-0.562,7.727-1.922,7.727-1.922l-2.332-15.261c0,0-2.934,1.277-5.852,2.221l2.318,2.765L93.192,32.166z"/>

+	<path fill="#C2A385" d="M79.272,25.999l0.864,0.334l0.46,0.801l3.503,6.05c2.646-1.636,4.611-2.287,4.611-2.287l-8.075-9.632

+		c0,0-2.584,1.391-5.376,3.188L79.272,25.999z"/>

+</g>

+<g id="trunk">

+	<circle fill="#C00000" cx="66.019" cy="52.945" r="7.877"/>

+	<circle fill="#C00000" cx="22.693" cy="52.945" r="7.877"/>

+	<path fill="#C00000" d="M22.693,42.441c1.915,0,3.705,0.522,5.251,1.421V28.001H12.191L3,37.192v14.439h9.281

+		C12.931,46.459,17.347,42.441,22.693,42.441z"/>

+	<path fill="#C00000" d="M55.925,50.075l-9.583-3.695H30.88c1.186,1.476,1.978,3.28,2.225,5.252h22.502

+		C55.674,51.1,55.78,50.58,55.925,50.075z"/>

+	<path fill="#C00000" d="M79.312,28.328L39.961,13.149l-9.384,24.335l26.381,10.174c1.824-3.115,5.198-5.218,9.062-5.218

+		c5.791,0,10.503,4.712,10.503,10.502c0,0.744-0.081,1.471-0.229,2.173l4.713,1.817L86.95,41.52L79.312,28.328z"/>

+</g>

+</svg>

 

--- a/admin/refreshDesignDoc.php
+++ b/admin/refreshDesignDoc.php
@@ -8,7 +8,7 @@
 $obj->_id = "_design/" . urlencode("app");
 $obj->language = "javascript";
 $obj->views->all->map = "function(doc) {   emit(doc._id, doc); };";
-$obj->views->byDate->map = "function(doc) {   emit(doc.date, doc); };";
+$obj->views->byDate->map = "function(doc) {  if (doc.title != "Disclosure Log Updated") { emit(doc.date, doc); } };";
 $obj->views->byDateMonthYear->map = "function(doc) {   emit(doc.date, doc); };";
 $obj->views->byDateMonthYear->reduce = "_count";
 $obj->views->byAgencyID->map = "function(doc) {   emit(doc.agencyID, doc); };";
@@ -42,6 +42,7 @@
 $obj->views->byWebServer->map = "function(doc) {\n  emit(doc.web_server, doc);\n}";
 
 $obj->views->datasets->map = "function(doc) {\nif (doc.fieldName == \"data\") {\n  emit(doc._id, doc);\n}\n}";
+$obj->views->datasetGroups->map = "function(doc) {\nif (doc.fieldName == \"data\") {\n  doc.metadata[\"data.gov.au Category\"] && doc.metadata[\"data.gov.au Category\"].forEach(function(tag) {\n emit(tag, doc.url); \n  });\n}\n}";
 $obj->views->getValidationRequired->map = "function(doc) {\nif (doc.mime_type == \"text/html\" \n&& typeof(doc.validation) == \"undefined\") {\n  emit(doc._id, doc._attachments);\n}\n}";
 $docdb->save($obj, true);
 

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();
-?>

file:b/disclosr.iml (new)
--- /dev/null
+++ b/disclosr.iml
@@ -1,1 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="WEB_MODULE" version="4">
+  <component name="FacetManager">
+    <facet type="Python" name="Python">
+      <configuration sdkName="" />
+    </facet>
+  </component>
+  <component name="NewModuleRootManager" inherit-compiler-output="true">
+    <exclude-output />
+    <content url="file://$MODULE_DIR$" />
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>
 
+

--- a/documents/agency.php
+++ b/documents/agency.php
@@ -19,7 +19,7 @@
     <br>
 <?php
 try {
-    if ($_REQUEST['id']) {
+    if (isset($_REQUEST['id'])) {
         $rows = $foidocsdb->get_view("app", "byAgencyID", $_REQUEST['id'], false, false, false)->rows;
         foreach ($rows as $row) {
             //print_r($rows);
@@ -42,3 +42,4 @@
 echo "<a class='btn btn-large btn-primary' href='?end_key=$endkey' style='float:right;'>next page <i class='icon-circle-arrow-right icon-white'></i></a>";
 include_footer_documents();
 ?>
+

--- 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:1000px;height:1400px;"></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

--- /dev/null
+++ b/documents/datagov-export-groups.py
@@ -1,1 +1,85 @@
+import ckanclient
+import couchdb
+from ckanclient import CkanApiError
+import re
 
+
+class LoaderError(Exception):
+    pass
+
+# Instantiate the CKAN client.
+#ckan = ckanclient.CkanClient(base_location='http://localhost:5000/api',    api_key='b47b24cd-591d-40c1-8677-d73101d56d1b')
+api_key = 'ff34526e-f794-4068-8235-fcbba38cd8bc'
+server = 'data.disclosurelo.gs'
+api_key = 'c30eb6f5-0f90-47e0-bf05-9b1b4e3a461a'
+server = 'ckan.data.gov.au'
+
+ckan = ckanclient.CkanClient(base_location='http://' + server + '/api',
+                             api_key=api_key)
+couch = couchdb.Server('http://127.0.0.1:5984/')
+#couch = couchdb.Server('http://192.168.1.113:5984/')
+
+# https://github.com/okfn/ckanext-importlib
+def munge(name):
+    # convert spaces to underscores
+    name = re.sub(' ', '_', name).lower()
+    # convert symbols to dashes
+    name = re.sub('[:]', '_-', name).lower()
+    name = re.sub('[/]', '-', name).lower()
+    # take out not-allowed characters
+    name = re.sub('[^a-zA-Z0-9-_]', '', name).lower()
+    # remove double underscores
+    name = re.sub('__', '_', name).lower()
+    return name
+
+
+def name_munge(input_name):
+    return munge(input_name.replace(' ', '').replace('.', '_').replace('&', 'and'))
+
+
+docsdb = couch['disclosr-documents']
+
+if __name__ == "__main__":
+    groups = {}
+    for doc in docsdb.view('app/datasetGroups'):
+            group_name = doc.key
+            if group_name != "Not specified":
+                pkg_name = filter(lambda x: x in '0123456789abcdefghijklmnopqrstuvwxyz-_',
+                                  doc.value.replace("http://data.gov.au/dataset/", '').replace('/', '')[:100]);
+                if group_name in groups.keys():
+                    groups[group_name] = list(set(groups[group_name] + [pkg_name]))
+                else:
+                    groups[group_name] = [pkg_name]
+
+    # add dataset to group(s)
+    for group_name in groups.keys():
+        if group_name != "Not specified":
+            group_url = name_munge(group_name[:100])
+            print group_name
+            print groups[group_name]
+            try:
+                # Update the group details
+                group_entity = ckan.group_entity_get(group_url)
+                print "group "+group_name+" exists"
+                if 'packages' in group_entity.keys():
+                    group_entity['packages'] = list(set(group_entity['packages'] + groups[group_name]))
+                else:
+                    group_entity['packages'] = groups[group_name]
+                ckan.group_entity_put(group_entity)
+            except CkanApiError, e:
+                if ckan.last_status == 404:
+                    print "group "+group_name+" does not exist, creating"
+                    group_entity = {
+                        'name': group_url,
+                        'title': group_name,
+                        'description': group_name,
+                        'packages': groups[group_name]
+                    }
+                    #print group_entity
+                    ckan.group_register_post(group_entity)
+                elif ckan.last_status == 409:
+                    print "group already exists"
+                else:
+                    raise LoaderError('Unexpected status %s adding to group under \'%s\': %r' % (
+                        ckan.last_status, pkg_name, e.args))
+

--- a/documents/datagov-export.py
+++ b/documents/datagov-export.py
@@ -1,19 +1,85 @@
+# coding=utf-8
 import ckanclient
 import couchdb
 from ckanclient import CkanApiError
 import re
 import html2text # aaronsw :(
-
+import ckanapi # https://github.com/open-data/ckanapi
+import scrape
+import datetime, os, hashlib
+import urllib2
 
 class LoaderError(Exception):
     pass
 
+import tempfile
+def add_package_resource_cachedurl(ckan, package_name, url, name, format, license_id, size,**kwargs):
+    excluded_apis = "recent-earthquakes,sentinel-hotspots,abc-local-stations,action-bus-service-gtfs-feed-act,current-and-future-road-reports-traffic-restrictions-in-south-australia,current-and-future-road-reports-traffic-restrictions-in-south-australia,current-and-future-road-reports-traffic-restrictions-in-south-australia,current-and-future-road-reports-traffic-restrictions-in-south-australia,current-and-future-road-reports-traffic-restrictions-in-south-australia,current-and-future-road-reports-traffic-restrictions-in-south-australia,journey-planner-data-act,live-traffic-cameras-nsw,precis-forecast-national,precis-forecast-national,precis-forecast-new-south-wales,precis-forecast-new-south-wales,precis-forecast-northern-territory,precis-forecast-northern-territory,precis-forecast-queensland,precis-forecast-queensland,precis-forecast-south-australia,precis-forecast-south-australia,precis-forecast-tasmania,precis-forecast-tasmania,precis-forecast-victoria,precis-forecast-victoria,precis-forecast-western-australia,precis-forecast-western-australia,register-of-penalty-notices-nsw,sentinel-hotspots,trove-people-and-organisations-data,weather-data-services-radar,abc-local-stations,act-emergency-services-agency-esa-28093-current-incidents,act-emergency-services-agency-esa-news-alerts,act-government-news-and-events,act-government-summaries-of-cabinet-outcomes,act-magistrates-court-judgements,act-supreme-court-judgements,act-supreme-court-sentences,actpla-latest-news,all-vacant-act-government-jobs,community-engagement-current-engagements,community-engagement-news,edd-media-releases,edd-news-and-events,freedom-of-information-foi-summaries,libraries-act-announcements,nsw-rural-fire-service-current-incidents,nsw-rural-fire-service-major-updates,precis-forecast-new-south-wales,precis-forecast-south-australia,precis-forecast-tasmania,precis-forecast-victoria,sentinel-hotspots,south-australian-road-crash-statistics,trove-people-and-organisations-data,weather-warnings-for-new-south-wales-australian-capital-territory,weather-warnings-for-northern-territory,weather-warnings-for-queensland,weather-warnings-for-south-australia,weather-warnings-for-tasmania,weather-warnings-for-victoria,weather-warnings-for-western-australia".split(",")
+    if "xls" in url:
+	format = "xls"
+    if "pdf" in url:
+	format = "pdf"
+    if "xlsx" in url:
+	format = "xlsx"
+    (returned_url, mime_type, content) = scrape.fetchURL(scrape.docsdb,
+                                                url, "dataset_resource", "AGIMO", False)
+    if mime_type in ["application/vnd.ms-excel","application/msexcel","application/x-msexcel","application/x-ms-excel","application/x-excel","application/x-dos_ms_excel","application/xls","application/x-xls"]:
+	format = "xls"
+    if mime_type in ["application/xlsx","application/x-xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"]:
+	format = "xlsx"
+
+    #put file extensions on for windows users downloading files
+    suffix = name.encode("ascii","ignore").replace("/","")
+    if len(suffix) < 5 or (suffix[-4] != "." and suffix[-5] != "."):
+	suffix = suffix + "." + format
+    if content != None and package_name not in excluded_apis:
+	    tf = tempfile.NamedTemporaryFile(suffix=suffix)
+	    tfName = os.path.abspath(tf.name)
+	    print tfName
+	    tf.seek(0)
+	    tf.write(content)
+	    tf.flush()
+	    ckan.add_package_resource (package_name, tfName, name=name, format=format, license_id=license_id)
+    else:
+	print "fetch error"
+	return ckan.add_package_resource(package_name, url, name=name, resource_type='data',
+                                                      format=format,
+                                                      size=size, mimetype=mime_type, license_id=license_id)
+
 # Instantiate the CKAN client.
-#ckan = ckanclient.CkanClient(base_location='http://localhost:5000/api',    api_key='b47b24cd-591d-40c1-8677-d73101d56d1b')
-ckan = ckanclient.CkanClient(base_location='http://data.disclosurelo.gs/api',
-    api_key='482a9dd2-a976-4adf-ac77-d71d92a98a52')
-#couch = couchdb.Server('http://127.0.0.1:5984/')
-couch = couchdb.Server('http://192.168.1.113:5984/')
+api_key = 'ff34526e-f794-4068-8235-fcbba38cd8bc'
+server = 'data.disclosurelo.gs'
+
+ckan = ckanclient.CkanClient(base_location='http://' + server + '/api',
+                             api_key=api_key)
+ckandirect = ckanapi.RemoteCKAN('http://' + server, api_key=api_key)
+couch = couchdb.Server('http://127.0.0.1:5984/')
+#couch = couchdb.Server('http://192.168.1.113:5984/')
+
+import urllib
+import urlparse
+
+
+def url_fix(s, charset='utf-8'):
+    """Sometimes you get an URL by a user that just isn't a real
+    URL because it contains unsafe characters like ' ' and so on.  This
+    function can fix some of the problems in a similar way browsers
+    handle data entered by the user:
+
+    >>> url_fix(u'http://de.wikipedia.org/wiki/Elf (Begriffsklärung)')
+    'http://de.wikipedia.org/wiki/Elf%20%28Begriffskl%C3%A4rung%29'
+
+    :param charset: The target charset for the URL if the url was
+                    given as unicode string.
+    """
+    if isinstance(s, unicode):
+        s = s.encode(charset, 'ignore')
+    if not urlparse.urlparse(s).scheme:
+        s = "http://" + s
+    scheme, netloc, path, qs, anchor = urlparse.urlsplit(s)
+    path = urllib.quote(path, '/%')
+    qs = urllib.quote_plus(qs, ':&=')
+    return urlparse.urlunsplit((scheme, netloc, path, qs, anchor))
 
 # http://code.activestate.com/recipes/578019-bytes-to-human-human-to-bytes-converter/
 SYMBOLS = {
@@ -24,6 +90,7 @@
     'iec_ext': ('byte', 'kibi', 'mebi', 'gibi', 'tebi', 'pebi', 'exbi',
                 'zebi', 'yobi'),
 }
+
 
 def human2bytes(s):
     """
@@ -53,6 +120,9 @@
           ...
       ValueError: can't interpret '12 foo'
     """
+    if s == None:
+        return 0
+    s = s.replace(',', '')
     init = s
     num = ""
     while s and s[0:1].isdigit() or s[0:1] == '.':
@@ -91,18 +161,17 @@
 
 def name_munge(input_name):
     return munge(input_name.replace(' ', '').replace('.', '_').replace('&', 'and'))
-    #return input_name.replace(' ', '').replace('.', '_').replace('&', 'and')
-
-
-def get_licence_id(licencename):
+
+
+def get_license_id(licencename):
     map = {
         "Creative Commons - Attribution-Share Alike 2.0 Australia (CC-SA)\nThe downloadable version of the database is licensed under CC-BY-SA Creative Commons Attribution Share Alike and contains only the database fields that are released under that license. These fields are object title, object number, object description as well as temporal, spatial and dimension details. It also contains a persistent URL for each record.": 'cc-by-sa',
         "CreativeCommonsAttributionNonCommercial30AustraliaCCBYNC30": 'cc-nc',
         'Otherpleasespecify': 'notspecified',
         '': 'notspecified',
         "Publicly available data": 'notspecified',
-        "CreativeCommonsAttributionNoDerivativeWorks30AustraliaCCBYND30": "other-closed",
-        "CreativeCommonsAttributionNonCommercialNoDerivs30AustraliaCCBYNCND30": "other-closed",
+        "CreativeCommonsAttributionNoDerivativeWorks30AustraliaCCBYND30": "cc-by-nd",
+        "CreativeCommonsAttributionNonCommercialNoDerivs30AustraliaCCBYNCND30": "cc-nc-nd",
         'CreativeCommonsAttribution30AustraliaCCBY30': 'cc-by',
         "Creative Commons - Attribution 2.5 Australia (CC-BY)": 'cc-by',
         'CreativeCommonsAttributionCCBY25': 'cc-by',
@@ -112,108 +181,143 @@
         raise Exception(licencename + " not found");
     return map[licencename];
 
+goodcsvdata = "afl-in-victoria,annual-budget-initiatives-by-suburb-brisbane-city-council,athletics-in-victoria-gfyl,bicycle-racks-mosman-municipal-council,boat-ramps-brisbane-city-council,brisbane-access-ratings-database,bus-stops-brisbane-city-council,cemeteries-brisbane-city-council,cfa-locations,citycycle-stations-brisbane-city-council,community-gardens-brisbane-city-council,community-halls-brisbane-city-council,cooking-classes-gfyl,court-locations-victoria,customer-service-centres-brisbane-city-council,dance-in-victoria-gfyl,disability-activity-gfyl,dog-parks-brisbane-city-council,ferry-terminals-brisbane-city-council,fishing-club-in-victoria-gfyl,fitness-centres-in-victoria-gfyl,gardens-reserves-gfyl,golf-courses-brisbane-city-council,gymnastics-in-victoria-gfyl,historic-cemeteries-brisbane-city-council,ice-skating-centres-gfyl,immunisation-clinics-brisbane-city-council,libraries-brisbane-city-council,licenced-venues-victoria,lifesaving-locations-victoria,loading-zones-brisbane-city-council,major-projects-victoria,markets-in-victoria,martial-arts-in-victoria-gfyl,melbourne-water-use-by-postcode,members-of-parliament-both-houses-nsw,members-of-the-legislative-assembly-nsw,members-of-the-legislative-council-nsw,mfb-locations-vic,ministers-of-the-nsw-parliament,mosman-local-government-area,mosman-rider-route,mosman-wwii-honour-roll,neighbourhood-houses-gfyl,news-feeds-mosman-municipal-council,off-street-car-parks-mosman-municipal-council,orienteering-clubs-gfyl,parking-meter-areas-brisbane-city-council,parks-and-reserves-mosman-municipal-council,parks-brisbane-city-council,personal-training-gfyl,picnic-areas-brisbane-city-council,playgrounds-brisbane-city-council,playgrounds-mosman-municipal-council,police-region-crime-statistics-victoria,police-service-area-crime-statistics-victoria,pony-clubs-in-victoria-gfyl,prison-locations-victoria,public-amenities-maintained-by-mosman-council,public-art-brisbane-city-council,public-internet-locations-vic,public-toilets-brisbane-city-council,racecourse-locations-victoria,recent-development-applications-mosman-municipal-council,recreation-groups-gfyl,recreational-fishing-spots,regional-business-centres-brisbane-city-council,reports-of-swooping-birds-mosman-municipal-council,restricted-parking-areas-brisbane-city-council,rollerskating-centres-in-victoria-gfyl,sailing-clubs-gfyl,school-locations-victoria,shadow-ministers-of-the-nsw-parliament,skate-parks-gfyl,sporting-clubs-and-organisations-gfyl,stakeboard-parks-brisbane-city-council,state-bodies-gfyl,street-names-brisbane-city-council,suburbs-and-adjoining-suburbs-brisbane-city-council,swimming-pools-brisbane-city-council,swimming-pools-gfyl,tennis-courts-brisbane-city-council,top-40-book-club-reads-brisbane-city-council,tracks-and-trails-gfyl,triathlon-clubs-gfyl,urban-water-restrictions-victoria,veterinary-services-in-mosman,victorian-microbreweries,volunteering-centres-services-and-groups-victoria,walking-groups-gfyl,ward-offices-brisbane-city-council,waste-collection-days-brisbane-city-council,waste-transfer-stations-brisbane-city-council,water-consumption-in-melbourne,water-sports-in-victoria-gfyl,wifi-hot-spots-brisbane-city-council,yoga-pilates-and-tai-chi-in-victoria-gfyl,2809cycling-in-new-south-wales-what-the-data-tells-us2809-and-related-data,act-barbecue-bbq-locations,act-tafe-locations,ausindustry-locations,austender-contract-notice-export,austender-contract-notice-export,austender-contract-notice-export,austender-contract-notice-export,austender-contract-notice-export,austender-contract-notice-export,austender-contract-notice-export,austender-contract-notice-export,australian-gas-light-company-maps,australian-gas-light-company-maps,australian-ports,australian-public-service-statistical-bulletin-2011-12,australian-public-service-statistical-bulletin-snapshot-at-december-31-2011,australian-public-service-statistical-bulletin-tables-0910,austrics-timetable-set,capital-works-call-tender-schedule,collection-item-usage-state-library-of-victoria,country-and-commodity-trade-data-spreadsheet,country-and-commodity-trade-data-spreadsheet-2,country-by-level-of-processing-trade-data-spreadsheet,crime-incident-type-and-frequency-by-capital-city-and-nationally,csiro-locations,data-from-the-oaic-public-sector-information-survey-2012,data-from-the-oaic-public-sector-information-survey-2012,data-from-the-oaic-public-sector-information-survey-2012,department-of-finance-and-deregulation-office-locations,digitised-maps,diisr-division-locations-excluding-ausindustry-enterprise-connect-and-nmi,diisr-locations,diisr-portfolio-agency-locations-excluding-csiro,distance-to-legal-service-providers-from-disadvantaged-suburbs,enterprise-connect-locations,fire-insurance-maps-sydney-block-plans-1919-1940,fire-insurance-maps-sydney-block-plans-1919-1940,first-fleet-collection,first-fleet-collection,first-fleet-maps,first-fleet-maps,freedom-of-information-annual-estimated-costs-and-staff-time-statistical-data-2011-12,freedom-of-information-quarterly-request-and-review-statistical-data-2011-12,freedom-of-information-requests-estimated-costs-and-charges-collected-1982-83-to-2011-12,higher-education-course-completions,higher-education-enrolments,historical-australian-government-contract-data,historical-australian-government-contract-data,historical-australian-government-contract-data,historical-australian-government-contract-data,historical-australian-government-contract-data,historical-australian-government-contract-data,historical-australian-government-contract-data,historical-australian-government-contract-data,historical-australian-government-contract-data,historical-australian-government-contract-data,historical-australian-government-contract-data,historical-australian-government-contract-data,historical-australian-government-contract-data,historical-australian-government-contract-data,historical-australian-government-contract-data,journey-planner-data-nt,library-catalogue-search-terms-state-library-of-victoria,location-of-act-schools,location-of-centrelink-offices,location-of-european-wasps-nests,location-of-lawyers-and-legal-service-providers-by-town,location-of-legal-assistance-service-providers,location-of-medicare-offices,location-of-medicare-offices,maps-of-the-southern-hemisphere-16th-18th-centuries,maps-of-the-southern-hemisphere-16th-18th-centuries,music-queensland,national-measurement-institute-locations,new-south-wales-officers-and-men-of-the-australian-imperial-force-a-i-f-and-the-australian-naval-for,new-south-wales-officers-and-men-of-the-australian-imperial-force-a-i-f-and-the-australian-naval-for,photographs-of-nsw-life-pre-1955,photographs-of-nsw-life-pre-1955,photographs-of-sydney-before-1885,photographs-of-sydney-before-1885,picture-queensland,plgr-28093-playgrounds-act,police-station-locations,queensland-public-libraries,rare-printed-books,rare-printed-books,real-estate-maps,regional-australia-funding-projects,sa-memory-state-library-of-south-australia,search-engine-terms-state-library-of-victoria,south-australian-photographs-state-library-of-south-australia,south-australian-sheet-music-state-library-of-south-australia,sydney-bond-store-maps-1894,sydney-bond-store-maps-1894,sydney-maps-1917,sydney-maps-1917,tafe-institute-locations-victoria,tafe-sa-campus-locations,tolt-public-toilets-act,victorian-public-library-branches-state-library-of-victoria,western-australia-public-library-network,world-war-one-photographs-by-frank-hurley,world-war-one-photographs-by-frank-hurley,citycat-timetables-brisbane-city-council,cityferry-timetables-brisbane-city-council,cost-of-salinity-to-local-infrastructure-1996-97-summary-of-component-costs-of-salinity-by-reporting,cost-of-salinity-to-local-infrastructure-1996-97-summary-of-component-costs-of-salinity-by-reporting,downstream-cost-calculator-model-and-data-for-199697-or-2001-prices,economics-of-australian-soil-conditions-199697-limiting-factor-or-relative-yield-min-of-ry_salt2000-,geographical-names-register-gnr-of-nsw,victorian-dryland-salinity-assessment-2000-d01cac_ramsar_final-xls,victorian-dryland-salinity-assessment-2000-d02cac_fauna_final-xls,victorian-dryland-salinity-assessment-2000-d03cac_fauna_dist_final-xls,victorian-dryland-salinity-assessment-2000-dc04cac_hydrol_final-xls,victorian-dryland-salinity-assessment-2000-dc05cac_wetland_final-xls,victorian-dryland-salinity-assessment-2000-dc06cac_util_final-xls,victorian-dryland-salinity-assessment-2000-dc07cac_road_final-xls,victorian-dryland-salinity-assessment-2000-dc08cac_towns_final-xls,victorian-dryland-salinity-assessment-2000-dc09cac_flora_final-xls,victorian-dryland-salinity-assessment-2000-dc10cac_flora_dist_final-xls,victorian-dryland-salinity-assessment-2000-dc12cac_infrastructure-xls,victorian-dryland-salinity-assessment-2000-dc13cac_natural_envt-xls,victorian-dryland-salinity-assessment-2000-dc14cac_agriculture-xls,victorian-dryland-salinity-assessment-2000-dc16cac_agric_cost-xls,victorian-dryland-salinity-assessment-2000-dc17cac_shallow_wt-xls,victorian-dryland-salinity-assessment-2000-dc18cac_agric_cost_time-xls,victorian-dryland-salinity-assessment-2000-dc21cac_water_resources_new-xls,victorian-dryland-salinity-assessment-2000-dc22cac_risk-xls,licensed-broadcasting-transmitter-data,nsw-crime-data,recorded-crime-dataset-nsw,crime-statistics-in-nsw-by-month,2001-02-to-2007-08-local-government-survey-victoria,2009-green-light-report,annual-statistical-reports-fire-brigades-nsw-200304,annual-statistical-reports-fire-brigades-nsw-200405,annual-statistical-reports-fire-brigades-nsw-200506,annual-statistical-reports-fire-brigades-nsw-200607,arts-on-the-map,assets-and-liabilities-of-australian-located-operations,assets-of-australian-located-operations,assets-of-australian-located-operations-by-country,assets-of-financial-institutions,back-issues-of-monthly-banking-statistics,banks-assets,banks-consolidated-group-capital,banks-consolidated-group-impaired-assets,banks-consolidated-group-off-balance-sheet-business,banks-liabilities,building-societies-selected-assets-and-liabilities,byteback2842-locations-vic,cash-management-trusts,city-of-melbourne-street-furniture-database,community-services-nsw,consolidated-exposures-immediate-and-ultimate-risk-basis,consolidated-exposures-immediate-risk-basis-foreign-claims-by-country,consolidated-exposures-immediate-risk-basis-international-claims-by-country,consolidated-exposures-ultimate-risk-basis,consolidated-exposures-ultimate-risk-basis-foreign-claims-by-country,cosolidated-exposures-immediate-risk-basis,credit-unions-selected-assets-and-liabilities,daily-net-foreign-exchange-transactions,detox-your-home,education-national-assessment-program-literacy-and-numeracy-nsw,employment-data-by-nsw-regions,excise-beer-clearance-data-updated-each-month-beer-clearance-summary-data,finance-companies-and-general-financiers-selected-assets-and-liabilities,foreign-exchange-transactions-and-holdings-of-official-reserve-assets,half-yearly-life-insurance-bulletin-december-2010,health-behaviours-in-nsw,international-liabilities-by-country-of-the-australian-located-operations-of-banks-and-rfcs,liabilities-and-assets-monthly,liabilities-and-assets-weekly,liabilities-of-australian-located-operations,life-insurance-offices-statutory-funds,managed-funds,monetary-policy-changes,money-market-corporations-selected-assets-and-liabilities,monthly-airport-traffic-data-for-top-ten-airports-january-1985-to-december-2008,monthly-banking-statistics-april-2011,monthly-banking-statistics-june-2011,monthly-banking-statistics-may-2011,open-market-operations-2009-to-current,projected-households-vic-rvic-msd-2006-2056,projected-population-by-age-and-sex-vic-rvic-msd-2006-2056,public-unit-trust,quarterly-bank-performance-statistics,quarterly-general-insurance-performance-statistics-march-2011,quarterly-superannuation-performance-march-2011,recorded-crime-dataset-nsw,residential-land-bulletin,resourcesmart-retailers,resourcesmart-retailers-vic,road-fatalities-nsw,securitisation-vehicles,selected-asset-and-liabilities-of-the-private-non-financial-sectors,seperannuation-funds-outside-life-offices,solar-report-vic,towns-in-time-victoria,vif2008-projected-population-by-5-year-age-groups-and-sex-sla-lga-ssd-sd-2006-2026,vif2008-projected-population-totals-and-components-vic-rvic-msd-2006-2056,vif2008-projected-population-totals-sla-lga-ssd-sd-2006-2026,arts-festivals-victoria,arts-organisations-victoria,arts-spaces-and-places-victoria,ausgrid-average-electricity-use,collecting-institutions-victoria,indigenous-arts-organisations-victoria,latest-coastal-weather-observations-for-coolangatta-qld,top-10-fiction-books-brisbane-city-council".split(",")
+goodotherdata = "abc-local-stations,abc-local-stations,abc-local-stations,act-emergency-services-agency-esa-28093-current-incidents,act-government-news-and-events,act-government-summaries-of-cabinet-outcomes,act-magistrates-court-judgements,act-supreme-court-judgements,act-supreme-court-sentences,action-bus-service-gtfs-feed-act,actpla-latest-news,agricultural-commodities-for-199697-linked-to-profit-function-surfaces,agricultural-structure-classification,agricultural-structure-classification,all-vacant-act-government-jobs,annual-family-income-1996-1997-to-1998-1999-three-year-average,apvma-pubcris-dataset-for-registered-agricultural-and-veterinary-chemical-products-and-approved-acti,argus-newspaper-collection-of-photographs-state-library-of-victoria,assessment-of-terrestrial-biodiversity-2002-biodiversity-audit-data-entry-system-bades,assessment-of-terrestrial-biodiversity-2002-database,assisted-immigration-1848-1912-index,ausgrid-average-electricity-use,ausgrid-average-electricity-use-2011,ausindustry-locations,ausindustry-locations,austender-contract-notice-export,australian-broadband-guarantee,australian-broadband-guarantee,australian-data-access,australian-dryland-salinity-assessment-spatial-data-12500000-nlwra-2001,australian-dryland-salinity-assessment-spatial-data-12500000-nlwra-2001,australian-groundwater-flow-systems-national-land-and-water-resources-audit-january-2000,australian-groundwater-flow-systems-national-land-and-water-resources-audit-january-2000,australian-irrigation-areas-raster-version-1a-national-land-and-water-resources-audit,australian-irrigation-areas-raster-version-1a-national-land-and-water-resources-audit,australian-irrigation-areas-vector-version-1a-national-land-and-water-resources-audit,australian-irrigation-areas-vector-version-1a-national-land-and-water-resources-audit,australian-public-service-statistical-bulletin-2010-11,australian-water-resources-assessment-2000-database,australiana-index-state-library-of-victoria,available-water-capacity-for-australian-areas-of-intensive-agriculture-of-layer-1-a-horizon-top-soil,bicycle-racks-mosman-municipal-council,bikeways-briisbane-city-council,bikeways-briisbane-city-council,boreholes-in-the-murray-basin-southeastern-australia,boreholes-in-the-murray-basin-southeastern-australia,british-convict-transportation-registers,calculated-annual-and-monthly-potential-evaporation-mm,calculated-annual-and-monthly-potential-evaporation-mm,canberra-suburb-boundaries,catchment-and-subcatchments-grid,cemeteries-brisbane-city-council,cemeteries-brisbane-city-council,coal-fields-in-the-murray-basin-southeastern-australia,coal-fields-in-the-murray-basin-southeastern-australia,commonwealth-agencies,commonwealth-electoral-boundaries-archive-2009,commonwealth-electoral-boundaries-archive-2009,cost-of-salinity-to-local-infrastructure-1996-97-total-cost-all-infrastructure-buildings-road-rail-a,cost-of-salinity-to-local-infrastructure-1996-97-total-cost-all-infrastructure-buildings-road-rail-a,cost-of-salinity-to-local-infrastructure-1996-97-total-cost-increase-to-local-infrastructure-based-o,cost-of-salinity-to-local-infrastructure-1996-97-total-cost-of-all-infrastructure-buildings-road-rai,cost-of-salinity-to-local-infrastructure-1996-97-total-cost-of-all-infrastructure-buildings-road-rai,cost-of-salinity-to-local-infrastructure-1996-97-total-cost-of-all-infrastructure-buildings-road-rai,cost-of-salinity-to-local-infrastructure-1996-97-total-cost-of-all-infrastructure-buildings-road-rai,cost-of-salinity-to-local-infrastructure-1996-97-total-cost-of-the-general-infrastructure-component-,cost-of-salinity-to-local-infrastructure-1996-97-total-cost-of-the-rail-component-of-infrastructure-,cost-of-salinity-to-local-infrastructure-1996-97-total-cost-the-general-infrastructure-component-bui,cost-of-salinity-to-local-infrastructure-1996-97-total-cost-the-road-component-of-infrastructure-bas,cost-of-salinity-to-local-infrastructure-1996-97-total-cost-the-road-component-of-infrastructure-bas,cost-of-salinity-to-local-infrastructure-1996-97-total-cost-to-the-bridge-component-of-infrastructur,cost-of-salinity-to-local-infrastructure-1996-97-total-cost-to-the-bridge-component-of-infrastructur,country-by-level-of-processing-trade-data-spreadsheet-2,country-by-level-of-processing-trade-data-spreadsheet-2011-12,crime-incidents-data-2004-international-crime-victimisation-survey-icvs-australian-component,cropping-management-practices-1998-1999,csiro-locations,csiro-locations,current-and-future-road-reports-traffic-restrictions-in-south-australia,current-and-future-road-reports-traffic-restrictions-in-south-australia,current-and-future-road-reports-traffic-restrictions-in-south-australia,current-and-future-road-reports-traffic-restrictions-in-south-australia,current-and-future-road-reports-traffic-restrictions-in-south-australia,current-and-future-road-reports-traffic-restrictions-in-south-australia,cybersafety-outreach-program,cybersafety-outreach-program,data-source-for-polygonal-data-used-by-the-asris-project-in-generation-of-modelled-surfaces,department-of-finance-and-deregulation-office-locations,department-of-finance-and-deregulation-office-locations,depositional-path-length,digital-enterprise,digital-hubs,digitised-maps,diisr-division-locations-excluding-ausindustry-enterprise-connect-and-nmi,diisr-division-locations-excluding-ausindustry-enterprise-connect-and-nmi,diisr-locations,diisr-portfolio-agency-locations-excluding-csiro,diisr-portfolio-agency-locations-excluding-csiro,directory-gov-au-full-data-export,distance-to-ridges,economics-of-australian-soil-conditions-199697-factor-most-limiting-yield-aciditysodicitysalinity,economics-of-australian-soil-conditions-199697-gross-benefit-acidity-hayr,economics-of-australian-soil-conditions-199697-gross-benefit-of-the-limiting-factor-hayr,economics-of-australian-soil-conditions-199697-gross-benefit-salinity-hayr,economics-of-australian-soil-conditions-199697-gross-benefit-sodicity-hayr,economics-of-australian-soil-conditions-199697-impact-cost-of-salinity-2000-2020-hayr,economics-of-australian-soil-conditions-199697-relative-yield-from-acidity,economics-of-australian-soil-conditions-199697-relative-yield-from-salinity-in-2000,economics-of-australian-soil-conditions-199697-relative-yield-from-salinity-in-2020,economics-of-australian-soil-conditions-199697-relative-yield-from-sodicity,edd-media-releases,edd-news-and-events,egovernment-resource-centre-website-analytics,elevation-of-the-pre-tertiary-basement-in-the-murray-basin,elevation-of-the-pre-tertiary-basement-in-the-murray-basin,enterprise-connect-locations,enterprise-connect-locations,equivalent-fresh-water-head-difference-between-the-shallowest-and-deepest-aquifers,equivalent-fresh-water-head-difference-between-the-shallowest-and-deepest-aquifers,erosion-gully-density,erosion-path-length,estimated-proportion-of-farms-carrying-out-landcare-related-work-1998-1999,estimated-value-of-agricultural-operations-evao-1996-1997,farm-equity-ratio-1996-1997-to-1998-1999-three-year-average,farm-family-cash-income-1196-1997-to-1998-1999-three-year-average,farmer-population-1996,farms-with-significant-degradation-problems-irrigation-salinity-1998-1999,farms-with-significant-degradation-problems-irrigation-salinity-1998-1999-2,farms-with-significant-degradation-problems-soil-acidity-1998-1999,forests-of-australia-2003,freedom-of-information-foi-summaries,geology-lithology-12-500-000-scale,glenorchy-city-council-building-footprints,glenorchy-city-council-building-footprints,glenorchy-city-council-building-footprints,glenorchy-city-council-kerbs,glenorchy-city-council-kerbs,glenorchy-city-council-kerbs,glenorchy-city-council-stormwater-pipes,glenorchy-city-council-stormwater-pipes,glenorchy-city-council-stormwater-pipes,glenorchy-city-council-stormwater-pits,glenorchy-city-council-stormwater-pits,glenorchy-city-council-stormwater-pits,groundwater-sdl-resource-units,groundwater-sdl-resource-units,groundwater-sdl-resource-units,higher-qualifications-of-farmers-and-farm-managers-1996,historical-australian-government-contract-data,historical-australian-government-contract-data,hydrologic-indicator-sites,hydrologic-indicator-sites,immigration-land-orders-1861-1874,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-biota-condition-sub-in,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-catchment-condition-in,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-feral-animal-density,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-human-population-densi,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-impoundment-density,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-industrial-point-sourc,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-intensive-agricultural,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-land-condition-sub-ind,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-native-vegetation-frag,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-nutrient-point-source-,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-pesticide-hazard,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-predicted-2050-salinit,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-protected-areas,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-rivers-in-acidificatio,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-rivers-in-salt-hazard,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-rivers-through-forests,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-soil-acidification-haz,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-soil-degradation-hazar,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-suspended-sediment-loa,indicators-of-catchment-condition-in-the-intensive-land-use-zone-of-australia-weed-density,integrated-vegetation-cover-2003-version-1,john-t-collins-collection-state-library-of-victoria,journal-of-the-h-m-s-endeavour-1768-1771,journey-planner-data-act,krantz-sheldon-architectural-images,land-use-of-australia-version-3-28093-20012002,lands-surveys-historic-map-series-western-australia,latest-coastal-weather-observations-for-coolangatta-qld,launceston-city-council-addresses,launceston-city-council-building-footprints,launceston-city-council-contours,launceston-city-council-detail-survey-drawing-file,launceston-city-council-drainage,launceston-city-council-fences,launceston-city-council-pavement,launceston-city-council-railway,launceston-city-council-roads,libraries-act-announcements,licensed-broadcasting-transmitter-data,linc-tasmania,look-up-table-of-auslig-river-basins-of-australia-1997,major-water-resources-infrastructure-part-of-the-australian-water-resources-assessment-2000-database,mean-annual-concentration-of-mineral-nitrogen-in-soil-water-mgn-kgh20-in-the-pre-1788-scenario,mean-annual-concentration-of-mineral-nitrogen-in-soil-water-mgn-kgh20-in-the-pre-1788-scenario,mean-annual-concentration-of-mineral-nitrogen-in-soil-water-mgn-kgh20-in-the-present-day-scenario,mean-annual-concentration-of-mineral-nitrogen-in-soil-water-mgn-kgh20-in-the-present-day-scenario,mean-annual-deep-drainage-mm-y-in-the-pre-1788-scenario,mean-annual-deep-drainage-mm-y-in-the-pre-1788-scenario,mean-annual-deep-drainage-mm-y-in-the-present-day-scenario,mean-annual-deep-drainage-mm-y-in-the-present-day-scenario,mean-annual-transpiration-from-the-plant-canopy-for-the-pre-1788-scenario,mean-annual-transpiration-from-the-plant-canopy-for-the-pre-1788-scenario,mean-annual-transpiration-from-the-plant-canopy-for-the-present-day-scenario,mean-annual-transpiration-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-april-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-april-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-august-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-august-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-august-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-august-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-december-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-december-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-december-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-december-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-february-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-february-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-january-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-january-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-january-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-january-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-july-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-july-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-july-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-july-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-june-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-june-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-june-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-june-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-march-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-march-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-march-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-march-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-march-from-the-plant-canopy-for-the-present-day-scenario-2,mean-transpiration-in-march-from-the-plant-canopy-for-the-present-day-scenario-2,mean-transpiration-in-may-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-may-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-may-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-may-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-november-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-november-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-november-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-november-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-october-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-october-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-october-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-october-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-september-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-september-from-the-plant-canopy-for-the-pre-1788-scenario,mean-transpiration-in-september-from-the-plant-canopy-for-the-present-day-scenario,mean-transpiration-in-september-from-the-plant-canopy-for-the-present-day-scenario,mildenhall-photographs-of-early-canberra,mobility-map-brisbane-city,mobility-map-mt-coot-tha,mosman-local-government-area,mosman-rider-route,mosman-wwii-honour-roll,mosman-wwii-honour-roll,murray-darling-basin-water-resource-plan-areas-groundwater,murray-darling-basin-water-resource-plan-areas-groundwater,murray-darling-basin-water-resource-plan-areas-surface-water,murray-darling-basin-water-resource-plan-areas-surface-water,music-queensland,national-broadband-network,national-broadband-network,national-broadband-network-2011-10,national-broadband-network-2011-10,national-broadband-network-2011-12,national-broadband-network-2011-12,national-broadband-network-2012,national-broadband-network-28093-august-2011,national-broadband-network-28093-august-2011,national-broadband-network-28093-july-2011,national-broadband-network-28093-july-2011,national-broadband-network-february-2012,national-broadband-network-february-2012,national-broadband-network-september-2011,national-broadband-network-september-2011,national-library-of-australia-sheet-music-collection,national-measurement-institute-locations,national-parks-and-asset-locations-south-australia,national-public-toilet-map,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2000,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2000,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2000,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2000,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2000,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2000,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2000,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2020,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2020,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2020,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2020,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2020,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2020,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2020,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2050,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2050,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2050,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2050,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2050,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2050,new-south-wales-dryland-salinity-assessment-2000-assessmet-of-dryland-salinity-extent-2050,nsw-newspapers-catalogue-data,nsw-rural-fire-service-current-incidents,nsw-rural-fire-service-major-updates,off-street-car-parks-mosman-municipal-council,open-database-brisbane-city-council,ost-of-salinity-to-local-infrastructure-1996-97-total-cost-of-the-rail-component-of-infrastructure-b,parking-areas-brisbane-city-council,parking-areas-brisbane-city-council,parks-and-reserves-mosman-municipal-council,parks-brisbane-city-council,parks-brisbane-city-council,picture-australia-metadata,picture-queensland,picture-queensland,playgrounds-mosman-municipal-council,police-station-locations,police-station-locations,port-phillip-papers-state-library-of-victoria,precis-forecast-national,precis-forecast-national,precis-forecast-new-south-wales,precis-forecast-new-south-wales,precis-forecast-new-south-wales,precis-forecast-northern-territory,precis-forecast-northern-territory,precis-forecast-queensland,precis-forecast-queensland,precis-forecast-south-australia,precis-forecast-south-australia,precis-forecast-south-australia,precis-forecast-tasmania,precis-forecast-tasmania,precis-forecast-tasmania,precis-forecast-victoria,precis-forecast-victoria,precis-forecast-victoria,precis-forecast-western-australia,precis-forecast-western-australia,public-amenities-maintained-by-mosman-council,radio-and-television-broadcasting-stations-book-internet-edition,real-estate-maps,recent-earthquakes,regional-development-australia,regional-development-australia-2011-september-2011,regional-development-australia-may-2012,reports-of-swooping-birds-mosman-municipal-council,sentinel-hotspots,sentinel-hotspots,slq-catalogue-searches,slq-catalogue-searches,slv-rural-water,slv-shipping,slwa-digital-photographic-collection,south-australian-boat-ramp-locator,south-australian-road-crash-statistics,state-library-of-victoria-online-image-collection,state-library-of-victoria-online-image-collection-inc-high-res,state-of-the-service-report-2010-11-australian-public-service-employee-survey-results,state-of-the-service-report-2010-11-australian-public-service-employee-survey-results,statistical-local-areas-1996-for-agricultural-structure-classification,surface-water-gauging-stations-part-of-the-australian-water-resources-assessment-2000-database,surface-water-gauging-stations-part-of-the-australian-water-resources-assessment-2000-database,surface-water-sdl-resource-units,surface-water-sdl-resource-units,tasmanian-herbarium,tasmanian-museum-and-art-gallery-faunal-collection".split(",")
+
+
 docsdb = couch['disclosr-documents']
 
 if __name__ == "__main__":
+    orgs_list = []
+    orgs_ids = {}
     for doc in docsdb.view('app/datasets'):
+        print "   ---   "
         print doc.id
-        if doc.value['url'] != "http://data.gov.au/data/":
+
+        if doc.value['url'] != "http://data.gov.au/data/" and doc.value['agencyID'] != "qld":
+
+
             # Collect the package metadata.
-            pkg_name = doc.value['url'].replace("http://data.gov.au/dataset/",'').replace('/','');                                                                  _
-            tags = []
-            if doc.value['agencyID'] == "AGIMO":
-                if len(doc.value['metadata']["Keywords / Tags"]) > 0:
-                    if hasattr(doc.value['metadata']["Keywords / Tags"], '__iter__'):
-                        tags = tags + doc.value['metadata']["Keywords / Tags"]
+            pkg_name = filter(lambda x: x in '0123456789abcdefghijklmnopqrstuvwxyz-_',
+                              doc.value['url'].replace("http://data.gov.au/dataset/", '').replace('/', '')[:100]);
+            print pkg_name
+            if pkg_name != "" :
+
+                #add to or create organization using direct API
+                agency = doc.value['metadata']["Agency"]
+                if agency == "APS":
+                    agency = "Australian Public Service Commission"
+                if agency == "Department of Broadband, Communications and the Digital Ecomomy":
+                    agency = "Department of Broadband, Communications and the Digital Economy"
+                if agency == "Shared Services, Treasury Directorate":
+                    agency = "Shared Services Procurement, Treasury Directorate"
+                if agency == "Treasury - Shared Services":
+                    agency = "Shared Services Procurement, Treasury Directorate"
+                if agency == "Territory and Municipal Services (TAMS)":
+                    agency = "Territory and Municipal Services Directorate"
+                if agency == "State Library of NSW":
+                    agency = "State Library of New South Wales"
+                org_name = name_munge(agency[:100])
+                if org_name not in orgs_list:
+                    orgs_list = ckandirect.action.organization_list()['result']
+                    #print orgs_list
+                    if org_name not in orgs_list:
+                        try:
+                            print "org not found, creating " + org_name
+                            ckandirect.action.organization_create(name=org_name, title=agency,
+                                                                  description=agency)
+                            orgs_list.append(org_name)
+                        except ckanapi.ValidationError, e:
+                            print e
+                            raise LoaderError('Unexpected status')
                     else:
-                        tags = tags + [doc.value['metadata']["Keywords / Tags"]]
-                if 'data.gov.au Category' in doc.value['metadata'].keys() and len(doc.value['metadata']['data.gov.au Category']) > 0:
-                    if hasattr(doc.value['metadata']['data.gov.au Category'], '__iter__'):
-                        tags = tags + doc.value['metadata']['data.gov.au Category']
+                        print "org found, adding dataset to " + org_name
+
+                # cache org names -> id mapping
+                if org_name not in orgs_ids:
+                    org = ckandirect.action.organization_show(id=org_name)
+                    orgs_ids[org_name] = org["result"]["id"]
+                org_id = orgs_ids[org_name]
+                print "org id is " + org_id
+                tags = []
+                creator = doc.value['metadata']["DCTERMS.Creator"]
+                if doc.value['agencyID'] == "AGIMO":
+                    if len(doc.value['metadata']["Keywords / Tags"]) > 0:
+                        if hasattr(doc.value['metadata']["Keywords / Tags"], '__iter__'):
+                            tags = tags + doc.value['metadata']["Keywords / Tags"]
+                        else:
+                            tags = tags + [doc.value['metadata']["Keywords / Tags"]]
+
+                    tags = [re.sub('[^a-zA-Z0-9-_.]', '', tag.replace('&', 'and')).lower() for tag in tags if tag]
+                    #print tags
+                    extras = []
+
+                    for extra_key in doc.value['metadata'].keys():
+                        if extra_key not in ["Description", "Content-Language", "DCTERMS.Description",
+                                             "Keywords / Tags",
+                                             "data.gov.au Category", "Download", "Permalink", "DCTERMS.Identifier"]:
+                            if doc.value['metadata'][extra_key] != None and doc.value['metadata'][extra_key] != "":
+                                extras.append([extra_key, doc.value['metadata'][extra_key]])
+
+                    package_entity = {
+                        'name': pkg_name,
+                        'title': doc.value['metadata']['DCTERMS.Title'],
+                        'url': doc.value['metadata']['DCTERMS.Source.URI'],
+                        'tags': tags, #tags are mandatory?
+                        'author': creator,
+                        'maintainer': creator,
+                        'license_id': get_license_id(doc.value['metadata']['DCTERMS.License']),
+                        'notes': html2text.html2text(doc.value['metadata']['Description']).replace('AC/a!a','-').replace('AC/a!aC/',"'").replace("AC/a!E",":").replace("A "," "),
+                        'owner_org': org_id,
+                        'extras': extras,
+                        'private': (pkg_name not in goodcsvdata and pkg_name not in goodotherdata)
+                    }
+
+                try:
+                    #print package_entity
+                    ckan.package_register_post(package_entity)
+                except CkanApiError, e:
+                    if ckan.last_message == "{\"name\": [\"That URL is already in use.\"]}":
+                        print "package already exists"
                     else:
-                        tags = tags + [doc.value['metadata']['data.gov.au Category']]
-                tags = [re.sub('[^a-zA-Z0-9-_.]', '', tag.replace('&', 'and')).lower() for tag in tags if tag]
-                print tags
-                package_entity = {
-                    'name': pkg_name,
-                    'title': doc.value['metadata']['DCTERMS.Title'],
-                    'url': doc.value['metadata']['DCTERMS.Source.URI'],
-                    'tags': tags, #tags are mandatory?
-                    'author': doc.value['metadata']["DCTERMS.Creator"],
-                    'maintainer': doc.value['metadata']["DCTERMS.Creator"],
-                    'licence_id': get_licence_id(doc.value['metadata']['DCTERMS.License']),
-                    'notes': html2text.html2text(doc.value['metadata']['Description']),
-                }
-            if doc.value['agencyID'] == "qld":
-                package_entity = doc.value['metadata']
-
-            try:
-                print package_entity
-                ckan.package_register_post(package_entity)
-            except CkanApiError, e:
-                if ckan.last_status == 409:
-                    print "package already exists"
-                else:
-                    raise LoaderError('Unexpected status %s checking for package under \'%s\': %r' % (
-                        ckan.last_status, pkg_name, e.args))
-
-
-            #add to group
-
-            group_name = name_munge(doc.value['metadata']["Agency"][:100])
-            try:
-                print ckan.group_entity_get(group_name)
-
-                # Update the group details
-                group_entity = ckan.last_message
-                print "group exists"
-                if 'packages' in group_entity.keys():
-                    group_entity['packages'] = list(set(group_entity['packages'] + [pkg_name]))
-                else:
-                    group_entity['packages'] = [pkg_name]
-                ckan.group_entity_put(group_entity)
-            except CkanApiError, e:
-                if ckan.last_status == 404:
-                    print "group does not exist, creating"
-                    group_entity = {
-                        'name': group_name,
-                        'title': doc.value['metadata']["Agency"],
-                        'description': doc.value['metadata']["Agency"],
-                        'packages': [pkg_name],
-                        # 'type': "organization" # not allowed via API, use database query
-                        # update "group" set type = 'organization';
-                        }
-                    print group_entity
-                    ckan.group_register_post(group_entity)
-                else:
-                    raise LoaderError('Unexpected status %s adding to group under \'%s\': %r' % (
-                        ckan.last_status, pkg_name, e.args))
-            if 'Download' in doc.value['metadata'].keys():
-                try:
-                    pkg = ckan.package_entity_get(pkg_name)
-                    resources = pkg.get('resources', [])
-                    if len(resources) < len(doc.value['metadata']['Download']):
-                        for resource in doc.value['metadata']['Download']:
-
-                            # http://docs.ckan.org/en/ckan-1.7/domain-model-resource.html
-                            # (KML/KMZ) / (Shapefile) /(Other)
-                            format = "plain"
-                            if resource['format'] == '(XML)':
-                                format = 'xml'
-                            if resource['format'] == '(CSV/XLS)':
-                                format = 'csv'
-                            name = resource['href']
-                            if 'name' in resource.keys():
-                                name = resource['name']
-                            print resource
-                            ckan.add_package_resource(pkg_name, resource['href'], name=name, resource_type='data',
-                                format=format, size=human2bytes(resource['size'].replace(',', '')))
-                    else:
-                        print "resources already exist"
-                except CkanApiError, e:
-                    if ckan.last_status == 404:
-                        print "parent dataset does not exist"
-                    else:
+                        print ckan.last_message
                         raise LoaderError('Unexpected status %s checking for package under \'%s\': %r' % (
                             ckan.last_status, pkg_name, e.args))
-
+                pkg = ckan.package_entity_get(pkg_name)
+
+
+                # add resources (downloadable data files)
+                if 'Download' in doc.value['metadata'].keys():
+                    try:
+
+                        resources = pkg.get('resources', [])
+                        if len(resources) < len(doc.value['metadata']['Download']):
+                            for resource in doc.value['metadata']['Download']:
+
+                                # http://docs.ckan.org/en/ckan-1.7/domain-model-resource.html
+                                # (KML/KMZ) / (Shapefile) /(Other)
+                                format = "plain"
+                                if resource['format'] == '(XML)':
+                                    format = 'xml'
+                                if resource['format'] == '(CSV/XLS)':
+                                    format = 'csv'
+                                if resource['format'] == '(Shapefile)':
+                                    format = 'shp'
+                                if resource['format'] == '(KML/KMZ)':
+                                    format = 'kml'
+                                name = resource['href']
+                                if 'name' in resource.keys():
+                                    name = resource['name']
+                                print resource
+                                add_package_resource_cachedurl(ckan, pkg_name, url_fix(resource['href']), name,
+                                                          format, get_license_id(doc.value['metadata']['DCTERMS.License']),
+                                                          human2bytes(resource.get('size', '0B')))
+                        else:
+                            print "resources already exist"
+                    except CkanApiError, e:
+                        if ckan.last_status == 404:
+                            print "parent dataset does not exist"
+                        else:
+                            raise LoaderError('Unexpected status %s checking for package under \'%s\': %r' % (
+                                ckan.last_status, pkg_name, e.args))
+

--- /dev/null
+++ b/documents/datagov-resourcereport.py
@@ -1,1 +1,81 @@
+import couchdb
+couch = couchdb.Server('http://127.0.0.1:5984/')
+#couch = couchdb.Server('http://192.168.1.113:5984/')
 
+import urllib
+import urlparse
+import httplib2
+import httplib
+import csv
+
+
+def url_fix(s, charset='utf-8'):
+    """Sometimes you get an URL by a user that just isn't a real
+    URL because it contains unsafe characters like ' ' and so on.  This
+    function can fix some of the problems in a similar way browsers
+    handle data entered by the user:
+
+    :param charset: The target charset for the URL if the url was
+                    given as unicode string.
+    """
+    if isinstance(s, unicode):
+        s = s.encode(charset, 'ignore')
+    if not urlparse.urlparse(s).scheme:
+   	s = "http://"+s
+    scheme, netloc, path, qs, anchor = urlparse.urlsplit(s)
+    path = urllib.quote(path, '/%')
+    qs = urllib.quote_plus(qs, ':&=')
+    return urlparse.urlunsplit((scheme, netloc, path, qs, anchor))
+
+# http://code.activestate.com/recipes/578019-bytes-to-human-human-to-bytes-converter/
+SYMBOLS = {
+    'customary': ('B', 'KB', 'MB', 'GB', 'T', 'P', 'E', 'Z', 'Y'),
+    'customary_ext': ('byte', 'kilo', 'mega', 'giga', 'tera', 'peta', 'exa',
+                      'zetta', 'iotta'),
+    'iec': ('Bi', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'),
+    'iec_ext': ('byte', 'kibi', 'mebi', 'gibi', 'tebi', 'pebi', 'exbi',
+                'zebi', 'yobi'),
+}
+
+
+docsdb = couch['disclosr-documents']
+out = csv.writer(open("output.csv","w"), delimiter=',',quoting=csv.QUOTE_ALL)
+if __name__ == "__main__":
+    for doc in docsdb.view('app/datasets'):
+        if doc.value['url'] != "http://data.gov.au/data/" and doc.value['agencyID'] != "qld":
+            # Collect the package metadata.
+            pkg_name = filter(lambda x: x in '0123456789abcdefghijklmnopqrstuvwxyz-_',
+                              doc.value['url'].replace("http://data.gov.au/dataset/", '').replace('/', '')[:100]);
+            if 'Download' in doc.value['metadata'].keys() and len(doc.value['metadata']['Download']) > 0:
+                        for resource in doc.value['metadata']['Download']:
+                            # http://docs.ckan.org/en/ckan-1.7/domain-model-resource.html
+                            # (KML/KMZ) / (Shapefile) /(Other)
+                            format = "plain"
+                            if resource['format'] == '(XML)':
+                                format = 'xml'
+                            if resource['format'] == '(CSV/XLS)':
+                                format = 'csv'
+                            if resource['format'] == '(Shapefile)':
+                                format = 'shp'
+                            if resource['format'] == '(KML/KMZ)':
+                                format = 'kml'
+                            name = resource['href']
+                            if 'name' in resource.keys():
+                                name = resource['name']
+			    if resource['href'].startswith("ftp"):
+				    out.writerow([pkg_name, url_fix(resource['href']), name,format, "ftp", ""])
+			    else:
+				    try:
+					h = httplib2.Http(disable_ssl_certificate_validation=True)
+  				        resp = h.request(url_fix(resource['href']), 'HEAD')
+					content_type = resp[0]['content-type'] if 'content-type' in resp[0].keys() else ""
+					out.writerow([pkg_name.encode('ascii', 'ignore'), url_fix(resource['href']).encode('ascii', 'ignore'), name.encode('ascii', 'ignore'),format, resp[0]['status'], content_type])
+				    except httplib2.ServerNotFoundError:
+					out.writerow([pkg_name.encode('ascii', 'ignore'), url_fix(resource['href']).encode('ascii', 'ignore'), name.encode('ascii', 'ignore'),format, "500","badurl"])
+				    except httplib.InvalidURL:
+					out.writerow([pkg_name.encode('ascii', 'ignore'), url_fix(resource['href']).encode('ascii', 'ignore'), name.encode('ascii', 'ignore'),format, "500","badurl"])
+				    except httplib2.RelativeURIError:
+					out.writerow([pkg_name.encode('ascii', 'ignore'), url_fix(resource['href']).encode('ascii', 'ignore'), name.encode('ascii', 'ignore'),format, "500","badurl"])
+	    else:
+		out.writerow([pkg_name.encode('ascii', 'ignore')])
+

--- a/documents/datagov.py
+++ b/documents/datagov.py
@@ -39,7 +39,9 @@
                                     link = item.find("a")
                                     format = item.find(property="dc:format")
                                     linkobj = {"href":link['href'].replace("/bye?","").strip(),
-                                            "format": format.string.strip(), "size": format.next_sibling.string.strip()}
+                                            "format": format.string.strip()}
+				    if format.next_sibling.string != None:
+					linkobj["size"] = format.next_sibling.string.strip()
                                     if link.string != None:
                                         linkobj["name"] = link.string.strip()
                                     doc['metadata'][last_title].append(linkobj)

--- a/documents/genericScrapers.py
+++ b/documents/genericScrapers.py
@@ -202,7 +202,7 @@
     def getDate(self, content, entry, doc):
         strdate = ''.join(content.stripped_strings).strip()
         (a, b, c) = strdate.partition("(")
-        strdate = self.remove_control_chars(a.replace("Octber", "October").replace("Janrurary", "January").replace("1012","2012"))
+        strdate = self.remove_control_chars(a.replace("Octber", "October").replace("1012","2012").replace("Janrurary", "January").replace("1012","2012"))
         print strdate
         try:
 		edate = parse(strdate, dayfirst=True, fuzzy=True).strftime("%Y-%m-%d")
@@ -241,6 +241,7 @@
                         print self.remove_control_chars(
                             ''.join(id.stripped_strings))
                         if id.string is None:
+			    print "no id, using date as hash"
                             dochash = scrape.mkhash(
                                 self.remove_control_chars(
                                     url + (''.join(date.stripped_strings))))

--- a/documents/runScrapers.sh
+++ b/documents/runScrapers.sh
@@ -1,5 +1,8 @@
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+echo $DIR
+cd $DIR
 echo "" > /tmp/disclosr-error
-for f in scrapers/*.py; do
+for f in $DIR/scrapers/*.py; do
 	echo "Processing $f file..";
 	md5=`md5sum /tmp/disclosr-error`
 	python $f 3>&1 1>&2 2>&3 | tee --append /tmp/disclosr-error;

--- a/documents/scrape.py
+++ b/documents/scrape.py
@@ -112,7 +112,7 @@
     else:
         if (('page_scraped' in doc) and ((time.time() - doc['page_scraped']) < 60 * 24 * 14) or (scrape_again == False)):
             print "Uh oh, trying to scrape URL again too soon!" + hash
-	    if "_attachments" in doc.keys():
+	    if (not doc.has_key('file_size') or doc["file_size"] != "0") and "_attachments" in doc.keys():
 	            last_attachment_fname = doc["_attachments"].keys()[-1]
 	            last_attachment = docsdb.get_attachment(doc, last_attachment_fname)
         	    content = last_attachment.read()

--- a/documents/scrapers/0049d35216493c545ef5f7f000e6b252.py
+++ b/documents/scrapers/0049d35216493c545ef5f7f000e6b252.py
@@ -42,7 +42,6 @@
                         'data': {'request': '', 'session': '', 'more': ''}
 
                 }
-
-	        amonpy.exception(data)
+		#amonpy.exception(data)
 	pass
 

--- a/documents/scrapers/3d5871a44abbbc81ef5b3a420070755d.py
+++ b/documents/scrapers/3d5871a44abbbc81ef5b3a420070755d.py
@@ -8,42 +8,14 @@
 from datetime import *
 
 #http://www.doughellmann.com/PyMOTW/abc/
-class ScraperImplementation(genericScrapers.GenericOAICDisclogScraper):
-        def getTable(self,soup):
-                return soup.find(class_ = "inner-column").table       
-        def getRows(self,table):
-                return table.tbody.find_all('tr',recursive=False)
+class ScraperImplementation(genericScrapers.GenericHTMLDisclogScraper):
         def getColumnCount(self):
-                return 3
-        def getColumns(self,columns):
-                (date, title, description) = columns
-                return (date, date, title, description, None)
-        def getDate(self, content, entry, doc):
-		i = 0
-		date = ""
-		for string in content.stripped_strings:
-    			if i ==1:
-				date = string
-			i = i+1
-                edate = parse(date, dayfirst=True, fuzzy=True).strftime("%Y-%m-%d")
-                print edate
-                doc.update({'date': edate})
-                return
-   	def getTitle(self, content, entry, doc):
-		i = 0
-		title = ""
-		for string in content.stripped_strings:
-    			if i < 2:
-				title = title + string
-			i = i+1
-                doc.update({'title': title})
-		#print title
-                return
+                return 0
 
 if __name__ == '__main__':
 #http://www.csiro.au/Portals/About-CSIRO/How-we-work/Governance/FOI-Request-Disclosure-Log-2012-13.aspx
 #http://www.csiro.au/Portals/About-CSIRO/How-we-work/Governance/FOI-Request-Disclosure-Log-2011-12.aspx
-    print 'Subclass:', issubclass(ScraperImplementation, genericScrapers.GenericOAICDisclogScraper)
-    print 'Instance:', isinstance(ScraperImplementation(), genericScrapers.GenericOAICDisclogScraper)
+    print 'Subclass:', issubclass(ScraperImplementation, genericScrapers.GenericHTMLDisclogScraper)
+    print 'Instance:', isinstance(ScraperImplementation(), genericScrapers.GenericHTMLDisclogScraper)
     ScraperImplementation().doScrape()
 

--- a/documents/scrapers/6fa04af95fbe7de96daa2c7560e0aad3.py
+++ b/documents/scrapers/6fa04af95fbe7de96daa2c7560e0aad3.py
@@ -6,8 +6,6 @@
 
 #http://www.doughellmann.com/PyMOTW/abc/
 class ScraperImplementation(genericScrapers.GenericOAICDisclogScraper):
-        def getTable(self,soup):
-                return soup.find(id = "content_div_50269").table
         def getColumns(self,columns):
                 (id, date, title, description, notes) = columns
                 return (id, date, title, description, notes)

--- a/documents/scrapers/7c6adc1d41cf029bf1a0959e5156477a.py
+++ b/documents/scrapers/7c6adc1d41cf029bf1a0959e5156477a.py
@@ -21,7 +21,7 @@
         d.make_links_absolute(base_url = self.getURL())
         for table in d('table').items():
             title= table('thead').text()
-            print title
+            print self.remove_control_chars(title)
             (idate,descA,descB,link,deldate,notes) = table('tbody tr').map(lambda i, e: pq(e).children().eq(1).text())
             links = table('a').map(lambda i, e: pq(e).attr('href'))
             description = descA+" "+descB

--- /dev/null
+++ b/documents/scrapers/b0ca7fddcd1c965787daea47f2d32e0a.py
@@ -1,1 +1,17 @@
+import sys,os
+sys.path.insert(0, os.path.join(os.path.dirname(__file__) or '.', '../'))
+import genericScrapers
+import scrape
+from bs4 import BeautifulSoup
 
+#http://www.doughellmann.com/PyMOTW/abc/
+class ScraperImplementation(genericScrapers.GenericOAICDisclogScraper):
+        def getColumns(self,columns):
+                (id, date, title, description, notes) = columns
+                return (id, date, title, description, notes)
+
+if __name__ == '__main__':
+    print 'Subclass:', issubclass(ScraperImplementation, genericScrapers.GenericOAICDisclogScraper)
+    print 'Instance:', isinstance(ScraperImplementation(), genericScrapers.GenericOAICDisclogScraper)
+    ScraperImplementation().doScrape()
+

--- a/documents/scrapers/f5ce2d1651739704634eb8ca4b2b46d3.py
+++ b/documents/scrapers/f5ce2d1651739704634eb8ca4b2b46d3.py
@@ -7,12 +7,12 @@
 #http://www.doughellmann.com/PyMOTW/abc/
 class ScraperImplementation(genericScrapers.GenericOAICDisclogScraper):
         def getTable(self,soup):
-                return soup.find(id = "ctl00_PlaceHolderMain_PublishingPageContent__ControlWrapper_RichHtmlField").table       
+                return soup.find(id = "block-system-main").table       
         def getColumnCount(self):
-                return 7
+                return 2
         def getColumns(self,columns):
-                (id, date, title, description,link,deldate, notes) = columns
-                return (id, date, title, description, notes)
+                (date, title) = columns
+                return (date, date, title, title, None)
 
 if __name__ == '__main__':
     print 'Subclass:', issubclass(ScraperImplementation, genericScrapers.GenericOAICDisclogScraper)

--- a/documents/sitemap.xml.php
+++ b/documents/sitemap.xml.php
@@ -1,30 +1,48 @@
 <?php
 
 include ('../include/common.inc.php');
-$last_updated = date('Y-m-d', @filemtime('cbrfeed.zip'));
 header("Content-Type: text/xml");
 echo "<?xml version='1.0' encoding='UTF-8'?>";
 echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
 echo " <url><loc>" . local_url() . "index.php</loc><priority>1.0</priority></url>\n";
 foreach (scandir("./") as $file) {
-    if (strpos($file, ".php") !== false && $file != "index.php" && $file != "sitemap.xml.php")
+    if (strpos($file, ".php") !== false && $file != "index.php" && $file != "sitemap.xml.php") {
         echo " <url><loc>" . local_url() . "$file</loc><priority>0.6</priority></url>\n";
+	}
 }
 $agenciesdb = $server->get_db('disclosr-agencies');
+$foidocsdb = $server->get_db('disclosr-foidocuments');
 try {
     $rows = $agenciesdb->get_view("app", "byCanonicalName")->rows;
     foreach ($rows as $row) {
         echo '<url><loc>' . local_url() . 'agency.php?id=' . $row->value->_id . "</loc><priority>0.3</priority></url>\n";
     }
+	unset($rows);
+	$rows = null;
 } catch (SetteeRestClientException $e) {
     setteErrorHandler($e);
 }
-$foidocsdb = $server->get_db('disclosr-foidocuments');
+
+foreach (range(0, 8) as $number) {
 try {
-    $rows = $foidocsdb->get_view("app", "all")->rows;
+    $rows = $foidocsdb->get_view("app", "all", Array($number,$number+1))->rows;
     foreach ($rows as $row) {
         echo '<url><loc>' . local_url() . 'view.php?id=' . $row->value->_id . "</loc><priority>0.3</priority></url>\n";
     }
+	unset($rows);
+	$rows = null;
+} catch (SetteeRestClientException $e) {
+    setteErrorHandler($e);
+}
+}
+
+try {
+    $rows = $foidocsdb->get_view("app", "all", Array('9','fffffffff'))->rows;
+    foreach ($rows as $row) {
+        echo '<url><loc>' . local_url() . 'view.php?id=' . $row->value->_id . "</loc><priority>0.3</priority></url>\n";
+    }
+	unset($rows);
+	$rows = null;
 } catch (SetteeRestClientException $e) {
     setteErrorHandler($e);
 }

--- 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
@@ -10,6 +10,7 @@
         || strstr($_SERVER['PHP_SELF'], "documents/")
 	|| $_SERVER['SERVER_NAME'] == "disclosurelo.gs"
 	|| $_SERVER['SERVER_NAME'] == "www.disclosurelo.gs"
+	|| $_SERVER['SERVER_NAME'] == "direct.disclosurelo.gs"
         )
     $basePath = "../";
 
@@ -19,7 +20,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>
+                                <li><a href="ranking.php">Open Gov Ranking</a></li>
                                 <li><a href="headcount.php">Employee Headcount Graph</a></li>
                                 <li><a href="budget.php">Budget Graph</a></li>
                                 <li><a href="about.php">About/FAQ</a></li>

--- a/lib/FeedWriter/FeedTypes.php
+++ /dev/null
@@ -1,63 +1,1 @@
-<?php
 
-/* 
- * Copyright (C) 2012 Michael Bemmerl <mail@mx-server.de>
- *
- * This file is part of the "Universal Feed Writer" project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-if (!class_exists('FeedWriter'))
-	require dirname(__FILE__) . '/FeedWriter.php';
-
-/**
- * Wrapper for creating RSS1 feeds
- *
- * @package     UniversalFeedWriter
- */
-class RSS1FeedWriter extends FeedWriter
-{
-	function __construct()
-	{
-		parent::__construct(RSS1);
-	}
-}
-
-/**
- * Wrapper for creating RSS2 feeds
- *
- * @package     UniversalFeedWriter
- */
-class RSS2FeedWriter extends FeedWriter
-{
-	function __construct()
-	{
-		parent::__construct(RSS2);
-	}
-}
-
-/**
- * Wrapper for creating ATOM feeds
- *
- * @package     UniversalFeedWriter
- */
-class ATOMFeedWriter extends FeedWriter
-{
-	function __construct()
-	{
-		parent::__construct(ATOM);
-	}
-}
-

--- a/lib/FeedWriter/README
+++ b/lib/FeedWriter/README
@@ -1,7 +1,7 @@
 This package can be used to generate feeds in either RSS 1.0, RSS 2.0 or ATOM

 formats.

 

-There are three main classes that abstracts the feed information and another to

+There are three main classes that abstract the feed information and another to

 encapsulate the feed items information.

 

 Applications can create feed writer object, several feed item objects, set

@@ -16,5 +16,27 @@
 Requirements

 ============

 

-PHP >= 5.0

+PHP >= 5.3

+

+If you don't have 5.3 available on your system, there's a version supporting

+PHP >= 5.0 in the "legacy-php-5.0" branch.

+

+

+Documentation

+=============

+

+The documentation can be found in the "gh-pages" branch or on GitHub Pages:

+http://mibe.github.io/FeedWriter/

+

+

+Authors

+=======

+(in chronological order)

+

+Anis uddin Ahmad

+Michael Bemmerl

+Phil Freo

+Paul Ferrett

+Brennen Bearnes

+Michael Robinson

 

--- a/lib/FeedWriter/examples/example_atom.php
+++ b/lib/FeedWriter/examples/example_atom.php
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
 <?php
 
 /* 
@@ -57,4 +58,77 @@
 	$TestFeed->generateFeed();
   
 ?>
+=======
+<?php

+

+// You should use an autoloader instead of including the files directly.

+// This is done here only to make the examples work out of the box.

+include('../Item.php');

+include('../Feed.php');

+include('../ATOM.php');

+

+date_default_timezone_set('UTC');

+

+use \FeedWriter\ATOM;

+

+/*

+ * Copyright (C) 2008 Anis uddin Ahmad <anisniit@gmail.com>

+ *

+ * This file is part of the "Universal Feed Writer" project.

+ *

+ * This program is free software: you can redistribute it and/or modify

+ * it under the terms of the GNU General Public License as published by

+ * the Free Software Foundation, either version 3 of the License, or

+ * (at your option) any later version.

+ *

+ * This program is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

+ * GNU General Public License for more details.

+ *

+ * You should have received a copy of the GNU General Public License

+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.

+ */

+

+// IMPORTANT : No need to add id for feed or channel. It will be automatically created from link.

+

+//Creating an instance of ATOM class.

+$TestFeed = new ATOM;

+

+//Setting the channel elements

+//Use wrapper functions for common elements

+$TestFeed->setTitle('Testing the RSS writer class');

+$TestFeed->setLink('http://www.ajaxray.com/rss2/channel/about');

+$TestFeed->setDate(new DateTime());

+

+//For other channel elements, use setChannelElement() function

+$TestFeed->setChannelElement('author', array('name'=>'Anis uddin Ahmad'));

+

+//You can add additional link elements, e.g. to a PubSubHubbub server with custom relations.

+$TestFeed->setSelfLink('http://example.com/myfeed');

+$TestFeed->setAtomLink('http://pubsubhubbub.appspot.com', 'hub');

+

+//Adding a feed. Generally this portion will be in a loop and add all feeds.

+

+//Create an empty Item

+$newItem = $TestFeed->createNewItem();

+

+//Add elements to the feed item

+//Use wrapper functions to add common feed elements

+$newItem->setTitle('The first feed');

+$newItem->setLink('http://www.yahoo.com');

+$newItem->setDate(time());

+$newItem->setAuthor('Anis uddin Ahmad', 'anis@example.invalid');

+$newItem->setEnclosure('http://upload.wikimedia.org/wikipedia/commons/4/49/En-us-hello-1.ogg', 11779, 'audio/ogg');

+

+//Internally changed to "summary" tag for ATOM feed

+$newItem->setDescription('This is a test of adding CDATA encoded description by the php <b>Universal Feed Writer</b> class');

+$newItem->setContent('<h1>hi.</h1> <p>This is the content for the entry.</p>');

+

+//Now add the feed item	

+$TestFeed->addItem($newItem);

+

+//OK. Everything is done. Now generate the feed.

+$TestFeed->printFeed();

+>>>>>>> origin/master
 

--- a/lib/FeedWriter/examples/example_minimum.php
+++ b/lib/FeedWriter/examples/example_minimum.php
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
 <?php
 
 /* 
@@ -56,4 +57,70 @@
   $TestFeed->generateFeed();
   
 ?>
+=======
+<?php

+

+// You should use an autoloader instead of including the files directly.

+// This is done here only to make the examples work out of the box.

+include('../Item.php');

+include('../Feed.php');

+include('../RSS2.php');

+

+date_default_timezone_set('UTC');

+

+use \FeedWriter\RSS2;

+

+/* 

+ * Copyright (C) 2008 Anis uddin Ahmad <anisniit@gmail.com>

+ *

+ * This file is part of the "Universal Feed Writer" project.

+ *

+ * This program is free software: you can redistribute it and/or modify

+ * it under the terms of the GNU General Public License as published by

+ * the Free Software Foundation, either version 3 of the License, or

+ * (at your option) any later version.

+ *

+ * This program is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

+ * GNU General Public License for more details.

+ * 

+ * You should have received a copy of the GNU General Public License

+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.

+ */

+

+//Creating an instance of RSS2 class.

+$TestFeed = new RSS2;

+

+//Setting the channel elements

+//Use wrapper functions for common channel elements

+$TestFeed->setTitle('Testing & Checking the RSS writer class');

+$TestFeed->setLink('http://www.ajaxray.com/projects/rss');

+$TestFeed->setDescription('This is a test of creating a RSS 2.0 feed Universal Feed Writer');

+

+//Image title and link must match with the 'title' and 'link' channel elements for valid RSS 2.0

+$TestFeed->setImage('Testing & Checking the RSS writer class','http://www.ajaxray.com/projects/rss','http://www.rightbrainsolution.com/_resources/img/logo.png');

+

+//Let's add some feed items: Create two empty Item instances

+$itemOne = $TestFeed->createNewItem();

+$itemTwo = $TestFeed->createNewItem();

+

+//Add item details

+$itemOne->setTitle('The title of the first entry.');

+$itemOne->setLink('http://www.google.de');

+$itemOne->setDate(time());

+$itemOne->setDescription('And here\'s the description of the entry.');

+

+$itemTwo->setTitle('Lorem ipsum');

+$itemTwo->setLink('http://www.example.com');

+$itemTwo->setDate(1234567890);

+$itemTwo->setDescription('Lorem ipsum dolor sit amet, consectetur, adipisci velit');

+

+//Now add the feed item

+$TestFeed->addItem($itemOne);

+$TestFeed->addItem($itemTwo);

+

+//OK. Everything is done. Now generate the feed.

+$TestFeed->printFeed();

+>>>>>>> origin/master
 

--- a/lib/FeedWriter/examples/example_rss1.php
+++ b/lib/FeedWriter/examples/example_rss1.php
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
 <?php
 
 /* 
@@ -64,4 +65,76 @@
   $TestFeed->generateFeed();
   
 ?>
+=======
+<?php

+

+// You should use an autoloader instead of including the files directly.

+// This is done here only to make the examples work out of the box.

+include('../Item.php');

+include('../Feed.php');

+include('../RSS1.php');

+

+date_default_timezone_set('UTC');

+

+use \FeedWriter\RSS1;

+

+/* 

+ * Copyright (C) 2008 Anis uddin Ahmad <anisniit@gmail.com>

+ *

+ * This file is part of the "Universal Feed Writer" project.

+ *

+ * This program is free software: you can redistribute it and/or modify

+ * it under the terms of the GNU General Public License as published by

+ * the Free Software Foundation, either version 3 of the License, or

+ * (at your option) any later version.

+ *

+ * This program is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

+ * GNU General Public License for more details.

+ * 

+ * You should have received a copy of the GNU General Public License

+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.

+ */

+

+//Creating an instance of RSS1 class.

+$TestFeed = new RSS1;

+

+//Setting the channel elements

+//Use wrapper functions for common elements

+//For other optional channel elements, use setChannelElement() function

+$TestFeed->setTitle('Testing the RSS writer class');

+$TestFeed->setLink('http://www.ajaxray.com/rss2/channel/about');

+$TestFeed->setDescription('This is test of creating a RSS 1.0 feed by Universal Feed Writer');

+

+//It's important for RSS 1.0 

+$TestFeed->setChannelAbout('http://www.ajaxray.com/rss2/channel/about');

+

+//Adding a feed. Generally this portion will be in a loop and add all feeds.

+

+//Create an empty FeedItem

+$newItem = $TestFeed->createNewItem();

+

+//Add elements to the feed item

+//Use wrapper functions to add common feed elements

+$newItem->setTitle('The first feed');

+$newItem->setLink('http://www.yahoo.com');

+//The parameter is a timestamp for setDate() function

+$newItem->setDate(time());

+$newItem->setDescription('This is test of adding CDATA encoded description by the php <b>Universal Feed Writer</b> class');

+//Use core addElement() function for other supported optional elements

+$newItem->addElement('dc:subject', 'Nothing but test');

+

+//Now add the feed item

+$TestFeed->addItem($newItem);

+

+//Adding multiple elements from array

+//Elements which have an attribute cannot be added by this way

+$newItem = $TestFeed->createNewItem();

+$newItem->addElementArray(array('title'=>'The 2nd feed', 'link'=>'http://www.google.com', 'description'=>'This is a test of the FeedWriter class'));

+$TestFeed->addItem($newItem);

+

+//OK. Everything is done. Now generate the feed.

+$TestFeed->printFeed();

+>>>>>>> origin/master
 

--- a/lib/FeedWriter/examples/example_rss2.php
+++ b/lib/FeedWriter/examples/example_rss2.php
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
 <?php
 
 /* 
@@ -70,4 +71,125 @@
   $TestFeed->generateFeed();
   
 ?>
+=======
+<?php

+

+// You should use an autoloader instead of including the files directly.

+// This is done here only to make the examples work out of the box.

+include('../Item.php');

+include('../Feed.php');

+include('../RSS2.php');

+

+date_default_timezone_set('UTC');

+

+use \FeedWriter\RSS2;

+

+/**

+ * Copyright (C) 2008 Anis uddin Ahmad <anisniit@gmail.com>

+ * Copyright (C) 2013 Michael Bemmerl <mail@mx-server.de>

+ *

+ * This file is part of the "Universal Feed Writer" project.

+ *

+ * This program is free software: you can redistribute it and/or modify

+ * it under the terms of the GNU General Public License as published by

+ * the Free Software Foundation, either version 3 of the License, or

+ * (at your option) any later version.

+ *

+ * This program is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

+ * GNU General Public License for more details.

+ *

+ * You should have received a copy of the GNU General Public License

+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.

+ */

+

+// Creating an instance of RSS2 class.

+$TestFeed = new RSS2;

+

+// Setting some basic channel elements. These three elements are mandatory.

+$TestFeed->setTitle('Testing & Checking the Feed Writer project');

+$TestFeed->setLink('https://github.com/mibe/FeedWriter');

+$TestFeed->setDescription('This is just an example how to use the Feed Writer project in your code.');

+

+// Image title and link must match with the 'title' and 'link' channel elements for RSS 2.0,

+// which were set above.

+$TestFeed->setImage('Testing & Checking the Feed Writer project', 'https://github.com/mibe/FeedWriter', 'https://upload.wikimedia.org/wikipedia/commons/thumb/d/d9/Rss-feed.svg/256px-Rss-feed.svg.png');

+

+// Use core setChannelElement() function for other optional channel elements.

+// See http://www.rssboard.org/rss-specification#optionalChannelElements

+// for other optional channel elements. Here the language code for American English and

+$TestFeed->setChannelElement('language', 'en-US');

+

+// The date when this feed was lastly updated. The publication date is also set.

+$TestFeed->setDate(date(DATE_RSS, time()));

+$TestFeed->setChannelElement('pubDate', date(\DATE_RSS, strtotime('2013-04-06')));

+

+// You can add additional link elements, e.g. to a PubSubHubbub server with custom relations.

+// It's recommended to provide a backlink to the feed URL.

+$TestFeed->setSelfLink('http://example.com/myfeed');

+$TestFeed->setAtomLink('http://pubsubhubbub.appspot.com', 'hub');

+

+// You can add more XML namespaces for more custom channel elements which are not defined

+// in the RSS 2 specification. Here the 'creativeCommons' element is used. There are much more

+// available. Have a look at this list: http://feedvalidator.org/docs/howto/declare_namespaces.html

+$TestFeed->addNamespace('creativeCommons', 'http://backend.userland.com/creativeCommonsRssModule');

+$TestFeed->setChannelElement('creativeCommons:license', 'http://www.creativecommons.org/licenses/by/1.0');

+

+// If you want you can also add a line to publicly announce that you used

+// this fine piece of software to generate the feed. ;-)

+$TestFeed->addGenerator();

+

+// Here we are done setting up the feed. What's next is adding some feed items.

+

+// Create a new feed item.

+$newItem = $TestFeed->createNewItem();

+

+// Add basic elements to the feed item

+// These are again mandatory for a valid feed.

+$newItem->setTitle('Hello World!');

+$newItem->setLink('http://www.example.com');

+$newItem->setDescription('This is a test of adding a description by the <b>Feed Writer</b> classes. It\'s automatically CDATA encoded.');

+

+// The following method calls add some optional elements to the feed item.

+

+// Let's set the publication date of this item. You could also use a UNIX timestamp or

+// an instance of PHP's DateTime class.

+$newItem->setDate('2013-04-07 00:50:30');

+

+// You can also attach a media object to a feed item. You just need the URL, the byte length

+// and the MIME type of the media. Here's a quirk: The RSS2 spec says "The url must be an http url.".

+// Other schemes like ftp, https, etc. produce an error in feed validators.

+$newItem->setEnclosure('http://upload.wikimedia.org/wikipedia/commons/4/49/En-us-hello-1.ogg', 11779, 'audio/ogg');

+

+// If you want you can set the name (and email address) of the author of this feed item.

+$newItem->setAuthor('Anis uddin Ahmad', 'admin@ajaxray.com');

+

+// You can set a globally unique identifier. This can be a URL or any other string.

+// If you set permaLink to true, the identifier must be an URL. The default of the

+// permaLink parameter is false.

+$newItem->setId('http://example.com/URL/to/article', true);

+

+// Use the addElement() method for other optional elements.

+// This here will add the 'source' element. The second parameter is the value of the element

+// and the third is an array containing the element attributes.

+$newItem->addElement('source', 'Mike\'s page', array('url' => 'http://www.example.com'));

+

+// Now add the feed item to the main feed.

+$TestFeed->addItem($newItem);

+

+// Another method to add feeds items is by using an array which contains key-value pairs

+// of every item element. Elements which have attributes cannot be added by this way.

+$newItem = $TestFeed->createNewItem();

+$newItem->addElementArray(array('title'=> 'The 2nd item', 'link' => 'http://www.google.com', 'description' => 'Just another test.'));

+$TestFeed->addItem($newItem);

+

+// OK. Everything is done. Now generate the feed.

+// If you want to send the feed directly to the browser, use the printFeed() method.

+$myFeed = $TestFeed->generateFeed();

+

+// Do anything you want with the feed in $myFeed. Why not send it to the browser? ;-)

+// You could also save it to a file if you don't want to invoke your script every time.

+echo $myFeed;

+>>>>>>> origin/master
 

file:b/ranking.php (new)
--- /dev/null
+++ b/ranking.php
@@ -1,1 +1,213 @@
-
+<?php
+include_once('include/common.inc.php');
+include_header('Open Gov Rankings');
+$db = $server->get_db('disclosr-agencies');
+?>
+<div class="foundation-header">
+    <h1><a href="about.php">Open Government Rankings</a></h1>
+    <h4 class="subheader"></h4>
+</div>
+<table>
+    <?php
+    $agenciesdb = $server->get_db('disclosr-agencies');
+    //$docsdb = $server->get_db('disclosr-documents');
+    $scoredagencies = Array();
+    $scores = Array();
+    $columnKeys = Array();
+
+    try {
+        $rows = $agenciesdb->get_view("app", "all", null, true)->rows;
+
+
+        if ($rows) {
+            foreach ($rows as $row) {
+                $columns = Array();
+                foreach ($row->value as $key => $value) {
+                    if ((strstr($key, "has") || strstr($key, "URL")) && $key != "rtkURLs") {
+                        //echo "$key<br>";
+                        $columns[$key] = $value;
+                    }
+                }
+                //print_r(array_keys($columns));
+                $columnKeys = array_unique(array_merge($columnKeys, array_keys($columns)));
+                //print_r($columnKeys);
+                $score = count($columns);
+                $scores[$score]++;
+                $scoredagencies[] = Array("id"=> $row->key, "website"=> $row->value->website, "name" => $row->value->name, "columns" => $columns, "score" => $score);
+            }
+        }
+
+    } catch (SetteeRestClientException $e) {
+        setteErrorHandler($e);
+    }
+    function cmp($a, $b)
+    {
+        if ($a['score'] == $b['score']) {
+            return strcmp($a['name'], $b['name']);
+        }
+        return ($a['score'] > $b['score']) ? -1 : 1;
+    }
+
+    usort($scoredagencies, "cmp");
+    echo "<tr>";
+    echo "<th>Agency Name</th>";
+    echo "<th>Score</th>";
+    foreach ($columnKeys as $columnID) {
+        echo "<th>" . (isset($schemas['agency']["properties"][$columnID]['x-title']) ? $schemas['agency']["properties"][$columnID]['x-title'] : "<i>$columnID</i>") .  "</th>";
+    }
+    echo "</tr>";
+    foreach ($scoredagencies as $scoredagency) {
+        echo "<tr>";
+        echo "<td><b><a href='getAgency.php?id=" . $scoredagency['id'] . "'>". $scoredagency['name'] . "</a></b></td>";
+        echo "<td><b>" . $scoredagency['score'] . "</b></td>";
+        foreach ($columnKeys as $key) {
+            echo "<td style='text-align: center;'>";
+            if (isset($scoredagency['columns'][$key])) {
+                $value = $scoredagency['columns'][$key];
+                if (is_array($value)) {
+                    if (count($value) == 1) {
+                        $href = $value[0];
+                    } else {
+                        $href = $value[0];
+                    }
+
+                } else {
+                    $href = $value;
+                }
+                if ($href[0] == "@") {
+                    $href = str_replace("@","https://twitter.com/",$href);
+                }
+                //$href= urlencode($href);
+
+                echo "<font color='lightgreen'>";
+
+                if (strstr($href, "http")) {
+                    echo "<a title='Yes' href='$href' style='color:lightgreen;'>&check;</a>";
+                } else {
+                    echo "&check;";
+                }
+
+                echo "</font>";
+            } else {
+                echo "<font color='orange'><abbr title='No'>✘</abbr></font>";
+            }
+            echo "</td>";
+        }
+        echo "</tr>\n";
+    }
+    ?>
+</table><br>
+<div id="criteria" style="width:500px;height:900px;"></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([$value, $i]);" . PHP_EOL;
+                    echo "        scorelabels.push('$key');" . PHP_EOL;
+                    $i++;
+                }
+            } catch (SetteeRestClientException $e) {
+                setteErrorHandler($e);
+            }
+            ?>
+            function scoretrackformatter(obj) {
+                if (scorelabels[Math.floor(obj.y)]) {
+                    return (scorelabels[Math.floor(obj.y)]) + "=" + obj.x;
+
+                } else {
+                    return "";
+                }
+            }
+
+            function scoretickformatter(val, axis) {
+                if (scorelabels[Math.floor(val)]) {
+                    return (scorelabels[Math.floor(val)]) ;
+
+                } else {
+                    return "";
+                }
+            }
+
+            Flotr.draw(document.getElementById("criteria"), [
+                {data: d1}
+            ], {
+                title: 'Total count of agencies with criteria',
+                HtmlText: true,
+                bars: {
+                    show: true,
+                    horizontal: true
+                },
+                mouse: {
+                    track: true,
+                    relative: true,
+                    trackFormatter: scoretrackformatter
+                }, yaxis: {
+                    autoscaling: true,
+                    minorTickFreq: 0.6,
+                    noTicks: scorelabels.length,
+                    tickFormatter: scoretickformatter
+                },
+                xaxis: {
+                    autoscaling: true
+
+                }
+            });
+
+            var d2 = [];
+            <?php
+            try {
+
+                ksort($scores);
+                foreach ($scores as $key => $value) {
+
+                    echo "       d2.push([$key,$value]);" . PHP_EOL;
+                    $i++;
+                }
+            } catch (SetteeRestClientException $e) {
+                setteErrorHandler($e);
+            }
+            ?>
+
+
+            Flotr.draw(document.getElementById("scores"), [
+                {data: d2}
+            ], {
+                title: 'Frequency distribution of Scores',
+                HtmlText: true,
+                bars: {
+                    show: true
+                },
+                mouse: {
+                    track: true,
+                    relative: true
+                }, yaxis: {
+                    autoscaling: true
+                },
+                xaxis: {
+                    autoscaling: true
+
+                }
+            });
+
+        });
+    };
+</script>
+<?php
+include_footer();
+?>
+