-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathning.xml
More file actions
349 lines (330 loc) · 15.4 KB
/
ning.xml
File metadata and controls
349 lines (330 loc) · 15.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
<!-- Unless otherwise stated in particular files or directories, this
software is free software; you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. -->
<?xml version="1.0" encoding="UTF-8"?>
<Module xmlns:ning="http://developer.ning.com/opensocial/">
<ModulePrefs description="Information about your UK local authority from OpenlyLocal.com :: making Local Government more transparent. Lists forthcoming meetings, committees, council members etc" thumbnail="http:/openlylocal.com/images/openlylocal_logo_120x60.png" author_affiliation="OpenlyLocal.com" author="CountCulture" author_email="countculture@gmail.com" title="UK Council info :: OpenlyLocal" author_link="http://OpenlyLocal.com" directory_title="UK Council info :: OpenlyLocal">
<ning:screenshot view="canvas">http://openlylocal.com/images/ning_screenshot_canvas.png</ning:screenshot>
<Require feature="opensocial-0.8"/>
<Require feature="dynamic-height"/>
<Require feature="setprefs"/>
<Require feature="views"/>
</ModulePrefs>
<Content type="html" view="canvas">
<![CDATA[<!-- Tab stuff taken from http://www.sohtanaka.com/web-design/simple-tabs-w-css-jquery/ -->
<style>
body {font-size:90%;}
.collection ul { font-size: 80%;}
h2, h3 { border-bottom: 1px solid #676767; margin: 0.5em 0 0 0;}
ul {padding: 12px; margin: 0.5em 0.25em;}
#footer { padding 5px; background-color: #eee; border-top: 1px solid #676767;}
a {text-decoration: none; color: #003366;}
a.official_page {color: #515151; background: transparent url(http://openlylocal.com/images/ext_link.gif) no-repeat scroll left center; padding-left:10px;}
a:hover {text-decoration: underline; color: black;}
#edit_settings a {float: right; font-size: 80%;}
#recent_activity {float: right; width: 250px; padding: 6px; margin-left: 1em; background-color: #dfe7ea;}
#basic_info {margin-bottom: 1em;}
#main_info {margin-top: 1em;}
ul.tabs {
margin: 0;
padding: 0;
float: left;
list-style: none;
height: 32px; /*--Set height of tabs--*/
border-bottom: 1px solid #999;
border-left: 1px solid #999;
width: 100%;
}
ul.tabs li {
float: left;
margin: 0;
padding: 0;
height: 31px; /*--Subtract 1px from the height of the unordered list--*/
line-height: 31px; /*--Vertically aligns the text within the tab--*/
border: 1px solid #999;
border-left: none;
margin-bottom: -1px; /*--Pull the list item down 1px--*/
overflow: hidden;
position: relative;
background: #e0e0e0;
}
ul.tabs li a {
text-decoration: none;
color: #000;
display: block;
font-size: 1.2em;
padding: 0 20px;
border: 1px solid #fff; /*--Gives the bevel look with a 1px white border inside the list item--*/
outline: none;
}
ul.tabs li a:hover {
background: #ccc;
}
html ul.tabs li.active, html ul.tabs li.active a:hover { /*--Makes sure that the active tab does not listen to the hover properties--*/
background: #fff;
border-bottom: 1px solid #fff; /*--Makes the active tab look like it's connected with its content--*/
}
</style>
<div id="edit_settings" style="display:none">
<p><a href="#">edit settings</a></p>
</div>
<div id="possible_councils" style="display:none">
<h2>Please choose council</h2>
<form action="/councils" method="post"><div style="margin:0;padding:0;display:inline"><input name="authenticity_token" type="hidden" value="rhowB+6JDDFwNjgsjwWMh5N2Oyf49SZVCeLb2IiN6lw=" /></div>
<select id="council" name="council"><option value="37">Aberdeen City Council</option>
<option value="38">Allerdale Borough Council</option>
<option value="40">Basildon District Council</option>
<option value="144">Bedford Borough Council</option>
<option value="41">Belfast City Council</option>
<option value="167">Birmingham City Council</option>
<option value="42">Blaby District Council</option>
<option value="112">Blackburn with Darwen Borough Council</option>
<option value="113">Bolton Metropolitan Borough Council</option>
<option value="43">Bracknell Forest Council</option>
<option value="44">Breckland District Council</option>
<option value="45">Brighton and Hove City Council</option>
<option value="149">Bristol City Council</option>
<option value="46">Bromsgrove District Council</option>
<option value="47">Buckinghamshire County Council</option>
<option value="48">Canterbury City Council</option>
<option value="145">Central Bedfordshire Council</option>
<option value="152">Cheltenham Borough Council</option>
<option value="146">Cheshire East</option>
<option value="147">Cheshire West and Chester</option>
<option value="36">City of Westminster</option>
<option value="111">City of York</option>
<option value="53">Cornwall Council</option>
<option value="54">Dartford Borough Council</option>
<option value="117">Derby City Council</option>
<option value="118">Dudley Metropolitan Borough</option>
<option value="168">Durham County Council</option>
<option value="56">East Lindsey District Council</option>
<option value="55">Eastleigh Borough Council</option>
<option value="59">Exeter City</option>
<option value="61">Gloucester City Council</option>
<option value="63">Halton Borough Council</option>
<option value="64">Herefordshire Council</option>
<option value="66">Huntingdonshire District Council</option>
<option value="298">Isle of Wight Council</option>
<option value="68">Kent County Council</option>
<option value="69">Knowsley Metropolitan Borough</option>
<option value="70">Lancaster City Council</option>
<option value="71">Leeds City Council</option>
<option value="303">Leicester City Council</option>
<option value="72">Leicestershire County Council</option>
<option value="156">Lichfield District Council</option>
<option value="306">Lincoln City Council</option>
<option value="73">Liverpool City Council</option>
<option value="19">London Borough of Barking & Dagenham</option>
<option value="20">London Borough of Barnet</option>
<option value="5">London Borough of Bexley</option>
<option value="21">London Borough of Brent</option>
<option value="22">London Borough of Bromley</option>
<option value="25">London Borough of Croydon</option>
<option value="6">London Borough of Enfield</option>
<option value="28">London Borough of Greenwich</option>
<option value="7">London Borough of Hackney</option>
<option value="8">London Borough of Haringey</option>
<option value="9">London Borough of Harrow</option>
<option value="31">London Borough of Hillingdon</option>
<option value="10">London Borough of Hounslow</option>
<option value="32">London Borough of Islington</option>
<option value="12">London Borough of Lambeth</option>
<option value="1">London Borough of Merton</option>
<option value="13">London Borough of Newham</option>
<option value="14">London Borough of Redbridge</option>
<option value="35">London Borough of Richmond upon Thames</option>
<option value="15">London Borough of Southwark</option>
<option value="4">London Borough of Sutton</option>
<option value="16">London Borough of Tower Hamlets</option>
<option value="17">London Borough of Waltham Forest</option>
<option value="2">London Borough of Wandsworth</option>
<option value="74">Maidstone Borough Council</option>
<option value="157">Manchester City Council</option>
<option value="76">Merthyr Tydfil Council</option>
<option value="77">Newcastle upon Tyne City Council</option>
<option value="126">Northamptonshire County Council</option>
<option value="350">Oxford City Council</option>
<option value="85">Preston Borough Council</option>
<option value="11">Royal Borough of Kingston upon Thames</option>
<option value="369">Salford City Council</option>
<option value="89">Sefton Metropolitan Borough Council</option>
<option value="130">Sevenoaks District Council</option>
<option value="90">Slough Borough Council</option>
<option value="93">South Gloucestershire District Council</option>
<option value="98">St Albans City & District Council</option>
<option value="99">St Helens Borough Council</option>
<option value="95">Staffordshire County Council</option>
<option value="96">Stoke-on-Trent City Council</option>
<option value="97">Stratford-on-Avon</option>
<option value="134">Sunderland City Council</option>
<option value="100">Swindon Borough Council</option>
<option value="102">Thanet District Council</option>
<option value="177">West Lothian Council</option>
<option value="108">Wirral Metropolitan Borough</option>
<option value="143">Wolverhampton City Council</option>
<option value="109">Worcester City Council</option>
<option value="110">Wychavon District Council</option></select>
<input name="commit" type="submit" value="Save changes" />
</form></div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
var councilId;
function set_callback(response) {
if (response.get("set_data").hadError()) {
alert("There was an error storing data");
} else {
alert("Successfully updated settings");
}
};
function get_callback(response) {
if (response.get("data").hadError()) {
alert("There was an error getting data");
} else {
var owner = response.get('owner').getData();
var data = response.get("data").getData();
if(owner.isViewer()){$("#edit_settings").show();};
councilId = data[owner.getId()].olCouncilId; //data is indexed by user
if(councilId){
getCouncilData();
}
else{
$("#possible_councils").show();
};
}
};
function getCouncilData() {
var params = {};
params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON;
// This URL returns a JSON-encoded string that represents a JavaScript object
var url = "http://openlylocal.com/councils/" + councilId + ".json";
gadgets.io.makeRequest(url, insertCouncilData, params);
};
function listAll(coll)
{
if(coll.length && coll.length > 0){
var listResult = "<ul>";
for (var i = 0; i < coll.length; i++) {
var li = coll[i];
listResult += listItemFor(li);
}
listResult += "</ul>";
return listResult;
}
else {
return '';
}
}
function listItemFor(obj)
{
var li = "<li>";
li += obj.formatted_date || "";
li += " <a href='" + (obj.openlylocal_url || obj.url) + "' class='openlylocal_page'>";
li += (obj.title || obj.name || (obj.first_name + " " + obj.last_name));
li += "</a>" + (obj.party ? " (" + obj.party + ")" : "");
li += obj.openlylocal_url && obj.url ? (" <a href='" + obj.url + "' class='official_page'>official page</a></li>") : "</li>";
return li;
}
function insertCouncilData(obj)
{
// alert("we are here");
var council = obj.data.council;
var partyBreakdown = [];
var partyBreakdownObj ={};
for (var i = 0; i < council.members.length; i++) {
var p = council.members[i].party;
partyBreakdownObj[p] === undefined ? partyBreakdownObj[p] = 1 : partyBreakdownObj[p] +=1;
}
// turn in to proper array
for (var party in partyBreakdownObj) {
if (partyBreakdownObj.hasOwnProperty(party)) {partyBreakdown.push([partyBreakdownObj[party], party]);}
}
partyBreakdown = partyBreakdown.sort(function (a,b) {return b[0] - a[0]}); //sort with largest first
var recentActivityHtml = "";
var basicInfo = "<h2><a href='" + council.openlylocal_url + "' class='openlylocal_page'>" + council.name + "</a></h2><div class='contact_details'>" + council.address + ", tel: " + council.telephone + ", <a href='" + council.url + "'class='official_page'>" + council.url + "</a></div>";
basicInfo += "<div class='party_breakdown'><strong>" + council.members.length + " councillors</strong> (";
for (var i = 0; i < partyBreakdown.length; i++) {
var p = partyBreakdown[i];
basicInfo += partyBreakdown[i][0] + " " + partyBreakdown[i][1];
if(partyBreakdown.length - i > 1) { basicInfo += ", "; };
}
basicInfo += ")</div>";
var recentActivity = council.recent_activity;
for (var coll in recentActivity) {
if (recentActivity.hasOwnProperty(coll)) {
recentActivityHtml += "<h3>" + recentActivity[coll].length + " new/updated " + coll + "</h3>" + listAll(recentActivity[coll]);
}
}
document.getElementById('basic_info').innerHTML = basicInfo;
document.getElementById('recent_activity').innerHTML = "<h2>Recent Changes</h2>" + recentActivityHtml;
document.getElementById('members').innerHTML = "<h2>Members</h2>" + listAll(council.members);
document.getElementById('committees').innerHTML = "<h2>Committees</h2>" + listAll(council.committees);
// console.log(council.meetings);
if(council.meetings.length > 0){
$("#navigation").show();
document.getElementById('meetings').innerHTML = "<h2>Forthcoming meetings</h2>" + listAll(council.meetings);
}
else{
$("#council_details").show();
}
gadgets.window.adjustHeight();
}
var idspec = opensocial.newIdSpec({ "userId" : "OWNER", "groupId" : "SELF" });
var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER), "owner");
req.add(req.newFetchPersonAppDataRequest(idspec, "olCouncilId"),"data");
req.send(get_callback);
$(document).ready( function() {
$('a.official_page, a.openlylocal_page').live("click", function(event){
window.open(this.href);
return false;
});
$("#possible_councils form").submit(function(){
councilId = $("#possible_councils select").val();
var req = opensocial.newDataRequest();
req.add(req.newUpdatePersonAppDataRequest("VIEWER", "olCouncilId", councilId), "set_data"); //set olCouncilId for viewer (will be irrelevant if not owner of group)
req.send(set_callback);
$('#summary').html("<strong class='alert'>Reloading data...</strong>");
getCouncilData();
$("#possible_councils").hide();
return false;
});
$("#edit_settings a").click(function(){
$("#possible_councils").show();
return false;
});
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
$(activeTab).fadeIn("fast", function(){ gadgets.window.adjustHeight(); }); //Fade in the active ID content
// gadgets.window.adjustHeight();
return false;
});
});
</script>
<div id="basic_info">
Loading...
</div>
<div id="navigation" style="display:none">
<ul class="tabs">
<li class="active"><a href="#summary">Summary</a></li>
<li><a href="#council_details">Members/Committees</a></li>
</ul>
</div>
<div id="main_info" class="tab_container">
<div id="recent_activity" class="collection"></div>
<div id="summary" class="tab_content">
<div id="meetings" class="collection"></div>
</div>
<div id="council_details" style="display:none" class="tab_content">
<div id="members" class="collection">Loading...</div>
<div id="committees" class="collection">Loading...</div>
</div>
</div>
<div id='footer'>More details and info at <a href='http://openlylocal.com' class="openlylocal_page">OpenlyLocal</a> :: Making local government more transparent</div>]]>
</Content>
</Module>