public function getOptions()
    {
        $manifest = PHUIIconView::getSheetManifest('main-header');
        $options = array();
        foreach (array_keys($manifest) as $sprite_name) {
            $key = substr($sprite_name, strlen('main-header-'));
            $options[$key] = $key;
        }
        $example = <<<EOJSON
[
  {
    "name" : "Copyright 2199 Examplecorp"
  },
  {
    "name" : "Privacy Policy",
    "href" : "http://www.example.org/privacy/"
  },
  {
    "name" : "Terms and Conditions",
    "href" : "http://www.example.org/terms/"
  }
]
EOJSON;
        return array($this->newOption('ui.header-color', 'enum', 'dark')->setDescription(pht('Sets the color of the main header.'))->setEnumOptions($options), $this->newOption('ui.footer-items', 'list<wild>', array())->setSummary(pht('Allows you to add footer links on most pages.'))->setDescription(pht("Allows you to add a footer with links in it to most " . "pages. You might want to use these links to point at legal " . "information or an about page.\n\n" . "Specify a list of dictionaries. Each dictionary describes " . "a footer item. These keys are supported:\n\n" . "  - `name` The name of the item.\n" . "  - `href` Optionally, the link target of the item. You can " . "    omit this if you just want a piece of text, like a copyright " . "    notice."))->addExample($example, pht('Basic Example')));
    }
    public function getOptions()
    {
        $manifest = PHUIIconView::getSheetManifest('main-header');
        $custom_header_example = PhabricatorCustomHeaderConfigType::getExampleConfig();
        $experimental_link = 'https://secure.phabricator.com/T4214';
        $options = array();
        foreach (array_keys($manifest) as $sprite_name) {
            $key = substr($sprite_name, strlen('main-header-'));
            $options[$key] = $key;
        }
        $example = <<<EOJSON
[
  {
    "name" : "Copyright 2199 Examplecorp"
  },
  {
    "name" : "Privacy Policy",
    "href" : "http://www.example.org/privacy/"
  },
  {
    "name" : "Terms and Conditions",
    "href" : "http://www.example.org/terms/"
  }
]
EOJSON;
        return array($this->newOption('ui.header-color', 'enum', 'blindigo')->setDescription(pht('Sets the color of the main header.'))->setEnumOptions($options), $this->newOption('ui.footer-items', 'list<wild>', array())->setSummary(pht('Allows you to add footer links on most pages.'))->setDescription(pht("Allows you to add a footer with links in it to most " . "pages. You might want to use these links to point at legal " . "information or an about page.\n\n" . "Specify a list of dictionaries. Each dictionary describes " . "a footer item. These keys are supported:\n\n" . "  - `name` The name of the item.\n" . "  - `href` Optionally, the link target of the item. You can " . "    omit this if you just want a piece of text, like a copyright " . "    notice."))->addExample($example, pht('Basic Example')), $this->newOption('ui.custom-header', 'custom:PhabricatorCustomHeaderConfigType', null)->setSummary(pht('Customize the Phabricator logo.'))->setDescription(pht('You can customize the Phabricator logo by specifying the ' . 'phid for a viewable image you have uploaded to Phabricator ' . 'via the [[ /file/ | Files application]]. This image should ' . 'be:' . "\n" . ' - 192px X 80px; while not enforced, images with these ' . 'dimensions will look best across devices.' . "\n" . ' - have view policy public if [[ ' . '/config/edit/policy.allow-public | `policy.allow-public`]] ' . 'is true and otherwise view policy user; mismatches in these ' . 'policy settings will result in a broken logo for some users.' . "\n\n" . 'You should restart your webserver after updating this value ' . 'to see this change take effect.' . "\n\n" . 'As this feature is experimental, please read [[ %s | T4214 ]] ' . 'for up to date information.', $experimental_link))->addExample($custom_header_example, pht('Valid Config')));
    }
 public function getOptions()
 {
     $manifest = PHUIIconView::getSheetManifest('main-header');
     $options = array();
     foreach (array_keys($manifest) as $sprite_name) {
         $key = substr($sprite_name, strlen('main-header-'));
         $options[$key] = $key;
     }
     return array($this->newOption('ui.header-color', 'enum', 'dark')->setDescription(pht('Sets the color of the main header.'))->setEnumOptions($options));
 }
 public function processRequest()
 {
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $colors = array('red' => pht('Verbillion'), 'orange' => pht('Navel Orange'), 'yellow' => pht('Prim Goldenrod'), 'green' => pht('Lustrous Verdant'), 'blue' => pht('Tropical Deep'), 'sky' => pht('Wide Open Sky'), 'indigo' => pht('Pleated Khaki'), 'violet' => pht('Aged Merlot'), 'charcoal' => pht('Gemstone'), 'backdrop' => pht('Driven Snow'));
     $manifest = PHUIIconView::getSheetManifest(PHUIIconView::SPRITE_PROJECTS);
     if ($request->isFormPost()) {
         $icon = $request->getStr('icon');
         $color = $request->getStr('color');
         if (isset($colors[$color]) && isset($manifest['projects-' . $icon])) {
             $root = dirname(phutil_get_library_root('phabricator'));
             $icon_file = $root . '/resources/sprite/projects_1x/' . $icon . '.png';
             $icon_data = Filesystem::readFile($icon_file);
             $data = $this->composeImage($color, $icon_data);
             $file = PhabricatorFile::buildFromFileDataOrHash($data, array('name' => 'project.png', 'canCDN' => true));
             $content = array('phid' => $file->getPHID());
             return id(new AphrontAjaxResponse())->setContent($content);
         }
     }
     $value_color = head_key($colors);
     $value_icon = head_key($manifest);
     $value_icon = substr($value_icon, strlen('projects-'));
     require_celerity_resource('people-profile-css');
     $buttons = array();
     foreach ($colors as $color => $name) {
         $buttons[] = javelin_tag('button', array('class' => 'grey profile-image-button', 'sigil' => 'has-tooltip compose-select-color', 'style' => 'margin: 0 8px 8px 0', 'meta' => array('color' => $color, 'tip' => $name)), id(new PHUIIconView())->addClass('compose-background-' . $color));
     }
     $icons = array();
     $icon_quips = array('8ball' => pht('Take a Risk'), 'alien' => pht('Foreign Interface'), 'announce' => pht('Louder is Better'), 'art' => pht('Unique Snowflake'), 'award' => pht('Shooting Star'), 'bacon' => pht('Healthy Vegetables'), 'bandaid' => pht('Durable Infrastructure'), 'beer' => pht('Healthy Vegetable Juice'), 'bomb' => pht('Imminent Success'), 'briefcase' => pht('Adventure Pack'), 'bug' => pht('Costumed Egg'), 'calendar' => pht('Everyone Loves Meetings'), 'cloud' => pht('Water Cycle'), 'coffee' => pht('Half-Whip Nonfat Soy Latte'), 'creditcard' => pht('Expense It'), 'death' => pht('Calcium Promotes Bone Health'), 'desktop' => pht('Magical Portal'), 'dropbox' => pht('Cardboard Box'), 'education' => pht('Debt'), 'experimental' => pht('CAUTION: Dangerous Chemicals'), 'facebook' => pht('Popular Social Network'), 'facility' => pht('Pollution Solves Problems'), 'film' => pht('Actual Physical Film'), 'forked' => pht('You Can\'t Eat Soup'), 'games' => pht('Serious Business'), 'ghost' => pht('Haunted'), 'gift' => pht('Surprise!'), 'globe' => pht('Scanner Sweep'), 'golf' => pht('Business Meeting'), 'heart' => pht('Undergoing a Major Surgery'), 'intergalactic' => pht('Jupiter'), 'lock' => pht('Extremely Secret'), 'mail' => pht('Oragami'), 'martini' => pht('Healthy Olive Drink'), 'medical' => pht('Medic!'), 'mobile' => pht('Cellular Telephone'), 'music' => pht("♫"), 'news' => pht('Actual Physical Newspaper'), 'orgchart' => pht('It\'s Good to be King'), 'peoples' => pht('Angel and Devil'), 'piechart' => pht('Actual Physical Pie'), 'poison' => pht('Healthy Bone Juice'), 'putabirdonit' => pht('Put a Bird On It'), 'radiate' => pht('Radiant Beauty'), 'savings' => pht('Oink Oink'), 'search' => pht('Sleuthing'), 'shield' => pht('Royal Crest'), 'speed' => pht('Slow and Steady'), 'sprint' => pht('Fire Exit'), 'star' => pht('The More You Know'), 'storage' => pht('Stack of Pancakes'), 'tablet' => pht('Cellular Telephone For Giants'), 'travel' => pht('Pretty Clearly an Airplane'), 'twitter' => pht('Bird Stencil'), 'warning' => pht('No Caution Required, Everything Looks Safe'), 'whale' => pht('Friendly Walrus'));
     foreach ($manifest as $icon => $spec) {
         $icon = substr($icon, strlen('projects-'));
         $icons[] = javelin_tag('button', array('class' => 'grey profile-image-button', 'sigil' => 'has-tooltip compose-select-icon', 'style' => 'margin: 0 8px 8px 0', 'meta' => array('icon' => $icon, 'tip' => idx($icon_quips, $icon, $icon))), id(new PHUIIconView())->setSpriteIcon($icon)->setSpriteSheet(PHUIIconView::SPRITE_PROJECTS));
     }
     $dialog_id = celerity_generate_unique_node_id();
     $color_input_id = celerity_generate_unique_node_id();
     $icon_input_id = celerity_generate_unique_node_id();
     $preview_id = celerity_generate_unique_node_id();
     $preview = id(new PHUIIconView())->setID($preview_id)->addClass('compose-background-' . $value_color)->setSpriteIcon($value_icon)->setSpriteSheet(PHUIIconView::SPRITE_PROJECTS);
     $color_input = javelin_tag('input', array('type' => 'hidden', 'name' => 'color', 'value' => $value_color, 'id' => $color_input_id));
     $icon_input = javelin_tag('input', array('type' => 'hidden', 'name' => 'icon', 'value' => $value_icon, 'id' => $icon_input_id));
     Javelin::initBehavior('phabricator-tooltips');
     Javelin::initBehavior('icon-composer', array('dialogID' => $dialog_id, 'colorInputID' => $color_input_id, 'iconInputID' => $icon_input_id, 'previewID' => $preview_id, 'defaultColor' => $value_color, 'defaultIcon' => $value_icon));
     $dialog = id(new AphrontDialogView())->setUser($viewer)->setFormID($dialog_id)->setClass('compose-dialog')->setTitle(pht('Compose Image'))->appendChild(phutil_tag('div', array('class' => 'compose-header'), pht('Choose Background Color')))->appendChild($buttons)->appendChild(phutil_tag('div', array('class' => 'compose-header'), pht('Choose Icon')))->appendChild($icons)->appendChild(phutil_tag('div', array('class' => 'compose-header'), pht('Preview')))->appendChild($preview)->appendChild($color_input)->appendChild($icon_input)->addCancelButton('/')->addSubmitButton(pht('Save Image'));
     return id(new AphrontDialogResponse())->setDialog($dialog);
 }