//add additional navigation items
$logoutURL = CRM_Utils_System::url('civicrm/logout', 'reset=1');
- $appendString = "<li id=\"menu-logout\" class=\"menumain\"><a href=\"{$logoutURL}\">" . ts('Logout') . "</a></li>";
// get home menu from db
$homeParams = array('name' => 'Home');
$homeNav = array();
- $homeIcon = '<img src="' . $config->userFrameworkResourceURL . 'i/logo16px.png" />';
+ $homeIcon = '<img src="' . $config->userFrameworkResourceURL . 'i/logo16px.png" style="vertical-align:middle;" />';
self::retrieve($homeParams, $homeNav);
if ($homeNav) {
list($path, $q) = explode('&', $homeNav['url']);
$homeURL = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
$homeLabel = ts('CiviCRM Home');
}
-
+ // Link to hide the menubar
if (
($config->userSystem->is_drupal) &&
((module_exists('toolbar') && user_access('access toolbar')) ||
module_exists('admin_menu') && user_access('access administration menu')
)
) {
- $prepandString = '<li class="menumain crm-link-home">' . $homeIcon . "<ul id=\"civicrm-home\"><li><a href=\"{$homeURL}\">" . $homeLabel . '</a></li><li><a href="#" class="crm-hidemenu">' . ts('Drupal Menu') . "</a></li></ul>";
+ $hideLabel = ts('Drupal Menu');
}
elseif ($config->userSystem->is_wordpress) {
- $prepandString = '<li class="menumain crm-link-home">' . $homeIcon . "<ul id=\"civicrm-home\"><li><a href=\"{$homeURL}\">" . $homeLabel . '</a></li><li><a href="#" class="crm-hidemenu">' . ts('WordPress Menu') . "</a></li></ul>";
+ $hideLabel = ts('WordPress Menu');
}
else {
- $prepandString = "<li class=\"menumain crm-link-home\"><a href=\"{$homeURL}\" title=\"" . $homeLabel . '">' . $homeIcon . "</a>";
+ $hideLabel = ts('Hide Menu');
}
- $navigation = $prepandString . $navigation . $appendString;
+ $prepandString = "
+ <li class='menumain crm-link-home'>$homeIcon
+ <ul id='civicrm-home'>
+ <li><a href='$homeURL'>$homeLabel</a></li>
+ <li><a href='#' class='crm-hidemenu'>$hideLabel</a></li>
+ <li><a href='$logoutURL' class='crm-logout-link'>". ts('Logout') ."</a></li>
+ </ul>";
+ // <li> tag doesn't need to be closed
}
- return $navigation;
+ return $prepandString . $navigation;
}
/**
padding: 2px 16px 3px 2px;
}
-#civicrm-menu #menu-logout {
- float: right;
- border-left: 1px solid #5D5D5D;
+/* Status message bar */
+#civicrm-menu .crm-menubar-status-container {
+ position: absolute;
+ right: 2px;
+ top: 0;
+ border-top: 1px solid #1B1B1B;
+}
+
+#civicrm-menu .crm-menubar-status-progressbar {
+ padding: 3px 14px;
+ font-size: 14px !important;
+ font-weight: bold;
+ background: rgba(142, 136, 0, 0.9);
+ text-align: center;
+}
+
+#civicrm-menu .status-busy {
+ background: #F8FF03 url("../packages/jquery/jquery-ui/css/black-tie/images/animated-overlay.gif");
+}
+
+#civicrm-menu .status-done .crm-menubar-status-progressbar {
+ background: rgba(41, 152, 32, 0.7);
}
/* Pop-up help icon - eliminate forced line break */
}
);
};
+ /**
+ * @param startMsg string
+ * @param endMsg string|function
+ * @param deferred optional jQuery deferred object
+ * @return jQuery deferred object - if not supplied a new one will be created
+ */
+ var fadeOut;
+ CRM.status = function(startMsg, endMsg, deferred) {
+ var $bar = $('#civicrm-menu');
+ if (!$bar.length) {
+ console && console.log && console.log('CRM.status called on a page with no menubar');
+ return;
+ }
+ $('.crm-menubar-status-container', $bar).remove();
+ fadeOut && window.clearTimeout(fadeOut);
+ $bar.append('<li class="crm-menubar-status-container status-busy"><div class="crm-menubar-status-progressbar"><div class="crm-menubar-status-msg">' + startMsg + '</div></div></li>');
+ $('.crm-menubar-status-container', $bar).css('min-width', $('.crm-menubar-status-container', $bar).width());
+ deferred || (deferred = new $.Deferred());
+ deferred.done(function(data) {
+ var msg = typeof(endMsg) === 'function' ? endMsg(data) : endMsg;
+ $('.crm-menubar-status-container', $bar).removeClass('status-busy').addClass('status-done').find('.crm-menubar-status-msg').html(msg);
+ fadeOut = window.setTimeout(function() {
+ $('.crm-menubar-status-container', $bar).fadeOut('slow');
+ }, 2000);
+ });
+ return deferred;
+ };
/**
* @param string text Displayable message
$('.crm-hidemenu').click(function() {
$.Menu.closeAll();
$('#civicrm-menu').slideUp();
+ var alert = CRM.alert({/literal}'<a href="#" id="crm-restore-menu">{ts escape='js'}Restore Menu{/ts}</a>', "{ts escape='js'}CiviCRM Menu Hidden{/ts}"{literal});
+ $('#crm-notification-container')
+ .off('.hideMenu')
+ .on('click.hideMenu', '#crm-restore-menu', function() {
+ alert.close();
+ $('#civicrm-menu').slideDown();
+ return false;
+ });
return false;
});
$('.crm-quickSearchField').click(function() {