From 03e65d589ad4f951c008b040d0bd4d019dfc2b3d Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 14 Jan 2009 01:38:00 -0500 Subject: Move subscribe and unsubscribe forms to their own classes --- lib/subscribeform.php | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 lib/subscribeform.php (limited to 'lib/subscribeform.php') diff --git a/lib/subscribeform.php b/lib/subscribeform.php new file mode 100644 index 000000000..fccc3d301 --- /dev/null +++ b/lib/subscribeform.php @@ -0,0 +1,117 @@ +. + * + * @category Form + * @package Laconica + * @author Evan Prodromou + * @author Sarven Capadisli + * @copyright 2009 Control Yourself, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + */ + +if (!defined('LACONICA')) { + exit(1); +} + +require_once INSTALLDIR.'/lib/form.php'; + +/** + * Form for subscribing to a user + * + * @category Form + * @package Laconica + * @author Evan Prodromou + * @author Sarven Capadisli + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + * + * @see UnsubscribeForm + */ + +class SubscribeForm extends Form +{ + /** + * Profile of user to nudge + */ + + var $profile = null; + + /** + * Constructor + * + * @param HTMLOutputter $out output channel + * @param Profile $profile profile of user to nudge + */ + + function __construct($out=null, $profile=null) + { + parent::__construct($out); + + $this->profile = $profile; + } + + /** + * ID of the form + * + * @return int ID of the form + */ + + function id() + { + return 'subscribe-' . $this->profile->id; + } + + /** + * Action of the form + * + * @return string URL of the action + */ + + function action() + { + return common_local_url('subscribe'); + } + + /** + * Data elements of the form + * + * @return void + */ + + function formData() + { + $this->out->hidden('subscribeto-' . $this->profile->id, + $this->profile->id, + 'subscribeto'); + } + + /** + * Action elements + * + * @return void + */ + + function formActions() + { + $this->out->submit('submit', _('Subscribe')); + } +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 353f64f47f07116151f500f37738f11d8c376c33 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 14 Jan 2009 02:26:42 -0500 Subject: Fix comments on profile Incorrectly said this was for nudging, not subbing/unsubbing --- lib/subscribeform.php | 4 ++-- lib/unsubscribeform.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/subscribeform.php') diff --git a/lib/subscribeform.php b/lib/subscribeform.php index fccc3d301..996729a28 100644 --- a/lib/subscribeform.php +++ b/lib/subscribeform.php @@ -50,7 +50,7 @@ require_once INSTALLDIR.'/lib/form.php'; class SubscribeForm extends Form { /** - * Profile of user to nudge + * Profile of user to subscribe to */ var $profile = null; @@ -59,7 +59,7 @@ class SubscribeForm extends Form * Constructor * * @param HTMLOutputter $out output channel - * @param Profile $profile profile of user to nudge + * @param Profile $profile profile of user to subscribe to */ function __construct($out=null, $profile=null) diff --git a/lib/unsubscribeform.php b/lib/unsubscribeform.php index 1d4c08a71..a724bb312 100644 --- a/lib/unsubscribeform.php +++ b/lib/unsubscribeform.php @@ -50,7 +50,7 @@ require_once INSTALLDIR.'/lib/form.php'; class UnsubscribeForm extends Form { /** - * Profile of user to nudge + * Profile of user to unsubscribe from */ var $profile = null; @@ -59,7 +59,7 @@ class UnsubscribeForm extends Form * Constructor * * @param HTMLOutputter $out output channel - * @param Profile $profile profile of user to nudge + * @param Profile $profile profile of user to unsub from */ function __construct($out=null, $profile=null) -- cgit v1.2.3-54-g00ecf From 77790ab7687c6ef6c86f502c27158ef71cdffa76 Mon Sep 17 00:00:00 2001 From: sarven Date: Mon, 19 Jan 2009 21:56:55 +0000 Subject: Featuerd profile list markup Minor class change to (un)subscribeform.php --- lib/profilelist.php | 53 ++++++++++++++++++++++++++----------------------- lib/subscribeform.php | 15 +++++++++++++- lib/unsubscribeform.php | 14 ++++++++++++- 3 files changed, 55 insertions(+), 27 deletions(-) (limited to 'lib/subscribeform.php') diff --git a/lib/profilelist.php b/lib/profilelist.php index fdc71ab8d..24b357385 100644 --- a/lib/profilelist.php +++ b/lib/profilelist.php @@ -68,7 +68,7 @@ class ProfileList extends Widget function show() { - $this->out->elementStart('ul', array('id' => 'profiles', 'class' => 'profile_list')); + $this->out->elementStart('ul', 'profiles'); $cnt = 0; @@ -87,51 +87,40 @@ class ProfileList extends Widget function showProfile() { - $this->out->elementStart('li', array('class' => 'profile_single', - 'id' => 'profile-' . $this->profile->id)); + $this->out->elementStart('li', array('class' => 'profile vcard', + 'id' => 'profile-' . $this->profile->id)); $user = common_current_user(); - if ($user && $user->id != $this->profile->id) { - # XXX: special-case for user looking at own - # subscriptions page - if ($user->isSubscribed($this->profile)) { - $usf = new UnsubscribeForm($this->out, $this->profile); - $usf->show(); - } else { - $sf = new SubscribeForm($this->out, $this->profile); - $sf->show(); - } - } + + $this->out->elementStart('div', array('id' => 'user_profile', + 'class' => 'vcard')); $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE); - $this->out->elementStart('a', array('href' => $this->profile->profileurl)); + $this->out->elementStart('a', array('href' => $this->profile->profileurl, + 'class' => 'url')); $this->out->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE), - 'class' => 'avatar stream', + 'class' => 'photo avatar', 'width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE, 'alt' => ($this->profile->fullname) ? $this->profile->fullname : $this->profile->nickname)); - $this->out->elementEnd('a'); - $this->out->elementStart('p'); - $this->out->elementStart('a', array('href' => $this->profile->profileurl, - 'class' => 'nickname')); + $this->out->elementStart('span', 'nickname'); $this->out->raw($this->highlight($this->profile->nickname)); + $this->out->elementEnd('span'); $this->out->elementEnd('a'); + if ($this->profile->fullname) { - $this->out->text(' | '); - $this->out->elementStart('span', 'fullname'); + $this->out->elementStart('span', 'fn'); $this->out->raw($this->highlight($this->profile->fullname)); $this->out->elementEnd('span'); } if ($this->profile->location) { - $this->out->text(' | '); $this->out->elementStart('span', 'location'); $this->out->raw($this->highlight($this->profile->location)); $this->out->elementEnd('span'); } - $this->out->elementEnd('p'); if ($this->profile->homepage) { $this->out->elementStart('p', 'website'); $this->out->elementStart('a', array('href' => $this->profile->homepage)); @@ -188,6 +177,20 @@ class ProfileList extends Widget $this->showOwnerControls($this->profile); } + $this->out->elementEnd('div'); + + if ($user && $user->id != $this->profile->id) { + # XXX: special-case for user looking at own + # subscriptions page + if ($user->isSubscribed($this->profile)) { + $usf = new UnsubscribeForm($this->out, $this->profile); + $usf->show(); + } else { + $sf = new SubscribeForm($this->out, $this->profile); + $sf->show(); + } + } + $this->out->elementEnd('li'); } @@ -202,4 +205,4 @@ class ProfileList extends Widget { return htmlspecialchars($text); } -} \ No newline at end of file +} diff --git a/lib/subscribeform.php b/lib/subscribeform.php index 996729a28..8b69efd1a 100644 --- a/lib/subscribeform.php +++ b/lib/subscribeform.php @@ -80,6 +80,19 @@ class SubscribeForm extends Form return 'subscribe-' . $this->profile->id; } + + /** + * class of the form + * + * @return string of the form class + */ + + function formClass() + { + return 'form_subscribe'; + } + + /** * Action of the form * @@ -114,4 +127,4 @@ class SubscribeForm extends Form { $this->out->submit('submit', _('Subscribe')); } -} \ No newline at end of file +} diff --git a/lib/unsubscribeform.php b/lib/unsubscribeform.php index a724bb312..b222f0e54 100644 --- a/lib/unsubscribeform.php +++ b/lib/unsubscribeform.php @@ -80,6 +80,18 @@ class UnsubscribeForm extends Form return 'unsubscribe-' . $this->profile->id; } + + /** + * class of the form + * + * @return string of the form class + */ + + function formClass() + { + return 'form_unsubscribe'; + } + /** * Action of the form * @@ -114,4 +126,4 @@ class UnsubscribeForm extends Form { $this->out->submit('submit', _('Unsubscribe')); } -} \ No newline at end of file +} -- cgit v1.2.3-54-g00ecf From bb4a6a514bb62a0fef2314512c121951a40437e7 Mon Sep 17 00:00:00 2001 From: sarven Date: Tue, 20 Jan 2009 22:36:57 +0000 Subject: user_actions form markup and styling --- actions/showstream.php | 1 + lib/blockform.php | 15 ++++++++++++++- lib/subscribeform.php | 2 +- lib/unblockform.php | 13 ++++++++++++- lib/unsubscribeform.php | 2 +- theme/base/css/display.css | 30 ++++++++++++------------------ theme/identica/css/display.css | 35 +++++++++++++++++++++++------------ 7 files changed, 64 insertions(+), 34 deletions(-) (limited to 'lib/subscribeform.php') diff --git a/actions/showstream.php b/actions/showstream.php index 1d79ea30d..d550ec295 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -22,6 +22,7 @@ * @category Personal * @package Laconica * @author Evan Prodromou + * @author Sarven Capadisli * @copyright 2008-2009 Control Yourself, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://laconi.ca/ diff --git a/lib/blockform.php b/lib/blockform.php index 51e43f8b5..b7790681d 100644 --- a/lib/blockform.php +++ b/lib/blockform.php @@ -88,6 +88,19 @@ class BlockForm extends Form return 'block-' . $this->profile->id; } + + /** + * class of the form + * + * @return string class of the form + */ + + function formClass() + { + return 'form_user_block'; + } + + /** * Action of the form * @@ -127,4 +140,4 @@ class BlockForm extends Form { $this->out->submit('submit', _('Block')); } -} \ No newline at end of file +} diff --git a/lib/subscribeform.php b/lib/subscribeform.php index 8b69efd1a..231e740a7 100644 --- a/lib/subscribeform.php +++ b/lib/subscribeform.php @@ -89,7 +89,7 @@ class SubscribeForm extends Form function formClass() { - return 'form_subscribe'; + return 'form_user_subscribe'; } diff --git a/lib/unblockform.php b/lib/unblockform.php index 4cb9ae4f5..025011a82 100644 --- a/lib/unblockform.php +++ b/lib/unblockform.php @@ -88,6 +88,17 @@ class UnblockForm extends Form return 'unblock-' . $this->profile->id; } + /** + * class of the form + * + * @return string class of the form + */ + + function formClass() + { + return 'form_user_unblock'; + } + /** * Action of the form * @@ -127,4 +138,4 @@ class UnblockForm extends Form { $this->out->submit('submit', _('Unblock')); } -} \ No newline at end of file +} diff --git a/lib/unsubscribeform.php b/lib/unsubscribeform.php index b222f0e54..092369db7 100644 --- a/lib/unsubscribeform.php +++ b/lib/unsubscribeform.php @@ -89,7 +89,7 @@ class UnsubscribeForm extends Form function formClass() { - return 'form_unsubscribe'; + return 'form_user_unsubscribe'; } /** diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 3c776aea0..fc1f35e35 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -570,8 +570,7 @@ display:none; list-style-type:none; } #user_actions li { -border-top-width:1px; -border-top-style:dotted; +margin-bottom:4px; } #user_actions li:first-child { border-top:0; @@ -584,34 +583,29 @@ padding:0; display:none; } -#user_actions a, #user_actions input.submit { display:block; text-align:left; -padding:4px 0 4px 19px; +cursor:pointer; +width:100%; } #user_actions a { text-decoration:none; } -#user_subscribe a, -#TB_window input.submit, -#user_actions input.submit { -border:0; -cursor:pointer; -padding-left:16px; -width:100%; -font-size:0.9em; -} -#user_subscribe a { -width:auto; + + +.form_user_block input.submit, +.form_user_unblock input.submit { +border:0; padding-left:20px; } -#user_subscribe a, -#TB_window input.submit, + + +#user_subscribe input.submit, .form_user_subscribe input.submit { -font-weight:bold; + } diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css index d5a5ce956..eb5f78b9e 100644 --- a/theme/identica/css/display.css +++ b/theme/identica/css/display.css @@ -125,30 +125,41 @@ background-image:url(../../base/images/icons/icon_vcard.gif); /*user_actions*/ #user_actions li { -border-top-color:#eee; +/*border-top-color:#eee;*/ } -#user_subscribe a, -#TB_window input.submit, -.form_user_subscribe input.submit { -background-image: url(../images/icons/twotone/green/shield.gif); -background-position: 0 45%; + + +.form_user_send-a-message input.submit, +.form_user_nudge input.submit, +.form_user_block input.submit, +.form_user_unblock input.submit { +background-position: 0 40%; background-repeat: no-repeat; +background-color:transparent; } +.form_user_subscribe input.submit, .form_user_unsubscribe input.submit { -background-color:#647819; +background-color:#A9BF4F; color:#fff; } +.form_user_unsubscribe input.submit { +background-color:#97BFD1; +} + #user_send-a-message a { -background:url(../images/icons/twotone/green/quote.gif) 0 45% no-repeat; +background-image:url(../images/icons/twotone/green/quote.gif); } .form_user_nudge input.submit { -background:url(../images/icons/twotone/green/mail.gif) 0 45% no-repeat; +background-image:url(../images/icons/twotone/green/mail.gif); } -.form_user_block input.submit { -background:url(../images/icons/twotone/green/against.gif) 0 45% no-repeat; +.form_user_block input.submit, +.form_user_unblock input.submit { +background-image:url(../images/icons/twotone/green/shield.gif); +color:#000; } + /* NOTICES */ .notices li.over { background-color:#fcfcfc; @@ -242,4 +253,4 @@ background-color:#0f0; } #home #intro #step_create-a-community a { background-color:#00f; -} \ No newline at end of file +} -- cgit v1.2.3-54-g00ecf