Summary: This attempts some consistency in form layouts. Notably, they all now contain headers and are 16px off the sides and tops of pages. Also updated dialogs to the same look and feel. I think I got 98% of forms with this pass, but it's likely I missed some buried somewhere. TODO: will take another pass as consolidating these colors and new gradients in another diff. Test Plan: Played in my sandbox all week. Please play with it too and let me know how they feel. Reviewers: epriestley, btrahan Reviewed By: epriestley CC: Korvin, aran Differential Revision: https://secure.phabricator.com/D6806
		
			
				
	
	
		
			78 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			78 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
final class PhabricatorSettingsPanelConpherencePreferences
 | 
						|
  extends PhabricatorSettingsPanel {
 | 
						|
 | 
						|
  public function isEnabled() {
 | 
						|
    return PhabricatorApplication::isClassInstalled(
 | 
						|
      'PhabricatorApplicationConpherence');
 | 
						|
  }
 | 
						|
 | 
						|
  public function getPanelKey() {
 | 
						|
    return 'conpherence';
 | 
						|
  }
 | 
						|
 | 
						|
  public function getPanelName() {
 | 
						|
    return pht('Conpherence Preferences');
 | 
						|
  }
 | 
						|
 | 
						|
  public function getPanelGroup() {
 | 
						|
    return pht('Application Settings');
 | 
						|
  }
 | 
						|
 | 
						|
  public function processRequest(AphrontRequest $request) {
 | 
						|
    $user = $request->getUser();
 | 
						|
    $preferences = $user->loadPreferences();
 | 
						|
 | 
						|
    $pref = PhabricatorUserPreferences::PREFERENCE_CONPH_NOTIFICATIONS;
 | 
						|
 | 
						|
    if ($request->isFormPost()) {
 | 
						|
      $notifications = $request->getInt($pref);
 | 
						|
      $preferences->setPreference($pref, $notifications);
 | 
						|
      $preferences->save();
 | 
						|
      return id(new AphrontRedirectResponse())
 | 
						|
        ->setURI($this->getPanelURI('?saved=true'));
 | 
						|
    }
 | 
						|
 | 
						|
    $form = id(new AphrontFormView())
 | 
						|
      ->setUser($user)
 | 
						|
      ->appendChild(
 | 
						|
        id(new AphrontFormSelectControl())
 | 
						|
          ->setLabel(pht('Conpherence Notifications'))
 | 
						|
          ->setName($pref)
 | 
						|
          ->setValue($preferences->getPreference($pref))
 | 
						|
          ->setOptions(
 | 
						|
            array(
 | 
						|
              ConpherenceSettings::EMAIL_ALWAYS
 | 
						|
                => pht('Email Always'),
 | 
						|
              ConpherenceSettings::NOTIFICATIONS_ONLY
 | 
						|
                => pht('Notifications Only'),
 | 
						|
            ))
 | 
						|
          ->setCaption(
 | 
						|
            pht('Should Conpherence send emails for updates or '.
 | 
						|
                'notifications only? This global setting can be overridden '.
 | 
						|
                'on a per-thread basis within Conpherence.')))
 | 
						|
      ->appendChild(
 | 
						|
        id(new AphrontFormSubmitControl())
 | 
						|
          ->setValue(pht('Save Preferences')));
 | 
						|
 | 
						|
    $error_view = null;
 | 
						|
    if ($request->getBool('saved')) {
 | 
						|
      $error_view = id(new AphrontErrorView())
 | 
						|
        ->setTitle(pht('Preferences Saved'))
 | 
						|
        ->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
 | 
						|
        ->setErrors(array(pht('Your preferences have been saved.')));
 | 
						|
    }
 | 
						|
 | 
						|
    $form_box = id(new PHUIFormBoxView())
 | 
						|
      ->setHeaderText(pht('Conpherence Preferences'))
 | 
						|
      ->setFormError($error_view)
 | 
						|
      ->setForm($form);
 | 
						|
 | 
						|
    return array(
 | 
						|
      $form_box,
 | 
						|
    );
 | 
						|
  }
 | 
						|
}
 | 
						|
 |