summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/facebookhome.php5
-rw-r--r--actions/facebookinvite.php8
-rw-r--r--lib/facebookaction.php169
-rw-r--r--theme/base/css/facebookapp.css84
4 files changed, 217 insertions, 49 deletions
diff --git a/actions/facebookhome.php b/actions/facebookhome.php
index d943104c2..5946e6c98 100644
--- a/actions/facebookhome.php
+++ b/actions/facebookhome.php
@@ -148,14 +148,11 @@ class FacebookhomeAction extends FacebookAction
function showNoticeForm()
{
-
$post_action = "$this->app_uri/index.php";
$notice_form = new FacebookNoticeForm($this, $post_action, null,
$post_action, $this->user);
$notice_form->show();
-
-
}
function title()
@@ -169,7 +166,6 @@ class FacebookhomeAction extends FacebookAction
function showContent()
{
-
$notice = $this->user->noticesWithFriends(($this->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->page, 'index.php', array('nickname' => $this->user->nickname));
-
}
function showNoticeList($notice)
diff --git a/actions/facebookinvite.php b/actions/facebookinvite.php
index b7224783a..3c872f94b 100644
--- a/actions/facebookinvite.php
+++ b/actions/facebookinvite.php
@@ -73,7 +73,7 @@ class FacebookinviteAction extends FacebookAction
$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) {
$this->elementStart('li');
@@ -112,11 +112,11 @@ class FacebookinviteAction extends FacebookAction
$this->element('h2', null, sprintf(_('Friends already using %s:'),
common_config('site', 'name')));
- $this->elementStart("ul");
-
+ $this->elementStart('ul', array('id' => 'facebook-friends'));
+
foreach ($exclude_ids as $friend) {
$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,
'capitalize' => 'true'));
$this->elementEnd('li');
diff --git a/lib/facebookaction.php b/lib/facebookaction.php
index f42427540..043a078cd 100644
--- a/lib/facebookaction.php
+++ b/lib/facebookaction.php
@@ -129,7 +129,7 @@ class FacebookAction extends Action
* Start an Facebook ready HTML document
*
* 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.
*
@@ -140,6 +140,9 @@ class FacebookAction extends Action
function startHTML($type=null)
{
+ $this->showStylesheets();
+ $this->showScripts();
+
$this->elementStart('div', array('class' => 'facebook-page'));
}
@@ -181,8 +184,6 @@ class FacebookAction extends Action
function showHead($error, $success)
{
- $this->showStylesheets();
- $this->showScripts();
if ($error) {
$this->element("h1", null, $error);
@@ -204,7 +205,6 @@ class FacebookAction extends Action
// Make this into a widget later
function showLocalNav()
{
-
$this->elementStart('ul', array('class' => 'nav'));
$this->elementStart('li', array('class' =>
@@ -229,18 +229,7 @@ class FacebookAction extends Action
$this->elementEnd('li');
$this->elementEnd('ul');
-
}
-
- /**
- * Show primary navigation.
- *
- * @return nothing
- */
- function showPrimaryNav()
- {
- // we don't want to show anything for this
- }
/**
* Show header of the page.
@@ -254,7 +243,6 @@ class FacebookAction extends Action
$this->elementStart('div', array('id' => 'header'));
$this->showLogo();
$this->showNoticeForm();
- $this->showPrimaryNav();
$this->elementEnd('div');
}
@@ -282,7 +270,6 @@ class FacebookAction extends Action
$loginmsg_part1 = _('To use the %s Facebook Application you need to login ' .
'with your username and password. Don\'t have a username yet? ');
-
$loginmsg_part2 = _(' a new account.');
$this->elementStart('dd');
@@ -291,18 +278,18 @@ class FacebookAction extends Action
$this->element('a',
array('href' => common_local_url('register')), _('Register'));
$this->text($loginmsg_part2);
+ $this->elementEnd('p');
$this->elementEnd('dd');
+
$this->elementEnd('dl');
-
$this->elementEnd('div');
-
}
function showLoginForm($msg = null)
{
- $this->elementStart('div', array('class' => 'content'));
+ $this->elementStart('div', array('id' => 'content'));
$this->element('h1', null, _('Login'));
if ($msg) {
@@ -330,6 +317,7 @@ class FacebookAction extends Action
$this->elementEnd('ul');
$this->submit('submit', _('Login'));
+ $this->elementEnd('fieldset');
$this->elementEnd('form');
$this->elementStart('p');
@@ -338,6 +326,7 @@ class FacebookAction extends Action
$this->elementEnd('p');
$this->elementEnd('div');
+ $this->elementEnd('div');
}
@@ -347,42 +336,70 @@ class FacebookAction extends Action
// 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>
+ .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 {
float:left;
display:inline;
+ margin-right:11px;
+ margin-bottom:11px
}
- .entry-title .vcard .nickname {
- margin-left:5px;
- }
-
+ .entry-title {
+ margin-bottom:11px;
+ }
.entry-title p.entry-content {
display:inline;
- margin-left:5px;
+ margin-left:5px;
}
+ div.entry-content {
+ clear:both;
+ }
div.entry-content dl,
div.entry-content dt,
div.entry-content dd {
display:inline;
+ text-transform:lowercase;
}
- div.entry-content dt,
- div.entry-content dd {
- display:inline;
- margin-left:5px;
+ div.entry-content dd,
+ div.entry-content .device dt {
+ margin-left:0;
+ margin-right:5px;
}
- div.entry-content dl.timestamp dt {
+ div.entry-content dl.timestamp dt,
+ div.entry-content dl.response dt {
display:none;
}
div.entry-content dd a {
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>';
$this->xw->openMemory();
- $item = new FacebookNoticeListItem($notice, $this);
+ $item = new FacebookProfileBoxNotice($notice, $this);
$item->show();
$fbml = "<fb:wide>$style " . $this->xw->outputMemory(false) . "</fb:wide>";
@@ -465,8 +482,6 @@ class FacebookAction extends Action
$content_shortened = common_shorten_links($content);
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.'));
return;
}
@@ -539,6 +554,18 @@ class FacebookNoticeForm extends NoticeForm
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
*
@@ -593,6 +620,20 @@ class FacebookNoticeList extends NoticeList
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.
*
@@ -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');
+ }
+
+}
diff --git a/theme/base/css/facebookapp.css b/theme/base/css/facebookapp.css
index af188ad7a..163b41fb4 100644
--- a/theme/base/css/facebookapp.css
+++ b/theme/base/css/facebookapp.css
@@ -1,10 +1,86 @@
@import url("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 }
+.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 dt,
.notice div.entry-content dd {
@@ -19,12 +95,6 @@ margin-bottom:18px;
list-style-type:none;
}
-.facebook_guide p {
-margin-bottom:18px;
-font-size:1.3em;
-font-weight:bold;
-}
-
.form_settings label {
margin-right:18px;
}