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