mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-11 17:32:41 +01:00
6270114767
Summary: - Removed trailing newlines. - Added newline at EOF. - Removed leading newlines. - Trimmed trailing whitespace. - Spelling fix. - Added newline at EOF Test Plan: N/A Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley CC: hach-que, chad, Korvin, epriestley, aran Differential Revision: https://secure.phabricator.com/D8344
70 lines
2 KiB
PHP
70 lines
2 KiB
PHP
<?php
|
|
|
|
final class PhabricatorSettingsPanelDiffPreferences
|
|
extends PhabricatorSettingsPanel {
|
|
|
|
public function getPanelKey() {
|
|
return 'diff';
|
|
}
|
|
|
|
public function getPanelName() {
|
|
return pht('Diff Preferences');
|
|
}
|
|
|
|
public function getPanelGroup() {
|
|
return pht('Application Settings');
|
|
}
|
|
|
|
public function processRequest(AphrontRequest $request) {
|
|
$user = $request->getUser();
|
|
$preferences = $user->loadPreferences();
|
|
|
|
$pref_filetree = PhabricatorUserPreferences::PREFERENCE_DIFF_FILETREE;
|
|
|
|
if ($request->isFormPost()) {
|
|
$filetree = $request->getInt($pref_filetree);
|
|
|
|
if ($filetree && !$preferences->getPreference($pref_filetree)) {
|
|
$preferences->setPreference(
|
|
PhabricatorUserPreferences::PREFERENCE_NAV_COLLAPSED,
|
|
false);
|
|
}
|
|
|
|
$preferences->setPreference($pref_filetree, $filetree);
|
|
|
|
$preferences->save();
|
|
return id(new AphrontRedirectResponse())
|
|
->setURI($this->getPanelURI('?saved=true'));
|
|
}
|
|
|
|
$form = id(new AphrontFormView())
|
|
->setUser($user)
|
|
->appendChild(
|
|
id(new AphrontFormSelectControl())
|
|
->setLabel(pht('Show Filetree'))
|
|
->setName($pref_filetree)
|
|
->setValue($preferences->getPreference($pref_filetree))
|
|
->setOptions(
|
|
array(
|
|
0 => pht('Disable Filetree'),
|
|
1 => pht('Enable Filetree'),
|
|
))
|
|
->setCaption(
|
|
pht("When looking at a revision or commit, enable a sidebar ".
|
|
"showing affected files. You can press %s to show or hide ".
|
|
"the sidebar.",
|
|
phutil_tag('tt', array(), 'f'))))
|
|
->appendChild(
|
|
id(new AphrontFormSubmitControl())
|
|
->setValue(pht('Save Preferences')));
|
|
|
|
$form_box = id(new PHUIObjectBoxView())
|
|
->setHeaderText(pht('Diff Preferences'))
|
|
->setFormSaved($request->getBool('saved'))
|
|
->setForm($form);
|
|
|
|
return array(
|
|
$form_box,
|
|
);
|
|
}
|
|
}
|