From 414a95a784294d63f4c636ef17e468db9428a446 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sat, 21 Jun 2014 21:01:17 +0200 Subject: [PATCH] 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 --- actions/doc.php | 4 +- actions/noticesearch.php | 2 +- actions/register.php | 6 +- actions/showapplication.php | 8 +- actions/shownotice.php | 57 +----- actions/showprofiletag.php | 2 +- actions/tagprofile.php | 6 +- actions/version.php | 6 +- classes/Notice.php | 13 ++ install.php | 11 +- js/util.js | 4 +- lib/action.php | 9 +- lib/applicationlist.php | 98 +++------- lib/attachment.php | 4 +- lib/attachmentlist.php | 2 +- lib/attachmentlistitem.php | 6 +- lib/dofollowlistitem.php | 6 +- lib/grouplist.php | 25 +-- lib/groupminilist.php | 13 +- lib/groupsection.php | 21 +- lib/inlineattachmentlist.php | 2 +- lib/messagelistitem.php | 21 +- lib/noticelistitem.php | 75 ++++---- lib/noticesection.php | 23 +-- lib/peopletaglist.php | 13 +- lib/profilelist.php | 10 +- lib/profileminilist.php | 11 +- lib/profilesection.php | 17 +- lib/threadednoticelist.php | 4 +- lib/util.php | 8 +- plugins/Bookmark/BookmarkPlugin.php | 2 +- plugins/Bookmark/css/bookmark.css | 4 +- plugins/Bookmark/lib/bookmarklistitem.php | 2 +- .../ConversationTree/lib/conversationtree.php | 2 +- plugins/Directory/lib/sortablegrouplist.php | 3 +- .../lib/sortablesubscriptionlist.php | 2 +- plugins/Event/css/event.css | 9 +- plugins/Event/lib/eventlistitem.php | 6 +- .../lib/noticetree.php | 2 +- .../lib/groupmessagelistitem.php | 6 +- plugins/Mapstraction/usermap.js | 2 +- plugins/MobileProfile/MobileProfilePlugin.php | 9 +- plugins/MobileProfile/mp-screen.css | 2 +- plugins/ModPlus/ModPlusPlugin.php | 9 +- plugins/ModPlus/modplus.css | 5 - plugins/ModPlus/modplus.js | 4 +- plugins/NoticeTitle/NoticeTitlePlugin.php | 25 ++- plugins/Oembed/OembedPlugin.php | 2 +- plugins/Poll/PollPlugin.php | 6 +- plugins/QnA/QnAPlugin.php | 12 +- plugins/QnA/actions/qnanewanswer.php | 2 +- plugins/QnA/js/qna.js | 6 +- plugins/Realtime/js/realtimeupdate.js | 2 +- theme/base/css/display.css | 181 ++++++++---------- theme/neo/css/display.css | 36 ++-- theme/neo/css/rtl.css | 38 ++-- 56 files changed, 327 insertions(+), 539 deletions(-) diff --git a/actions/doc.php b/actions/doc.php index c26b290902..6db3830ce1 100644 --- a/actions/doc.php +++ b/actions/doc.php @@ -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'); diff --git a/actions/noticesearch.php b/actions/noticesearch.php index d4fc884f4b..ee7bb86f40 100644 --- a/actions/noticesearch.php +++ b/actions/noticesearch.php @@ -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 { diff --git a/actions/register.php b/actions/register.php index cf2c049e73..82fb9fc573 100644 --- a/actions/register.php +++ b/actions/register.php @@ -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'); diff --git a/actions/showapplication.php b/actions/showapplication.php index b44dd5746a..d8ac293d40 100644 --- a/actions/showapplication.php +++ b/actions/showapplication.php @@ -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', diff --git a/actions/shownotice.php b/actions/shownotice.php index 5e2be9f9d2..1d01244cc1 100644 --- a/actions/shownotice.php +++ b/actions/shownotice.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 * @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; - } -} diff --git a/actions/showprofiletag.php b/actions/showprofiletag.php index 6b1bc5e5b5..44ded832b8 100644 --- a/actions/showprofiletag.php +++ b/actions/showprofiletag.php @@ -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)); } diff --git a/actions/tagprofile.php b/actions/tagprofile.php index 7538d7c8b6..a79ebf1d25 100644 --- a/actions/tagprofile.php +++ b/actions/tagprofile.php @@ -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); } diff --git a/actions/version.php b/actions/version.php index f0f2661831..97115d23cd 100644 --- a/actions/version.php +++ b/actions/version.php @@ -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'); diff --git a/classes/Notice.php b/classes/Notice.php index 917095acab..9cf676a664 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -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. */ diff --git a/install.php b/install.php index a105e2e8c1..d72cf69b07 100644 --- a/install.php +++ b/install.php @@ -376,19 +376,16 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - - -