git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit 414a95a7 authored by mmn's avatar mmn

Initial move towards microformats2

No validation has been attempted yet. Lots of changes left. This
is visibly not (very) different from the previous CSS layout. But
some simplifications have been made.

Might cause issues with local changes to themes and CSS. Also maybe
javascript which depends on certain legacy microformats elements.

The move to microformats2 is motivated by the announcement that all
microformats should be migrated to version 2, as of 2014-06-20 at:
http://microformats.org/2014/06/20/microformats-org-turns-9-upgrade-to-microformats2
parent d16af504
......@@ -96,11 +96,11 @@ class DocAction extends Action
*/
function showContentBlock()
{
$this->elementStart('div', array('id' => 'content', 'class' => 'hentry'));
$this->elementStart('div', array('id' => 'content', 'class' => 'h-entry'));
$this->showPageTitle();
$this->showPageNoticeBlock();
$this->elementStart('div', array('id' => 'content_inner',
'class' => 'entry-content'));
'class' => 'e-content'));
// show the actual content (forms, lists, whatever)
$this->showContent();
$this->elementEnd('div');
......
......@@ -202,7 +202,7 @@ class SearchNoticeListItem extends NoticeListItem {
function showContent()
{
// FIXME: URL, image, video, audio
$this->out->elementStart('p', array('class' => 'entry-content'));
$this->out->elementStart('p', array('class' => 'e-content'));
if ($this->notice->rendered) {
$this->out->raw($this->highlight($this->notice->rendered, $this->terms));
} else {
......
......@@ -293,14 +293,14 @@ class RegisterAction extends Action
}
}
// overrided to add hentry, and content-inner class
// overrided to add h-entry, and content-inner class
function showContentBlock()
{
$this->elementStart('div', array('id' => 'content', 'class' => 'hentry'));
$this->elementStart('div', array('id' => 'content', 'class' => 'h-entry'));
$this->showPageTitle();
$this->showPageNoticeBlock();
$this->elementStart('div', array('id' => 'content_inner',
'class' => 'entry-content'));
'class' => 'e-content'));
// show the actual content (forms, lists, whatever)
$this->showContent();
$this->elementEnd('div');
......
......@@ -147,20 +147,20 @@ class ShowApplicationAction extends Action
$consumer = $this->application->getConsumer();
$this->elementStart('div', 'entity_profile vcard');
$this->elementStart('div', 'entity_profile h-card');
// TRANS: Header on the OAuth application page.
$this->element('h2', null, _('Application profile'));
if (!empty($this->application->icon)) {
$this->element('img', array('src' => $this->application->icon,
'class' => 'photo logo entity_depiction'));
'class' => 'u-photo logo entity_depiction'));
}
$this->element('a', array('href' => $this->application->source_url,
'class' => 'url fn entity_fn'),
'class' => 'u-url p-name entity_fn'),
$this->application->name);
$this->element('a', array('href' => $this->application->homepage,
'class' => 'url entity_org'),
'class' => 'u-url entity_org'),
$this->application->organization);
$this->element('div',
......
......@@ -40,7 +40,7 @@ require_once INSTALLDIR.'/lib/noticelist.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ShownoticeAction extends Action
class ShownoticeAction extends ManagedAction
{
/**
* Notice object to show
......@@ -184,33 +184,7 @@ class ShownoticeAction extends Action
*/
function title()
{
$base = $this->profile->getFancyName();
// TRANS: Title of the page that shows a notice.
// TRANS: %1$s is a user name, %2$s is the notice creation date/time.
return sprintf(_('%1$s\'s status on %2$s'),
$base,
common_exact_date($this->notice->created));
}
/**
* Handle input
*
* Only handles get, so just show the page.
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
protected function handle()
{
parent::handle();
if (StatusNet::isAjax()) {
$this->showAjax();
} else {
$this->showPage();
}
return $this->notice->getTitle();
}
/**
......@@ -223,23 +197,9 @@ class ShownoticeAction extends Action
function showContent()
{
$this->elementStart('ol', array('class' => 'notices xoxo'));
$nli = new SingleNoticeItem($this->notice, $this);
$nli->show();
$this->elementEnd('ol');
}
function showAjax()
{
$this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head');
// TRANS: Title for page that shows a notice.
$this->element('title', null, _m('TITLE','Notice'));
$this->elementEnd('head');
$this->elementStart('body');
$nli = new NoticeListItem($this->notice, $this);
$nli->show();
$this->elementEnd('body');
$this->endHTML();
$this->elementEnd('ol');
}
/**
......@@ -270,7 +230,7 @@ class ShownoticeAction extends Action
{
$user = User::getKV($this->profile->id);
if (!$user) {
if (!$user instanceof User) {
return;
}
......@@ -289,12 +249,3 @@ class ShownoticeAction extends Action
'content' => $this->notice->content));
}
}
// @todo FIXME: Class documentation missing.
class SingleNoticeItem extends DoFollowListItem
{
function avatarSize()
{
return AVATAR_STREAM_SIZE;
}
}
......@@ -364,7 +364,7 @@ class Peopletag extends PeopletagListItem
function showStart()
{
$mode = $this->peopletag->private ? 'private' : 'public';
$this->out->elementStart('div', array('class' => 'hentry peopletag peopletag-profile mode-'.$mode,
$this->out->elementStart('div', array('class' => 'h-entry peopletag peopletag-profile mode-'.$mode,
'id' => 'peopletag-' . $this->peopletag->id));
}
......
......@@ -101,7 +101,7 @@ class TagprofileAction extends Action
function showContent()
{
if (Event::handle('StartShowTagProfileForm', array($this, $this->profile)) && $this->profile) {
$this->elementStart('div', 'entity_profile vcard author');
$this->elementStart('div', 'entity_profile h-card p-author');
// TRANS: Header in list form.
$this->element('h2', null, _('User profile'));
......@@ -118,7 +118,7 @@ class TagprofileAction extends Action
'class' => 'entity_nickname nickname'),
$this->profile->nickname);
if ($this->profile->fullname) {
$this->element('div', 'fn entity_fn', $this->profile->fullname);
$this->element('div', 'p-name entity_fn', $this->profile->fullname);
}
if ($this->profile->location) {
......@@ -128,7 +128,7 @@ class TagprofileAction extends Action
if ($this->profile->homepage) {
$this->element('a', array('href' => $this->profile->homepage,
'rel' => 'me',
'class' => 'url entity_url'),
'class' => 'u-url entity_url'),
$this->profile->homepage);
}
......
......@@ -108,17 +108,17 @@ class VersionAction extends Action
/*
* Override to add hentry, and content-inner classes
* Override to add h-entry, and content-inner classes
*
* @return void
*/
function showContentBlock()
{
$this->elementStart('div', array('id' => 'content', 'class' => 'hentry'));
$this->elementStart('div', array('id' => 'content', 'class' => 'h-entry'));
$this->showPageTitle();
$this->showPageNoticeBlock();
$this->elementStart('div', array('id' => 'content_inner',
'class' => 'entry-content'));
'class' => 'e-content'));
// show the actual content (forms, lists, whatever)
$this->showContent();
$this->elementEnd('div');
......
......@@ -232,6 +232,19 @@ class Notice extends Managed_DataObject
return common_local_url('shownotice', array('notice' => $this->id), null, null, false);
}
public function getTitle()
{
$title = null;
if (Event::handle('GetNoticeTitle', array($this, &$title))) {
// TRANS: Title of a notice posted without a title value.
// TRANS: %1$s is a user name, %2$s is the notice creation date/time.
$title = sprintf(_('%1$s\'s status on %2$s'),
$this->getProfile()->getFancyName(),
common_exact_date($this->created));
}
return $title;
}
/*
* Get the original representation URL of this notice.
*/
......
......@@ -376,19 +376,16 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<link rel="stylesheet" type="text/css" href="theme/base/css/display.css" media="screen, projection, tv"/>
<link rel="stylesheet" type="text/css" href="theme/neo/css/display.css" media="screen, projection, tv"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!--[if IE]><link rel="stylesheet" type="text/css" href="theme/base/css/ie.css" /><![endif]-->
<!--[if lte IE 6]><link rel="stylesheet" type="text/css" theme/base/css/ie6.css" /><![endif]-->
<!--[if lte IE 7]><link rel="stylesheet" type="text/css" theme/base/css/ie7.css" /><![endif]-->
<script src="js/extlib/jquery.js"></script>
<script src="js/install.js"></script>
</head>
<body id="install">
<div id="wrap">
<div id="header">
<address id="site_contact" class="vcard">
<a class="url home bookmark" href=".">
<img class="logo photo" src="theme/neo/logo.png" alt="GNU social"/>
<span class="fn org">GNU social</span>
<address id="site_contact" class="h-card">
<a class="u-url p-name home bookmark org" href=".">
<img class="logo u-photo" src="theme/neo/logo.png" alt="GNU social"/>
GNU social
</a>
</address>
<div id="site_nav_global_primary"></div>
......
......@@ -863,7 +863,7 @@ var SN = { // StatusNet
var m = $(this);
m.addClass(SN.C.S.Processing);
$.get(m.attr('href'), {ajax: 1}, function (data) {
m.parent('.entry-content').html($(data).find('#attachment_view .entry-content').html());
m.parent('.e-content').html($(data).find('#attachment_view .e-content').html());
});
return false;
......@@ -1361,7 +1361,7 @@ var SN = { // StatusNet
var profileLink = $('#nav_profile a').attr('href');
if (profileLink) {
var authorUrl = $(notice).find('.vcard.author a.url').attr('href');
var authorUrl = $(notice).find('.h-card.u-url').attr('href');
if (authorUrl == profileLink) {
if (action == 'all' || action == 'showstream') {
// Posts always show on your own friends and profile streams.
......
......@@ -582,8 +582,7 @@ class Action extends HTMLOutputter // lawsuit
*/
function showLogo()
{
$this->elementStart('address', array('id' => 'site_contact',
'class' => 'vcard'));
$this->elementStart('address', array('id' => 'site_contact', 'class' => 'h-card'));
if (Event::handle('StartAddressData', array($this))) {
if (common_config('singleuser', 'enabled')) {
$user = User::singleUser();
......@@ -596,7 +595,7 @@ class Action extends HTMLOutputter // lawsuit
$url = common_local_url('public');
}
$this->elementStart('a', array('class' => 'url home bookmark',
$this->elementStart('a', array('class' => 'home bookmark',
'href' => $url));
if (StatusNet::isHTTPS()) {
......@@ -622,13 +621,11 @@ class Action extends HTMLOutputter // lawsuit
}
if (!empty($logoUrl)) {
$this->element('img', array('class' => 'logo photo',
$this->element('img', array('class' => 'logo u-photo p-name',
'src' => $logoUrl,
'alt' => common_config('site', 'name')));
}
$this->text(' ');
$this->element('span', array('class' => 'fn org'), common_config('site', 'name'));
$this->elementEnd('a');
Event::handle('EndAddressData', array($this));
......
......@@ -87,50 +87,26 @@ class ApplicationList extends Widget
{
$user = common_current_user();
$this->out->elementStart(
'li',
array(
'class' => 'application',
'id' => 'oauthclient-' . $this->application->id
)
);
$this->out->elementStart('li', array('class' => 'application h-entry',
'id' => 'oauthclient-' . $this->application->id));
$this->out->elementStart('span', 'vcard author');
$this->out->elementStart(
'a',
array(
'href' => common_local_url(
'showapplication',
array('id' => $this->application->id)),
'class' => 'url'
)
);
$this->out->elementStart('a', array('href' => common_local_url('showapplication',
array('id' => $this->application->id)),
'class' => 'h-card'));
if (!empty($this->application->icon)) {
$this->out->element(
'img',
array(
'src' => $this->application->icon,
'class' => 'photo avatar'
)
);
$this->out->element('img', array('src' => $this->application->icon,
'class' => 'avatar u-photo'));
}
$this->out->element('span', 'fn', $this->application->name);
$this->out->text($this->application->name);
$this->out->elementEnd('a');
$this->out->elementEnd('span');
$this->out->raw(' by ');
$this->out->element(
'a',
array(
'href' => $this->application->homepage,
'class' => 'url'
),
$this->application->organization
);
$this->out->element('a', array('href' => $this->application->homepage,
'class' => 'u-url'),
$this->application->organization);
$this->out->element('p', 'note', $this->application->description);
$this->out->elementEnd('li');
......@@ -204,44 +180,23 @@ class ConnectedAppsList extends Widget
{
$app = Oauth_application::getKV('id', $this->connection->application_id);
$this->out->elementStart(
'li',
array(
'class' => 'application',
'id' => 'oauthclient-' . $app->id
)
);
$this->out->elementStart('span', 'vcard author');
$this->out->elementStart('li', array('class' => 'application h-entry',
'id' => 'oauthclient-' . $app->id));
$this->out->elementStart(
'a',
array(
'href' => $app->source_url,
'class' => 'url'
)
);
$this->out->elementStart('a', array('href' => $app->source_url,
'class' => 'h-card p-name'));
if (!empty($app->icon)) {
$this->out->element(
'img',
array(
'src' => $app->icon,
'class' => 'photo avatar'
)
);
$this->out->element('img', array('src' => $app->icon,
'class' => 'avatar u-photo'));
}
if ($app->name != 'anonymous') {
$this->out->element('span', 'fn', $app->name);
}
$this->out->elementEnd('a');
if ($app->name == 'anonymous') {
$this->out->text($app->name);
} else {
// TRANS: Name for an anonymous application in application list.
$this->out->element('span', 'fn', _('Unknown application'));
$this->out->element('span', 'p-name', _('Unknown application'));
}
$this->out->elementEnd('span');
$this->out->elementEnd('a');
if ($app->name != 'anonymous') {
// @todo FIXME: i18n trouble.
......@@ -249,14 +204,9 @@ class ConnectedAppsList extends Widget
// TRANS: Before this message the application name is put, behind it the organisation that manages it.
$this->out->raw(_(' by '));
$this->out->element(
'a',
array(
'href' => $app->homepage,
'class' => 'url'
),
$app->organization
);
$this->out->element('a', array('href' => $app->homepage,
'class' => 'h-card'),
$app->organization);
}
// TRANS: Application access type
......
......@@ -38,12 +38,12 @@ class Attachment extends AttachmentListItem
function showLink() {
if (Event::handle('StartShowAttachmentLink', array($this->out, $this->attachment))) {
$this->out->elementStart('div', array('id' => 'attachment_view',
'class' => 'hentry'));
'class' => 'h-entry'));
$this->out->elementStart('div', 'entry-title');
$this->out->element('a', $this->linkAttr(), _('Download link'));
$this->out->elementEnd('div');
$this->out->elementStart('div', 'entry-content');
$this->out->elementStart('div', 'e-content');
$this->showRepresentation();
$this->out->elementEnd('div');
Event::handle('EndShowAttachmentLink', array($this->out, $this->attachment));
......
......@@ -90,7 +90,7 @@ class AttachmentList extends Widget
function showListStart()
{
$this->out->elementStart('ol', array('class' => 'attachments entry-content'));
$this->out->elementStart('ol', array('class' => 'attachments'));
}
function showListEnd()
......
......@@ -114,9 +114,9 @@ class AttachmentListItem extends Widget
case 'image/jpeg':
try {
$thumb = $this->attachment->getThumbnail();
$this->out->element('img', array('src' => $thumb->getUrl(), 'alt' => ''));
$this->out->element('img', array('class'=>'u-photo', 'src' => $thumb->getUrl(), 'alt' => $e->file->title));
} catch (UseFileAsThumbnailException $e) {
$this->out->element('img', array('src' => $e->file->getUrl(), 'alt' => $e->file->title));
$this->out->element('img', array('class'=>'u-photo', 'src' => $e->file->getUrl(), 'alt' => $e->file->title));
} catch (UnsupportedMediaException $e) {
// FIXME: Show a good representation of unsupported/unshowable images
}
......@@ -151,7 +151,7 @@ class AttachmentListItem extends Widget
$poster = null;
}
$this->out->elementStart($mediatype,
array('class'=>'attachment_player',
array('class'=>"attachment_player u-{$mediatype}",
'poster'=>$poster,
'controls'=>'controls'));
$this->out->element('source',
......
......@@ -66,7 +66,7 @@ class DoFollowListItem extends NoticeListItem
function showContent()
{
// FIXME: URL, image, video, audio
$this->out->elementStart('p', array('class' => 'entry-content'));
$this->out->elementStart('div', array('class' => 'e-content'));
if (!empty($this->notice->rendered)) {
$html = $this->notice->rendered;
......@@ -83,6 +83,6 @@ class DoFollowListItem extends NoticeListItem
$this->out->raw($html);
$this->out->elementEnd('p');
$this->out->elementEnd('div');
}
}
\ No newline at end of file
}
......@@ -83,36 +83,29 @@ class GroupList extends Widget
function showGroup()
{
$this->out->elementStart('li', array('class' => 'profile hentry',
$this->out->elementStart('li', array('class' => 'profile h-card',
'id' => 'group-' . $this->group->id));
$user = common_current_user();
$this->out->elementStart('div', 'entity_profile vcard entry-content');
$this->out->elementStart('div', 'entity_profile');
$logo = ($this->group->stream_logo) ?
$this->group->stream_logo : User_group::defaultLogo(AVATAR_STREAM_SIZE);
$logo = $this->group->stream_logo ?: User_group::defaultLogo(AVATAR_STREAM_SIZE);
$this->out->elementStart('a', array('href' => $this->group->homeUrl(),
'class' => 'url entry-title',
'class' => 'u-url p-nickname',
'rel' => 'contact group'));
$this->out->element('img', array('src' => $logo,
'class' => 'photo avatar',
'class' => 'avatar u-photo',
'width' => AVATAR_STREAM_SIZE,
'height' => AVATAR_STREAM_SIZE,
'alt' =>
($this->group->fullname) ? $this->group->fullname :
$this->group->nickname));
$this->out->text(' ');
$hasFN = ($this->group->fullname) ? 'nickname' : 'fn org nickname';
$this->out->elementStart('span', $hasFN);
$this->out->raw($this->highlight($this->group->nickname));
$this->out->elementEnd('span');
'alt' => $this->group->getBestName()));
$this->out->text($this->group->getNickname());
$this->out->elementEnd('a');
if ($this->group->fullname) {
$this->out->text(' ');
$this->out->elementStart('span', 'fn org');
$this->out->elementStart('span', 'p-name');
$this->out->raw($this->highlight($this->group->fullname));
$this->out->elementEnd('span');
}
......@@ -125,7 +118,7 @@ class GroupList extends Widget
if ($this->group->homepage) {
$this->out->text(' ');
$this->out->elementStart('a', array('href' => $this->group->homepage,
'class' => 'url'));
'class' => 'u-url'));
$this->out->raw($this->highlight($this->group->homepage));
$this->out->elementEnd('a');
}
......
......@@ -67,13 +67,11 @@ class GroupMiniList extends GroupList
function showGroup()
{
$this->out->elementStart('li', 'vcard');
$this->out->elementStart('a', array('title' => ($this->group->fullname) ?
$this->group->fullname :
$this->group->nickname,
$this->out->elementStart('li', 'h-card');
$this->out->elementStart('a', array('title' => $this->group->getBestName(),
'href' => $this->group->homeUrl(),
'rel' => 'contact group',
'class' => 'url'));
'class' => 'p-name u-url org'));
$logo = ($this->group->mini_logo) ?
$this->group->mini_logo : User_group::defaultLogo(AVATAR_MINI_SIZE);
......@@ -82,10 +80,7 @@ class GroupMiniList extends GroupList
'width' => AVATAR_MINI_SIZE,
'height' => AVATAR_MINI_SIZE,
'class' => 'avatar photo',
'alt' => ($this->group->fullname) ?
$this->group->fullname :
$this->group->nickname));
$this->out->element('span', 'fn org nickname', $this->group->nickname);
'alt' => $this->group->getBestName()));
$this->out->elementEnd('a');
$this->out->elementEnd('li');
}
......
......@@ -77,27 +77,18 @@ class GroupSection extends Section
{
$this->out->elementStart('tr');
$this->out->elementStart('td');
$this->out->elementStart('span', 'vcard');
$this->out->elementStart('a', array('title' => ($group->fullname) ?
$group->fullname :
$group->nickname,
$this->out->elementStart('a', array('title' => $group->getBestName(),
'href' => $group->homeUrl(),
'rel' => 'contact group',
'class' => 'url'));
$this->out->text(' ');
$logo = ($group->stream_logo) ?
$group->stream_logo : User_group::defaultLogo(AVATAR_STREAM_SIZE);
'class' => 'h-card org nickname'));
$logo = $group->stream_logo ?: User_group::defaultLogo(AVATAR_STREAM_SIZE);
$this->out->element('img', array('src' => $logo,
'width' => AVATAR_MINI_SIZE,
'height' => AVATAR_MINI_SIZE,
'class' => 'avatar photo',
'alt' => ($group->fullname) ?
$group->fullname :
$group->nickname));
$this->out->text(' ');
$this->out->element('span', 'fn org nickname', $group->nickname);
'class' => 'avatar u-photo',
'alt' => $group->getBestName()));
$this->out->text($group->nickname);
$this->out->elementEnd('a');
$this->out->elementEnd('span');
$this->out->elementEnd('td');
if ($group->value) {
$this->out->element('td', 'value', $group->value);
......
......@@ -35,7 +35,7 @@ class InlineAttachmentList extends AttachmentList
{
function showListStart()
{
$this->out->elementStart('div', array('class' => 'entry-content thumbnails'));
$this->out->elementStart('div', array('class' => 'attachments'));
}
function showListEnd()
......
......@@ -67,32 +67,25 @@ abstract class MessageListItem extends Widget
*/
function show()
{
$this->out->elementStart('li', array('class' => 'hentry notice',
$this->out->elementStart('li', array('class' => 'h-entry notice',
'id' => 'message-' . $this->message->id));
$profile = $this->getMessageProfile();
$this->out->elementStart('div', 'entry-title');
$this->out->elementStart('span', 'vcard author');
$this->out->elementStart('a', array('href' => $profile->profileurl,
'class' => 'url'));
'class' => 'p-author'));
$avatarUrl = $profile->avatarUrl(AVATAR_STREAM_SIZE);
$this->out->element('img', array('src' => $avatarUrl,
'class' => 'photo avatar',
'class' => 'avatar u-photo',
'width' => AVATAR_STREAM_SIZE,
'height' => AVATAR_STREAM_SIZE,
'alt' =>
($profile->fullname) ? $profile->fullname :
$profile->nickname));
$this->out->element('span', array('class' => 'nickname fn'),
$profile->nickname);
'alt' => $profile->getBestName()));
$this->out->element('span', array('class' => 'nickname fn'), $profile->getNickname());
$this->out->elementEnd('a');
$this->out->elementEnd('span');
// FIXME: URL, image, video, audio
$this->out->elementStart('p', array('class' => 'entry-content'));
$this->out->elementStart('div', array('class' => 'e-content'));
$this->out->raw($this->message->rendered);
$this->out->elementEnd('p');
$this->out->elementEnd('div');
$messageurl = common_local_url('showmessage',
......@@ -104,7 +97,7 @@ abstract class MessageListItem extends Widget
$messageurl = $this->message->uri;
}
$this->out->elementStart('div', 'entry-content');
$this->out->elementStart('div', 'entry-metadata');
$this->out->elementStart('a', array('rel' => 'bookmark',
'class' => 'timestamp',
'href' => $messageurl));
......
......@@ -113,15 +113,25 @@ class NoticeListItem extends Widget
function showNotice()
{
$this->out->elementStart('div', 'entry-title');