コード例 #1
0
 private function renderItemCommonProperties(PhabricatorUser $viewer, NuanceItem $item, PHUIPropertyListView $view)
 {
     $complaint = $item->getNuanceProperty('complaint');
     $complaint = new PHUIRemarkupView($viewer, $complaint);
     $view->addSectionHeader(pht('Complaint'), 'fa-exclamation-circle');
     $view->addTextContent($complaint);
 }
コード例 #2
0
 private function renderItemCommonProperties(PhabricatorUser $viewer, NuanceItem $item, PHUIPropertyListView $view)
 {
     $complaint = $item->getNuanceProperty('complaint');
     $complaint = PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setContent($complaint), 'default', $viewer);
     $view->addSectionHeader(pht('Complaint'), 'fa-exclamation-circle');
     $view->addTextContent($complaint);
 }
コード例 #3
0
 protected function loadPage()
 {
     $table = new NuanceItem();
     $conn = $table->establishConnection('r');
     $data = queryfx_all($conn, '%Q FROM %T %Q %Q %Q', $this->buildSelectClause($conn), $table->getTableName(), $this->buildWhereClause($conn), $this->buildOrderClause($conn), $this->buildLimitClause($conn));
     return $table->loadAllFromArray($data);
 }
コード例 #4
0
 public function loadPage()
 {
     $table = new NuanceItem();
     $conn_r = $table->establishConnection('r');
     $data = queryfx_all($conn_r, 'SELECT FROM %T %Q %Q %Q', $table->getTableName(), $this->buildWhereClause($conn_r), $this->buildOrderClause($conn_r), $this->buildLimitClause($conn_r));
     return $table->loadAllFromArray($data);
 }
コード例 #5
0
 private function buildActionView(NuanceItem $item)
 {
     $viewer = $this->getViewer();
     $id = $item->getID();
     $actions = id(new PhabricatorActionListView())->setUser($viewer);
     $actions->addAction(id(new PhabricatorActionView())->setName(pht('View Item'))->setIcon('fa-eye')->setHref($this->getApplicationURI("item/view/{$id}/")));
     return $actions;
 }
コード例 #6
0
 private function buildCurtain(NuanceItem $item)
 {
     $viewer = $this->getViewer();
     $id = $item->getID();
     $curtain = $this->newCurtainView($item);
     $curtain->addAction(id(new PhabricatorActionView())->setName(pht('View Item'))->setIcon('fa-eye')->setHref($item->getURI()));
     return $curtain;
 }
コード例 #7
0
 private function buildActionView(NuanceItem $item)
 {
     $viewer = $this->getViewer();
     $id = $item->getID();
     $actions = id(new PhabricatorActionListView())->setUser($viewer);
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $item, PhabricatorPolicyCapability::CAN_EDIT);
     $actions->addAction(id(new PhabricatorActionView())->setName(pht('Edit Item'))->setIcon('fa-pencil')->setHref($this->getApplicationURI("item/edit/{$id}/"))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
     return $actions;
 }
コード例 #8
0
 private function applyCommands(NuanceItem $item)
 {
     $viewer = $this->getViewer();
     $impl = $item->getImplementation();
     $impl->setViewer($viewer);
     $commands = id(new NuanceItemCommandQuery())->setViewer($viewer)->withItemPHIDs(array($item->getPHID()))->execute();
     $commands = msort($commands, 'getID');
     foreach ($commands as $command) {
         $impl->applyCommand($item, $command);
         $command->delete();
     }
 }
コード例 #9
0
 private function buildCommands(NuanceItem $item)
 {
     $viewer = $this->getViewer();
     $commands = id(new NuanceItemCommandQuery())->setViewer($viewer)->withItemPHIDs(array($item->getPHID()))->execute();
     $commands = msort($commands, 'getID');
     if (!$commands) {
         return null;
     }
     $rows = array();
     foreach ($commands as $command) {
         $rows[] = array($command->getCommand());
     }
     $table = id(new AphrontTableView($rows))->setHeaders(array(pht('Command')));
     return id(new PHUIObjectBoxView())->setHeaderText(pht('Pending Commands'))->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->setTable($table);
 }
コード例 #10
0
 protected function execute(ConduitAPIRequest $request)
 {
     $source_phid = $request->getValue('sourcePHID');
     $owner_phid = $request->getValue('ownerPHID');
     $requestor_phid = $request->getValue('requestorPHID');
     $user = $request->getUser();
     $item = NuanceItem::initializeNewItem();
     $xactions = array();
     if ($source_phid) {
         $xactions[] = id(new NuanceItemTransaction())->setTransactionType(NuanceItemTransaction::TYPE_SOURCE)->setNewValue($source_phid);
     } else {
         throw new ConduitException('ERR-NO-SOURCE-PHID');
     }
     if ($owner_phid) {
         $xactions[] = id(new NuanceItemTransaction())->setTransactionType(NuanceItemTransaction::TYPE_OWNER)->setNewValue($owner_phid);
     }
     if ($requestor_phid) {
         $xactions[] = id(new NuanceItemTransaction())->setTransactionType(NuanceItemTransaction::TYPE_REQUESTOR)->setNewValue($requestor_phid);
     } else {
         throw new ConduitException('ERR-NO-REQUESTOR-PHID');
     }
     $source = PhabricatorContentSource::newFromConduitRequest($request);
     $editor = id(new NuanceItemEditor())->setActor($user)->setContentSource($source)->applyTransactions($item, $xactions);
     return $item->toDictionary();
 }
コード例 #11
0
 protected function newNuanceItemFromGitHubRecord(array $record)
 {
     $source = $this->getSource();
     $id = $record['id'];
     $item_key = "github.issueevent.{$id}";
     $container_key = null;
     return NuanceItem::initializeNewItem()->setStatus(NuanceItem::STATUS_IMPORTING)->setSourcePHID($source->getPHID())->setItemType(NuanceGitHubEventItemType::ITEMTYPE)->setItemKey($item_key)->setItemContainerKey($container_key)->setItemProperty('api.type', 'issue')->setItemProperty('api.raw', $record);
 }
コード例 #12
0
 protected function newItemFromProperties(NuanceRequestor $requestor, array $properties, PhabricatorContentSource $content_source)
 {
     // TODO: Should we have a tighter actor/viewer model? Requestors will
     // often have no real user associated with them...
     $actor = PhabricatorUser::getOmnipotentUser();
     $source = $this->requireSourceObject();
     $item = NuanceItem::initializeNewItem();
     $xactions = array();
     $xactions[] = id(new NuanceItemTransaction())->setTransactionType(NuanceItemTransaction::TYPE_SOURCE)->setNewValue($source->getPHID());
     $xactions[] = id(new NuanceItemTransaction())->setTransactionType(NuanceItemTransaction::TYPE_REQUESTOR)->setNewValue($requestor->getPHID());
     foreach ($properties as $key => $property) {
         $xactions[] = id(new NuanceItemTransaction())->setTransactionType(NuanceItemTransaction::TYPE_PROPERTY)->setMetadataValue(NuanceItemTransaction::PROPERTY_KEY, $key)->setNewValue($property);
     }
     $editor = id(new NuanceItemEditor())->setActor($actor)->setActingAsPHID($requestor->getActingAsPHID())->setContentSource($content_source);
     $editor->applyTransactions($item, $xactions);
     return $item;
 }
コード例 #13
0
 protected function getActingAsPHID(NuanceItem $item)
 {
     $actor_phid = $item->getRequestorPHID();
     if ($actor_phid) {
         return $actor_phid;
     }
     return parent::getActingAsPHID($item);
 }
コード例 #14
0
 protected final function newContentSource(NuanceItem $item, $agent_phid)
 {
     return PhabricatorContentSource::newForSource(NuanceContentSource::SOURCECONST, array('itemPHID' => $item->getPHID(), 'agentPHID' => $agent_phid));
 }
コード例 #15
0
 protected function newItemFromProperties(array $properties, PhabricatorContentSource $content_source)
 {
     // TODO: Should we have a tighter actor/viewer model? Requestors will
     // often have no real user associated with them...
     $actor = PhabricatorUser::getOmnipotentUser();
     $source = $this->getSource();
     $item = NuanceItem::initializeNewItem();
     $xactions = array();
     $xactions[] = id(new NuanceItemTransaction())->setTransactionType(NuanceItemTransaction::TYPE_SOURCE)->setNewValue($source->getPHID());
     // TODO: Eventually, apply real routing rules. For now, just put everything
     // in the default queue for the source.
     $xactions[] = id(new NuanceItemTransaction())->setTransactionType(NuanceItemTransaction::TYPE_QUEUE)->setNewValue($source->getDefaultQueuePHID());
     foreach ($properties as $key => $property) {
         $xactions[] = id(new NuanceItemTransaction())->setTransactionType(NuanceItemTransaction::TYPE_PROPERTY)->setMetadataValue(NuanceItemTransaction::PROPERTY_KEY, $key)->setNewValue($property);
     }
     $editor = id(new NuanceItemEditor())->setActor($actor)->setContentSource($content_source);
     $editor->applyTransactions($item, $xactions);
     return $item;
 }