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
*
* User profile page
* List of a user's subscriptions
*
* PHP version 5
*
@ -19,7 +19,7 @@
* 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/>.
*
* @category Personal
* @category Social
* @package Laconica
* @author Evan Prodromou <evan@controlyourself.ca>
* @author Sarven Capadisli <csarven@controlyourself.ca>
@ -32,18 +32,10 @@ if (!defined('LACONICA')) {
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.
* 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
* @category Social
* @package Laconica
* @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
@ -52,62 +44,8 @@ require_once INSTALLDIR.'/lib/subsgroupnav.php';
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()
{
if ($this->page == 1) {
@ -134,21 +72,22 @@ class SubscriptionsAction extends Action
}
}
function showLocalNav()
function getAllTags()
{
$nav = new SubGroupNav($this, $this->user);
$nav->show();
return $this->getTags('subscribed', 'subscriber');
}
function showContent()
{
parent::showContent();
$offset = ($this->page-1) * PROFILES_PER_PAGE;
$limit = PROFILES_PER_PAGE + 1;
$subscriptions = $this->user->getSubscriptions($offset, $limit);
if ($subs) {
$subscriptions_list = new SubscriptionsList($subscriptions, null, $this);
if ($subscriptions) {
$subscriptions_list = new SubscriptionsList($subscriptions, $this->user, $this);
$subscriptions_list->show();
}
@ -170,16 +109,16 @@ class SubscriptionsList extends ProfileList
return;
}
$this->elementStart('form', array('id' => 'subedit-' . $profile->id,
$this->out->elementStart('form', array('id' => 'subedit-' . $profile->id,
'method' => 'post',
'class' => 'subedit',
'action' => common_local_url('subedit')));
$this->hidden('token', common_session_token());
$this->hidden('profile', $profile->id);
$this->checkbox('jabber', _('Jabber'), $sub->jabber);
$this->checkbox('sms', _('SMS'), $sub->sms);
$this->submit('save', _('Save'));
$this->elementEnd('form');
$this->out->hidden('token', common_session_token());
$this->out->hidden('profile', $profile->id);
$this->out->checkbox('jabber', _('Jabber'), $sub->jabber);
$this->out->checkbox('sms', _('SMS'), $sub->sms);
$this->out->submit('save', _('Save'));
$this->out->elementEnd('form');
return;
}
}

View File

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