includes/clientside/static/toolbar.js
author Dan
Tue, 12 Feb 2008 22:17:58 -0500
changeset 419 b8b4e38825db
parent 128 01955bf53f96
child 420 301f546688d1
permissions -rw-r--r--
Unsuccessful attempt at fixing "dismiss"/"close manager" buttons in ACL editor; non-breaking change to template API to allow plugins to add "normal" sidebar widgets in addition to the special "raw" block type, specified as the third parameter to $template->sidebar_widget(). Defaults to false, which is old behavior; new behavior (enabled by passing TRUE as the 3rd param) means that the content of the block is primarily block-level links.

// Page toolbar - selecting buttons

function unselectAllButtonsMajor()
{
  if ( !document.getElementById('pagebar_main') )
    return false;
  obj = document.getElementById('pagebar_main').firstChild;
  while(obj)
  {
    if(obj.id == 'mdgToolbar_article' || obj.id == 'mdgToolbar_discussion')
    {
      $(obj).rmClass('selected');
    }
    obj = obj.nextSibling;
  }
}

function unselectAllButtonsMinor()
{
  if ( !document.getElementById('pagebar_main') )
    return false;
  obj = document.getElementById('pagebar_main').firstChild.nextSibling;
  while(obj)
  {
    if ( !$(obj).hasClass('selected') )
    {
      obj = obj.nextSibling;
      continue;
    }
    if(obj.id != 'mdgToolbar_article' && obj.id != 'mdgToolbar_discussion')
    {
      if ( obj.className )
        $(obj).rmClass('selected');
    }
    obj = obj.nextSibling;
  }
}

function selectButtonMajor(which)
{
  if ( !document.getElementById('pagebar_main') )
    return false;
  var dom = document.getElementById('mdgToolbar_'+which);
  if ( !dom )
    return false;
  if(typeof(dom) == 'object')
  {
    unselectAllButtonsMajor();
    $('mdgToolbar_'+which).addClass('selected');
  }
}

function selectButtonMinor(which)
{
  if ( !document.getElementById('pagebar_main') )
    return false;
  if(typeof(document.getElementById('mdgToolbar_'+which)) == 'object')
  {
    unselectAllButtonsMinor();
    $('mdgToolbar_'+which).addClass('selected');
  }
}