[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorSettingsPanelDeveloperPreferences 4 extends PhabricatorSettingsPanel { 5 6 public function getPanelKey() { 7 return 'developer'; 8 } 9 10 public function getPanelName() { 11 return pht('Developer Settings'); 12 } 13 14 public function getPanelGroup() { 15 return pht('Developer'); 16 } 17 18 public function processRequest(AphrontRequest $request) { 19 $user = $request->getUser(); 20 $preferences = $user->loadPreferences(); 21 22 $pref_dark_console = PhabricatorUserPreferences::PREFERENCE_DARK_CONSOLE; 23 24 $dark_console_value = $preferences->getPreference($pref_dark_console); 25 26 if ($request->isFormPost()) { 27 $new_dark_console = $request->getBool($pref_dark_console); 28 $preferences->setPreference($pref_dark_console, $new_dark_console); 29 30 // If the user turned Dark Console on, enable it (as though they had hit 31 // "`"). 32 if ($new_dark_console && !$dark_console_value) { 33 $user->setConsoleVisible(true); 34 $user->save(); 35 } 36 37 $preferences->save(); 38 39 return id(new AphrontRedirectResponse()) 40 ->setURI($this->getPanelURI('?saved=true')); 41 } 42 43 $is_console_enabled = PhabricatorEnv::getEnvConfig('darkconsole.enabled'); 44 45 $preamble = pht( 46 '**DarkConsole** is a developer console which can help build and '. 47 'debug Phabricator applications. It includes tools for understanding '. 48 'errors, performance, service calls, and other low-level aspects of '. 49 'Phabricator\'s inner workings.'); 50 51 if ($is_console_enabled) { 52 $instructions = pht( 53 "%s\n\n". 54 'You can enable it for your account below. Enabling DarkConsole will '. 55 'slightly decrease performance, but give you access to debugging '. 56 'tools. You may want to disable it again later if you only need it '. 57 'temporarily.'. 58 "\n\n". 59 'NOTE: After enabling DarkConsole, **press the ##`## key on your '. 60 'keyboard** to show or hide it.', 61 $preamble); 62 } else { 63 $instructions = pht( 64 "%s\n\n". 65 'Before you can turn on DarkConsole, it needs to be enabled in '. 66 'the configuration for this install (`darkconsole.enabled`).', 67 $preamble); 68 } 69 70 $form = id(new AphrontFormView()) 71 ->setUser($user) 72 ->appendRemarkupInstructions($instructions) 73 ->appendChild( 74 id(new AphrontFormSelectControl()) 75 ->setLabel(pht('Dark Console')) 76 ->setName($pref_dark_console) 77 ->setValue($dark_console_value) 78 ->setOptions( 79 array( 80 0 => pht('Disable DarkConsole'), 81 1 => pht('Enable DarkConsole'), 82 )) 83 ->setDisabled(!$is_console_enabled)) 84 ->appendChild( 85 id(new AphrontFormSubmitControl()) 86 ->setValue(pht('Save Preferences'))); 87 88 $form_box = id(new PHUIObjectBoxView()) 89 ->setHeaderText(pht('Developer Settings')) 90 ->setFormSaved($request->getBool('saved')) 91 ->setForm($form); 92 93 return array( 94 $form_box, 95 ); 96 } 97 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |