/** controller.js (C) 2009 Rackspace Hosting, All Rights Reserved This file definas a single object in global scope: trc.schema.controller The controller object is responsible for displaying a menu that allows users to view schema source and jump to various definitions in the schema. **/ // // Initialization code... // (function() { // // Make sure dependecies are defined in the global scope, throw // an error if they are not. // if ((!window.trc) || (!trc.util)) { throw new Error("Require trc/util.js to be loaded."); } // // We use YUI to build our controller menu make sure we have the // proper dependecies loaded, call init when we do... // function InitController() { trc.schema.controller._init(); } trc.util.yui.loadYUIDeps (["menu"], InitController); })(); if (!trc.schema) { trc.schema = new Object(); } trc.schema.controller = { // // Internal and external links by type: // // type --> array of links // // possible types include: import, include, element, // attribute, complextype, simpleType // // each link contains the following properties: // name : the name of the link // href : the link itself // title : a description of the link links : new Object(), // // A single link that points to the schema index document. // index : null, // // Our initialization function // _init : function() { // // Load the menu... // var controllerDiv = document.getElementById("Controller"); var mainMenu = this._menuMarkup("mainmenu"); for (var linkType in this.links) { var subItem = this._menuItemMarkup(mainMenu, linkType, "#", null); var subMenu = this._menuMarkup (linkType+"_subMenu"); var items = this.links[linkType]; for (var i=0;i