From a1403183dfcfb6886cc75153044745d9cc70687b Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Mon, 27 Apr 2015 21:18:09 +1000 Subject: [PATCH] Remove some unused Aphront classes Summary: These classes aren't used anywhere. Test Plan: `grep` Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D12564 --- .../form/control/AphrontFormCropControl.php | 94 ------------------- .../form/control/AphrontFormImageControl.php | 36 ------- .../control/AphrontFormSectionControl.php | 13 --- .../AphrontFormToggleButtonsControl.php | 52 ---------- 4 files changed, 195 deletions(-) delete mode 100644 src/view/form/control/AphrontFormCropControl.php delete mode 100644 src/view/form/control/AphrontFormImageControl.php delete mode 100644 src/view/form/control/AphrontFormSectionControl.php delete mode 100644 src/view/form/control/AphrontFormToggleButtonsControl.php diff --git a/src/view/form/control/AphrontFormCropControl.php b/src/view/form/control/AphrontFormCropControl.php deleted file mode 100644 index 6096520f3b..0000000000 --- a/src/view/form/control/AphrontFormCropControl.php +++ /dev/null @@ -1,94 +0,0 @@ -height = $height; - return $this; - } - public function getHeight() { - return $this->height; - } - - public function setWidth($width) { - $this->width = $width; - return $this; - } - public function getWidth() { - return $this->width; - } - - protected function getCustomControlClass() { - return 'aphront-form-crop'; - } - - protected function renderInput() { - $file = $this->getValue(); - - if ($file === null) { - return phutil_tag( - 'img', - array( - 'src' => PhabricatorUser::getDefaultProfileImageURI(), - ), - ''); - } - - $c_id = celerity_generate_unique_node_id(); - $metadata = $file->getMetadata(); - $scale = PhabricatorImageTransformer::getScaleForCrop( - $file, - $this->getWidth(), - $this->getHeight()); - - Javelin::initBehavior( - 'aphront-crop', - array( - 'cropBoxID' => $c_id, - 'width' => $this->getWidth(), - 'height' => $this->getHeight(), - 'scale' => $scale, - 'imageH' => $metadata[PhabricatorFile::METADATA_IMAGE_HEIGHT], - 'imageW' => $metadata[PhabricatorFile::METADATA_IMAGE_WIDTH], - )); - - return javelin_tag( - 'div', - array( - 'id' => $c_id, - 'sigil' => 'crop-box', - 'mustcapture' => true, - 'class' => 'crop-box', - ), - array( - javelin_tag( - 'img', - array( - 'src' => $file->getBestURI(), - 'class' => 'crop-image', - 'sigil' => 'crop-image', - ), - ''), - javelin_tag( - 'input', - array( - 'type' => 'hidden', - 'name' => 'image_x', - 'sigil' => 'crop-x', - ), - ''), - javelin_tag( - 'input', - array( - 'type' => 'hidden', - 'name' => 'image_y', - 'sigil' => 'crop-y', - ), - ''), - )); - } - -} diff --git a/src/view/form/control/AphrontFormImageControl.php b/src/view/form/control/AphrontFormImageControl.php deleted file mode 100644 index 28c6620037..0000000000 --- a/src/view/form/control/AphrontFormImageControl.php +++ /dev/null @@ -1,36 +0,0 @@ -%s%s', - phutil_tag( - 'input', - array( - 'type' => 'file', - 'name' => $this->getName(), - )), - phutil_tag( - 'input', - array( - 'type' => 'checkbox', - 'name' => 'default_image', - 'class' => 'default-image', - 'id' => $id, - )), - phutil_tag( - 'label', - array( - 'for' => $id, - ), - pht('Use Default Image instead'))); - } - -} diff --git a/src/view/form/control/AphrontFormSectionControl.php b/src/view/form/control/AphrontFormSectionControl.php deleted file mode 100644 index e6d9705646..0000000000 --- a/src/view/form/control/AphrontFormSectionControl.php +++ /dev/null @@ -1,13 +0,0 @@ -getValue(); - } - -} diff --git a/src/view/form/control/AphrontFormToggleButtonsControl.php b/src/view/form/control/AphrontFormToggleButtonsControl.php deleted file mode 100644 index 1c2fb3a673..0000000000 --- a/src/view/form/control/AphrontFormToggleButtonsControl.php +++ /dev/null @@ -1,52 +0,0 @@ -baseURI = $uri; - $this->param = $param; - return $this; - } - - public function setButtons(array $buttons) { - $this->buttons = $buttons; - return $this; - } - - protected function getCustomControlClass() { - return 'aphront-form-control-togglebuttons'; - } - - protected function renderInput() { - if (!$this->baseURI) { - throw new Exception('Call setBaseURI() before render()!'); - } - - $selected = $this->getValue(); - - $out = array(); - foreach ($this->buttons as $value => $label) { - if ($value == $selected) { - $more = ' toggle-selected toggle-fixed'; - } else { - $more = null; - } - - $out[] = phutil_tag( - 'a', - array( - 'class' => 'toggle'.$more, - 'href' => $this->baseURI->alter($this->param, $value), - ), - $label); - } - - return $out; - } - -}