Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/conpherence/editor/ConpherenceEditEngine.php
12256 views
1
<?php
2
3
final class ConpherenceEditEngine
4
extends PhabricatorEditEngine {
5
6
const ENGINECONST = 'conpherence.thread';
7
8
public function getEngineName() {
9
return pht('Conpherence');
10
}
11
12
public function getEngineApplicationClass() {
13
return 'PhabricatorConpherenceApplication';
14
}
15
16
public function getSummaryHeader() {
17
return pht('Configure Conpherence Forms');
18
}
19
20
public function getSummaryText() {
21
return pht('Configure creation and editing forms in Conpherence.');
22
}
23
24
protected function newEditableObject() {
25
return ConpherenceThread::initializeNewRoom($this->getViewer());
26
}
27
28
protected function newObjectQuery() {
29
return new ConpherenceThreadQuery();
30
}
31
32
protected function getObjectCreateTitleText($object) {
33
return pht('Create New Room');
34
}
35
36
protected function getObjectEditTitleText($object) {
37
return pht('Edit Room: %s', $object->getTitle());
38
}
39
40
protected function getObjectEditShortText($object) {
41
return $object->getTitle();
42
}
43
44
protected function getObjectCreateShortText() {
45
return pht('Create Room');
46
}
47
48
protected function getObjectName() {
49
return pht('Room');
50
}
51
52
protected function getObjectCreateCancelURI($object) {
53
return $this->getApplication()->getApplicationURI('/');
54
}
55
56
protected function getEditorURI() {
57
return $this->getApplication()->getApplicationURI('edit/');
58
}
59
60
protected function getObjectViewURI($object) {
61
return $object->getURI();
62
}
63
64
public function isEngineConfigurable() {
65
return false;
66
}
67
68
protected function buildCustomEditFields($object) {
69
$viewer = $this->getViewer();
70
71
if ($this->getIsCreate()) {
72
$participant_phids = array($viewer->getPHID());
73
$initial_phids = array();
74
} else {
75
$participant_phids = $object->getParticipantPHIDs();
76
$initial_phids = $participant_phids;
77
}
78
79
// Only show participants on create or conduit, not edit.
80
$show_participants = (bool)$this->getIsCreate();
81
82
return array(
83
id(new PhabricatorTextEditField())
84
->setKey('name')
85
->setLabel(pht('Name'))
86
->setDescription(pht('Room name.'))
87
->setConduitTypeDescription(pht('New Room name.'))
88
->setIsRequired(true)
89
->setTransactionType(
90
ConpherenceThreadTitleTransaction::TRANSACTIONTYPE)
91
->setValue($object->getTitle()),
92
93
id(new PhabricatorTextEditField())
94
->setKey('topic')
95
->setLabel(pht('Topic'))
96
->setDescription(pht('Room topic.'))
97
->setConduitTypeDescription(pht('New Room topic.'))
98
->setTransactionType(
99
ConpherenceThreadTopicTransaction::TRANSACTIONTYPE)
100
->setValue($object->getTopic()),
101
102
id(new PhabricatorUsersEditField())
103
->setKey('participants')
104
->setValue($participant_phids)
105
->setInitialValue($initial_phids)
106
->setIsFormField($show_participants)
107
->setAliases(array('users', 'members', 'participants', 'userPHID'))
108
->setDescription(pht('Room participants.'))
109
->setUseEdgeTransactions(true)
110
->setConduitTypeDescription(pht('New Room participants.'))
111
->setTransactionType(
112
ConpherenceThreadParticipantsTransaction::TRANSACTIONTYPE)
113
->setLabel(pht('Initial Participants')),
114
115
);
116
}
117
118
}
119
120