1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

Conpherence - kill the image-based header UI

Summary:
removes the whole custom image thing, instead using a more standard application crumbs. Gives this glorious space back to the compose area which is now tens of pixels taller. Also defaults it to the people widget. Basically, fixes T3160.

For now, you **CAN NOT** edit the title of a conpherence. I didn't want to jam in too much here. Next diff will be to change the widget icons into the dropdown switcher, which will also bring back the editing of titles.

Test Plan: looked at conpherence and it was pretty. Resized it vigorously and it wasn't too bad.

Reviewers: epriestley

Reviewed By: epriestley

CC: chad, aran, Korvin

Maniphest Tasks: T3160

Differential Revision: https://secure.phabricator.com/D5998
This commit is contained in:
Bob Trahan 2013-05-22 16:05:47 -07:00
parent b956944667
commit a56ca7a043
24 changed files with 48 additions and 517 deletions

View file

@ -0,0 +1,2 @@
ALTER TABLE `{$NAMESPACE}_conpherence`.`conpherence_thread`
DROP imagePHIDs;

View file

@ -918,7 +918,7 @@ celerity_register_resource_map(array(
), ),
'conpherence-header-pane-css' => 'conpherence-header-pane-css' =>
array( array(
'uri' => '/res/dc654fce/rsrc/css/application/conpherence/header-pane.css', 'uri' => '/res/762c199d/rsrc/css/application/conpherence/header-pane.css',
'type' => 'css', 'type' => 'css',
'requires' => 'requires' =>
array( array(
@ -936,7 +936,7 @@ celerity_register_resource_map(array(
), ),
'conpherence-message-pane-css' => 'conpherence-message-pane-css' =>
array( array(
'uri' => '/res/52cf7ca3/rsrc/css/application/conpherence/message-pane.css', 'uri' => '/res/ff25351b/rsrc/css/application/conpherence/message-pane.css',
'type' => 'css', 'type' => 'css',
'requires' => 'requires' =>
array( array(
@ -954,7 +954,7 @@ celerity_register_resource_map(array(
), ),
'conpherence-widget-pane-css' => 'conpherence-widget-pane-css' =>
array( array(
'uri' => '/res/197df36c/rsrc/css/application/conpherence/widget-pane.css', 'uri' => '/res/c0131a8b/rsrc/css/application/conpherence/widget-pane.css',
'type' => 'css', 'type' => 'css',
'requires' => 'requires' =>
array( array(
@ -1316,7 +1316,7 @@ celerity_register_resource_map(array(
), ),
'javelin-behavior-conpherence-menu' => 'javelin-behavior-conpherence-menu' =>
array( array(
'uri' => '/res/06bfc1a3/rsrc/js/application/conpherence/behavior-menu.js', 'uri' => '/res/2bffa665/rsrc/js/application/conpherence/behavior-menu.js',
'type' => 'js', 'type' => 'js',
'requires' => 'requires' =>
array( array(

View file

@ -250,9 +250,7 @@ phutil_register_library_map(array(
'ConpherenceDAO' => 'applications/conpherence/storage/ConpherenceDAO.php', 'ConpherenceDAO' => 'applications/conpherence/storage/ConpherenceDAO.php',
'ConpherenceEditor' => 'applications/conpherence/editor/ConpherenceEditor.php', 'ConpherenceEditor' => 'applications/conpherence/editor/ConpherenceEditor.php',
'ConpherenceFileWidgetView' => 'applications/conpherence/view/ConpherenceFileWidgetView.php', 'ConpherenceFileWidgetView' => 'applications/conpherence/view/ConpherenceFileWidgetView.php',
'ConpherenceFormDragAndDropUploadControl' => 'applications/conpherence/view/ConpherenceFormDragAndDropUploadControl.php',
'ConpherenceHovercardEventListener' => 'applications/conpherence/events/ConpherenceHovercardEventListener.php', 'ConpherenceHovercardEventListener' => 'applications/conpherence/events/ConpherenceHovercardEventListener.php',
'ConpherenceImageData' => 'applications/conpherence/constants/ConpherenceImageData.php',
'ConpherenceLayoutView' => 'applications/conpherence/view/ConpherenceLayoutView.php', 'ConpherenceLayoutView' => 'applications/conpherence/view/ConpherenceLayoutView.php',
'ConpherenceListController' => 'applications/conpherence/controller/ConpherenceListController.php', 'ConpherenceListController' => 'applications/conpherence/controller/ConpherenceListController.php',
'ConpherenceMenuItemView' => 'applications/conpherence/view/ConpherenceMenuItemView.php', 'ConpherenceMenuItemView' => 'applications/conpherence/view/ConpherenceMenuItemView.php',
@ -2058,9 +2056,7 @@ phutil_register_library_map(array(
'ConpherenceDAO' => 'PhabricatorLiskDAO', 'ConpherenceDAO' => 'PhabricatorLiskDAO',
'ConpherenceEditor' => 'PhabricatorApplicationTransactionEditor', 'ConpherenceEditor' => 'PhabricatorApplicationTransactionEditor',
'ConpherenceFileWidgetView' => 'ConpherenceWidgetView', 'ConpherenceFileWidgetView' => 'ConpherenceWidgetView',
'ConpherenceFormDragAndDropUploadControl' => 'AphrontFormControl',
'ConpherenceHovercardEventListener' => 'PhutilEventListener', 'ConpherenceHovercardEventListener' => 'PhutilEventListener',
'ConpherenceImageData' => 'ConpherenceConstants',
'ConpherenceLayoutView' => 'AphrontView', 'ConpherenceLayoutView' => 'AphrontView',
'ConpherenceListController' => 'ConpherenceController', 'ConpherenceListController' => 'ConpherenceController',
'ConpherenceMenuItemView' => 'AphrontTagView', 'ConpherenceMenuItemView' => 'AphrontTagView',

View file

@ -1,11 +0,0 @@
<?php
final class ConpherenceImageData extends ConpherenceConstants {
const SIZE_ORIG = 'original';
const SIZE_HEAD = 'header';
const HEAD_WIDTH = 120;
const HEAD_HEIGHT = 80;
}

View file

@ -7,8 +7,10 @@ final class ConpherenceTransactionType extends ConpherenceConstants {
const TYPE_FILES = 'files'; const TYPE_FILES = 'files';
const TYPE_TITLE = 'title'; const TYPE_TITLE = 'title';
const TYPE_PICTURE = 'picture';
const TYPE_PICTURE_CROP = 'picture-crop';
const TYPE_PARTICIPANTS = 'participants'; const TYPE_PARTICIPANTS = 'participants';
/* these two are deprecated but keep them around for legacy installs */
const TYPE_PICTURE = 'picture';
const TYPE_PICTURE_CROP = 'picture-crop';
} }

View file

@ -22,62 +22,25 @@ abstract class ConpherenceController extends PhabricatorController {
$crumbs $crumbs
->addAction( ->addAction(
id(new PhabricatorMenuItemView()) id(new PhabricatorMenuItemView())
->setName(pht('New Message')) ->setName(pht('New Message'))
->setHref($this->getApplicationURI('new/')) ->setHref($this->getApplicationURI('new/'))
->setIcon('create')) ->setIcon('create')
->addCrumb( ->setWorkflow(true));
id(new PhabricatorCrumbView())
->setName(pht('Conpherence')));
return $crumbs; return $crumbs;
} }
protected function buildHeaderPaneContent(ConpherenceThread $conpherence) { protected function buildHeaderPaneContent(ConpherenceThread $conpherence) {
$user = $this->getRequest()->getUser(); $crumbs = $this->buildApplicationCrumbs();
$display_data = $conpherence->getDisplayData( if ($conpherence->getTitle()) {
$user, $title = $conpherence->getTitle();
ConpherenceImageData::SIZE_HEAD); } else {
$edit_href = $this->getApplicationURI('update/'.$conpherence->getID().'/'); $title = pht('Conpherence');
$class_mod = $display_data['image_class']; }
$crumbs->addCrumb(
id(new PhabricatorCrumbView())
->setName($title));
return array( return $crumbs;
phutil_tag(
'div',
array(
'class' => 'upload-photo'
),
pht('Drop photo here to change this Conpherence photo.')),
javelin_tag(
'a',
array(
'class' => 'edit',
'href' => $edit_href,
'sigil' => 'conpherence-edit-metadata',
'meta' => array(
'action' => 'metadata'
)
),
''),
phutil_tag(
'div',
array(
'class' => $class_mod.'header-image',
'style' => 'background-image: url('.$display_data['image'].');'
),
''),
phutil_tag(
'div',
array(
'class' => $class_mod.'title',
),
$display_data['title']),
phutil_tag(
'div',
array(
'class' => $class_mod.'subtitle',
),
$display_data['subtitle']),
);
} }
protected function renderConpherenceTransactions( protected function renderConpherenceTransactions(

View file

@ -31,10 +31,7 @@ final class ConpherenceUpdateController
->setViewer($user) ->setViewer($user)
->withIDs(array($conpherence_id)) ->withIDs(array($conpherence_id))
->needFilePHIDs(true) ->needFilePHIDs(true)
->needOrigPics(true)
->needHeaderPics(true)
->executeOne(); ->executeOne();
$supported_formats = PhabricatorFile::getTransformableImageFormats();
$action = $request->getStr('action', ConpherenceUpdateActions::METADATA); $action = $request->getStr('action', ConpherenceUpdateActions::METADATA);
$latest_transaction_id = null; $latest_transaction_id = null;
@ -99,73 +96,13 @@ final class ConpherenceUpdateController
break; break;
case ConpherenceUpdateActions::METADATA: case ConpherenceUpdateActions::METADATA:
$xactions = array(); $xactions = array();
$top = $request->getInt('image_y');
$left = $request->getInt('image_x');
$file_id = $request->getInt('file_id');
$title = $request->getStr('title');
$updated = false; $updated = false;
if ($file_id) {
$orig_file = id(new PhabricatorFileQuery())
->setViewer($user)
->withIDs(array($file_id))
->executeOne();
$okay = $orig_file->isTransformableImage();
if ($okay) {
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_PICTURE)
->setNewValue($orig_file->getPHID());
// do a transformation "crudely"
$xformer = new PhabricatorImageTransformer();
$header_file = $xformer->executeConpherenceTransform(
$orig_file,
0,
0,
ConpherenceImageData::HEAD_WIDTH,
ConpherenceImageData::HEAD_HEIGHT);
// this is handled outside the editor for now. no particularly
// good reason to move it inside
$conpherence->setImagePHIDs(
array(
ConpherenceImageData::SIZE_HEAD => $header_file->getPHID(),
));
$conpherence->setImages(
array(
ConpherenceImageData::SIZE_HEAD => $header_file,
));
} else {
$e_file[] = $orig_file;
$errors[] =
pht('This server only supports these image formats: %s.',
implode(', ', $supported_formats));
}
// use the existing title in this image upload case
$title = $conpherence->getTitle();
$updated = true;
$response_mode = 'redirect';
}
// all other metadata updates are continue requests // all other metadata updates are continue requests
if (!$request->isContinueRequest()) { if (!$request->isContinueRequest()) {
break; break;
} }
if ($top !== null || $left !== null) { $title = $request->getStr('title');
$file = $conpherence->getImage(ConpherenceImageData::SIZE_ORIG);
$xformer = new PhabricatorImageTransformer();
$xformed = $xformer->executeConpherenceTransform(
$file,
$top,
$left,
ConpherenceImageData::HEAD_WIDTH,
ConpherenceImageData::HEAD_HEIGHT);
$image_phid = $xformed->getPHID();
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(
ConpherenceTransactionType::TYPE_PICTURE_CROP)
->setNewValue($image_phid);
$updated = true;
}
if ($title != $conpherence->getTitle()) { if ($title != $conpherence->getTitle()) {
$xactions[] = id(new ConpherenceTransaction()) $xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_TITLE) ->setTransactionType(ConpherenceTransactionType::TYPE_TITLE)
@ -282,34 +219,6 @@ final class ConpherenceUpdateController
->setName('title') ->setName('title')
->setValue($conpherence->getTitle())); ->setValue($conpherence->getTitle()));
$image = $conpherence->getImage(ConpherenceImageData::SIZE_ORIG);
if ($image) {
$form
->appendChild(
id(new AphrontFormMarkupControl())
->setLabel(pht('Image'))
->setValue(phutil_tag(
'img',
array(
'src' =>
$conpherence->loadImageURI(ConpherenceImageData::SIZE_HEAD),
))))
->appendChild(
id(new AphrontFormCropControl())
->setLabel(pht('Crop Image'))
->setValue($image)
->setWidth(ConpherenceImageData::HEAD_WIDTH)
->setHeight(ConpherenceImageData::HEAD_HEIGHT))
->appendChild(
id(new ConpherenceFormDragAndDropUploadControl())
->setLabel(pht('Change Image')));
} else {
$form
->appendChild(
id(new ConpherenceFormDragAndDropUploadControl())
->setLabel(pht('Image')));
}
require_celerity_resource('conpherence-update-css'); require_celerity_resource('conpherence-update-css');
return id(new AphrontDialogView()) return id(new AphrontDialogView())
->setTitle(pht('Update Conpherence')) ->setTitle(pht('Update Conpherence'))
@ -323,12 +232,10 @@ final class ConpherenceUpdateController
$conpherence_id, $conpherence_id,
$latest_transaction_id) { $latest_transaction_id) {
$need_header_pics = false;
$need_widget_data = false; $need_widget_data = false;
$need_transactions = false; $need_transactions = false;
switch ($action) { switch ($action) {
case ConpherenceUpdateActions::METADATA: case ConpherenceUpdateActions::METADATA:
$need_header_pics = true;
$need_transactions = true; $need_transactions = true;
break; break;
case ConpherenceUpdateActions::MESSAGE: case ConpherenceUpdateActions::MESSAGE:
@ -346,7 +253,6 @@ final class ConpherenceUpdateController
$conpherence = id(new ConpherenceThreadQuery()) $conpherence = id(new ConpherenceThreadQuery())
->setViewer($user) ->setViewer($user)
->setAfterTransactionID($latest_transaction_id) ->setAfterTransactionID($latest_transaction_id)
->needHeaderPics($need_header_pics)
->needWidgetData($need_widget_data) ->needWidgetData($need_widget_data)
->needTransactions($need_transactions) ->needTransactions($need_transactions)
->withIDs(array($conpherence_id)) ->withIDs(array($conpherence_id))

View file

@ -40,7 +40,6 @@ final class ConpherenceViewController extends
$query = id(new ConpherenceThreadQuery()) $query = id(new ConpherenceThreadQuery())
->setViewer($user) ->setViewer($user)
->withIDs(array($conpherence_id)) ->withIDs(array($conpherence_id))
->needHeaderPics(true)
->needParticipantCache(true) ->needParticipantCache(true)
->needTransactions(true) ->needTransactions(true)
->setTransactionLimit(ConpherenceThreadQuery::TRANSACTION_LIMIT); ->setTransactionLimit(ConpherenceThreadQuery::TRANSACTION_LIMIT);

View file

@ -107,7 +107,8 @@ final class ConpherenceWidgetController extends
'widget' => 'widgets-people', 'widget' => 'widgets-people',
), ),
'id' => 'widgets-people-toggle', 'id' => 'widgets-people-toggle',
'class' => 'sprite-conpherence conpherence_people_off' 'class' =>
'sprite-conpherence conpherence_people_on conpherence_people_off'
), ),
''), ''),
javelin_tag( javelin_tag(
@ -119,7 +120,7 @@ final class ConpherenceWidgetController extends
), ),
'id' => 'widgets-files-toggle', 'id' => 'widgets-files-toggle',
'class' => 'class' =>
'sprite-conpherence conpherence_files_on conpherence_files_off' 'sprite-conpherence conpherence_files_off'
), ),
''), ''),
javelin_tag( javelin_tag(
@ -153,7 +154,6 @@ final class ConpherenceWidgetController extends
'class' => 'widgets-body', 'class' => 'widgets-body',
'id' => 'widgets-people', 'id' => 'widgets-people',
'sigil' => 'widgets-people', 'sigil' => 'widgets-people',
'style' => 'display: none;'
), ),
id(new ConpherencePeopleWidgetView()) id(new ConpherencePeopleWidgetView())
->setUser($user) ->setUser($user)
@ -165,6 +165,7 @@ final class ConpherenceWidgetController extends
'class' => 'widgets-body', 'class' => 'widgets-body',
'id' => 'widgets-files', 'id' => 'widgets-files',
'sigil' => 'widgets-files', 'sigil' => 'widgets-files',
'style' => 'display: none;'
), ),
id(new ConpherenceFileWidgetView()) id(new ConpherenceFileWidgetView())
->setUser($user) ->setUser($user)

View file

@ -45,8 +45,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
$types[] = PhabricatorTransactions::TYPE_COMMENT; $types[] = PhabricatorTransactions::TYPE_COMMENT;
$types[] = ConpherenceTransactionType::TYPE_TITLE; $types[] = ConpherenceTransactionType::TYPE_TITLE;
$types[] = ConpherenceTransactionType::TYPE_PICTURE;
$types[] = ConpherenceTransactionType::TYPE_PICTURE_CROP;
$types[] = ConpherenceTransactionType::TYPE_PARTICIPANTS; $types[] = ConpherenceTransactionType::TYPE_PARTICIPANTS;
$types[] = ConpherenceTransactionType::TYPE_FILES; $types[] = ConpherenceTransactionType::TYPE_FILES;
@ -60,10 +58,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
switch ($xaction->getTransactionType()) { switch ($xaction->getTransactionType()) {
case ConpherenceTransactionType::TYPE_TITLE: case ConpherenceTransactionType::TYPE_TITLE:
return $object->getTitle(); return $object->getTitle();
case ConpherenceTransactionType::TYPE_PICTURE:
return $object->getImagePHID(ConpherenceImageData::SIZE_ORIG);
case ConpherenceTransactionType::TYPE_PICTURE_CROP:
return $object->getImagePHID(ConpherenceImageData::SIZE_HEAD);
case ConpherenceTransactionType::TYPE_PARTICIPANTS: case ConpherenceTransactionType::TYPE_PARTICIPANTS:
return $object->getParticipantPHIDs(); return $object->getParticipantPHIDs();
case ConpherenceTransactionType::TYPE_FILES: case ConpherenceTransactionType::TYPE_FILES:
@ -77,8 +71,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
switch ($xaction->getTransactionType()) { switch ($xaction->getTransactionType()) {
case ConpherenceTransactionType::TYPE_TITLE: case ConpherenceTransactionType::TYPE_TITLE:
case ConpherenceTransactionType::TYPE_PICTURE:
case ConpherenceTransactionType::TYPE_PICTURE_CROP:
return $xaction->getNewValue(); return $xaction->getNewValue();
case ConpherenceTransactionType::TYPE_PARTICIPANTS: case ConpherenceTransactionType::TYPE_PARTICIPANTS:
case ConpherenceTransactionType::TYPE_FILES: case ConpherenceTransactionType::TYPE_FILES:
@ -115,16 +107,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
case ConpherenceTransactionType::TYPE_TITLE: case ConpherenceTransactionType::TYPE_TITLE:
$object->setTitle($xaction->getNewValue()); $object->setTitle($xaction->getNewValue());
break; break;
case ConpherenceTransactionType::TYPE_PICTURE:
$object->setImagePHID(
$xaction->getNewValue(),
ConpherenceImageData::SIZE_ORIG);
break;
case ConpherenceTransactionType::TYPE_PICTURE_CROP:
$object->setImagePHID(
$xaction->getNewValue(),
ConpherenceImageData::SIZE_HEAD);
break;
} }
$this->updateRecentParticipantPHIDs($object, $xaction); $this->updateRecentParticipantPHIDs($object, $xaction);
} }
@ -241,7 +223,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
$type = $u->getTransactionType(); $type = $u->getTransactionType();
switch ($type) { switch ($type) {
case ConpherenceTransactionType::TYPE_TITLE: case ConpherenceTransactionType::TYPE_TITLE:
case ConpherenceTransactionType::TYPE_PICTURE:
return $v; return $v;
case ConpherenceTransactionType::TYPE_FILES: case ConpherenceTransactionType::TYPE_FILES:
case ConpherenceTransactionType::TYPE_PARTICIPANTS: case ConpherenceTransactionType::TYPE_PARTICIPANTS:

View file

@ -11,8 +11,6 @@ final class ConpherenceThreadQuery
private $phids; private $phids;
private $ids; private $ids;
private $needWidgetData; private $needWidgetData;
private $needHeaderPics;
private $needOrigPics;
private $needTransactions; private $needTransactions;
private $needParticipantCache; private $needParticipantCache;
private $needFilePHIDs; private $needFilePHIDs;
@ -30,16 +28,6 @@ final class ConpherenceThreadQuery
return $this; return $this;
} }
public function needOrigPics($need_orig_pics) {
$this->needOrigPics = $need_orig_pics;
return $this;
}
public function needHeaderPics($need_header_pics) {
$this->needHeaderPics = $need_header_pics;
return $this;
}
public function needWidgetData($need_widget_data) { public function needWidgetData($need_widget_data) {
$this->needWidgetData = $need_widget_data; $this->needWidgetData = $need_widget_data;
return $this; return $this;
@ -110,12 +98,6 @@ final class ConpherenceThreadQuery
if ($this->needWidgetData) { if ($this->needWidgetData) {
$this->loadWidgetData($conpherences); $this->loadWidgetData($conpherences);
} }
if ($this->needOrigPics) {
$this->loadOrigPics($conpherences);
}
if ($this->needHeaderPics) {
$this->loadHeaderPics($conpherences);
}
} }
return $conpherences; return $conpherences;
@ -304,42 +286,4 @@ final class ConpherenceThreadQuery
return $this; return $this;
} }
private function loadOrigPics(array $conpherences) {
return $this->loadPics(
$conpherences,
ConpherenceImageData::SIZE_ORIG);
}
private function loadHeaderPics(array $conpherences) {
return $this->loadPics(
$conpherences,
ConpherenceImageData::SIZE_HEAD);
}
private function loadPics(array $conpherences, $size) {
$conpherence_pic_phids = array();
foreach ($conpherences as $conpherence) {
$phid = $conpherence->getImagePHID($size);
if ($phid) {
$conpherence_pic_phids[$conpherence->getPHID()] = $phid;
}
}
if (!$conpherence_pic_phids) {
return $this;
}
$files = id(new PhabricatorFileQuery())
->setViewer($this->getViewer())
->withPHIDs($conpherence_pic_phids)
->execute();
$files = mpull($files, null, 'getPHID');
foreach ($conpherence_pic_phids as $conpherence_phid => $pic_phid) {
$conpherences[$conpherence_phid]->setImage($files[$pic_phid], $size);
}
return $this;
}
} }

View file

@ -11,7 +11,6 @@ final class ConpherenceThread extends ConpherenceDAO
protected $title; protected $title;
protected $messageCount; protected $messageCount;
protected $recentParticipantPHIDs = array(); protected $recentParticipantPHIDs = array();
protected $imagePHIDs = array();
protected $mailKey; protected $mailKey;
private $participants; private $participants;
@ -26,7 +25,6 @@ final class ConpherenceThread extends ConpherenceDAO
self::CONFIG_AUX_PHID => true, self::CONFIG_AUX_PHID => true,
self::CONFIG_SERIALIZATION => array( self::CONFIG_SERIALIZATION => array(
'recentParticipantPHIDs' => self::SERIALIZATION_JSON, 'recentParticipantPHIDs' => self::SERIALIZATION_JSON,
'imagePHIDs' => self::SERIALIZATION_JSON,
), ),
) + parent::getConfiguration(); ) + parent::getConfiguration();
} }
@ -43,33 +41,6 @@ final class ConpherenceThread extends ConpherenceDAO
return parent::save(); return parent::save();
} }
public function getImagePHID($size) {
$image_phids = $this->getImagePHIDs();
return idx($image_phids, $size);
}
public function setImagePHID($phid, $size) {
$image_phids = $this->getImagePHIDs();
$image_phids[$size] = $phid;
return $this->setImagePHIDs($image_phids);
}
public function getImage($size) {
$images = $this->getImages();
return idx($images, $size);
}
public function setImage(PhabricatorFile $file, $size) {
$files = $this->getImages();
$files[$size] = $file;
return $this->setImages($files);
}
public function setImages(array $files) {
$this->images = $files;
return $this;
}
private function getImages() {
return $this->images;
}
public function attachParticipants(array $participants) { public function attachParticipants(array $participants) {
assert_instances_of($participants, 'ConpherenceParticipant'); assert_instances_of($participants, 'ConpherenceParticipant');
$this->participants = $participants; $this->participants = $participants;
@ -162,16 +133,6 @@ final class ConpherenceThread extends ConpherenceDAO
return $this->widgetData; return $this->widgetData;
} }
public function loadImageURI($size) {
$file = $this->getImage($size);
if ($file) {
return $file->getBestURI();
}
return PhabricatorUser::getDefaultProfileImageURI();
}
public function getDisplayData(PhabricatorUser $user, $size) { public function getDisplayData(PhabricatorUser $user, $size) {
$recent_phids = $this->getRecentParticipantPHIDs(); $recent_phids = $this->getRecentParticipantPHIDs();
$handles = $this->getHandles(); $handles = $this->getHandles();
@ -200,15 +161,7 @@ final class ConpherenceThread extends ConpherenceDAO
if (!$title) { if (!$title) {
$title = $lucky_handle->getName(); $title = $lucky_handle->getName();
} }
$img_src = $lucky_handle->getImageURI();
$image = $this->getImagePHID($size);
if ($image) {
$img_src = $this->getImage($size)->getBestURI();
$img_class = 'custom-';
} else {
$img_src = $lucky_handle->getImageURI();
$img_class = null;
}
$count = 0; $count = 0;
$final = false; $final = false;
@ -242,7 +195,6 @@ final class ConpherenceThread extends ConpherenceDAO
'unread_count' => $unread_count, 'unread_count' => $unread_count,
'epoch' => $this->getDateModified(), 'epoch' => $this->getDateModified(),
'image' => $img_src, 'image' => $img_src,
'image_class' => $img_class,
); );
} }

View file

@ -39,9 +39,11 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
case ConpherenceTransactionType::TYPE_PARTICIPANTS: case ConpherenceTransactionType::TYPE_PARTICIPANTS:
return ($old === null); return ($old === null);
case ConpherenceTransactionType::TYPE_TITLE: case ConpherenceTransactionType::TYPE_TITLE:
case ConpherenceTransactionType::TYPE_PICTURE:
return false; return false;
case ConpherenceTransactionType::TYPE_FILES: case ConpherenceTransactionType::TYPE_FILES:
return true;
// we used to have them so just always hide
case ConpherenceTransactionType::TYPE_PICTURE:
case ConpherenceTransactionType::TYPE_PICTURE_CROP: case ConpherenceTransactionType::TYPE_PICTURE_CROP:
return true; return true;
} }
@ -98,10 +100,6 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
} }
return $title; return $title;
break; break;
case ConpherenceTransactionType::TYPE_PICTURE:
return pht(
'%s updated the conpherence image.',
$this->renderHandleLink($author_phid));
case ConpherenceTransactionType::TYPE_PARTICIPANTS: case ConpherenceTransactionType::TYPE_PARTICIPANTS:
$add = array_diff($new, $old); $add = array_diff($new, $old);
$rem = array_diff($old, $new); $rem = array_diff($old, $new);
@ -142,7 +140,6 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
$phids[] = $this->getAuthorPHID(); $phids[] = $this->getAuthorPHID();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case ConpherenceTransactionType::TYPE_PICTURE:
case ConpherenceTransactionType::TYPE_TITLE: case ConpherenceTransactionType::TYPE_TITLE:
case ConpherenceTransactionType::TYPE_FILES: case ConpherenceTransactionType::TYPE_FILES:
break; break;
@ -150,7 +147,6 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
$phids = array_merge($phids, $this->getOldValue()); $phids = array_merge($phids, $this->getOldValue());
$phids = array_merge($phids, $this->getNewValue()); $phids = array_merge($phids, $this->getNewValue());
break; break;
} }
return $phids; return $phids;

View file

@ -1,40 +0,0 @@
<?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.'));
}
}

View file

@ -65,14 +65,6 @@ final class ConpherenceLayoutView extends AphrontView {
'hasWidgets' => false, 'hasWidgets' => false,
)); ));
Javelin::initBehavior('conpherence-drag-and-drop-photo',
array(
'target' => 'conpherence-header-pane',
'form_pane' => 'conpherence-form',
'upload_uri' => '/file/dropupload/',
'activated_class' => 'conpherence-header-upload-photo',
));
$all_views = 1; $all_views = 1;
$devices_only = 0; $devices_only = 0;
Javelin::initBehavior( Javelin::initBehavior(
@ -96,12 +88,6 @@ final class ConpherenceLayoutView extends AphrontView {
'showstyle' => 'block', 'showstyle' => 'block',
'hidestyle' => 'none', 'hidestyle' => 'none',
'desktopstyle' => 'block'), 'desktopstyle' => 'block'),
array(
'tagname' => 'a',
'sigil' => 'conpherence-new-conversation',
'showstyle' => 'none',
'hidestyle' => 'none',
'desktopstyle' => 'block'),
) )
), ),
'widgetToggleMap' => array( 'widgetToggleMap' => array(

View file

@ -37,16 +37,6 @@ final class ConpherenceThreadListView extends AphrontView {
->addClass('conpherence-menu') ->addClass('conpherence-menu')
->setID('conpherence-menu'); ->setID('conpherence-menu');
$menu->addMenuItem(
id(new PhabricatorMenuItemView())
->addSigil('conpherence-new-conversation')
->setName(pht('New Message'))
->setWorkflow(true)
->setKey('new')
->setHref($this->baseURI.'new/')
->setType(PhabricatorMenuItemView::TYPE_BUTTON));
$menu->newLabel('');
$this->addThreadsToMenu($menu, $this->threads); $this->addThreadsToMenu($menu, $this->threads);
return $menu; return $menu;

View file

@ -46,25 +46,12 @@ final class ConpherenceTransactionView extends AphrontView {
$content = null; $content = null;
switch ($transaction->getTransactionType()) { switch ($transaction->getTransactionType()) {
case ConpherenceTransactionType::TYPE_TITLE: case ConpherenceTransactionType::TYPE_TITLE:
case ConpherenceTransactionType::TYPE_PICTURE:
case ConpherenceTransactionType::TYPE_PICTURE_CROP:
$content = $transaction->getTitle(); $content = $transaction->getTitle();
$transaction_view->addClass('conpherence-edited'); $transaction_view->addClass('conpherence-edited');
break; break;
case ConpherenceTransactionType::TYPE_FILES: case ConpherenceTransactionType::TYPE_FILES:
$content = $transaction->getTitle(); $content = $transaction->getTitle();
break; break;
case ConpherenceTransactionType::TYPE_PICTURE:
$img = $transaction->getHandle($transaction->getNewValue());
$content = array(
$transaction->getTitle(),
phutil_tag(
'img',
array(
'src' => $img->getImageURI()
)));
$transaction_view->addClass('conpherence-edited');
break;
case ConpherenceTransactionType::TYPE_PARTICIPANTS: case ConpherenceTransactionType::TYPE_PARTICIPANTS:
$content = $transaction->getTitle(); $content = $transaction->getTitle();
$transaction_view->addClass('conpherence-edited'); $transaction_view->addClass('conpherence-edited');

View file

@ -317,7 +317,7 @@ final class DifferentialChangesetListView extends AphrontView {
'target' => '_blank', 'target' => '_blank',
'sigil' => 'differential-view-options', 'sigil' => 'differential-view-options',
), ),
pht("View Options \xE2\x96\xBC")); pht('View Options') . " \xE2\x96\xBC");
} }
} }

View file

@ -1306,6 +1306,11 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList {
'type' => 'sql', 'type' => 'sql',
'name' => $this->getPatchPath('20130519.diviner.sql'), 'name' => $this->getPatchPath('20130519.diviner.sql'),
), ),
'20130521.dropconphimages.sql' => array(
'type' => 'sql',
'name' => $this->getPatchPath('20130521.dropconphimages.sql'),
),
); );
} }
} }

View file

@ -2,96 +2,6 @@
* @provides conpherence-header-pane-css * @provides conpherence-header-pane-css
*/ */
.conpherence-header-pane {
border-bottom: 1px solid #ccc;
height: 80px;
width: 100%;
}
.device .conpherence-header-pane { .device .conpherence-header-pane {
display: none; display: none;
} }
.conpherence-header-pane .edit {
float: right;
margin: 16px 16px 0px 0px;
height: 50px;
width: 50px;
background-image: url('/rsrc/image/actions/edit.png');
}
.conpherence-header-pane .header-image {
position: absolute;
top: 15px;
left: 15px;
height: 50px;
width: 50px;
}
.conpherence-header-pane .custom-header-image {
position: absolute;
top: 0px;
left: 0px;
height: 80px;
width: 120px;
}
.conpherence-header-pane .title {
position: absolute;
font-size: 16px;
font-weight: bold;
left: 77px;
top: 21px;
right: 66px;
overflow-x: auto;
}
.conpherence-header-pane .custom-title {
position: absolute;
font-size: 16px;
font-weight: bold;
left: 132px;
top: 21px;
right: 66px;
overflow-x: auto;
}
.conpherence-header-pane .subtitle {
position: absolute;
left: 77px;
top: 40px;
right: 66px;
color: #bfbfbf;
}
.conpherence-header-pane .custom-subtitle {
position: absolute;
left: 132px;
top: 40px;
right: 66px;
color: #bfbfbf;
}
.conpherence-header-pane .upload-photo {
display: none;
}
.conpherence-header-upload-photo .upload-photo {
display: block;
width: 100%;
padding: 32px;
font-size: 16px;
background: #99ff99;
border-color: #669966;
}
.conpherence-header-upload-photo .edit,
.conpherence-header-upload-photo .header-image,
.conpherence-header-upload-photo .custom-header-image,
.conpherence-header-upload-photo .title,
.conpherence-header-upload-photo .custom-title,
.conpherence-header-upload-photo .subtitle,
.conpherence-header-upload-photo .custom-subtitle {
display: none;
}

View file

@ -6,7 +6,7 @@
position: fixed; position: fixed;
left: 300px; left: 300px;
right: 281px; right: 281px;
top: 125px; top: 76px;
min-width: 300px; min-width: 300px;
width: auto; width: auto;
height: 100%; height: 100%;
@ -33,8 +33,8 @@
position: fixed; position: fixed;
left: 300px; left: 300px;
right: 281px; right: 281px;
top: 125px; top: 76px;
bottom: 142px; bottom: 190px;
overflow-y: auto; overflow-y: auto;
box-shadow: inset 1px 4px 5px rgba(0,0,0,0.1); box-shadow: inset 1px 4px 5px rgba(0,0,0,0.1);
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
@ -52,7 +52,7 @@
.conpherence-message-pane .phabricator-form-view { .conpherence-message-pane .phabricator-form-view {
border-width: 0; border-width: 0;
background: none; background: none;
height: 143px; height: 190px;
padding: 0; padding: 0;
position: fixed; position: fixed;
bottom: 0; bottom: 0;
@ -121,7 +121,7 @@
} }
.conpherence-message-pane .remarkup-assist-textarea { .conpherence-message-pane .remarkup-assist-textarea {
height: 6em; height: 124px;
padding: 6px; padding: 6px;
border-width: 0 0 1px 0; border-width: 0 0 1px 0;
border-color: #e7e7e7; border-color: #e7e7e7;

View file

@ -5,7 +5,7 @@
.conpherence-widget-pane { .conpherence-widget-pane {
position: fixed; position: fixed;
right: 0px; right: 0px;
top: 125px; top: 76px;
width: 280px; width: 280px;
height: 100%; height: 100%;
border-width: 0 0 0 1px; border-width: 0 0 0 1px;
@ -75,7 +75,7 @@
.conpherence-widget-pane .widgets-body { .conpherence-widget-pane .widgets-body {
position: fixed; position: fixed;
overflow-y: auto; overflow-y: auto;
top: 165px; top: 116px;
bottom: 0px; bottom: 0px;
width: 100%; width: 100%;
} }
@ -161,6 +161,7 @@
.aphront-multi-column-fluid .aphront-multi-column-5-up .aphront-multi-column-fluid .aphront-multi-column-5-up
.aphront-multi-column-column-outer { .aphront-multi-column-column-outer {
width: 20%; width: 20%;
margin-bottom: 0px;
} }
.conpherence-widget-pane #widgets-calendar .aphront-multi-column-view .conpherence-widget-pane #widgets-calendar .aphront-multi-column-view
.aphront-multi-column-column-last { .aphront-multi-column-column-last {

View file

@ -1,39 +0,0 @@
/**
* @provides javelin-behavior-conpherence-drag-and-drop-photo
* @requires javelin-behavior
* javelin-dom
* javelin-workflow
* phabricator-drag-and-drop-file-upload
*/
JX.behavior('conpherence-drag-and-drop-photo', function(config) {
var target = JX.$(config.target);
var form_pane = JX.$(config.form_pane);
function onupload(f) {
var data = {
'file_id' : f.getID(),
'action' : 'metadata'
};
var form = JX.DOM.find(form_pane, 'form');
var workflow = JX.Workflow.newFromForm(form, data);
workflow.start();
}
if (JX.PhabricatorDragAndDropFileUpload.isSupported()) {
var drop = new JX.PhabricatorDragAndDropFileUpload(target)
.setURI(config.upload_uri);
drop.listen('didBeginDrag', function(e) {
JX.DOM.alterClass(target, config.activated_class, true);
});
drop.listen('didEndDrag', function(e) {
JX.DOM.alterClass(target, config.activated_class, false);
});
drop.listen('didUpload', onupload);
drop.start();
}
});

View file

@ -149,7 +149,7 @@ JX.behavior('conpherence-menu', function(config) {
'conpherence-toggle-widget', 'conpherence-toggle-widget',
null, null,
{ {
widget : 'widgets-files' widget : 'widgets-people'
} }
); );
} }