diff --git a/src/applications/almanac/application/PhabricatorAlmanacApplication.php b/src/applications/almanac/application/PhabricatorAlmanacApplication.php index b399bba53e..4ef75aca08 100644 --- a/src/applications/almanac/application/PhabricatorAlmanacApplication.php +++ b/src/applications/almanac/application/PhabricatorAlmanacApplication.php @@ -1,92 +1,88 @@ array( '' => 'AlmanacConsoleController', 'service/' => array( '(?:query/(?P[^/]+)/)?' => 'AlmanacServiceListController', 'edit/(?:(?P\d+)/)?' => 'AlmanacServiceEditController', 'view/(?P[^/]+)/' => 'AlmanacServiceViewController', ), 'device/' => array( '(?:query/(?P[^/]+)/)?' => 'AlmanacDeviceListController', 'edit/(?:(?P\d+)/)?' => 'AlmanacDeviceEditController', 'view/(?P[^/]+)/' => 'AlmanacDeviceViewController', ), 'interface/' => array( 'edit/(?:(?P\d+)/)?' => 'AlmanacInterfaceEditController', ), 'binding/' => array( 'edit/(?:(?P\d+)/)?' => 'AlmanacBindingEditController', '(?P\d+)/' => 'AlmanacBindingViewController', ), 'network/' => array( '(?:query/(?P[^/]+)/)?' => 'AlmanacNetworkListController', 'edit/(?:(?P\d+)/)?' => 'AlmanacNetworkEditController', '(?P\d+)/' => 'AlmanacNetworkViewController', ), 'property/' => array( 'edit/' => 'AlmanacPropertyEditController', 'delete/' => 'AlmanacPropertyDeleteController', ), ), ); } protected function getCustomCapabilities() { return array( AlmanacCreateServicesCapability::CAPABILITY => array( 'default' => PhabricatorPolicies::POLICY_ADMIN, ), AlmanacCreateDevicesCapability::CAPABILITY => array( 'default' => PhabricatorPolicies::POLICY_ADMIN, ), AlmanacCreateNetworksCapability::CAPABILITY => array( 'default' => PhabricatorPolicies::POLICY_ADMIN, ), AlmanacCreateClusterServicesCapability::CAPABILITY => array( 'default' => PhabricatorPolicies::POLICY_ADMIN, ), ); } } diff --git a/src/applications/audit/application/PhabricatorAuditApplication.php b/src/applications/audit/application/PhabricatorAuditApplication.php index 6cb960f24d..7b611d0969 100644 --- a/src/applications/audit/application/PhabricatorAuditApplication.php +++ b/src/applications/audit/application/PhabricatorAuditApplication.php @@ -1,98 +1,94 @@ array( '(?:query/(?P[^/]+)/)?' => 'PhabricatorAuditListController', 'addcomment/' => 'PhabricatorAuditAddCommentController', 'preview/(?P[1-9]\d*)/' => 'PhabricatorAuditPreviewController', ), ); } public function getApplicationOrder() { return 0.130; } public function loadStatus(PhabricatorUser $user) { $status = array(); $phids = PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($user); $query = id(new DiffusionCommitQuery()) ->setViewer($user) ->withAuthorPHIDs(array($user->getPHID())) ->withAuditStatus(DiffusionCommitQuery::AUDIT_STATUS_CONCERN) ->setLimit(self::MAX_STATUS_ITEMS); $commits = $query->execute(); $count = count($commits); $count_str = self::formatStatusCount( $count, '%s Problem Commits', '%d Problem Commit(s)'); $type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION; $status[] = id(new PhabricatorApplicationStatusView()) ->setType($type) ->setText($count_str) ->setCount($count); $query = id(new DiffusionCommitQuery()) ->setViewer($user) ->withAuditorPHIDs($phids) ->withAuditStatus(DiffusionCommitQuery::AUDIT_STATUS_OPEN) ->withAuditAwaitingUser($user) ->setLimit(self::MAX_STATUS_ITEMS); $commits = $query->execute(); $count = count($commits); $count_str = self::formatStatusCount( $count, '%s Commits Awaiting Audit', '%d Commit(s) Awaiting Audit'); $type = PhabricatorApplicationStatusView::TYPE_WARNING; $status[] = id(new PhabricatorApplicationStatusView()) ->setType($type) ->setText($count_str) ->setCount($count); return $status; } } diff --git a/src/applications/auth/application/PhabricatorAuthApplication.php b/src/applications/auth/application/PhabricatorAuthApplication.php index 5c6e7a5d4d..70d1966fc2 100644 --- a/src/applications/auth/application/PhabricatorAuthApplication.php +++ b/src/applications/auth/application/PhabricatorAuthApplication.php @@ -1,158 +1,154 @@ getIsAdmin(); } public function getName() { return pht('Auth'); } public function getShortDescription() { return pht('Login/Registration'); } public function getHelpURI() { // NOTE: Although reasonable help exists for this in "Configuring Accounts // and Registration", specifying a help URI here means we get the menu // item in all the login/link interfaces, which is confusing and not // helpful. // TODO: Special case this, or split the auth and auth administration // applications? return null; } public function buildMainMenuItems( PhabricatorUser $user, PhabricatorController $controller = null) { $items = array(); if ($user->isLoggedIn()) { $item = id(new PHUIListItemView()) ->addClass('core-menu-item') ->setName(pht('Log Out')) ->setIcon('fa-sign-out') ->setWorkflow(true) ->setHref('/logout/') ->setSelected(($controller instanceof PhabricatorLogoutController)) ->setAural(pht('Log Out')) ->setOrder(900); $items[] = $item; } else { if ($controller instanceof PhabricatorAuthController) { // Don't show the "Login" item on auth controllers, since they're // generally all related to logging in anyway. } else { $uri = new PhutilURI('/auth/start/'); if ($controller) { $path = $controller->getRequest()->getPath(); $uri->setQueryParam('next', $path); } $item = id(new PHUIListItemView()) ->addClass('core-menu-item') ->setName(pht('Log In')) // TODO: Login icon? ->setIcon('fa-sign-in') ->setHref($uri) ->setAural(pht('Log In')) ->setOrder(900); $items[] = $item; } } return $items; } public function getApplicationGroup() { return self::GROUP_ADMIN; } public function getRoutes() { return array( '/auth/' => array( '' => 'PhabricatorAuthListController', 'config/' => array( 'new/' => 'PhabricatorAuthNewController', 'new/(?P[^/]+)/' => 'PhabricatorAuthEditController', 'edit/(?P\d+)/' => 'PhabricatorAuthEditController', '(?Penable|disable)/(?P\d+)/' => 'PhabricatorAuthDisableController', ), 'login/(?P[^/]+)/(?:(?P[^/]+)/)?' => 'PhabricatorAuthLoginController', 'register/(?:(?P[^/]+)/)?' => 'PhabricatorAuthRegisterController', 'start/' => 'PhabricatorAuthStartController', 'validate/' => 'PhabricatorAuthValidateController', 'finish/' => 'PhabricatorAuthFinishController', 'unlink/(?P[^/]+)/' => 'PhabricatorAuthUnlinkController', '(?Plink|refresh)/(?P[^/]+)/' => 'PhabricatorAuthLinkController', 'confirmlink/(?P[^/]+)/' => 'PhabricatorAuthConfirmLinkController', 'session/terminate/(?P[^/]+)/' => 'PhabricatorAuthTerminateSessionController', 'token/revoke/(?P[^/]+)/' => 'PhabricatorAuthRevokeTokenController', 'session/downgrade/' => 'PhabricatorAuthDowngradeSessionController', 'multifactor/' => 'PhabricatorAuthNeedsMultiFactorController', 'sshkey/' => array( 'generate/' => 'PhabricatorAuthSSHKeyGenerateController', 'upload/' => 'PhabricatorAuthSSHKeyEditController', 'edit/(?P\d+)/' => 'PhabricatorAuthSSHKeyEditController', 'delete/(?P\d+)/' => 'PhabricatorAuthSSHKeyDeleteController', ), ), '/oauth/(?P\w+)/login/' => 'PhabricatorAuthOldOAuthRedirectController', '/login/' => array( '' => 'PhabricatorAuthStartController', 'email/' => 'PhabricatorEmailLoginController', 'once/'. '(?P[^/]+)/'. '(?P\d+)/'. '(?P[^/]+)/'. '(?:(?P\d+)/)?' => 'PhabricatorAuthOneTimeLoginController', 'refresh/' => 'PhabricatorRefreshCSRFController', 'mustverify/' => 'PhabricatorMustVerifyEmailController', ), '/emailverify/(?P[^/]+)/' => 'PhabricatorEmailVerificationController', '/logout/' => 'PhabricatorLogoutController', ); } protected function getCustomCapabilities() { return array( AuthManageProvidersCapability::CAPABILITY => array( 'default' => PhabricatorPolicies::POLICY_ADMIN, ), ); } } diff --git a/src/applications/base/PhabricatorApplication.php b/src/applications/base/PhabricatorApplication.php index 44598fb030..bcfcce952d 100644 --- a/src/applications/base/PhabricatorApplication.php +++ b/src/applications/base/PhabricatorApplication.php @@ -1,541 +1,537 @@ pht('Core Applications'), self::GROUP_UTILITIES => pht('Utilities'), self::GROUP_ADMIN => pht('Administration'), self::GROUP_DEVELOPER => pht('Developer Tools'), ); } /* -( Application Information )-------------------------------------------- */ public abstract function getName(); public function getShortDescription() { return $this->getName().' Application'; } public function isInstalled() { if (!$this->canUninstall()) { return true; } $prototypes = PhabricatorEnv::getEnvConfig('phabricator.show-prototypes'); if (!$prototypes && $this->isPrototype()) { return false; } $uninstalled = PhabricatorEnv::getEnvConfig( 'phabricator.uninstalled-applications'); return empty($uninstalled[get_class($this)]); } public function isPrototype() { return false; } /** * Return `true` if this application should never appear in application lists * in the UI. Primarily intended for unit test applications or other * pseudo-applications. * * Few applications should be unlisted. For most applications, use * @{method:isLaunchable} to hide them from main launch views instead. * * @return bool True to remove application from UI lists. */ public function isUnlisted() { return false; } /** * Return `true` if this application is a normal application with a base * URI and a web interface. * * Launchable applications can be pinned to the home page, and show up in the * "Launcher" view of the Applications application. Making an application * unlauncahble prevents pinning and hides it from this view. * * Usually, an application should be marked unlaunchable if: * * - it is available on every page anyway (like search); or * - it does not have a web interface (like subscriptions); or * - it is still pre-release and being intentionally buried. * * To hide applications more completely, use @{method:isUnlisted}. * * @return bool True if the application is launchable. */ public function isLaunchable() { return true; } /** * Return `true` if this application should be pinned by default. * * Users who have not yet set preferences see a default list of applications. * * @param PhabricatorUser User viewing the pinned application list. * @return bool True if this application should be pinned by default. */ public function isPinnedByDefault(PhabricatorUser $viewer) { return false; } /** * Returns true if an application is first-party (developed by Phacility) * and false otherwise. * * @return bool True if this application is developed by Phacility. */ final public function isFirstParty() { $where = id(new ReflectionClass($this))->getFileName(); $root = phutil_get_library_root('phabricator'); if (!Filesystem::isDescendant($where, $root)) { return false; } if (Filesystem::isDescendant($where, $root.'/extensions')) { return false; } return true; } public function canUninstall() { return true; } public function getPHID() { return 'PHID-APPS-'.get_class($this); } public function getTypeaheadURI() { return $this->isLaunchable() ? $this->getBaseURI() : null; } public function getBaseURI() { return null; } public function getApplicationURI($path = '') { return $this->getBaseURI().ltrim($path, '/'); } public function getIconURI() { return null; } - public function getIconName() { - return 'application'; - } - public function getFontIcon() { return 'fa-puzzle-piece'; } public function getApplicationOrder() { return PHP_INT_MAX; } public function getApplicationGroup() { return self::GROUP_CORE; } public function getTitleGlyph() { return null; } public function getHelpURI() { return null; } public function getOverview() { return null; } public function getEventListeners() { return array(); } public function getRemarkupRules() { return array(); } /* -( URI Routing )-------------------------------------------------------- */ public function getRoutes() { return array(); } /* -( Email Integration )-------------------------------------------------- */ public function supportsEmailIntegration() { return false; } protected function getInboundEmailSupportLink() { return PhabricatorEnv::getDocLink('Configuring Inbound Email'); } public function getAppEmailBlurb() { throw new Exception('Not Implemented.'); } /* -( Fact Integration )--------------------------------------------------- */ public function getFactObjectsForAnalysis() { return array(); } /* -( UI Integration )----------------------------------------------------- */ /** * Render status elements (like "3 Waiting Reviews") for application list * views. These provide a way to alert users to new or pending action items * in applications. * * @param PhabricatorUser Viewing user. * @return list Application status elements. * @task ui */ public function loadStatus(PhabricatorUser $user) { return array(); } /** * @return string * @task ui */ public static function formatStatusCount( $count, $limit_string = '%s', $base_string = '%d') { if ($count == self::MAX_STATUS_ITEMS) { $count_str = pht($limit_string, ($count - 1).'+'); } else { $count_str = pht($base_string, $count); } return $count_str; } /** * You can provide an optional piece of flavor text for the application. This * is currently rendered in application launch views if the application has no * status elements. * * @return string|null Flavor text. * @task ui */ public function getFlavorText() { return null; } /** * Build items for the main menu. * * @param PhabricatorUser The viewing user. * @param AphrontController The current controller. May be null for special * pages like 404, exception handlers, etc. * @return list List of menu items. * @task ui */ public function buildMainMenuItems( PhabricatorUser $user, PhabricatorController $controller = null) { return array(); } /** * Build extra items for the main menu. Generally, this is used to render * static dropdowns. * * @param PhabricatorUser The viewing user. * @param AphrontController The current controller. May be null for special * pages like 404, exception handlers, etc. * @return view List of menu items. * @task ui */ public function buildMainMenuExtraNodes( PhabricatorUser $viewer, PhabricatorController $controller = null) { return array(); } /** * Build items for the "quick create" menu. * * @param PhabricatorUser The viewing user. * @return list List of menu items. */ public function getQuickCreateItems(PhabricatorUser $viewer) { return array(); } /* -( Application Management )--------------------------------------------- */ public static function getByClass($class_name) { $selected = null; $applications = PhabricatorApplication::getAllApplications(); foreach ($applications as $application) { if (get_class($application) == $class_name) { $selected = $application; break; } } if (!$selected) { throw new Exception("No application '{$class_name}'!"); } return $selected; } public static function getAllApplications() { static $applications; if ($applications === null) { $apps = id(new PhutilSymbolLoader()) ->setAncestorClass(__CLASS__) ->loadObjects(); // Reorder the applications into "application order". Notably, this // ensures their event handlers register in application order. $apps = msort($apps, 'getApplicationOrder'); $apps = mgroup($apps, 'getApplicationGroup'); $group_order = array_keys(self::getApplicationGroups()); $apps = array_select_keys($apps, $group_order) + $apps; $apps = array_mergev($apps); $applications = $apps; } return $applications; } public static function getAllInstalledApplications() { $all_applications = self::getAllApplications(); $apps = array(); foreach ($all_applications as $app) { if (!$app->isInstalled()) { continue; } $apps[] = $app; } return $apps; } /** * Determine if an application is installed, by application class name. * * To check if an application is installed //and// available to a particular * viewer, user @{method:isClassInstalledForViewer}. * * @param string Application class name. * @return bool True if the class is installed. * @task meta */ public static function isClassInstalled($class) { return self::getByClass($class)->isInstalled(); } /** * Determine if an application is installed and available to a viewer, by * application class name. * * To check if an application is installed at all, use * @{method:isClassInstalled}. * * @param string Application class name. * @param PhabricatorUser Viewing user. * @return bool True if the class is installed for the viewer. * @task meta */ public static function isClassInstalledForViewer( $class, PhabricatorUser $viewer) { if (!self::isClassInstalled($class)) { return false; } return PhabricatorPolicyFilter::hasCapability( $viewer, self::getByClass($class), PhabricatorPolicyCapability::CAN_VIEW); } /* -( PhabricatorPolicyInterface )----------------------------------------- */ public function getCapabilities() { return array_merge( array( PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT, ), array_keys($this->getCustomCapabilities())); } public function getPolicy($capability) { $default = $this->getCustomPolicySetting($capability); if ($default) { return $default; } switch ($capability) { case PhabricatorPolicyCapability::CAN_VIEW: return PhabricatorPolicies::getMostOpenPolicy(); case PhabricatorPolicyCapability::CAN_EDIT: return PhabricatorPolicies::POLICY_ADMIN; default: $spec = $this->getCustomCapabilitySpecification($capability); return idx($spec, 'default', PhabricatorPolicies::POLICY_USER); } } public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { return false; } public function describeAutomaticCapability($capability) { return null; } /* -( Policies )----------------------------------------------------------- */ protected function getCustomCapabilities() { return array(); } private function getCustomPolicySetting($capability) { if (!$this->isCapabilityEditable($capability)) { return null; } $policy_locked = PhabricatorEnv::getEnvConfig('policy.locked'); if (isset($policy_locked[$capability])) { return $policy_locked[$capability]; } $config = PhabricatorEnv::getEnvConfig('phabricator.application-settings'); $app = idx($config, $this->getPHID()); if (!$app) { return null; } $policy = idx($app, 'policy'); if (!$policy) { return null; } return idx($policy, $capability); } private function getCustomCapabilitySpecification($capability) { $custom = $this->getCustomCapabilities(); if (!isset($custom[$capability])) { throw new Exception("Unknown capability '{$capability}'!"); } return $custom[$capability]; } public function getCapabilityLabel($capability) { switch ($capability) { case PhabricatorPolicyCapability::CAN_VIEW: return pht('Can Use Application'); case PhabricatorPolicyCapability::CAN_EDIT: return pht('Can Configure Application'); } $capobj = PhabricatorPolicyCapability::getCapabilityByKey($capability); if ($capobj) { return $capobj->getCapabilityName(); } return null; } public function isCapabilityEditable($capability) { switch ($capability) { case PhabricatorPolicyCapability::CAN_VIEW: return $this->canUninstall(); case PhabricatorPolicyCapability::CAN_EDIT: return false; default: $spec = $this->getCustomCapabilitySpecification($capability); return idx($spec, 'edit', true); } } public function getCapabilityCaption($capability) { switch ($capability) { case PhabricatorPolicyCapability::CAN_VIEW: if (!$this->canUninstall()) { return pht( 'This application is required for Phabricator to operate, so all '. 'users must have access to it.'); } else { return null; } case PhabricatorPolicyCapability::CAN_EDIT: return null; default: $spec = $this->getCustomCapabilitySpecification($capability); return idx($spec, 'caption'); } } } diff --git a/src/applications/calendar/application/PhabricatorCalendarApplication.php b/src/applications/calendar/application/PhabricatorCalendarApplication.php index bc92475fc8..098e58795e 100644 --- a/src/applications/calendar/application/PhabricatorCalendarApplication.php +++ b/src/applications/calendar/application/PhabricatorCalendarApplication.php @@ -1,72 +1,68 @@ array( '' => 'PhabricatorCalendarViewController', 'all/' => 'PhabricatorCalendarBrowseController', 'event/' => array( '(?:query/(?P[^/]+)/)?' => 'PhabricatorCalendarEventListController', 'create/' => 'PhabricatorCalendarEventEditController', 'edit/(?P[1-9]\d*)/' => 'PhabricatorCalendarEventEditController', 'delete/(?P[1-9]\d*)/' => 'PhabricatorCalendarEventDeleteController', 'view/(?P[1-9]\d*)/' => 'PhabricatorCalendarEventViewController', ), ), ); } public function getQuickCreateItems(PhabricatorUser $viewer) { $items = array(); $item = id(new PHUIListItemView()) ->setName(pht('Calendar Event')) ->setIcon('fa-calendar') ->setHref($this->getBaseURI().'event/create/'); $items[] = $item; return $items; } } diff --git a/src/applications/chatlog/application/PhabricatorChatLogApplication.php b/src/applications/chatlog/application/PhabricatorChatLogApplication.php index 14dd5fca4f..74d6d8b645 100644 --- a/src/applications/chatlog/application/PhabricatorChatLogApplication.php +++ b/src/applications/chatlog/application/PhabricatorChatLogApplication.php @@ -1,47 +1,43 @@ array( '' => 'PhabricatorChatLogChannelListController', 'channel/(?P[^/]+)/' => 'PhabricatorChatLogChannelLogController', ), ); } } diff --git a/src/applications/conduit/application/PhabricatorConduitApplication.php b/src/applications/conduit/application/PhabricatorConduitApplication.php index 9c1c1de70a..8b2048507b 100644 --- a/src/applications/conduit/application/PhabricatorConduitApplication.php +++ b/src/applications/conduit/application/PhabricatorConduitApplication.php @@ -1,63 +1,59 @@ array( '(?:query/(?P[^/]+)/)?' => 'PhabricatorConduitListController', 'method/(?P[^/]+)/' => 'PhabricatorConduitConsoleController', 'log/' => 'PhabricatorConduitLogController', 'log/view/(?P[^/]+)/' => 'PhabricatorConduitLogController', 'token/' => 'PhabricatorConduitTokenController', 'token/edit/(?:(?P\d+)/)?' => 'PhabricatorConduitTokenEditController', 'token/terminate/(?:(?P\d+)/)?' => 'PhabricatorConduitTokenTerminateController', 'login/' => 'PhabricatorConduitTokenHandshakeController', ), '/api/(?P[^/]+)' => 'PhabricatorConduitAPIController', ); } } diff --git a/src/applications/config/application/PhabricatorConfigApplication.php b/src/applications/config/application/PhabricatorConfigApplication.php index e79925ef7c..0b3b6d4626 100644 --- a/src/applications/config/application/PhabricatorConfigApplication.php +++ b/src/applications/config/application/PhabricatorConfigApplication.php @@ -1,66 +1,62 @@ getIsAdmin(); } public function getTitleGlyph() { return "\xE2\x98\xBA"; } public function getApplicationGroup() { return self::GROUP_ADMIN; } public function canUninstall() { return false; } public function getName() { return 'Config'; } public function getShortDescription() { return pht('Configure Phabricator'); } public function getRoutes() { return array( '/config/' => array( '' => 'PhabricatorConfigListController', 'all/' => 'PhabricatorConfigAllController', 'history/' => 'PhabricatorConfigHistoryController', 'edit/(?P[\w\.\-]+)/' => 'PhabricatorConfigEditController', 'group/(?P[^/]+)/' => 'PhabricatorConfigGroupController', 'welcome/' => 'PhabricatorConfigWelcomeController', 'database/'. '(?:(?P[^/]+)/'. '(?:(?P[^/]+)/'. '(?:(?:col/(?P[^/]+)|key/(?P[^/]+))/)?)?)?' => 'PhabricatorConfigDatabaseStatusController', 'dbissue/' => 'PhabricatorConfigDatabaseIssueController', '(?Pignore|unignore)/(?P[^/]+)/' => 'PhabricatorConfigIgnoreController', 'issue/' => array( '' => 'PhabricatorConfigIssueListController', '(?P[^/]+)/' => 'PhabricatorConfigIssueViewController', ), ), ); } } diff --git a/src/applications/conpherence/application/PhabricatorConpherenceApplication.php b/src/applications/conpherence/application/PhabricatorConpherenceApplication.php index 8d5c4c700e..6220d169dc 100644 --- a/src/applications/conpherence/application/PhabricatorConpherenceApplication.php +++ b/src/applications/conpherence/application/PhabricatorConpherenceApplication.php @@ -1,63 +1,59 @@ array( '' => 'ConpherenceListController', 'thread/(?P[1-9]\d*)/' => 'ConpherenceListController', '(?P[1-9]\d*)/' => 'ConpherenceViewController', 'new/' => 'ConpherenceNewController', 'panel/' => 'ConpherenceNotificationPanelController', 'widget/(?P[1-9]\d*)/' => 'ConpherenceWidgetController', 'update/(?P[1-9]\d*)/' => 'ConpherenceUpdateController', ), ); } public function getQuickCreateItems(PhabricatorUser $viewer) { $items = array(); $item = id(new PHUIListItemView()) ->setName(pht('Conpherence Thread')) ->setIcon('fa-comments') ->setWorkflow(true) ->setHref($this->getBaseURI().'new/'); $items[] = $item; return $items; } } diff --git a/src/applications/countdown/application/PhabricatorCountdownApplication.php b/src/applications/countdown/application/PhabricatorCountdownApplication.php index dec35a2254..5c00661bd0 100644 --- a/src/applications/countdown/application/PhabricatorCountdownApplication.php +++ b/src/applications/countdown/application/PhabricatorCountdownApplication.php @@ -1,63 +1,59 @@ array( '(?:query/(?P[^/]+)/)?' => 'PhabricatorCountdownListController', '(?P[1-9]\d*)/' => 'PhabricatorCountdownViewController', 'edit/(?:(?P[1-9]\d*)/)?' => 'PhabricatorCountdownEditController', 'delete/(?P[1-9]\d*)/' => 'PhabricatorCountdownDeleteController', ), ); } protected function getCustomCapabilities() { return array( PhabricatorCountdownDefaultViewCapability::CAPABILITY => array( 'caption' => pht('Default view policy for new countdowns.'), ), ); } } diff --git a/src/applications/daemon/application/PhabricatorDaemonsApplication.php b/src/applications/daemon/application/PhabricatorDaemonsApplication.php index 40bc42bd74..f7f3cb77ee 100644 --- a/src/applications/daemon/application/PhabricatorDaemonsApplication.php +++ b/src/applications/daemon/application/PhabricatorDaemonsApplication.php @@ -1,57 +1,53 @@ array( '' => 'PhabricatorDaemonConsoleController', 'task/(?P[1-9]\d*)/' => 'PhabricatorWorkerTaskDetailController', 'log/' => array( '' => 'PhabricatorDaemonLogListController', '(?P[1-9]\d*)/' => 'PhabricatorDaemonLogViewController', ), 'event/(?P[1-9]\d*)/' => 'PhabricatorDaemonLogEventViewController', ), ); } } diff --git a/src/applications/dashboard/application/PhabricatorDashboardApplication.php b/src/applications/dashboard/application/PhabricatorDashboardApplication.php index 8fe5319de7..1e76c1e57b 100644 --- a/src/applications/dashboard/application/PhabricatorDashboardApplication.php +++ b/src/applications/dashboard/application/PhabricatorDashboardApplication.php @@ -1,66 +1,62 @@ \d+)' => 'PhabricatorDashboardPanelViewController', '/dashboard/' => array( '(?:query/(?P[^/]+)/)?' => 'PhabricatorDashboardListController', 'view/(?P\d+)/' => 'PhabricatorDashboardViewController', 'manage/(?P\d+)/' => 'PhabricatorDashboardManageController', 'history/(?P\d+)/' => 'PhabricatorDashboardHistoryController', 'create/' => 'PhabricatorDashboardEditController', 'copy/(?:(?P\d+)/)?' => 'PhabricatorDashboardCopyController', 'edit/(?:(?P\d+)/)?' => 'PhabricatorDashboardEditController', 'install/(?P\d+)/' => 'PhabricatorDashboardInstallController', 'uninstall/(?P\d+)/' => 'PhabricatorDashboardUninstallController', 'addpanel/(?P\d+)/' => 'PhabricatorDashboardAddPanelController', 'movepanel/(?P\d+)/' => 'PhabricatorDashboardMovePanelController', 'removepanel/(?P\d+)/' => 'PhabricatorDashboardRemovePanelController', 'panel/' => array( '(?:query/(?P[^/]+)/)?' => 'PhabricatorDashboardPanelListController', 'create/' => 'PhabricatorDashboardPanelEditController', 'edit/(?:(?P\d+)/)?' => 'PhabricatorDashboardPanelEditController', 'render/(?P\d+)/' => 'PhabricatorDashboardPanelRenderController', 'archive/(?P\d+)/' => 'PhabricatorDashboardPanelArchiveController', ), ), ); } public function getRemarkupRules() { return array( new PhabricatorDashboardRemarkupRule(), ); } public function canUninstall() { return false; } } diff --git a/src/applications/differential/application/PhabricatorDifferentialApplication.php b/src/applications/differential/application/PhabricatorDifferentialApplication.php index af9cbd477c..a510bb8f26 100644 --- a/src/applications/differential/application/PhabricatorDifferentialApplication.php +++ b/src/applications/differential/application/PhabricatorDifferentialApplication.php @@ -1,189 +1,185 @@ [1-9]\d*)' => 'DifferentialRevisionViewController', '/differential/' => array( '(?:query/(?P[^/]+)/)?' => 'DifferentialRevisionListController', 'diff/' => array( '(?P[1-9]\d*)/' => 'DifferentialDiffViewController', 'create/' => 'DifferentialDiffCreateController', ), 'changeset/' => 'DifferentialChangesetViewController', 'revision/edit/(?:(?P[1-9]\d*)/)?' => 'DifferentialRevisionEditController', 'revision/land/(?:(?P[1-9]\d*))/(?P[^/]+)/' => 'DifferentialRevisionLandController', 'revision/closedetails/(?P[^/]+)/' => 'DifferentialRevisionCloseDetailsController', 'comment/' => array( 'preview/(?P[1-9]\d*)/' => 'DifferentialCommentPreviewController', 'save/(?P[1-9]\d*)/' => 'DifferentialCommentSaveController', 'inline/' => array( 'preview/(?P[1-9]\d*)/' => 'DifferentialInlineCommentPreviewController', 'edit/(?P[1-9]\d*)/' => 'DifferentialInlineCommentEditController', ), ), 'preview/' => 'PhabricatorMarkupPreviewController', ), ); } public function getApplicationOrder() { return 0.100; } public function getRemarkupRules() { return array( new DifferentialRemarkupRule(), ); } public function loadStatus(PhabricatorUser $user) { $revisions = id(new DifferentialRevisionQuery()) ->setViewer($user) ->withResponsibleUsers(array($user->getPHID())) ->withStatus(DifferentialRevisionQuery::STATUS_OPEN) ->needRelationships(true) ->setLimit(self::MAX_STATUS_ITEMS) ->execute(); $status = array(); if (count($revisions) == self::MAX_STATUS_ITEMS) { $all_count = count($revisions); $all_count_str = self::formatStatusCount( $all_count, '%s Active Reviews', '%d Active Review(s)'); $type = PhabricatorApplicationStatusView::TYPE_WARNING; $status[] = id(new PhabricatorApplicationStatusView()) ->setType($type) ->setText($all_count_str) ->setCount($all_count); } else { list($blocking, $active, $waiting) = DifferentialRevisionQuery::splitResponsible( $revisions, array($user->getPHID())); $blocking = count($blocking); $blocking_str = self::formatStatusCount( $blocking, '%s Reviews Blocking Others', '%d Review(s) Blocking Others'); $type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION; $status[] = id(new PhabricatorApplicationStatusView()) ->setType($type) ->setText($blocking_str) ->setCount($blocking); $active = count($active); $active_str = self::formatStatusCount( $active, '%s Reviews Need Attention', '%d Review(s) Need Attention'); $type = PhabricatorApplicationStatusView::TYPE_WARNING; $status[] = id(new PhabricatorApplicationStatusView()) ->setType($type) ->setText($active_str) ->setCount($active); $waiting = count($waiting); $waiting_str = self::formatStatusCount( $waiting, '%s Reviews Waiting on Others', '%d Review(s) Waiting on Others'); $type = PhabricatorApplicationStatusView::TYPE_INFO; $status[] = id(new PhabricatorApplicationStatusView()) ->setType($type) ->setText($waiting_str) ->setCount($waiting); } return $status; } public function supportsEmailIntegration() { return true; } public function getAppEmailBlurb() { return pht( 'Send email to these addresses to create revisions. The body of the '. 'message and / or one or more attachments should be the output of a '. '"diff" command. %s', phutil_tag( 'a', array( 'href' => $this->getInboundEmailSupportLink(),), pht('Learn More'))); } protected function getCustomCapabilities() { return array( DifferentialDefaultViewCapability::CAPABILITY => array( 'caption' => pht('Default view policy for newly created revisions.'), ), ); } } diff --git a/src/applications/diffusion/application/PhabricatorDiffusionApplication.php b/src/applications/diffusion/application/PhabricatorDiffusionApplication.php index e2be00715a..80c478f65f 100644 --- a/src/applications/diffusion/application/PhabricatorDiffusionApplication.php +++ b/src/applications/diffusion/application/PhabricatorDiffusionApplication.php @@ -1,150 +1,146 @@ [A-Z]+)(?P[a-z0-9]+)' => 'DiffusionCommitController', '/diffusion/' => array( '(?:query/(?P[^/]+)/)?' => 'DiffusionRepositoryListController', 'new/' => 'DiffusionRepositoryNewController', '(?Pcreate)/' => 'DiffusionRepositoryCreateController', '(?Pimport)/' => 'DiffusionRepositoryCreateController', 'pushlog/' => array( '(?:query/(?P[^/]+)/)?' => 'DiffusionPushLogListController', 'view/(?P\d+)/' => 'DiffusionPushEventViewController', ), '(?P[A-Z]+)/' => array( '' => 'DiffusionRepositoryController', 'repository/(?P.*)' => 'DiffusionRepositoryController', 'change/(?P.*)' => 'DiffusionChangeController', 'history/(?P.*)' => 'DiffusionHistoryController', 'browse/(?P.*)' => 'DiffusionBrowseMainController', 'lastmodified/(?P.*)' => 'DiffusionLastModifiedController', 'diff/' => 'DiffusionDiffController', 'tags/(?P.*)' => 'DiffusionTagListController', 'branches/(?P.*)' => 'DiffusionBranchTableController', 'lint/(?P.*)' => 'DiffusionLintController', 'commit/(?P[a-z0-9]+)/branches/' => 'DiffusionCommitBranchesController', 'commit/(?P[a-z0-9]+)/tags/' => 'DiffusionCommitTagsController', 'commit/(?P[a-z0-9]+)/edit/' => 'DiffusionCommitEditController', 'edit/' => array( '' => 'DiffusionRepositoryEditMainController', 'basic/' => 'DiffusionRepositoryEditBasicController', 'encoding/' => 'DiffusionRepositoryEditEncodingController', 'activate/' => 'DiffusionRepositoryEditActivateController', 'dangerous/' => 'DiffusionRepositoryEditDangerousController', 'branches/' => 'DiffusionRepositoryEditBranchesController', 'subversion/' => 'DiffusionRepositoryEditSubversionController', 'actions/' => 'DiffusionRepositoryEditActionsController', '(?Premote)/' => 'DiffusionRepositoryCreateController', '(?Ppolicy)/' => 'DiffusionRepositoryCreateController', 'storage/' => 'DiffusionRepositoryEditStorageController', 'delete/' => 'DiffusionRepositoryEditDeleteController', 'hosting/' => 'DiffusionRepositoryEditHostingController', '(?Pserve)/' => 'DiffusionRepositoryEditHostingController', 'update/' => 'DiffusionRepositoryEditUpdateController', ), 'pathtree/(?P.*)' => 'DiffusionPathTreeController', 'mirror/' => array( 'edit/(?:(?P\d+)/)?' => 'DiffusionMirrorEditController', 'delete/(?P\d+)/' => 'DiffusionMirrorDeleteController', ), ), // NOTE: This must come after the rule above; it just gives us a // catch-all for serving repositories over HTTP. We must accept // requests without the trailing "/" because SVN commands don't // necessarily include it. '(?P[A-Z]+)(/|$).*' => 'DiffusionRepositoryDefaultController', 'inline/' => array( 'edit/(?P[^/]+)/' => 'DiffusionInlineCommentController', 'preview/(?P[^/]+)/' => 'DiffusionInlineCommentPreviewController', ), 'services/' => array( 'path/' => array( 'complete/' => 'DiffusionPathCompleteController', 'validate/' => 'DiffusionPathValidateController', ), ), 'symbol/(?P[^/]+)/' => 'DiffusionSymbolController', 'external/' => 'DiffusionExternalController', 'lint/' => 'DiffusionLintController', ), ); } public function getApplicationOrder() { return 0.120; } protected function getCustomCapabilities() { return array( DiffusionDefaultViewCapability::CAPABILITY => array(), DiffusionDefaultEditCapability::CAPABILITY => array( 'default' => PhabricatorPolicies::POLICY_ADMIN, ), DiffusionDefaultPushCapability::CAPABILITY => array(), DiffusionCreateRepositoriesCapability::CAPABILITY => array( 'default' => PhabricatorPolicies::POLICY_ADMIN, ), ); } } diff --git a/src/applications/diviner/application/PhabricatorDivinerApplication.php b/src/applications/diviner/application/PhabricatorDivinerApplication.php index 172d09b962..6826e3051a 100644 --- a/src/applications/diviner/application/PhabricatorDivinerApplication.php +++ b/src/applications/diviner/application/PhabricatorDivinerApplication.php @@ -1,56 +1,52 @@ array( '' => 'DivinerMainController', 'query/((?[^/]+)/)?' => 'DivinerAtomListController', 'find/' => 'DivinerFindController', ), '/book/(?P[^/]+)/' => 'DivinerBookController', '/book/'. '(?P[^/]+)/'. '(?P[^/]+)/'. '(?:(?P[^/]+)/)?'. '(?P[^/]+)/'. '(?:(?P\d+)/)?' => 'DivinerAtomController', ); } public function getApplicationGroup() { return self::GROUP_UTILITIES; } public function getRemarkupRules() { return array( new DivinerSymbolRemarkupRule(), ); } } diff --git a/src/applications/drydock/application/PhabricatorDrydockApplication.php b/src/applications/drydock/application/PhabricatorDrydockApplication.php index 2a6f0c33b6..033e2666c7 100644 --- a/src/applications/drydock/application/PhabricatorDrydockApplication.php +++ b/src/applications/drydock/application/PhabricatorDrydockApplication.php @@ -1,84 +1,80 @@ array( '' => 'DrydockConsoleController', 'blueprint/' => array( '(?:query/(?P[^/]+)/)?' => 'DrydockBlueprintListController', '(?P[1-9]\d*)/' => 'DrydockBlueprintViewController', 'create/' => 'DrydockBlueprintCreateController', 'edit/(?:(?P[1-9]\d*)/)?' => 'DrydockBlueprintEditController', ), 'resource/' => array( '(?:query/(?P[^/]+)/)?' => 'DrydockResourceListController', '(?P[1-9]\d*)/' => 'DrydockResourceViewController', '(?P[1-9]\d*)/close/' => 'DrydockResourceCloseController', ), 'lease/' => array( '(?:query/(?P[^/]+)/)?' => 'DrydockLeaseListController', '(?P[1-9]\d*)/' => 'DrydockLeaseViewController', '(?P[1-9]\d*)/release/' => 'DrydockLeaseReleaseController', ), 'log/' => array( '(?:query/(?P[^/]+)/)?' => 'DrydockLogListController', ), ), ); } protected function getCustomCapabilities() { return array( DrydockDefaultViewCapability::CAPABILITY => array(), DrydockDefaultEditCapability::CAPABILITY => array( 'default' => PhabricatorPolicies::POLICY_ADMIN, ), DrydockCreateBlueprintsCapability::CAPABILITY => array( 'default' => PhabricatorPolicies::POLICY_ADMIN, ), ); } } diff --git a/src/applications/fact/application/PhabricatorFactApplication.php b/src/applications/fact/application/PhabricatorFactApplication.php index b8d19755e1..5967778c71 100644 --- a/src/applications/fact/application/PhabricatorFactApplication.php +++ b/src/applications/fact/application/PhabricatorFactApplication.php @@ -1,42 +1,38 @@ array( '' => 'PhabricatorFactHomeController', 'chart/' => 'PhabricatorFactChartController', ), ); } } diff --git a/src/applications/feed/application/PhabricatorFeedApplication.php b/src/applications/feed/application/PhabricatorFeedApplication.php index 2d9cb4bf39..6f2dbea50a 100644 --- a/src/applications/feed/application/PhabricatorFeedApplication.php +++ b/src/applications/feed/application/PhabricatorFeedApplication.php @@ -1,39 +1,35 @@ array( 'public/' => 'PhabricatorFeedPublicStreamController', '(?P\d+)/' => 'PhabricatorFeedDetailController', '(?:query/(?P[^/]+)/)?' => 'PhabricatorFeedListController', ), ); } } diff --git a/src/applications/files/application/PhabricatorFilesApplication.php b/src/applications/files/application/PhabricatorFilesApplication.php index cf49fa2fd6..85116e9786 100644 --- a/src/applications/files/application/PhabricatorFilesApplication.php +++ b/src/applications/files/application/PhabricatorFilesApplication.php @@ -1,96 +1,92 @@ $this->getInboundEmailSupportLink(),), pht('Learn More'))); } protected function getCustomCapabilities() { return array( FilesDefaultViewCapability::CAPABILITY => array( 'caption' => pht( 'Default view policy for newly created files.'), ), ); } public function getRoutes() { return array( '/F(?P[1-9]\d*)' => 'PhabricatorFileInfoController', '/file/' => array( '(query/(?P[^/]+)/)?' => 'PhabricatorFileListController', 'upload/' => 'PhabricatorFileUploadController', 'dropupload/' => 'PhabricatorFileDropUploadController', 'compose/' => 'PhabricatorFileComposeController', 'comment/(?P[1-9]\d*)/' => 'PhabricatorFileCommentController', 'delete/(?P[1-9]\d*)/' => 'PhabricatorFileDeleteController', 'edit/(?P[1-9]\d*)/' => 'PhabricatorFileEditController', 'info/(?P[^/]+)/' => 'PhabricatorFileInfoController', 'data/(?P[^/]+)/(?P[^/]+)/(?P[^/]+)/.*' => 'PhabricatorFileDataController', 'data/(?P[^/]+)/(?P[^/]+)/.*' => 'PhabricatorFileDataController', 'proxy/' => 'PhabricatorFileProxyController', 'xform/(?P[^/]+)/(?P[^/]+)/(?P[^/]+)/' => 'PhabricatorFileTransformController', 'uploaddialog/' => 'PhabricatorFileUploadDialogController', 'download/(?P[^/]+)/' => 'PhabricatorFileDialogController', ), ); } } diff --git a/src/applications/flag/application/PhabricatorFlagsApplication.php b/src/applications/flag/application/PhabricatorFlagsApplication.php index 023c4570a9..232f6f4dca 100644 --- a/src/applications/flag/application/PhabricatorFlagsApplication.php +++ b/src/applications/flag/application/PhabricatorFlagsApplication.php @@ -1,73 +1,69 @@ setViewer($user) ->withOwnerPHIDs(array($user->getPHID())) ->setLimit(self::MAX_STATUS_ITEMS) ->execute(); $count = count($flags); $count_str = self::formatStatusCount( $count, '%s Flagged Objects', '%d Flagged Object(s)'); $type = PhabricatorApplicationStatusView::TYPE_WARNING; $status[] = id(new PhabricatorApplicationStatusView()) ->setType($type) ->setText($count_str) ->setCount($count); return $status; } public function getRoutes() { return array( '/flag/' => array( '(?:query/(?P[^/]+)/)?' => 'PhabricatorFlagListController', 'view/(?P[^/]+)/' => 'PhabricatorFlagListController', 'edit/(?P[^/]+)/' => 'PhabricatorFlagEditController', 'delete/(?P[1-9]\d*)/' => 'PhabricatorFlagDeleteController', ), ); } } diff --git a/src/applications/fund/application/PhabricatorFundApplication.php b/src/applications/fund/application/PhabricatorFundApplication.php index 1dcce4a8fd..72207995b8 100644 --- a/src/applications/fund/application/PhabricatorFundApplication.php +++ b/src/applications/fund/application/PhabricatorFundApplication.php @@ -1,69 +1,65 @@ [1-9]\d*)' => 'FundInitiativeViewController', '/fund/' => array( '(?:query/(?P[^/]+)/)?' => 'FundInitiativeListController', 'create/' => 'FundInitiativeEditController', 'edit/(?:(?P\d+)/)?' => 'FundInitiativeEditController', 'close/(?P\d+)/' => 'FundInitiativeCloseController', 'back/(?P\d+)/' => 'FundInitiativeBackController', 'backers/(?:(?P\d+)/)?(?:query/(?P[^/]+)/)?' => 'FundBackerListController', ), ); } protected function getCustomCapabilities() { return array( FundDefaultViewCapability::CAPABILITY => array( 'caption' => pht('Default view policy for newly created initiatives.'), ), FundCreateInitiativesCapability::CAPABILITY => array( 'default' => PhabricatorPolicies::POLICY_ADMIN, ), ); } } diff --git a/src/applications/harbormaster/application/PhabricatorHarbormasterApplication.php b/src/applications/harbormaster/application/PhabricatorHarbormasterApplication.php index f01f0d58c7..fd491f707b 100644 --- a/src/applications/harbormaster/application/PhabricatorHarbormasterApplication.php +++ b/src/applications/harbormaster/application/PhabricatorHarbormasterApplication.php @@ -1,97 +1,93 @@ [1-9]\d*)' => 'HarbormasterBuildableViewController', '/harbormaster/' => array( '(?:query/(?P[^/]+)/)?' => 'HarbormasterBuildableListController', 'step/' => array( 'add/(?:(?P\d+)/)?' => 'HarbormasterStepAddController', 'new/(?P\d+)/(?P[^/]+)/' => 'HarbormasterStepEditController', 'edit/(?:(?P\d+)/)?' => 'HarbormasterStepEditController', 'delete/(?:(?P\d+)/)?' => 'HarbormasterStepDeleteController', ), 'buildable/' => array( '(?P\d+)/(?Pstop|resume|restart)/' => 'HarbormasterBuildableActionController', ), 'build/' => array( '(?P\d+)/' => 'HarbormasterBuildViewController', '(?Pstop|resume|restart)/(?P\d+)/(?:(?P[^/]+)/)?' => 'HarbormasterBuildActionController', ), 'plan/' => array( '(?:query/(?P[^/]+)/)?' => 'HarbormasterPlanListController', 'edit/(?:(?P\d+)/)?' => 'HarbormasterPlanEditController', 'order/(?:(?P\d+)/)?' => 'HarbormasterPlanOrderController', 'disable/(?P\d+)/' => 'HarbormasterPlanDisableController', 'run/(?P\d+)/' => 'HarbormasterPlanRunController', '(?P\d+)/' => 'HarbormasterPlanViewController', ), ), ); } protected function getCustomCapabilities() { return array( HarbormasterManagePlansCapability::CAPABILITY => array( 'caption' => pht('Can create and manage build plans.'), 'default' => PhabricatorPolicies::POLICY_ADMIN, ), ); } } diff --git a/src/applications/herald/application/PhabricatorHeraldApplication.php b/src/applications/herald/application/PhabricatorHeraldApplication.php index 11f6554be7..d6fedeca7f 100644 --- a/src/applications/herald/application/PhabricatorHeraldApplication.php +++ b/src/applications/herald/application/PhabricatorHeraldApplication.php @@ -1,77 +1,73 @@ array( '(?:query/(?P[^/]+)/)?' => 'HeraldRuleListController', 'new/' => 'HeraldNewController', 'rule/(?P[1-9]\d*)/' => 'HeraldRuleViewController', 'edit/(?:(?P[1-9]\d*)/)?' => 'HeraldRuleController', 'disable/(?P[1-9]\d*)/(?P\w+)/' => 'HeraldDisableController', 'history/(?:(?P[1-9]\d*)/)?' => 'HeraldRuleEditHistoryController', 'test/' => 'HeraldTestConsoleController', 'transcript/' => array( '' => 'HeraldTranscriptListController', '(?:query/(?P[^/]+)/)?' => 'HeraldTranscriptListController', '(?P[1-9]\d*)/(?:(?P\w+)/)?' => 'HeraldTranscriptController', ), ), ); } protected function getCustomCapabilities() { return array( HeraldManageGlobalRulesCapability::CAPABILITY => array( 'caption' => pht('Global rules can bypass access controls.'), 'default' => PhabricatorPolicies::POLICY_ADMIN, ), ); } } diff --git a/src/applications/home/application/PhabricatorHomeApplication.php b/src/applications/home/application/PhabricatorHomeApplication.php index 2e80a620de..ad013b03fa 100644 --- a/src/applications/home/application/PhabricatorHomeApplication.php +++ b/src/applications/home/application/PhabricatorHomeApplication.php @@ -1,121 +1,117 @@ 'PhabricatorHomeMainController', '/(?Phome)/' => 'PhabricatorHomeMainController', '/home/' => array( 'create/' => 'PhabricatorHomeQuickCreateController', ), ); } public function isLaunchable() { return false; } public function canUninstall() { return false; } public function getApplicationOrder() { return 9; } public function buildMainMenuItems( PhabricatorUser $user, PhabricatorController $controller = null) { $items = array(); if ($user->isLoggedIn() && $user->isUserActivated()) { $create_id = celerity_generate_unique_node_id(); Javelin::initBehavior( 'aphlict-dropdown', array( 'bubbleID' => $create_id, 'dropdownID' => 'phabricator-quick-create-menu', 'local' => true, 'desktop' => true, 'right' => true, )); $item = id(new PHUIListItemView()) ->setName(pht('Create New...')) ->setIcon('fa-plus') ->addClass('core-menu-item') ->setHref('/home/create/') ->addSigil('quick-create-menu') ->setID($create_id) ->setAural(pht('Quick Create')) ->setOrder(300); $items[] = $item; } return $items; } public function loadAllQuickCreateItems(PhabricatorUser $viewer) { $applications = id(new PhabricatorApplicationQuery()) ->setViewer($viewer) ->withInstalled(true) ->execute(); $items = array(); foreach ($applications as $application) { $app_items = $application->getQuickCreateItems($viewer); foreach ($app_items as $app_item) { $items[] = $app_item; } } return $items; } public function buildMainMenuExtraNodes( PhabricatorUser $viewer, PhabricatorController $controller = null) { $items = $this->loadAllQuickCreateItems($viewer); $view = new PHUIListView(); $view->newLabel(pht('Create New...')); foreach ($items as $item) { $view->addMenuItem($item); } return phutil_tag( 'div', array( 'id' => 'phabricator-quick-create-menu', 'class' => 'phabricator-main-menu-dropdown phui-list-sidenav', 'style' => 'display: none', ), $view); } } diff --git a/src/applications/legalpad/application/PhabricatorLegalpadApplication.php b/src/applications/legalpad/application/PhabricatorLegalpadApplication.php index cae15d0b25..a453881ca8 100644 --- a/src/applications/legalpad/application/PhabricatorLegalpadApplication.php +++ b/src/applications/legalpad/application/PhabricatorLegalpadApplication.php @@ -1,82 +1,78 @@ \d+)' => 'LegalpadDocumentSignController', '/legalpad/' => array( '' => 'LegalpadDocumentListController', '(?:query/(?P[^/]+)/)?' => 'LegalpadDocumentListController', 'create/' => 'LegalpadDocumentEditController', 'edit/(?P\d+)/' => 'LegalpadDocumentEditController', 'comment/(?P\d+)/' => 'LegalpadDocumentCommentController', 'view/(?P\d+)/' => 'LegalpadDocumentManageController', 'done/' => 'LegalpadDocumentDoneController', 'verify/(?P[^/]+)/' => 'LegalpadDocumentSignatureVerificationController', 'signatures/(?:(?P\d+)/)?(?:query/(?P[^/]+)/)?' => 'LegalpadDocumentSignatureListController', 'addsignature/(?P\d+)/' => 'LegalpadDocumentSignatureAddController', 'signature/(?P\d+)/' => 'LegalpadDocumentSignatureViewController', 'document/' => array( 'preview/' => 'PhabricatorMarkupPreviewController', ), ), ); } protected function getCustomCapabilities() { return array( LegalpadCreateDocumentsCapability::CAPABILITY => array(), LegalpadDefaultViewCapability::CAPABILITY => array(), LegalpadDefaultEditCapability::CAPABILITY => array(), ); } } diff --git a/src/applications/macro/application/PhabricatorMacroApplication.php b/src/applications/macro/application/PhabricatorMacroApplication.php index be971f682d..0168d5f2c8 100644 --- a/src/applications/macro/application/PhabricatorMacroApplication.php +++ b/src/applications/macro/application/PhabricatorMacroApplication.php @@ -1,64 +1,60 @@ array( '(query/(?P[^/]+)/)?' => 'PhabricatorMacroListController', 'create/' => 'PhabricatorMacroEditController', 'view/(?P[1-9]\d*)/' => 'PhabricatorMacroViewController', 'comment/(?P[1-9]\d*)/' => 'PhabricatorMacroCommentController', 'edit/(?P[1-9]\d*)/' => 'PhabricatorMacroEditController', 'audio/(?P[1-9]\d*)/' => 'PhabricatorMacroAudioController', 'disable/(?P[1-9]\d*)/' => 'PhabricatorMacroDisableController', 'meme/' => 'PhabricatorMacroMemeController', 'meme/create/' => 'PhabricatorMacroMemeDialogController', ), ); } public function getRemarkupRules() { return array( new PhabricatorIconRemarkupRule(), new PhabricatorEmojiRemarkupRule(), ); } protected function getCustomCapabilities() { return array( PhabricatorMacroManageCapability::CAPABILITY => array( 'caption' => pht('Allows creating and editing macros.'), ), ); } } diff --git a/src/applications/mailinglists/application/PhabricatorMailingListsApplication.php b/src/applications/mailinglists/application/PhabricatorMailingListsApplication.php index a3409dc1ba..00198328f3 100644 --- a/src/applications/mailinglists/application/PhabricatorMailingListsApplication.php +++ b/src/applications/mailinglists/application/PhabricatorMailingListsApplication.php @@ -1,44 +1,40 @@ array( '(?:query/(?P[^/]+)/)?' => 'PhabricatorMailingListsListController', 'edit/(?:(?P[1-9]\d*)/)?' => 'PhabricatorMailingListsEditController', ), ); } public function getTitleGlyph() { return '@'; } } diff --git a/src/applications/maniphest/application/PhabricatorManiphestApplication.php b/src/applications/maniphest/application/PhabricatorManiphestApplication.php index 1df47ad390..fa2e2c0c90 100644 --- a/src/applications/maniphest/application/PhabricatorManiphestApplication.php +++ b/src/applications/maniphest/application/PhabricatorManiphestApplication.php @@ -1,151 +1,147 @@ [1-9]\d*)' => 'ManiphestTaskDetailController', '/maniphest/' => array( '(?:query/(?P[^/]+)/)?' => 'ManiphestTaskListController', 'report/(?:(?P\w+)/)?' => 'ManiphestReportController', 'batch/' => 'ManiphestBatchEditController', 'task/' => array( 'create/' => 'ManiphestTaskEditController', 'edit/(?P[1-9]\d*)/' => 'ManiphestTaskEditController', 'descriptionpreview/' => 'PhabricatorMarkupPreviewController', ), 'transaction/' => array( 'save/' => 'ManiphestTransactionSaveController', 'preview/(?P[1-9]\d*)/' => 'ManiphestTransactionPreviewController', ), 'export/(?P[^/]+)/' => 'ManiphestExportController', 'subpriority/' => 'ManiphestSubpriorityController', ), ); } public function loadStatus(PhabricatorUser $user) { $status = array(); if (!$user->isLoggedIn()) { return $status; } $query = id(new ManiphestTaskQuery()) ->setViewer($user) ->withStatuses(ManiphestTaskStatus::getOpenStatusConstants()) ->withOwners(array($user->getPHID())) ->setLimit(self::MAX_STATUS_ITEMS); $count = count($query->execute()); $count_str = self::formatStatusCount( $count, '%s Assigned Tasks', '%d Assigned Task(s)'); $type = PhabricatorApplicationStatusView::TYPE_WARNING; $status[] = id(new PhabricatorApplicationStatusView()) ->setType($type) ->setText($count_str) ->setCount($count); return $status; } public function getQuickCreateItems(PhabricatorUser $viewer) { $items = array(); $item = id(new PHUIListItemView()) ->setName(pht('Maniphest Task')) ->setIcon('fa-anchor') ->setHref($this->getBaseURI().'task/create/'); $items[] = $item; return $items; } public function supportsEmailIntegration() { return true; } public function getAppEmailBlurb() { return pht( 'Send email to these addresses to create tasks. %s', phutil_tag( 'a', array( 'href' => $this->getInboundEmailSupportLink(),), pht('Learn More'))); } protected function getCustomCapabilities() { return array( ManiphestDefaultViewCapability::CAPABILITY => array( 'caption' => pht('Default view policy for newly created tasks.'), ), ManiphestDefaultEditCapability::CAPABILITY => array( 'caption' => pht('Default edit policy for newly created tasks.'), ), ManiphestEditStatusCapability::CAPABILITY => array(), ManiphestEditAssignCapability::CAPABILITY => array(), ManiphestEditPoliciesCapability::CAPABILITY => array(), ManiphestEditPriorityCapability::CAPABILITY => array(), ManiphestEditProjectsCapability::CAPABILITY => array(), ManiphestBulkEditCapability::CAPABILITY => array(), ); } } diff --git a/src/applications/meta/application/PhabricatorApplicationsApplication.php b/src/applications/meta/application/PhabricatorApplicationsApplication.php index 8b5e801057..1b1d90e975 100644 --- a/src/applications/meta/application/PhabricatorApplicationsApplication.php +++ b/src/applications/meta/application/PhabricatorApplicationsApplication.php @@ -1,56 +1,52 @@ array( '(?:query/(?P[^/]+)/)?' => 'PhabricatorApplicationsListController', 'view/(?P\w+)/' => 'PhabricatorApplicationDetailViewController', 'edit/(?P\w+)/' => 'PhabricatorApplicationEditController', 'editemail/(?P\w+)/' => 'PhabricatorApplicationEditEmailController', '(?P\w+)/(?Pinstall|uninstall)/' => 'PhabricatorApplicationUninstallController', ), ); } } diff --git a/src/applications/metamta/application/PhabricatorMetaMTAApplication.php b/src/applications/metamta/application/PhabricatorMetaMTAApplication.php index 5a356acc26..802b3f1661 100644 --- a/src/applications/metamta/application/PhabricatorMetaMTAApplication.php +++ b/src/applications/metamta/application/PhabricatorMetaMTAApplication.php @@ -1,54 +1,50 @@ array( 'sendgrid/' => 'PhabricatorMetaMTASendGridReceiveController', 'mailgun/' => 'PhabricatorMetaMTAMailgunReceiveController', ), ); } public function getTitleGlyph() { return '@'; } } diff --git a/src/applications/nuance/application/PhabricatorNuanceApplication.php b/src/applications/nuance/application/PhabricatorNuanceApplication.php index 87e3c8b0b4..31f06c4b64 100644 --- a/src/applications/nuance/application/PhabricatorNuanceApplication.php +++ b/src/applications/nuance/application/PhabricatorNuanceApplication.php @@ -1,81 +1,77 @@ array( 'item/' => array( 'view/(?P[1-9]\d*)/' => 'NuanceItemViewController', 'edit/(?P[1-9]\d*)/' => 'NuanceItemEditController', 'new/' => 'NuanceItemEditController', ), 'source/' => array( 'view/(?P[1-9]\d*)/' => 'NuanceSourceViewController', 'edit/(?P[1-9]\d*)/' => 'NuanceSourceEditController', 'new/' => 'NuanceSourceEditController', ), 'queue/' => array( 'view/(?P[1-9]\d*)/' => 'NuanceQueueViewController', 'edit/(?P[1-9]\d*)/' => 'NuanceQueueEditController', 'new/' => 'NuanceQueueEditController', ), 'requestor/' => array( 'view/(?P[1-9]\d*)/' => 'NuanceRequestorViewController', 'edit/(?P[1-9]\d*)/' => 'NuanceRequestorEditController', 'new/' => 'NuanceRequestorEditController', ), ), ); } protected function getCustomCapabilities() { return array( NuanceSourceDefaultViewCapability::CAPABILITY => array( 'caption' => pht('Default view policy for newly created sources.'), ), NuanceSourceDefaultEditCapability::CAPABILITY => array( 'caption' => pht('Default edit policy for newly created sources.'), ), NuanceSourceManageCapability::CAPABILITY => array(), ); } } diff --git a/src/applications/oauthserver/application/PhabricatorOAuthServerApplication.php b/src/applications/oauthserver/application/PhabricatorOAuthServerApplication.php index 94faae69dd..82bb0d6821 100644 --- a/src/applications/oauthserver/application/PhabricatorOAuthServerApplication.php +++ b/src/applications/oauthserver/application/PhabricatorOAuthServerApplication.php @@ -1,72 +1,68 @@ array( '(?:query/(?P[^/]+)/)?' => 'PhabricatorOAuthClientListController', 'auth/' => 'PhabricatorOAuthServerAuthController', 'test/(?P\d+)/' => 'PhabricatorOAuthServerTestController', 'token/' => 'PhabricatorOAuthServerTokenController', 'client/' => array( 'create/' => 'PhabricatorOAuthClientEditController', 'delete/(?P[^/]+)/' => 'PhabricatorOAuthClientDeleteController', 'edit/(?P[^/]+)/' => 'PhabricatorOAuthClientEditController', 'view/(?P[^/]+)/' => 'PhabricatorOAuthClientViewController', 'secret/(?P[^/]+)/' => 'PhabricatorOAuthClientSecretController', ), ), ); } protected function getCustomCapabilities() { return array( PhabricatorOAuthServerCreateClientsCapability::CAPABILITY => array( 'default' => PhabricatorPolicies::POLICY_ADMIN, ), ); } } diff --git a/src/applications/owners/application/PhabricatorOwnersApplication.php b/src/applications/owners/application/PhabricatorOwnersApplication.php index 18acb9ab9d..fc11103179 100644 --- a/src/applications/owners/application/PhabricatorOwnersApplication.php +++ b/src/applications/owners/application/PhabricatorOwnersApplication.php @@ -1,54 +1,50 @@ array( '' => 'PhabricatorOwnersListController', 'view/(?P[^/]+)/' => 'PhabricatorOwnersListController', 'edit/(?P[1-9]\d*)/' => 'PhabricatorOwnersEditController', 'new/' => 'PhabricatorOwnersEditController', 'package/(?P[1-9]\d*)/' => 'PhabricatorOwnersDetailController', 'delete/(?P[1-9]\d*)/' => 'PhabricatorOwnersDeleteController', ), ); } } diff --git a/src/applications/passphrase/application/PhabricatorPassphraseApplication.php b/src/applications/passphrase/application/PhabricatorPassphraseApplication.php index d5fb4d1fa8..d549a451e5 100644 --- a/src/applications/passphrase/application/PhabricatorPassphraseApplication.php +++ b/src/applications/passphrase/application/PhabricatorPassphraseApplication.php @@ -1,64 +1,60 @@ \d+)' => 'PassphraseCredentialViewController', '/passphrase/' => array( '(?:query/(?P[^/]+)/)?' => 'PassphraseCredentialListController', 'create/' => 'PassphraseCredentialCreateController', 'edit/(?:(?P\d+)/)?' => 'PassphraseCredentialEditController', 'destroy/(?P\d+)/' => 'PassphraseCredentialDestroyController', 'reveal/(?P\d+)/' => 'PassphraseCredentialRevealController', 'public/(?P\d+)/' => 'PassphraseCredentialPublicController', 'lock/(?P\d+)/' => 'PassphraseCredentialLockController', 'conduit/(?P\d+)/' => 'PassphraseCredentialConduitController', ), ); } public function getRemarkupRules() { return array( new PassphraseRemarkupRule(), ); } } diff --git a/src/applications/paste/application/PhabricatorPasteApplication.php b/src/applications/paste/application/PhabricatorPasteApplication.php index 6de712a92a..38f0484339 100644 --- a/src/applications/paste/application/PhabricatorPasteApplication.php +++ b/src/applications/paste/application/PhabricatorPasteApplication.php @@ -1,89 +1,85 @@ [1-9]\d*)(?:\$(?P\d+(?:-\d+)?))?' => 'PhabricatorPasteViewController', '/paste/' => array( '(query/(?P[^/]+)/)?' => 'PhabricatorPasteListController', 'create/' => 'PhabricatorPasteEditController', 'edit/(?P[1-9]\d*)/' => 'PhabricatorPasteEditController', 'comment/(?P[1-9]\d*)/' => 'PhabricatorPasteCommentController', ), ); } public function supportsEmailIntegration() { return true; } public function getAppEmailBlurb() { return pht( 'Send email to these addresses to create pastes. %s', phutil_tag( 'a', array( 'href' => $this->getInboundEmailSupportLink(),), pht('Learn More'))); } protected function getCustomCapabilities() { return array( PasteDefaultViewCapability::CAPABILITY => array( 'caption' => pht('Default view policy for newly created pastes.'), ), PasteDefaultEditCapability::CAPABILITY => array( 'caption' => pht('Default edit policy for newly created pastes.'), ), ); } public function getQuickCreateItems(PhabricatorUser $viewer) { $items = array(); $item = id(new PHUIListItemView()) ->setName(pht('Paste')) ->setIcon('fa-clipboard') ->setHref($this->getBaseURI().'create/'); $items[] = $item; return $items; } } diff --git a/src/applications/people/application/PhabricatorPeopleApplication.php b/src/applications/people/application/PhabricatorPeopleApplication.php index 165a7b387f..d46a2c4f6d 100644 --- a/src/applications/people/application/PhabricatorPeopleApplication.php +++ b/src/applications/people/application/PhabricatorPeopleApplication.php @@ -1,175 +1,171 @@ getIsAdmin(); } public function getFlavorText() { return pht('Sort of a social utility.'); } public function canUninstall() { return false; } public function getEventListeners() { return array( new PhabricatorPeopleHovercardEventListener(), ); } public function getRoutes() { return array( '/people/' => array( '(query/(?P[^/]+)/)?' => 'PhabricatorPeopleListController', 'logs/(?:query/(?P[^/]+)/)?' => 'PhabricatorPeopleLogsController', 'approve/(?P[1-9]\d*)/' => 'PhabricatorPeopleApproveController', '(?Pdisapprove)/(?P[1-9]\d*)/' => 'PhabricatorPeopleDisableController', '(?Pdisable)/(?P[1-9]\d*)/' => 'PhabricatorPeopleDisableController', 'empower/(?P[1-9]\d*)/' => 'PhabricatorPeopleEmpowerController', 'delete/(?P[1-9]\d*)/' => 'PhabricatorPeopleDeleteController', 'rename/(?P[1-9]\d*)/' => 'PhabricatorPeopleRenameController', 'welcome/(?P[1-9]\d*)/' => 'PhabricatorPeopleWelcomeController', 'create/' => 'PhabricatorPeopleCreateController', 'new/(?P[^/]+)/' => 'PhabricatorPeopleNewController', 'ldap/' => 'PhabricatorPeopleLdapController', 'editprofile/(?P[1-9]\d*)/' => 'PhabricatorPeopleProfileEditController', 'picture/(?P[1-9]\d*)/' => 'PhabricatorPeopleProfilePictureController', ), '/p/(?P[\w._-]+)/' => 'PhabricatorPeopleProfileController', '/p/(?P[\w._-]+)/calendar/' => 'PhabricatorPeopleCalendarController', ); } public function getRemarkupRules() { return array( new PhabricatorMentionRemarkupRule(), ); } protected function getCustomCapabilities() { return array( PeopleCreateUsersCapability::CAPABILITY => array( 'default' => PhabricatorPolicies::POLICY_ADMIN, ), PeopleBrowseUserDirectoryCapability::CAPABILITY => array(), ); } public function loadStatus(PhabricatorUser $user) { if (!$user->getIsAdmin()) { return array(); } $need_approval = id(new PhabricatorPeopleQuery()) ->setViewer($user) ->withIsApproved(false) ->withIsDisabled(false) ->setLimit(self::MAX_STATUS_ITEMS) ->execute(); if (!$need_approval) { return array(); } $status = array(); $count = count($need_approval); $count_str = self::formatStatusCount( $count, '%s Users Need Approval', '%d User(s) Need Approval'); $type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION; $status[] = id(new PhabricatorApplicationStatusView()) ->setType($type) ->setText($count_str) ->setCount($count); return $status; } public function buildMainMenuItems( PhabricatorUser $user, PhabricatorController $controller = null) { $items = array(); if ($user->isLoggedIn() && $user->isUserActivated()) { $image = $user->loadProfileImageURI(); $item = id(new PHUIListItemView()) ->setName($user->getUsername()) ->setHref('/p/'.$user->getUsername().'/') ->addClass('core-menu-item') ->setAural(pht('Profile')) ->setOrder(100); $classes = array( 'phabricator-core-menu-icon', 'phabricator-core-menu-profile-image', ); $item->appendChild( phutil_tag( 'span', array( 'class' => implode(' ', $classes), 'style' => 'background-image: url('.$image.')', ), '')); $items[] = $item; } return $items; } public function getQuickCreateItems(PhabricatorUser $viewer) { $items = array(); if ($viewer->getIsAdmin()) { $item = id(new PHUIListItemView()) ->setName(pht('User Account')) ->setIcon('fa-users') ->setHref($this->getBaseURI().'create/'); $items[] = $item; } return $items; } } diff --git a/src/applications/phame/application/PhabricatorPhameApplication.php b/src/applications/phame/application/PhabricatorPhameApplication.php index 82f5205a4d..452a521854 100644 --- a/src/applications/phame/application/PhabricatorPhameApplication.php +++ b/src/applications/phame/application/PhabricatorPhameApplication.php @@ -1,71 +1,67 @@ array( '' => 'PhamePostListController', 'r/(?P\d+)/(?P[^/]+)/(?P.*)' => 'PhameResourceController', 'live/(?P[^/]+)/(?P.*)' => 'PhameBlogLiveController', 'post/' => array( '(?:(?Pdraft|all)/)?' => 'PhamePostListController', 'blogger/(?P[\w\.-_]+)/' => 'PhamePostListController', 'delete/(?P[^/]+)/' => 'PhamePostDeleteController', 'edit/(?:(?P[^/]+)/)?' => 'PhamePostEditController', 'view/(?P\d+)/' => 'PhamePostViewController', 'publish/(?P\d+)/' => 'PhamePostPublishController', 'unpublish/(?P\d+)/' => 'PhamePostUnpublishController', 'notlive/(?P\d+)/' => 'PhamePostNotLiveController', 'preview/' => 'PhamePostPreviewController', 'framed/(?P\d+)/' => 'PhamePostFramedController', 'new/' => 'PhamePostNewController', 'move/(?P\d+)/' => 'PhamePostNewController', ), 'blog/' => array( '(?:(?Puser|all)/)?' => 'PhameBlogListController', 'delete/(?P[^/]+)/' => 'PhameBlogDeleteController', 'edit/(?P[^/]+)/' => 'PhameBlogEditController', 'view/(?P[^/]+)/' => 'PhameBlogViewController', 'feed/(?P[^/]+)/' => 'PhameBlogFeedController', 'new/' => 'PhameBlogEditController', ), ), ); } } diff --git a/src/applications/phlux/application/PhabricatorPhluxApplication.php b/src/applications/phlux/application/PhabricatorPhluxApplication.php index feaf981eec..aabd7c9d1a 100644 --- a/src/applications/phlux/application/PhabricatorPhluxApplication.php +++ b/src/applications/phlux/application/PhabricatorPhluxApplication.php @@ -1,47 +1,43 @@ array( '' => 'PhluxListController', 'view/(?P[^/]+)/' => 'PhluxViewController', 'edit/(?:(?P[^/]+)/)?' => 'PhluxEditController', ), ); } } diff --git a/src/applications/pholio/application/PhabricatorPholioApplication.php b/src/applications/pholio/application/PhabricatorPholioApplication.php index 06e554158c..4524852085 100644 --- a/src/applications/pholio/application/PhabricatorPholioApplication.php +++ b/src/applications/pholio/application/PhabricatorPholioApplication.php @@ -1,84 +1,80 @@ [1-9]\d*)(?:/(?P\d+)/)?' => 'PholioMockViewController', '/pholio/' => array( '(?:query/(?P[^/]+)/)?' => 'PholioMockListController', 'new/' => 'PholioMockEditController', 'edit/(?P\d+)/' => 'PholioMockEditController', 'comment/(?P\d+)/' => 'PholioMockCommentController', 'inline/' => array( '(?:(?P\d+)/)?' => 'PholioInlineController', 'list/(?P\d+)/' => 'PholioInlineListController', 'thumb/(?P\d+)/' => 'PholioInlineThumbController', ), 'image/' => array( 'upload/' => 'PholioImageUploadController', ), ), ); } public function getQuickCreateItems(PhabricatorUser $viewer) { $items = array(); $item = id(new PHUIListItemView()) ->setName(pht('Pholio Mock')) ->setIcon('fa-picture-o') ->setHref($this->getBaseURI().'new/'); $items[] = $item; return $items; } protected function getCustomCapabilities() { return array( PholioDefaultViewCapability::CAPABILITY => array(), PholioDefaultEditCapability::CAPABILITY => array(), ); } } diff --git a/src/applications/phortune/application/PhabricatorPhortuneApplication.php b/src/applications/phortune/application/PhabricatorPhortuneApplication.php index 23da65f4fc..8eac0d16b7 100644 --- a/src/applications/phortune/application/PhabricatorPhortuneApplication.php +++ b/src/applications/phortune/application/PhabricatorPhortuneApplication.php @@ -1,113 +1,109 @@ array( '' => 'PhortuneLandingController', '(?P\d+)/' => array( '' => 'PhortuneAccountViewController', 'card/' => array( 'new/' => 'PhortunePaymentMethodCreateController', ), 'order/(?:query/(?P[^/]+)/)?' => 'PhortuneCartListController', 'subscription/' => array( '(?:query/(?P[^/]+)/)?' => 'PhortuneSubscriptionListController', 'view/(?P\d+)/' => 'PhortuneSubscriptionViewController', 'order/(?P\d+)/' => 'PhortuneCartListController', ), 'charge/(?:query/(?P[^/]+)/)?' => 'PhortuneChargeListController', ), 'card/(?P\d+)/' => array( 'edit/' => 'PhortunePaymentMethodEditController', 'disable/' => 'PhortunePaymentMethodDisableController', ), 'cart/(?P\d+)/' => array( '' => 'PhortuneCartViewController', 'checkout/' => 'PhortuneCartCheckoutController', '(?Pcancel|refund)/' => 'PhortuneCartCancelController', 'update/' => 'PhortuneCartUpdateController', 'accept/' => 'PhortuneCartAcceptController', ), 'account/' => array( '' => 'PhortuneAccountListController', 'edit/(?:(?P\d+)/)?' => 'PhortuneAccountEditController', ), 'product/' => array( '' => 'PhortuneProductListController', 'view/(?P\d+)/' => 'PhortuneProductViewController', 'edit/(?:(?P\d+)/)?' => 'PhortuneProductEditController', ), 'provider/' => array( 'edit/(?:(?P\d+)/)?' => 'PhortuneProviderEditController', 'disable/(?P\d+)/' => 'PhortuneProviderDisableController', '(?P\d+)/(?P[^/]+)/' => 'PhortuneProviderActionController', ), 'merchant/' => array( '(?:query/(?P[^/]+)/)?' => 'PhortuneMerchantListController', 'edit/(?:(?P\d+)/)?' => 'PhortuneMerchantEditController', 'orders/(?P\d+)/(?:query/(?P[^/]+)/)?' => 'PhortuneCartListController', '(?P\d+)/subscription/' => array( '(?:query/(?P[^/]+)/)?' => 'PhortuneSubscriptionListController', 'view/(?P\d+)/' => 'PhortuneSubscriptionViewController', 'order/(?P\d+)/' => 'PhortuneCartListController', ), '(?P\d+)/' => 'PhortuneMerchantViewController', ), ), ); } protected function getCustomCapabilities() { return array( PhortuneMerchantCapability::CAPABILITY => array( 'caption' => pht('Merchant accounts can receive payments.'), 'default' => PhabricatorPolicies::POLICY_ADMIN, ), ); } } diff --git a/src/applications/phpast/application/PhabricatorPHPASTApplication.php b/src/applications/phpast/application/PhabricatorPHPASTApplication.php index f24f03650d..8a9efa5a99 100644 --- a/src/applications/phpast/application/PhabricatorPHPASTApplication.php +++ b/src/applications/phpast/application/PhabricatorPHPASTApplication.php @@ -1,51 +1,47 @@ array( '' => 'PhabricatorXHPASTViewRunController', 'view/(?P[1-9]\d*)/' => 'PhabricatorXHPASTViewFrameController', 'frameset/(?P[1-9]\d*)/' => 'PhabricatorXHPASTViewFramesetController', 'input/(?P[1-9]\d*)/' => 'PhabricatorXHPASTViewInputController', 'tree/(?P[1-9]\d*)/' => 'PhabricatorXHPASTViewTreeController', 'stream/(?P[1-9]\d*)/' => 'PhabricatorXHPASTViewStreamController', ), ); } } diff --git a/src/applications/phragment/application/PhabricatorPhragmentApplication.php b/src/applications/phragment/application/PhabricatorPhragmentApplication.php index 90e2e69928..9463835811 100644 --- a/src/applications/phragment/application/PhabricatorPhragmentApplication.php +++ b/src/applications/phragment/application/PhabricatorPhragmentApplication.php @@ -1,74 +1,70 @@ array( '' => 'PhragmentBrowseController', 'browse/(?P.*)' => 'PhragmentBrowseController', 'create/(?P.*)' => 'PhragmentCreateController', 'update/(?P.+)' => 'PhragmentUpdateController', 'policy/(?P.+)' => 'PhragmentPolicyController', 'history/(?P.+)' => 'PhragmentHistoryController', 'zip/(?P.+)' => 'PhragmentZIPController', 'zip@(?P[^/]+)/(?P.+)' => 'PhragmentZIPController', 'version/(?P[0-9]*)/' => 'PhragmentVersionController', 'patch/(?P[0-9x]*)/(?P[0-9]*)/' => 'PhragmentPatchController', 'revert/(?P[0-9]*)/(?P.*)' => 'PhragmentRevertController', 'snapshot/' => array( 'create/(?P.*)' => 'PhragmentSnapshotCreateController', 'view/(?P[0-9]*)/' => 'PhragmentSnapshotViewController', 'delete/(?P[0-9]*)/' => 'PhragmentSnapshotDeleteController', 'promote/' => array( 'latest/(?P.*)' => 'PhragmentSnapshotPromoteController', '(?P[0-9]*)/' => 'PhragmentSnapshotPromoteController', ), ), ), ); } protected function getCustomCapabilities() { return array( PhragmentCanCreateCapability::CAPABILITY => array(), ); } } diff --git a/src/applications/phrequent/application/PhabricatorPhrequentApplication.php b/src/applications/phrequent/application/PhabricatorPhrequentApplication.php index fb627fea76..bc0c39994f 100644 --- a/src/applications/phrequent/application/PhabricatorPhrequentApplication.php +++ b/src/applications/phrequent/application/PhabricatorPhrequentApplication.php @@ -1,75 +1,71 @@ array( '(?:query/(?P[^/]+)/)?' => 'PhrequentListController', 'track/(?P[a-z]+)/(?P[^/]+)/' => 'PhrequentTrackController', ), ); } public function loadStatus(PhabricatorUser $user) { $status = array(); // Show number of objects that are currently // being tracked for a user. $count = PhrequentUserTimeQuery::getUserTotalObjectsTracked( $user, self::MAX_STATUS_ITEMS); $count_str = self::formatStatusCount( $count, '%s Objects Tracked', '%d Object(s) Tracked'); $type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION; $status[] = id(new PhabricatorApplicationStatusView()) ->setType($type) ->setText($count_str) ->setCount($count); return $status; } } diff --git a/src/applications/phriction/application/PhabricatorPhrictionApplication.php b/src/applications/phriction/application/PhabricatorPhrictionApplication.php index dd5f4a2c27..db378633a4 100644 --- a/src/applications/phriction/application/PhabricatorPhrictionApplication.php +++ b/src/applications/phriction/application/PhabricatorPhrictionApplication.php @@ -1,71 +1,67 @@ /)' => 'PhrictionDocumentController', // Match "/w/x/y/z/" with slug "x/y/z/". '/w/(?P.+/)' => 'PhrictionDocumentController', '/phriction/' => array( '(?:query/(?P[^/]+)/)?' => 'PhrictionListController', 'history(?P/)' => 'PhrictionHistoryController', 'history/(?P.+/)' => 'PhrictionHistoryController', 'edit/(?:(?P[1-9]\d*)/)?' => 'PhrictionEditController', 'delete/(?P[1-9]\d*)/' => 'PhrictionDeleteController', 'new/' => 'PhrictionNewController', 'move/(?P[1-9]\d*)/' => 'PhrictionMoveController', 'preview/' => 'PhabricatorMarkupPreviewController', 'diff/(?P[1-9]\d*)/' => 'PhrictionDiffController', ), ); } public function getApplicationOrder() { return 0.140; } } diff --git a/src/applications/ponder/application/PhabricatorPonderApplication.php b/src/applications/ponder/application/PhabricatorPonderApplication.php index 2122fbc181..a23a370d60 100644 --- a/src/applications/ponder/application/PhabricatorPonderApplication.php +++ b/src/applications/ponder/application/PhabricatorPonderApplication.php @@ -1,73 +1,69 @@ [1-9]\d*)' => 'PonderQuestionViewController', '/ponder/' => array( '(?:query/(?P[^/]+)/)?' => 'PonderQuestionListController', 'answer/add/' => 'PonderAnswerSaveController', 'answer/edit/(?P\d+)/' => 'PonderAnswerEditController', 'answer/comment/(?P\d+)/' => 'PonderAnswerCommentController', 'answer/history/(?P\d+)/' => 'PonderAnswerHistoryController', 'question/edit/(?:(?P\d+)/)?' => 'PonderQuestionEditController', 'question/comment/(?P\d+)/' => 'PonderQuestionCommentController', 'question/history/(?P\d+)/' => 'PonderQuestionHistoryController', 'preview/' => 'PhabricatorMarkupPreviewController', 'question/(?Popen|close)/(?P[1-9]\d*)/' => 'PonderQuestionStatusController', 'vote/' => 'PonderVoteSaveController', ), ); } } diff --git a/src/applications/project/application/PhabricatorProjectApplication.php b/src/applications/project/application/PhabricatorProjectApplication.php index 0dd6983181..7f874da3be 100644 --- a/src/applications/project/application/PhabricatorProjectApplication.php +++ b/src/applications/project/application/PhabricatorProjectApplication.php @@ -1,140 +1,136 @@ array( '(?:query/(?P[^/]+)/)?' => 'PhabricatorProjectListController', 'filter/(?P[^/]+)/' => 'PhabricatorProjectListController', 'details/(?P[1-9]\d*)/' => 'PhabricatorProjectEditDetailsController', 'archive/(?P[1-9]\d*)/' => 'PhabricatorProjectArchiveController', 'members/(?P[1-9]\d*)/' => 'PhabricatorProjectMembersEditController', 'members/(?P[1-9]\d*)/remove/' => 'PhabricatorProjectMembersRemoveController', 'profile/(?P[1-9]\d*)/' => 'PhabricatorProjectProfileController', 'feed/(?P[1-9]\d*)/' => 'PhabricatorProjectFeedController', 'view/(?P[1-9]\d*)/' => 'PhabricatorProjectViewController', 'picture/(?P[1-9]\d*)/' => 'PhabricatorProjectEditPictureController', 'icon/(?P[1-9]\d*)/' => 'PhabricatorProjectEditIconController', 'icon/' => 'PhabricatorProjectEditIconController', 'create/' => 'PhabricatorProjectEditDetailsController', 'board/(?P[1-9]\d*)/'. '(?Pfilter/)?'. '(?:query/(?P[^/]+)/)?' => 'PhabricatorProjectBoardViewController', 'move/(?P[1-9]\d*)/' => 'PhabricatorProjectMoveController', 'board/(?P[1-9]\d*)/' => array( 'edit/(?:(?P\d+)/)?' => 'PhabricatorProjectColumnEditController', 'hide/(?:(?P\d+)/)?' => 'PhabricatorProjectColumnHideController', 'column/(?:(?P\d+)/)?' => 'PhabricatorProjectColumnDetailController', 'import/' => 'PhabricatorProjectBoardImportController', 'reorder/' => 'PhabricatorProjectBoardReorderController', ), 'update/(?P[1-9]\d*)/(?P[^/]+)/' => 'PhabricatorProjectUpdateController', 'history/(?P[1-9]\d*)/' => 'PhabricatorProjectHistoryController', '(?Pwatch|unwatch)/(?P[1-9]\d*)/' => 'PhabricatorProjectWatchController', ), '/tag/' => array( '(?P[^/]+)/' => 'PhabricatorProjectViewController', '(?P[^/]+)/board/' => 'PhabricatorProjectBoardViewController', ), ); } public function getQuickCreateItems(PhabricatorUser $viewer) { $can_create = PhabricatorPolicyFilter::hasCapability( $viewer, $this, ProjectCreateProjectsCapability::CAPABILITY); $items = array(); if ($can_create) { $item = id(new PHUIListItemView()) ->setName(pht('Project')) ->setIcon('fa-briefcase') ->setHref($this->getBaseURI().'create/'); $items[] = $item; } return $items; } protected function getCustomCapabilities() { return array( ProjectCreateProjectsCapability::CAPABILITY => array(), ProjectCanLockProjectsCapability::CAPABILITY => array( 'default' => PhabricatorPolicies::POLICY_ADMIN, ), ProjectDefaultViewCapability::CAPABILITY => array( 'caption' => pht( 'Default view policy for newly created projects.'), ), ProjectDefaultEditCapability::CAPABILITY => array( 'caption' => pht( 'Default edit policy for newly created projects.'), ), ProjectDefaultJoinCapability::CAPABILITY => array( 'caption' => pht( 'Default join policy for newly created projects.'), ), ); } } diff --git a/src/applications/releeph/application/PhabricatorReleephApplication.php b/src/applications/releeph/application/PhabricatorReleephApplication.php index b9d4ff3d23..064aaea6a6 100644 --- a/src/applications/releeph/application/PhabricatorReleephApplication.php +++ b/src/applications/releeph/application/PhabricatorReleephApplication.php @@ -1,85 +1,81 @@ [1-9]\d*)' => 'ReleephRequestViewController', // TODO: Remove these older routes eventually. '/RQ(?P[1-9]\d*)' => 'ReleephRequestViewController', '/releeph/request/(?P[1-9]\d*)/' => 'ReleephRequestViewController', '/releeph/' => array( '' => 'ReleephProductListController', '(?:product|project)/' => array( '(?:query/(?P[^/]+)/)?' => 'ReleephProductListController', 'create/' => 'ReleephProductCreateController', '(?P[1-9]\d*)/' => array( '(?:query/(?P[^/]+)/)?' => 'ReleephProductViewController', 'edit/' => 'ReleephProductEditController', 'cutbranch/' => 'ReleephBranchCreateController', 'action/(?P.+)/' => 'ReleephProductActionController', 'history/' => 'ReleephProductHistoryController', ), ), 'branch/' => array( 'edit/(?P[1-9]\d*)/' => 'ReleephBranchEditController', '(?Pclose|re-open)/(?P[1-9]\d*)/' => 'ReleephBranchAccessController', 'preview/' => 'ReleephBranchNamePreviewController', '(?P[1-9]\d*)/' => array( 'history/' => 'ReleephBranchHistoryController', '(?:query/(?P[^/]+)/)?' => 'ReleephBranchViewController', ), 'pull/(?P[1-9]\d*)/' => 'ReleephRequestEditController', ), 'request/' => array( 'create/' => 'ReleephRequestEditController', 'differentialcreate/' => array( 'D(?P[1-9]\d*)' => 'ReleephRequestDifferentialCreateController', ), 'edit/(?P[1-9]\d*)/' => 'ReleephRequestEditController', 'action/(?P.+)/(?P[1-9]\d*)/' => 'ReleephRequestActionController', 'typeahead/' => 'ReleephRequestTypeaheadController', 'comment/(?P[1-9]\d*)/' => 'ReleephRequestCommentController', ), ), ); } } diff --git a/src/applications/repository/application/PhabricatorRepositoriesApplication.php b/src/applications/repository/application/PhabricatorRepositoriesApplication.php index 66568e882f..534db063e7 100644 --- a/src/applications/repository/application/PhabricatorRepositoriesApplication.php +++ b/src/applications/repository/application/PhabricatorRepositoriesApplication.php @@ -1,45 +1,41 @@ array( '' => 'PhabricatorRepositoryListController', 'project/edit/(?P[1-9]\d*)/' => 'PhabricatorRepositoryArcanistProjectEditController', 'project/delete/(?P[1-9]\d*)/' => 'PhabricatorRepositoryArcanistProjectDeleteController', ), ); } } diff --git a/src/applications/search/application/PhabricatorSearchApplication.php b/src/applications/search/application/PhabricatorSearchApplication.php index cdb3835556..51d5e9780c 100644 --- a/src/applications/search/application/PhabricatorSearchApplication.php +++ b/src/applications/search/application/PhabricatorSearchApplication.php @@ -1,52 +1,48 @@ array( '(?:query/(?P[^/]+)/)?' => 'PhabricatorSearchController', 'attach/(?P[^/]+)/(?P\w+)/(?:(?P\w+)/)?' => 'PhabricatorSearchAttachController', 'select/(?P\w+)/' => 'PhabricatorSearchSelectController', 'index/(?P[^/]+)/' => 'PhabricatorSearchIndexController', 'hovercard/(?Pretrieve|test)/' => 'PhabricatorSearchHovercardController', 'edit/(?P[^/]+)/' => 'PhabricatorSearchEditController', 'delete/(?P[^/]+)/(?P[^/]+)/' => 'PhabricatorSearchDeleteController', 'order/(?P[^/]+)/' => 'PhabricatorSearchOrderController', ), ); } } diff --git a/src/applications/settings/application/PhabricatorSettingsApplication.php b/src/applications/settings/application/PhabricatorSettingsApplication.php index b7b809d977..da0daf65d2 100644 --- a/src/applications/settings/application/PhabricatorSettingsApplication.php +++ b/src/applications/settings/application/PhabricatorSettingsApplication.php @@ -1,69 +1,65 @@ array( '(?:(?P\d+)/)?(?:panel/(?P[^/]+)/)?' => 'PhabricatorSettingsMainController', 'adjust/' => 'PhabricatorSettingsAdjustController', ), ); } public function getApplicationGroup() { return self::GROUP_UTILITIES; } public function buildMainMenuItems( PhabricatorUser $user, PhabricatorController $controller = null) { $items = array(); if ($user->isLoggedIn() && $user->isUserActivated()) { $selected = ($controller instanceof PhabricatorSettingsMainController); $item = id(new PHUIListItemView()) ->setName(pht('Settings')) ->setIcon('fa-wrench') ->addClass('core-menu-item') ->setSelected($selected) ->setHref('/settings/') ->setAural(pht('Settings')) ->setOrder(400); $items[] = $item; } return $items; } } diff --git a/src/applications/slowvote/application/PhabricatorSlowvoteApplication.php b/src/applications/slowvote/application/PhabricatorSlowvoteApplication.php index b5cdf31f06..9114b0ea89 100644 --- a/src/applications/slowvote/application/PhabricatorSlowvoteApplication.php +++ b/src/applications/slowvote/application/PhabricatorSlowvoteApplication.php @@ -1,70 +1,66 @@ [1-9]\d*)' => 'PhabricatorSlowvotePollController', '/vote/' => array( '(?:query/(?P[^/]+)/)?' => 'PhabricatorSlowvoteListController', 'create/' => 'PhabricatorSlowvoteEditController', 'edit/(?P[1-9]\d*)/' => 'PhabricatorSlowvoteEditController', '(?P[1-9]\d*)/' => 'PhabricatorSlowvoteVoteController', 'comment/(?P[1-9]\d*)/' => 'PhabricatorSlowvoteCommentController', 'close/(?P[1-9]\d*)/' => 'PhabricatorSlowvoteCloseController', ), ); } protected function getCustomCapabilities() { return array( PhabricatorSlowvoteDefaultViewCapability::CAPABILITY => array( 'caption' => pht('Default view policy for new polls.'), ), ); } } diff --git a/src/applications/tokens/application/PhabricatorTokensApplication.php b/src/applications/tokens/application/PhabricatorTokensApplication.php index f8682e3143..4462d1a132 100644 --- a/src/applications/tokens/application/PhabricatorTokensApplication.php +++ b/src/applications/tokens/application/PhabricatorTokensApplication.php @@ -1,50 +1,46 @@ array( '' => 'PhabricatorTokenGivenController', 'given/' => 'PhabricatorTokenGivenController', 'give/(?[^/]+)/' => 'PhabricatorTokenGiveController', 'leaders/' => 'PhabricatorTokenLeaderController', ), ); } public function getEventListeners() { return array( new PhabricatorTokenUIEventListener(), ); } } diff --git a/src/applications/uiexample/application/PhabricatorUIExamplesApplication.php b/src/applications/uiexample/application/PhabricatorUIExamplesApplication.php index ebc9703039..c347a101e9 100644 --- a/src/applications/uiexample/application/PhabricatorUIExamplesApplication.php +++ b/src/applications/uiexample/application/PhabricatorUIExamplesApplication.php @@ -1,50 +1,46 @@ array( '' => 'PhabricatorUIExampleRenderController', 'view/(?P[^/]+)/' => 'PhabricatorUIExampleRenderController', ), ); } } diff --git a/src/applications/xhprof/application/PhabricatorXHProfApplication.php b/src/applications/xhprof/application/PhabricatorXHProfApplication.php index cb30ca2405..ad480a821a 100644 --- a/src/applications/xhprof/application/PhabricatorXHProfApplication.php +++ b/src/applications/xhprof/application/PhabricatorXHProfApplication.php @@ -1,43 +1,39 @@ array( '' => 'PhabricatorXHProfSampleListController', 'list/(?P[^/]+)/' => 'PhabricatorXHProfSampleListController', 'profile/(?P[^/]+)/' => 'PhabricatorXHProfProfileController', ), ); } }