diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2011-11-22 14:55:57 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2011-11-22 14:55:57 -0200 |
commit | 1baa58bdadaad694ec52e92829da52ae901ab466 (patch) | |
tree | 6f825f9fed0259534b0f59963d187fe40ec55c82 | |
parent | 01f345fc6643b010f429a761b239d9e30d1dd479 (diff) | |
download | muamba-1baa58bdadaad694ec52e92829da52ae901ab466.tar.gz muamba-1baa58bdadaad694ec52e92829da52ae901ab466.tar.bz2 |
Enhanced message page
-rw-r--r-- | muamba.embed.inc | 45 | ||||
-rw-r--r-- | muamba.module | 9 | ||||
-rw-r--r-- | muamba.theme.inc | 16 |
3 files changed, 64 insertions, 6 deletions
diff --git a/muamba.embed.inc b/muamba.embed.inc new file mode 100644 index 0000000..944dd2f --- /dev/null +++ b/muamba.embed.inc @@ -0,0 +1,45 @@ +<?php +// $Id$ + +/** + * @file + * Embed functions. + */ + +/** + * Embeds a view. + * + * @param $viewname + * Name of the view. + * + * @param $args + * View arguments. + * + * @param $display + * Display to use. + * + * @param $return + * Whether to return a rendered view or the view object. + * + * @return + * Rendered view. + */ +function muamba_embed_view($viewname, $args, $display = 'default', $return = 'preview') { + $view = views_get_view($viewname); + $view->override_path = $_GET['q']; + $output = $view->preview($display, $args); + + if ($return == 'preview') { + // Do not output empty views. + if ($view->result) { + return $output; + } + } + else if ($return == 'output') { + // Return output, even if empty result set. + return $output; + } + else { + return $view; + } +} diff --git a/muamba.module b/muamba.module index b35949d..1a5967d 100644 --- a/muamba.module +++ b/muamba.module @@ -267,18 +267,25 @@ function muamba_privatemsg_view_alter(&$content) { if (!empty($transaction)) { global $user; + include_once('muamba.embed.inc'); + $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 ef169bf..8369e6f 100644 --- a/muamba.theme.inc +++ b/muamba.theme.inc @@ -88,9 +88,7 @@ function theme_muamba_colorbox_link($variables) { * Theme callback. */ function theme_muamba_request_message($transaction = NULL) { - $link = l(t('your requests page'), 'muamba'); - return t('Hi, I would like to request this item of yours. Please visit @link to manage this request', - array('@link' => $link)); + return t('Hi, I would like to request this item of yours.'); } /** @@ -189,10 +187,16 @@ function theme_muamba_widget_owner($variables) { * Theme callback. */ function theme_muamba_widget_requester($variables) { - $content = ''; + $output = ''; + $content = ''; $transaction = $variables['transaction']; $size = $variables['size']; + if ($size != 'small') { + $output .= '<h3>'. t('Options') .'</h3>'; + $output .= '<br />'; + } + foreach (muamba_actions_available('sent', $transaction) as $action) { $content .= theme('muamba_widget_icon', array( 'status' => $action, @@ -201,5 +205,7 @@ function theme_muamba_widget_requester($variables) { )); } - return $content; + if (!empty($content)) { + return $output . $content; + } } |