Remove common code from Subscriptions, make tags link visible

This commit is contained in:
Evan Prodromou 2009-01-22 17:12:23 +01:00
parent 9d913150d4
commit 01e7859a81
2 changed files with 24 additions and 157 deletions

View File

@ -2,7 +2,7 @@
/** /**
* Laconica, the distributed open-source microblogging tool * Laconica, the distributed open-source microblogging tool
* *
* User profile page * List of a user's subscriptions
* *
* PHP version 5 * PHP version 5
* *
@ -19,7 +19,7 @@
* You should have received a copy of the GNU Affero General Public License * 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/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
* @category Personal * @category Social
* @package Laconica * @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca> * @author Evan Prodromou <evan@controlyourself.ca>
* @author Sarven Capadisli <csarven@controlyourself.ca> * @author Sarven Capadisli <csarven@controlyourself.ca>
@ -32,18 +32,10 @@ if (!defined('LACONICA')) {
exit(1); exit(1);
} }
require_once INSTALLDIR.'/lib/subsgroupnav.php';
/** /**
* User profile page * A list of the user's subscriptions
* *
* When I created this page, "show stream" seemed like the best name for it. * @category Social
* Now, it seems like a really bad name.
*
* It shows a stream of the user's posts, plus lots of profile info, links
* to subscriptions and stuff, etc.
*
* @category Personal
* @package Laconica * @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca> * @author Evan Prodromou <evan@controlyourself.ca>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
@ -52,62 +44,8 @@ require_once INSTALLDIR.'/lib/subsgroupnav.php';
if (!defined('LACONICA')) { exit(1); } if (!defined('LACONICA')) { exit(1); }
class SubscriptionsAction extends Action class SubscriptionsAction extends GalleryAction
{ {
var $profile = null;
var $user = null;
var $page = null;
function prepare($args)
{
parent::prepare($args);
// FIXME very similar code below
$nickname_arg = $this->arg('nickname');
$nickname = common_canonical_nickname($nickname_arg);
// Permanent redirect on non-canonical nickname
if ($nickname_arg != $nickname) {
$args = array('nickname' => $nickname);
if ($this->arg('page') && $this->arg('page') != 1) {
$args['page'] = $this->arg['page'];
}
common_redirect(common_local_url('subscriptions', $args), 301);
return false;
}
$this->user = User::staticGet('nickname', $nickname);
if (!$this->user) {
$this->clientError(_('No such user.'), 404);
return false;
}
$this->profile = $this->user->getProfile();
if (!$this->profile) {
$this->serverError(_('User has no profile.'));
return false;
}
$this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
return true;
}
function isReadOnly()
{
return true;
}
function handle($args)
{
parent::handle($args);
$this->showPage();
}
function title() function title()
{ {
if ($this->page == 1) { if ($this->page == 1) {
@ -134,21 +72,22 @@ class SubscriptionsAction extends Action
} }
} }
function showLocalNav() function getAllTags()
{ {
$nav = new SubGroupNav($this, $this->user); return $this->getTags('subscribed', 'subscriber');
$nav->show();
} }
function showContent() function showContent()
{ {
parent::showContent();
$offset = ($this->page-1) * PROFILES_PER_PAGE; $offset = ($this->page-1) * PROFILES_PER_PAGE;
$limit = PROFILES_PER_PAGE + 1; $limit = PROFILES_PER_PAGE + 1;
$subscriptions = $this->user->getSubscriptions($offset, $limit); $subscriptions = $this->user->getSubscriptions($offset, $limit);
if ($subs) { if ($subscriptions) {
$subscriptions_list = new SubscriptionsList($subscriptions, null, $this); $subscriptions_list = new SubscriptionsList($subscriptions, $this->user, $this);
$subscriptions_list->show(); $subscriptions_list->show();
} }
@ -170,16 +109,16 @@ class SubscriptionsList extends ProfileList
return; return;
} }
$this->elementStart('form', array('id' => 'subedit-' . $profile->id, $this->out->elementStart('form', array('id' => 'subedit-' . $profile->id,
'method' => 'post', 'method' => 'post',
'class' => 'subedit', 'class' => 'subedit',
'action' => common_local_url('subedit'))); 'action' => common_local_url('subedit')));
$this->hidden('token', common_session_token()); $this->out->hidden('token', common_session_token());
$this->hidden('profile', $profile->id); $this->out->hidden('profile', $profile->id);
$this->checkbox('jabber', _('Jabber'), $sub->jabber); $this->out->checkbox('jabber', _('Jabber'), $sub->jabber);
$this->checkbox('sms', _('SMS'), $sub->sms); $this->out->checkbox('sms', _('SMS'), $sub->sms);
$this->submit('save', _('Save')); $this->out->submit('save', _('Save'));
$this->elementEnd('form'); $this->out->elementEnd('form');
return; return;
} }
} }

View File

@ -36,7 +36,7 @@ font-weight:bold;
} }
legend { legend {
font-weight:bold; font-weight:bold;
font-size:1.3em; font-size:1.3em;
text-transform:uppercase; text-transform:uppercase;
} }
@ -99,9 +99,6 @@ display:none;
margin-left:11px; margin-left:11px;
} }
/* FORM SETTINGS */ /* FORM SETTINGS */
.form_settings fieldset { .form_settings fieldset {
margin-bottom:29px; margin-bottom:29px;
@ -111,7 +108,6 @@ margin-bottom:29px;
font-style:italic; font-style:italic;
} }
.form_settings .form_data li { .form_settings .form_data li {
width:100%; width:100%;
float:left; float:left;
@ -179,7 +175,6 @@ width:90%;
margin-left:0; margin-left:0;
} }
.form_settings .form_note { .form_settings .form_note {
border-radius:4px; border-radius:4px;
-moz-border-radius:4px; -moz-border-radius:4px;
@ -187,13 +182,8 @@ border-radius:4px;
padding:0 7px; padding:0 7px;
} }
/* FORM SETTINGS */ /* FORM SETTINGS */
address { address {
float:left; float:left;
margin-bottom:18px; margin-bottom:18px;
@ -206,7 +196,6 @@ address .fn {
font-weight:bold; font-weight:bold;
} }
#header { #header {
width:100%; width:100%;
position:relative; position:relative;
@ -225,7 +214,6 @@ display:inline;
margin-left:11px; margin-left:11px;
} }
.system_notice dt { .system_notice dt {
font-weight:bold; font-weight:bold;
text-transform:uppercase; text-transform:uppercase;
@ -244,17 +232,12 @@ clear:both;
margin-bottom:18px; margin-bottom:18px;
} }
#footer { #footer {
float:left; float:left;
width:64%; width:64%;
padding:18px; padding:18px;
} }
#site_nav_local_views { #site_nav_local_views {
width:100%; width:100%;
float:left; float:left;
@ -286,7 +269,6 @@ float:left;
width:100%; width:100%;
} }
#site_nav_global_primary dt, #site_nav_global_primary dt,
#site_nav_global_secondary dt { #site_nav_global_secondary dt {
display:none; display:none;
@ -315,8 +297,6 @@ padding-left:30px;
padding-left:28px; padding-left:28px;
} }
#export_data ul { #export_data ul {
display:inline; display:inline;
} }
@ -329,8 +309,6 @@ margin-left:11px;
margin-left:0; margin-left:0;
} }
#licenses { #licenses {
font-size:0.9em; font-size:0.9em;
} }
@ -353,7 +331,6 @@ vertical-align:top;
margin-right:4px; margin-right:4px;
} }
#wrap { #wrap {
float:left; float:left;
margin:0 auto; margin:0 auto;
@ -361,7 +338,6 @@ margin-right:4px;
width:71.714em; width:71.714em;
} }
#core { #core {
position:relative; position:relative;
width:100%; width:100%;
@ -396,9 +372,6 @@ border-radius:7px;
-webkit-border-radius:7px; -webkit-border-radius:7px;
} }
/*Start: FORM NOTICE*/ /*Start: FORM NOTICE*/
#form_notice { #form_notice {
width:384px; width:384px;
@ -501,10 +474,6 @@ float:left;
/*end FORM NOTICE*/ /*end FORM NOTICE*/
/* entity_profile */ /* entity_profile */
.entity_profile { .entity_profile {
position:relative; position:relative;
@ -575,10 +544,6 @@ display:none;
/* entity_profile */ /* entity_profile */
/*entity_actions*/ /*entity_actions*/
.entity_actions { .entity_actions {
float:right; float:right;
@ -617,8 +582,6 @@ font-weight:bold;
display:block; display:block;
} }
.form_user_block input.submit, .form_user_block input.submit,
.form_user_unblock input.submit, .form_user_unblock input.submit,
#entity_send-a-message a, #entity_send-a-message a,
@ -633,8 +596,6 @@ padding-left:20px;
padding:4px 4px 4px 23px; padding:4px 4px 4px 23px;
} }
.entity_tags ul { .entity_tags ul {
list-style-type:none; list-style-type:none;
} }
@ -644,8 +605,6 @@ margin-right:1em;
float:left; float:left;
} }
.aside .section { .aside .section {
margin-bottom:29px; margin-bottom:29px;
clear:both; clear:both;
@ -665,7 +624,6 @@ display:inline;
content: ":"; content: ":";
} }
#user_subscriptions, #user_subscriptions,
#user_subscribers, #user_subscribers,
#user_groups, { #user_groups, {
@ -692,8 +650,6 @@ display:none;
clear:both; clear:both;
} }
.profile .entity_profile { .profile .entity_profile {
margin-bottom:0; margin-bottom:0;
min-height:60px; min-height:60px;
@ -708,7 +664,6 @@ float:right;
display:none; display:none;
} }
.profiles { .profiles {
list-style-type:none; list-style-type:none;
} }
@ -730,8 +685,6 @@ display:block;
width:auto; width:auto;
} }
/* NOTICE */ /* NOTICE */
.notice, .notice,
.profile { .profile {
@ -756,7 +709,6 @@ border-radius:4px;
-webkit-border-radius:4px; -webkit-border-radius:4px;
} }
/* NOTICES */ /* NOTICES */
#notices_primary { #notices_primary {
float:left; float:left;
@ -773,7 +725,6 @@ display:block;
padding-left:28px; padding-left:28px;
} }
.notice .author { .notice .author {
margin-right:11px; margin-right:11px;
} }
@ -802,7 +753,6 @@ font-style:italic;
} }
.notice .entry-title { .notice .entry-title {
float:left; float:left;
width:100%; width:100%;
@ -875,8 +825,6 @@ text-transform:lowercase;
.notice div.entry-content a:hover { .notice div.entry-content a:hover {
} }
.notice-data { .notice-data {
position:absolute; position:absolute;
top:18px; top:18px;
@ -966,10 +914,6 @@ padding:0;
/*END: NOTICES */ /*END: NOTICES */
.pagination dt { .pagination dt {
font-weight:bold; font-weight:bold;
display:none; display:none;
@ -1010,11 +954,8 @@ padding-right:20px;
border-right:0; border-right:0;
} }
/* END: NOTICE */ /* END: NOTICE */
/*If there is hentry on #content_inner, then this doesn't need to be specific to #doc or any other section */ /*If there is hentry on #content_inner, then this doesn't need to be specific to #doc or any other section */
.hentry .entry-content p { .hentry .entry-content p {
margin-bottom:18px; margin-bottom:18px;
@ -1030,7 +971,6 @@ margin-bottom:18px;
margin-left:18px; margin-left:18px;
} }
/*START: LOAD ALONG WITH JS*/ /*START: LOAD ALONG WITH JS*/
.notice .in-reply-to { .notice .in-reply-to {
width:98%; width:98%;
@ -1046,8 +986,6 @@ background-color:#E4E9F0;
background-color:#D1D9E4; background-color:#D1D9E4;
} }
.entity_actions #user_subscribe .form_note, .entity_actions #user_subscribe .form_note,
.entity_actions #user_subscribe .form_data, .entity_actions #user_subscribe .form_data,
.entity_actions #user_subscribe .form_actions label { .entity_actions #user_subscribe .form_actions label {
@ -1079,8 +1017,6 @@ background-color:#fff;
/*END: LOAD ALONG WITH JS*/ /*END: LOAD ALONG WITH JS*/
/* TOP_POSTERS */ /* TOP_POSTERS */
#top-posters caption { #top-posters caption {
text-align:left; text-align:left;
@ -1106,8 +1042,6 @@ height:24px;
width:24px; width:24px;
} }
/* tagcloud */ /* tagcloud */
.tag-cloud { .tag-cloud {
list-style-type:none; list-style-type:none;
@ -1150,20 +1084,15 @@ font-size:4em;
display:none; display:none;
} }
#form_settings_photo .form_data { #form_settings_photo .form_data {
clear:both; clear:both;
} }
#form_settings_avatar li { #form_settings_avatar li {
width:auto; width:auto;
} }
#form_settings_avatar input { #form_settings_avatar input {
margin-left:0; margin-left:0;
} }
#avatar_original, #avatar_original,
#avatar_preview { #avatar_preview {
@ -1188,8 +1117,6 @@ clear:both;
margin-bottom:0; margin-bottom:0;
} }
#groups_related ul, #groups_related ul,
#users_featured ul { #users_featured ul {
list-style-type:none; list-style-type:none;
@ -1223,8 +1150,6 @@ display:none;
font-weight:bold; font-weight:bold;
} }
#home.logged_out h1 { #home.logged_out h1 {
display:none; display:none;
} }
@ -1267,7 +1192,10 @@ font-weight:bold;
text-align:center; text-align:center;
} }
#testimonials { #testimonials {
clear:both; clear:both;
} }
.entity_tags dt {
display:block;
}