From a161617d8eb4181f9396fe7e686ed1d2590a85fc Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Fri, 15 Mar 2013 23:41:36 -0700 Subject: [PATCH] Conpherence - make the files widget purdy-ish Summary: does the title and also a few other small tweaks - kills the init js behavior; now its part of menu where it belongs. - adds the underline to the icon when its toggled in the widget menu - fixed JS initialization errors on the "create conpherence" page. Note I still like keeping all that init stuff in one function because its typing the same data a bunch to be passed over to the JS layer. Other ways to accomplish this obvi... Only fun wrinkle here is I think Chad intended me to display "when the file was attached". Instead, I display when the file was *uploaded*. I think this jives better with our version where you can't delete and all that. Files are pretty powerful, long-living objects in Phabricator land. Test Plan: added files to a conpherence and noted widget loaded updated okay. added a file with no author (generated by the system) and verified it still rendered okay. switched between conpherences and verified proper data in each files widget. uploaded image and text files to check the icons were correct. Reviewers: epriestley, chad Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2530 Differential Revision: https://secure.phabricator.com/D5337 --- src/__celerity_resource_map__.php | 14 +- .../controller/ConpherenceController.php | 45 ++- .../controller/ConpherenceListController.php | 2 +- .../ConpherenceUpdateController.php | 75 ++--- .../ConpherenceWidgetController.php | 287 +++++++++--------- .../query/ConpherenceThreadQuery.php | 23 +- .../view/ConpherenceFileWidgetView.php | 84 +++-- .../config/PhabricatorFilesConfigOptions.php | 35 +++ .../files/storage/PhabricatorFile.php | 6 + src/view/layout/PhabricatorFileLinkView.php | 16 +- .../application/conpherence/widget-pane.css | 68 ++++- .../application/conpherence/behavior-init.js | 20 -- .../application/conpherence/behavior-menu.js | 15 +- 13 files changed, 426 insertions(+), 264 deletions(-) delete mode 100644 webroot/rsrc/js/application/conpherence/behavior-init.js diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 7a4c32ef6e..5b5b962185 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -1174,21 +1174,9 @@ celerity_register_resource_map(array( ), 'disk' => '/rsrc/js/application/conpherence/behavior-drag-and-drop-photo.js', ), - 'javelin-behavior-conpherence-init' => - array( - 'uri' => '/res/700bba2e/rsrc/js/application/conpherence/behavior-init.js', - 'type' => 'js', - 'requires' => - array( - 0 => 'javelin-behavior', - 1 => 'javelin-dom', - 2 => 'javelin-stratcom', - ), - 'disk' => '/rsrc/js/application/conpherence/behavior-init.js', - ), 'javelin-behavior-conpherence-menu' => array( - 'uri' => '/res/cb1a5cf0/rsrc/js/application/conpherence/behavior-menu.js', + 'uri' => '/res/e5da1c05/rsrc/js/application/conpherence/behavior-menu.js', 'type' => 'js', 'requires' => array( diff --git a/src/applications/conpherence/controller/ConpherenceController.php b/src/applications/conpherence/controller/ConpherenceController.php index 9ff05a7dde..5e60d73e19 100644 --- a/src/applications/conpherence/controller/ConpherenceController.php +++ b/src/applications/conpherence/controller/ConpherenceController.php @@ -309,41 +309,36 @@ abstract class ConpherenceController extends PhabricatorController { } - protected function initJavelinBehaviors() { + protected function initJavelinBehaviors($more_than_menu = false) { Javelin::initBehavior('conpherence-menu', array( 'base_uri' => $this->getApplicationURI(''), 'header' => 'conpherence-header-pane', 'messages' => 'conpherence-messages', + 'messages_pane' => 'conpherence-message-pane', 'widgets_pane' => 'conpherence-widget-pane', 'form_pane' => 'conpherence-form', 'menu_pane' => 'conpherence-menu', + 'selected_conpherence_id' => $this->getSelectedConpherencePHID(), 'fancy_ajax' => (bool) $this->getSelectedConpherencePHID() )); - Javelin::initBehavior('conpherence-init', - array( - 'selected_conpherence_id' => $this->getSelectedConpherencePHID(), - 'menu_pane' => 'conpherence-menu', - 'messages_pane' => 'conpherence-message-pane', - 'messages' => 'conpherence-messages', - 'widgets_pane' => 'conpherence-widget-pane', - 'form_pane' => 'conpherence-form' - )); - 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', - )); - Javelin::initBehavior('conpherence-pontificate', - array( - 'messages' => 'conpherence-messages', - 'header' => 'conpherence-header-pane', - 'menu_pane' => 'conpherence-menu', - 'form_pane' => 'conpherence-form', - 'file_widget' => 'widgets-files', - )); + if ($more_than_menu) { + 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', + )); + Javelin::initBehavior('conpherence-pontificate', + array( + 'messages' => 'conpherence-messages', + 'header' => 'conpherence-header-pane', + 'menu_pane' => 'conpherence-menu', + 'form_pane' => 'conpherence-form', + 'file_widget' => 'widgets-files', + )); + } } } diff --git a/src/applications/conpherence/controller/ConpherenceListController.php b/src/applications/conpherence/controller/ConpherenceListController.php index 573c9a296b..ebc9cd5ff2 100644 --- a/src/applications/conpherence/controller/ConpherenceListController.php +++ b/src/applications/conpherence/controller/ConpherenceListController.php @@ -63,7 +63,7 @@ final class ConpherenceListController extends } private function renderEmptyMainPane() { - $this->initJavelinBehaviors(); + $this->initJavelinBehaviors(true); return phutil_tag( 'div', array( diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php index ca2a07fbf1..0f4b6927b9 100644 --- a/src/applications/conpherence/controller/ConpherenceUpdateController.php +++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php @@ -234,46 +234,47 @@ final class ConpherenceUpdateController extends $conpherence_id, $latest_transaction_id) { - $user = $this->getRequest()->getUser(); - $conpherence = id(new ConpherenceThreadQuery()) - ->setViewer($user) - ->setAfterID($latest_transaction_id) - ->needHeaderPics(true) - ->needWidgetData(true) - ->withIDs(array($conpherence_id)) - ->executeOne(); + $user = $this->getRequest()->getUser(); + $conpherence = id(new ConpherenceThreadQuery()) + ->setViewer($user) + ->setAfterID($latest_transaction_id) + ->needHeaderPics(true) + ->needWidgetData(true) + ->withIDs(array($conpherence_id)) + ->executeOne(); - $data = $this->renderConpherenceTransactions($conpherence); - $rendered_transactions = $data['transactions']; - $new_latest_transaction_id = $data['latest_transaction_id']; + $data = $this->renderConpherenceTransactions($conpherence); + $rendered_transactions = $data['transactions']; + $new_latest_transaction_id = $data['latest_transaction_id']; - $selected = true; - $nav_item = $this->buildConpherenceMenuItem( - $conpherence, - '-nav-item', - $selected); - $menu_item = $this->buildConpherenceMenuItem( - $conpherence, - '-menu-item', - $selected); + $selected = true; + $nav_item = $this->buildConpherenceMenuItem( + $conpherence, + '-nav-item', + $selected); + $menu_item = $this->buildConpherenceMenuItem( + $conpherence, + '-menu-item', + $selected); - $header = $this->buildHeaderPaneContent($conpherence); + $header = $this->buildHeaderPaneContent($conpherence); - $file_widget = id(new ConpherenceFileWidgetView()) - ->setConpherence($conpherence) - ->setUpdateURI( - $this->getApplicationURI('update/'.$conpherence->getID().'/')); - - $content = array( - 'transactions' => $rendered_transactions, - 'latest_transaction_id' => $new_latest_transaction_id, - 'menu_item' => $menu_item->render(), - 'nav_item' => $nav_item->render(), - 'conpherence_phid' => $conpherence->getPHID(), - 'header' => $header, - 'file_widget' => $file_widget->render() - ); - return $content; - } + $file_widget = id(new ConpherenceFileWidgetView()) + ->setUser($this->getRequest()->getUser()) + ->setConpherence($conpherence) + ->setUpdateURI( + $this->getApplicationURI('update/'.$conpherence->getID().'/')); + $content = array( + 'transactions' => $rendered_transactions, + 'latest_transaction_id' => $new_latest_transaction_id, + 'menu_item' => $menu_item->render(), + 'nav_item' => $nav_item->render(), + 'conpherence_phid' => $conpherence->getPHID(), + 'header' => $header, + 'file_widget' => $file_widget->render() + ); + return $content; } + +} diff --git a/src/applications/conpherence/controller/ConpherenceWidgetController.php b/src/applications/conpherence/controller/ConpherenceWidgetController.php index 0e2775878e..65a55e599b 100644 --- a/src/applications/conpherence/controller/ConpherenceWidgetController.php +++ b/src/applications/conpherence/controller/ConpherenceWidgetController.php @@ -76,115 +76,122 @@ final class ConpherenceWidgetController extends array( 'class' => 'widgets-header' ), - array( - javelin_tag( - 'a', - array( - 'sigil' => 'conpherence-change-widget', - 'meta' => array( - 'widget' => 'widgets-conpherence-list', - 'toggleClass' => 'conpherence_list_on' - ), - 'id' => 'widgets-conpherence-list-toggle', - 'class' => 'sprite-conpherence conpherence_list_off', - ), - ''), - javelin_tag( - 'a', - array( - 'sigil' => 'conpherence-change-widget', - 'meta' => array( - 'widget' => 'widgets-conversation', - 'toggleClass' => 'conpherence_conversation_on' - ), - 'id' => 'widgets-conpherence-conversation-toggle', - 'class' => 'sprite-conpherence conpherence_conversation_off', - ), - ''), - javelin_tag( - 'a', - array( - 'sigil' => 'conpherence-change-widget', - 'meta' => array( - 'widget' => 'widgets-people', - 'toggleClass' => 'conpherence_people_on' - ), - 'id' => 'widgets-people-toggle', - 'class' => 'sprite-conpherence conpherence_people_off' - ), - ''), - javelin_tag( - 'a', - array( - 'sigil' => 'conpherence-change-widget', - 'meta' => array( - 'widget' => 'widgets-files', - 'toggleClass' => 'conpherence_files_on' - ), - 'id' => 'widgets-files-toggle', - 'class' => 'sprite-conpherence conpherence_files_off' - ), - ''), - javelin_tag( - 'a', - array( - 'sigil' => 'conpherence-change-widget', - 'meta' => array( - 'widget' => 'widgets-calendar', - 'toggleClass' => 'conpherence_calendar_on' - ), - 'id' => 'widgets-calendar-toggle', - 'class' => 'sprite-conpherence conpherence_calendar_off', - ), - ''), - javelin_tag( - 'a', - array( - 'sigil' => 'conpherence-change-widget', - 'meta' => array( - 'widget' => 'widgets-settings', - 'toggleClass' => 'conpherence_settings_on' - ), - 'id' => 'widgets-settings-toggle', - 'class' => 'sprite-conpherence conpherence_settings_off', - ), - '') - )). phutil_tag( 'div', array( - 'class' => 'widgets-body', - 'id' => 'widgets-people', + 'class' => 'widgets-header-icon-holder' ), - $this->renderPeopleWidgetPaneContent()). + array( + javelin_tag( + 'a', + array( + 'sigil' => 'conpherence-change-widget', + 'meta' => array( + 'widget' => 'widgets-conpherence-list', + 'toggleClass' => 'conpherence_list_on' + ), + 'id' => 'widgets-conpherence-list-toggle', + 'class' => 'sprite-conpherence conpherence_list_off', + ), + ''), + javelin_tag( + 'a', + array( + 'sigil' => 'conpherence-change-widget', + 'meta' => array( + 'widget' => 'widgets-conversation', + 'toggleClass' => 'conpherence_conversation_on' + ), + 'id' => 'widgets-conpherence-conversation-toggle', + 'class' => 'sprite-conpherence conpherence_conversation_off', + ), + ''), + javelin_tag( + 'a', + array( + 'sigil' => 'conpherence-change-widget', + 'meta' => array( + 'widget' => 'widgets-people', + 'toggleClass' => 'conpherence_people_on' + ), + 'id' => 'widgets-people-toggle', + 'class' => 'sprite-conpherence conpherence_people_off' + ), + ''), + javelin_tag( + 'a', + array( + 'sigil' => 'conpherence-change-widget', + 'meta' => array( + 'widget' => 'widgets-files', + 'toggleClass' => 'conpherence_files_on' + ), + 'id' => 'widgets-files-toggle', + 'class' => + 'sprite-conpherence conpherence_files_on conpherence_files_off' + ), + ''), + javelin_tag( + 'a', + array( + 'sigil' => 'conpherence-change-widget', + 'meta' => array( + 'widget' => 'widgets-calendar', + 'toggleClass' => 'conpherence_calendar_on' + ), + 'id' => 'widgets-calendar-toggle', + 'class' => 'sprite-conpherence conpherence_calendar_off', + ), + ''), + javelin_tag( + 'a', + array( + 'sigil' => 'conpherence-change-widget', + 'meta' => array( + 'widget' => 'widgets-settings', + 'toggleClass' => 'conpherence_settings_on' + ), + 'id' => 'widgets-settings-toggle', + 'class' => 'sprite-conpherence conpherence_settings_off', + ), + '') + ))). + phutil_tag( + 'div', + array( + 'class' => 'widgets-body', + 'id' => 'widgets-people', + 'style' => 'display: none;' + ), + $this->renderPeopleWidgetPaneContent()). phutil_tag( 'div', array( 'class' => 'widgets-body', 'id' => 'widgets-files', - 'style' => 'display: none;' ), id(new ConpherenceFileWidgetView()) + ->setUser($this->getRequest()->getUser()) ->setConpherence($conpherence) ->setUpdateURI( $this->getApplicationURI('update/'.$conpherence->getID().'/')) ->render()). - phutil_tag( - 'div', - array( - 'class' => 'widgets-body', - 'id' => 'widgets-calendar', - 'style' => 'display: none;' - ), - $this->renderCalendarWidgetPaneContent()). - phutil_tag( - 'div', - array( - 'class' => 'widgets-body', - 'id' => 'widgets-settings', - 'style' => 'display: none' - ), - $this->renderSettingsWidgetPaneContent()); + phutil_tag( + 'div', + array( + 'class' => 'widgets-body', + 'id' => 'widgets-calendar', + 'style' => 'display: none;' + ), + $this->renderCalendarWidgetPaneContent()). + phutil_tag( + 'div', + array( + 'class' => 'widgets-body', + 'id' => 'widgets-settings', + 'style' => 'display: none' + ), + $this->renderSettingsWidgetPaneContent()); return array('widgets' => $widgets); } @@ -225,53 +232,53 @@ final class ConpherenceWidgetController extends break; } if ($status->getDateFrom() < $epoch_end && - $status->getDateTo() > $epoch_start) { - $timespan = $status->getDateTo() - $status->getDateFrom(); - if ($timespan > $one_day) { - $time_str = 'm/d'; - } else { - $time_str = 'h:i A'; - } - $epoch_range = phabricator_format_local_time( - $status->getDateFrom(), - $user, - $time_str) . ' - ' . phabricator_format_local_time( - $status->getDateTo(), - $user, - $time_str); + $status->getDateTo() > $epoch_start) { + $timespan = $status->getDateTo() - $status->getDateFrom(); + if ($timespan > $one_day) { + $time_str = 'm/d'; + } else { + $time_str = 'h:i A'; + } + $epoch_range = phabricator_format_local_time( + $status->getDateFrom(), + $user, + $time_str) . ' - ' . phabricator_format_local_time( + $status->getDateTo(), + $user, + $time_str); - $content[] = phutil_tag( - 'div', - array( - 'class' => 'user-status '.$status->getTextStatus(), - ), - array( - phutil_tag( - 'div', - array( - 'class' => 'epoch-range' - ), - $epoch_range), - phutil_tag( - 'div', - array( - 'class' => 'icon', - ), - ''), - phutil_tag( - 'div', - array( - 'class' => 'description' - ), - $status->getTerseSummary($user)), - phutil_tag( - 'div', - array( - 'class' => 'participant' - ), - $handles[$status->getUserPHID()]->getName()) - )); - } + $content[] = phutil_tag( + 'div', + array( + 'class' => 'user-status '.$status->getTextStatus(), + ), + array( + phutil_tag( + 'div', + array( + 'class' => 'epoch-range' + ), + $epoch_range), + phutil_tag( + 'div', + array( + 'class' => 'icon', + ), + ''), + phutil_tag( + 'div', + array( + 'class' => 'description' + ), + $status->getTerseSummary($user)), + phutil_tag( + 'div', + array( + 'class' => 'participant' + ), + $handles[$status->getUserPHID()]->getName()) + )); + } } } diff --git a/src/applications/conpherence/query/ConpherenceThreadQuery.php b/src/applications/conpherence/query/ConpherenceThreadQuery.php index 2bbf8f3742..5c2bc8476d 100644 --- a/src/applications/conpherence/query/ConpherenceThreadQuery.php +++ b/src/applications/conpherence/query/ConpherenceThreadQuery.php @@ -170,12 +170,19 @@ final class ConpherenceThreadQuery // attached files $files = array(); + $file_author_phids = array(); + $authors = array(); if ($file_phids) { $files = id(new PhabricatorFileQuery()) ->setViewer($this->getViewer()) ->withPHIDs($file_phids) ->execute(); $files = mpull($files, null, 'getPHID'); + $file_author_phids = mpull($files, 'getAuthorPHID', 'getPHID'); + $authors = id(new PhabricatorObjectHandleData($file_author_phids)) + ->setViewer($this->getViewer()) + ->loadHandles(); + $authors = mpull($authors, null, 'getPHID'); } foreach ($conpherences as $phid => $conpherence) { @@ -183,9 +190,23 @@ final class ConpherenceThreadQuery $statuses = array_select_keys($statuses, $participant_phids); $statuses = array_mergev($statuses); $statuses = msort($statuses, 'getDateFrom'); + + $conpherence_files = array(); + $files_authors = array(); + foreach ($conpherence->getFilePHIDs() as $curr_phid) { + $conpherence_files[$curr_phid] = $files[$curr_phid]; + // some files don't have authors so be careful + $current_author = null; + $current_author_phid = idx($file_author_phids, $curr_phid); + if ($current_author_phid) { + $current_author = $authors[$current_author_phid]; + } + $files_authors[$curr_phid] = $current_author; + } $widget_data = array( 'statuses' => $statuses, - 'files' => array_select_keys($files, $conpherence->getFilePHIDs()), + 'files' => $conpherence_files, + 'files_authors' => $files_authors ); $conpherence->attachWidgetData($widget_data); } diff --git a/src/applications/conpherence/view/ConpherenceFileWidgetView.php b/src/applications/conpherence/view/ConpherenceFileWidgetView.php index 6cf746300b..97a6b5d829 100644 --- a/src/applications/conpherence/view/ConpherenceFileWidgetView.php +++ b/src/applications/conpherence/view/ConpherenceFileWidgetView.php @@ -22,43 +22,89 @@ final class ConpherenceFileWidgetView extends AphrontView { } public function render() { + require_celerity_resource('sprite-docs-css'); $conpherence = $this->getConpherence(); $widget_data = $conpherence->getWidgetData(); $files = $widget_data['files']; - - $table_data = array(); + $files_authors = $widget_data['files_authors']; + $files_html = array(); foreach ($files as $file) { + $icon_class = $file->getDisplayIconForMimeType(); + $icon_view = phutil_tag( + 'div', + array( + 'class' => 'file-icon sprite-docs '.$icon_class + ), + ''); $file_view = id(new PhabricatorFileLinkView()) ->setFilePHID($file->getPHID()) ->setFileName($file->getName()) - ->setFileViewable(true) - ->setFileViewURI($file->getBestURI()); - $meta = $file_view->getMetadata(); + ->setFileViewable($file->isViewableImage()) + ->setFileViewURI($file->getBestURI()) + ->setCustomClass('file-title'); - $table_data[] = array( - javelin_tag( + $who_done_it_text = ''; + // system generated files don't have authors + if ($file->getAuthorPHID()) { + $who_done_it_text = pht( + 'by %s ', + $files_authors[$file->getPHID()]->renderLink()); + } + $date_text = phabricator_relative_date( + $file->getDateCreated(), + $this->getUser()); + + $who_done_it = phutil_tag( + 'div', + array( + 'class' => 'file-uploaded-by' + ), + pht('Uploaded %s%s.', $who_done_it_text, $date_text)); + + $extra = ''; + if ($file->isViewableImage()) { + $meta = $file_view->getMetadata(); + $extra = javelin_tag( 'a', array( 'sigil' => 'lightboxable', - 'meta' => $meta + 'meta' => $meta, + 'class' => 'file-extra', ), phutil_tag( 'img', array( - 'src' => $file->getThumb60x45URI() + 'src' => $file->getThumb160x120URI() ), - '')), - $file_view->render() - ); + '')); + } + + $divider = phutil_tag( + 'div', + array( + 'class' => 'divider' + ), + ''); + + $files_html[] = phutil_tag( + 'div', + array( + 'class' => 'file-entry' + ), + array( + $icon_view, + $file_view, + $who_done_it, + $extra, + $divider + )); } - $header = id(new PhabricatorHeaderView()) - ->setHeader(pht('Attached Files')); - $table = id(new AphrontTableView($table_data)) - ->setNoDataString(pht('No files attached to conpherence.')) - ->setHeaders(array('', pht('Name'))) - ->setColumnClasses(array('', 'wide wrap')); - return array($header, $table); + + return phutil_tag( + 'div', + array('class' => 'file-list'), + $files_html); } diff --git a/src/applications/files/config/PhabricatorFilesConfigOptions.php b/src/applications/files/config/PhabricatorFilesConfigOptions.php index 45b7512597..376b95da4a 100644 --- a/src/applications/files/config/PhabricatorFilesConfigOptions.php +++ b/src/applications/files/config/PhabricatorFilesConfigOptions.php @@ -38,6 +38,35 @@ final class PhabricatorFilesConfigOptions 'image/vnd.microsoft.icon' => true, ); + // largely lifted from http://en.wikipedia.org/wiki/Internet_media_type + $icon_default = array( + // audio file icon + 'audio/basic' => 'docs_audio', + 'audio/L24' => 'docs_audio', + 'audio/mp4' => 'docs_audio', + 'audio/mpeg' => 'docs_audio', + 'audio/ogg' => 'docs_audio', + 'audio/vorbis' => 'docs_audio', + 'audio/vnd.rn-realaudio' => 'docs_audio', + 'audio/vnd.wave' => 'docs_audio', + 'audio/webm' => 'docs_audio', + // movie file icon + 'video/mpeg' => 'docs_movie', + 'video/mp4' => 'docs_movie', + 'video/ogg' => 'docs_movie', + 'video/quicktime' => 'docs_movie', + 'video/webm' => 'docs_movie', + 'video/x-matroska' => 'docs_movie', + 'video/x-ms-wmv' => 'docs_movie', + 'video/x-flv' => 'docs_movie', + // pdf file icon + 'application/pdf' => 'docs_pdf', + // zip file icon + 'application/zip' => 'docs_zip', + // msword icon + 'application/msword' => 'docs_doc', + ) + array_fill_keys(array_keys($image_default), 'docs_image'); + return array( $this->newOption('files.viewable-mime-types', 'wild', $viewable_default) ->setSummary( @@ -58,6 +87,12 @@ final class PhabricatorFilesConfigOptions pht( 'List of MIME types which can be used as the `src` for an '. '`` tag.')), + $this->newOption('files.icon-mime-types', 'wild', $icon_default) + ->setSummary(pht('Configure which MIME types map to which icons.')) + ->setDescription( + pht( + 'Map of MIME type to icon name. MIME types which can not be '. + 'found default to icon `doc_files`.')), $this->newOption('storage.mysql-engine.max-size', 'int', 1000000) ->setSummary( pht( diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php index 3d4810d4e1..e746fd1a53 100644 --- a/src/applications/files/storage/PhabricatorFile.php +++ b/src/applications/files/storage/PhabricatorFile.php @@ -586,6 +586,12 @@ final class PhabricatorFile extends PhabricatorFileDAO return idx($mime_map, $mime_type); } + public function getDisplayIconForMimeType() { + $mime_map = PhabricatorEnv::getEnvConfig('files.icon-mime-types'); + $mime_type = $this->getMimeType(); + return idx($mime_map, $mime_type, 'docs_file'); + } + public function validateSecretKey($key) { return ($key == $this->getSecretKey()); } diff --git a/src/view/layout/PhabricatorFileLinkView.php b/src/view/layout/PhabricatorFileLinkView.php index dd8c582771..8551b4c567 100644 --- a/src/view/layout/PhabricatorFileLinkView.php +++ b/src/view/layout/PhabricatorFileLinkView.php @@ -7,6 +7,15 @@ final class PhabricatorFileLinkView extends AphrontView { private $fileViewURI; private $fileViewable; private $filePHID; + private $customClass; + + public function setCustomClass($custom_class) { + $this->customClass = $custom_class; + return $this; + } + public function getCustomClass() { + return $this->customClass; + } public function setFilePHID($file_phid) { $this->filePHID = $file_phid; @@ -71,11 +80,16 @@ final class PhabricatorFileLinkView extends AphrontView { $meta = $this->getMetadata(); } + $class = 'phabricator-remarkup-embed-layout-link'; + if ($this->getCustomClass()) { + $class = $this->getCustomClass(); + } + return javelin_tag( 'a', array( 'href' => $this->getFileViewURI(), - 'class' => 'phabricator-remarkup-embed-layout-link', + 'class' => $class, 'sigil' => $sigil, 'meta' => $meta, 'mustcapture' => $mustcapture, diff --git a/webroot/rsrc/css/application/conpherence/widget-pane.css b/webroot/rsrc/css/application/conpherence/widget-pane.css index f71050a45f..97a6b19e58 100644 --- a/webroot/rsrc/css/application/conpherence/widget-pane.css +++ b/webroot/rsrc/css/application/conpherence/widget-pane.css @@ -5,7 +5,7 @@ .conpherence-widget-pane { position: fixed; right: 0px; - top: 125px; + top: 124px; width: 320px; height: 100%; border-width: 0 0 0 1px; @@ -21,10 +21,17 @@ } .conpherence-widget-pane .widgets-header { + background-color: #d8dce2; + width: 320px; + box-shadow: 0px 2px 2px rgba(0,0,0,0.15); +} + +.conpherence-widget-pane .widgets-header .widgets-header-icon-holder { height: 40px; } -.device-desktop .conpherence-widget-pane .widgets-header { +.device-desktop .conpherence-widget-pane .widgets-header +.widgets-header-icon-holder { width: 196px; margin: 0px auto 0px auto; } @@ -32,12 +39,21 @@ .conpherence-widget-pane .widgets-header .sprite-conpherence { display: block; width: 29px; - height: 33px; + height: 34px; margin: 4px 0px 0px 20px; float: left; clear: none; } +.conpherence-widget-pane .widgets-header .conpherence_list_on, +.conpherence-widget-pane .widgets-header .conpherence_conversation_on, +.conpherence-widget-pane .widgets-header .conpherence_people_on, +.conpherence-widget-pane .widgets-header .conpherence_files_on, +.conpherence-widget-pane .widgets-header .conpherence_calendar_on, +.conpherence-widget-pane .widgets-header .conpherence_settings_on { + border-bottom: 3px solid #525252; +} + .device-desktop .conpherence-widget-pane .widgets-header #widgets-conpherence-list-toggle, .device-desktop .conpherence-widget-pane .widgets-header @@ -53,10 +69,52 @@ width: 320px; } -/* calendar widget */ +/* files widget */ -.conpherence-widget-pane #widgets-calendar { +.conpherence-widget-pane #widgets-files .file-entry { + padding: 12px 0px 14px 0px; + width: 320px; } +.conpherence-widget-pane #widgets-files .file-icon { + position: relative; + top: 0px; + left: 8px; + width: 32px; + height: 32px; + float: left; +} +.conpherence-widget-pane #widgets-files .file-title { + position: relative; + top: -4px; + left: 20px; + font-weight: bold; +} +.conpherence-widget-pane #widgets-files .file-uploaded-by { + color: #bfbfbf; + position: relative; + top: 0px; + left: 20px; + width: 270px; + font-size: 11px; +} + +.conpherence-widget-pane #widgets-files .file-extra { + display: block; + height: 120px; + width: 160px; + margin: 8px 0px 8px 52px; + border: 1px solid rgb(24, 85, 157); +} + +.conpherence-widget-pane #widgets-files .divider { + float: left; + clear: both; + width: 242px; + margin: 8px 0px 0px 52px; + border: 1px dashed #bfbfbf; +} + +/* calendar widget */ .conpherence-widget-pane #widgets-calendar .user-status { height: 60px; diff --git a/webroot/rsrc/js/application/conpherence/behavior-init.js b/webroot/rsrc/js/application/conpherence/behavior-init.js deleted file mode 100644 index 1f43f25d25..0000000000 --- a/webroot/rsrc/js/application/conpherence/behavior-init.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @provides javelin-behavior-conpherence-init - * @requires javelin-behavior - * javelin-dom - * javelin-stratcom - */ -JX.behavior('conpherence-init', function(config) { - // select the current message - var selectedConpherence = false; - if (config.selected_conpherence_id) { - var selected = JX.$(config.selected_conpherence_id + '-nav-item'); - JX.Stratcom.invoke( - 'conpherence-initial-selected', - null, - { selected : selected } - ); - selectedConpherence = true; - } - -}); diff --git a/webroot/rsrc/js/application/conpherence/behavior-menu.js b/webroot/rsrc/js/application/conpherence/behavior-menu.js index ae6339e9ae..c528e0cf23 100644 --- a/webroot/rsrc/js/application/conpherence/behavior-menu.js +++ b/webroot/rsrc/js/application/conpherence/behavior-menu.js @@ -11,8 +11,6 @@ JX.behavior('conpherence-menu', function(config) { - var root = JX.$(config.form_pane); - function onwidgetresponse(context, response) { var widgets = JX.$H(response.widgets); var widgetsRoot = JX.$(config.widgets_pane); @@ -112,6 +110,7 @@ JX.behavior('conpherence-menu', function(config) { JX.Stratcom.listen('click', 'conpherence-edit-metadata', function (e) { e.kill(); + var root = JX.$(config.form_pane); var form = JX.DOM.find(root, 'form'); var data = e.getNodeData('conpherence-edit-metadata'); new JX.Workflow.newFromForm(form, data) @@ -145,4 +144,16 @@ JX.behavior('conpherence-menu', function(config) { .send(); }); + // select the current message + var selectedConpherence = false; + if (config.selected_conpherence_id) { + var selected = JX.$(config.selected_conpherence_id + '-nav-item'); + JX.Stratcom.invoke( + 'conpherence-initial-selected', + null, + { selected : selected } + ); + selectedConpherence = true; + } + });