Merge branch 'master' of /var/www/trunk

Conflicts:

	actions/facebookhome.php
	actions/facebooksettings.php
This commit is contained in:
Evan Prodromou 2009-01-19 13:35:17 +00:00
commit 12c475c101
11 changed files with 2058 additions and 262 deletions

View File

@ -19,7 +19,7 @@
if (!defined('LACONICA')) { exit(1); }
require_once(INSTALLDIR.'/lib/facebookaction.php');
require_once INSTALLDIR.'/lib/facebookaction.php';
class FacebookhomeAction extends FacebookAction
{
@ -34,9 +34,43 @@ class FacebookhomeAction extends FacebookAction
// Check to see whether there's already a Facebook link for this user
$flink = Foreign_link::getByForeignID($fbuid, FACEBOOK_SERVICE);
// If the user has opted not to initially allow the app to have
// Facebook status update permission, store that preference. Only
// promt the user the first time she uses the app
if ($this->arg('skip')) {
$facebook->api_client->data_setUserPreference(
FACEBOOK_PROMPTED_UPDATE_PREF, 'true');
}
if ($flink) {
if ($_POST['submit'] == 'Send') {
$this->saveNewNotice($flink);
return;
}
$user = $flink->getUser();
common_set_user($user);
// If this is the first time the user has started the app
// prompt for Facebook status update permission
if (!$facebook->api_client->users_hasAppPermission('status_update')) {
if ($facebook->api_client->data_getUserPreference(
FACEBOOK_PROMPTED_UPDATE_PREF) != 'true') {
$this->getUpdatePermission();
return;
}
}
// Use is authenticated and has already been prompted once for
// Facebook status update permission? Then show the main page
// of the app
$this->showHome($flink, null);
} else {
// User hasn't authenticated yet, prompt for creds
$this->login($fbuid);
}
@ -71,8 +105,10 @@ class FacebookhomeAction extends FacebookAction
// XXX: Do some error handling here
$this->setDefaults();
//$this->showHome($flink, _('You can now use Identi.ca from Facebook!'));
$this->showHome($flink, _('You can now use Identi.ca from Facebook!'));
$this->getUpdatePermission();
return;
} else {
$msg = _('Incorrect username or password.');
@ -80,6 +116,7 @@ class FacebookhomeAction extends FacebookAction
}
$this->showLoginForm($msg);
}
function setDefaults()
@ -87,7 +124,10 @@ class FacebookhomeAction extends FacebookAction
$facebook = get_facebook();
// A default prefix string for notices
$facebook->api_client->data_setUserPreference(1, 'dented: ');
$facebook->api_client->data_setUserPreference(
FACEBOOK_NOTICE_PREFIX, 'dented: ');
$facebook->api_client->data_setUserPreference(
FACEBOOK_PROMPTED_UPDATE_PREF, 'false');
}
function showHome($flink, $msg)
@ -101,19 +141,16 @@ class FacebookhomeAction extends FacebookAction
$notice = $user->getCurrentNotice();
update_profile_box($facebook, $fbuid, $user, $notice);
$this->showHeader($msg);
$this->showNoticeForm($user);
$this->showNav('Home');
$this->show_header('Home');
echo $this->showNotices($user);
if ($msg) {
$this->element('fb:success', array('message' => $msg));
}
echo $this->show_notices($user);
$this->show_footer();
$this->showFooter();
}
function show_notices($user)
function showNotices($user)
{
$page = $this->trimmed('page');
@ -123,16 +160,113 @@ class FacebookhomeAction extends FacebookAction
$notice = $user->noticesWithFriends(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
$cnt = $this->show_notice_list($notice);
$cnt = $this->showNoticeList($notice);
common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
$page, 'all', array('nickname' => $user->nickname));
facebookPagination($page > 1, $cnt > NOTICES_PER_PAGE,
$page, 'all', array('nickname' => $user->nickname));
}
function show_notice_list($notice)
function showNoticeList($notice)
{
$nl = new NoticeList($notice);
$nl = new FacebookNoticeList($notice);
return $nl->show();
}
function getUpdatePermission() {
$facebook = get_facebook();
$fbuid = $facebook->require_login();
startFBML();
$this->showStylesheets();
$this->showScripts();
$this->showLogo();
common_element_start('div', array('class' => 'content'));
// Figure what the URL of our app is.
$app_props = $facebook->api_client->Admin_getAppProperties(
array('canvas_name', 'application_name'));
$app_url = 'http://apps.facebook.com/' . $app_props['canvas_name'] . '/index.php';
$app_name = $app_props['application_name'];
$instructions = sprintf(_('If you would like the %s app to automatically update ' .
'your Facebook status with your latest notice, you need ' .
'to give it permission.'), $app_name);
common_element_start('p');
common_element('span', array('id' => 'permissions_notice'), $instructions);
common_element_end('p');
common_element_start('form', array('method' => 'post',
'action' => $app_url,
'id' => 'facebook-skip-permissions'));
common_element_start('ul', array('id' => 'fb-permissions-list'));
common_element_start('li', array('id' => 'fb-permissions-item'));
common_element_start('fb:prompt-permission', array('perms' => 'status_update',
'next_fbjs' => 'document.setLocation(\'' . $app_url . '\')'));
common_element('span', array('class' => 'facebook-button'),
_('Allow Identi.ca to update my Facebook status'));
common_element_end('fb:prompt-permission');
common_element_end('li');
common_element_start('li', array('id' => 'fb-permissions-item'));
common_submit('skip', _('Skip'));
common_element_end('li');
common_element_end('ul');
common_element_end('form');
common_element_end('div');
common_end_xml();
}
function saveNewNotice($flink)
{
$user = $flink->getUser();
$content = $_POST['status_textarea'];
if (!$content) {
$this->showHome($flink, _('No content!'));
return;
} else {
$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->showHome($flink, _('That\'s too long. Max notice size is 140 chars.'));
return;
}
}
$inter = new CommandInterpreter();
$cmd = $inter->handle_command($user, $content_shortened);
if ($cmd) {
$cmd->execute(new WebChannel());
return;
}
$replyto = $this->trimmed('inreplyto');
$notice = Notice::saveNew($user->id, $content,
'Facebook', 1, ($replyto == 'false') ? null : $replyto);
if (is_string($notice)) {
$this->showHome($flink, 'Error!');
return;
}
common_broadcast_notice($notice);
$this->showHome($flink, 'Success!');
}
}

View File

@ -41,7 +41,7 @@ class FacebookinviteAction extends FacebookAction
$facebook = get_facebook();
$fbuid = $facebook->require_login();
$this->show_header('Invite');
$this->showHeader('Invite');
$this->element('h2', null, _('Thanks for inviting your friends to use Identi.ca!'));
$this->element('p', null, _('Invitations have been sent to the following users:'));
@ -60,7 +60,7 @@ class FacebookinviteAction extends FacebookAction
$this->elementEnd("ul");
$this->show_footer();
$this->showFooter();
}
function showInviteForm()
@ -69,7 +69,8 @@ class FacebookinviteAction extends FacebookAction
$facebook = get_facebook();
$fbuid = $facebook->require_login();
$this->show_header('Invite');
$this->showHeader();
$this->showNav('Invite');
// Get a list of users who are already using the app for exclusion
$exclude_ids = $facebook->api_client->friends_getAppUsers();
@ -104,7 +105,7 @@ class FacebookinviteAction extends FacebookAction
$this->elementEnd("ul");
$this->show_footer();
$this->showFooter();
}

View File

@ -19,7 +19,7 @@
if (!defined('LACONICA')) { exit(1); }
require_once(INSTALLDIR.'/lib/facebookaction.php');
require_once INSTALLDIR.'/lib/facebookaction.php';
class FacebookremoveAction extends FacebookAction
{

View File

@ -19,7 +19,7 @@
if (!defined('LACONICA')) { exit(1); }
require_once(INSTALLDIR.'/lib/facebookaction.php');
require_once INSTALLDIR.'/lib/facebookaction.php';
class FacebooksettingsAction extends FacebookAction
{
@ -29,13 +29,13 @@ class FacebooksettingsAction extends FacebookAction
parent::handle($args);
if ($this->arg('save')) {
$this->save_settings();
$this->saveSettings();
} else {
$this->show_form();
$this->showForm();
}
}
function save_settings() {
function saveSettings() {
$noticesync = $this->arg('noticesync');
$replysync = $this->arg('replysync');
@ -50,36 +50,25 @@ class FacebooksettingsAction extends FacebookAction
$flink->set_flags($noticesync, $replysync, false);
$result = $flink->update($original);
$facebook->api_client->data_setUserPreference(1, substr($prefix, 0, 128));
$facebook->api_client->data_setUserPreference(FACEBOOK_NOTICE_PREFIX,
substr($prefix, 0, 128));
if ($result) {
$this->show_form('Sync preferences saved.', true);
$this->showForm('Sync preferences saved.', true);
} else {
$this->show_form('There was a problem saving your sync preferences!');
$this->showForm('There was a problem saving your sync preferences!');
}
}
function show_form($msg = null, $success = false) {
function showForm($msg = null, $success = false) {
$facebook = get_facebook();
$fbuid = $facebook->require_login();
$flink = Foreign_link::getByForeignID($fbuid, FACEBOOK_SERVICE);
$this->show_header('Settings', $msg, $success);
$this->elementStart('fb:if-section-not-added', array('section' => 'profile'));
$this->element('h2', null, _('Add an Identi.ca box to my profile'));
$this->elementStart('p');
$this->element('fb:add-section-button', array('section' => 'profile'));
$this->elementEnd('p');
$this->elementEnd('fb:if-section-not-added');
$this->elementStart('p');
$this->elementStart('fb:prompt-permission', array('perms' => 'status_update'));
$this->element('h2', null, _('Allow Identi.ca to update my Facebook status'));
$this->elementEnd('fb:prompt-permission');
$this->elementEnd('p');
$this->showHeader($msg, $success);
$this->showNav('Settings');
if ($facebook->api_client->users_hasAppPermission('status_update')) {
@ -91,13 +80,10 @@ class FacebooksettingsAction extends FacebookAction
$this->checkbox('noticesync', _('Automatically update my Facebook status with my notices.'),
($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND) : true);
$this->checkbox('replysync', _('Send local "@" replies to Facebook.'),
$this->checkbox('replysync', _('Send "@" replies to Facebook.'),
($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true);
// function $this->input($id, $label, $value=null,$instructions=null)
$prefix = $facebook->api_client->data_getUserPreference(1);
$this->input('prefix', _('Prefix'),
($prefix) ? $prefix : null,
@ -106,9 +92,34 @@ class FacebooksettingsAction extends FacebookAction
$this->elementEnd('form');
} else {
// Figure what the URL of our app is.
$app_props = $facebook->api_client->Admin_getAppProperties(
array('canvas_name', 'application_name'));
$app_url = 'http://apps.facebook.com/' . $app_props['canvas_name'] . '/settings.php';
$app_name = $app_props['application_name'];
$instructions = sprintf(_('If you would like the %s app to automatically update ' .
'your Facebook status with your latest notice, you need ' .
'to give it permission.'), $app_name);
common_element_start('p');
common_element('span', array('id' => 'permissions_notice'), $instructions);
common_element_end('p');
common_element_start('ul', array('id' => 'fb-permissions-list'));
common_element_start('li', array('id' => 'fb-permissions-item'));
common_element_start('fb:prompt-permission', array('perms' => 'status_update',
'next_fbjs' => 'document.setLocation(\'' . $app_url . '\')'));
common_element('span', array('class' => 'facebook-button'),
_('Allow Identi.ca to update my Facebook status'));
common_element_end('fb:prompt-permission');
common_element_end('li');
common_element_end('ul');
}
$this->show_footer();
$this->showFooter();
}
}

18
js/facebookapp.js Normal file
View File

@ -0,0 +1,18 @@
/*
* Laconica - a distributed open-source microblogging tool
* Copyright (C) 2008, Controlez-Vous, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* 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/>.
*/

View File

@ -17,9 +17,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (!defined('LACONICA')) { exit(1); }
if (!defined('LACONICA')) {
exit(1);
}
require_once(INSTALLDIR.'/lib/facebookutil.php');
require_once INSTALLDIR.'/lib/facebookutil.php';
class FacebookAction extends Action
{
@ -29,33 +31,39 @@ class FacebookAction extends Action
parent::handle($args);
}
function show_header($selected = 'Home', $msg = null, $success = false)
function showLogo(){
global $xw;
$this->showStylesheets();
$this->showScripts();
common_element_start('a', array('class' => 'url home bookmark',
'href' => common_local_url('public')));
if (common_config('site', 'logo') || file_exists(theme_file('logo.png'))) {
common_element('img', array('class' => 'logo photo',
'src' => (common_config('site', 'logo')) ?
common_config('site', 'logo') : theme_path('logo.png'),
'alt' => common_config('site', 'name')));
}
common_element('span', array('class' => 'fn org'), common_config('site', 'name'));
common_element_end('a');
}
function showHeader($msg = null, $success = false)
{
startFBML();
start_fbml();
# Add a timestamp to the CSS file so Facebook cache wont ignore our changes
$ts = filemtime(theme_file('facebookapp.css'));
$cssurl = theme_path('facebookapp.css') . "?ts=$ts";
common_element('link', array('rel' => 'stylesheet',
'type' => 'text/css',
'href' => $cssurl));
common_element('fb:dashboard');
common_element_start('fb:tabs');
common_element('fb:tab-item', array('title' => 'Home',
'href' => 'index.php',
'selected' => ($selected == 'Home')));
common_element('fb:tab-item', array('title' => 'Invite',
'href' => 'invite.php',
'selected' => ($selected == 'Invite')));
common_element('fb:tab-item', array('title' => 'Settings',
'href' => 'settings.php',
'selected' => ($selected == 'Settings')));
common_element_end('fb:tabs');
common_element_start('fb:if-section-not-added', array('section' => 'profile'));
common_element_start('span', array('id' => 'add_to_profile'));
common_element('fb:add-section-button', array('section' => 'profile'));
common_element_end('span');
common_element_end('fb:if-section-not-added');
$this->showLogo();
if ($msg) {
if ($success) {
@ -65,47 +73,135 @@ class FacebookAction extends Action
}
}
common_element_start('div', 'main_body');
common_element_start('div', 'main_body');
}
function showNav($selected = 'Home')
{
common_element_start('dl', array("id" => 'site_nav_local_views'));
common_element('dt', null, _('Local Views'));
common_element_start('dd');
common_element_start('ul', array('class' => 'nav'));
common_element_start('li', array('class' =>
($selected == 'Home') ? 'current' : 'facebook_home'));
common_element('a',
array('href' => 'index.php', 'title' => _('Home')), _('Home'));
common_element_end('li');
common_element_start('li',
array('class' =>
($selected == 'Invite') ? 'current' : 'facebook_invite'));
common_element('a',
array('href' => 'invite.php', 'title' => _('Invite')), _('Invite'));
common_element_end('li');
common_element_start('li',
array('class' =>
($selected == 'Settings') ? 'current' : 'facebook_settings'));
common_element('a',
array('href' => 'settings.php',
'title' => _('Settings')), _('Settings'));
common_element_end('li');
common_element_end('ul');
common_element_end('dd');
common_element_end('dl');
}
function show_footer()
function showFooter()
{
common_element_end('div');
common_end_xml();
}
function showInstructions()
{
global $xw;
common_element_start('dl', array('class' => 'system_notice'));
common_element('dt', null, 'Page Notice');
$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.');
common_element_start('dd');
common_element_start('p');
common_text(sprintf($loginmsg_part1, common_config('site', 'name')));
common_element('a',
array('href' => common_local_url('register')), _('Register'));
common_text($loginmsg_part2);
common_element_end('dd');
common_element_end('dl');
}
function showStylesheets()
{
global $xw;
common_element('link', array('rel' => 'stylesheet',
'type' => 'text/css',
'href' => getFacebookBaseCSS()));
common_element('link', array('rel' => 'stylesheet',
'type' => 'text/css',
'href' => getFacebookThemeCSS()));
}
function showScripts()
{
global $xw;
common_element('script', array('type' => 'text/javascript',
'src' => getFacebookJS()));
}
function showLoginForm($msg = null)
{
start_fbml();
startFBML();
common_element_start('a', array('href' => 'http://identi.ca'));
common_element('img', array('src' => 'http://theme.identi.ca/identica/logo.png',
'alt' => 'Identi.ca',
'id' => 'logo'));
common_element_end('a');
$this->showStylesheets();
$this->showScripts();
$this->showLogo();
common_element_start('div', array('class' => 'content'));
common_element('h1', null, _('Login'));
if ($msg) {
common_element('fb:error', array('message' => $msg));
}
common_element("h2", null,
_('To add the Identi.ca application, you need to log into your Identi.ca account.'));
$this->showInstructions();
common_element_start('div', array('id' => 'content_inner'));
common_element_start('div', array('class' => 'instructions'));
common_element_start('p');
common_raw('Login with your username and password. Don\'t have a username yet?'
.' <a href="http://identi.ca/main/register">Register</a> a new account.');
common_element_end('p');
common_element_end('div');
common_element_start('div', array('id' => 'content'));
common_element_start('form', array('method' => 'post',
'class' => 'form_settings',
'id' => 'login',
'action' => 'index.php'));
common_element_start('fieldset');
common_element('legend', null, _('Login to site'));
common_element_start('ul', array('class' => 'form_datas'));
common_element_start('li');
common_input('nickname', _('Nickname'));
common_element_end('li');
common_element_start('li');
common_password('password', _('Password'));
common_element_end('li');
common_element_end('ul');
common_submit('submit', _('Login'));
common_element_end('form');
@ -114,6 +210,7 @@ class FacebookAction extends Action
common_element('a', array('href' => common_local_url('recoverpassword')),
_('Lost or forgotten password?'));
common_element_end('p');
common_element_end('div');
common_end_xml();
@ -121,4 +218,53 @@ class FacebookAction extends Action
}
function showNoticeForm($user)
{
global $xw;
common_element_start('form', array('id' => 'form_notice',
'method' => 'post',
'action' => 'index.php'));
common_element_start('fieldset');
common_element('legend', null, 'Send a notice');
common_element_start('ul', 'form_datas');
common_element_start('li', array('id' => 'noticcommon_elemente_text'));
common_element('label', array('for' => 'notice_data-text'),
sprintf(_('What\'s up, %s?'), $user->nickname));
common_element('textarea', array('id' => 'notice_data-text',
'cols' => 35,
'rows' => 4,
'name' => 'status_textarea'));
common_element_end('li');
common_element_end('ul');
common_element_start('dl', 'form_note');
common_element('dt', null, _('Available characters'));
common_element('dd', array('id' => 'notice_text-count'),
'140');
common_element_end('dl');
common_element_start('ul', array('class' => 'form_actions'));
common_element_start('li', array('id' => 'notice_submit'));
common_submit('submit', _('Send'));
/*
common_element('input', array('id' => 'notice_action-submit',
'class' => 'submit',
'name' => 'status_submit',
'type' => 'submit',
'value' => _('Send')));
*/
common_element_end('li');
common_element_end('ul');
common_element_end('fieldset');
common_element_end('form');
}
}

View File

@ -17,10 +17,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
require_once(INSTALLDIR.'/extlib/facebook/facebook.php');
require_once(INSTALLDIR.'/lib/noticelist.php');
require_once INSTALLDIR.'/extlib/facebook/facebook.php';
require_once INSTALLDIR.'/lib/noticelist.php';
define("FACEBOOK_SERVICE", 2); // Facebook is foreign_service ID 2
define("FACEBOOK_NOTICE_PREFIX", 1);
define("FACEBOOK_PROMPTED_UPDATE_PREF", 2);
// Gets all the notices from users with a Facebook link since a given ID
function get_facebook_notices($since)
@ -42,7 +44,7 @@ function get_facebook()
return new Facebook($apikey, $secret);
}
function start_fbml($indent = true)
function startFBML($indent = true)
{
global $xw;
$xw = new XMLWriter();
@ -94,7 +96,7 @@ function update_profile_box($facebook, $fbuid, $user, $notice)
$xw = new XMLWriter();
$xw->openMemory();
$item = new NoticeListItem($notice);
$item = new FacebookNoticeListItem($notice);
$item->show();
$fbml = "<fb:wide>$style " . $xw->outputMemory(false) . "</fb:wide>";
@ -104,3 +106,182 @@ function update_profile_box($facebook, $fbuid, $user, $notice)
$facebook->api_client->profile_setFBML(null, $fbuid, $fbml, null, null, $fbml_main);
}
function getFacebookBaseCSS()
{
# Add a timestamp to the CSS file so Facebook cache wont ignore our changes
$ts = filemtime(INSTALLDIR.'/theme/base/css/facebookapp.base.css');
$cssurl = INSTALLDIR.'/theme/base/css/facebookapp.base.css' . "?ts=$ts";
return $cssurl;
}
function getFacebookThemeCSS()
{
# Add a timestamp to the CSS file so Facebook cache wont ignore our changes
$ts = filemtime(theme_file('css/facebookapp.theme.css'));
$cssurl = theme_path('css/facebookapp.theme.css') . "?ts=$ts";
return $cssurl;
}
function getFacebookJS() {
# Add a timestamp to the FBJS file so Facebook cache wont ignore our changes
$ts = filemtime(INSTALLDIR.'/js/facebookapp.js');
$jsurl = common_path('js/facebookapp.js') . "?ts=$ts";
return $jsurl;
}
// Does a little before-after block for next/prev page
function facebookPagination($have_before, $have_after, $page, $action, $args=null)
{
if ($have_before || $have_after) {
common_element_start('div', array('id' => 'pagination'));
common_element_start('ul', array('id' => 'nav_pagination'));
}
if ($have_before) {
$pargs = array('page' => $page-1);
$newargs = ($args) ? array_merge($args,$pargs) : $pargs;
common_element_start('li', 'before');
common_element('a', array('href' => "index.php?page=$newargs[page]", 'rel' => 'prev'),
_('« After'));
common_element_end('li');
}
if ($have_after) {
$pargs = array('page' => $page+1);
$newargs = ($args) ? array_merge($args,$pargs) : $pargs;
common_element_start('li', 'after');
common_element('a', array('href' => "index.php?page=$newargs[page]", 'rel' => 'next'),
_('Before »'));
common_element_end('li');
}
if ($have_before || $have_after) {
common_element_end('ul');
common_element_end('div');
}
}
class FacebookNoticeList extends NoticeList
{
/**
* show the list of notices
*
* "Uses up" the stream by looping through it. So, probably can't
* be called twice on the same list.
*
* @return int count of notices listed.
*/
function show()
{
common_element_start('div', array('id' =>'notices_primary'));
common_element('h2', null, _('Notices'));
common_element_start('ul', array('class' => 'notices'));
$cnt = 0;
while ($this->notice->fetch() && $cnt <= NOTICES_PER_PAGE) {
$cnt++;
if ($cnt > NOTICES_PER_PAGE) {
break;
}
$item = $this->newListItem($this->notice);
$item->show();
}
common_element_end('ul');
common_element_end('div');
return $cnt;
}
/**
* returns a new list item for the current notice
*
* Overridden to return a Facebook specific list item.
*
* @param Notice $notice the current notice
*
* @return FacebookNoticeListItem a list item for displaying the notice
* formatted for display in the Facebook App.
*/
function newListItem($notice)
{
return new FacebookNoticeListItem($notice);
}
}
class FacebookNoticeListItem extends NoticeListItem
{
/**
* recipe function for displaying a single notice in the Facebook App.
*
* Overridden to strip out some of the controls that we don't
* want to be available.
*
* @return void
*/
function show()
{
$this->showStart();
common_element_start('div', 'entry-title');
$this->showAuthor();
$this->showContent();
common_element_end('div');
common_element_start('div', 'entry-content');
$this->showNoticeLink();
$this->showNoticeSource();
$this->showReplyTo();
common_element_end('div');
$this->showEnd();
}
function showStart()
{
// XXX: RDFa
// TODO: add notice_type class e.g., notice_video, notice_image
common_element_start('li', array('class' => 'hentry notice',
'id' => 'notice-' . $this->notice->id));
}
function showNoticeLink()
{
$noticeurl = common_local_url('shownotice',
array('notice' => $this->notice->id));
// XXX: we need to figure this out better. Is this right?
if (strcmp($this->notice->uri, $noticeurl) != 0 &&
preg_match('/^http/', $this->notice->uri)) {
$noticeurl = $this->notice->uri;
}
common_element_start('dl', 'timestamp');
common_element('dt', null, _('Published'));
common_element_start('dd', null);
common_element_start('a', array('rel' => 'bookmark',
'href' => $noticeurl));
$dt = common_date_iso8601($this->notice->created);
common_element('abbr', array('class' => 'published',
'title' => $dt),
common_date_string($this->notice->created));
common_element_end('a');
common_element_end('dd');
common_element_end('dl');
}
}

View File

@ -67,9 +67,13 @@ while($notice->fetch()) {
// If it's not a reply, or if the user WANTS to send replies...
if (!preg_match('/@[a-zA-Z0-9_]{1,15}\b/u', $content) ||
(($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) == FOREIGN_NOTICE_SEND_REPLY)) {
update_status($fbuid, $content);
update_profile_box($facebook, $fbuid, $user, $notice);
$cnt++;
// Avoid a Loop
if ($notice->source != 'Facebook') {
update_status($fbuid, $content);
update_profile_box($facebook, $fbuid, $user, $notice);
$cnt++;
}
}
}
}

View File

@ -0,0 +1,285 @@
/* theme: identica */
html {
background-color:#ddd;
}
body {
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
font-size:1em;
background-color:#ddd;
}
input, textarea, select, option {
font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
}
input, textarea, select {
border-color:#aaa;
}
input:focus, textarea:focus, select:focus {
border-color:#A9BF4F;
}
input.submit {
background-color:#A9BF4F;
color:#fff;
}
a {
color:#002E6E;
}
a:active {
background-color:#ddd;
}
.notice p.entry-content a:visited {
background-color:#fcfcfc;
border-radius:4px;
-moz-border-radius:4px;
-webkit-border-radius:4px;
}
.notice p.entry-content .vcard a {
background-color:#fcfffc;
border-radius:4px;
-moz-border-radius:4px;
-webkit-border-radius:4px;
}
#aside_primary {
background-color:#CEE1E9;
}
#form_notice textarea {
}
#form_notice label {
color:#88171A;
}
#notice_text-count {
color:#333;
}
#form_notice.warning #notice_text-count {
color:#000;
background-color:#A9BF4F;
}
#form_notice.warning #notice_data-text {
border-color:#A9BF4F;
}
#form_notice #notice_data-attach_view {
background-image:url(../images/icons/twotone/green/paper-clip.gif);
background-repeat:no-repeat;
background-position:0 45%;
background-color:transparent;
}
#site_nav_global_primary a {
}
#form_notice .form_actions input.submit {
}
#nav_register a {
background-color:#A9BF4F;
color:#fff;
text-decoration:none;
font-weight:bold;
padding:2px 4px;
}
#nav_login a {
}
#site_nav_local_views a {
border-color:#fff;
background-color:rgba(255, 255, 255, 0.2);
}
#site_nav_local_views a:hover {
background-color:rgba(255, 255, 255, 0.7);
}
#content,
#site_nav_local_views .current a {
background-color:#fff;
}
#page_notice .error {
background-color:#F7E8E8;
}
#page_notice .success {
background-color:#EFF3DC;
}
#export_data li a {
background-repeat:no-repeat;
background-position:0 45%;
}
#export_data li a.rss {
background-image:url(../../base/images/icons/icon_rss.jpg);
}
#export_data li a.atom {
background-image:url(../../base/images/icons/icon_atom.jpg);
}
#export_data li a.foaf {
background-image:url(../../base/images/icons/icon_foaf.gif);
}
#export_data li a.export_vcard {
background-image:url(../../base/images/icons/icon_vcard.gif);
}
/*user_actions*/
#user_actions li {
border-top-color:#eee;
}
#user_actions a {
color:#000;
}
#user_subscribe a,
#TB_window input.submit,
.form_user_subscribe input.submit {
background:#CEE1E9 url(../images/icons/twotone/green/shield.gif) 0 45% no-repeat;
}
.form_user_unsubscribe input.submit {
background-color:#647819;
color:#fff;
}
#user_send-a-message a {
background:url(../images/icons/twotone/green/quote.gif) 0 45% no-repeat;
}
.form_user_nudge input.submit {
background:url(../images/icons/twotone/green/mail.gif) 0 45% no-repeat;
}
.form_user_block input.submit {
background:url(../images/icons/twotone/green/against.gif) 0 45% no-repeat;
}
.user_tags .mark_hash {
color:#555;
}
.vcard .fn {
}
.vcard .fn:hover {
}
/* NOTICES */
.notices li.over {
background-color:#fcfcfc;
}
.notice div.entry-content a {
}
.notice div.entry-content a:hover {
}
.notice-data a span {
background-color:transparent;
background-repeat:no-repeat;
background-position:0 45%;
}
.notice_video .notice-data a span {
background-image:url(../images/icons/twotone/green/camera.gif);
}
.notice_audio .notice-data a span {
background-image:url(../images/icons/twotone/green/music.gif);
}
.notice_image .notice-data a span {
background-image:url(../images/icons/twotone/green/search.gif);
}
.notice_event .notice-data a span {
background-image:url(../images/icons/twotone/green/calendar.gif);
}
.notice_location .notice-data a span {
background-image:url(../images/icons/twotone/green/flag.gif);
}
.notice_document .notice-data a span {
background-image:url(../images/icons/twotone/green/document.gif);
}
.notice-options .notice_reply a,
.notice-options form input.submit {
background-color:transparent;
}
.notice-options .notice_reply a {
background:transparent url(../images/icons/twotone/green/reply.gif) no-repeat 0 45%;
}
.notice-options form.form_favor input.submit {
background:transparent url(../images/icons/twotone/green/favourite.gif) no-repeat 0 45%;
}
.notice-options form.form_disfavor input.submit {
background:transparent url(../images/icons/twotone/green/disfavourite.gif) no-repeat 0 45%;
}
.notice-options .notice_delete a {
background:transparent url(../images/icons/twotone/green/trash.gif) no-repeat 0 45%;
}
div.notice-options {
opacity:0.3;
}
div.entry-content {
color:#333;
}
div.notice-options a,
div.notice-options input {
font-family:sans-serif;
}
div.notice-options input {
color:#002E6E;
}
.notices li.hover {
background-color:#fcfcfc;
}
.notices li.hover div.entry-content,
.notices li.hover div.notice-options {
opacity:1;
}
.form_settings .form_note {
background-color:#A9BF4F;
}
/*END: NOTICES */
.pagination .nav_prev a,
.pagination .nav_next a {
background-repeat:no-repeat;
}
.pagination .nav_prev a {
background-image:url(../images/icons/twotone/green/arrow-left.gif);
background-position:0 45%;
}
.pagination .nav_next a {
background-image:url(../images/icons/twotone/green/arrow-right.gif);
background-position:100% 45%;
}
#home #intro #guide_steps li a {
border-color:#ccc;
color:#fff;
}
#home #intro #step_join-now a {
background-color:#f00;
}
#home #intro #step_start-a-group a {
background-color:#0f0;
}
#home #intro #step_create-a-community a {
background-color:#00f;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,161 +0,0 @@
/* XXX: Most of this just copied out of display.css -- need to factor out what we really neeed -- Zach */
body {
color: #193441;
}
a {
color: #d1451a;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
img, img a {
border: 0;
}
h1 {
font-size: 14px;
}
#wrap {
margin: 0 auto;
padding: 0 20px;
width: 760px;
background: url(bg-header.gif) repeat-x #fbf2d7;
}
#notices {
clear: both;
margin: 0 auto;
padding: 0;
list-style-type: none;
width: 600px;
border-top: 1px solid #dec5b5;
}
#notices a:hover {
text-decoration: underline;
}
.notice_single {
clear: both;
display: block;
margin: 0;
padding: 5px 5px 5px 0;
min-height: 48px;
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 13px;
line-height: 16px;
border-bottom: 1px solid #dec5b5;
background-color:#FCFFF5;
opacity:1;
}
.notice_single:hover {
background-color: #f7ebcc;
}
.notice_single p {
display: inline;
margin: 0;
padding: 0;
}
#notice_delete_form #confirmation_text {
display: block;
font-size: 14px;
font-weight: bold;
}
input#submit_yes, input#submit_no {
margin: 18px 10px 0px 0px;
padding: 4px;
font-weight: bold;
color: #fff6d5;
background-color: #F60;
cursor: pointer;
border: 0;
width: 40px;
}
input#submit_yes:hover, input#submit_no:hover {
background-color: #701238;
}
.avatar.stream {
float: left;
margin: 0 10px 0.5em 0;
}
p.time {
display: block;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
line-height: 15px;
}
p.time a {
color: #dab134;
}
/* ----- Forms General Style ----- */
form {
margin: 0 auto;
padding: 0;
}
form {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
form label {
display: block;
font-size: 12px;
font-weight: bold;
line-height: 18px;
}
form input {
border: 1px solid #dec5b5;
width: 264px;
}
input#submit, input.submit {
display: block;
margin: 18px 0;
padding: 4px;
font-weight: bold;
color: #fff6d5;
background-color: #F60;
cursor: pointer;
border: 0;
width: auto;
}
input#submit:hover, input.submit:hover {
background-color: #701238;
}
input.checkbox {
/*width: 14px;
height: 14px;*/
width: auto;
border: 0;
}
label.checkbox_label {
display: inline;
font-weight: normal;
}
textarea, input {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #701238;
padding: 3px;
}
textarea:focus, input:focus {
background-color: #f8ebc0;
}
textarea {
width: 270px;
border: 1px solid #D8E2D7;
}
.input_instructions {
margin-top: 3px;
display: block;
font-size: 11px;
line-height: 15px;
color: #924959;
font-family: Verdana, Arial, Helvetica, sans-serif;
}