@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Provide a web interface to view raw source text in Differential

Summary:
Add links to the 'standalone view' to grab the raw source text. I think this
operation is rare enough that it's okay to hide it like this. I changed
'Standalone View' to 'View Standalone / Raw' to improve discoverability.

This also fixes the broken Standalone View links in Diffusion by no longer
rendering them.

Test Plan:
viewed old and new sources for a changeset

Reviewed By: tuomaspelkonen
Reviewers: tuomaspelkonen, jungejason, aran
CC: aran, tuomaspelkonen
Differential Revision: 243

+94 -28
+11 -11
src/__celerity_resource_map__.php
··· 136 136 ), 137 137 'differential-changeset-view-css' => 138 138 array( 139 - 'uri' => '/res/f26ca6f9/rsrc/css/application/differential/changeset-view.css', 139 + 'uri' => '/res/32a8bac6/rsrc/css/application/differential/changeset-view.css', 140 140 'type' => 'css', 141 141 'requires' => 142 142 array( ··· 690 690 'uri' => '/res/pkg/6c786373/differential.pkg.js', 691 691 'type' => 'js', 692 692 ), 693 - '8d8a971a' => 693 + '8e4ef51b' => 694 694 array ( 695 695 'name' => 'differential.pkg.css', 696 696 'symbols' => ··· 704 704 6 => 'differential-revision-add-comment-css', 705 705 7 => 'differential-revision-comment-list-css', 706 706 ), 707 - 'uri' => '/res/pkg/8d8a971a/differential.pkg.css', 707 + 'uri' => '/res/pkg/8e4ef51b/differential.pkg.css', 708 708 'type' => 'css', 709 709 ), 710 710 'eadf6ec3' => ··· 728 728 'aphront-table-view-css' => '4270730a', 729 729 'aphront-tokenizer-control-css' => '4270730a', 730 730 'aphront-typeahead-control-css' => '4270730a', 731 - 'differential-changeset-view-css' => '8d8a971a', 732 - 'differential-core-view-css' => '8d8a971a', 733 - 'differential-revision-add-comment-css' => '8d8a971a', 734 - 'differential-revision-comment-css' => '8d8a971a', 735 - 'differential-revision-comment-list-css' => '8d8a971a', 736 - 'differential-revision-detail-css' => '8d8a971a', 737 - 'differential-revision-history-css' => '8d8a971a', 738 - 'differential-table-of-contents-css' => '8d8a971a', 731 + 'differential-changeset-view-css' => '8e4ef51b', 732 + 'differential-core-view-css' => '8e4ef51b', 733 + 'differential-revision-add-comment-css' => '8e4ef51b', 734 + 'differential-revision-comment-css' => '8e4ef51b', 735 + 'differential-revision-comment-list-css' => '8e4ef51b', 736 + 'differential-revision-detail-css' => '8e4ef51b', 737 + 'differential-revision-history-css' => '8e4ef51b', 738 + 'differential-table-of-contents-css' => '8e4ef51b', 739 739 'diffusion-commit-view-css' => 'eadf6ec3', 740 740 'javelin-behavior-differential-diff-radios' => '6c786373', 741 741 'javelin-behavior-differential-edit-inline-comments' => '6c786373',
+38
src/applications/differential/controller/changesetview/DifferentialChangesetViewController.php
··· 33 33 return new Aphront404Response(); 34 34 } 35 35 36 + $view = $request->getStr('view'); 37 + if ($view) { 38 + $changeset->attachHunks($changeset->loadHunks()); 39 + switch ($view) { 40 + case 'new': 41 + return $this->buildRawFileResponse($changeset->makeNewFile()); 42 + case 'old': 43 + return $this->buildRawFileResponse($changeset->makeOldFile()); 44 + default: 45 + return new Aphront400Response(); 46 + } 47 + } 48 + 36 49 if ($vs && ($vs != -1)) { 37 50 $vs_changeset = id(new DifferentialChangeset())->load($vs); 38 51 if (!$vs_changeset) { ··· 177 190 $detail = new DifferentialChangesetDetailView(); 178 191 $detail->setChangeset($changeset); 179 192 $detail->appendChild($output); 193 + 194 + if (!$vs) { 195 + $detail->addButton( 196 + phutil_render_tag( 197 + 'a', 198 + array( 199 + 'href' => $request->getRequestURI()->alter('view', 'old'), 200 + 'class' => 'grey button small', 201 + ), 202 + 'View Raw File (Old Version)')); 203 + $detail->addButton( 204 + phutil_render_tag( 205 + 'a', 206 + array( 207 + 'href' => $request->getRequestURI()->alter('view', 'new'), 208 + 'class' => 'grey button small', 209 + ), 210 + 'View Raw File (New Version)')); 211 + } 212 + 180 213 $detail->setRevisionID($request->getInt('revision_id')); 181 214 182 215 $output = ··· 202 235 $author_phid); 203 236 } 204 237 238 + private function buildRawFileResponse($text) { 239 + return id(new AphrontFileResponse()) 240 + ->setMimeType('text/plain') 241 + ->setContent($text); 242 + } 205 243 206 244 }
+3
src/applications/differential/controller/changesetview/__init__.php
··· 8 8 9 9 phutil_require_module('arcanist', 'parser/diff'); 10 10 11 + phutil_require_module('phabricator', 'aphront/response/400'); 11 12 phutil_require_module('phabricator', 'aphront/response/404'); 12 13 phutil_require_module('phabricator', 'aphront/response/ajax'); 14 + phutil_require_module('phabricator', 'aphront/response/file'); 13 15 phutil_require_module('phabricator', 'applications/differential/controller/base'); 14 16 phutil_require_module('phabricator', 'applications/differential/parser/changeset'); 15 17 phutil_require_module('phabricator', 'applications/differential/parser/markup'); ··· 23 25 phutil_require_module('phutil', 'filesystem'); 24 26 phutil_require_module('phutil', 'filesystem/tempfile'); 25 27 phutil_require_module('phutil', 'future/exec'); 28 + phutil_require_module('phutil', 'markup'); 26 29 phutil_require_module('phutil', 'utils'); 27 30 28 31
+1
src/applications/differential/controller/revisionview/DifferentialRevisionViewController.php
··· 179 179 $changeset_view = new DifferentialChangesetListView(); 180 180 $changeset_view->setChangesets($visible_changesets); 181 181 $changeset_view->setEditable(true); 182 + $changeset_view->setStandaloneViews(true); 182 183 $changeset_view->setRevision($revision); 183 184 $changeset_view->setVsMap($vs_map); 184 185 $changeset_view->setWhitespace($whitespace);
+9 -1
src/applications/differential/view/changesetdetailview/DifferentialChangesetDetailView.php
··· 53 53 $class .= ' differential-changeset-immutable'; 54 54 } 55 55 56 + $buttons = null; 57 + if ($this->buttons) { 58 + $buttons = 59 + '<div class="differential-changeset-buttons">'. 60 + implode('', $this->buttons). 61 + '</div>'; 62 + } 63 + 56 64 $display_filename = $changeset->getDisplayFilename(); 57 65 $output = javelin_render_tag( 58 66 'div', ··· 70 78 'name' => $changeset->getAnchorName(), 71 79 ), 72 80 ''). 73 - implode('', $this->buttons). 81 + $buttons. 74 82 '<h1>'.phutil_escape_html($display_filename).'</h1>'. 75 83 '<div style="clear: both;"></div>'. 76 84 $this->renderChildren());
+24 -16
src/applications/differential/view/changesetlistview/DifferentialChangesetListView.php
··· 24 24 private $renderURI = '/differential/changeset/'; 25 25 private $vsMap = array(); 26 26 private $whitespace; 27 + private $standaloneViews; 27 28 28 29 public function setChangesets($changesets) { 29 30 $this->changesets = $changesets; ··· 32 33 33 34 public function setEditable($editable) { 34 35 $this->editable = $editable; 36 + return $this; 37 + } 38 + 39 + public function setStandaloneViews($has_standalone_views) { 40 + $this->standaloneViews = $has_standalone_views; 35 41 return $this; 36 42 } 37 43 ··· 78 84 79 85 $ref = $changeset->getRenderingReference(); 80 86 81 - $detail_uri = new PhutilURI($this->renderURI); 82 - $detail_uri->setQueryParams( 83 - array( 84 - 'id' => $ref, 85 - 'vs' => $vs_id, 86 - 'whitespace' => $this->whitespace, 87 - )); 87 + $detail_button = null; 88 + if ($this->standaloneViews) { 89 + $detail_uri = new PhutilURI($this->renderURI); 90 + $detail_uri->setQueryParams( 91 + array( 92 + 'id' => $ref, 93 + 'vs' => $vs_id, 94 + 'whitespace' => $this->whitespace, 95 + )); 88 96 89 - $detail_button = phutil_render_tag( 90 - 'a', 91 - array( 92 - 'style' => 'float: right', 93 - 'class' => 'button small grey', 94 - 'href' => $detail_uri, 95 - 'target' => '_blank', 96 - ), 97 - 'Standalone View'); 97 + $detail_button = phutil_render_tag( 98 + 'a', 99 + array( 100 + 'class' => 'button small grey', 101 + 'href' => $detail_uri, 102 + 'target' => '_blank', 103 + ), 104 + 'View Standalone / Raw'); 105 + } 98 106 99 107 $uniq_id = celerity_generate_unique_node_id(); 100 108
+8
webroot/rsrc/css/application/differential/changeset-view.css
··· 172 172 width: 100%; 173 173 height: 12em; 174 174 } 175 + 176 + .differential-changeset-buttons { 177 + float: right; 178 + } 179 + 180 + .differential-changeset-buttons a.button { 181 + margin-left: 8px; 182 + }