librefm-commits
[Top][All Lists]
Advanced

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

[Librefm-commits] [1052] Profile improvements.


From: Toby Inkster
Subject: [Librefm-commits] [1052] Profile improvements.
Date: Thu, 30 Apr 2009 10:35:27 +0000

Revision: 1052
          http://svn.sv.gnu.org/viewvc/?view=rev&root=librefm&revision=1052
Author:   tobyink
Date:     2009-04-30 10:35:26 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
Profile improvements.

Modified Paths:
--------------
    trunk/nixtape/data/User.php
    trunk/nixtape/themes/librefm/templates/maxiprofile.tpl
    trunk/nixtape/themes/librefm/templates/miniprofile.tpl
    trunk/nixtape/user-journal.php
    trunk/nixtape/user-profile.php

Modified: trunk/nixtape/data/User.php
===================================================================
--- trunk/nixtape/data/User.php 2009-04-30 10:14:43 UTC (rev 1051)
+++ trunk/nixtape/data/User.php 2009-04-30 10:35:26 UTC (rev 1052)
@@ -34,7 +34,7 @@
 
        public $name, $email, $fullname, $bio, $location, $homepage, $error, 
$userlevel;
        public $id, $acctid, $avatar_uri, $location_uri, $webid_uri, 
$laconica_profile, $journal_rss;
-       public $password;
+       public $password, $has_identica;
 
        /**
         * User constructor
@@ -74,6 +74,8 @@
                        $this->journal_rss  = $row["journal_rss"];
                        $this->acctid       = $this->getURL() . '#acct';
                        
+                       $this->has_identica = 
preg_match('#^http://identi\.ca/#i', $this->laconica_profile);
+                       
                        if (! preg_match('/\:/', $this->id))
                                $this->id = $this->getURL() . '#me';
                }               

Modified: trunk/nixtape/themes/librefm/templates/maxiprofile.tpl
===================================================================
--- trunk/nixtape/themes/librefm/templates/maxiprofile.tpl      2009-04-30 
10:14:43 UTC (rev 1051)
+++ trunk/nixtape/themes/librefm/templates/maxiprofile.tpl      2009-04-30 
10:35:26 UTC (rev 1052)
@@ -24,6 +24,11 @@
                        <a href="{$homepage|escape:'html':'UTF-8'}" rel="me 
foaf:homepage" class="url">{$homepage|escape:'html':'UTF-8'}</a>
                </dd>
                {/if}
+               {if $laconica_profile}
+               <dd>
+                       <a href="{$laconica_profile|escape:'html':'UTF-8'}" 
rel="foaf:homepage" class="url">{$laconica_profile|escape:'html':'UTF-8'} 
(microblog)</a>
+               </dd>
+               {/if}
                <dd rel="foaf:based_near">
                        <span {if $location_uri} 
about="{$location_uri|escape:'html':'UTF-8'}"{/if}>
                                <span class="label" 
property="rdfs:comment">{$location|escape:'html':'UTF-8'}</span>
@@ -43,6 +48,11 @@
                <dd class="note" 
property="bio:olb">{$bio|escape:'html':'UTF-8'}</dd>
        </dl>
 
+       <div style="text-align:right;clear:right;font-size:80%">
+               <!-- These shouldn't be hard-coded. Will fix soon. -->
+               <a rel="rdfs:seeAlso" 
href="{$base_url}/user/{$user}">profile</a>
+               {if $journal_rss} &middot; <a rel="rdfs:seeAlso" 
href="{$base_url}/user/{$user}/journal">journal</a>{/if}
+       </div>
        <hr style="border: 1px solid transparent; clear: both;" rel="foaf:page" 
rev="foaf:primaryTopic" resource="" />
 
 </div>

Modified: trunk/nixtape/themes/librefm/templates/miniprofile.tpl
===================================================================
--- trunk/nixtape/themes/librefm/templates/miniprofile.tpl      2009-04-30 
10:14:43 UTC (rev 1051)
+++ trunk/nixtape/themes/librefm/templates/miniprofile.tpl      2009-04-30 
10:35:26 UTC (rev 1052)
@@ -14,9 +14,10 @@
                                </span>
                        </span>
                </dt>
-               {if $me->homepage}
+               {if $me->homepage || $me->laconica_profile}
                <dd>
-                       <a href="{$me->homepage|escape:'html':'UTF-8'}" 
rel="foaf:homepage" class="url">{$me->homepage|escape:'html':'UTF-8'}</a>
+                       {if $me->homepage}<a 
href="{$me->homepage|escape:'html':'UTF-8'}" rel="foaf:homepage" 
class="url">{$me->homepage|escape:'html':'UTF-8'}</a>{/if}
+                       {if $me->laconica_profile}{if $me->homepage} // {/if}<a 
href="{$me->laconica_profile|escape:'html':'UTF-8'}" rel="foaf:homepage" 
class="url">{$me->laconica_profile|escape:'html':'UTF-8'}</a>{/if}
                </dd>
                {/if}
                <dd rel="foaf:based_near">

Modified: trunk/nixtape/user-journal.php
===================================================================
--- trunk/nixtape/user-journal.php      2009-04-30 10:14:43 UTC (rev 1051)
+++ trunk/nixtape/user-journal.php      2009-04-30 10:35:26 UTC (rev 1052)
@@ -36,66 +36,64 @@
 
 $user = new User($_GET['user']);
 
-# We need to get this from account profile really. This is just hard-coded for 
experimenting.
-if ($user->name == 'tobyink')
-       $rssFeed = 'http://identi.ca/tobyink/rss';
+if(! $user->journal_rss ) {
+        $smarty->assign('error', 'Error!');
+        $smarty->assign('details', 'You need an RSS feed set up for your 
account.');
+        $smarty->display('error.tpl');
+        die();
+}
 
-if ($rssFeed)
-{
-       # We have to implement HTTP caching here!
-       $parser = ARC2::getRDFParser();
-       $parser->parse($rssFeed);
+# We have to implement HTTP caching here!
+$parser = ARC2::getRDFParser();
+$parser->parse($user->journal_rss);
 
-       $index = $parser->getSimpleIndex();
-       krsort($index); // Newest last.
-       $items = array();
-       foreach ($index as $subject => $data)
+$index = $parser->getSimpleIndex();
+krsort($index); // Newest last.
+$items = array();
+foreach ($index as $subject => $data)
+{
+       if (in_array('http://purl.org/rss/1.0/item', 
$data['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']))
        {
-               if (in_array('http://purl.org/rss/1.0/item', 
$data['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']))
-               {
-                       $ts = strtotime($data[ 
'http://purl.org/dc/elements/1.1/date' ][0]);
-                       $items[] = array(
-                               'subject_uri' => $subject,
-                               'title' => $data[ 
'http://purl.org/rss/1.0/title' ][0],
-                               'link' => $data[ 'http://purl.org/rss/1.0/link' 
][0],
-                               'date_iso' => $data[ 
'http://purl.org/dc/elements/1.1/date' ][0],
-                               'date_unix' => $ts,
-                               'date_human' => human_timestamp($ts)
-                               );
-               }
+               $ts = strtotime($data[ 'http://purl.org/dc/elements/1.1/date' 
][0]);
+               $items[] = array(
+                       'subject_uri' => $subject,
+                       'title' => $data[ 'http://purl.org/rss/1.0/title' ][0],
+                       'link' => $data[ 'http://purl.org/rss/1.0/link' ][0],
+                       'date_iso' => $data[ 
'http://purl.org/dc/elements/1.1/date' ][0],
+                       'date_unix' => $ts,
+                       'date_human' => human_timestamp($ts)
+                       );
        }
+}
 
-       $smarty->assign("id", $user->id);
-       $smarty->assign("acctid", $user->acctid);
-       $smarty->assign('user', $user->name);
-       $smarty->assign('email', $user->email);
-       $smarty->assign('fullname', $user->fullname);
-       $smarty->assign('bio', $user->bio);
-       $smarty->assign('homepage', $user->homepage);
-       $smarty->assign('location', $user->location);
-       $smarty->assign('location_uri', $user->location_uri);
-       $smarty->assign('geo', Server::getLocationDetails($user->location_uri));
-       $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('profile', true);
-       $smarty->assign('items', $items);
-       $smarty->assign('extra_head_links', array(
-               array(
-                       'rel'=>'alternate',
-                       'type' => 'application/rss+xml' ,
-                       'title' => 'RSS 1.0 Feed (Journal)',
-                       'href' => $rssFeed
-                       )
-               ));
-       $smarty->display('user-journal.tpl');
-       
-} else {
-       $smarty->assign('error', 'No RSS Feed for this User');
-       $smarty->assign('details', 'Shall I call in a missing feeds report?');
-       $smarty->display('error.tpl');
+$smarty->assign("id", $user->id);
+$smarty->assign("acctid", $user->acctid);
+$smarty->assign('user', $user->name);
+$smarty->assign('email', $user->email);
+$smarty->assign('fullname', $user->fullname);
+$smarty->assign('bio', $user->bio);
+$smarty->assign('homepage', $user->homepage);
+$smarty->assign('laconica_profile', $user->laconica_profile);
+$smarty->assign('has_identica', $user->has_identica);
+$smarty->assign('location', $user->location);
+$smarty->assign('location_uri', $user->location_uri);
+$smarty->assign('geo', Server::getLocationDetails($user->location_uri));
+$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('profile', true);
+$smarty->assign('items', $items);
+$smarty->assign('extra_head_links', array(
+       array(
+               'rel'=>'alternate',
+               'type' => 'application/rss+xml' ,
+               'title' => 'RSS 1.0 Feed (Journal)',
+               'href' => $user->journal_rss
+               )
+       ));
+$smarty->display('user-journal.tpl');
+       

Modified: trunk/nixtape/user-profile.php
===================================================================
--- trunk/nixtape/user-profile.php      2009-04-30 10:14:43 UTC (rev 1051)
+++ trunk/nixtape/user-profile.php      2009-04-30 10:35:26 UTC (rev 1052)
@@ -42,6 +42,8 @@
        $smarty->assign('fullname', $user->fullname);
        $smarty->assign('bio', $user->bio);
        $smarty->assign('homepage', $user->homepage);
+       $smarty->assign('laconica_profile', $user->laconica_profile);
+       $smarty->assign('has_identica', $user->has_identica);
        $smarty->assign('location', $user->location);
        $smarty->assign('location_uri', $user->location_uri);
        $smarty->assign('geo', Server::getLocationDetails($user->location_uri));





reply via email to

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