Page MenuHomePhabricator

D21451.diff
No OneTemporary

D21451.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -9,7 +9,7 @@
'names' => array(
'conpherence.pkg.css' => '0e3cf785',
'conpherence.pkg.js' => '020aebcf',
- 'core.pkg.css' => 'b13bef94',
+ 'core.pkg.css' => 'bd937962',
'core.pkg.js' => 'adc34883',
'dark-console.pkg.js' => '187792c2',
'differential.pkg.css' => '5c459f92',
@@ -113,7 +113,7 @@
'rsrc/css/application/slowvote/slowvote.css' => '1694baed',
'rsrc/css/application/tokens/tokens.css' => 'ce5a50bd',
'rsrc/css/application/uiexample/example.css' => 'b4795059',
- 'rsrc/css/core/core.css' => '1b29ed61',
+ 'rsrc/css/core/core.css' => 'b3ebd90d',
'rsrc/css/core/remarkup.css' => '94c3d777',
'rsrc/css/core/syntax.css' => '548567f6',
'rsrc/css/core/z-index.css' => 'ac3bfcd4',
@@ -779,7 +779,7 @@
'phabricator-busy' => '5202e831',
'phabricator-chatlog-css' => 'abdc76ee',
'phabricator-content-source-view-css' => 'cdf0d579',
- 'phabricator-core-css' => '1b29ed61',
+ 'phabricator-core-css' => 'b3ebd90d',
'phabricator-countdown-css' => 'bff8012f',
'phabricator-darklog' => '3b869402',
'phabricator-darkmessage' => '26cd4b73',
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -5959,9 +5959,11 @@
'celerity_get_resource_uri' => 'applications/celerity/api.php',
'hsprintf' => 'infrastructure/markup/render.php',
'javelin_tag' => 'infrastructure/javelin/markup.php',
+ 'phabricator_absolute_datetime' => 'view/viewutils.php',
'phabricator_date' => 'view/viewutils.php',
'phabricator_datetime' => 'view/viewutils.php',
'phabricator_datetimezone' => 'view/viewutils.php',
+ 'phabricator_dual_datetime' => 'view/viewutils.php',
'phabricator_form' => 'infrastructure/javelin/markup.php',
'phabricator_format_local_time' => 'view/viewutils.php',
'phabricator_relative_date' => 'view/viewutils.php',
diff --git a/src/applications/phriction/controller/PhrictionDocumentController.php b/src/applications/phriction/controller/PhrictionDocumentController.php
--- a/src/applications/phriction/controller/PhrictionDocumentController.php
+++ b/src/applications/phriction/controller/PhrictionDocumentController.php
@@ -401,7 +401,7 @@
$view->addProperty(
pht('Last Edited'),
- phabricator_datetime($content->getDateCreated(), $viewer));
+ phabricator_dual_datetime($content->getDateCreated(), $viewer));
return $view;
}
diff --git a/src/infrastructure/javelin/markup.php b/src/infrastructure/javelin/markup.php
--- a/src/infrastructure/javelin/markup.php
+++ b/src/infrastructure/javelin/markup.php
@@ -50,6 +50,23 @@
unset($attributes['aural']);
}
+ if (isset($attributes['print'])) {
+ if ($attributes['print']) {
+ $class = idx($attributes, 'class', '');
+ $class = rtrim('print-only '.$class);
+ $attributes['class'] = $class;
+
+ // NOTE: Alternative print content is hidden from screen readers.
+ $attributes['aria-hidden'] = 'true';
+ } else {
+ $class = idx($attributes, 'class', '');
+ $class = rtrim('screen-only '.$class);
+ $attributes['class'] = $class;
+ }
+ unset($attributes['print']);
+ }
+
+
return phutil_tag($tag, $attributes, $content);
}
diff --git a/src/view/phui/PHUICurtainObjectRefView.php b/src/view/phui/PHUICurtainObjectRefView.php
--- a/src/view/phui/PHUICurtainObjectRefView.php
+++ b/src/view/phui/PHUICurtainObjectRefView.php
@@ -46,7 +46,7 @@
$epoch = $this->epoch;
if ($epoch !== null) {
- $epoch_view = phabricator_datetime($epoch, $viewer);
+ $epoch_view = phabricator_dual_datetime($epoch, $viewer);
$epoch_cells = array();
diff --git a/src/view/phui/PHUIObjectItemView.php b/src/view/phui/PHUIObjectItemView.php
--- a/src/view/phui/PHUIObjectItemView.php
+++ b/src/view/phui/PHUIObjectItemView.php
@@ -192,7 +192,7 @@
}
public function setEpoch($epoch) {
- $date = phabricator_datetime($epoch, $this->getUser());
+ $date = phabricator_dual_datetime($epoch, $this->getUser());
$this->addIcon('none', $date);
return $this;
}
diff --git a/src/view/phui/PHUITimelineEventView.php b/src/view/phui/PHUITimelineEventView.php
--- a/src/view/phui/PHUITimelineEventView.php
+++ b/src/view/phui/PHUITimelineEventView.php
@@ -591,7 +591,7 @@
}
if ($date_created) {
- $date = phabricator_datetime(
+ $date = phabricator_dual_datetime(
$date_created,
$this->getUser());
if ($this->anchor) {
@@ -611,6 +611,7 @@
$date),
);
}
+
$extra[] = $date;
}
diff --git a/src/view/viewutils.php b/src/view/viewutils.php
--- a/src/view/viewutils.php
+++ b/src/view/viewutils.php
@@ -38,6 +38,39 @@
$user->getUserSetting($time_key));
}
+function phabricator_dual_datetime($epoch, $user) {
+ $screen_view = phabricator_datetime($epoch, $user);
+ $print_view = phabricator_absolute_datetime($epoch, $user);
+
+ $screen_tag = javelin_tag(
+ 'span',
+ array(
+ 'print' => false,
+ ),
+ $screen_view);
+
+ $print_tag = javelin_tag(
+ 'span',
+ array(
+ 'print' => true,
+ ),
+ $print_view);
+
+ return array(
+ $screen_tag,
+ $print_tag,
+ );
+}
+
+function phabricator_absolute_datetime($epoch, $user) {
+ $format = 'Y-m-d H:i:s (\\U\\T\\CP)';
+
+ $datetime = phabricator_format_local_time($epoch, $user, $format);
+ $datetime = preg_replace('/(UTC[+-])0?([^:]+)(:00)?/', '\\1\\2', $datetime);
+
+ return $datetime;
+}
+
function phabricator_datetime($epoch, $user) {
$time_key = PhabricatorTimeFormatSetting::SETTINGKEY;
return phabricator_format_local_time(
diff --git a/webroot/rsrc/css/core/core.css b/webroot/rsrc/css/core/core.css
--- a/webroot/rsrc/css/core/core.css
+++ b/webroot/rsrc/css/core/core.css
@@ -162,6 +162,33 @@
opacity: 0.25;
}
+.print-only {
+ display: none;
+}
+
+/* NOTE: These rules currently only work when applied to elements which
+ actually want "display: inline". There is no "display: auto". If there
+ is a future need to mix inline and block print elements, using
+ "display: initial" may be a reasonable approach. */
+
+.printable .print-only {
+ display: inline;
+}
+
+.printable .screen-only {
+ display: none;
+}
+
+@media print {
+ .screen-only {
+ display: none;
+ }
+
+ .print-only {
+ display: inline;
+ }
+}
+
.routing-bar {
position: fixed;
top: 0;

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 9, 8:46 AM (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7223481
Default Alt Text
D21451.diff (6 KB)

Event Timeline