@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 back the motivator panel

Summary: Fixes T12226, Ref D17233. Resurrects the motivator panel.

Test Plan: Add panel, see fact on hover.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: yelirekim, jcox, Korvin

Maniphest Tasks: T12226

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

+162
+2
src/__phutil_library_map__.php
··· 3029 3029 'PhabricatorModularTransactionType' => 'applications/transactions/storage/PhabricatorModularTransactionType.php', 3030 3030 'PhabricatorMonospacedFontSetting' => 'applications/settings/setting/PhabricatorMonospacedFontSetting.php', 3031 3031 'PhabricatorMonospacedTextareasSetting' => 'applications/settings/setting/PhabricatorMonospacedTextareasSetting.php', 3032 + 'PhabricatorMotivatorProfileMenuItem' => 'applications/search/menuitem/PhabricatorMotivatorProfileMenuItem.php', 3032 3033 'PhabricatorMultiColumnUIExample' => 'applications/uiexample/examples/PhabricatorMultiColumnUIExample.php', 3033 3034 'PhabricatorMultiFactorSettingsPanel' => 'applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php', 3034 3035 'PhabricatorMultimeterApplication' => 'applications/multimeter/application/PhabricatorMultimeterApplication.php', ··· 8099 8100 'PhabricatorModularTransactionType' => 'Phobject', 8100 8101 'PhabricatorMonospacedFontSetting' => 'PhabricatorStringSetting', 8101 8102 'PhabricatorMonospacedTextareasSetting' => 'PhabricatorSelectSetting', 8103 + 'PhabricatorMotivatorProfileMenuItem' => 'PhabricatorProfileMenuItem', 8102 8104 'PhabricatorMultiColumnUIExample' => 'PhabricatorUIExample', 8103 8105 'PhabricatorMultiFactorSettingsPanel' => 'PhabricatorSettingsPanel', 8104 8106 'PhabricatorMultimeterApplication' => 'PhabricatorApplication',
+160
src/applications/search/menuitem/PhabricatorMotivatorProfileMenuItem.php
··· 1 + <?php 2 + 3 + final class PhabricatorMotivatorProfileMenuItem 4 + extends PhabricatorProfileMenuItem { 5 + 6 + const MENUITEMKEY = 'motivator'; 7 + 8 + public function getMenuItemTypeIcon() { 9 + return 'fa-coffee'; 10 + } 11 + 12 + public function getMenuItemTypeName() { 13 + return pht('Motivator'); 14 + } 15 + 16 + public function canAddToObject($object) { 17 + return ($object instanceof PhabricatorHomeApplication); 18 + } 19 + 20 + public function getDisplayName( 21 + PhabricatorProfileMenuItemConfiguration $config) { 22 + 23 + $options = $this->getOptions(); 24 + $name = idx($options, $config->getMenuItemProperty('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 + PhabricatorProfileMenuItemConfiguration $config) { 34 + return array( 35 + id(new PhabricatorInstructionsEditField()) 36 + ->setValue( 37 + pht( 38 + 'Motivate your team with inspirational quotes from great minds. '. 39 + 'This menu item 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 + PhabricatorProfileMenuItemConfiguration $config) { 55 + 56 + $source = $config->getMenuItemProperty('source'); 57 + 58 + switch ($source) { 59 + case 'catfacts': 60 + default: 61 + $facts = $this->getCatFacts(); 62 + $fact_name = pht('Cat Facts'); 63 + $fact_icon = 'fa-paw'; 64 + break; 65 + } 66 + 67 + $fact_text = $this->selectFact($facts); 68 + 69 + $item = $this->newItem() 70 + ->setName($fact_name) 71 + ->setIcon($fact_icon) 72 + ->setTooltip($fact_text) 73 + ->setHref('#'); 74 + 75 + return array( 76 + $item, 77 + ); 78 + } 79 + 80 + private function getCatFacts() { 81 + return array( 82 + pht('Cats purr when they are happy, upset, or asleep.'), 83 + pht('The first cats evolved on the savanah about 8,000 years ago.'), 84 + pht( 85 + 'Cats have a tail, two feet, between one and three ears, and two '. 86 + 'other feet.'), 87 + pht('Cats use their keen sense of smell to avoid feeling empathy.'), 88 + pht('The first cats evolved in swamps about 65 years ago.'), 89 + pht( 90 + 'You can tell how warm a cat is by examining the coloration: cooler '. 91 + 'areas are darker.'), 92 + pht( 93 + 'Cat tails are flexible because they contain thousands of tiny '. 94 + 'bones.'), 95 + pht( 96 + 'A cattail is a wetland plant with an appearance that resembles '. 97 + 'the tail of a cat.'), 98 + pht( 99 + 'Cats must eat a diet rich in fish to replace the tiny bones in '. 100 + 'their tails.'), 101 + pht('Cats are stealthy predators and nearly invisible to radar.'), 102 + pht( 103 + 'Cats use a special type of magnetism to help them land on their '. 104 + 'feet.'), 105 + pht( 106 + 'A cat can run seven times faster than a human, but only for a '. 107 + 'short distance.'), 108 + pht( 109 + 'The largest recorded cat was nearly 11 inches long from nose to '. 110 + 'tail.'), 111 + pht( 112 + 'Not all cats can retract their claws, but most of them can.'), 113 + pht( 114 + 'In the wild, cats and racoons sometimes hunt together in packs.'), 115 + pht( 116 + 'The Spanish word for cat is "cato". The biggest cat is called '. 117 + '"el cato".'), 118 + pht( 119 + 'The Japanese word for cat is "kome", which is also the word for '. 120 + 'rice. Japanese cats love to eat rice, so the two are synonymous.'), 121 + pht('Cats have five pointy ends.'), 122 + pht('cat -A can find mice hiding in files.'), 123 + pht('A cat\'s visual, olfactory, and auditory senses, '. 124 + 'Contribute to their hunting skills and natural defenses.'), 125 + pht( 126 + 'Cats with high self-esteem seek out high perches '. 127 + 'to launch their attacks. Watch out!'), 128 + pht('Cats prefer vanilla ice cream.'), 129 + pht('Taco cat spelled backwards is taco cat.'), 130 + pht( 131 + 'Cats will often bring you their prey because they feel sorry '. 132 + 'for your inability to hunt.'), 133 + pht('Cats spend most of their time plotting to kill their owner.'), 134 + pht('Outside of the CAT scan, cats have made almost no contributions '. 135 + 'to modern medicine.'), 136 + pht('In ancient Egypt, the cat-god Horus watched over all cats.'), 137 + pht('The word "catastrophe" has no etymological relationship to the '. 138 + 'word "cat".'), 139 + pht('Many cats appear black in low light, suffering a -2 modifier to '. 140 + 'luck rolls.'), 141 + pht('The popular trivia game "World of Warcraft" features a race of '. 142 + 'cat people called the Khajiit.'), 143 + ); 144 + } 145 + 146 + private function selectFact(array $facts) { 147 + // This is a simple pseudorandom number generator that avoids touching 148 + // srand(), because it would seed it to a highly predictable value. It 149 + // selects a new fact every day. 150 + 151 + $seed = ((int)date('Y') * 366) + (int)date('z'); 152 + for ($ii = 0; $ii < 32; $ii++) { 153 + $seed = ((1664525 * $seed) + 1013904223) % (1 << 31); 154 + } 155 + 156 + return $facts[$seed % count($facts)]; 157 + } 158 + 159 + 160 + }