Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phriction/controller/PhrictionDocumentController.php
Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | if (!$document) { | ||||
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); | $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); | ||||
$notice->setTitle(pht('Empty Document')); | $notice->setTitle(pht('Empty Document')); | ||||
$notice->appendChild( | $notice->appendChild( | ||||
pht('This document is empty. You can edit it to put some proper '. | pht('This document is empty. You can edit it to put some proper '. | ||||
'content here.')); | 'content here.')); | ||||
$core_content = $notice->render(); | $core_content = $notice->render(); | ||||
} else if ($current_status == PhrictionChangeType::CHANGE_MOVE_AWAY) { | } else if ($current_status == PhrictionChangeType::CHANGE_MOVE_AWAY) { | ||||
$new_doc_id = $content->getChangeRef(); | $new_doc_id = $content->getChangeRef(); | ||||
$new_doc = new PhrictionDocument(); | $new_doc = id(new PhrictionDocumentQuery()) | ||||
$new_doc->load($new_doc_id); | ->setViewer($user) | ||||
->withIDs(array($new_doc_id)) | |||||
->exectueOne(); | |||||
$slug_uri = PhrictionDocument::getSlugURI($new_doc->getSlug()); | $slug_uri = PhrictionDocument::getSlugURI($new_doc->getSlug()); | ||||
$notice = new AphrontErrorView(); | $notice = new AphrontErrorView(); | ||||
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); | $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); | ||||
$notice->setTitle(pht('Document Moved')); | $notice->setTitle(pht('Document Moved')); | ||||
$notice->appendChild(phutil_tag('p', array(), | $notice->appendChild(phutil_tag('p', array(), | ||||
pht('This document has been moved to %s. You can edit it to put new '. | pht('This document has been moved to %s. You can edit it to put new '. | ||||
'content here, or use history to revert to an earlier version.', | 'content here, or use history to revert to an earlier version.', | ||||
phutil_tag('a', array('href' => $slug_uri), $slug_uri)))); | phutil_tag('a', array('href' => $slug_uri), $slug_uri)))); | ||||
$core_content = $notice->render(); | $core_content = $notice->render(); | ||||
} else { | } else { | ||||
throw new Exception("Unknown document status '{$doc_status}'!"); | throw new Exception("Unknown document status '{$doc_status}'!"); | ||||
} | } | ||||
$move_notice = null; | $move_notice = null; | ||||
if ($current_status == PhrictionChangeType::CHANGE_MOVE_HERE) { | if ($current_status == PhrictionChangeType::CHANGE_MOVE_HERE) { | ||||
$from_doc_id = $content->getChangeRef(); | $from_doc_id = $content->getChangeRef(); | ||||
$from_doc = id(new PhrictionDocument())->load($from_doc_id); | $from_doc = id(new PhrictionDocumentQuery()) | ||||
->setViewer($user) | |||||
->withIDs(array($from_doc_id)) | |||||
->executeOne(); | |||||
$slug_uri = PhrictionDocument::getSlugURI($from_doc->getSlug()); | $slug_uri = PhrictionDocument::getSlugURI($from_doc->getSlug()); | ||||
$move_notice = id(new AphrontErrorView()) | $move_notice = id(new AphrontErrorView()) | ||||
->setSeverity(AphrontErrorView::SEVERITY_NOTICE) | ->setSeverity(AphrontErrorView::SEVERITY_NOTICE) | ||||
->appendChild(pht('This document was moved from %s', | ->appendChild(pht('This document was moved from %s', | ||||
phutil_tag('a', array('href' => $slug_uri), $slug_uri))) | phutil_tag('a', array('href' => $slug_uri), $slug_uri))) | ||||
->render(); | ->render(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 316 Lines • Show Last 20 Lines |