2012-11-10 00:08:37 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @group phriction
|
|
|
|
*/
|
|
|
|
final class PhrictionNewController extends PhrictionController {
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$user = $request->getUser();
|
|
|
|
|
|
|
|
if ($request->isFormPost()) {
|
|
|
|
$slug = PhabricatorSlug::normalize($request->getStr('slug'));
|
|
|
|
$uri = '/phriction/edit/?slug='.$slug;
|
|
|
|
return id(new AphrontRedirectResponse())
|
|
|
|
->setURI($uri);
|
|
|
|
}
|
|
|
|
|
|
|
|
$view = id(new AphrontFormLayoutView())
|
|
|
|
->appendChild(id(new AphrontFormTextControl())
|
|
|
|
->setLabel('/w/')
|
|
|
|
->setName('slug'));
|
|
|
|
|
|
|
|
$dialog = id(new AphrontDialogView())
|
|
|
|
->setUser($user)
|
|
|
|
->setTitle(pht('New Document'))
|
2013-01-18 04:15:06 +01:00
|
|
|
->appendChild(phutil_tag('p',
|
2012-11-10 00:08:37 +01:00
|
|
|
array(),
|
|
|
|
pht('Create a new document at')))
|
|
|
|
->appendChild($view)
|
|
|
|
->addSubmitButton(pht('Create'))
|
2013-01-11 20:58:31 +01:00
|
|
|
->addCancelButton('/w/');
|
2012-11-10 00:08:37 +01:00
|
|
|
|
|
|
|
return id(new AphrontDialogResponse())->setDialog($dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|