Commit da693964 authored by Imran Hussain's avatar Imran Hussain

Merge remote-tracking branch 'upstream/master' into redesign

Conflicts:
	static/About/Room-secondary.txt
	static/About/Room.txt
	templates/head.tpl
	templates/index.tpl
parents 3d386b9c c5966e6f
# specify what docker image
# go with the default image for now and mangle it
#image: ruby:2.1
stages:
- test
- deploy
#before_script:
php-syntax-check:
stage: test
script:
- apt-get clean
- apt-get update
- apt-get install -y php5-cli
- php -l htdocs/index.php
- find components -name *.php | xargs -n 1 php -l
- find plugins -name *.php | xargs -n 1 php -l
- find lib -name *.php | xargs -n 1 php -l
js-syntax-check:
stage: test
script:
- apt-get clean
- apt-get update
- apt-get install -y npm
- ln -s /usr/bin/nodejs /usr/bin/node
- npm install -g jshint
- find htdocs/js/ -name *.js ! -name jquery* | xargs -n 1 jshint --verbose
fake-deploy-beta:
stage: deploy
script:
- echo "Hello World!"
only:
- beta
environment: beta
fake-deploy-live:
stage: deploy
script:
- echo "Hello World!"
only:
- sucs-site
environment: live
\ No newline at end of file
# SUCS Site # SUCS Site
[![build status](https://projects.sucs.org/ci/projects/2/status.png?ref=master)](https://projects.sucs.org/ci/projects/2?ref=master)
--- ---
## Project Structure ## Project Structure
<br> <br>
......
...@@ -24,6 +24,8 @@ if (count($members->memberView($who)) > 0) { ...@@ -24,6 +24,8 @@ if (count($members->memberView($who)) > 0) {
header("Location: https://$preferred_hostname$baseurl/Community/Members/$who"); header("Location: https://$preferred_hostname$baseurl/Community/Members/$who");
} else { } else {
// banana admin bits // banana admin bits
// Tell the banana library that the person/organisation/thing we're dealing with isn't a SUCS member
$isnonmember = true;
if ($mode == "detail") { if ($mode == "detail") {
if ($session->loggedin) { if ($session->loggedin) {
include("../lib/banana-admin.php"); include("../lib/banana-admin.php");
...@@ -37,7 +39,6 @@ if (count($members->memberView($who)) > 0) { ...@@ -37,7 +39,6 @@ if (count($members->memberView($who)) > 0) {
if (isset($who)) if (isset($who))
$smarty->assign('who', "$who"); $smarty->assign('who', "$who");
$smarty->assign('mode', "$mode"); $smarty->assign('mode', "$mode");
$smarty->assign('users', $users); $smarty->assign('users', $users);
......
...@@ -32,7 +32,9 @@ if ($session->loggedin) { ...@@ -32,7 +32,9 @@ if ($session->loggedin) {
if (count($usernames) == 1) { if (count($usernames) == 1) {
$smarty->assign('who', $usernames[0]['uid']); $smarty->assign('who', $usernames[0]['uid']);
// Add banana widget to the sidebar // Add banana widget to the sidebar
$who = $usernames[0]['uid']; $who = $usernames[0]['uid'];
//Tell the banana library that we're dealing with a real member
$isnonmember = false;
include("../lib/banana-admin.php"); include("../lib/banana-admin.php");
// Needs Redirection // Needs Redirection
if ($uid) { if ($uid) {
......
...@@ -128,16 +128,8 @@ if (isset($_REQUEST['signupid']) && isset($_REQUEST['signuppw'])) { ...@@ -128,16 +128,8 @@ if (isset($_REQUEST['signupid']) && isset($_REQUEST['signuppw'])) {
); );
$failed = true; $failed = true;
} else { } else {
// determine the uid range //generate the new uid
if ($row[type] == 2) { $uid = generateUid();
$baseuid = 8;
} else {
$baseuid = 29;
}
$minuid = $baseuid * 1000;
$maxuid = $minuid + 999;
//get the new uid
$uid = findUid($minuid, $maxuid);
// make a password // make a password
$password = make_password(); $password = make_password();
// make the ldif // make the ldif
......
...@@ -204,6 +204,7 @@ CREATE TABLE election_votes ( ...@@ -204,6 +204,7 @@ CREATE TABLE election_votes (
treasurer text, treasurer text,
secretary text, secretary text,
publicity text, publicity text,
gaming text,
ipaddress text ipaddress text
); );
...@@ -2100,7 +2101,7 @@ COPY menu (id, title, parent, menuorder, target, title_cy, permission) FROM stdi ...@@ -2100,7 +2101,7 @@ COPY menu (id, title, parent, menuorder, target, title_cy, permission) FROM stdi
19 Members 16 1 /Community/Members Aelodau \N 19 Members 16 1 /Community/Members Aelodau \N
20 Societies 16 2 /Community/Societies Cymdeithasau \N 20 Societies 16 2 /Community/Societies Cymdeithasau \N
33 Desktop on Demand 8 5 /Tools/Desktop on Demand \N \N 33 Desktop on Demand 8 5 /Tools/Desktop on Demand \N \N
34 Projects 16 8 /Community/Projects \N \N 34 Projects 16 8 https://projects.sucs.org/explore \N \N
3 About \N 2 /About Amdano \N 3 About \N 2 /About Amdano \N
16 Community \N 4 /Community Cymuned \N 16 Community \N 4 /Community Cymuned \N
37 Talks 16 5 /Community/Talks \N \N 37 Talks 16 5 /Community/Talks \N \N
......
/* /*
addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
*/ */
function addEvent( obj, type, fn ) function addEvent(obj, type, fn) {
{ if (obj.addEventListener)
if (obj.addEventListener) obj.addEventListener(type, fn, false);
obj.addEventListener( type, fn, false ); else if (obj.attachEvent) {
else if (obj.attachEvent) obj["e" + type + fn] = fn;
{ obj[type + fn] = function () {
obj["e"+type+fn] = fn; obj["e" + type + fn](window.event);
obj[type+fn] = function() { obj["e"+type+fn]( window.event ); } };
obj.attachEvent( "on"+type, obj[type+fn] ); obj.attachEvent("on" + type, obj[type + fn]);
} }
} }
/* /*
createElement function found at http://simon.incutio.com/archive/2003/06/15/javascriptWithXML createElement function found at http://simon.incutio.com/archive/2003/06/15/javascriptWithXML
*/ */
function createElement(element) { function createElement(element) {
if (typeof document.createElementNS != 'undefined') { if (typeof document.createElementNS != 'undefined') {
return document.createElementNS('http://www.w3.org/1999/xhtml', element); return document.createElementNS('http://www.w3.org/1999/xhtml', element);
} }
if (typeof document.createElement != 'undefined') { if (typeof document.createElement != 'undefined') {
return document.createElement(element); return document.createElement(element);
} }
return false; return false;
} }
function insertTop(obj) { function insertTop(obj) {
// Create the two div elements needed for the top of the box // Create the two div elements needed for the top of the box
d=createElement("div"); d = createElement("div");
d.className="bt"; // The outer div needs a class name d.className = "bt"; // The outer div needs a class name
d2=createElement("div"); d2 = createElement("div");
d.appendChild(d2); d.appendChild(d2);
obj.insertBefore(d,obj.firstChild); obj.insertBefore(d, obj.firstChild);
} }
function insertBottom(obj) { function insertBottom(obj) {
// Create the two div elements needed for the bottom of the box // Create the two div elements needed for the bottom of the box
d=createElement("div"); d = createElement("div");
d.className="bb"; // The outer div needs a class name d.className = "bb"; // The outer div needs a class name
d2=createElement("div"); d2 = createElement("div");
d.appendChild(d2); d.appendChild(d2);
obj.appendChild(d); obj.appendChild(d);
} }
function initCB() function initCB() {
{ // Find all div elements
// Find all div elements var divs = document.getElementsByTagName('div');
var divs = document.getElementsByTagName('div'); var cbDivs = [];
var cbDivs = []; for (var i = 0; i < divs.length; i++) {
for (var i = 0; i < divs.length; i++) { // Find all div elements with cbb in their class attribute while allowing for multiple class names
// Find all div elements with cbb in their class attribute while allowing for multiple class names if (/\bcbb\b/.test(divs[i].className))
if (/\bcbb\b/.test(divs[i].className)) cbDivs[cbDivs.length] = divs[i];
cbDivs[cbDivs.length] = divs[i]; }
} // Loop through the found div elements
// Loop through the found div elements var thediv, outer, i1, i2;
var thediv, outer, i1, i2; for (var j = 0; j < cbDivs.length; j++) {
for (var i = 0; i < cbDivs.length; i++) { // Save the original outer div for later
// Save the original outer div for later thediv = cbDivs[j];
thediv = cbDivs[i]; // Create a new div, give it the original div's class attribute, and replace 'cbb' with 'cb'
// Create a new div, give it the original div's class attribute, and replace 'cbb' with 'cb' outer = createElement('div');
outer = createElement('div'); outer.className = thediv.className;
outer.className = thediv.className; outer.className = thediv.className.replace('cbb', 'cb');
outer.className = thediv.className.replace('cbb', 'cb'); // Change the original div's class name and replace it with the new div
// Change the original div's class name and replace it with the new div thediv.className = 'i3';
thediv.className = 'i3'; thediv.parentNode.replaceChild(outer, thediv);
thediv.parentNode.replaceChild(outer, thediv); // Create two new div elements and insert them into the outermost div
// Create two new div elements and insert them into the outermost div i1 = createElement('div');
i1 = createElement('div'); i1.className = 'i1';
i1.className = 'i1'; outer.appendChild(i1);
outer.appendChild(i1); i2 = createElement('div');
i2 = createElement('div'); i2.className = 'i2';
i2.className = 'i2'; i1.appendChild(i2);
i1.appendChild(i2); // Insert the original div
// Insert the original div i2.appendChild(thediv);
i2.appendChild(thediv); // Insert the top and bottom divs
// Insert the top and bottom divs insertTop(outer);
insertTop(outer); insertBottom(outer);
insertBottom(outer); }
}
} }
if(document.getElementById && document.createTextNode) if (document.getElementById && document.createTextNode) {
{ addEvent(window, 'load', initCB);
addEvent(window, 'load', initCB);
} }
\ No newline at end of file
/*
Correctly handle PNG transparency in Win IE 5.5 & 6.
http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.
Use in <HEAD> with DEFER keyword wrapped in conditional comments:
<!--[if lt IE 7]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->
*/
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])
if ((version >= 5.5) && (document.body.filters))
{
for(var i=0; i<document.images.length; i++)
{
var img = document.images[i]
var imgName = img.src.toUpperCase()
if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
{
var imgID = (img.id) ? "id='" + img.id + "' " : ""
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
if (img.align == "left") imgStyle = "float:left;" + imgStyle
if (img.align == "right") imgStyle = "float:right;" + imgStyle
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
img.outerHTML = strNewHTML
i = i-1
}
}
}
...@@ -10,6 +10,7 @@ var validation = { ...@@ -10,6 +10,7 @@ var validation = {
var submitted = false; var submitted = false;
function validate() { function validate() {
var valid = true; var valid = true;
var field;
for (field in req) { for (field in req) {
if (!validation[req[field]]) { if (!validation[req[field]]) {
valid = false; valid = false;
...@@ -37,16 +38,16 @@ function processPostcode() { ...@@ -37,16 +38,16 @@ function processPostcode() {
$('div#addseldiv').removeAttr("style"); $('div#addseldiv').removeAttr("style");
for (var i = 0; i < (j.addresses.length); i++) { for (var i = 0; i < (j.addresses.length); i++) {
options += '<option>'; options += '<option>';
if (j.addresses[i].flat != null) { if (j.addresses[i].flat !== null) {
options += j.addresses[i].flat + "\n"; options += j.addresses[i].flat + "\n";
} }
if (j.addresses[i].house != null) { if (j.addresses[i].house !== null) {
options += j.addresses[i].house + "\n"; options += j.addresses[i].house + "\n";
} }
if (j.addresses[i].road != null) { if (j.addresses[i].road !== null) {
options += j.addresses[i].road + "\n"; options += j.addresses[i].road + "\n";
} }
if (j.addresses[i].city != null) { if (j.addresses[i].city !== null) {
options += j.addresses[i].city + "\n"; options += j.addresses[i].city + "\n";
} }
options += '</option>'; options += '</option>';
...@@ -56,13 +57,13 @@ function processPostcode() { ...@@ -56,13 +57,13 @@ function processPostcode() {
} }
if (j.addresses.length == 1) { if (j.addresses.length == 1) {
$('div#addseldiv').attr("style", "display:none"); $('div#addseldiv').attr("style", "display:none");
$("textarea#address") $("textarea#address");
$('div#addressmessage').attr("style", "color:green; float:right; clear:right;"); $('div#addressmessage').attr("style", "color:green; float:right; clear:right;");
$('div#addressmessage').html("OK"); $('div#addressmessage').html("OK");
validation["address"] = true; validation.address = true;
validate(); validate();
} }
}) });
} }
function lookupSID(setname) { function lookupSID(setname) {
...@@ -71,21 +72,21 @@ function lookupSID(setname) { ...@@ -71,21 +72,21 @@ function lookupSID(setname) {
key = arr.shift(); key = arr.shift();
val = arr.join(":"); val = arr.join(":");
if (key == "OK") { if (key == "OK") {
if (setname = true) if (setname === true)
$("input#realname").val(val); $("input#realname").val(val);
$('div#studentidmessage').attr("style", "color:green; float:right; clear:right;"); $('div#studentidmessage').attr("style", "color:green; float:right; clear:right;");
$('div#studentidmessage').html(key); $('div#studentidmessage').html(key);
validation['studentid'] = true; validation.studentid = true;
processName("realname", "realname"); processName("realname", "realname");
} }
else { else {
$('div#studentidmessage').attr("style", "color:red; float:right; clear:right;"); $('div#studentidmessage').attr("style", "color:red; float:right; clear:right;");
$('div#studentidmessage').html(val); $('div#studentidmessage').html(val);
validation['email'] = false; validation.email = false;
validate(); validate();
} }
}, 'text') }, 'text');
} }
function processSID() { function processSID() {
lookupSID(true); lookupSID(true);
...@@ -95,15 +96,15 @@ function processUsername() { ...@@ -95,15 +96,15 @@ function processUsername() {
$.get("/signup/ajax", {key: "username", value: $('input#username').val()}, function (j) { $.get("/signup/ajax", {key: "username", value: $('input#username').val()}, function (j) {
if (j != "OK") { if (j != "OK") {
$('div#usernamemessage').attr("style", "color:red; float:right; clear:right;"); $('div#usernamemessage').attr("style", "color:red; float:right; clear:right;");
validation['username'] = false; validation.username = false;
} }
else { else {
$('div#usernamemessage').attr("style", "color:green; float:right; clear:right;"); $('div#usernamemessage').attr("style", "color:green; float:right; clear:right;");
validation['username'] = true; validation.username = true;
} }
$('div#usernamemessage').html(j); $('div#usernamemessage').html(j);
validate(); validate();
}, 'text') }, 'text');
} }
function processName(type, input) { function processName(type, input) {
...@@ -118,7 +119,7 @@ function processName(type, input) { ...@@ -118,7 +119,7 @@ function processName(type, input) {
} }
$('div#' + input + 'message').html(j); $('div#' + input + 'message').html(j);
validate(); validate();
}, 'text') }, 'text');
} }
function processContact() { function processContact() {
processName('realname', 'contact'); processName('realname', 'contact');
...@@ -128,45 +129,45 @@ function processAddress() { ...@@ -128,45 +129,45 @@ function processAddress() {
$.get("/signup/ajax", {key: "address", value: $('textarea#address').val()}, function (j) { $.get("/signup/ajax", {key: "address", value: $('textarea#address').val()}, function (j) {
if (j != "OK") { if (j != "OK") {
$('div#addressmessage').attr("style", "color:red; float:right; clear:right;"); $('div#addressmessage').attr("style", "color:red; float:right; clear:right;");
validation['address'] = false; validation.address = false;
} }
else { else {
$('div#addressmessage').attr("style", "color:green; float:right; clear:right;"); $('div#addressmessage').attr("style", "color:green; float:right; clear:right;");
validation['address'] = true; validation.address = true;
} }
$('div#addressmessage').html(j); $('div#addressmessage').html(j);
validate(); validate();
}, 'text') }, 'text');