Commit c493ef87 authored by Mike Sheldon's avatar Mike Sheldon

Add submenu facility

Add submenu to user pages
Add page heading into content-top
Use content-top page heading for user pages
Move user's loved radio player to separate page
Make profile editing a sub page of user pages
parent 53ddb41c
......@@ -6,6 +6,7 @@ RewriteRule ^user/([^/]+)/journal/?$ user-journal.php
RewriteRule ^user/([^/]+)/groups/?$ user-groups.php?user=$1 [B,NC]
RewriteRule ^user/([^/]+)/recent-tracks/?$ user-recent-tracks.php?user=$1 [B,NC,QSA]
RewriteRule ^user/([^/]+)/stats/?$ user-stats.php?user=$1 [B,NC]
RewriteRule ^user/([^/]+)/station/?$ user-station.php?user=$1 [B,NC]
RewriteRule ^artist/([^/]+)/track/([^/]+)/?$ track.php?artist=$1&track=$2 [B,NC]
RewriteRule ^artist/([^/]+)/album/([^/]+)/track/([^/]+)/?$ track.php?artist=$1&album=$2&track=$3 [B,NC]
RewriteRule ^artist/([^/]+)/album/add/?$ album-add.php?artist=$1 [B,NC]
......
......@@ -21,6 +21,7 @@
require_once('database.php');
require_once('templating.php');
require_once('user-menu.php');
require_once('data/User.php');
require_once('data/TagCloud.php');
......@@ -180,6 +181,12 @@ if(isset($this_user->name))
$aTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable('user'), 'artist', 40, $this_user->uniqueid, "userid");
$smarty->assign('tagcloud', $aTagCloud);
} catch (exception $e) {}
$submenu = user_menu($this_user, 'Edit Profile');
$smarty->assign('submenu', $submenu);
$smarty->assign('me', $this_user);
$smarty->assign('pageheader', 'maxiprofile.tpl');
$smarty->assign('errors', $errors);
$smarty->display('user-edit.tpl');
}
......
<?
/* GNU FM -- a free network service for sharing your music listening habits
Copyright (C) 2009 Free Software Foundation, Inc
This program 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.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function user_menu($user, $active_page) {
global $this_user;
$submenu = array(
array('name' => 'Overview', 'url' => $user->getURL()),
array('name' => 'Stats', 'url' => $user->getURL('stats')),
array('name' => 'Recent Tracks', 'url' => $user->getURL('recent-tracks'))
);
if($user->hasLoved()) {
$submenu[] = array('name' => 'Radio Station', 'url' => $user->getURL('station'));
}
if($user->name == $this_user->name) {
$submenu[] = array('name' => 'Edit Profile', 'url' => $user->getURL('edit'));
}
foreach ($submenu as &$item) {
$item['active'] = ($item['name'] == $active_page);
}
return $submenu;
}
?>
......@@ -20,6 +20,7 @@
*/
require_once('database.php');
require_once('user-menu.php');
require_once('templating.php');
require_once('data/User.php');
require_once('data/TagCloud.php');
......@@ -53,14 +54,6 @@ if(isset($user->name)) {
$smarty->assign('me', $user);
$smarty->assign('pagetitle', $user->name);
$station = 'librefm://user/' . $user->name . '/loved';
if(isset($this_user)) {
$radio_session = $this_user->getRadioSession($station);
} else {
$radio_session = Server::getRadioSession($station);
}
$smarty->assign('radio_session', $radio_session);
$smarty->assign('extra_head_links', array(
array(
'rel'=>'alternate',
......@@ -82,6 +75,11 @@ if(isset($user->name)) {
)
));
$submenu = user_menu($user, 'Overview');
$smarty->assign('submenu', $submenu);
$smarty->assign('pageheader', 'maxiprofile.tpl');
$smarty->display('user-profile.tpl');
} else {
$smarty->assign('error', $error);
......
......@@ -21,6 +21,7 @@
require_once('database.php');
require_once('templating.php');
require_once('user-menu.php');
require_once('data/User.php');
require_once('data/TagCloud.php');
require_once('data/Server.php');
......@@ -70,6 +71,10 @@ if(isset($user->name)) {
)
));
$submenu = user_menu($user, 'Recent Tracks');
$smarty->assign('submenu', $submenu);
$smarty->assign('pageheader', 'maxiprofile.tpl');
$smarty->display('user-recent-tracks.tpl');
} else {
$smarty->assign('error', 'User not found');
......
......@@ -21,6 +21,7 @@
require_once('database.php');
require_once('templating.php');
require_once('user-menu.php');
require_once('data/User.php');
require_once('data/TagCloud.php');
require_once('data/Statistic.php');
......@@ -85,6 +86,10 @@ try {
)
));
$submenu = user_menu($user, 'Stats');
$smarty->assign('submenu', $submenu);
$smarty->assign('pageheader', 'maxiprofile.tpl');
$smarty->assign('stats', true);
$smarty->display('user-stats.tpl');
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment