2011-02-05 21:20:18 +01:00
|
|
|
<?php
|
|
|
|
|
2012-03-10 00:46:25 +01:00
|
|
|
final class DifferentialDiffCreateController extends DifferentialController {
|
2011-02-05 21:20:18 +01:00
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
|
|
|
|
if ($request->isFormPost()) {
|
2011-10-19 04:46:52 +02:00
|
|
|
$diff = null;
|
2013-01-09 17:14:17 +01:00
|
|
|
|
|
|
|
if ($request->getFileExists('diff-file')) {
|
2011-10-19 04:46:52 +02:00
|
|
|
$diff = PhabricatorFile::readUploadedFileData($_FILES['diff-file']);
|
2013-01-09 17:14:17 +01:00
|
|
|
} else {
|
2011-10-19 04:46:52 +02:00
|
|
|
$diff = $request->getStr('diff');
|
|
|
|
}
|
2011-02-05 21:20:18 +01:00
|
|
|
|
2012-06-20 21:35:04 +02:00
|
|
|
$call = new ConduitCall(
|
|
|
|
'differential.createrawdiff',
|
|
|
|
array(
|
|
|
|
'diff' => $diff,
|
|
|
|
));
|
|
|
|
$call->setUser($request->getUser());
|
|
|
|
$result = $call->execute();
|
2011-02-05 21:20:18 +01:00
|
|
|
|
2012-06-20 21:35:04 +02:00
|
|
|
$path = id(new PhutilURI($result['uri']))->getPath();
|
|
|
|
return id(new AphrontRedirectResponse())->setURI($path);
|
2011-02-05 21:20:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$form = new AphrontFormView();
|
Update form styles, implement in many places
Summary:
This creates a common form look and feel across the site. I spent a bit of time working out a number of kinks in our various renderings. Some things:
- Font Styles are correctly applied for form elements now.
- Everything lines up!
- Selects are larger, easier to read, interact.
- Inputs have been squared.
- Consistant CSS applied glow (try it!)
- Improved Mobile Responsiveness
- CSS applied to all form elements, not just Aphront
- Many other minor tweaks.
I tried to hit as many high profile forms as possible in an effort to increase consistency. Stopped for now and will follow up after this lands. I know Evan is not a super fan of the glow, but after working with it for a week, it's way cleaner and responsive than the OS controls. Give it a try.
Test Plan: Tested many applications, forms, mobile and tablet.
Reviewers: epriestley, btrahan
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D5860
2013-05-07 23:07:06 +02:00
|
|
|
$form->setFlexible(true);
|
2011-12-02 01:05:54 +01:00
|
|
|
$arcanist_href = PhabricatorEnv::getDoclink(
|
|
|
|
'article/Arcanist_User_Guide.html');
|
2013-01-18 03:57:09 +01:00
|
|
|
$arcanist_link = phutil_tag(
|
2011-12-02 01:05:54 +01:00
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => $arcanist_href,
|
|
|
|
'target' => '_blank',
|
|
|
|
),
|
|
|
|
'Arcanist');
|
2011-02-05 21:20:18 +01:00
|
|
|
$form
|
|
|
|
->setAction('/differential/diff/create/')
|
2011-10-19 04:46:52 +02:00
|
|
|
->setEncType('multipart/form-data')
|
2011-02-05 21:20:18 +01:00
|
|
|
->setUser($request->getUser())
|
2013-02-07 23:39:04 +01:00
|
|
|
->appendChild(hsprintf(
|
|
|
|
'<p class="aphront-form-instructions">%s</p>',
|
|
|
|
pht(
|
|
|
|
'The best way to create a Differential diff is by using %s, but you '.
|
|
|
|
'can also just paste a diff (e.g., from %s or %s) into this box '.
|
|
|
|
'or upload it as a file if you really want.',
|
|
|
|
$arcanist_link,
|
|
|
|
phutil_tag('tt', array(), 'svn diff'),
|
|
|
|
phutil_tag('tt', array(), 'git diff'))))
|
2011-02-05 21:20:18 +01:00
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTextAreaControl())
|
2013-01-24 19:46:47 +01:00
|
|
|
->setLabel(pht('Raw Diff'))
|
2011-02-05 21:20:18 +01:00
|
|
|
->setName('diff')
|
|
|
|
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL))
|
2011-10-19 04:46:52 +02:00
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormFileControl())
|
2013-01-24 19:46:47 +01:00
|
|
|
->setLabel(pht('Raw Diff from file'))
|
2011-10-19 04:46:52 +02:00
|
|
|
->setName('diff-file'))
|
2011-02-05 21:20:18 +01:00
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormSubmitControl())
|
2013-01-24 19:46:47 +01:00
|
|
|
->setValue(pht("Create Diff \xC2\xBB")));
|
2011-02-05 21:20:18 +01:00
|
|
|
|
2013-03-26 21:15:15 +01:00
|
|
|
$crumbs = $this->buildApplicationCrumbs();
|
|
|
|
$crumbs->addCrumb(
|
|
|
|
id(new PhabricatorCrumbView())
|
|
|
|
->setName(pht('Create Diff'))
|
|
|
|
->setHref('/differential/diff/create/'));
|
|
|
|
|
|
|
|
return $this->buildApplicationPage(
|
|
|
|
array(
|
|
|
|
$crumbs,
|
Update form styles, implement in many places
Summary:
This creates a common form look and feel across the site. I spent a bit of time working out a number of kinks in our various renderings. Some things:
- Font Styles are correctly applied for form elements now.
- Everything lines up!
- Selects are larger, easier to read, interact.
- Inputs have been squared.
- Consistant CSS applied glow (try it!)
- Improved Mobile Responsiveness
- CSS applied to all form elements, not just Aphront
- Many other minor tweaks.
I tried to hit as many high profile forms as possible in an effort to increase consistency. Stopped for now and will follow up after this lands. I know Evan is not a super fan of the glow, but after working with it for a week, it's way cleaner and responsive than the OS controls. Give it a try.
Test Plan: Tested many applications, forms, mobile and tablet.
Reviewers: epriestley, btrahan
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D5860
2013-05-07 23:07:06 +02:00
|
|
|
$form
|
2013-03-26 21:15:15 +01:00
|
|
|
),
|
2011-02-05 21:20:18 +01:00
|
|
|
array(
|
2013-01-24 19:46:47 +01:00
|
|
|
'title' => pht('Create Diff'),
|
2013-03-26 21:15:15 +01:00
|
|
|
'device' => true,
|
Update form styles, implement in many places
Summary:
This creates a common form look and feel across the site. I spent a bit of time working out a number of kinks in our various renderings. Some things:
- Font Styles are correctly applied for form elements now.
- Everything lines up!
- Selects are larger, easier to read, interact.
- Inputs have been squared.
- Consistant CSS applied glow (try it!)
- Improved Mobile Responsiveness
- CSS applied to all form elements, not just Aphront
- Many other minor tweaks.
I tried to hit as many high profile forms as possible in an effort to increase consistency. Stopped for now and will follow up after this lands. I know Evan is not a super fan of the glow, but after working with it for a week, it's way cleaner and responsive than the OS controls. Give it a try.
Test Plan: Tested many applications, forms, mobile and tablet.
Reviewers: epriestley, btrahan
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D5860
2013-05-07 23:07:06 +02:00
|
|
|
'dust' => true,
|
2011-02-05 21:20:18 +01:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|