}
require_once INSTALLDIR . '/plugins/Facebook/facebookutil.php';
-require_once INSTALLDIR . '/lib/noticeform.php';
+require_once INSTALLDIR . '/plugins/Facebook/facebooknoticeform.php';
class FacebookAction extends Action
{
-
var $facebook = null;
var $fbuid = null;
var $flink = null;
function showScripts()
{
- $this->script('js/facebookapp.js');
+ $this->script('plugins/Facebook/facebookapp.js');
}
/**
*
* @return void
*/
-
function startHTML($type=null)
{
$this->showStylesheets();
function showHead($error, $success)
{
-
if ($error) {
$this->element("h1", null, $error);
}
$this->elementStart('li', array('class' =>
($this->action == 'facebookhome') ? 'current' : 'facebook_home'));
$this->element('a',
- array('href' => 'index.php', 'title' => _m('Home')), _m('Home'));
+ // TRANS: Link description for 'Home' link that leads to a start page.
+ array('href' => 'index.php', 'title' => _m('MENU','Home')),
+ // TRANS: Tooltip for 'Home' link that leads to a start page.
+ _m('Home'));
$this->elementEnd('li');
if (common_config('invite', 'enabled')) {
array('class' =>
($this->action == 'facebookinvite') ? 'current' : 'facebook_invite'));
$this->element('a',
- array('href' => 'invite.php', 'title' => _m('Invite')), _m('Invite'));
+ // TRANS: Link description for 'Invite' link that leads to a page where friends can be invited.
+ array('href' => 'invite.php', 'title' => _m('MENU','Invite')),
+ // TRANS: Tooltip for 'Invite' link that leads to a page where friends can be invited.
+ _m('Invite'));
$this->elementEnd('li');
}
($this->action == 'facebooksettings') ? 'current' : 'facebook_settings'));
$this->element('a',
array('href' => 'settings.php',
- 'title' => _m('Settings')), _m('Settings'));
+ // TRANS: Link description for 'Settings' link that leads to a page user preferences can be set.
+ 'title' => _m('MENU','Settings')),
+ // TRANS: Tooltip for 'Settings' link that leads to a page user preferences can be set.
+ _m('Settings'));
$this->elementEnd('li');
$this->elementEnd('ul');
function showInstructions()
{
-
$this->elementStart('div', array('class' => 'facebook_guide'));
$this->elementStart('dl', array('class' => 'system_notice'));
$this->element('dt', null, 'Page Notice');
$loginmsg_part1 = _m('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 = _m(' a new account.');
$this->elementStart('dd');
$this->elementStart('p');
$this->text(sprintf($loginmsg_part1, common_config('site', 'name')));
+ // @todo FIXME: Bad i18n. Patchwork message in two parts.
$this->element('a',
array('href' => common_local_url('register')), _m('Register'));
- $this->text($loginmsg_part2);
+ $this->text( " " . $loginmsg_part2);
$this->elementEnd('p');
$this->elementEnd('dd');
$this->elementEnd('li');
$this->elementEnd('ul');
- $this->submit('submit', _m('Login'));
+ // TRANS: Login button.
+ $this->submit('submit', _m('BUTTON','Login'));
$this->elementEnd('fieldset');
$this->elementEnd('form');
$this->elementEnd('div');
$this->elementEnd('div');
-
}
function updateProfileBox($notice)
function saveNewNotice()
{
-
$user = $this->flink->getUser();
$content = $this->trimmed('status_textarea');
$this->showPage(_m('No notice content!'));
return;
} else {
- $content_shortened = common_shorten_links($content);
+ $content_shortened = $user->shortenLinks($content);
if (Notice::contentTooLong($content_shortened)) {
+ // @todo FIXME: i18n: Needs plural.
$this->showPage(sprintf(_m('That\'s too long. Max notice size is %d chars.'),
Notice::maxContent()));
return;
$cmd = $inter->handle_command($user, $content_shortened);
if ($cmd) {
-
// XXX fix this
-
$cmd->execute(new WebChannel());
return;
}
return;
}
- common_broadcast_notice($notice);
-
- // Also update the user's Facebook status
- facebookBroadcastNotice($notice);
-
}
-
-}
-
-class FacebookNoticeForm extends NoticeForm
-{
-
- var $post_action = null;
-
- /**
- * Constructor
- *
- * @param HTMLOutputter $out output channel
- * @param string $action action to return to, if any
- * @param string $content content to pre-fill
- */
-
- function __construct($out=null, $action=null, $content=null,
- $post_action=null, $user=null)
- {
- parent::__construct($out, $action, $content, $user);
- $this->post_action = $post_action;
- }
-
- /**
- * Action of the form
- *
- * @return string URL of the action
- */
-
- function action()
- {
- return $this->post_action;
- }
-
}
class FacebookNoticeList extends NoticeList
{
-
/**
* constructor
*
*
* @return int count of notices listed.
*/
-
function show()
{
$this->out->elementStart('div', array('id' =>'notices_primary'));
* @return FacebookNoticeListItem a list item for displaying the notice
* formatted for display in the Facebook App.
*/
-
function newListItem($notice)
{
return new FacebookNoticeListItem($notice, $this);
}
-
}
class FacebookNoticeListItem extends NoticeListItem
{
-
/**
* constructor
*
*
* @param Notice $notice The notice we'll display
*/
-
function __construct($notice, $out=null)
{
parent::__construct($notice, $out);
*
* @return void
*/
-
function show()
{
$this->showStart();
$this->showEnd();
}
-
}
class FacebookProfileBoxNotice extends FacebookNoticeListItem
{
-
/**
* constructor
*
*
* @param Notice $notice The notice we'll display
*/
-
function __construct($notice, $out=null)
{
parent::__construct($notice, $out);
*
* @return void
*/
-
function show()
{
$this->showNotice();
function showAppLink()
{
-
$this->facebook = getFacebook();
$app_props = $this->facebook->api_client->Admin_getAppProperties(
$this->out->text($this->app_name);
$this->out->elementEnd('a');
}
-
}