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

Conpherence - make conpherence load the bare minimum of data

Summary: also re-enables the updating of the widgets and "cleans up" the javascript a tad. Ref T2867

Test Plan: all sorts of conpherence fun like adding people to threads, adding files, pontificating, etc

Reviewers: epriestley, chad

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2867

Differential Revision: https://secure.phabricator.com/D5595
This commit is contained in:
Bob Trahan 2013-04-08 11:13:35 -07:00
parent dbcd38aa88
commit 18c76b8a46
17 changed files with 222 additions and 235 deletions

View file

@ -913,7 +913,7 @@ celerity_register_resource_map(array(
),
'conpherence-menu-css' =>
array(
'uri' => '/res/69980966/rsrc/css/application/conpherence/menu.css',
'uri' => '/res/7413379f/rsrc/css/application/conpherence/menu.css',
'type' => 'css',
'requires' =>
array(
@ -940,7 +940,7 @@ celerity_register_resource_map(array(
),
'conpherence-widget-pane-css' =>
array(
'uri' => '/res/fda7cf40/rsrc/css/application/conpherence/widget-pane.css',
'uri' => '/res/28fbffe3/rsrc/css/application/conpherence/widget-pane.css',
'type' => 'css',
'requires' =>
array(
@ -1289,7 +1289,7 @@ celerity_register_resource_map(array(
),
'javelin-behavior-conpherence-menu' =>
array(
'uri' => '/res/29585411/rsrc/js/application/conpherence/behavior-menu.js',
'uri' => '/res/e8479b8e/rsrc/js/application/conpherence/behavior-menu.js',
'type' => 'js',
'requires' =>
array(
@ -1305,7 +1305,7 @@ celerity_register_resource_map(array(
),
'javelin-behavior-conpherence-pontificate' =>
array(
'uri' => '/res/ae5f5f61/rsrc/js/application/conpherence/behavior-pontificate.js',
'uri' => '/res/68f1e046/rsrc/js/application/conpherence/behavior-pontificate.js',
'type' => 'js',
'requires' =>
array(
@ -1319,7 +1319,7 @@ celerity_register_resource_map(array(
),
'javelin-behavior-conpherence-widget-pane' =>
array(
'uri' => '/res/c0990399/rsrc/js/application/conpherence/behavior-widget-pane.js',
'uri' => '/res/0c0fc5ef/rsrc/js/application/conpherence/behavior-widget-pane.js',
'type' => 'js',
'requires' =>
array(

View file

@ -46,7 +46,7 @@ abstract class ConpherenceController extends PhabricatorController {
$all_conpherences = id(new ConpherenceThreadQuery())
->setViewer($user)
->withPHIDs($all_conpherence_phids)
->needAllTransactions(true)
->needParticipantCache(true)
->execute();
$unread_conpherences = array_select_keys(
$all_conpherences,

View file

@ -31,7 +31,6 @@ final class ConpherenceListController
if ($conpherence_id) {
$conpherence = id(new ConpherenceThreadQuery())
->setViewer($user)
->needAllTransactions(true)
->withIDs(array($conpherence_id))
->executeOne();
if (!$conpherence) {

View file

@ -30,9 +30,9 @@ final class ConpherenceUpdateController
$conpherence = id(new ConpherenceThreadQuery())
->setViewer($user)
->withIDs(array($conpherence_id))
->needFilePHIDs(true)
->needOrigPics(true)
->needHeaderPics(true)
->needAllTransactions(true)
->executeOne();
$supported_formats = PhabricatorFile::getTransformableImageFormats();
@ -327,7 +327,7 @@ final class ConpherenceUpdateController
->setAfterMessageID($latest_transaction_id)
->needHeaderPics(true)
->needWidgetData(true)
->needAllTransactions(true)
->needTransactions(true)
->withIDs(array($conpherence_id))
->executeOne();
@ -358,10 +358,8 @@ final class ConpherenceUpdateController
'nav_item' => hsprintf('%s', $nav_item),
'conpherence_phid' => $conpherence->getPHID(),
'header' => hsprintf('%s', $header),
// TODO: Fix these.
// 'file_widget' => $file_widget->render(),
// 'people_widget' => $people_widget->render()
'file_widget' => $file_widget->render(),
'people_widget' => $people_widget->render()
);
return $content;
}

View file

@ -41,7 +41,7 @@ final class ConpherenceViewController extends
->setViewer($user)
->withIDs(array($conpherence_id))
->needHeaderPics(true)
->needAllTransactions(true)
->needTransactions(true)
->executeOne();
$this->setConpherence($conpherence);
@ -105,7 +105,6 @@ final class ConpherenceViewController extends
->setWorkflow(true)
->setUser($user)
->addHiddenInput('action', 'message')
->addHiddenInput('latest_transaction_id', $latest_transaction_id)
->appendChild(
id(new PhabricatorRemarkupControl())
->setUser($user)
@ -113,6 +112,19 @@ final class ConpherenceViewController extends
->appendChild(
id(new AphrontFormSubmitControl())
->setValue(pht('Pontificate')))
->appendChild(
javelin_tag(
'input',
array(
'type' => 'hidden',
'name' => 'latest_transaction_id',
'value' => $latest_transaction_id,
'sigil' => 'latest-transaction-id',
'meta' => array(
'id' => $latest_transaction_id
)
),
''))
->render();
$scrollbutton = javelin_tag(

View file

@ -50,7 +50,6 @@ final class ConpherenceWidgetController extends
->setViewer($user)
->withIDs(array($conpherence_id))
->needWidgetData(true)
->needAllTransactions(true)
->executeOne();
$this->setConpherence($conpherence);
@ -69,11 +68,6 @@ final class ConpherenceWidgetController extends
Javelin::initBehavior(
'conpherence-widget-pane',
array(
'header' => 'conpherence-header-pane',
'messages' => 'conpherence-messages',
'people_widget' => 'widgets-people',
'file_widget' => 'widgets-files',
'settings_widget' => 'widgets-settings',
'widgetRegistery' => array(
'widgets-conpherence-list' => $cant_toggle,
'widgets-conversation' => $cant_toggle,
@ -174,22 +168,24 @@ final class ConpherenceWidgetController extends
)));
$user = $this->getRequest()->getUser();
// now the widget bodies
$widgets[] = phutil_tag(
$widgets[] = javelin_tag(
'div',
array(
'class' => 'widgets-body',
'id' => 'widgets-people',
'sigil' => 'widgets-people',
'style' => 'display: none;'
),
id(new ConpherencePeopleWidgetView())
->setUser($user)
->setConpherence($conpherence)
->setUpdateURI($this->getWidgetURI()));
$widgets[] = phutil_tag(
$widgets[] = javelin_tag(
'div',
array(
'class' => 'widgets-body',
'id' => 'widgets-files',
'sigil' => 'widgets-files',
),
id(new ConpherenceFileWidgetView())
->setUser($user)
@ -257,10 +253,10 @@ final class ConpherenceWidgetController extends
'name' => 'action',
'value' => 'notifications'
)),
javelin_tag(
phutil_tag(
'button',
array(
'sigil' => 'notifications-update',
'type' => 'submit',
'class' => 'notifications-update grey',
),
pht('Update Notifications'))
@ -271,6 +267,7 @@ final class ConpherenceWidgetController extends
array(
'method' => 'POST',
'action' => $this->getWidgetURI(),
'sigil' => 'notifications-update',
),
$layout);
}

View file

@ -11,9 +11,21 @@ final class ConpherenceThreadQuery
private $needWidgetData;
private $needHeaderPics;
private $needOrigPics;
private $needAllTransactions;
private $needTransactions;
private $needParticipantCache;
private $needFilePHIDs;
private $afterMessageID;
public function needFilePHIDs($need_file_phids) {
$this->needFilePHIDs = $need_file_phids;
return $this;
}
public function needParticipantCache($participant_cache) {
$this->needParticipantCache = $participant_cache;
return $this;
}
public function needOrigPics($need_orig_pics) {
$this->needOrigPics = $need_orig_pics;
return $this;
@ -29,8 +41,8 @@ final class ConpherenceThreadQuery
return $this;
}
public function needAllTransactions($need_all_transactions) {
$this->needAllTransactions = $need_all_transactions;
public function needTransactions($need_transactions) {
$this->needTransactions = $need_transactions;
return $this;
}
@ -66,14 +78,18 @@ final class ConpherenceThreadQuery
if ($conpherences) {
$conpherences = mpull($conpherences, null, 'getPHID');
$this->loadParticipants($conpherences);
if ($this->needAllTransactions) {
$this->loadParticipantsAndInitHandles($conpherences);
if ($this->needParticipantCache) {
$this->loadCoreHandles($conpherences, 'getRecentParticipantPHIDs');
} else if ($this->needWidgetData) {
$this->loadCoreHandles($conpherences, 'getParticipantPHIDs');
}
if ($this->needTransactions) {
$this->loadTransactionsAndHandles($conpherences);
}
if ($this->needFilePHIDs || $this->needWidgetData) {
$this->loadFilePHIDs($conpherences);
}
if ($this->needWidgetData) {
$this->loadWidgetData($conpherences);
}
@ -110,7 +126,7 @@ final class ConpherenceThreadQuery
return $this->formatWhereClause($where);
}
private function loadParticipants(array $conpherences) {
private function loadParticipantsAndInitHandles(array $conpherences) {
$participants = id(new ConpherenceParticipant())
->loadAllWhere('conpherencePHID IN (%Ls)', array_keys($conpherences));
$map = mgroup($participants, 'getConpherencePHID');
@ -121,11 +137,32 @@ final class ConpherenceThreadQuery
null,
'getParticipantPHID');
$current_conpherence->attachParticipants($conpherence_participants);
$current_conpherence->attachHandles(array());
}
return $this;
}
private function loadCoreHandles(
array $conpherences,
$method) {
$handle_phids = array();
foreach ($conpherences as $conpherence) {
$handle_phids[$conpherence->getPHID()] =
$conpherence->$method();
}
$flat_phids = array_mergev($handle_phids);
$handles = id(new PhabricatorObjectHandleData($flat_phids))
->setViewer($this->getViewer())
->loadHandles();
foreach ($handle_phids as $conpherence_phid => $phids) {
$conpherence = $conpherences[$conpherence_phid];
$conpherence->attachHandles(array_select_keys($handles, $phids));
}
return $this;
}
private function loadTransactionsAndHandles(array $conpherences) {
$transactions = id(new ConpherenceTransactionQuery())
->setViewer($this->getViewer())
@ -141,7 +178,7 @@ final class ConpherenceThreadQuery
foreach ($current_transactions as $transaction) {
$handles += $transaction->getHandles();
}
$conpherence->attachHandles($handles);
$conpherence->attachHandles($conpherence->getHandles() + $handles);
$conpherence->attachTransactions($transactions[$phid]);
}
return $this;

View file

@ -173,107 +173,51 @@ final class ConpherenceThread extends ConpherenceDAO
}
public function getDisplayData(PhabricatorUser $user, $size) {
$transactions = $this->getTransactions();
$recent_phids = $this->getRecentParticipantPHIDs();
$handles = $this->getHandles();
// we don't want to show the user unless they are babbling to themselves
if (count($handles) > 1) {
unset($handles[$user->getPHID()]);
// luck has little to do with it really; most recent participant who isn't
// the user....
$lucky_phid = null;
$lucky_index = null;
foreach ($recent_phids as $index => $phid) {
if ($phid == $user->getPHID()) {
continue;
}
$lucky_phid = $phid;
break;
}
reset($recent_phids);
if ($lucky_phid) {
$lucky_handle = $handles[$lucky_phid];
// this will be just the user talking to themselves. weirdos.
} else {
$lucky_handle = reset($handles);
}
$participants = $this->getParticipants();
$user_participation = $participants[$user->getPHID()];
$latest_transaction = null;
$title = $this->getTitle();
$subtitle = '';
$img_src = null;
$img_class = null;
if ($this->getImagePHID($size)) {
if (!$title) {
$title = $lucky_handle->getName();
}
$image = $this->getImagePHID($size);
if ($image) {
$img_src = $this->getImage($size)->getBestURI();
$img_class = 'custom-';
}
$unread_count = 0;
$max_count = 10;
$snippet = null;
if (!$user_participation->isUpToDate()) {
$behind_transaction_phid =
$user_participation->getBehindTransactionPHID();
} else {
$behind_transaction_phid = null;
}
foreach (array_reverse($transactions) as $transaction) {
switch ($transaction->getTransactionType()) {
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
case ConpherenceTransactionType::TYPE_TITLE:
case ConpherenceTransactionType::TYPE_PICTURE:
continue 2;
case PhabricatorTransactions::TYPE_COMMENT:
if ($snippet === null) {
$snippet = phutil_utf8_shorten(
$transaction->getComment()->getContent(),
48);
if ($transaction->getAuthorPHID() == $user->getPHID()) {
$snippet = "\xE2\x86\xB0 " . $snippet;
}
}
// fallthrough intentionally here
case ConpherenceTransactionType::TYPE_FILES:
if (!$latest_transaction) {
$latest_transaction = $transaction;
}
$latest_participant_phid = $transaction->getAuthorPHID();
if ((!$title || !$img_src) &&
$latest_participant_phid != $user->getPHID()) {
$latest_handle = $handles[$latest_participant_phid];
if (!$img_src) {
$img_src = $latest_handle->getImageURI();
}
if (!$title) {
$title = $latest_handle->getName();
// (maybs) used the pic, definitely used the name -- discard
unset($handles[$latest_participant_phid]);
}
}
if ($behind_transaction_phid) {
$unread_count++;
if ($transaction->getPHID() == $behind_transaction_phid) {
break 2;
}
}
if ($unread_count > $max_count) {
break 2;
}
break;
default:
continue 2;
}
if ($snippet && !$behind_transaction_phid) {
break;
}
}
if ($unread_count > $max_count) {
$unread_count = $max_count.'+';
}
// This happens if the user has been babbling, maybs just to themselves,
// but enough un-responded to transactions for our SQL limit would
// hit this too... Also happens on new threads since only the first
// author has participated.
// ...so just pick a different handle in these cases.
$some_handle = reset($handles);
if (!$img_src) {
$img_src = $some_handle->getImageURI();
}
if (!$title) {
$title = $some_handle->getName();
$img_src = $lucky_handle->getImageURI();
$img_class = null;
}
$count = 0;
$final = false;
foreach ($handles as $handle) {
if ($handle->getType() != PhabricatorPHIDConstants::PHID_TYPE_USER) {
$subtitle = null;
foreach ($recent_phids as $phid) {
if ($phid == $user->getPHID()) {
continue;
}
$handle = $handles[$phid];
if ($subtitle) {
if ($final) {
$subtitle .= '...';
@ -287,14 +231,18 @@ final class ConpherenceThread extends ConpherenceDAO
$final = $count == 3;
}
$participants = $this->getParticipants();
$user_participation = $participants[$user->getPHID()];
$unread_count = $this->getMessageCount() -
$user_participation->getSeenMessageCount();
return array(
'title' => $title,
'subtitle' => $subtitle,
'unread_count' => $unread_count,
'epoch' => $latest_transaction->getDateCreated(),
'epoch' => $this->getDateModified(),
'image' => $img_src,
'image_class' => $img_class,
'snippet' => $snippet,
);
}

View file

@ -9,7 +9,6 @@ final class ConpherenceMenuItemView extends AphrontTagView {
private $subtitle;
private $imageURI;
private $href;
private $messageText;
private $epoch;
private $unreadCount;
@ -21,14 +20,6 @@ final class ConpherenceMenuItemView extends AphrontTagView {
return $this->unreadCount;
}
public function setMessageText($message_text) {
$this->messageText = $message_text;
return $this;
}
public function getMessageText() {
return $this->messageText;
}
public function setEpoch($epoch) {
$this->epoch = $epoch;
return $this;
@ -111,15 +102,6 @@ final class ConpherenceMenuItemView extends AphrontTagView {
),
$this->subtitle);
}
$message = null;
if ($this->messageText) {
$message = phutil_tag(
'span',
array(
'class' => 'conpherence-menu-item-message-text'
),
$this->messageText);
}
$epoch = null;
if ($this->epoch) {
$epoch = phutil_tag(
@ -143,7 +125,6 @@ final class ConpherenceMenuItemView extends AphrontTagView {
$image,
$title,
$subtitle,
$message,
$epoch,
$unread_count,
);

View file

@ -18,6 +18,10 @@ final class ConpherencePeopleWidgetView extends ConpherenceWidgetView {
array(
'method' => 'POST',
'action' => $this->getUpdateURI(),
'sigil' => 'add-person',
'meta' => array(
'action' => 'add_person'
)
),
array(
id(new AphrontFormTokenizerControl())
@ -26,15 +30,11 @@ final class ConpherencePeopleWidgetView extends ConpherenceWidgetView {
->setUser($user)
->setDatasource('/typeahead/common/users/')
->setLimit(1),
javelin_tag(
phutil_tag(
'button',
array(
'sigil' => 'add-person',
'type' => 'submit',
'class' => 'people-add-button',
'meta' => array(
'action' => 'add_person',
'latest_transaction_id' => $this->getLatestTransactionID()
)
),
pht('Add'))
));
@ -73,7 +73,6 @@ final class ConpherencePeopleWidgetView extends ConpherenceWidgetView {
'meta' => array(
'remove_person' => $handle->getPHID(),
'action' => 'remove_person',
'latest_transaction_id' => $this->getLatestTransactionID()
)
),
phutil_tag(
@ -105,6 +104,5 @@ final class ConpherencePeopleWidgetView extends ConpherenceWidgetView {
}
return array($header, $body);
}
}

View file

@ -66,7 +66,6 @@ final class ConpherenceThreadListView extends AphrontView {
$unread_count = $data['unread_count'];
$epoch = $data['epoch'];
$image = $data['image'];
$snippet = $data['snippet'];
return id(new ConpherenceMenuItemView())
->setUser($user)
@ -75,7 +74,6 @@ final class ConpherenceThreadListView extends AphrontView {
->setHref($uri)
->setEpoch($epoch)
->setImageURI($image)
->setMessageText($snippet)
->setUnreadCount($unread_count)
->setID($thread->getPHID().'-nav-item')
->addSigil('conpherence-menu-click')

View file

@ -23,11 +23,4 @@ abstract class ConpherenceWidgetView extends AphrontView {
public function getConpherence() {
return $this->conpherence;
}
public function getLatestTransactionID() {
$transactions = $this->getConpherence()->getTransactions();
$latest = end($transactions);
return $latest->getID();
}
}

View file

@ -59,7 +59,7 @@ div.conpherence-layout .phabricator-nav-column-background {
.conpherence-menu .conpherence-menu-item-view {
display: block;
height: 70px;
height: 55px;
width: 100%;
overflow: hidden;
position: relative;
@ -84,45 +84,37 @@ div.conpherence-layout .phabricator-nav-column-background {
left: 6px;
display: block;
position: absolute;
width: 50px;
height: 50px;
width: 35px;
height: 35px;
background-size: 35px;
border: 4px solid rgb(29, 32, 34);
border-radius: 2px;
border-radius: 3px;
}
.conpherence-menu .conpherence-menu-item-view .conpherence-menu-item-title {
display: block;
margin-top: 12px;
margin-left: 70px;
margin-left: 58px;
text-align: left;
font-weight: bold;
font-size: 12px;
font-size: 13px;
color: #ffffff;
text-shadow: 0px 1px 1px #000000;
}
.conpherence-menu .conpherence-menu-item-view .conpherence-menu-item-subtitle {
display: block;
color: #bfbfbf;
color: #a1a5a9;
font-size: 11px;
margin-top: 2px;
margin-left: 70px;
margin-left: 58px;
font-style: italic;
}
.conpherence-menu .conpherence-menu-item-view
.conpherence-menu-item-message-text {
display: block;
color: #66CCFF;
font-size: 12px;
margin-top: 4px;
margin-left: 70px;
}
.conpherence-menu .conpherence-menu-item-view
.conpherence-menu-item-unread-count {
position: absolute;
left: 48px;
left: 35px;
top: 3px;
background: #f00;
border-radius: 10px;
@ -140,10 +132,10 @@ div.conpherence-layout .phabricator-nav-column-background {
.conpherence-menu .conpherence-menu-item-view .conpherence-menu-item-date {
position: absolute;
top: 10px;
right: 12px;
color: white;
font-size: 12px;
top: 15px;
right: 16px;
color: #a1a5a9;
font-size: 11px;
}
.no-conpherences-menu-item {

View file

@ -337,7 +337,7 @@
clear: none;
font-size: 14px;
font-weight: bold;
width: 166px;
width: 164px;
}
.conpherence-widget-pane .person-entry .pic {

View file

@ -29,13 +29,12 @@ JX.behavior('conpherence-menu', function(config) {
}
function selectthread(node) {
if (node === thread.node) {
return;
}
if (thread.node) {
JX.DOM.alterClass(thread.node, 'conpherence-selected', false);
JX.DOM.alterClass(thread.node, 'hide-unread-count', false);
// keep the unread-count hidden still. big TODO once we ajax in updates
// to threads to make this work right and move threads between read /
// unread
}
JX.DOM.alterClass(node, 'conpherence-selected', true);
@ -47,10 +46,18 @@ JX.behavior('conpherence-menu', function(config) {
thread.selected = data.id;
JX.History.replace(config.base_uri + data.id + '/');
redrawthread();
}
JX.Stratcom.listen(
'conpherence-selectthread',
null,
function (e) {
var node = JX.$(e.getData().id);
selectthread(node);
}
);
function redrawthread() {
if (!thread.node) {
return;
@ -67,6 +74,8 @@ JX.behavior('conpherence-menu', function(config) {
new JX.Workflow(uri, {})
.setHandler(onresponse)
.start();
} else {
didredrawthread();
}
if (thread.visible !== null || !config.hasWidgets) {
@ -183,7 +192,6 @@ JX.behavior('conpherence-menu', function(config) {
if (!config.hasThreadList) {
loadthreads();
didredrawthread();
} else {
didloadthreads();
}
@ -192,7 +200,6 @@ JX.behavior('conpherence-menu', function(config) {
JX.Stratcom.listen('phabricator-device-change', null, ondevicechange);
ondevicechange();
function loadthreads() {
var uri = config.base_uri + 'thread/' + config.selectedID + '/';
new JX.Workflow(uri)
@ -221,7 +228,6 @@ JX.behavior('conpherence-menu', function(config) {
}
}
}
redrawthread();
}

View file

@ -16,6 +16,12 @@ JX.behavior('conpherence-pontificate', function(config) {
var root = e.getNode('conpherence-layout');
var messages = JX.DOM.find(root, 'div', 'conpherence-messages');
var header = JX.DOM.find(root, 'div', 'conpherence-header');
var fileWidget = null;
try {
fileWidget = JX.DOM.find(root, 'div', 'widgets-files');
} catch (ex) {
// Ignore; maybe no files widget
}
JX.Workflow.newFromForm(form)
.setHandler(JX.bind(this, function(r) {
@ -25,16 +31,28 @@ JX.behavior('conpherence-pontificate', function(config) {
JX.DOM.setContent(header, JX.$H(r.header));
try {
var node = JX.$(r.conpherence_phid + '-nav-item');
JX.DOM.replace(
JX.$(r.conpherence_phid + '-nav-item'),
node,
JX.$H(r.nav_item));
JX.Stratcom.invoke(
'conpherence-selectthread',
null,
{ id : r.conpherence_phid + '-nav-item' }
);
} catch (ex) {
// Ignore; this view may not have a menu.
}
if (fileWidget) {
JX.DOM.setContent(
fileWidget,
JX.$H(r.file_widget)
);
}
var inputs = JX.DOM.scry(form, 'input');
for (var ii = 0; ii < inputs.length; ii++) {
JX.log(inputs[ii]);
if (inputs[ii].name == 'latest_transaction_id') {
inputs[ii].value = r.latest_transaction_id;
break;

View file

@ -40,65 +40,76 @@ JX.behavior('conpherence-widget-pane', function(config) {
);
/* people widget */
var peopleRoot = JX.$(config.people_widget);
var peopleUpdateHandler = function (r) {
JX.Stratcom.listen(
['submit', 'didSyntheticSubmit'],
'add-person',
function (e) {
e.kill();
var root = e.getNode('conpherence-layout');
var form = e.getNode('tag:form');
var data = e.getNodeData('add-person');
var peopleRoot = e.getNode('widgets-people');
var messages = JX.DOM.find(root, 'div', 'conpherence-messages');
var header = JX.DOM.find(root, 'div', 'conpherence-header');
var latestTransactionData = JX.Stratcom.getData(
JX.DOM.find(
root,
'input',
'latest-transaction-id'
));
data.latest_transaction_id = latestTransactionData.id;
JX.Workflow.newFromForm(form, data)
.setHandler(JX.bind(this, function (r) {
// update the transactions
var messages = JX.$(config.messages);
JX.DOM.appendContent(messages, JX.$H(r.transactions));
messages.scrollTop = messages.scrollHeight;
// update the menu entry as well
try {
JX.DOM.replace(
JX.$(r.conpherence_phid + '-nav-item'),
JX.$H(r.nav_item)
JX.$H(r.nav_item));
JX.Stratcom.invoke(
'conpherence-selectthread',
null,
{ id : r.conpherence_phid + '-nav-item' }
);
} catch (ex) {
// Ignore; this view may not have a menu.
}
// update the header
JX.DOM.setContent(
JX.$(config.header),
header,
JX.$H(r.header)
);
// update the people widget
JX.DOM.setContent(
JX.$(config.people_widget),
peopleRoot,
JX.$H(r.people_widget)
);
};
JX.DOM.listen(
peopleRoot,
['click'],
'add-person',
function (e) {
e.kill();
var form = JX.DOM.find(peopleRoot, 'form');
var data = e.getNodeData('add-person');
JX.Workflow.newFromForm(form, data)
.setHandler(peopleUpdateHandler)
}))
.start();
}
);
JX.DOM.listen(
peopleRoot,
JX.Stratcom.listen(
['click'],
'remove-person',
function (e) {
var peopleRoot = e.getNode('widgets-people');
var form = JX.DOM.find(peopleRoot, 'form');
var data = e.getNodeData('remove-person');
// we end up re-directing to conpherence home
JX.Workflow.newFromForm(form, data)
.setHandler(peopleUpdateHandler)
.start();
}
);
/* settings widget */
var settingsRoot = JX.$(config.settings_widget);
var onsubmitSettings = function (e) {
e.kill();
var form = JX.DOM.find(settingsRoot, 'form');
var form = e.getNode('tag:form');
var button = JX.DOM.find(form, 'button');
JX.Workflow.newFromForm(form)
.setHandler(JX.bind(this, function (r) {
@ -112,9 +123,8 @@ JX.behavior('conpherence-widget-pane', function(config) {
.start();
};
JX.DOM.listen(
settingsRoot,
['click'],
JX.Stratcom.listen(
['submit', 'didSyntheticSubmit'],
'notifications-update',
onsubmitSettings
);