1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-28 09:42:41 +01:00
phorge-phorge/src/applications/conpherence/view/ConpherenceFormDragAndDropUploadControl.php
Bob Trahan 16ce63ec20 Conpherence - add back in custom images
Summary: Fixes T7254. This reverts the previous functionality, but makes pertinent updates like scaling the images to 35 x 35. Codebase had moved on quite a bit so far from a straight revert but nothing too tricky relative to the code that was here before. This does not allow for changing the images from the conpherence durable column view -- that would require some JS trickery, but also doesn't fit into the current notion of the column being "light". Can always modify this later.

Test Plan:
 - from full conpherence, uploaded a square pic and things looked nice
 - from full conpherence, uploaded a rectangular pic and wasnt happy, so reinvoked edit dialog and used crop control to make it better
 - noted could not update picture from conpherence durable column
 - used different user and noted could see custom picture

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: CodeMouse92, Korvin, epriestley

Maniphest Tasks: T7254

Differential Revision: https://secure.phabricator.com/D12648
2015-05-04 13:52:22 -07:00

40 lines
953 B
PHP

<?php
final class ConpherenceFormDragAndDropUploadControl extends AphrontFormControl {
private $dropID;
public function setDropID($drop_id) {
$this->dropID = $drop_id;
return $this;
}
public function getDropID() {
return $this->dropID;
}
protected function getCustomControlClass() {
return null;
}
protected function renderInput() {
$drop_id = celerity_generate_unique_node_id();
Javelin::initBehavior('conpherence-drag-and-drop-photo',
array(
'target' => $drop_id,
'form_pane' => 'conpherence-form',
'upload_uri' => '/file/dropupload/',
'activated_class' => 'conpherence-dialogue-upload-photo',
));
require_celerity_resource('conpherence-update-css');
return phutil_tag(
'div',
array(
'id' => $drop_id,
'class' => 'conpherence-dialogue-drag-photo',
),
pht('Drag and drop an image here to upload it.'));
}
}