librefm-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Librefm-commits] [1059] Add "recent tracks" page to profiles.


From: Toby Inkster
Subject: [Librefm-commits] [1059] Add "recent tracks" page to profiles.
Date: Thu, 30 Apr 2009 12:12:31 +0000

Revision: 1059
          http://svn.sv.gnu.org/viewvc/?view=rev&root=librefm&revision=1059
Author:   tobyink
Date:     2009-04-30 12:12:31 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Add "recent tracks" page to profiles.

Modified Paths:
--------------
    trunk/nixtape/.htaccess
    trunk/nixtape/themes/librefm/templates/maxiprofile.tpl
    trunk/nixtape/user-profile.php

Added Paths:
-----------
    trunk/nixtape/themes/librefm/templates/user-recent-tracks.tpl
    trunk/nixtape/user-recent-tracks.php

Modified: trunk/nixtape/.htaccess
===================================================================
--- trunk/nixtape/.htaccess     2009-04-30 12:00:42 UTC (rev 1058)
+++ trunk/nixtape/.htaccess     2009-04-30 12:12:31 UTC (rev 1059)
@@ -2,8 +2,9 @@
 RewriteEngine on
 
 RewriteRule ^user/([^/]+)/?$                                   
user-profile.php?user=$1                [B,NC]
-RewriteRule ^user/([^/]+)/journal?$                             
user-journal.php?user=$1                [B,NC]
-RewriteRule ^user/([^/]+)/groups?$                              
user-groups.php?user=$1                 [B,NC]
+RewriteRule ^user/([^/]+)/journal/?$                            
user-journal.php?user=$1                [B,NC]
+RewriteRule ^user/([^/]+)/groups/?$                             
user-groups.php?user=$1                 [B,NC]
+RewriteRule ^user/([^/]+)/recent-tracks/?$                      
user-recent-tracks.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/([^/]+)/?$                   
album.php?artist=$1&album=$2            [B,NC]

Modified: trunk/nixtape/themes/librefm/templates/maxiprofile.tpl
===================================================================
--- trunk/nixtape/themes/librefm/templates/maxiprofile.tpl      2009-04-30 
12:00:42 UTC (rev 1058)
+++ trunk/nixtape/themes/librefm/templates/maxiprofile.tpl      2009-04-30 
12:12:31 UTC (rev 1059)
@@ -53,7 +53,8 @@
        </dl>
 
        <div style="text-align:right;clear:right;font-size:80%">
-               <a{if $this_page_absolute != $me->getURL()}rel="rdfs:seeAlso" 
href="{$me->getURL()|escape:'html':'UTF-8'}"{/if}>profile</a>
+               <a{if $this_page_absolute != $me->getURL()} rel="rdfs:seeAlso" 
href="{$me->getURL()|escape:'html':'UTF-8'}"{/if}>profile</a>
+               &middot; <a{if $this_page_absolute != 
$me->getURL('recent-tracks')} rel="rdfs:seeAlso" 
href="{$me->getURL('recent-tracks')|escape:'html':'UTF-8'}"{/if}>recent 
tracks</a>
                {if $me->journal_rss} &middot; <a{if $this_page_absolute != 
$me->getURL('journal')} rel="rdfs:seeAlso" 
href="{$me->getURL('journal')|escape:'html':'UTF-8'}"{/if}>journal</a>{/if}
        </div>
        <hr style="border: 1px solid transparent; clear: both;" rel="foaf:page" 
rev="foaf:primaryTopic" resource="" />

Added: trunk/nixtape/themes/librefm/templates/user-recent-tracks.tpl
===================================================================
--- trunk/nixtape/themes/librefm/templates/user-recent-tracks.tpl               
                (rev 0)
+++ trunk/nixtape/themes/librefm/templates/user-recent-tracks.tpl       
2009-04-30 12:12:31 UTC (rev 1059)
@@ -0,0 +1,72 @@
+{include file='header.tpl'}
+
+<h2 property="dc:title">{$me->name|escape:'html':'UTF-8'}'s recent tracks</h2>
+
+{include file='maxiprofile.tpl'}
+
+<div about="[_:seq1]" typeof="rdf:Seq" rev="rss:items">
+       <h3 typeof="rss:channel" property="rss:title" rel="rss:link" 
resource="#latest_plays" id="latest_plays" 
content="{$me->name|escape:'html':'UTF-8'}'s Latest Plays">Latest 
{$scrobbles|@count} Plays:</h3>
+</div>
+
+<ul class="gobbles" about="{$me->id|escape:'html':'UTF-8'}" rev="gob:user">
+{section name=i loop=$scrobbles}
+
+       <li class="play {if $scrobbles[i].license > 0}libre{/if}" 
about="{$scrobbles[i].id|escape:'html':'UTF-8'}" typeof="rss:item 
gob:ScrobbleEvent" rel="gob:track_played">
+               <div about="{$scrobbles[i].id_track|escape:'html':'UTF-8'}" 
typeof="mo:Track" class="haudio">
+                       <div rev="mo:track">
+                               <div 
about="{$scrobbles[i].id_album|escape:'html':'UTF-8'}" typeof="mo:Record"{if 
$scrobbles[i].album} property="dc:title" 
content="{$scrobbles[i].album|escape:'html':'UTF-8'}"{/if}>
+                                       {if $scrobbles[i].albumurl}<a 
rel="foaf:page" href="{$scrobbles[i].albumurl|escape:'html':'UTF-8'}">{/if}
+                                               <span{if 
$scrobbles[i].album_image} rel="foaf:depiction"{/if}{if $scrobbles[i].albumurl} 
about="{$scrobbles[i].id_album|escape:'html':'UTF-8'}"{/if}>
+                                                       <img height="50" 
width="50" 
+                                                               src="{if 
!$scrobbles[i].album_image}/i/qm50.png{else}{$scrobbles[i].album_image|escape:'html':'UTF-8'}{/if}"
 
+                                                               
class="albumart{if !$scrobbles[i].album_image} photo{/if}" 
+                                                               {if 
$scrobbles[i].album}title="{$scrobbles[i].album|escape:'html':'UTF-8'}" 
alt="Album: {$scrobbles[i].album|escape:'html':'UTF-8'}"{else}alt="Unknown 
album"{/if}  />
+                                               </span>
+                                       {if $scrobbles[i].albumurl}</a>{/if}
+                               </div>
+                       </div>
+                       <div rel="foaf:maker" class="contributor vcard">
+                               <a 
about="{$scrobbles[i].id_artist|escape:'html':'UTF-8'}" typeof="mo:MusicArtist" 
property="foaf:name" rel="foaf:page"
+                                       class="fn url" 
href="{$scrobbles[i].artisturl|escape:'html':'UTF-8'}"
+                                       
>{$scrobbles[i].artist|escape:'html':'UTF-8'}</a>
+                       </div>
+                       <div><a class="fn" property="dc:title" rel="foaf:page" 
href="{$scrobbles[i].trackurl|escape:'html':'UTF-8'}">{$scrobbles[i].track|escape:'html':'UTF-8'}</a></div>
+                       <small about="{$scrobbles[i].id|escape:'html':'UTF-8'}" 
property="dc:date" content="{$scrobbles[i].timeiso}" 
datatype="xsd:dateTime">{$scrobbles[i].timehuman}</small>
+                       <span about="{$scrobbles[i].id|escape:'html':'UTF-8'}" 
property="rss:link" content="{$scrobbles[i].trackurl|escape:'html':'UTF-8'}">
+                               <span property="rss:description" content="{if 
$scrobbles[i].album}{$scrobbles[i].album}{else}Unknown album{/if}">
+                                       <span property="rss:title" 
content="{$scrobbles[i].artist|escape:'html':'UTF-8'}: 
{$scrobbles[i].track|escape:'html':'UTF-8'}" 
rev="rdf:_{$smarty.section.i.index_next}" resource="[_:seq1]"></span>
+                               </span>
+                       </span>
+               </div>
+       </li>
+{/section}
+</ul>
+
+<!-- Column break -->
+</div></div><div class="yui-u" id="sidebar"><div style="padding: 10px;">
+
+<h3>{$me->name}'s top artists</h3>
+<ul class="tagcloud" about="{$me->id}">
+       {section name=i loop=$user_tagcloud}
+       <li style="font-size:{$user_tagcloud[i].size}"><a
+       href="{$user_tagcloud[i].pageurl|escape:'html':'UTF-8'}" rel="{if 
$user_tagcloud[i].size|substr:-5 ==
+       'large'}foaf:interest 
{/if}tag">{$user_tagcloud[i].artist|escape:"html":"UTF-8"}</a></li>
+       {/section}
+</ul>
+
+       <div id="adbard">
+
+           <!--Ad Bard advertisement snippet, begin -->
+
+           <script type='text/javascript'>
+            var ab_h = '4bcaab930d3bdfded68fd7be730d7db4';
+            var ab_s = '55fd9cde6d855a75f9ca43d854272f6b';
+           </script>
+           
+            <script type='text/javascript' 
src='http://cdn1.adbard.net/js/ab1.js'></script>
+
+           <!--Ad Bard, end -->
+
+       </div>
+
+{include file='footer.tpl'}

Modified: trunk/nixtape/user-profile.php
===================================================================
--- trunk/nixtape/user-profile.php      2009-04-30 12:00:42 UTC (rev 1058)
+++ trunk/nixtape/user-profile.php      2009-04-30 12:12:31 UTC (rev 1059)
@@ -37,7 +37,7 @@
 if(isset($user->name)) {
 
        $smarty->assign('geo', Server::getLocationDetails($user->location_uri));
-       $aUserScrobbles = $user->getScrobbles(20);
+       $aUserScrobbles = $user->getScrobbles(10);
        if (!PEAR::isError ($aUserScrobbles)) {
                $smarty->assign('scrobbles', $aUserScrobbles);
        }

Added: trunk/nixtape/user-recent-tracks.php
===================================================================
--- trunk/nixtape/user-recent-tracks.php                                (rev 0)
+++ trunk/nixtape/user-recent-tracks.php        2009-04-30 12:12:31 UTC (rev 
1059)
@@ -0,0 +1,76 @@
+<?php
+
+/* Libre.fm -- a free network service for sharing your music listening habits
+
+   Copyright (C) 2009 Libre.fm Project
+
+   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/>.
+
+*/
+
+require_once('database.php');
+require_once('templating.php');
+require_once('data/User.php');
+require_once('data/TagCloud.php');
+require_once('data/Server.php');
+
+if(!isset($_GET['user']) && $logged_in == false) {
+       $smarty->assign('error', 'Error!');
+       $smarty->assign('details', 'User not set! You shouldn\'t be here!');
+       $smarty->display('error.tpl');
+       die();
+}
+
+$user = new User($_GET['user']);
+
+if(isset($user->name)) {
+
+       $smarty->assign('geo', Server::getLocationDetails($user->location_uri));
+       $aUserScrobbles = $user->getScrobbles(100);
+       if (!PEAR::isError ($aUserScrobbles)) {
+               $smarty->assign('scrobbles', $aUserScrobbles);
+       }
+       $smarty->assign('userlevel', $user->userlevel);
+       $smarty->assign('avatar', $user->getAvatar());
+       $aUserTagCloud =  TagCloud::GenerateTagCloud('Scrobbles', 'artist', 40, 
$user->name);
+       if (!PEAR::isError ($aUserTagCloud)) {
+               $smarty->assign('user_tagcloud',$aUserTagCloud);
+       }
+       $smarty->assign('isme', ($_SESSION['user']->name == $user->name));
+       $smarty->assign('me', $user);
+       $smarty->assign('profile', true);
+       
+       $smarty->assign('extra_head_links', array(
+                       array(
+                               'rel'=>'alternate',
+                               'type' => 'application/rss+xml' ,
+                               'title' => 'RSS 1.0 Feed (Recent plays)',
+                               'href' => 
$base_url.'/rdf.php?fmt=rss&page='.htmlentities($_SERVER['REQUEST_URI'])
+                               ),
+                       array(
+                               'rel' => 'meta',
+                               'type' => 'application/rdf+xml' ,
+                               'title' => 'FOAF',
+                               'href' => 
$base_url.'/rdf.php?fmt=xml&page='.htmlentities($_SERVER['REQUEST_URI'])
+                               )
+               ));
+
+       $smarty->display('user-profile.tpl');
+} else {
+       $smarty->assign('error', 'User not found');
+       $smarty->assign('details', 'Shall I call in a missing persons report?');
+       $smarty->display('error.tpl');
+}
+
+?>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]