Merge branch '0.7.x' of git@gitorious.org:laconica/dev into 0.7.x

This commit is contained in:
Evan Prodromou 2009-02-05 11:47:47 -05:00
commit 43feee783b
4 changed files with 217 additions and 49 deletions

View File

@ -148,14 +148,11 @@ class FacebookhomeAction extends FacebookAction
function showNoticeForm() function showNoticeForm()
{ {
$post_action = "$this->app_uri/index.php"; $post_action = "$this->app_uri/index.php";
$notice_form = new FacebookNoticeForm($this, $post_action, null, $notice_form = new FacebookNoticeForm($this, $post_action, null,
$post_action, $this->user); $post_action, $this->user);
$notice_form->show(); $notice_form->show();
} }
function title() function title()
@ -169,7 +166,6 @@ class FacebookhomeAction extends FacebookAction
function showContent() function showContent()
{ {
$notice = $this->user->noticesWithFriends(($this->page-1) * $notice = $this->user->noticesWithFriends(($this->page-1) *
NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
@ -179,7 +175,6 @@ class FacebookhomeAction extends FacebookAction
$this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE, $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE,
$this->page, 'index.php', array('nickname' => $this->user->nickname)); $this->page, 'index.php', array('nickname' => $this->user->nickname));
} }
function showNoticeList($notice) function showNoticeList($notice)

View File

@ -73,7 +73,7 @@ class FacebookinviteAction extends FacebookAction
$friend_ids = $_POST['ids']; // XXX: Hmm... is this the best way to acces the list? $friend_ids = $_POST['ids']; // XXX: Hmm... is this the best way to acces the list?
$this->elementStart("ul"); $this->elementStart('ul', array('id' => 'facebook-friends'));
foreach ($friend_ids as $friend) { foreach ($friend_ids as $friend) {
$this->elementStart('li'); $this->elementStart('li');
@ -112,11 +112,11 @@ class FacebookinviteAction extends FacebookAction
$this->element('h2', null, sprintf(_('Friends already using %s:'), $this->element('h2', null, sprintf(_('Friends already using %s:'),
common_config('site', 'name'))); common_config('site', 'name')));
$this->elementStart("ul"); $this->elementStart('ul', array('id' => 'facebook-friends'));
foreach ($exclude_ids as $friend) { foreach ($exclude_ids as $friend) {
$this->elementStart('li'); $this->elementStart('li');
$this->element('fb:profile-pic', array('uid' => $friend)); $this->element('fb:profile-pic', array('uid' => $friend, 'size' => 'square'));
$this->element('fb:name', array('uid' => $friend, $this->element('fb:name', array('uid' => $friend,
'capitalize' => 'true')); 'capitalize' => 'true'));
$this->elementEnd('li'); $this->elementEnd('li');

View File

@ -129,7 +129,7 @@ class FacebookAction extends Action
* Start an Facebook ready HTML document * Start an Facebook ready HTML document
* *
* For Facebook we don't want to actually output any headers, * For Facebook we don't want to actually output any headers,
* DTD info, etc. * DTD info, etc. Just Stylesheet and JavaScript links.
* *
* If $type isn't specified, will attempt to do content negotiation. * If $type isn't specified, will attempt to do content negotiation.
* *
@ -140,6 +140,9 @@ class FacebookAction extends Action
function startHTML($type=null) function startHTML($type=null)
{ {
$this->showStylesheets();
$this->showScripts();
$this->elementStart('div', array('class' => 'facebook-page')); $this->elementStart('div', array('class' => 'facebook-page'));
} }
@ -181,8 +184,6 @@ class FacebookAction extends Action
function showHead($error, $success) function showHead($error, $success)
{ {
$this->showStylesheets();
$this->showScripts();
if ($error) { if ($error) {
$this->element("h1", null, $error); $this->element("h1", null, $error);
@ -204,7 +205,6 @@ class FacebookAction extends Action
// Make this into a widget later // Make this into a widget later
function showLocalNav() function showLocalNav()
{ {
$this->elementStart('ul', array('class' => 'nav')); $this->elementStart('ul', array('class' => 'nav'));
$this->elementStart('li', array('class' => $this->elementStart('li', array('class' =>
@ -229,17 +229,6 @@ class FacebookAction extends Action
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
}
/**
* Show primary navigation.
*
* @return nothing
*/
function showPrimaryNav()
{
// we don't want to show anything for this
} }
/** /**
@ -254,7 +243,6 @@ class FacebookAction extends Action
$this->elementStart('div', array('id' => 'header')); $this->elementStart('div', array('id' => 'header'));
$this->showLogo(); $this->showLogo();
$this->showNoticeForm(); $this->showNoticeForm();
$this->showPrimaryNav();
$this->elementEnd('div'); $this->elementEnd('div');
} }
@ -282,7 +270,6 @@ class FacebookAction extends Action
$loginmsg_part1 = _('To use the %s Facebook Application you need to login ' . $loginmsg_part1 = _('To use the %s Facebook Application you need to login ' .
'with your username and password. Don\'t have a username yet? '); 'with your username and password. Don\'t have a username yet? ');
$loginmsg_part2 = _(' a new account.'); $loginmsg_part2 = _(' a new account.');
$this->elementStart('dd'); $this->elementStart('dd');
@ -291,18 +278,18 @@ class FacebookAction extends Action
$this->element('a', $this->element('a',
array('href' => common_local_url('register')), _('Register')); array('href' => common_local_url('register')), _('Register'));
$this->text($loginmsg_part2); $this->text($loginmsg_part2);
$this->elementEnd('p');
$this->elementEnd('dd'); $this->elementEnd('dd');
$this->elementEnd('dl'); $this->elementEnd('dl');
$this->elementEnd('div'); $this->elementEnd('div');
} }
function showLoginForm($msg = null) function showLoginForm($msg = null)
{ {
$this->elementStart('div', array('class' => 'content')); $this->elementStart('div', array('id' => 'content'));
$this->element('h1', null, _('Login')); $this->element('h1', null, _('Login'));
if ($msg) { if ($msg) {
@ -330,6 +317,7 @@ class FacebookAction extends Action
$this->elementEnd('ul'); $this->elementEnd('ul');
$this->submit('submit', _('Login')); $this->submit('submit', _('Login'));
$this->elementEnd('fieldset');
$this->elementEnd('form'); $this->elementEnd('form');
$this->elementStart('p'); $this->elementStart('p');
@ -338,6 +326,7 @@ class FacebookAction extends Action
$this->elementEnd('p'); $this->elementEnd('p');
$this->elementEnd('div'); $this->elementEnd('div');
$this->elementEnd('div');
} }
@ -347,42 +336,70 @@ class FacebookAction extends Action
// Need to include inline CSS for styling the Profile box // Need to include inline CSS for styling the Profile box
$app_props = $this->facebook->api_client->Admin_getAppProperties(array('icon_url'));
$icon_url = $app_props['icon_url'];
$style = '<style> $style = '<style>
.entry-title *,
.entry-content * {
font-size:14px;
font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
}
.entry-title a,
.entry-content a {
color:#002E6E;
}
.entry-title .vcard .photo { .entry-title .vcard .photo {
float:left; float:left;
display:inline; display:inline;
margin-right:11px;
margin-bottom:11px
} }
.entry-title .vcard .nickname { .entry-title {
margin-left:5px; margin-bottom:11px;
} }
.entry-title p.entry-content { .entry-title p.entry-content {
display:inline; display:inline;
margin-left:5px; margin-left:5px;
} }
div.entry-content {
clear:both;
}
div.entry-content dl, div.entry-content dl,
div.entry-content dt, div.entry-content dt,
div.entry-content dd { div.entry-content dd {
display:inline; display:inline;
text-transform:lowercase;
} }
div.entry-content dt, div.entry-content dd,
div.entry-content dd { div.entry-content .device dt {
display:inline; margin-left:0;
margin-left:5px; margin-right:5px;
} }
div.entry-content dl.timestamp dt { div.entry-content dl.timestamp dt,
div.entry-content dl.response dt {
display:none; display:none;
} }
div.entry-content dd a { div.entry-content dd a {
display:inline-block; display:inline-block;
} }
#facebook_laconica_app {
text-indent:-9999px;
height:16px;
width:16px;
display:block;
background:url('.$icon_url.') no-repeat 0 0;
float:right;
}
</style>'; </style>';
$this->xw->openMemory(); $this->xw->openMemory();
$item = new FacebookNoticeListItem($notice, $this); $item = new FacebookProfileBoxNotice($notice, $this);
$item->show(); $item->show();
$fbml = "<fb:wide>$style " . $this->xw->outputMemory(false) . "</fb:wide>"; $fbml = "<fb:wide>$style " . $this->xw->outputMemory(false) . "</fb:wide>";
@ -465,8 +482,6 @@ class FacebookAction extends Action
$content_shortened = common_shorten_links($content); $content_shortened = common_shorten_links($content);
if (mb_strlen($content_shortened) > 140) { if (mb_strlen($content_shortened) > 140) {
common_debug("Content = '$content_shortened'", __FILE__);
common_debug("mb_strlen(\$content) = " . mb_strlen($content_shortened), __FILE__);
$this->showPage(_('That\'s too long. Max notice size is 140 chars.')); $this->showPage(_('That\'s too long. Max notice size is 140 chars.'));
return; return;
} }
@ -539,6 +554,18 @@ class FacebookNoticeForm extends NoticeForm
class FacebookNoticeList extends NoticeList class FacebookNoticeList extends NoticeList
{ {
/**
* constructor
*
* @param Notice $notice stream of notices from DB_DataObject
*/
function __construct($notice, $out=null)
{
parent::__construct($notice, $out);
}
/** /**
* show the list of notices * show the list of notices
* *
@ -593,6 +620,20 @@ class FacebookNoticeList extends NoticeList
class FacebookNoticeListItem extends NoticeListItem class FacebookNoticeListItem extends NoticeListItem
{ {
/**
* constructor
*
* Also initializes the profile attribute.
*
* @param Notice $notice The notice we'll display
*/
function __construct($notice, $out=null)
{
parent::__construct($notice, $out);
}
/** /**
* recipe function for displaying a single notice in the Facebook App. * recipe function for displaying a single notice in the Facebook App.
* *
@ -645,3 +686,65 @@ class FacebookNoticeListItem extends NoticeListItem
} }
} }
class FacebookProfileBoxNotice extends FacebookNoticeListItem
{
/**
* constructor
*
* Also initializes the profile attribute.
*
* @param Notice $notice The notice we'll display
*/
function __construct($notice, $out=null)
{
parent::__construct($notice, $out);
}
/**
* Recipe function for displaying a single notice in the
* Facebook App's Profile
*
* @return void
*/
function show()
{
$this->out->elementStart('div', 'entry-title');
$this->showAuthor();
$this->showContent();
$this->out->elementEnd('div');
$this->out->elementStart('div', 'entry-content');
$this->showNoticeLink();
$this->showNoticeSource();
$this->showReplyTo();
$this->out->elementEnd('div');
$this->showAppLink();
}
function showAppLink()
{
$this->facebook = getFacebook();
$app_props = $this->facebook->api_client->Admin_getAppProperties(
array('canvas_name', 'application_name'));
$this->app_uri = 'http://apps.facebook.com/' . $app_props['canvas_name'];
$this->app_name = $app_props['application_name'];
$this->out->elementStart('a', array('id' => 'facebook_laconica_app',
'href' => $this->app_uri));
$this->out->text($this->app_name);
$this->out->elementEnd('a');
}
}

View File

@ -1,10 +1,86 @@
@import url("display.css"); @import url("display.css");
@import url("../../identica/css/display.css"); @import url("../../identica/css/display.css");
span.facebook-button { border: 2px solid #777; padding: 5px; display: block; float: left; margin-right: 20px; -moz-border-radius: 4px; border-radius:4px; -webkit-border-radius:4px; font-weight: bold; background-color:#A9BF4F; color:#fff; font-size:1.2em } * {
font-size:14px;
font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
}
#wrap {
background-color:#F0F2F5;
padding-left:18px;
padding-right:18px;
width:auto;
}
p,label,
h1,h2,h3,h4,h5,h6 {
color:#000;
}
#content {
width:95%;
}
#site_nav_local_views a {
background-color:#D0DFE7;
}
#site_nav_local_views a:hover {
background-color:#FAFBFC;
}
span.facebook-button {
border: 2px solid #aaa;
padding: 3px;
display: block;
float: left;
margin-right: 20px;
-moz-border-radius: 4px;
border-radius:4px;
-webkit-border-radius:4px;
font-weight: bold;
background-color:#A9BF4F;
color:#fff;
font-size:1.2em
}
span.facebook-button a { color:#fff } span.facebook-button a { color:#fff }
.facebook_guide {
margin-bottom:18px;
}
.facebook_guide p {
font-weight:bold;
}
input {
height:auto !important;
}
#facebook-friends {
float:left;
width:100%;
}
#facebook-friends li {
float:left;
margin-right:2%;
margin-bottom:11px;
width:18%;
height:115px;
}
#facebook-friends li a {
float:left;
}
#add_to_profile {
position:absolute;
right:18px;
top:10px;
z-index:2;
}
.notice div.entry-content dl, .notice div.entry-content dl,
.notice div.entry-content dt, .notice div.entry-content dt,
.notice div.entry-content dd { .notice div.entry-content dd {
@ -19,12 +95,6 @@ margin-bottom:18px;
list-style-type:none; list-style-type:none;
} }
.facebook_guide p {
margin-bottom:18px;
font-size:1.3em;
font-weight:bold;
}
.form_settings label { .form_settings label {
margin-right:18px; margin-right:18px;
} }