8ebdcaf61a7cfef5b6c87833cb0cd488d313499f

Author: chawbacca

Date: 2009-05-02 21:03:10 -0500

Merge from debug_kit.git

diff --git a/controllers/components/toolbar.php b/controllers/components/toolbar.php index f461da8..6eb4d78 100644 --- a/controllers/components/toolbar.php +++ b/controllers/components/toolbar.php @@ -59,12 +59,15 @@ class ToolbarComponent extends Object { var $javascript = array(); /** <<<<<<< HEAD:controllers/components/toolbar.php +<<<<<<< HEAD:controllers/components/toolbar.php * how many historical requests to keep data for. * * @var int **/ var $history = 5; ======= +======= +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php * CacheKey used for the cache file. * * @var string @@ -76,6 +79,9 @@ class ToolbarComponent extends Object { * @var string **/ var $cacheDuration = '+4 hours'; +<<<<<<< HEAD:controllers/components/toolbar.php +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php +======= >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php /** * initialize @@ -100,6 +106,7 @@ class ToolbarComponent extends Object { unset($settings['panels']); } <<<<<<< HEAD:controllers/components/toolbar.php +<<<<<<< HEAD:controllers/components/toolbar.php if (isset($settings['history'])) { $this->history = $settings['history']; @@ -108,6 +115,11 @@ class ToolbarComponent extends Object { if (!isset($settings['history']) || (isset($settings['history']) && $settings['history'] !== false)) { $this->_createCacheConfig(); >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php +======= + $this->cacheKey .= $controller->Session->read('Config.userAgent'); + if (!isset($settings['history']) || (isset($settings['history']) && $settings['history'] !== false)) { + $this->_createCacheConfig(); +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php } if (!$this->history) { @@ -122,10 +134,14 @@ class ToolbarComponent extends Object { } $this->_loadPanels($panels, $settings); <<<<<<< HEAD:controllers/components/toolbar.php +<<<<<<< HEAD:controllers/components/toolbar.php ======= >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php +======= + +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php $this->_set($settings); $this->controller =& $controller; return false; @@ -142,10 +158,14 @@ class ToolbarComponent extends Object { $controller->view = 'DebugKit.Debug'; $isHtml = ( <<<<<<< HEAD:controllers/components/toolbar.php +<<<<<<< HEAD:controllers/components/toolbar.php !isset($controller->params['url']['ext']) || ======= !isset($controller->params['url']['ext']) || >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php +======= + !isset($controller->params['url']['ext']) || +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php (isset($controller->params['url']['ext']) && $controller->params['url']['ext'] == 'html') ); @@ -175,6 +195,10 @@ class ToolbarComponent extends Object { DebugKitDebugger::stopTimer('controllerAction'); $vars = $this->_gatherVars($controller); <<<<<<< HEAD:controllers/components/toolbar.php +<<<<<<< HEAD:controllers/components/toolbar.php +======= + $this->_saveState($controller, $vars); +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php ======= $this->_saveState($controller, $vars); >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php @@ -190,6 +214,10 @@ class ToolbarComponent extends Object { DebugKitDebugger::stopTimer('controllerAction'); $vars = $this->_gatherVars($controller); <<<<<<< HEAD:controllers/components/toolbar.php +<<<<<<< HEAD:controllers/components/toolbar.php +======= + $this->_saveState($controller, $vars); +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php ======= $this->_saveState($controller, $vars); >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php @@ -199,7 +227,10 @@ class ToolbarComponent extends Object { } /** <<<<<<< HEAD:controllers/components/toolbar.php +<<<<<<< HEAD:controllers/components/toolbar.php +======= ======= +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php * Load a toolbar state from cache * * @param int $key @@ -224,16 +255,23 @@ class ToolbarComponent extends Object { } } /** +<<<<<<< HEAD:controllers/components/toolbar.php +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php +======= >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php * collects the panel contents * * @return array Array of all panel beforeRender() * @access protected <<<<<<< HEAD:controllers/components/toolbar.php +<<<<<<< HEAD:controllers/components/toolbar.php **/ ======= **/ >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php +======= + **/ +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php function _gatherVars(&$controller) { $vars = array(); $panels = array_keys($this->panels); @@ -251,9 +289,12 @@ class ToolbarComponent extends Object { $vars[$panelName]['disableTimer'] = true; } <<<<<<< HEAD:controllers/components/toolbar.php +<<<<<<< HEAD:controllers/components/toolbar.php $this->_setHistory($controller, $vars); ======= >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php +======= +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php return $vars; } /** @@ -333,10 +374,14 @@ class ToolbarComponent extends Object { } /** <<<<<<< HEAD:controllers/components/toolbar.php +<<<<<<< HEAD:controllers/components/toolbar.php * setHistory save the current toolbar variables to the session ======= * Save the current state of the toolbar varibles to the cache file. >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php +======= + * Save the current state of the toolbar varibles to the cache file. +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php * * @param object $controller Controller instance * @param array $vars Vars to save. @@ -344,6 +389,7 @@ class ToolbarComponent extends Object { * @return void **/ <<<<<<< HEAD:controllers/components/toolbar.php +<<<<<<< HEAD:controllers/components/toolbar.php function _setHistory(&$controller, $vars) { if (!$this->history) { return; @@ -366,6 +412,8 @@ class ToolbarComponent extends Object { unset($historicalVars[0]); $controller->set(array('debugToolbarPanelsHistory' => $historicalVars)); ======= +======= +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php function _saveState(&$controller, $vars) { $config = Cache::config('debug_kit'); if (empty($config) || !isset($this->panels['history'])) { @@ -381,6 +429,9 @@ class ToolbarComponent extends Object { unset($vars['history']); array_unshift($history, $vars); Cache::write($this->cacheKey, $history, 'debug_kit'); +<<<<<<< HEAD:controllers/components/toolbar.php +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php +======= >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php } } @@ -428,7 +479,10 @@ class DebugPanel extends Object { class HistoryPanel extends DebugPanel { var $plugin = 'debug_kit'; <<<<<<< HEAD:controllers/components/toolbar.php +<<<<<<< HEAD:controllers/components/toolbar.php ======= +======= +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php /** * Number of history elements to keep * @@ -479,6 +533,9 @@ class HistoryPanel extends DebugPanel { } return $historyStates; } +<<<<<<< HEAD:controllers/components/toolbar.php +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php +======= >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php } @@ -520,9 +577,12 @@ class SessionPanel extends DebugPanel { function beforeRender(&$controller) { $sessions = $controller->Session->read(); <<<<<<< HEAD:controllers/components/toolbar.php +<<<<<<< HEAD:controllers/components/toolbar.php unset($sessions['DebugToolbar']); ======= >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php +======= +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php return $sessions; } } @@ -587,7 +647,10 @@ class TimerPanel extends DebugPanel { class sqlLogPanel extends DebugPanel { var $plugin = 'debug_kit'; <<<<<<< HEAD:controllers/components/toolbar.php +<<<<<<< HEAD:controllers/components/toolbar.php ======= +======= +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php /** * Minimum number of Rows Per Millisecond that must be returned by a query before an explain * is done. @@ -595,6 +658,9 @@ class sqlLogPanel extends DebugPanel { * @var int **/ var $slowRate = 20; +<<<<<<< HEAD:controllers/components/toolbar.php +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php +======= >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php /** * Get Sql Logs for each DB config @@ -608,6 +674,12 @@ class sqlLogPanel extends DebugPanel { return array(); } <<<<<<< HEAD:controllers/components/toolbar.php +<<<<<<< HEAD:controllers/components/toolbar.php +======= + App::import('Core', 'Xml'); + $queryLogs = array(); + +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:controllers/components/toolbar.php ======= App::import('Core', 'Xml'); $queryLogs = array(); diff --git a/vendors/css/debug_toolbar.css b/vendors/css/debug_toolbar.css index 96df4de..60fd3b6 100644 --- a/vendors/css/debug_toolbar.css +++ b/vendors/css/debug_toolbar.css @@ -138,15 +138,25 @@ border-bottom: 1px solid #222; background: 0; color: #252525; +<<<<<<< HEAD:vendors/css/debug_toolbar.css } #debug-kit-toolbar table.debug-table tr:nth-child(2n+1) td { background:#f6f6f6; +======= +} +#debug-kit-toolbar table.debug-table tr:nth-child(2n+1) td { + background:#f6f6f6; +} +#debug-kit-toolbar table.debug-table tr.even td { + background:#f7f7f7; +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/css/debug_toolbar.css } #debug-kit-toolbar table.debug-table tr.even td { background:#f7f7f7; } + /** code tables **/ #debug-kit-toolbar .code-table td { white-space: pre; @@ -223,16 +233,22 @@ } #debug-kit-toolbar .debug-kit-graph-bar { <<<<<<< HEAD:vendors/css/debug_toolbar.css +<<<<<<< HEAD:vendors/css/debug_toolbar.css background-color: #ccc; ======= background-color: #ddd; padding:2px; >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/css/debug_toolbar.css +======= + background-color: #ddd; + padding:2px; +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/css/debug_toolbar.css } #debug-kit-toolbar .debug-kit-graph-bar-value { background-color: #CE9E23; } <<<<<<< HEAD:vendors/css/debug_toolbar.css +<<<<<<< HEAD:vendors/css/debug_toolbar.css /* previous panels */ #debug-kit-toolbar .panel-history-active { @@ -241,6 +257,8 @@ #debug-kit-toolbar .panel-content-history { display: none; ======= +======= +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/css/debug_toolbar.css #sql_log-tab td { font-family: Monaco, 'Corsiva', "Courier New", Courier, monospaced; } @@ -248,6 +266,9 @@ #debug-kit-toolbar .panel-content-history { display: none; background:#eeffff; +<<<<<<< HEAD:vendors/css/debug_toolbar.css +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/css/debug_toolbar.css +======= >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/css/debug_toolbar.css } #debug-kit-toolbar #history-tab a { @@ -256,10 +277,16 @@ #debug-kit-toolbar #history-tab a.active { background: #FEF6E5; <<<<<<< HEAD:vendors/css/debug_toolbar.css +<<<<<<< HEAD:vendors/css/debug_toolbar.css +======= ======= +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/css/debug_toolbar.css } #debug-kit-toolbar #history-tab a.loading:after { content : ' Loading...'; font-style:italic; +<<<<<<< HEAD:vendors/css/debug_toolbar.css +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/css/debug_toolbar.css +======= >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/css/debug_toolbar.css } \ No newline at end of file diff --git a/vendors/js/js_debug_toolbar.js b/vendors/js/js_debug_toolbar.js index 66e12d1..90a8bc0 100755 --- a/vendors/js/js_debug_toolbar.js +++ b/vendors/js/js_debug_toolbar.js @@ -13,6 +13,7 @@ * Redistributions of files must retain the above copyright notice. * <<<<<<< HEAD:vendors/js/js_debug_toolbar.js +<<<<<<< HEAD:vendors/js/js_debug_toolbar.js * @filesource * @copyright Copyright 2006-2008, Cake Software Foundation, Inc. * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project @@ -62,10 +63,47 @@ var DEBUGKIT = function () { if (this[newmodule] === undef) { this[newmodule] = {}; return this[newmodule]; +======= + * @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org + * @package debug_kit + * @subpackage debug_kit.views.helpers + * @since DebugKit 0.1 + * @license MIT License (http://www.opensource.org/licenses/mit-license.php) + **/ +var DEBUGKIT = function () { + var undef; + return { + module : function (newmodule) { + if (this[newmodule] === undef) { + this[newmodule] = {}; + return this[newmodule]; + } + return this[newmodule]; + } + }; +}() ; + +DEBUGKIT.module('loader'); +DEBUGKIT.loader = function () { + return { + //list of methods to run on startup. + _startup : [], + + //register a new method to be run on dom ready. + register : function (method) { + this._startup.push(method); + }, + + init : function () { + for (var i = 0, callback; callback = this._startup[i]; i++) { + callback.init(); +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/js/js_debug_toolbar.js } return this[newmodule]; } }; +<<<<<<< HEAD:vendors/js/js_debug_toolbar.js }() ; DEBUGKIT.module('loader'); @@ -95,18 +133,26 @@ DEBUGKIT.loader = function () { this.addPanel(element); } ======= +======= +}(); + +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/js/js_debug_toolbar.js //Util module and Element utility class. DEBUGKIT.module('Util'); DEBUGKIT.Util.Element = { hasClass : function (element, className) { if (!element.className) { return false; +<<<<<<< HEAD:vendors/js/js_debug_toolbar.js +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/js/js_debug_toolbar.js +======= >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/js/js_debug_toolbar.js } return element.className.indexOf(className) > -1; }, <<<<<<< HEAD:vendors/js/js_debug_toolbar.js +<<<<<<< HEAD:vendors/js/js_debug_toolbar.js lists = document.getElementsByTagName('ul'); i = 0; while (lists[i] !== undefined) { @@ -205,11 +251,69 @@ DEBUGKIT.Util.Event = { type = 'on' + type; element[type] = handler; } +======= + addClass : function (element, className) { + if (!element.className) { + element.className = className; + return; + } + element.className = element.className.replace(/^(.*)$/, '$1 ' + className); + }, + + removeClass : function (element, className) { + if (!element.className) { + return false; + } + element.className = element.className.replace(new RegExp(' ?(' + className +') ?'), ''); + }, + + swapClass : function (element, removeClass, addClass) { + if (!element.className) { + return false; + } + element.className = element.className.replace(removeClass, addClass); + }, + + show : function (element) { + element.style.display = 'block'; + }, + + hide : function (element) { + element.style.display = 'none'; + }, + + toggle : function (element) { + if (element.style.display == 'none') { + this.show(element); + return; + } + this.hide(element); + } +}; + + +//Event binding +DEBUGKIT.Util.Event = { + addEvent :function(element, type, handler, capture) { + capture = (capture === undefined) ? false : capture; + if (element.addEventListener) { + element.addEventListener(type, handler, capture); + } else if (element.attachEvent) { + type = 'on' + type; + element.attachEvent(type, handler); + } else { + type = 'on' + type; + element[type] = handler; + } +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/js/js_debug_toolbar.js }, domready : function(callback) { if (document.addEventListener) { return document.addEventListener("DOMContentLoaded", callback, false); +<<<<<<< HEAD:vendors/js/js_debug_toolbar.js +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/js/js_debug_toolbar.js +======= >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/js/js_debug_toolbar.js } @@ -223,6 +327,7 @@ DEBUGKIT.Util.Event = { } }; return; +<<<<<<< HEAD:vendors/js/js_debug_toolbar.js } <<<<<<< HEAD:vendors/js/js_debug_toolbar.js @@ -276,6 +381,16 @@ DEBUGKIT.Util.Event = { callback(); } }, 10); +======= + } + + if (/Webkit/i.test(navigator.userAgent)){ + var _timer = setInterval(function (){ + if (/loaded|complete/.test(document.readyState)) { + clearInterval(_timer); + callback(); + } + }, 10); } } }; @@ -402,6 +517,142 @@ DEBUGKIT.Util.Request.prototype.onReadyStateChange = function (){ if (typeof this.onComplete == 'function') { this.onComplete.apply(this, [this, this.response]); + } else { + return this.response; + } + } else if (this.transport.status > 400) { + if (typeof this.onFail == 'function') { + this.onFail.apply(this, []); + } else { + console.error('request failed'); +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/js/js_debug_toolbar.js + } + } +}; + +<<<<<<< HEAD:vendors/js/js_debug_toolbar.js +//Cookie utility +DEBUGKIT.Util.Cookie = function() { + var cookieLife = 60; + +//public methods + return { + // Write to cookie + // @param [string] name Name of cookie to write. + // @param [mixed] value Value to write to cookie. + write : function (name, value) { + var date = new Date(); + date.setTime(date.getTime() + (cookieLife * 24 * 60 * 60 * 1000)); + var expires = "; expires=" + date.toGMTString(); + document.cookie = name + "=" + value + expires + "; path=/"; + return true; + }, + + // Read from the cookie + // @param [string] name Name of cookie to read. + read : function (name) { + name = name + '='; + var cookieJar = document.cookie.split(';'); + for (var i = 0; i < cookieJar.length; i++) { + var chips = cookieJar[i]; + //trim leading spaces + while (chips.charAt(0) == ' ') { + chips = chips.substring(1, chips.length); + } + if (chips.indexOf(name) == 0) { + return chips.substring(name.length, chips.length); + } + } + return false; + }, + /** + * Delete a cookie by name. + */ + del : function (name) { + var date = new Date(); + date.setFullYear(2000,0,1); + var expires = " ; expires=" + date.toGMTString(); + document.cookie = name + "=" + expires + "; path=/"; + } + }; +}(); + + +// Object merge takes any number of arguments and glues them together +// @param [Object] one first object +// @return object +DEBUGKIT.Util.merge = function() { + var out = {}; + for (var i = 0; i < arguments.length; i++) { + var current = arguments[i]; + for (prop in current) { + if (current[prop] !== undefined){ + out[prop] = current[prop]; + } + } + } + return out; +}; + + +// Simple wrapper for XmlHttpRequest objects. +DEBUGKIT.Util.Request = function (options) { + var _defaults = { + onComplete : function (){}, + onRequest : function (){}, + onFail : function (){}, + method : 'GET', + async : true, + headers : { + 'X-Requested-With': 'XMLHttpRequest', + 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' + } + }; + + var self = this; + this.options = DEBUGKIT.Util.merge(_defaults, options); + this.options.method = this.options.method.toUpperCase(); + + var ajax = this.createObj(); + this.transport = ajax; + + //event assignment + this.onComplete = this.options.onComplete; + this.onRequest = this.options.onRequest; + this.onFail = this.options.onFail; + + this.send = function (url, data) { + if (this.options.method == 'GET' && data) { + url = url + ( (url.charAt(url.length -1) == '?') ? '&' : '?') + data; //check for ? at the end of the string + data = null; + } + //open connection + this.transport.open(this.options.method, url, this.options.async); + + //set statechange and pass the active XHR object to it. From here it handles all status changes. + this.transport.onreadystatechange = function () { + self.onReadyStateChange.apply(self, arguments); + }; + for (var key in this.options.headers) { + this.transport.setRequestHeader(key, this.options.headers[key]); + } + this.onRequest(); + this.transport.send(data); + }; +}; + +DEBUGKIT.Util.Request.prototype.onReadyStateChange = function (){ + if (this.transport.readyState !== 4) { + return; + } + if (this.transport.status == 200 || this.transport.status > 300 && this.transport.status < 400 ) { + this.response = { + xml: this.transport.responseXML, + text: this.transport.responseText + }; + + if (typeof this.onComplete == 'function') { + this.onComplete.apply(this, [this, this.response]); >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/js/js_debug_toolbar.js } else { return this.response; @@ -578,6 +829,56 @@ DEBUGKIT.toolbar = function () { Element.show(subUl); Element.swapClass(clickedEl, 'collapsed', 'expanded'); } +======= +// Creates cross-broswer XHR object used for requests +DEBUGKIT.Util.Request.prototype.createObj = function(){ + var request = null; + try { + request = new XMLHttpRequest(); + } catch (MS) { + try { + request = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (old_MS) { + try { + request = new ActiveXObject("Microsoft.XMLHTTP"); + } catch(failure) { + request = null; + } + } + } + return request; +}; + + +//Basic toolbar module. +DEBUGKIT.module('toolbar'); +DEBUGKIT.toolbar = function () { + //shortcuts + var Request = DEBUGKIT.Request, + Element = DEBUGKIT.Util.Element, + Cookie = DEBUGKIT.Util.Cookie, + Event = DEBUGKIT.Util.Event, + toolbarHidden = false; + + + // Add neat array functionality. + // Events are bound to depth-0 UL elements. + // Use event delegation to find original target. + function _delegateNeatArray (event) { + var clickedEl = event.target; + while (clickedEl.nodeName.toUpperCase() !== 'LI') { + clickedEl = clickedEl.parentNode; + } + var subUl = clickedEl.lastChild; + var hide = Boolean(subUl.style.display === 'block'); + if (hide) { + Element.hide(subUl); + Element.swapClass(clickedEl, 'expanded', 'collapsed'); + } else { + Element.show(subUl); + Element.swapClass(clickedEl, 'collapsed', 'expanded'); + } +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/js/js_debug_toolbar.js if (event.stopPropagation !== undefined) { event.stopPropagation(); } @@ -600,6 +901,9 @@ DEBUGKIT.toolbar = function () { if (element.nodeName && element.id === 'panel-tabs') { this.elements.panel = element; break; +<<<<<<< HEAD:vendors/js/js_debug_toolbar.js +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/js/js_debug_toolbar.js +======= >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/js/js_debug_toolbar.js } } @@ -609,6 +913,7 @@ DEBUGKIT.toolbar = function () { if (Element.hasClass(element, 'panel-tab')) { this.addPanel(element); } +<<<<<<< HEAD:vendors/js/js_debug_toolbar.js } if (document.getElementsByClassName) { lists = this.elements.toolbar.getElementsByClassName('depth-0'); @@ -846,6 +1151,113 @@ DebugKit.Util.domready(function() { } } } +======= + } + if (document.getElementsByClassName) { + lists = this.elements.toolbar.getElementsByClassName('depth-0'); + } else { + lists = this.elements.toolbar.getElementsByTagName('ul'); + } + this.makeNeatArray(lists); + + this.deactivatePanel(true); + }, + + // Add a panel to the toolbar + addPanel : function (tab) { + if (!tab.nodeName || tab.nodeName.toUpperCase() !== 'LI') { + throw ('Toolbar not found, make sure you loaded it.'); + } + var panel = { + id : false, + element : tab, + button : undefined, + content : undefined, + active : false + }; + for (var i in tab.childNodes) { + var element = tab.childNodes[i], + tag = element.nodeName ? element.nodeName.toUpperCase() : false; + if (tag === 'A') { + panel.id = element.hash.replace(/^#/, ''); + panel.button = element; + } else if (tag === 'DIV') { + panel.content = element; + } + } + if (!panel.id || !panel.content) { + return false; + } + + var self = this; + Event.addEvent(panel.button, 'click', function(event) { + event = event || window.event; + event.preventDefault(); + return self.togglePanel(panel.id); + }); + + this.panels[panel.id] = panel; + return panel.id; + }, + + // Toggle a panel + togglePanel : function (id) { + if (this.panels[id] && this.panels[id].active) { + this.deactivatePanel(true); + } else { + this.deactivatePanel(true); + this.activatePanel(id); + } + }, + + // Make a panel active. + activatePanel : function (id, unique) { + if (this.panels[id] !== undefined && !this.panels[id].active) { + var panel = this.panels[id]; + if (panel.content !== undefined) { + Element.show(panel.content); + } + Element.addClass(panel.button, 'active'); + panel.active = true; + return true; + } + return false; + }, + + // Deactivate a panel. use true to hide all panels. + deactivatePanel : function (id) { + if (id === true) { + for (var i in this.panels) { + this.deactivatePanel(i); + } + return true; + } + if (this.panels[id] !== undefined) { + var panel = this.panels[id]; + if (panel.content !== undefined) { + Element.hide(panel.content); + } + Element.removeClass(panel.button, 'active'); + panel.active = false; + return true; + } + return false; + }, + + // Bind events for all the collapsible arrays. + makeNeatArray : function (lists) { + for (var i = 0, element; element = lists[i]; i++) { + if (Element.hasClass(element, 'neat-array') && element.className.match(/depth-0/)) { + var childLists = element.getElementsByTagName('UL'); + for (var j = 0, childEl; childEl = childLists[j]; j++) { + Element.hide(childEl); + Element.addClass(childEl.parentNode, 'expandable collapsed'); + } + Event.addEvent(element, 'click', _delegateNeatArray); + } + } + } +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/js/js_debug_toolbar.js }; }(); DEBUGKIT.loader.register(DEBUGKIT.toolbar); @@ -892,5 +1304,8 @@ DEBUGKIT.loader.register(DEBUGKIT.toolbarToggle); DEBUGKIT.Util.Event.domready(function () { DEBUGKIT.loader.init(); +<<<<<<< HEAD:vendors/js/js_debug_toolbar.js +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/js/js_debug_toolbar.js +======= >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/js/js_debug_toolbar.js }); \ No newline at end of file diff --git a/vendors/shells/benchmark.php b/vendors/shells/benchmark.php index e4dcdf1..ff96843 100644 --- a/vendors/shells/benchmark.php +++ b/vendors/shells/benchmark.php @@ -29,6 +29,7 @@ * @todo Print/export time detail information * @todo Export/graphing of data to .dot format for graphviz visualization * @todo Make calculated results round to leading significant digit position of std dev. +<<<<<<< HEAD:vendors/shells/benchmark.php */ /** @@ -39,6 +40,8 @@ * @todo Print/export time detail information * @todo Export/graphing of data to .dot format for graphviz visualization * @todo Make calculated results round to leading significant digit position of std dev. +======= +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/shells/benchmark.php */ class BenchmarkShell extends Shell { @@ -57,16 +60,22 @@ class BenchmarkShell extends Shell { $defaults = array('t' => 100, 'n' => 10); $options = array_merge($defaults, $this->params); <<<<<<< HEAD:vendors/shells/benchmark.php +<<<<<<< HEAD:vendors/shells/benchmark.php $times = array(); $this->out(String::insert(__('-> Testing :url', true), compact('url'))); $this->out(""); ======= +======= +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/shells/benchmark.php $times = array(); $this->out(String::insert(__('-> Testing :url', true), compact('url'))); $this->out(""); +<<<<<<< HEAD:vendors/shells/benchmark.php +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/shells/benchmark.php +======= >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:vendors/shells/benchmark.php for ($i = 0; $i < $options['n']; $i++) { if (floor($options['t'] - array_sum($times)) <= 0 || $options['n'] <= 1) { diff --git a/views/elements/debug_toolbar.ctp b/views/elements/debug_toolbar.ctp index 64383c2..6fc90c1 100644 --- a/views/elements/debug_toolbar.ctp +++ b/views/elements/debug_toolbar.ctp @@ -32,6 +32,7 @@ </li> <?php foreach ($debugToolbarPanels as $panelName => $panelInfo): ?> <<<<<<< HEAD:views/elements/debug_toolbar.ctp +<<<<<<< HEAD:views/elements/debug_toolbar.ctp <li class="panel-tab"> <a href="#<?php echo Inflector::underscore($panelName); ?>"> <?php echo Inflector::humanize(Inflector::underscore($panelName)); ?> @@ -69,12 +70,26 @@ <div class="panel-content-data"> <?php echo $this->element($panelInfo['elementName'], $panelInfo); ?> </div> +======= + <?php $panelUnderscore = Inflector::underscore($panelName);?> + <li class="panel-tab"> + <a href="#<?php echo $panelUnderscore; ?>"> + <?php echo Inflector::humanize($panelUnderscore); ?> + </a> + <div class="panel-content" id="<?php echo $panelUnderscore ?>-tab"> + <div class="panel-content-data"> + <?php echo $this->element($panelInfo['elementName'], $panelInfo); ?> + </div> +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:views/elements/debug_toolbar.ctp <div class="panel-content-data panel-content-history" id="<?php echo $panelUnderscore; ?>-history"> <!-- content here --> </div> </div> </li> <?php endforeach ?> +<<<<<<< HEAD:views/elements/debug_toolbar.ctp +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:views/elements/debug_toolbar.ctp +======= >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:views/elements/debug_toolbar.ctp </ul> <?php endif; ?> diff --git a/views/elements/timer_panel.ctp b/views/elements/timer_panel.ctp index 2f4f2ac..a2b6cfa 100644 --- a/views/elements/timer_panel.ctp +++ b/views/elements/timer_panel.ctp @@ -32,6 +32,7 @@ endif; <h2><?php __('Memory'); ?></h2> <div class="current-mem-use"> <<<<<<< HEAD:views/elements/timer_panel.ctp +<<<<<<< HEAD:views/elements/timer_panel.ctp <?php echo $toolbar->message( __('Current Memory Use',true), $number->toReadableSize(DebugKitDebugger::getMemoryUse()) @@ -45,12 +46,17 @@ endif; ); ?></div> ======= +======= +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:views/elements/timer_panel.ctp <?php echo $toolbar->message(__('Current Memory Use',true), $number->toReadableSize($currentMemory)); ?> </div> <div class="peak-mem-use"> <?php echo $toolbar->message(__('Peak Memory Use', true), $number->toReadableSize($peakMemory)); ?> </div> +<<<<<<< HEAD:views/elements/timer_panel.ctp +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:views/elements/timer_panel.ctp +======= >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:views/elements/timer_panel.ctp <h2><?php __('Timers'); ?></h2> diff --git a/views/elements/variables_panel.ctp b/views/elements/variables_panel.ctp index 8770d3b..3bd69c3 100644 --- a/views/elements/variables_panel.ctp +++ b/views/elements/variables_panel.ctp @@ -20,6 +20,10 @@ ?> <h2> <?php __('View Variables'); ?></h2> <<<<<<< HEAD:views/elements/variables_panel.ctp +<<<<<<< HEAD:views/elements/variables_panel.ctp +======= +<?php $content['$this->validationErrors'] = $this->validationErrors; ?> +>>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:views/elements/variables_panel.ctp ======= <?php $content['$this->validationErrors'] = $this->validationErrors; ?> >>>>>>> ea7bcb91ef06211231dc08307cda607a12977638:views/elements/variables_panel.ctp