当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorOwnersPackage::getAuditingEnabled方法代码示例

本文整理汇总了PHP中PhabricatorOwnersPackage::getAuditingEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorOwnersPackage::getAuditingEnabled方法的具体用法?PHP PhabricatorOwnersPackage::getAuditingEnabled怎么用?PHP PhabricatorOwnersPackage::getAuditingEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhabricatorOwnersPackage的用法示例。


在下文中一共展示了PhabricatorOwnersPackage::getAuditingEnabled方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildPackagePropertyView

 private function buildPackagePropertyView(PhabricatorOwnersPackage $package)
 {
     $viewer = $this->getViewer();
     $view = id(new PHUIPropertyListView())->setUser($viewer);
     $primary_phid = $package->getPrimaryOwnerPHID();
     if ($primary_phid) {
         $primary_owner = $viewer->renderHandle($primary_phid);
     } else {
         $primary_owner = phutil_tag('em', array(), pht('None'));
     }
     $view->addProperty(pht('Primary Owner'), $primary_owner);
     // TODO: needOwners() this on the Query.
     $owners = $package->loadOwners();
     if ($owners) {
         $owner_list = $viewer->renderHandleList(mpull($owners, 'getUserPHID'));
     } else {
         $owner_list = phutil_tag('em', array(), pht('None'));
     }
     $view->addProperty(pht('Owners'), $owner_list);
     if ($package->getAuditingEnabled()) {
         $auditing = pht('Enabled');
     } else {
         $auditing = pht('Disabled');
     }
     $view->addProperty(pht('Auditing'), $auditing);
     $description = $package->getDescription();
     if (strlen($description)) {
         $view->addSectionHeader(pht('Description'));
         $view->addTextContent($output = PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setContent($description), 'default', $viewer));
     }
     return $view;
 }
开发者ID:bohanlin,项目名称:phabricator,代码行数:32,代码来源:PhabricatorOwnersDetailController.php

示例2: buildPackagePropertyView

 private function buildPackagePropertyView(PhabricatorOwnersPackage $package, PhabricatorCustomFieldList $field_list)
 {
     $viewer = $this->getViewer();
     $view = id(new PHUIPropertyListView())->setUser($viewer);
     $owners = $package->getOwners();
     if ($owners) {
         $owner_list = $viewer->renderHandleList(mpull($owners, 'getUserPHID'));
     } else {
         $owner_list = phutil_tag('em', array(), pht('None'));
     }
     $view->addProperty(pht('Owners'), $owner_list);
     if ($package->getAuditingEnabled()) {
         $auditing = pht('Enabled');
     } else {
         $auditing = pht('Disabled');
     }
     $view->addProperty(pht('Auditing'), $auditing);
     $description = $package->getDescription();
     if (strlen($description)) {
         $view->addSectionHeader(pht('Description'));
         $view->addTextContent($output = PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setContent($description), 'default', $viewer));
     }
     $view->invokeWillRenderEvent();
     $field_list->appendFieldsToPropertyList($package, $viewer, $view);
     return $view;
 }
开发者ID:phpsong,项目名称:phabricator,代码行数:26,代码来源:PhabricatorOwnersDetailController.php

示例3: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     if ($this->id) {
         $package = id(new PhabricatorOwnersPackage())->load($this->id);
         if (!$package) {
             return new Aphront404Response();
         }
     } else {
         $package = new PhabricatorOwnersPackage();
         $package->setPrimaryOwnerPHID($user->getPHID());
     }
     $e_name = true;
     $e_primary = true;
     $errors = array();
     if ($request->isFormPost()) {
         $package->setName($request->getStr('name'));
         $package->setDescription($request->getStr('description'));
         $old_auditing_enabled = $package->getAuditingEnabled();
         $package->setAuditingEnabled($request->getStr('auditing') === 'enabled' ? 1 : 0);
         $primary = $request->getArr('primary');
         $primary = reset($primary);
         $old_primary = $package->getPrimaryOwnerPHID();
         $package->setPrimaryOwnerPHID($primary);
         $owners = $request->getArr('owners');
         if ($primary) {
             array_unshift($owners, $primary);
         }
         $owners = array_unique($owners);
         $paths = $request->getArr('path');
         $repos = $request->getArr('repo');
         $excludes = $request->getArr('exclude');
         $path_refs = array();
         for ($ii = 0; $ii < count($paths); $ii++) {
             if (empty($paths[$ii]) || empty($repos[$ii])) {
                 continue;
             }
             $path_refs[] = array('repositoryPHID' => $repos[$ii], 'path' => $paths[$ii], 'excluded' => $excludes[$ii]);
         }
         if (!strlen($package->getName())) {
             $e_name = pht('Required');
             $errors[] = pht('Package name is required.');
         } else {
             $e_name = null;
         }
         if (!$package->getPrimaryOwnerPHID()) {
             $e_primary = pht('Required');
             $errors[] = pht('Package must have a primary owner.');
         } else {
             $e_primary = null;
         }
         if (!$path_refs) {
             $errors[] = pht('Package must include at least one path.');
         }
         if (!$errors) {
             $package->attachUnsavedOwners($owners);
             $package->attachUnsavedPaths($path_refs);
             $package->attachOldAuditingEnabled($old_auditing_enabled);
             $package->attachOldPrimaryOwnerPHID($old_primary);
             $package->attachActorPHID($user->getPHID());
             try {
                 $package->save();
                 return id(new AphrontRedirectResponse())->setURI('/owners/package/' . $package->getID() . '/');
             } catch (AphrontDuplicateKeyQueryException $ex) {
                 $e_name = pht('Duplicate');
                 $errors[] = pht('Package name must be unique.');
             }
         }
     } else {
         $owners = $package->loadOwners();
         $owners = mpull($owners, 'getUserPHID');
         $paths = $package->loadPaths();
         $path_refs = array();
         foreach ($paths as $path) {
             $path_refs[] = array('repositoryPHID' => $path->getRepositoryPHID(), 'path' => $path->getPath(), 'excluded' => $path->getExcluded());
         }
     }
     $handles = $this->loadViewerHandles($owners);
     $primary = $package->getPrimaryOwnerPHID();
     if ($primary && isset($handles[$primary])) {
         $handle_primary_owner = array($handles[$primary]);
     } else {
         $handle_primary_owner = array();
     }
     $handles_all_owners = array_select_keys($handles, $owners);
     if ($package->getID()) {
         $title = pht('Edit Package');
         $side_nav_filter = 'edit/' . $this->id;
     } else {
         $title = pht('New Package');
         $side_nav_filter = 'new';
     }
     $this->setSideNavFilter($side_nav_filter);
     $repos = id(new PhabricatorRepositoryQuery())->setViewer($user)->execute();
     $default_paths = array();
     foreach ($repos as $repo) {
         $default_path = $repo->getDetail('default-owners-path');
         if ($default_path) {
             $default_paths[$repo->getPHID()] = $default_path;
//.........这里部分代码省略.........
开发者ID:denghp,项目名称:phabricator,代码行数:101,代码来源:PhabricatorOwnersEditController.php

示例4: buildPackageDetailView

 private function buildPackageDetailView(PhabricatorOwnersPackage $package, PhabricatorCustomFieldList $field_list)
 {
     $viewer = $this->getViewer();
     $view = id(new PHUIPropertyListView())->setUser($viewer);
     $owners = $package->getOwners();
     if ($owners) {
         $owner_list = $viewer->renderHandleList(mpull($owners, 'getUserPHID'));
     } else {
         $owner_list = phutil_tag('em', array(), pht('None'));
     }
     $view->addProperty(pht('Owners'), $owner_list);
     $dominion = $package->getDominion();
     $dominion_map = PhabricatorOwnersPackage::getDominionOptionsMap();
     $spec = idx($dominion_map, $dominion, array());
     $name = idx($spec, 'short', $dominion);
     $view->addProperty(pht('Dominion'), $name);
     $auto = $package->getAutoReview();
     $autoreview_map = PhabricatorOwnersPackage::getAutoreviewOptionsMap();
     $spec = idx($autoreview_map, $auto, array());
     $name = idx($spec, 'name', $auto);
     $view->addProperty(pht('Auto Review'), $name);
     if ($package->getAuditingEnabled()) {
         $auditing = pht('Enabled');
     } else {
         $auditing = pht('Disabled');
     }
     $view->addProperty(pht('Auditing'), $auditing);
     $description = $package->getDescription();
     if (strlen($description)) {
         $description = new PHUIRemarkupView($viewer, $description);
         $view->addSectionHeader(pht('Description'));
         $view->addTextContent($description);
     }
     $field_list->appendFieldsToPropertyList($package, $viewer, $view);
     return $view;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:36,代码来源:PhabricatorOwnersDetailController.php

示例5: processRequest


//.........这里部分代码省略.........
     if ($request->isFormPost()) {
         $package->setName($request->getStr('name'));
         $package->setDescription($request->getStr('description'));
         $package->setAuditingEnabled($request->getStr('auditing') === 'enabled');
         $primary = $request->getArr('primary');
         $primary = reset($primary);
         $package->setPrimaryOwnerPHID($primary);
         $owners = $request->getArr('owners');
         if ($primary) {
             array_unshift($owners, $primary);
         }
         $owners = array_unique($owners);
         $paths = $request->getArr('path');
         $repos = $request->getArr('repo');
         $path_refs = array();
         for ($ii = 0; $ii < count($paths); $ii++) {
             if (empty($paths[$ii]) || empty($repos[$ii])) {
                 continue;
             }
             $path_refs[] = array('repositoryPHID' => $repos[$ii], 'path' => $paths[$ii]);
         }
         if (!strlen($package->getName())) {
             $e_name = 'Required';
             $errors[] = 'Package name is required.';
         } else {
             $e_name = null;
         }
         if (!$package->getPrimaryOwnerPHID()) {
             $e_primary = 'Required';
             $errors[] = 'Package must have a primary owner.';
         } else {
             $e_primary = null;
         }
         if (!$owners) {
             $e_owners = 'Required';
             $errors[] = 'Package must have at least one owner.';
         } else {
             $e_owners = null;
         }
         if (!$path_refs) {
             $errors[] = 'Package must include at least one path.';
         }
         if (!$errors) {
             $package->attachUnsavedOwners($owners);
             $package->attachUnsavedPaths($path_refs);
             try {
                 $package->save();
                 return id(new AphrontRedirectResponse())->setURI('/owners/package/' . $package->getID() . '/');
             } catch (AphrontQueryDuplicateKeyException $ex) {
                 $e_name = 'Duplicate';
                 $errors[] = 'Package name must be unique.';
             }
         }
     } else {
         $owners = $package->loadOwners();
         $owners = mpull($owners, 'getUserPHID');
         $paths = $package->loadPaths();
         $path_refs = array();
         foreach ($paths as $path) {
             $path_refs[] = array('repositoryPHID' => $path->getRepositoryPHID(), 'path' => $path->getPath());
         }
     }
     $error_view = null;
     if ($errors) {
         $error_view = new AphrontErrorView();
         $error_view->setTitle('Package Errors');
         $error_view->setErrors($errors);
     }
     $handles = id(new PhabricatorObjectHandleData($owners))->loadHandles();
     $primary = $package->getPrimaryOwnerPHID();
     if ($primary && isset($handles[$primary])) {
         $token_primary_owner = array($primary => $handles[$primary]->getFullName());
     } else {
         $token_primary_owner = array();
     }
     $token_all_owners = array_select_keys($handles, $owners);
     $token_all_owners = mpull($token_all_owners, 'getFullName');
     $title = $package->getID() ? 'Edit Package' : 'New Package';
     $repos = id(new PhabricatorRepository())->loadAll();
     $default_paths = array();
     foreach ($repos as $repo) {
         $default_path = $repo->getDetail('default-owners-path');
         if ($default_path) {
             $default_paths[$repo->getPHID()] = $default_path;
         }
     }
     $repos = mpull($repos, 'getCallsign', 'getPHID');
     $template = new AphrontTypeaheadTemplateView();
     $template = $template->render();
     Javelin::initBehavior('owners-path-editor', array('root' => 'path-editor', 'table' => 'paths', 'add_button' => 'addpath', 'repositories' => $repos, 'input_template' => $template, 'pathRefs' => $path_refs, 'completeURI' => '/diffusion/services/path/complete/', 'validateURI' => '/diffusion/services/path/validate/', 'repositoryDefaultPaths' => $default_paths));
     require_celerity_resource('owners-path-editor-css');
     $cancel_uri = $package->getID() ? '/owners/package/' . $package->getID() . '/' : '/owners/';
     $form = id(new AphrontFormView())->setUser($user)->appendChild(id(new AphrontFormTextControl())->setLabel('Name')->setName('name')->setValue($package->getName())->setError($e_name))->appendChild(id(new AphrontFormTokenizerControl())->setDatasource('/typeahead/common/users/')->setLabel('Primary Owner')->setName('primary')->setLimit(1)->setValue($token_primary_owner)->setError($e_primary))->appendChild(id(new AphrontFormTokenizerControl())->setDatasource('/typeahead/common/users/')->setLabel('Owners')->setName('owners')->setValue($token_all_owners)->setError($e_owners))->appendChild(id(new AphrontFormSelectControl())->setName('auditing')->setLabel('Auditing')->setOptions(array('disabled' => 'Disabled', 'enabled' => 'Enabled'))->setValue($package->getAuditingEnabled() ? 'enabled' : 'disabled'))->appendChild('<h1>Paths</h1>' . '<div class="aphront-form-inset" id="path-editor">' . '<div style="float: right;">' . javelin_render_tag('a', array('href' => '#', 'class' => 'button green', 'sigil' => 'addpath', 'mustcapture' => true), 'Add New Path') . '</div>' . '<p>Specify the files and directories which comprise this ' . 'package.</p>' . '<div style="clear: both;"></div>' . javelin_render_tag('table', array('class' => 'owners-path-editor-table', 'sigil' => 'paths'), '') . '</div>')->appendChild(id(new AphrontFormTextAreaControl())->setLabel('Description')->setName('description')->setValue($package->getDescription()))->appendChild(id(new AphrontFormSubmitControl())->addCancelButton($cancel_uri)->setValue('Save Package'));
     $panel = new AphrontPanelView();
     $panel->setHeader($title);
     $panel->setWidth(AphrontPanelView::WIDTH_WIDE);
     $panel->appendChild($error_view);
     $panel->appendChild($form);
     return $this->buildStandardPageResponse($panel, array('title' => $title));
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:101,代码来源:PhabricatorOwnersEditController.php


注:本文中的PhabricatorOwnersPackage::getAuditingEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。