[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorAuthProviderConfigTransaction 4 extends PhabricatorApplicationTransaction { 5 6 const TYPE_ENABLE = 'config:enable'; 7 const TYPE_REGISTRATION = 'config:registration'; 8 const TYPE_LINK = 'config:link'; 9 const TYPE_UNLINK = 'config:unlink'; 10 const TYPE_TRUST_EMAILS = 'config:trustEmails'; 11 const TYPE_PROPERTY = 'config:property'; 12 13 const PROPERTY_KEY = 'auth:property'; 14 15 private $provider; 16 17 public function setProvider(PhabricatorAuthProvider $provider) { 18 $this->provider = $provider; 19 return $this; 20 } 21 22 public function getProvider() { 23 return $this->provider; 24 } 25 26 public function getApplicationName() { 27 return 'auth'; 28 } 29 30 public function getApplicationTransactionType() { 31 return PhabricatorPHIDConstants::PHID_TYPE_AUTH; 32 } 33 34 public function getApplicationTransactionCommentObject() { 35 return null; 36 } 37 38 public function getIcon() { 39 $old = $this->getOldValue(); 40 $new = $this->getNewValue(); 41 42 switch ($this->getTransactionType()) { 43 case self::TYPE_ENABLE: 44 if ($new) { 45 return 'fa-play'; 46 } else { 47 return 'fa-pause'; 48 } 49 } 50 51 return parent::getIcon(); 52 } 53 54 public function getColor() { 55 $old = $this->getOldValue(); 56 $new = $this->getNewValue(); 57 58 switch ($this->getTransactionType()) { 59 case self::TYPE_ENABLE: 60 if ($new) { 61 return 'green'; 62 } else { 63 return 'red'; 64 } 65 } 66 67 return parent::getColor(); 68 } 69 70 public function getTitle() { 71 $author_phid = $this->getAuthorPHID(); 72 73 $old = $this->getOldValue(); 74 $new = $this->getNewValue(); 75 76 switch ($this->getTransactionType()) { 77 case self::TYPE_ENABLE: 78 if ($old === null) { 79 return pht( 80 '%s created this provider.', 81 $this->renderHandleLink($author_phid)); 82 } else if ($new) { 83 return pht( 84 '%s enabled this provider.', 85 $this->renderHandleLink($author_phid)); 86 } else { 87 return pht( 88 '%s disabled this provider.', 89 $this->renderHandleLink($author_phid)); 90 } 91 break; 92 case self::TYPE_REGISTRATION: 93 if ($new) { 94 return pht( 95 '%s enabled registration.', 96 $this->renderHandleLink($author_phid)); 97 } else { 98 return pht( 99 '%s disabled registration.', 100 $this->renderHandleLink($author_phid)); 101 } 102 break; 103 case self::TYPE_LINK: 104 if ($new) { 105 return pht( 106 '%s enabled accont linking.', 107 $this->renderHandleLink($author_phid)); 108 } else { 109 return pht( 110 '%s disabled account linking.', 111 $this->renderHandleLink($author_phid)); 112 } 113 break; 114 case self::TYPE_UNLINK: 115 if ($new) { 116 return pht( 117 '%s enabled account unlinking.', 118 $this->renderHandleLink($author_phid)); 119 } else { 120 return pht( 121 '%s disabled account unlinking.', 122 $this->renderHandleLink($author_phid)); 123 } 124 break; 125 case self::TYPE_TRUST_EMAILS: 126 if ($new) { 127 return pht( 128 '%s enabled email trust.', 129 $this->renderHandleLink($author_phid)); 130 } else { 131 return pht( 132 '%s disabled email trust.', 133 $this->renderHandleLink($author_phid)); 134 } 135 break; 136 case self::TYPE_PROPERTY: 137 $provider = $this->getProvider(); 138 if ($provider) { 139 $title = $provider->renderConfigPropertyTransactionTitle($this); 140 if (strlen($title)) { 141 return $title; 142 } 143 } 144 145 return pht( 146 '%s edited a property of this provider.', 147 $this->renderHandleLink($author_phid)); 148 break; 149 } 150 151 return parent::getTitle(); 152 } 153 154 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |