diff --git a/src/applications/differential/view/DifferentialAddCommentView.php b/src/applications/differential/view/DifferentialAddCommentView.php index 0273432033..095f695d7e 100644 --- a/src/applications/differential/view/DifferentialAddCommentView.php +++ b/src/applications/differential/view/DifferentialAddCommentView.php @@ -118,7 +118,8 @@ final class DifferentialAddCommentView extends AphrontView { ->setName('comment') ->setID('comment-content') ->setLabel('Comment') - ->setValue($this->draft ? $this->draft->getDraft() : null)) + ->setValue($this->draft ? $this->draft->getDraft() : null) + ->setUser($this->user)) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue($is_serious ? 'Submit' : 'Clowncopterize')); diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php index d35eae1630..8eb90f7bb3 100644 --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -575,7 +575,8 @@ final class DiffusionCommitController extends DiffusionController { ->setLabel('Comments') ->setName('content') ->setValue($draft) - ->setID('audit-content')) + ->setID('audit-content') + ->setUser($user)) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue($is_serious ? 'Submit' : 'Cook the Books')); diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php index deb9cd12db..eabdfd6278 100644 --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -415,7 +415,8 @@ final class ManiphestTaskDetailController extends ManiphestController { ->setLabel('Comments') ->setName('comments') ->setValue($draft_text) - ->setID('transaction-comments')) + ->setID('transaction-comments') + ->setUser($user)) ->appendChild( id(new AphrontFormDragAndDropUploadControl()) ->setLabel('Attached Files') diff --git a/src/applications/maniphest/controller/ManiphestTaskEditController.php b/src/applications/maniphest/controller/ManiphestTaskEditController.php index cfb4733012..f00f8a2e70 100644 --- a/src/applications/maniphest/controller/ManiphestTaskEditController.php +++ b/src/applications/maniphest/controller/ManiphestTaskEditController.php @@ -487,7 +487,8 @@ final class ManiphestTaskEditController extends ManiphestController { ->setLabel('Description') ->setName('description') ->setID('description-textarea') - ->setValue($task->getDescription()); + ->setValue($task->getDescription()) + ->setUser($user); $form ->appendChild($description_control); diff --git a/src/applications/phame/controller/blog/PhameBlogEditController.php b/src/applications/phame/controller/blog/PhameBlogEditController.php index 4784b989ad..d043b147a2 100644 --- a/src/applications/phame/controller/blog/PhameBlogEditController.php +++ b/src/applications/phame/controller/blog/PhameBlogEditController.php @@ -122,7 +122,7 @@ final class PhameBlogEditController ->setName('description') ->setValue($blog->getDescription()) ->setID('blog-description') - ) + ->setUser($user)) ->appendChild( id(new AphrontFormPolicyControl()) ->setUser($user) diff --git a/src/applications/phame/controller/post/PhamePostEditController.php b/src/applications/phame/controller/post/PhamePostEditController.php index e5906a4e6f..2f16595716 100644 --- a/src/applications/phame/controller/post/PhamePostEditController.php +++ b/src/applications/phame/controller/post/PhamePostEditController.php @@ -132,6 +132,7 @@ final class PhamePostEditController ->setValue($post->getBody()) ->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL) ->setID('post-body') + ->setUser($user) ) ->appendChild( id(new AphrontFormSelectControl()) diff --git a/src/applications/pholio/controller/PholioMockEditController.php b/src/applications/pholio/controller/PholioMockEditController.php index ee3b9cf2cb..da4285b39e 100644 --- a/src/applications/pholio/controller/PholioMockEditController.php +++ b/src/applications/pholio/controller/PholioMockEditController.php @@ -193,7 +193,8 @@ final class PholioMockEditController extends PholioController { id(new PhabricatorRemarkupControl()) ->setName('description') ->setValue($v_desc) - ->setLabel(pht('Description'))) + ->setLabel(pht('Description')) + ->setUser($user)) ->appendChild( id(new AphrontFormDragAndDropUploadControl($request)) ->setName('file_phids') diff --git a/src/applications/pholio/controller/PholioMockViewController.php b/src/applications/pholio/controller/PholioMockViewController.php index 8b29c7aec1..0d9b93816a 100644 --- a/src/applications/pholio/controller/PholioMockViewController.php +++ b/src/applications/pholio/controller/PholioMockViewController.php @@ -194,7 +194,8 @@ final class PholioMockViewController extends PholioController { ->appendChild( id(new PhabricatorRemarkupControl()) ->setName('comment') - ->setLabel(pht('Comment'))) + ->setLabel(pht('Comment')) + ->setUser($user)) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue($action)); diff --git a/src/applications/phriction/controller/PhrictionEditController.php b/src/applications/phriction/controller/PhrictionEditController.php index f15a466df7..e5ebe1bf11 100644 --- a/src/applications/phriction/controller/PhrictionEditController.php +++ b/src/applications/phriction/controller/PhrictionEditController.php @@ -222,7 +222,8 @@ final class PhrictionEditController ->setValue($content_text) ->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL) ->setName('content') - ->setID('document-textarea')) + ->setID('document-textarea') + ->setUser($user)) ->appendChild( id(new AphrontFormTextControl()) ->setLabel('Edit Notes') diff --git a/src/applications/ponder/controller/PonderQuestionAskController.php b/src/applications/ponder/controller/PonderQuestionAskController.php index 0a9a4dfa0b..405ce3f7c5 100644 --- a/src/applications/ponder/controller/PonderQuestionAskController.php +++ b/src/applications/ponder/controller/PonderQuestionAskController.php @@ -68,7 +68,8 @@ final class PonderQuestionAskController extends PonderController { ->setName('content') ->setID('content') ->setValue($question->getContent()) - ->setLabel(pht('Description'))) + ->setLabel(pht('Description')) + ->setUser($user)) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue('Ask Away!')); diff --git a/src/applications/ponder/view/PonderAddAnswerView.php b/src/applications/ponder/view/PonderAddAnswerView.php index fd9c4e0c40..d60f0abc06 100644 --- a/src/applications/ponder/view/PonderAddAnswerView.php +++ b/src/applications/ponder/view/PonderAddAnswerView.php @@ -44,7 +44,8 @@ final class PonderAddAnswerView extends AphrontView { ->setName('answer') ->setLabel('Answer') ->setError(true) - ->setID('answer-content')) + ->setID('answer-content') + ->setUser($this->user)) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue($is_serious ? 'Submit' : 'Make it so.')); diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php b/src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php index a27b40960b..1f6c22faf8 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php @@ -23,6 +23,8 @@ final class PhabricatorSettingsPanelDisplayPreferences $pref_editor = PhabricatorUserPreferences::PREFERENCE_EDITOR; $pref_titles = PhabricatorUserPreferences::PREFERENCE_TITLES; $pref_symbols = PhabricatorUserPreferences::PREFERENCE_DIFFUSION_SYMBOLS; + $pref_monospaced_textareas = + PhabricatorUserPreferences::PREFERENCE_MONOSPACED_TEXTAREAS; if ($request->isFormPost()) { $monospaced = $request->getStr($pref_monospaced); @@ -32,9 +34,13 @@ final class PhabricatorSettingsPanelDisplayPreferences $preferences->setPreference($pref_titles, $request->getStr($pref_titles)); $preferences->setPreference($pref_editor, $request->getStr($pref_editor)); - $preferences->setPreference($pref_symbols, + $preferences->setPreference( + $pref_symbols, $request->getStr($pref_symbols)); $preferences->setPreference($pref_monospaced, $monospaced); + $preferences->setPreference( + $pref_monospaced_textareas, + $request->getStr($pref_monospaced_textareas)); $preferences->save(); return id(new AphrontRedirectResponse()) @@ -60,6 +66,11 @@ EXAMPLE; $font_default = phutil_escape_html($font_default); $pref_symbols_value = $preferences->getPreference($pref_symbols); + $pref_monospaced_textareas_value = $preferences + ->getPreference($pref_monospaced_textareas); + if (!$pref_monospaced_textareas_value) { + $pref_monospaced_textareas_value = 'disabled'; + } $form = id(new AphrontFormView()) ->setUser($user) @@ -108,6 +119,14 @@ EXAMPLE; 'Use this setting to disable linking symbol names in Differential '. 'and Diffusion to their definitions. This is enabled by default.') ->addButton('disabled', 'Disabled', null)) + ->appendChild( + id(new AphrontFormRadioButtonControl()) + ->setLabel('Monospaced Textareas') + ->setName($pref_monospaced_textareas) + ->setValue($pref_monospaced_textareas_value) + ->addButton('enabled', 'Enabled', + 'Show all textareas using the monospaced font defined above.') + ->addButton('disabled', 'Disabled', null)) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue('Save Preferences')); diff --git a/src/applications/settings/storage/PhabricatorUserPreferences.php b/src/applications/settings/storage/PhabricatorUserPreferences.php index be7a2aca68..081fd9dd51 100644 --- a/src/applications/settings/storage/PhabricatorUserPreferences.php +++ b/src/applications/settings/storage/PhabricatorUserPreferences.php @@ -2,22 +2,23 @@ final class PhabricatorUserPreferences extends PhabricatorUserDAO { - const PREFERENCE_MONOSPACED = 'monospaced'; - const PREFERENCE_EDITOR = 'editor'; - const PREFERENCE_TITLES = 'titles'; + const PREFERENCE_MONOSPACED = 'monospaced'; + const PREFERENCE_EDITOR = 'editor'; + const PREFERENCE_TITLES = 'titles'; + const PREFERENCE_MONOSPACED_TEXTAREAS = 'monospaced-textareas'; - const PREFERENCE_RE_PREFIX = 're-prefix'; - const PREFERENCE_NO_SELF_MAIL = 'self-mail'; - const PREFERENCE_MAILTAGS = 'mailtags'; - const PREFERENCE_VARY_SUBJECT = 'vary-subject'; + const PREFERENCE_RE_PREFIX = 're-prefix'; + const PREFERENCE_NO_SELF_MAIL = 'self-mail'; + const PREFERENCE_MAILTAGS = 'mailtags'; + const PREFERENCE_VARY_SUBJECT = 'vary-subject'; - const PREFERENCE_SEARCHBAR_JUMP = 'searchbar-jump'; - const PREFERENCE_SEARCH_SHORTCUT = 'search-shortcut'; + const PREFERENCE_SEARCHBAR_JUMP = 'searchbar-jump'; + const PREFERENCE_SEARCH_SHORTCUT = 'search-shortcut'; - const PREFERENCE_DIFFUSION_VIEW = 'diffusion-view'; - const PREFERENCE_DIFFUSION_SYMBOLS = 'diffusion-symbols'; + const PREFERENCE_DIFFUSION_VIEW = 'diffusion-view'; + const PREFERENCE_DIFFUSION_SYMBOLS = 'diffusion-symbols'; - const PREFERENCE_NAV_WIDTH = 'nav-width'; + const PREFERENCE_NAV_WIDTH = 'nav-width'; protected $userPHID; protected $preferences = array(); diff --git a/src/view/form/control/PhabricatorRemarkupControl.php b/src/view/form/control/PhabricatorRemarkupControl.php index 55473450a6..70b44c8fad 100644 --- a/src/view/form/control/PhabricatorRemarkupControl.php +++ b/src/view/form/control/PhabricatorRemarkupControl.php @@ -2,6 +2,17 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl { + private $user; + + public function setUser(PhabricatorUser $user) { + $this->user = $user; + return $this; + } + + public function getUser() { + return $this->user; + } + protected function renderInput() { $id = $this->getID(); if (!$id) { @@ -119,7 +130,22 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl { ), implode('', $buttons)); - $this->setCustomClass('remarkup-assist-textarea'); + $monospaced_textareas = null; + $monospaced_textareas_class = null; + $user = $this->getUser(); + + if ($user) { + $monospaced_textareas = $user + ->loadPreferences() + ->getPreference( + PhabricatorUserPreferences::PREFERENCE_MONOSPACED_TEXTAREAS); + if ($monospaced_textareas == 'enabled') { + $monospaced_textareas_class = 'PhabricatorMonospaced'; + } + } + + $this->setCustomClass( + 'remarkup-assist-textarea '.$monospaced_textareas_class); return javelin_render_tag( 'div',