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 ...@@ -96,11 +96,11 @@ class DocAction extends Action
*/ */
function showContentBlock() function showContentBlock()
{ {
$this->elementStart('div', array('id' => 'content', 'class' => 'hentry')); $this->elementStart('div', array('id' => 'content', 'class' => 'h-entry'));
$this->showPageTitle(); $this->showPageTitle();
$this->showPageNoticeBlock(); $this->showPageNoticeBlock();
$this->elementStart('div', array('id' => 'content_inner', $this->elementStart('div', array('id' => 'content_inner',
'class' => 'entry-content')); 'class' => 'e-content'));
// show the actual content (forms, lists, whatever) // show the actual content (forms, lists, whatever)
$this->showContent(); $this->showContent();
$this->elementEnd('div'); $this->elementEnd('div');
......
...@@ -202,7 +202,7 @@ class SearchNoticeListItem extends NoticeListItem { ...@@ -202,7 +202,7 @@ class SearchNoticeListItem extends NoticeListItem {
function showContent() function showContent()
{ {
// FIXME: URL, image, video, audio // 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) { if ($this->notice->rendered) {
$this->out->raw($this->highlight($this->notice->rendered, $this->terms)); $this->out->raw($this->highlight($this->notice->rendered, $this->terms));
} else { } else {
......
...@@ -293,14 +293,14 @@ class RegisterAction extends Action ...@@ -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() function showContentBlock()
{ {
$this->elementStart('div', array('id' => 'content', 'class' => 'hentry')); $this->elementStart('div', array('id' => 'content', 'class' => 'h-entry'));
$this->showPageTitle(); $this->showPageTitle();
$this->showPageNoticeBlock(); $this->showPageNoticeBlock();
$this->elementStart('div', array('id' => 'content_inner', $this->elementStart('div', array('id' => 'content_inner',
'class' => 'entry-content')); 'class' => 'e-content'));
// show the actual content (forms, lists, whatever) // show the actual content (forms, lists, whatever)
$this->showContent(); $this->showContent();
$this->elementEnd('div'); $this->elementEnd('div');
......
...@@ -147,20 +147,20 @@ class ShowApplicationAction extends Action ...@@ -147,20 +147,20 @@ class ShowApplicationAction extends Action
$consumer = $this->application->getConsumer(); $consumer = $this->application->getConsumer();
$this->elementStart('div', 'entity_profile vcard'); $this->elementStart('div', 'entity_profile h-card');
// TRANS: Header on the OAuth application page. // TRANS: Header on the OAuth application page.
$this->element('h2', null, _('Application profile')); $this->element('h2', null, _('Application profile'));
if (!empty($this->application->icon)) { if (!empty($this->application->icon)) {
$this->element('img', array('src' => $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, $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->application->name);
$this->element('a', array('href' => $this->application->homepage, $this->element('a', array('href' => $this->application->homepage,
'class' => 'url entity_org'), 'class' => 'u-url entity_org'),
$this->application->organization); $this->application->organization);
$this->element('div', $this->element('div',
......
...@@ -40,7 +40,7 @@ require_once INSTALLDIR.'/lib/noticelist.php'; ...@@ -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 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class ShownoticeAction extends Action class ShownoticeAction extends ManagedAction
{ {
/** /**
* Notice object to show * Notice object to show
...@@ -184,33 +184,7 @@ class ShownoticeAction extends Action ...@@ -184,33 +184,7 @@ class ShownoticeAction extends Action
*/ */
function title() function title()
{ {
$base = $this->profile->getFancyName(); return $this->notice->getTitle();
// 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();
}
} }
/** /**
...@@ -223,23 +197,9 @@ class ShownoticeAction extends Action ...@@ -223,23 +197,9 @@ class ShownoticeAction extends Action
function showContent() function showContent()
{ {
$this->elementStart('ol', array('class' => 'notices xoxo')); $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 = new NoticeListItem($this->notice, $this);
$nli->show(); $nli->show();
$this->elementEnd('body'); $this->elementEnd('ol');
$this->endHTML();
} }
/** /**
...@@ -270,7 +230,7 @@ class ShownoticeAction extends Action ...@@ -270,7 +230,7 @@ class ShownoticeAction extends Action
{ {
$user = User::getKV($this->profile->id); $user = User::getKV($this->profile->id);
if (!$user) { if (!$user instanceof User) {
return; return;
} }
...@@ -289,12 +249,3 @@ class ShownoticeAction extends Action ...@@ -289,12 +249,3 @@ class ShownoticeAction extends Action
'content' => $this->notice->content)); '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 ...@@ -364,7 +364,7 @@ class Peopletag extends PeopletagListItem
function showStart() function showStart()
{ {
$mode = $this->peopletag->private ? 'private' : 'public'; $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)); 'id' => 'peopletag-' . $this->peopletag->id));
} }
......
...@@ -101,7 +101,7 @@ class TagprofileAction extends Action ...@@ -101,7 +101,7 @@ class TagprofileAction extends Action
function showContent() function showContent()
{ {
if (Event::handle('StartShowTagProfileForm', array($this, $this->profile)) && $this->profile) { 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. // TRANS: Header in list form.
$this->element('h2', null, _('User profile')); $this->element('h2', null, _('User profile'));
...@@ -118,7 +118,7 @@ class TagprofileAction extends Action ...@@ -118,7 +118,7 @@ class TagprofileAction extends Action
'class' => 'entity_nickname nickname'), 'class' => 'entity_nickname nickname'),
$this->profile->nickname); $this->profile->nickname);
if ($this->profile->fullname) { 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) { if ($this->profile->location) {
...@@ -128,7 +128,7 @@ class TagprofileAction extends Action ...@@ -128,7 +128,7 @@ class TagprofileAction extends Action
if ($this->profile->homepage) { if ($this->profile->homepage) {
$this->element('a', array('href' => $this->profile->homepage, $this->element('a', array('href' => $this->profile->homepage,
'rel' => 'me', 'rel' => 'me',
'class' => 'url entity_url'), 'class' => 'u-url entity_url'),
$this->profile->homepage); $this->profile->homepage);
} }
......
...@@ -108,17 +108,17 @@ class VersionAction extends Action ...@@ -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 * @return void
*/ */
function showContentBlock() function showContentBlock()
{ {
$this->elementStart('div', array('id' => 'content', 'class' => 'hentry')); $this->elementStart('div', array('id' => 'content', 'class' => 'h-entry'));
$this->showPageTitle(); $this->showPageTitle();
$this->showPageNoticeBlock(); $this->showPageNoticeBlock();
$this->elementStart('div', array('id' => 'content_inner', $this->elementStart('div', array('id' => 'content_inner',
'class' => 'entry-content')); 'class' => 'e-content'));
// show the actual content (forms, lists, whatever) // show the actual content (forms, lists, whatever)
$this->showContent(); $this->showContent();
$this->elementEnd('div'); $this->elementEnd('div');
......
...@@ -232,6 +232,19 @@ class Notice extends Managed_DataObject ...@@ -232,6 +232,19 @@ class Notice extends Managed_DataObject
return common_local_url('shownotice', array('notice' => $this->id), null, null, false); 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. * Get the original representation URL of this notice.
*/ */
......
...@@ -376,19 +376,16 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ...@@ -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/base/css/display.css" media="screen, projection, tv"/>
<link rel="stylesheet" type="text/css" href="theme/neo/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"/> <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/extlib/jquery.js"></script>
<script src="js/install.js"></script> <script src="js/install.js"></script>
</head> </head>
<body id="install"> <body id="install">
<div id="wrap"> <div id="wrap">
<div id="header"> <div id="header">
<address id="site_contact" class="vcard"> <address id="site_contact" class="h-card">
<a class="url home bookmark" href="."> <a class="u-url p-name home bookmark org" href=".">
<img class="logo photo" src="theme/neo/logo.png" alt="GNU social"/> <img class="logo u-photo" src="theme/neo/logo.png" alt="GNU social"/>
<span class="fn org">GNU social</span> GNU social
</a> </a>
</address> </address>
<div id="site_nav_global_primary"></div> <div id="site_nav_global_primary"></div>
......
...@@ -863,7 +863,7 @@ var SN = { // StatusNet ...@@ -863,7 +863,7 @@ var SN = { // StatusNet
var m = $(this); var m = $(this);
m.addClass(SN.C.S.Processing); m.addClass(SN.C.S.Processing);
$.get(m.attr('href'), {ajax: 1}, function (data) { $.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; return false;
...@@ -1361,7 +1361,7 @@ var SN = { // StatusNet ...@@ -1361,7 +1361,7 @@ var SN = { // StatusNet
var profileLink = $('#nav_profile a').attr('href'); var profileLink = $('#nav_profile a').attr('href');
if (profileLink) { 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 (authorUrl == profileLink) {
if (action == 'all' || action == 'showstream') { if (action == 'all' || action == 'showstream') {
// Posts always show on your own friends and profile streams. // Posts always show on your own friends and profile streams.
......
...@@ -582,8 +582,7 @@ class Action extends HTMLOutputter // lawsuit ...@@ -582,8 +582,7 @@ class Action extends HTMLOutputter // lawsuit
*/ */
function showLogo() function showLogo()
{ {
$this->elementStart('address', array('id' => 'site_contact', $this->elementStart('address', array('id' => 'site_contact', 'class' => 'h-card'));
'class' => 'vcard'));
if (Event::handle('StartAddressData', array($this))) { if (Event::handle('StartAddressData', array($this))) {
if (common_config('singleuser', 'enabled')) { if (common_config('singleuser', 'enabled')) {
$user = User::singleUser(); $user = User::singleUser();
...@@ -596,7 +595,7 @@ class Action extends HTMLOutputter // lawsuit ...@@ -596,7 +595,7 @@ class Action extends HTMLOutputter // lawsuit
$url = common_local_url('public'); $url = common_local_url('public');
} }
$this->elementStart('a', array('class' => 'url home bookmark', $this->elementStart('a', array('class' => 'home bookmark',
'href' => $url)); 'href' => $url));
if (StatusNet::isHTTPS()) { if (StatusNet::isHTTPS()) {
...@@ -622,13 +621,11 @@ class Action extends HTMLOutputter // lawsuit ...@@ -622,13 +621,11 @@ class Action extends HTMLOutputter // lawsuit
} }
if (!empty($logoUrl)) { if (!empty($logoUrl)) {
$this->element('img', array('class' => 'logo photo', $this->element('img', array('class' => 'logo u-photo p-name',
'src' => $logoUrl, 'src' => $logoUrl,
'alt' => common_config('site', 'name'))); 'alt' => common_config('site', 'name')));
} }
$this->text(' ');
$this->element('span', array('class' => 'fn org'), common_config('site', 'name'));
$this->elementEnd('a'); $this->elementEnd('a');
Event::handle('EndAddressData', array($this)); Event::handle('EndAddressData', array($this));
......
...@@ -87,50 +87,26 @@ class ApplicationList extends Widget ...@@ -87,50 +87,26 @@ class ApplicationList extends Widget
{ {
$user = common_current_user(); $user = common_current_user();
$this->out->elementStart( $this->out->elementStart('li', array('class' => 'application h-entry',
'li', 'id' => 'oauthclient-' . $this->application->id));
array(
'class' => 'application',
'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)),
$this->out->elementStart( 'class' => 'h-card'));
'a',
array(
'href' => common_local_url(
'showapplication',
array('id' => $this->application->id)),
'class' => 'url'
)
);
if (!empty($this->application->icon)) { if (!empty($this->application->icon)) {
$this->out->element( $this->out->element('img', array('src' => $this->application->icon,
'img', 'class' => 'avatar u-photo'));
array(
'src' => $this->application->icon,
'class' => 'photo avatar'
)
);
} }
$this->out->element('span', 'fn', $this->application->name); $this->out->text($this->application->name);
$this->out->elementEnd('a'); $this->out->elementEnd('a');
$this->out->elementEnd('span');
$this->out->raw(' by '); $this->out->raw(' by ');
$this->out->element( $this->out->element('a', array('href' => $this->application->homepage,
'a', 'class' => 'u-url'),
array( $this->application->organization);
'href' => $this->application->homepage,
'class' => 'url'
),
$this->application->organization
);
$this->out->element('p', 'note', $this->application->description); $this->out->element('p', 'note', $this->application->description);
$this->out->elementEnd('li'); $this->out->elementEnd('li');
...@@ -204,44 +180,23 @@ class ConnectedAppsList extends Widget ...@@ -204,44 +180,23 @@ class ConnectedAppsList extends Widget
{ {
$app = Oauth_application::getKV('id', $this->connection->application_id); $app = Oauth_application::getKV('id', $this->connection->application_id);
$this->out->elementStart( $this->out->elementStart('li', array('class' => 'application h-entry',
'li', 'id' => 'oauthclient-' . $app->id));
array(
'class' => 'application',
'id' => 'oauthclient-' . $app->id
)
);
$this->out->elementStart('span', 'vcard author');
$this->out->elementStart( $this->out->elementStart('a', array('href' => $app->source_url,
'a', 'class' => 'h-card p-name'));
array(
'href' => $app->source_url,
'class' => 'url'
)
);
if (!empty($app->icon)) { if (!empty($app->icon)) {
$this->out->element( $this->out->element('img', array('src' => $app->icon,
'img', 'class' => 'avatar u-photo'));
array(
'src' => $app->icon,
'class' => 'photo avatar'
)
);
} }
if ($app->name != 'anonymous') { if ($app->name != 'anonymous') {
$this->out->element('span', 'fn', $app->name); $this->out->text($app->name);
} } else {
$this->out->elementEnd('a');
if ($app->name == 'anonymous') {
// TRANS: Name for an anonymous application in application list. // 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('a');
$this->out->elementEnd('span');
if ($app->name != 'anonymous') { if ($app->name != 'anonymous') {
// @todo FIXME: i18n trouble. // @todo FIXME: i18n trouble.
...@@ -249,14 +204,9 @@ class ConnectedAppsList extends Widget ...@@ -249,14 +204,9 @@ class ConnectedAppsList extends Widget
// TRANS: Before this message the application name is put, behind it the organisation that manages it. // TRANS: Before this message the application name is put, behind it the organisation that manages it.
$this->out->raw(_(' by ')); $this->out->raw(_(' by '));
$this->out->element( $this->out->element('a', array('href' => $app->homepage,
'a', 'class' => 'h-card'),
array( $app->organization);
'href' => $app->homepage,
'class' => 'url'
),
$app->organization
);
} }
// TRANS: Application access type // TRANS: Application access type
......
...@@ -38,12 +38,12 @@ class Attachment extends AttachmentListItem ...@@ -38,12 +38,12 @@ class Attachment extends AttachmentListItem
function showLink() { function showLink() {
if (Event::handle('StartShowAttachmentLink', array($this->out, $this->attachment))) { if (Event::handle('StartShowAttachmentLink', array($this->out, $this->attachment))) {
$this->out->elementStart('div', array('id' => 'attachment_view', $this->out->elementStart('div', array('id' => 'attachment_view',
'class' => 'hentry')); 'class' => 'h-entry'));
$this->out->elementStart('div', 'entry-title'); $this->out->elementStart('div', 'entry-title');
$this->out->element('a', $this->linkAttr(), _('Download link')); $this->out->element('a', $this->linkAttr(), _('Download link'));
$this->out->elementEnd('div'); $this->out->elementEnd('div');
$this->out->elementStart('div', 'entry-content'); $this->out->elementStart('div', 'e-content');
$this->showRepresentation(); $this->showRepresentation();
$this->out->elementEnd('div'); $this->out->elementEnd('div');
Event::handle('EndShowAttachmentLink', array($this->out, $this->attachment)); Event::handle('EndShowAttachmentLink', array($this->out, $this->attachment));
......
...@@ -90,7 +90,7 @@ class AttachmentList extends Widget ...@@ -90,7 +90,7 @@ class AttachmentList extends Widget
function showListStart() function showListStart()
{ {
$this->out->elementStart('ol', array('class' => 'attachments entry-content')); $this->out->elementStart('ol', array('class' => 'attachments'));
} }
function showListEnd() function showListEnd()
......
...@@ -114,9 +114,9 @@ class AttachmentListItem extends Widget ...@@ -114,9 +114,9 @@ class AttachmentListItem extends Widget
case 'image/jpeg': case 'image/jpeg':
try { try {
$thumb = $this->attachment->getThumbnail(); $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) { } 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) { } catch (UnsupportedMediaException $e) {
// FIXME: Show a good representation of unsupported/unshowable images // FIXME: Show a good representation of unsupported/unshowable images
} }
...@@ -151,7 +151,7 @@ class AttachmentListItem extends Widget ...@@ -151,7 +151,7 @@ class AttachmentListItem extends Widget
$poster = null; $poster = null;
} }