aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2011-11-22 18:20:33 -0200
committerSilvio Rhatto <rhatto@riseup.net>2011-11-22 18:20:33 -0200
commita7d2dc7637a923f4b5ba5530b7328e8a55f22985 (patch)
tree3d4e95c8146ece52cd248293f992e63445377eb5
parent1baa58bdadaad694ec52e92829da52ae901ab466 (diff)
downloadmuamba-a7d2dc7637a923f4b5ba5530b7328e8a55f22985.tar.gz
muamba-a7d2dc7637a923f4b5ba5530b7328e8a55f22985.tar.bz2
Messages icon in actions handler
-rw-r--r--features/muamba_interface/muamba_interface.views_default.inc273
-rw-r--r--images/icons/big/messages.pngbin0 -> 236 bytes
-rw-r--r--images/icons/small/messages.pngbin0 -> 259 bytes
-rw-r--r--muamba-widget.tpl.php2
-rw-r--r--muamba.business.inc3
-rw-r--r--muamba.handlers.inc45
-rw-r--r--muamba.module15
-rw-r--r--muamba.theme.inc36
-rw-r--r--muamba.views.inc3
9 files changed, 361 insertions, 16 deletions
diff --git a/features/muamba_interface/muamba_interface.views_default.inc b/features/muamba_interface/muamba_interface.views_default.inc
index ef6a1d7..c9cc281 100644
--- a/features/muamba_interface/muamba_interface.views_default.inc
+++ b/features/muamba_interface/muamba_interface.views_default.inc
@@ -123,6 +123,12 @@ function muamba_interface_views_default_views() {
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
+ /* Filtro contextual: Conteúdo: Nid */
+ $handler->display->display_options['arguments']['nid']['id'] = 'nid';
+ $handler->display->display_options['arguments']['nid']['table'] = 'node';
+ $handler->display->display_options['arguments']['nid']['field'] = 'nid';
+ $handler->display->display_options['arguments']['nid']['default_argument_type'] = 'fixed';
+ $handler->display->display_options['arguments']['nid']['summary']['format'] = 'default_summary';
/* Filter criterion: Conteúdo: Publicado */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
@@ -2123,6 +2129,269 @@ function muamba_interface_views_default_views() {
$handler->display->display_options['filters']['status_1']['field'] = 'status';
$handler->display->display_options['filters']['status_1']['operator'] = 'empty';
$handler->display->display_options['filters']['status_1']['group'] = 1;
+
+ /* Display: Info (bloco) */
+ $handler = $view->new_display('block', 'Info (bloco)', 'info');
+ $handler->display->display_options['defaults']['title'] = FALSE;
+ $handler->display->display_options['title'] = 'Informações';
+ $handler->display->display_options['display_description'] = 'Informação sobre uma muamba (bloco)';
+ $handler->display->display_options['defaults']['query'] = FALSE;
+ $handler->display->display_options['query']['type'] = 'views_query';
+ $handler->display->display_options['query']['options']['distinct'] = TRUE;
+ $handler->display->display_options['query']['options']['query_comment'] = FALSE;
+ $handler->display->display_options['defaults']['pager'] = FALSE;
+ $handler->display->display_options['pager']['type'] = 'full';
+ $handler->display->display_options['pager']['options']['items_per_page'] = '5';
+ $handler->display->display_options['pager']['options']['expose']['items_per_page_label'] = 'Itens por página';
+ $handler->display->display_options['pager']['options']['expose']['items_per_page_options_all_label'] = '- Todos -';
+ $handler->display->display_options['pager']['options']['expose']['offset_label'] = 'Deslocamento';
+ $handler->display->display_options['defaults']['style_plugin'] = FALSE;
+ $handler->display->display_options['style_plugin'] = 'table';
+ $handler->display->display_options['style_options']['columns'] = array(
+ 'field_foto' => 'field_foto',
+ 'title' => 'field_foto',
+ 'picture' => 'picture',
+ 'name' => 'picture',
+ 'ops' => 'ops',
+ );
+ $handler->display->display_options['style_options']['default'] = '-1';
+ $handler->display->display_options['style_options']['info'] = array(
+ 'field_foto' => array(
+ 'align' => '',
+ 'separator' => '<br />',
+ ),
+ 'title' => array(
+ 'sortable' => 0,
+ 'default_sort_order' => 'asc',
+ 'align' => '',
+ 'separator' => '',
+ ),
+ 'picture' => array(
+ 'sortable' => 0,
+ 'default_sort_order' => 'asc',
+ 'align' => '',
+ 'separator' => '',
+ ),
+ 'name' => array(
+ 'sortable' => 0,
+ 'default_sort_order' => 'asc',
+ 'align' => '',
+ 'separator' => '',
+ ),
+ 'ops' => array(
+ 'align' => '',
+ 'separator' => '',
+ ),
+ );
+ $handler->display->display_options['style_options']['override'] = 1;
+ $handler->display->display_options['style_options']['sticky'] = 0;
+ $handler->display->display_options['style_options']['empty_table'] = 0;
+ $handler->display->display_options['defaults']['style_options'] = FALSE;
+ $handler->display->display_options['defaults']['row_plugin'] = FALSE;
+ $handler->display->display_options['defaults']['row_options'] = FALSE;
+ $handler->display->display_options['defaults']['relationships'] = FALSE;
+ /* Relação: Conteúdo: Autor */
+ $handler->display->display_options['relationships']['uid']['id'] = 'uid';
+ $handler->display->display_options['relationships']['uid']['table'] = 'node';
+ $handler->display->display_options['relationships']['uid']['field'] = 'uid';
+ $handler->display->display_options['relationships']['uid']['required'] = 1;
+ /* Relação: Flags: bookmarks */
+ $handler->display->display_options['relationships']['flag_content_rel']['id'] = 'flag_content_rel';
+ $handler->display->display_options['relationships']['flag_content_rel']['table'] = 'node';
+ $handler->display->display_options['relationships']['flag_content_rel']['field'] = 'flag_content_rel';
+ $handler->display->display_options['relationships']['flag_content_rel']['required'] = 0;
+ $handler->display->display_options['relationships']['flag_content_rel']['flag'] = 'bookmarks';
+ $handler->display->display_options['defaults']['fields'] = FALSE;
+ /* Campo: Conteúdo: Foto */
+ $handler->display->display_options['fields']['field_foto']['id'] = 'field_foto';
+ $handler->display->display_options['fields']['field_foto']['table'] = 'field_data_field_foto';
+ $handler->display->display_options['fields']['field_foto']['field'] = 'field_foto';
+ $handler->display->display_options['fields']['field_foto']['label'] = 'Item';
+ $handler->display->display_options['fields']['field_foto']['alter']['alter_text'] = 0;
+ $handler->display->display_options['fields']['field_foto']['alter']['make_link'] = 0;
+ $handler->display->display_options['fields']['field_foto']['alter']['absolute'] = 0;
+ $handler->display->display_options['fields']['field_foto']['alter']['external'] = 0;
+ $handler->display->display_options['fields']['field_foto']['alter']['replace_spaces'] = 0;
+ $handler->display->display_options['fields']['field_foto']['alter']['trim_whitespace'] = 0;
+ $handler->display->display_options['fields']['field_foto']['alter']['nl2br'] = 0;
+ $handler->display->display_options['fields']['field_foto']['alter']['word_boundary'] = 1;
+ $handler->display->display_options['fields']['field_foto']['alter']['ellipsis'] = 1;
+ $handler->display->display_options['fields']['field_foto']['alter']['strip_tags'] = 0;
+ $handler->display->display_options['fields']['field_foto']['alter']['trim'] = 0;
+ $handler->display->display_options['fields']['field_foto']['alter']['html'] = 0;
+ $handler->display->display_options['fields']['field_foto']['element_label_colon'] = 0;
+ $handler->display->display_options['fields']['field_foto']['element_default_classes'] = 1;
+ $handler->display->display_options['fields']['field_foto']['hide_empty'] = 0;
+ $handler->display->display_options['fields']['field_foto']['empty_zero'] = 0;
+ $handler->display->display_options['fields']['field_foto']['hide_alter_empty'] = 0;
+ $handler->display->display_options['fields']['field_foto']['click_sort_column'] = 'fid';
+ $handler->display->display_options['fields']['field_foto']['settings'] = array(
+ 'image_style' => 'thumbnail',
+ 'image_link' => 'content',
+ );
+ $handler->display->display_options['fields']['field_foto']['group_rows'] = 1;
+ $handler->display->display_options['fields']['field_foto']['delta_offset'] = '0';
+ $handler->display->display_options['fields']['field_foto']['delta_reversed'] = 0;
+ $handler->display->display_options['fields']['field_foto']['field_api_classes'] = 0;
+ /* Campo: Conteúdo: Título */
+ $handler->display->display_options['fields']['title']['id'] = 'title';
+ $handler->display->display_options['fields']['title']['table'] = 'node';
+ $handler->display->display_options['fields']['title']['field'] = 'title';
+ $handler->display->display_options['fields']['title']['label'] = 'Item';
+ $handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['external'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['replace_spaces'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['trim_whitespace'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['nl2br'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['trim'] = 0;
+ $handler->display->display_options['fields']['title']['alter']['html'] = 0;
+ $handler->display->display_options['fields']['title']['element_label_colon'] = 0;
+ $handler->display->display_options['fields']['title']['element_default_classes'] = 1;
+ $handler->display->display_options['fields']['title']['hide_empty'] = 0;
+ $handler->display->display_options['fields']['title']['empty_zero'] = 0;
+ $handler->display->display_options['fields']['title']['hide_alter_empty'] = 0;
+ $handler->display->display_options['fields']['title']['link_to_node'] = 1;
+ /* Campo: Usuário: Foto */
+ $handler->display->display_options['fields']['picture']['id'] = 'picture';
+ $handler->display->display_options['fields']['picture']['table'] = 'users';
+ $handler->display->display_options['fields']['picture']['field'] = 'picture';
+ $handler->display->display_options['fields']['picture']['relationship'] = 'uid';
+ $handler->display->display_options['fields']['picture']['label'] = 'Dono(a)';
+ $handler->display->display_options['fields']['picture']['alter']['alter_text'] = 0;
+ $handler->display->display_options['fields']['picture']['alter']['make_link'] = 0;
+ $handler->display->display_options['fields']['picture']['alter']['absolute'] = 0;
+ $handler->display->display_options['fields']['picture']['alter']['external'] = 0;
+ $handler->display->display_options['fields']['picture']['alter']['replace_spaces'] = 0;
+ $handler->display->display_options['fields']['picture']['alter']['trim_whitespace'] = 0;
+ $handler->display->display_options['fields']['picture']['alter']['nl2br'] = 0;
+ $handler->display->display_options['fields']['picture']['alter']['word_boundary'] = 1;
+ $handler->display->display_options['fields']['picture']['alter']['ellipsis'] = 1;
+ $handler->display->display_options['fields']['picture']['alter']['strip_tags'] = 0;
+ $handler->display->display_options['fields']['picture']['alter']['trim'] = 0;
+ $handler->display->display_options['fields']['picture']['alter']['html'] = 0;
+ $handler->display->display_options['fields']['picture']['element_label_colon'] = 0;
+ $handler->display->display_options['fields']['picture']['element_default_classes'] = 1;
+ $handler->display->display_options['fields']['picture']['hide_empty'] = 0;
+ $handler->display->display_options['fields']['picture']['empty_zero'] = 0;
+ $handler->display->display_options['fields']['picture']['hide_alter_empty'] = 0;
+ /* Campo: Usuário: Nome */
+ $handler->display->display_options['fields']['name']['id'] = 'name';
+ $handler->display->display_options['fields']['name']['table'] = 'users';
+ $handler->display->display_options['fields']['name']['field'] = 'name';
+ $handler->display->display_options['fields']['name']['relationship'] = 'uid';
+ $handler->display->display_options['fields']['name']['label'] = 'Dono(a)';
+ $handler->display->display_options['fields']['name']['alter']['alter_text'] = 0;
+ $handler->display->display_options['fields']['name']['alter']['make_link'] = 0;
+ $handler->display->display_options['fields']['name']['alter']['absolute'] = 0;
+ $handler->display->display_options['fields']['name']['alter']['external'] = 0;
+ $handler->display->display_options['fields']['name']['alter']['replace_spaces'] = 0;
+ $handler->display->display_options['fields']['name']['alter']['trim_whitespace'] = 0;
+ $handler->display->display_options['fields']['name']['alter']['nl2br'] = 0;
+ $handler->display->display_options['fields']['name']['alter']['word_boundary'] = 1;
+ $handler->display->display_options['fields']['name']['alter']['ellipsis'] = 1;
+ $handler->display->display_options['fields']['name']['alter']['strip_tags'] = 0;
+ $handler->display->display_options['fields']['name']['alter']['trim'] = 0;
+ $handler->display->display_options['fields']['name']['alter']['html'] = 0;
+ $handler->display->display_options['fields']['name']['element_label_colon'] = 0;
+ $handler->display->display_options['fields']['name']['element_default_classes'] = 1;
+ $handler->display->display_options['fields']['name']['hide_empty'] = 0;
+ $handler->display->display_options['fields']['name']['empty_zero'] = 0;
+ $handler->display->display_options['fields']['name']['hide_alter_empty'] = 0;
+ $handler->display->display_options['fields']['name']['link_to_user'] = 1;
+ $handler->display->display_options['fields']['name']['overwrite_anonymous'] = 0;
+ /* Campo: Muamba: Availability */
+ $handler->display->display_options['fields']['available']['id'] = 'available';
+ $handler->display->display_options['fields']['available']['table'] = 'muamba';
+ $handler->display->display_options['fields']['available']['field'] = 'available';
+ $handler->display->display_options['fields']['available']['label'] = 'Disponível?';
+ $handler->display->display_options['fields']['available']['alter']['alter_text'] = 0;
+ $handler->display->display_options['fields']['available']['alter']['make_link'] = 0;
+ $handler->display->display_options['fields']['available']['alter']['absolute'] = 0;
+ $handler->display->display_options['fields']['available']['alter']['external'] = 0;
+ $handler->display->display_options['fields']['available']['alter']['replace_spaces'] = 0;
+ $handler->display->display_options['fields']['available']['alter']['trim_whitespace'] = 0;
+ $handler->display->display_options['fields']['available']['alter']['nl2br'] = 0;
+ $handler->display->display_options['fields']['available']['alter']['word_boundary'] = 1;
+ $handler->display->display_options['fields']['available']['alter']['ellipsis'] = 1;
+ $handler->display->display_options['fields']['available']['alter']['strip_tags'] = 0;
+ $handler->display->display_options['fields']['available']['alter']['trim'] = 0;
+ $handler->display->display_options['fields']['available']['alter']['html'] = 0;
+ $handler->display->display_options['fields']['available']['element_label_colon'] = 0;
+ $handler->display->display_options['fields']['available']['element_default_classes'] = 1;
+ $handler->display->display_options['fields']['available']['hide_empty'] = 0;
+ $handler->display->display_options['fields']['available']['empty_zero'] = 0;
+ $handler->display->display_options['fields']['available']['hide_alter_empty'] = 0;
+ /* Campo: Muamba: Ações */
+ $handler->display->display_options['fields']['actions']['id'] = 'actions';
+ $handler->display->display_options['fields']['actions']['table'] = 'muamba';
+ $handler->display->display_options['fields']['actions']['field'] = 'actions';
+ $handler->display->display_options['fields']['actions']['alter']['alter_text'] = 0;
+ $handler->display->display_options['fields']['actions']['alter']['make_link'] = 0;
+ $handler->display->display_options['fields']['actions']['alter']['absolute'] = 0;
+ $handler->display->display_options['fields']['actions']['alter']['external'] = 0;
+ $handler->display->display_options['fields']['actions']['alter']['replace_spaces'] = 0;
+ $handler->display->display_options['fields']['actions']['alter']['trim_whitespace'] = 0;
+ $handler->display->display_options['fields']['actions']['alter']['nl2br'] = 0;
+ $handler->display->display_options['fields']['actions']['alter']['word_boundary'] = 1;
+ $handler->display->display_options['fields']['actions']['alter']['ellipsis'] = 1;
+ $handler->display->display_options['fields']['actions']['alter']['strip_tags'] = 0;
+ $handler->display->display_options['fields']['actions']['alter']['trim'] = 0;
+ $handler->display->display_options['fields']['actions']['alter']['html'] = 0;
+ $handler->display->display_options['fields']['actions']['element_label_colon'] = 1;
+ $handler->display->display_options['fields']['actions']['element_default_classes'] = 1;
+ $handler->display->display_options['fields']['actions']['hide_empty'] = 0;
+ $handler->display->display_options['fields']['actions']['empty_zero'] = 0;
+ $handler->display->display_options['fields']['actions']['hide_alter_empty'] = 0;
+ $handler->display->display_options['defaults']['arguments'] = FALSE;
+ /* Filtro contextual: Conteúdo: Nid */
+ $handler->display->display_options['arguments']['nid']['id'] = 'nid';
+ $handler->display->display_options['arguments']['nid']['table'] = 'node';
+ $handler->display->display_options['arguments']['nid']['field'] = 'nid';
+ $handler->display->display_options['arguments']['nid']['default_action'] = 'not found';
+ $handler->display->display_options['arguments']['nid']['default_argument_type'] = 'fixed';
+ $handler->display->display_options['arguments']['nid']['default_argument_skip_url'] = 0;
+ $handler->display->display_options['arguments']['nid']['summary']['number_of_records'] = '0';
+ $handler->display->display_options['arguments']['nid']['summary']['format'] = 'default_summary';
+ $handler->display->display_options['arguments']['nid']['summary_options']['items_per_page'] = '25';
+ $handler->display->display_options['arguments']['nid']['break_phrase'] = 0;
+ $handler->display->display_options['arguments']['nid']['not'] = 0;
+ $handler->display->display_options['filter_groups']['groups'] = array(
+ 0 => 'AND',
+ 1 => 'OR',
+ );
+ $handler->display->display_options['defaults']['filters'] = FALSE;
+ /* Filter criterion: Conteúdo: Publicado */
+ $handler->display->display_options['filters']['status']['id'] = 'status';
+ $handler->display->display_options['filters']['status']['table'] = 'node';
+ $handler->display->display_options['filters']['status']['field'] = 'status';
+ $handler->display->display_options['filters']['status']['value'] = '1';
+ $handler->display->display_options['filters']['status']['group'] = 0;
+ $handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
+ /* Filter criterion: Conteúdo: Tipo */
+ $handler->display->display_options['filters']['type']['id'] = 'type';
+ $handler->display->display_options['filters']['type']['table'] = 'node';
+ $handler->display->display_options['filters']['type']['field'] = 'type';
+ $handler->display->display_options['filters']['type']['value'] = array(
+ 'muamba' => 'muamba',
+ );
+ $handler->display->display_options['filters']['type']['group'] = 0;
+ /* Filter criterion: Muamba: Ativo */
+ $handler->display->display_options['filters']['active']['id'] = 'active';
+ $handler->display->display_options['filters']['active']['table'] = 'muamba';
+ $handler->display->display_options['filters']['active']['field'] = 'active';
+ $handler->display->display_options['filters']['active']['value'] = '1';
+ $handler->display->display_options['filters']['active']['group'] = 1;
+ /* Filter criterion: Muamba: Status */
+ $handler->display->display_options['filters']['status_1']['id'] = 'status_1';
+ $handler->display->display_options['filters']['status_1']['table'] = 'muamba';
+ $handler->display->display_options['filters']['status_1']['field'] = 'status';
+ $handler->display->display_options['filters']['status_1']['operator'] = 'empty';
+ $handler->display->display_options['filters']['status_1']['group'] = 1;
$translatables['muambas'] = array(
t('Master'),
t('Minhas muambas'),
@@ -2140,6 +2409,7 @@ function muamba_interface_views_default_views() {
t('autor'),
t('Muamba node'),
t('Item'),
+ t('Tudo'),
t('Minhas'),
t('Minhas (bloco)'),
t('Minhas muambas (bloco)'),
@@ -2175,6 +2445,9 @@ function muamba_interface_views_default_views() {
t('Todas (bloco)'),
t('Todas as muambas'),
t('Todas as muambas (bloco)'),
+ t('Info (bloco)'),
+ t('Informações'),
+ t('Informação sobre uma muamba (bloco)'),
);
$export['muambas'] = $view;
diff --git a/images/icons/big/messages.png b/images/icons/big/messages.png
new file mode 100644
index 0000000..461094b
--- /dev/null
+++ b/images/icons/big/messages.png
Binary files differ
diff --git a/images/icons/small/messages.png b/images/icons/small/messages.png
new file mode 100644
index 0000000..30bbfb5
--- /dev/null
+++ b/images/icons/small/messages.png
Binary files differ
diff --git a/muamba-widget.tpl.php b/muamba-widget.tpl.php
index 34a05cd..7d4cc5a 100644
--- a/muamba-widget.tpl.php
+++ b/muamba-widget.tpl.php
@@ -43,6 +43,7 @@ if ($node->uid != $user->uid) {
$content .= theme('muamba_widget_requester', array(
'transaction' => $transactions,
'size' => $size,
+ 'messages' => $messages,
));
}
else {
@@ -58,6 +59,7 @@ else {
$content .= theme('muamba_widget_owner', array(
'transaction' => $transaction,
'size' => $size,
+ 'messages' => $messages,
));
}
}
diff --git a/muamba.business.inc b/muamba.business.inc
index 6c0d236..2b4857f 100644
--- a/muamba.business.inc
+++ b/muamba.business.inc
@@ -412,7 +412,7 @@ function muamba_lost($mid) {
* @return
* HTML formatted muamba widget.
*/
-function muamba_widget($node, $size = 'small') {
+function muamba_widget($node, $size = 'small', $messages = FALSE) {
global $user;
// Check if widget can be shown
@@ -434,6 +434,7 @@ function muamba_widget($node, $size = 'small') {
'transactions' => $transactions,
'available' => $available,
'size' => $size,
+ 'messages' => $messages,
));
}
diff --git a/muamba.handlers.inc b/muamba.handlers.inc
index ea1a54d..d9a603b 100644
--- a/muamba.handlers.inc
+++ b/muamba.handlers.inc
@@ -70,6 +70,29 @@ class views_handler_field_muamba_actions extends views_handler_field {
}
/**
+ * Option definition.
+ */
+ function option_definition() {
+ $options = parent::option_definition();
+ $options['messages'] = array('default' => FALSE);
+ return $options;
+ }
+
+ /**
+ * Provide link to node option.
+ */
+ function options_form(&$form, &$form_state) {
+ parent::options_form($form, $form_state);
+
+ $form['messages'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Show messages link'),
+ '#default_value' => isset($this->options['messages']) ? $this->options['messages'] : FALSE,
+ '#description' => t('Add a link to the transaction thread.'),
+ );
+ }
+
+ /**
* Renders the field.
*/
function render($values) {
@@ -85,10 +108,16 @@ class views_handler_field_muamba_actions extends views_handler_field {
}
if ($transaction['owner'] == $user->uid) {
- return theme('muamba_widget_owner', array('transaction' => $transaction));
+ return theme('muamba_widget_owner', array(
+ 'transaction' => $transaction,
+ 'messages' => $this->options['messages'],
+ ));
}
elseif ($transaction['uid'] == $user->uid) {
- return theme('muamba_widget_requester', array('transaction' => $transaction));
+ return theme('muamba_widget_requester', array(
+ 'transaction' => $transaction,
+ 'messages' => $this->options['messages'],
+ ));
}
}
elseif (isset($values->nid)) {
@@ -101,15 +130,21 @@ class views_handler_field_muamba_actions extends views_handler_field {
}
if ($transaction['owner'] == $user->uid) {
- return theme('muamba_widget_owner', array('transaction' => $transaction));
+ return theme('muamba_widget_owner', array(
+ 'transaction' => $transaction,
+ 'messages' => $this->options['messages'],
+ ));
}
elseif ($transaction['uid'] == $user->uid) {
- return theme('muamba_widget_requester', array('transaction' => $transaction));
+ return theme('muamba_widget_requester', array(
+ 'transaction' => $transaction,
+ 'messages' => $this->options['messages'],
+ ));
}
}
else {
$node = node_load($values->nid);
- return muamba_widget($node);
+ return muamba_widget($node, 'small', $this->options['messages']);
}
}
}
diff --git a/muamba.module b/muamba.module
index 1a5967d..5251379 100644
--- a/muamba.module
+++ b/muamba.module
@@ -141,12 +141,14 @@ function muamba_theme($existing, $type, $theme, $path) {
'transactions' => NULL,
'available' => NULL,
'size' => 'small',
+ 'messages' => FALSE,
),
),
'muamba_widget_owner' => array(
'variables' => array(
'transaction' => NULL,
'size' => 'small',
+ 'messages' => FALSE,
),
'file' => 'muamba.theme.inc',
),
@@ -154,6 +156,7 @@ function muamba_theme($existing, $type, $theme, $path) {
'variables' => array(
'transaction' => NULL,
'size' => 'small',
+ 'messages' => FALSE,
),
'file' => 'muamba.theme.inc',
),
@@ -265,26 +268,26 @@ function muamba_privatemsg_view_alter(&$content) {
$transaction = muamba_get_transaction($thread, 'thread_id');
if (!empty($transaction)) {
- global $user;
-
include_once('muamba.embed.inc');
+ $title = '<h2>'. t('Messages') .'</h2>';
+ $info = muamba_embed_view('transacoes', array($transaction['mid']), 'info');
+
+ /*
+ global $user;
$node = node_load($transaction['nid']);
$available = muamba_check_availability($node->nid);
$widget = ($node->uid == $user->uid) ? 'owner' : 'requester';
- $info = muamba_embed_view('muambas', array($node->nid), 'info');
- $title = '<h2>'. t('Messages') .'</h2>';
- /*
$bar = theme('muamba_widget_'. $widget, array(
'node' => $node,
'transaction' => $transaction,
'available' => $available,
'size' => 'big',
));
+ $content['participants']['#markup'] = $bar . $content['participants']['#markup'];
*/
- //$content['participants']['#markup'] = $bar . $content['participants']['#markup'];
$content['participants']['#markup'] = $info . $title;
}
}
diff --git a/muamba.theme.inc b/muamba.theme.inc
index 8369e6f..03d1c1f 100644
--- a/muamba.theme.inc
+++ b/muamba.theme.inc
@@ -141,9 +141,19 @@ function theme_muamba_widget_icon($variables) {
$id = $variables['id'];
$size = $variables['size'];
$path = drupal_get_path('module', 'muamba');
- $action = muamba_actions($status);
- $image = $path .'/images/icons/'. $size .'/'. $action .'.png';
- $title = ucfirst($action) .' item';
+
+ if ($status != NULL) {
+ $action = muamba_actions($status);
+ $image = $path .'/images/icons/'. $size .'/'. $action .'.png';
+ $title = ucfirst($action) .' item';
+ $action = 'muamba/'. $action;
+ }
+ else {
+ // Default action.
+ $action = 'messages/view';
+ $image = $path .'/images/icons/'. $size .'/messages.png';
+ $title = t('Messages');
+ }
$icon = theme('image',
array(
@@ -153,7 +163,7 @@ function theme_muamba_widget_icon($variables) {
)
);
- $output = l($icon, 'muamba/'. $action .'/'. $id, array('html' => TRUE));
+ $output = l($icon, $action .'/'. $id, array('html' => TRUE));
return $output;
}
@@ -180,6 +190,15 @@ function theme_muamba_widget_owner($variables) {
));
}
+ // Add a message link.
+ if ($variables['messages'] == TRUE) {
+ $content .= theme('muamba_widget_icon', array(
+ 'status' => NULL,
+ 'id' => $transaction['thread_id'],
+ 'size' => $size,
+ ));
+ }
+
return $content;
}
@@ -205,6 +224,15 @@ function theme_muamba_widget_requester($variables) {
));
}
+ // Add a message link.
+ if ($variables['messages'] == TRUE) {
+ $content .= theme('muamba_widget_icon', array(
+ 'status' => NULL,
+ 'id' => $transaction['thread_id'],
+ 'size' => $size,
+ ));
+ }
+
if (!empty($content)) {
return $output . $content;
}
diff --git a/muamba.views.inc b/muamba.views.inc
index e8e433d..9f54e74 100644
--- a/muamba.views.inc
+++ b/muamba.views.inc
@@ -40,6 +40,9 @@ function muamba_views_data() {
'sort' => array(
'handler' => 'views_handler_sort',
),
+ 'argument' => array(
+ 'handler' => 'views_handler_argument_numeric',
+ ),
);
// Node ID field.