Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 2 additions & 38 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ If you have Docker on your system, use Docker Compose to set up an environment.
Simply run `docker compose up -d` and visit "https://localhost:4443/myradio/".

If you encounter an error with autoload.php:
find the id of your myradio container using `docker dontainer ls`
enter a bash session with `docker exec -it [myradioid] bash`
enter a bash session with `docker compose exec myradio bash`
then in this session run `composer install`
finally exit the session by running `exit`

Expand Down Expand Up @@ -176,42 +175,7 @@ To do this, you first need to:
- Apply for a Season of your new Show (List My Shows -> New Season)
- Schedule the Season (Shows Scheduler)

### Setting up your own 2016-site

First pull [2016-site](https://github.com/UniversityRadioYork/2016-site)

#### database

Next you need a api_key to allow the website to access myradio's show information,

login into database with details used during setup of myradio

`INSERT INTO myury.api_key (key_string, description) VALUES ('ARANDOMSTRINGOFCHARACTERS', '2016-site development api key');`

`INSERT INTO myury.api_key_auth (key_string, typeid) VALUES ('ARANDOMSTRINGOFCHARACTERS', (SELECT typeid FROM l_action WHERE phpconstant = 'AUTH_APISUDO'));`

[please choose a better key than 'ARANDOMSTRINGOFCHARACTERS']

You might need add some other database columns to create shows

for example:

- explict podcasts (to create shows)
- selector (expected by 2016-site/can remove this from models/index.go 2016-site)

2016-site uses parts of database that aren't made on myradio creation,

#### finishing steps

This will fix shows not loading on 2016-site when using the base myradio database

After completing all these setups:

you can use setup guide in [2016-site](https://github.com/UniversityRadioYork/2016-site),
And setup a reverse proxy to "https://localhost:4443/api/v2" or configure ssl for https connections
To complete the setup.

### A note on Seasons and Terms
#### A note on Seasons and Terms

MyRadio splits Shows into "Seasons". Any Season is applied to in relation to a
"Term", which is a user defined space of time (normally 11-15 weeks). This is because The University of York has 12 week semesters, if you didn't know.
2 changes: 1 addition & 1 deletion schema/base.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ CREATE TABLE mail_list (
COMMENT ON TABLE mail_list IS 'Definitions of mailing lists';
COMMENT ON COLUMN mail_list.listid IS 'Surrogate Key';
COMMENT ON COLUMN mail_list.listname IS 'Name of the list';
COMMENT ON COLUMN mail_list.defn IS 'A SQL string that returns fname, nname ,sname and email address.';
COMMENT ON COLUMN mail_list.defn IS 'A SQL string that returns fname ,sname and email address.';
COMMENT ON COLUMN mail_list.toexim IS 'Whether to create a mail alias on the email server for this list.';
COMMENT ON COLUMN mail_list.listaddress IS 'If the list is exported, this is the list''s email address.';
COMMENT ON COLUMN mail_list.subscribable IS 'Whether members can (un)subscribe freely.';
Expand Down
6 changes: 5 additions & 1 deletion src/Classes/MyRadio/MyRadioNews.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ public static function getNewsItem($newsentryid, MyRadio_User $user = null)
$db = Database::getInstance();

$news = $db->fetchOne(
'SELECT newsentryid, fname || \' \' || sname AS author, fname || \' "\' || nname || \'" \' || sname AS nickname, timestamp AS posted, content
'SELECT newsentryid,
CASE WHEN nname IS NULL
THEN fname || \' \' || sname
ELSE fname || \' "\' || nname || \'" \' || sname
END AS name, timestamp AS posted, content
FROM public.news_feed, public.member
WHERE newsentryid=$1
AND news_feed.memberid = member.memberid',
Expand Down
2 changes: 1 addition & 1 deletion src/Classes/ServiceAPI/MyRadio_Season.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public static function create($params = [])
* Select an appropriate value for $term_id.
*/
$term_id = MyRadio_Term::getActiveApplicationTerm()->getID();
$num_weeks = MyRadio_Term::getActiveApplicationTerm()->getTermWeeks();
$num_weeks = MyRadio_Term::getActiveApplicationTerm()->getTermWeeks();

//Start a transaction
self::$db->query('BEGIN');
Expand Down
6 changes: 1 addition & 5 deletions src/Classes/ServiceAPI/MyRadio_Track.php
Original file line number Diff line number Diff line change
Expand Up @@ -634,11 +634,7 @@ public function reportExplicit()

$title = htmlspecialchars($this->getTitle());
$artist = htmlspecialchars($this->getArtist());
if (empty($currentUser->getNName()) == True) {
$userName = htmlspecialchars($currentUser->getFName() . ' ' . $currentUser->getSName());
} else {
$userName = htmlspecialchars($currentUser->getFName() . ' "' . $currentUser->getNName() . '" ' . $currentUser->getSName());
}
$userName = htmlspecialchars($currentUser->getFName() . ' ' . $currentUser->getSName());
$editUrl = URLUtils::makeURL('Library', 'editTrack', ['trackid' => $this->getID()]);
MyRadioEmail::sendEmailToList(
MyRadio_List::getByName('playlisting'),
Expand Down
6 changes: 2 additions & 4 deletions src/Classes/ServiceAPI/MyRadio_User.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ public function getFName()
}

/**
* Returns the User's first name.
* Returns the User's nickname.
*
* @return string The User's first name
*/
Expand Down Expand Up @@ -475,7 +475,6 @@ public function getName()
} else {
return $this->fname.' "'.$this->nname.'" '.$this->sname;
}
return $this->fname.' '.$this->nname.' '.$this->sname;
}

public function getLastLogin()
Expand Down Expand Up @@ -2418,7 +2417,7 @@ public function getEmptyData(){
$data['bio'] = 'This user is hidden';
$data['memberid'] = $this->getID();
$data['fname'] = 'Hidden';
$data['nname'] = 'Hidden';
$data['nname'] = NULL;
$datap['sname'] = 'User';
$data['public_email'] = '';
$data['url'] = $this->getURL();
Expand Down Expand Up @@ -2476,7 +2475,6 @@ public function toDataSource($mixins = [])
'fname' => $this->getFName(),
'nname' => $this->getNName(),
'sname' => $this->getSName(),
//Warning this will leak user emails to public as the api isn't secure
'public_email' => $this->getPublicEmail(),
'url' => $this->getURL(),
'receive_email' => $this->getReceiveEmail(),
Expand Down
31 changes: 16 additions & 15 deletions src/Classes/ServiceAPI/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,33 +57,28 @@ public static function getThisYearsMembers()
return self::getMembersForYear(CoreUtils::getAcademicYear());
}

function rem_inx ($str, $ind)
{
return substr($str,0,$ind++). substr($str,$ind);
}

/**
* Returns an Array representation of the given year's URY Members.
*
* @return array A two-dimensional Array, each element in the first dimension container the following details about
* a member, sorted by their name:
*
* memberid: The user's unique memberid
* name: The user's last and first names formatted as <code>sname, fname</code>
* name: The user's last and first names and possibly nickname formatted as <code>fname "nname" sname</code>
* college: The name of the member's college (not the ID!)
* paid: How much the member has paid this year
*/
public static function getMembersForYear($year)
{
self::wakeup();

/* Adding nickname can cause issues if the nickname is null;
* If you work out a way to have a default value for null values in SQL,
* message me on slack @Ren Herring
*/


$result = self::$db->fetchAll(
'SELECT member.memberid, CONCAT(fname, \', \' ,sname) AS name, fname || \' "\' || nname || \'" \' || sname as nickname, l_college.descr AS college, paid, email, eduroam
'SELECT member.memberid,
CASE WHEN nname IS NULL
THEN fname || \' \' || sname
ELSE fname || \' "\' || nname || \'" \' || sname
END AS name, l_college.descr AS college, paid, email, eduroam
FROM member INNER JOIN (SELECT * FROM member_year WHERE year = $1) AS member_year
ON ( member.memberid = member_year.memberid ), l_college
WHERE member.college = l_college.collegeid
Expand Down Expand Up @@ -114,8 +109,11 @@ public static function getCurrentOfficers()
if (self::$currentOfficers === false) {
self::wakeup();
self::$currentOfficers = self::$db->fetchAll(
'SELECT team.team_name AS team, officer.officer_name AS officership,
sname || \', "\' || nname || \'", \' || fname AS name, member.memberid
'SELECT team.team_name AS team, officer.officer_name AS officership
CASE WHEN nname IS NULL
THEN fname || \' \' || sname
ELSE fname || \' "\' || nname || \'" \' || sname
END AS name, member.memberid
FROM member, officer, member_officer, team
WHERE member_officer.memberid = member.memberid
AND officer.officerid = member_officer.officerid
Expand Down Expand Up @@ -149,7 +147,10 @@ public static function getOfficers()
self::wakeup();
self::$officers = self::$db->fetchAll(
'SELECT team.team_name AS team, officer.type, officer.officer_name AS officership,
fname || \'"\' || nname || \'"\' || sname AS name, member.memberid, officer.officerid
CASE WHEN nname IS NULL
THEN fname || \' \' || sname
ELSE fname || \' "\' || nname || \'" \' || sname
END AS name, member.memberid, officer.officerid
FROM team
LEFT JOIN officer ON team.teamid = officer.teamid AND officer.status = \'c\'
LEFT JOIN member_officer ON officer.officerid = member_officer.officerid
Expand Down
5 changes: 0 additions & 5 deletions src/Public/js/myradio.newslist.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ $(".twig-datatable").dataTable({
{
"sTitle": "Author"
},
//nickname
{
"sTitle": "nickname",
"sClass": "left",
},
//posted
{
"sTitle": "Time"
Expand Down
5 changes: 0 additions & 5 deletions src/Public/js/myradio.profile.list.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ $(".twig-datatable").dataTable({
"sClass": "left",
"aDataSort": [ 1, 2 ]
},
//nickname
{
"sTitle": "Nickname",
"sClass": "left",
},
//college
{
"sTitle": "College"
Expand Down
16 changes: 8 additions & 8 deletions src/Public/js/myradio.scheduler.termlist.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
$(".twig-datatable").dataTable({
"aaSorting": [[2, "desc"]],
"aaSorting": [[4, "desc"]],
"aoColumns": [
//termid
{
"bVisible": false
},
//start
{
"sTitle": "Start Date"
},
//descr
{
"sTitle": "Name"
},
//num_weeks
{
"bVisible": false
"bVisible": true
},
//week_names
{
"bVisible": false,
"bVisible": false
},
//start
{
"sTitle": "Start Date"
}
],
"bPaginate": true
});
});
21 changes: 13 additions & 8 deletions src/Public/js/myradio.timeslot.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
//Name helper function for concating names;
function NameHelper(data) {
if (empty(data[row].user.nname) != false) {
return data[row].user.fname + ' "' + data[row].user.nname + '" ' + data[row].user.sname;
}
else {
return data[row].user.fname + " " + data[row].user.sname;
}
}


/* global moment, myradio */
/**
* Handles the interactivityness of timeslot selection
Expand Down Expand Up @@ -69,14 +80,8 @@ $("#timeslots").on(
check.attr("name", "signin[]")
.attr("id", "signin_"+data[row].user.memberid)
.attr("value", data[row].user.memberid);
if (empty(data[row].user.nname) != false) {
label.attr("for", "signin_"+data[row].user.memberid)
.html(data[row].user.fname + ' "' + data[row].user.nname + '" ' + data[row].user.sname);
}
else {
label.attr("for", "signin_"+data[row].user.memberid)
.html(data[row].user.fname + " " + data[row].user.sname);
}
label.attr("for", "signin_"+data[row].user.memberid)
.html(NameHelper(data));
if (data[row].signedby !== null) {
check.attr("checked", "checked")
.attr("disabled", "true");
Expand Down
2 changes: 1 addition & 1 deletion src/Templates/MyRadio/getOnAir.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<!--Pay Membership-->
<li>
<a href="{{ config.payment_url }}" target="_blank" title="Before we can let you use our shiny and expensive studio, you'll need to pay membership. Click here to do so on the YORKSU website now.">Become a Paid Member
<a href="{{ config.payment_url }}" target="_blank" title="Before we can let you use our shiny and expensive studio, you'll need to pay membership. Click here to do so on the YorkSU website now.">Become a Paid Member
{% if config.base_url not in config.payment_url %}
&nbsp;<span class="glyphicon glyphicon-new-window" aria-hidden="true"></span>
{% endif %}</a>
Expand Down
2 changes: 1 addition & 1 deletion src/Templates/Profile/user.twig
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
<em>by <a href="{{train.awarded_by.url}}">{{train.awarded_by.value}}</a>
{% if train.revoked_by %}
, revoked on {{train.revoked_time|date("j/n/Y")}} by
<a href="{{train.revoked_by.url}}"> {{train.revoked_by.fname}} {{train.revoked_by.sname}}</a>
<a href="{{train.revoked_by.url}}">{{train.revoked_by.fname}} {{train.revoked_by.sname}}</a>
{% endif %}
</em>
</li>
Expand Down