/**
 * MindCMS 3
 *
 * msModule
 *
 * JS Module object definition
 *
 * @package CMS3
 * @author Gabriel PREDA <gabriel.preda@mindbench.nl>
 * @author Raluca NECHITA <raluca.nechita@mindbench.nl>
 * @author Francisc Ungureanu <francisc.ungureanu@mindbench.nl> 
 * @copyright Mindbench Active Media B.V.
 * @version $Id: msModule.js 6464 2008-11-28 12:38:15Z gpr $
 *
 * Details: 
 * <li> <a onlick href accesskey > ICON TEXT </a> </li>
 * - color full stuff (active, inactive, mouseover, mouseout)
 * - by option: accesskey, icon/text, 
 * - display style(future method if time permitts)
 * 
 *  metoda apelata de msPlugins este DRAW care intoarce HTML 
 *  
 *  new msModule( config, options );
 *   config
 *   {
 *    isActive: false, *    
 *    icon: '', // src to icon
 *    text: '', // text to be displayed in the link
 *    link: '', // href attribute
 *    accesskey: '' // one character used as shortcut
 *   }
 *   
 *   options
 *   {
 *    accesskey: native | js
 *   }
 *   
 */

msModule = Class.create(msContainer, {
  'xtype': 'module',
  
  initialize: function ($super, config)
  {
    $super(config);
    
    this.config = {
      isActive: false,
      icon: '', // src to icon
      name: 'Unnamed module', // text to be displayed in the link
      link: '#unlinked-module', // href attribute
      accesskey: 'native'
    };
    Object.extend(this.config, config || {});
    
    this.isActive = this.config && this.config.isActive;

    this.build();
  },
  
  build: function(config) {
    var THIS = this;
    
    this.el = new Element('LI');
    
    //adds the tab button
    var button = new Element('A', { href: this.config.link });
    
    if (this.config.accesskey.strip() !== "") {
      button.accesskey = this.config.accesskey;
    }
    this.link = this.config.link;
    button.insert(this.name);

    this.el.appendChild(button);
  }
});

