Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/legalpad/storage/LegalpadDocumentBody.php
13459 views
1
<?php
2
3
final class LegalpadDocumentBody extends LegalpadDAO
4
implements
5
PhabricatorMarkupInterface {
6
7
const MARKUP_FIELD_TEXT = 'markup:text ';
8
9
protected $phid;
10
protected $creatorPHID;
11
protected $documentPHID;
12
protected $version;
13
protected $title;
14
protected $text;
15
16
protected function getConfiguration() {
17
return array(
18
self::CONFIG_AUX_PHID => true,
19
self::CONFIG_COLUMN_SCHEMA => array(
20
'version' => 'uint32',
21
'title' => 'text255',
22
'text' => 'text?',
23
),
24
self::CONFIG_KEY_SCHEMA => array(
25
'key_document' => array(
26
'columns' => array('documentPHID', 'version'),
27
'unique' => true,
28
),
29
),
30
) + parent::getConfiguration();
31
}
32
33
public function generatePHID() {
34
return PhabricatorPHID::generateNewPHID(
35
PhabricatorPHIDConstants::PHID_TYPE_LEGB);
36
}
37
38
/* -( PhabricatorMarkupInterface )----------------------------------------- */
39
40
41
public function getMarkupFieldKey($field) {
42
$content = $this->getMarkupText($field);
43
return PhabricatorMarkupEngine::digestRemarkupContent($this, $content);
44
}
45
46
public function newMarkupEngine($field) {
47
return PhabricatorMarkupEngine::newMarkupEngine(array());
48
}
49
50
public function getMarkupText($field) {
51
switch ($field) {
52
case self::MARKUP_FIELD_TEXT:
53
$text = $this->getText();
54
break;
55
default:
56
throw new Exception(pht('Unknown field: %s', $field));
57
break;
58
}
59
60
return $text;
61
}
62
63
public function didMarkupText($field, $output, PhutilMarkupEngine $engine) {
64
require_celerity_resource('phabricator-remarkup-css');
65
return phutil_tag(
66
'div',
67
array(
68
'class' => 'phabricator-remarkup',
69
),
70
$output);
71
}
72
73
public function shouldUseMarkupCache($field) {
74
return (bool)$this->getID();
75
}
76
77
}
78
79