Commit 255f8db3 authored by Imran Hussain's avatar Imran Hussain

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

parents 3d386b9c d788d45f
# 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
fake-deploy-live:
stage: deploy
script:
- echo "Hello World!"
only:
- sucs-site
\ No newline at end of file
# 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
<br>
......
......@@ -24,6 +24,8 @@ if (count($members->memberView($who)) > 0) {
header("Location: https://$preferred_hostname$baseurl/Community/Members/$who");
} else {
// 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 ($session->loggedin) {
include("../lib/banana-admin.php");
......@@ -37,7 +39,6 @@ if (count($members->memberView($who)) > 0) {
if (isset($who))
$smarty->assign('who', "$who");
$smarty->assign('mode', "$mode");
$smarty->assign('users', $users);
......
......@@ -32,7 +32,9 @@ if ($session->loggedin) {
if (count($usernames) == 1) {
$smarty->assign('who', $usernames[0]['uid']);
// 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");
// Needs Redirection
if ($uid) {
......
......@@ -204,6 +204,7 @@ CREATE TABLE election_votes (
treasurer text,
secretary text,
publicity text,
gaming text,
ipaddress text
);
......@@ -2100,7 +2101,7 @@ COPY menu (id, title, parent, menuorder, target, title_cy, permission) FROM stdi
19 Members 16 1 /Community/Members Aelodau \N
20 Societies 16 2 /Community/Societies Cymdeithasau \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
16 Community \N 4 /Community Cymuned \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
*/
function addEvent( obj, type, fn )
{
if (obj.addEventListener)
obj.addEventListener( type, fn, false );
else if (obj.attachEvent)
{
obj["e"+type+fn] = fn;
obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
obj.attachEvent( "on"+type, obj[type+fn] );
}
addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
*/
function addEvent(obj, type, fn) {
if (obj.addEventListener)
obj.addEventListener(type, fn, false);
else if (obj.attachEvent) {
obj["e" + type + fn] = fn;
obj[type + fn] = function () {
obj["e" + type + fn](window.event);
};
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) {
if (typeof document.createElementNS != 'undefined') {
return document.createElementNS('http://www.w3.org/1999/xhtml', element);
}
if (typeof document.createElement != 'undefined') {
return document.createElement(element);
}
return false;
if (typeof document.createElementNS != 'undefined') {
return document.createElementNS('http://www.w3.org/1999/xhtml', element);
}
if (typeof document.createElement != 'undefined') {
return document.createElement(element);
}
return false;
}
function insertTop(obj) {
// Create the two div elements needed for the top of the box
d=createElement("div");
d.className="bt"; // The outer div needs a class name
d2=createElement("div");
// Create the two div elements needed for the top of the box
d = createElement("div");
d.className = "bt"; // The outer div needs a class name
d2 = createElement("div");
d.appendChild(d2);
obj.insertBefore(d,obj.firstChild);
obj.insertBefore(d, obj.firstChild);
}
function insertBottom(obj) {
// Create the two div elements needed for the bottom of the box
d=createElement("div");
d.className="bb"; // The outer div needs a class name
d2=createElement("div");
// Create the two div elements needed for the bottom of the box
d = createElement("div");
d.className = "bb"; // The outer div needs a class name
d2 = createElement("div");
d.appendChild(d2);
obj.appendChild(d);
obj.appendChild(d);
}
function initCB()
{
// Find all div elements
var divs = document.getElementsByTagName('div');
var cbDivs = [];
for (var i = 0; i < divs.length; i++) {
// Find all div elements with cbb in their class attribute while allowing for multiple class names
if (/\bcbb\b/.test(divs[i].className))
cbDivs[cbDivs.length] = divs[i];
}
// Loop through the found div elements
var thediv, outer, i1, i2;
for (var i = 0; i < cbDivs.length; i++) {
// Save the original outer div for later
thediv = cbDivs[i];
// Create a new div, give it the original div's class attribute, and replace 'cbb' with 'cb'
outer = createElement('div');
outer.className = thediv.className;
outer.className = thediv.className.replace('cbb', 'cb');
// Change the original div's class name and replace it with the new div
thediv.className = 'i3';
thediv.parentNode.replaceChild(outer, thediv);
// Create two new div elements and insert them into the outermost div
i1 = createElement('div');
i1.className = 'i1';
outer.appendChild(i1);
i2 = createElement('div');
i2.className = 'i2';
i1.appendChild(i2);
// Insert the original div
i2.appendChild(thediv);
// Insert the top and bottom divs
insertTop(outer);
insertBottom(outer);
}
function initCB() {
// Find all div elements
var divs = document.getElementsByTagName('div');
var cbDivs = [];
for (var i = 0; i < divs.length; i++) {
// Find all div elements with cbb in their class attribute while allowing for multiple class names
if (/\bcbb\b/.test(divs[i].className))
cbDivs[cbDivs.length] = divs[i];
}
// Loop through the found div elements
var thediv, outer, i1, i2;
for (var j = 0; j < cbDivs.length; j++) {
// Save the original outer div for later
thediv = cbDivs[j];
// Create a new div, give it the original div's class attribute, and replace 'cbb' with 'cb'
outer = createElement('div');
outer.className = thediv.className;
outer.className = thediv.className.replace('cbb', 'cb');
// Change the original div's class name and replace it with the new div
thediv.className = 'i3';
thediv.parentNode.replaceChild(outer, thediv);
// Create two new div elements and insert them into the outermost div
i1 = createElement('div');
i1.className = 'i1';
outer.appendChild(i1);
i2 = createElement('div');
i2.className = 'i2';
i1.appendChild(i2);
// Insert the original div
i2.appendChild(thediv);
// Insert the top and bottom divs
insertTop(outer);
insertBottom(outer);
}
}
if(document.getElementById && document.createTextNode)
{
addEvent(window, 'load', initCB);
if (document.getElementById && document.createTextNode) {
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 = {
var submitted = false;
function validate() {
var valid = true;
var field;
for (field in req) {
if (!validation[req[field]]) {
valid = false;
......@@ -37,16 +38,16 @@ function processPostcode() {
$('div#addseldiv').removeAttr("style");
for (var i = 0; i < (j.addresses.length); i++) {
options += '<option>';
if (j.addresses[i].flat != null) {
if (j.addresses[i].flat !== null) {
options += j.addresses[i].flat + "\n";
}
if (j.addresses[i].house != null) {
if (j.addresses[i].house !== null) {
options += j.addresses[i].house + "\n";
}
if (j.addresses[i].road != null) {
if (j.addresses[i].road !== null) {
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 += '</option>';
......@@ -56,13 +57,13 @@ function processPostcode() {
}
if (j.addresses.length == 1) {
$('div#addseldiv').attr("style", "display:none");
$("textarea#address")
$("textarea#address");
$('div#addressmessage').attr("style", "color:green; float:right; clear:right;");
$('div#addressmessage').html("OK");
validation["address"] = true;
validation.address = true;
validate();
}
})
});
}
function lookupSID(setname) {
......@@ -71,21 +72,21 @@ function lookupSID(setname) {
key = arr.shift();
val = arr.join(":");
if (key == "OK") {
if (setname = true)
if (setname === true)
$("input#realname").val(val);
$('div#studentidmessage').attr("style", "color:green; float:right; clear:right;");
$('div#studentidmessage').html(key);
validation['studentid'] = true;
validation.studentid = true;
processName("realname", "realname");
}
else {
$('div#studentidmessage').attr("style", "color:red; float:right; clear:right;");
$('div#studentidmessage').html(val);
validation['email'] = false;
validation.email = false;
validate();
}
}, 'text')
}, 'text');
}
function processSID() {
lookupSID(true);
......@@ -95,15 +96,15 @@ function processUsername() {
$.get("/signup/ajax", {key: "username", value: $('input#username').val()}, function (j) {
if (j != "OK") {
$('div#usernamemessage').attr("style", "color:red; float:right; clear:right;");
validation['username'] = false;
validation.username = false;
}
else {
$('div#usernamemessage').attr("style", "color:green; float:right; clear:right;");
validation['username'] = true;
validation.username = true;
}
$('div#usernamemessage').html(j);
validate();
}, 'text')
}, 'text');
}
function processName(type, input) {
......@@ -118,7 +119,7 @@ function processName(type, input) {
}
$('div#' + input + 'message').html(j);
validate();
}, 'text')
}, 'text');
}
function processContact() {
processName('realname', 'contact');
......@@ -128,45 +129,45 @@ function processAddress() {
$.get("/signup/ajax", {key: "address", value: $('textarea#address').val()}, function (j) {
if (j != "OK") {
$('div#addressmessage').attr("style", "color:red; float:right; clear:right;");
validation['address'] = false;
validation.address = false;
}
else {
$('div#addressmessage').attr("style", "color:green; float:right; clear:right;");
validation['address'] = true;
validation.address = true;
}
$('div#addressmessage').html(j);
validate();
}, 'text')
}, 'text');
}
function processEmail() {
$.get("/signup/ajax", {key: "email", value: $('input#email').val()}, function (j) {
if (j != "OK") {
$('div#emailmessage').attr("style", "color:red; float:right; clear:right;");
validation['email'] = false;
validation.email = false;
}
else {
$('div#emailmessage').attr("style", "color:green; float:right; clear:right;");
validation['email'] = true;
validation.email = true;
}
$('div#emailmessage').html(j);
validate();
}, 'text')
}, 'text');
}
function processPhone() {
$.get("/signup/ajax", {key: "phone", value: $('input#phone').val()}, function (j) {
if (j != "OK") {
$('div#phonemessage').attr("style", "color:red; float:right; clear:right;");
validation['phone'] = false;
validation.phone = false;
}
else {
$('div#phonemessage').attr("style", "color:green; float:right; clear:right;");
validation['phone'] = true;
validation.phone = true;
}
$('div#phonemessage').html(j);
validate();
}, 'text')
}, 'text');
}
$(function () {
......@@ -196,25 +197,25 @@ $(function () {
$('div#postcodediv').removeAttr("style");
$('input#submit').attr("disabled", "disabled");
// if the fields are not empty validate them
if ($('input#username').val() != "") processUsername();
if ($('input#email').val() != "") processEmail();
if ($('input#phone').val() != "") processPhone();
if (usertype != 2) {
if ($('input#postcode').val() != "") processPostcode();
if ($('textarea#address').val() != "") processAddress();
if ($('input#realname').val() != "") processName("realname", "realname");
if ($('input#username').val() !== "") processUsername();
if ($('input#email').val() !== "") processEmail();
if ($('input#phone').val() !== "") processPhone();
if (usertype !== 2) {
if ($('input#postcode').val() !== "") processPostcode();
if ($('textarea#address').val() !== "") processAddress();
if ($('input#realname').val() !== "") processName("realname", "realname");
}
else {
if ($('input#contact').val() != "") processContact();
if ($('input#realname').val() != "") processName("socname", "realname");
if ($('input#contact').val() !== "") processContact();
if ($('input#realname').val() !== "") processName("socname", "realname");
}
if ((usertype == 1) && ($('input#studentid').val() != "")) {
if ($('input#realname').val() == "") lookupSID(true);
if ((usertype == 1) && ($('input#studentid').val() !== "")) {
if ($('input#realname').val() === "") lookupSID(true);
else lookupSID(false);
}
validate();
})
});
// dont do address stuff for societies
if (usertype != 2) {
// process postcode when the box changes
......@@ -234,21 +235,21 @@ $(function () {
$("textarea#address").text(strUser);
$('div#addressmessage').attr("style", "color:green; float:right; clear:right;");
$('div#addressmessage').html("OK");
validation['address'] = true;
})
validation.address = true;
});
}
//else deal with the contact field
else {
$("input#contact").change(processContact)
$("input#contact").change(processContact);
}
//if is a student
if (usertype == 1) {
//lookup the real name from the studentid
$("input#studentid").change(processSID)
$("input#studentid").change(processSID);
}
//validate username
$("input#username").change(processUsername)
$("input#username").change(processUsername);
//validate personal and society names differntly
if (usertype != 2) {
persoc = 'realname';
......@@ -259,7 +260,7 @@ $(function () {
//validate real name
$("input#realname").change(function () {
processName(persoc, 'realname');