diff --git a/conf/default.conf.php b/conf/default.conf.php index b265976e23..5841624ff3 100644 --- a/conf/default.conf.php +++ b/conf/default.conf.php @@ -24,7 +24,7 @@ return array( 'phabricator.csrf-key' => '0b7ec0592e0a2829d8b71df2fa269b2c6172eca3', - + 'phabricator.version' => 'UNSTABLE', @@ -42,13 +42,13 @@ return array( // DarkConsole is a administrative debugging/profiling tool built into // Phabricator. You can leave it disabled unless you're developing against // Phabricator. - + // Determines whether or not DarkConsole is available. DarkConsole exposes // some data like queries and stack traces, so you should be careful about // turning it on in production (although users can not normally see it, even // if the deployment configuration enables it). 'darkconsole.enabled' => true, - + // Always enable DarkConsole, even for logged out users. This potentially // exposes sensitive information to users, so make sure untrusted users can // not access an install running in this mode. You should definitely leave diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 6b34bd6c71..105e2d0a4a 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -27,7 +27,7 @@ celerity_register_resource_map(array( ), 'aphront-form-view-css' => array( - 'uri' => '/res/785ac1c6/rsrc/css/aphront/form-view.css', + 'uri' => '/res/0ea02f2f/rsrc/css/aphront/form-view.css', 'type' => 'css', 'requires' => array( @@ -91,7 +91,7 @@ celerity_register_resource_map(array( ), 'phabricator-standard-page-view' => array( - 'uri' => '/res/c7dedb5f/rsrc/css/application/base/standard-page-view.css', + 'uri' => '/res/4ebe4b10/rsrc/css/application/base/standard-page-view.css', 'type' => 'css', 'requires' => array( @@ -398,7 +398,7 @@ celerity_register_resource_map(array( ), array ( 'packages' => array ( - '554bfa09' => + '89ccb170' => array ( 'name' => 'core.pkg.css', 'symbols' => @@ -417,7 +417,7 @@ celerity_register_resource_map(array( 11 => 'phabricator-remarkup-css', 12 => 'syntax-highlighting-css', ), - 'uri' => '/res/pkg/554bfa09/core.pkg.css', + 'uri' => '/res/pkg/89ccb170/core.pkg.css', 'type' => 'css', ), '4b8af7b5' => @@ -454,19 +454,19 @@ celerity_register_resource_map(array( ), 'reverse' => array ( - 'phabricator-core-css' => '554bfa09', - 'phabricator-core-buttons-css' => '554bfa09', - 'phabricator-standard-page-view' => '554bfa09', - 'aphront-dialog-view-css' => '554bfa09', - 'aphront-form-view-css' => '554bfa09', - 'aphront-panel-view-css' => '554bfa09', - 'aphront-side-nav-view-css' => '554bfa09', - 'aphront-table-view-css' => '554bfa09', - 'aphront-tokenizer-control-css' => '554bfa09', - 'aphront-typeahead-control-css' => '554bfa09', - 'phabricator-directory-css' => '554bfa09', - 'phabricator-remarkup-css' => '554bfa09', - 'syntax-highlighting-css' => '554bfa09', + 'phabricator-core-css' => '89ccb170', + 'phabricator-core-buttons-css' => '89ccb170', + 'phabricator-standard-page-view' => '89ccb170', + 'aphront-dialog-view-css' => '89ccb170', + 'aphront-form-view-css' => '89ccb170', + 'aphront-panel-view-css' => '89ccb170', + 'aphront-side-nav-view-css' => '89ccb170', + 'aphront-table-view-css' => '89ccb170', + 'aphront-tokenizer-control-css' => '89ccb170', + 'aphront-typeahead-control-css' => '89ccb170', + 'phabricator-directory-css' => '89ccb170', + 'phabricator-remarkup-css' => '89ccb170', + 'syntax-highlighting-css' => '89ccb170', 'differential-core-view-css' => '4b8af7b5', 'differential-changeset-view-css' => '4b8af7b5', 'differential-revision-detail-css' => '4b8af7b5', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index a7ce107e3d..4179c68c21 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -98,6 +98,7 @@ phutil_register_library_map(array( 'DifferentialDAO' => 'applications/differential/storage/base', 'DifferentialDiff' => 'applications/differential/storage/diff', 'DifferentialDiffContentMail' => 'applications/differential/mail/diffcontent', + 'DifferentialDiffCreateController' => 'applications/differential/controller/diffcreate', 'DifferentialDiffProperty' => 'applications/differential/storage/diffproperty', 'DifferentialDiffTableOfContentsView' => 'applications/differential/view/difftableofcontents', 'DifferentialDiffViewController' => 'applications/differential/controller/diffview', @@ -286,6 +287,7 @@ phutil_register_library_map(array( 'DifferentialDAO' => 'PhabricatorLiskDAO', 'DifferentialDiff' => 'DifferentialDAO', 'DifferentialDiffContentMail' => 'DifferentialMail', + 'DifferentialDiffCreateController' => 'DifferentialController', 'DifferentialDiffProperty' => 'DifferentialDAO', 'DifferentialDiffTableOfContentsView' => 'AphrontView', 'DifferentialDiffViewController' => 'DifferentialController', diff --git a/src/aphront/applicationconfiguration/AphrontApplicationConfiguration.php b/src/aphront/applicationconfiguration/AphrontApplicationConfiguration.php index 9fb983f220..610f15e3f5 100644 --- a/src/aphront/applicationconfiguration/AphrontApplicationConfiguration.php +++ b/src/aphront/applicationconfiguration/AphrontApplicationConfiguration.php @@ -43,7 +43,7 @@ abstract class AphrontApplicationConfiguration { final public function getConsole() { return $this->console; } - + final public function setConsole($console) { $this->console = $console; } diff --git a/src/aphront/applicationconfiguration/__init__.php b/src/aphront/applicationconfiguration/__init__.php index ccf7d6e897..fa09ec8107 100644 --- a/src/aphront/applicationconfiguration/__init__.php +++ b/src/aphront/applicationconfiguration/__init__.php @@ -6,7 +6,6 @@ -phutil_require_module('phabricator', 'aphront/console/core'); phutil_require_module('phabricator', 'aphront/mapper'); phutil_require_module('phutil', 'symbols'); diff --git a/src/aphront/console/controller/DarkConsoleController.php b/src/aphront/console/controller/DarkConsoleController.php index 8c6f0a1925..d728efdc87 100755 --- a/src/aphront/console/controller/DarkConsoleController.php +++ b/src/aphront/console/controller/DarkConsoleController.php @@ -38,7 +38,7 @@ class DarkConsoleController extends PhabricatorController { $user->save(); return new AphrontAjaxResponse(); } - + if (PhabricatorEnv::getEnvConfig('darkconsole.enabled')) { $user->setConsoleEnabled(!$user->getConsoleEnabled()); $user->save(); @@ -48,7 +48,7 @@ class DarkConsoleController extends PhabricatorController { return id(new AphrontRedirectResponse())->setURI('/'); } } - + } } diff --git a/src/aphront/console/controller/__init__.php b/src/aphront/console/controller/__init__.php index e4df3df00d..82e0a1c395 100644 --- a/src/aphront/console/controller/__init__.php +++ b/src/aphront/console/controller/__init__.php @@ -7,7 +7,11 @@ phutil_require_module('phabricator', 'aphront/response/ajax'); +phutil_require_module('phabricator', 'aphront/response/redirect'); phutil_require_module('phabricator', 'applications/base/controller/base'); +phutil_require_module('phabricator', 'infrastructure/env'); + +phutil_require_module('phutil', 'utils'); phutil_require_source('DarkConsoleController.php'); diff --git a/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php b/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php index 5d59e50786..29912550e1 100644 --- a/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php +++ b/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php @@ -82,7 +82,10 @@ class AphrontDefaultApplicationConfiguration '/differential/' => array( '$' => 'DifferentialRevisionListController', 'filter/(?\w+)/$' => 'DifferentialRevisionListController', - 'diff/(?\d+)/$' => 'DifferentialDiffViewController', + 'diff/' => array( + '(?\d+)/$' => 'DifferentialDiffViewController', + 'create/$' => 'DifferentialDiffCreateController', + ), 'changeset/$' => 'DifferentialChangesetViewController', 'revision/edit/(?:(?\d+)/)?$' => 'DifferentialRevisionEditController', diff --git a/src/aphront/request/AphrontRequest.php b/src/aphront/request/AphrontRequest.php index c7628c0a82..ef3332f864 100644 --- a/src/aphront/request/AphrontRequest.php +++ b/src/aphront/request/AphrontRequest.php @@ -70,7 +70,13 @@ class AphrontRequest { final public function getStr($name, $default = null) { if (isset($this->requestData[$name])) { - return (string)$this->requestData[$name]; + $str = (string)$this->requestData[$name]; + // Normalize newline craziness. + $str = str_replace( + array("\r\n", "\r"), + array("\n", "\n"), + $str); + return $str; } else { return $default; } diff --git a/src/aphront/response/redirect/AphrontRedirectResponse.php b/src/aphront/response/redirect/AphrontRedirectResponse.php index 1939a86f53..73cfcc3254 100644 --- a/src/aphront/response/redirect/AphrontRedirectResponse.php +++ b/src/aphront/response/redirect/AphrontRedirectResponse.php @@ -27,7 +27,7 @@ class AphrontRedirectResponse extends AphrontResponse { $this->uri = $uri; return $this; } - + public function getURI() { return $this->uri; } diff --git a/src/applications/base/controller/base/PhabricatorController.php b/src/applications/base/controller/base/PhabricatorController.php index 32205c245a..a05964173e 100644 --- a/src/applications/base/controller/base/PhabricatorController.php +++ b/src/applications/base/controller/base/PhabricatorController.php @@ -46,7 +46,7 @@ abstract class PhabricatorController extends AphrontController { } $request->setUser($user); - + if (PhabricatorEnv::getEnvConfig('darkconsole.enabled')) { if ($user->getConsoleEnabled() || PhabricatorEnv::getEnvConfig('darkconsole.always-on')) { diff --git a/src/applications/base/controller/base/__init__.php b/src/applications/base/controller/base/__init__.php index 038d5108a6..ebf030f26b 100644 --- a/src/applications/base/controller/base/__init__.php +++ b/src/applications/base/controller/base/__init__.php @@ -6,10 +6,12 @@ +phutil_require_module('phabricator', 'aphront/console/core'); phutil_require_module('phabricator', 'aphront/controller'); phutil_require_module('phabricator', 'aphront/exception/redirect'); phutil_require_module('phabricator', 'aphront/response/webpage'); phutil_require_module('phabricator', 'applications/people/storage/user'); +phutil_require_module('phabricator', 'infrastructure/env'); phutil_require_module('phabricator', 'storage/queryfx'); phutil_require_module('phabricator', 'view/page/standard'); diff --git a/src/applications/differential/controller/base/DifferentialController.php b/src/applications/differential/controller/base/DifferentialController.php index 7d10a590db..50300b0210 100644 --- a/src/applications/differential/controller/base/DifferentialController.php +++ b/src/applications/differential/controller/base/DifferentialController.php @@ -29,6 +29,18 @@ abstract class DifferentialController extends PhabricatorController { $page->setTitle(idx($data, 'title')); $page->setGlyph("\xE2\x9A\x99"); $page->appendChild($view); + $page->setTabs( + array( + 'revisions' => array( + 'name' => 'Revisions', + 'href' => '/differential/', + ), + 'create' => array( + 'name' => 'Create Diff', + 'href' => '/differential/diff/create/', + ), + ), + idx($data, 'tab')); $response = new AphrontWebpageResponse(); return $response->setContent($page->render()); diff --git a/src/applications/differential/controller/diffcreate/DifferentialDiffCreateController.php b/src/applications/differential/controller/diffcreate/DifferentialDiffCreateController.php new file mode 100644 index 0000000000..86416188bc --- /dev/null +++ b/src/applications/differential/controller/diffcreate/DifferentialDiffCreateController.php @@ -0,0 +1,73 @@ +getRequest(); + + if ($request->isFormPost()) { + $parser = new ArcanistDiffParser(); + $diff = $request->getStr('diff'); + $changes = $parser->parseDiff($diff); + $diff = DifferentialDiff::newFromRawChanges($changes); + + $diff->setLintStatus(DifferentialLintStatus::LINT_SKIP); + $diff->setUnitStatus(DifferentialLintStatus::LINT_SKIP); + + $diff->setAuthorPHID($request->getUser()->getPHID()); + $diff->setCreationMethod('web'); + $diff->save(); + + return id(new AphrontRedirectResponse()) + ->setURI('/differential/diff/'.$diff->getID().'/'); + } + + $form = new AphrontFormView(); + $form + ->setAction('/differential/diff/create/') + ->setUser($request->getUser()) + ->appendChild( + '

The best way to create a '. + 'Differential diff is by using Arcanist, but you '. + 'can also just paste a diff (e.g., from svn diff or '. + 'git diff) into this box if you really want.

') + ->appendChild( + id(new AphrontFormTextAreaControl()) + ->setLabel('Raw Diff') + ->setName('diff') + ->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)) + ->appendChild( + id(new AphrontFormSubmitControl()) + ->setValue("Create Diff \xC2\xBB")); + + $panel = new AphrontPanelView(); + $panel->setHeader('Create New Diff'); + $panel->appendChild($form); + $panel->setWidth(AphrontPanelView::WIDTH_FORM); + + return $this->buildStandardPageResponse( + $panel, + array( + 'title' => 'Create Diff', + 'tab' => 'create', + )); + } + +} diff --git a/src/applications/differential/controller/diffcreate/__init__.php b/src/applications/differential/controller/diffcreate/__init__.php new file mode 100644 index 0000000000..0622bca3d7 --- /dev/null +++ b/src/applications/differential/controller/diffcreate/__init__.php @@ -0,0 +1,22 @@ + 'Differential Home', + 'tab' => 'revisions', )); } diff --git a/src/view/form/control/textarea/AphrontFormTextAreaControl.php b/src/view/form/control/textarea/AphrontFormTextAreaControl.php index 36b64a8b53..33a5873c08 100755 --- a/src/view/form/control/textarea/AphrontFormTextAreaControl.php +++ b/src/view/form/control/textarea/AphrontFormTextAreaControl.php @@ -20,6 +20,7 @@ class AphrontFormTextAreaControl extends AphrontFormControl { const HEIGHT_VERY_SHORT = 'very-short'; const HEIGHT_SHORT = 'short'; + const HEIGHT_VERY_TALL = 'very-tall'; private $height; @@ -38,6 +39,7 @@ class AphrontFormTextAreaControl extends AphrontFormControl { switch ($this->height) { case self::HEIGHT_VERY_SHORT: case self::HEIGHT_SHORT: + case self::HEIGHT_VERY_TALL: $height_class = 'aphront-textarea-'.$this->height; break; } diff --git a/src/view/page/standard/PhabricatorStandardPageView.php b/src/view/page/standard/PhabricatorStandardPageView.php index a2ba41c9ab..d3732da0f9 100755 --- a/src/view/page/standard/PhabricatorStandardPageView.php +++ b/src/view/page/standard/PhabricatorStandardPageView.php @@ -173,12 +173,12 @@ class PhabricatorStandardPageView extends AphrontPageView { ''; } } - + $foot_links = array(); - + $version = PhabricatorEnv::getEnvConfig('phabricator.version'); $foot_links[] = phutil_escape_html('Phabricator '.$version); - + if (PhabricatorEnv::getEnvConfig('darkconsole.enabled') && !PhabricatorEnv::getEnvConfig('darkconsole.always-on')) { if ($console) { @@ -201,7 +201,7 @@ class PhabricatorStandardPageView extends AphrontPageView { $foot_links[] = $link; } $foot_links = implode(' · ', $foot_links); - + return ($console ? '' : null). diff --git a/src/view/page/standard/__init__.php b/src/view/page/standard/__init__.php index 70f42a3448..5b4e699da5 100644 --- a/src/view/page/standard/__init__.php +++ b/src/view/page/standard/__init__.php @@ -7,7 +7,9 @@ phutil_require_module('phabricator', 'infrastructure/celerity/api'); +phutil_require_module('phabricator', 'infrastructure/env'); phutil_require_module('phabricator', 'infrastructure/javelin/api'); +phutil_require_module('phabricator', 'infrastructure/javelin/markup'); phutil_require_module('phabricator', 'view/page/base'); phutil_require_module('phutil', 'markup'); diff --git a/webroot/rsrc/css/aphront/form-view.css b/webroot/rsrc/css/aphront/form-view.css index aded181c7d..64db545fbe 100644 --- a/webroot/rsrc/css/aphront/form-view.css +++ b/webroot/rsrc/css/aphront/form-view.css @@ -57,6 +57,10 @@ height: 3em; } +.aphront-form-control-textarea textarea.aphront-textarea-very-tall { + height: 24em; +} + .aphront-form-control-select .aphront-form-input { padding-top: 2px; } diff --git a/webroot/rsrc/css/application/base/standard-page-view.css b/webroot/rsrc/css/application/base/standard-page-view.css index c525693278..b9ef2b35b2 100644 --- a/webroot/rsrc/css/application/base/standard-page-view.css +++ b/webroot/rsrc/css/application/base/standard-page-view.css @@ -53,6 +53,6 @@ .phabricator-page-foot { text-align: right; padding: .5em 1em; - font-size: 11px; + font-size: 11px; color: #f3f3f3; -} \ No newline at end of file +}