@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add a motivational profile menu panel

Summary: Motivate your employees with inspirational quotes. A new quote every day!

Test Plan: So inspirational.

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D15026

+171 -4
+3 -3
resources/celerity/map.php
··· 7 7 */ 8 8 return array( 9 9 'names' => array( 10 - 'core.pkg.css' => '30316566', 10 + 'core.pkg.css' => '3a97c8b9', 11 11 'core.pkg.js' => '1f5f365a', 12 12 'darkconsole.pkg.js' => 'e7393ebb', 13 13 'differential.pkg.css' => '2de124c9', ··· 143 143 'rsrc/css/phui/phui-object-item-list-view.css' => '26c30d3f', 144 144 'rsrc/css/phui/phui-pager.css' => 'bea33d23', 145 145 'rsrc/css/phui/phui-pinboard-view.css' => '2495140e', 146 - 'rsrc/css/phui/phui-profile-menu.css' => '05546270', 146 + 'rsrc/css/phui/phui-profile-menu.css' => 'e8030bb3', 147 147 'rsrc/css/phui/phui-property-list-view.css' => '27b2849e', 148 148 'rsrc/css/phui/phui-remarkup-preview.css' => '1a8f2591', 149 149 'rsrc/css/phui/phui-spacing.css' => '042804d6', ··· 822 822 'phui-object-item-list-view-css' => '26c30d3f', 823 823 'phui-pager-css' => 'bea33d23', 824 824 'phui-pinboard-view-css' => '2495140e', 825 - 'phui-profile-menu-css' => '05546270', 825 + 'phui-profile-menu-css' => 'e8030bb3', 826 826 'phui-property-list-view-css' => '27b2849e', 827 827 'phui-remarkup-preview-css' => '1a8f2591', 828 828 'phui-spacing-css' => '042804d6',
+2
src/__phutil_library_map__.php
··· 2552 2552 'PhabricatorMetaMTASendGridReceiveController' => 'applications/metamta/controller/PhabricatorMetaMTASendGridReceiveController.php', 2553 2553 'PhabricatorMetaMTAWorker' => 'applications/metamta/PhabricatorMetaMTAWorker.php', 2554 2554 'PhabricatorMetronomicTriggerClock' => 'infrastructure/daemon/workers/clock/PhabricatorMetronomicTriggerClock.php', 2555 + 'PhabricatorMotivatorProfilePanel' => 'applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php', 2555 2556 'PhabricatorMultiColumnUIExample' => 'applications/uiexample/examples/PhabricatorMultiColumnUIExample.php', 2556 2557 'PhabricatorMultiFactorSettingsPanel' => 'applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php', 2557 2558 'PhabricatorMultimeterApplication' => 'applications/multimeter/application/PhabricatorMultimeterApplication.php', ··· 6863 6864 'PhabricatorMetaMTASendGridReceiveController' => 'PhabricatorMetaMTAController', 6864 6865 'PhabricatorMetaMTAWorker' => 'PhabricatorWorker', 6865 6866 'PhabricatorMetronomicTriggerClock' => 'PhabricatorTriggerClock', 6867 + 'PhabricatorMotivatorProfilePanel' => 'PhabricatorProfilePanel', 6866 6868 'PhabricatorMultiColumnUIExample' => 'PhabricatorUIExample', 6867 6869 'PhabricatorMultiFactorSettingsPanel' => 'PhabricatorSettingsPanel', 6868 6870 'PhabricatorMultimeterApplication' => 'PhabricatorApplication',
+151
src/applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php
··· 1 + <?php 2 + 3 + final class PhabricatorMotivatorProfilePanel 4 + extends PhabricatorProfilePanel { 5 + 6 + const PANELKEY = 'motivator'; 7 + 8 + public function getPanelTypeIcon() { 9 + return 'fa-coffee'; 10 + } 11 + 12 + public function getPanelTypeName() { 13 + return pht('Motivator'); 14 + } 15 + 16 + public function canAddToObject($object) { 17 + return true; 18 + } 19 + 20 + public function getDisplayName( 21 + PhabricatorProfilePanelConfiguration $config) { 22 + 23 + $options = $this->getOptions(); 24 + $name = idx($options, $config->getPanelProperty('source')); 25 + if ($name !== null) { 26 + return pht('Motivator: %s', $name); 27 + } else { 28 + return pht('Motivator'); 29 + } 30 + } 31 + 32 + public function buildEditEngineFields( 33 + PhabricatorProfilePanelConfiguration $config) { 34 + return array( 35 + id(new PhabricatorInstructionsEditField()) 36 + ->setValue( 37 + pht( 38 + 'Motivate your team with inspirational quotes from great minds. '. 39 + 'This panel shows a new quote every day.')), 40 + id(new PhabricatorSelectEditField()) 41 + ->setKey('source') 42 + ->setLabel(pht('Source')) 43 + ->setOptions($this->getOptions()), 44 + ); 45 + } 46 + 47 + private function getOptions() { 48 + return array( 49 + 'catfacts' => pht('Cat Facts'), 50 + ); 51 + } 52 + 53 + protected function newNavigationMenuItems( 54 + PhabricatorProfilePanelConfiguration $config) { 55 + 56 + $source = $config->getPanelProperty('source'); 57 + 58 + switch ($source) { 59 + case 'catfacts': 60 + default: 61 + $facts = $this->getCatFacts(); 62 + break; 63 + } 64 + 65 + $fact = $this->selectFact($facts); 66 + 67 + switch ($source) { 68 + case 'catfacts': 69 + default: 70 + $fact = array( 71 + id(new PHUIIconView())->setIconFont('fa-paw'), 72 + ' ', 73 + $fact, 74 + ); 75 + break; 76 + } 77 + 78 + $fact = phutil_tag( 79 + 'div', 80 + array( 81 + 'class' => 'phui-motivator', 82 + ), 83 + $fact); 84 + 85 + $item = $this->newItem() 86 + ->appendChild($fact); 87 + 88 + return array( 89 + $item, 90 + ); 91 + } 92 + 93 + private function getCatFacts() { 94 + return array( 95 + pht('Cats purr when they are happy, upset, or asleep.'), 96 + pht('The first cats evolved on the savanah about 8,000 years ago.'), 97 + pht( 98 + 'Cats have a tail, two feet, between one and three ears, and two '. 99 + 'other feet.'), 100 + pht('Cats use their keen sense of smell to avoid feeling empathy.'), 101 + pht('The first cats evolved in swamps about 65 years ago.'), 102 + pht( 103 + 'You can tell how warm a cat is by examining the coloration: cooler '. 104 + 'areas are darker.'), 105 + pht( 106 + 'Cat tails are flexible because they contain thousands of tiny '. 107 + 'bones.'), 108 + pht( 109 + 'A cattail is a wetland plant with an appearance that resembles '. 110 + 'the tail of a cat.'), 111 + pht( 112 + 'Cats must eat a diet rich in fish to replace the tiny bones in '. 113 + 'their tails.'), 114 + pht('Cats are stealthy predators and nearly invisible to radar.'), 115 + pht( 116 + 'Cats use a special type of magnetism to help them land on their '. 117 + 'feet.'), 118 + pht( 119 + 'A cat can run seven times faster than a human, but only for a '. 120 + 'short distance.'), 121 + pht( 122 + 'The largest recorded cat was nearly 11 inches long from nose to '. 123 + 'tail.'), 124 + pht( 125 + 'Not all cats can retract their claws, but most of them can.'), 126 + pht( 127 + 'In the wild, cats and racooons sometimes hunt together in packs.'), 128 + pht( 129 + 'The Spanish word for cat is "cato". The biggest cat is called '. 130 + '"el cato".'), 131 + pht( 132 + 'The Japanese word for cat is "kome", which is also the word for '. 133 + 'rice. Japanese cats love to eat rice, so the two are synonymous.'), 134 + ); 135 + } 136 + 137 + private function selectFact(array $facts) { 138 + // This is a simple pseudorandom number generator that avoids touching 139 + // srand(), because it would seed it to a highly predictable value. It 140 + // selects a new fact every day. 141 + 142 + $seed = ((int)date('Y') * 366) + (int)date('z'); 143 + for ($ii = 0; $ii < 32; $ii++) { 144 + $seed = ((1664525 * $seed) + 1013904223) % (1 << 31); 145 + } 146 + 147 + return $facts[$seed % count($facts)]; 148 + } 149 + 150 + 151 + }
+15 -1
webroot/rsrc/css/phui/phui-profile-menu.css
··· 48 48 } 49 49 50 50 .phui-profile-menu .phabricator-side-menu .phui-list-item-icon, 51 - .phui-profile-menu .phabricator-side-menu .phui-icon-view { 51 + .phui-profile-menu .phabricator-side-menu 52 + .phui-list-item-href .phui-icon-view { 52 53 position: absolute; 53 54 left: 13px; 54 55 top: 12px; ··· 91 92 margin: 4px 0; 92 93 border-bottom: 1px solid rgba(0, 0, 0, 0.200); 93 94 } 95 + 96 + .phui-profile-menu .phabricator-side-menu .phui-motivator { 97 + white-space: normal; 98 + padding: 18px 15px; 99 + font-size: 12px; 100 + color: {$menu.profile.text}; 101 + } 102 + 103 + .phui-profile-menu .phabricator-side-menu .phui-motivator .phui-icon-view { 104 + position: static; 105 + font-size: 12px; 106 + color: {$menu.profile.text}; 107 + }