diff options
-rw-r--r-- | muamba-widget.tpl.php | 23 | ||||
-rw-r--r-- | muamba.admin.inc | 9 | ||||
-rw-r--r-- | muamba.business.inc | 7 |
3 files changed, 28 insertions, 11 deletions
diff --git a/muamba-widget.tpl.php b/muamba-widget.tpl.php index 9a0916a..34a05cd 100644 --- a/muamba-widget.tpl.php +++ b/muamba-widget.tpl.php @@ -22,13 +22,22 @@ if ($node->uid != $user->uid) { return; } elseif (!$available && $transactions['uid'] != $user->uid) { - $content .= theme('image', - array( - 'path' => $path .'/images/unavailable.png', - 'alt' => t('Item unavailable'), - 'title' => t('Item unavailable'), - ) - ); + if (variable_get('muamba_allow_request_unavailable', FALSE) == TRUE) { + $content .= theme('muamba_widget_icon', array( + 'status' => MUAMBA_REQUESTED, + 'id' => $node->nid, + 'size' => $size, + )); + } + else { + $content .= theme('image', + array( + 'path' => $path .'/images/unavailable.png', + 'alt' => t('Item unavailable'), + 'title' => t('Item unavailable'), + ) + ); + } } elseif ($transactions['uid'] == $user->uid) { $content .= theme('muamba_widget_requester', array( diff --git a/muamba.admin.inc b/muamba.admin.inc index cafc7b3..456fc88 100644 --- a/muamba.admin.inc +++ b/muamba.admin.inc @@ -13,7 +13,14 @@ function muamba_config_form($form, &$form_state) { '#type' => 'checkbox', '#title' => t('Reject all pending requests upon acceptance'), '#default_value' => variable_get('muamba_reject_all_on_accept', FALSE), - '#description' => t('Cancel all other requests of an item upon acceptance'), + '#description' => t('Cancel all other requests of an item upon acceptance.'), + ); + + $form['muamba_allow_request_unavailable'] = array( + '#type' => 'checkbox', + '#title' => t('Allow request of unavailable items'), + '#default_value' => variable_get('muamba_allow_request_unavailable', FALSE), + '#description' => t('Makes possible users request items that are not currently available.'), ); return system_settings_form($form); diff --git a/muamba.business.inc b/muamba.business.inc index 9aea8ee..6c0d236 100644 --- a/muamba.business.inc +++ b/muamba.business.inc @@ -131,8 +131,9 @@ function muamba() { */ function muamba_request($nid) { global $user; - $nid = (int) $nid; - $node = node_load($nid); + $nid = (int) $nid; + $node = node_load($nid); + $allow_unavailable = variable_get('muamba_allow_request_unavailable', FALSE); // Access check if (!muamba_has_request_access($node)) { @@ -145,7 +146,7 @@ function muamba_request($nid) { } // Check if the item is available - if (!muamba_check_availability($nid)) { + if (!muamba_check_availability($nid) && $allow_unavailable == FALSE) { return t('Item not available'); } |