2011-07-16 18:25:45 -07:00
|
|
|
<?php
|
|
|
|
|
2011-09-14 08:02:31 -07:00
|
|
|
/**
|
|
|
|
* @group phriction
|
|
|
|
*/
|
2012-03-09 15:46:25 -08:00
|
|
|
final class PhrictionDocumentPreviewController
|
2011-07-16 18:25:45 -07:00
|
|
|
extends PhrictionController {
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$document = $request->getStr('document');
|
|
|
|
|
2012-01-12 11:57:22 -08:00
|
|
|
$draft_key = $request->getStr('draftkey');
|
|
|
|
if ($draft_key) {
|
2012-10-01 15:50:47 -07:00
|
|
|
id(new PhabricatorDraft())
|
|
|
|
->setAuthorPHID($request->getUser()->getPHID())
|
|
|
|
->setDraftKey($draft_key)
|
|
|
|
->setDraft($document)
|
|
|
|
->replaceOrDelete();
|
2012-01-12 11:57:22 -08:00
|
|
|
}
|
|
|
|
|
2012-01-06 09:08:59 -08:00
|
|
|
$content_obj = new PhrictionContent();
|
|
|
|
$content_obj->setContent($document);
|
2012-09-05 11:40:48 -07:00
|
|
|
$content = $content_obj->renderContent($request->getUser());
|
2011-07-16 18:25:45 -07:00
|
|
|
|
|
|
|
return id(new AphrontAjaxResponse())->setContent($content);
|
|
|
|
}
|
|
|
|
}
|