Debughelper Firefox Add-on: Difference between revisions
The Extention |
m moved Debughelper to Debughelper Firefox Add-on |
||
| (6 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
= Introduction = | = Introduction = | ||
In my latest ATK project, I needed to switch quite often between debuglevel 1 and 2: in some cases I wanted to see the intermediate-screens after updating a record, but not everytime. | In [[Jeroen van Sluijs|my]] latest ATK project, I needed to switch quite often between debuglevel 1 and 2: in some cases I wanted to see the intermediate-screens after updating a record, but not everytime. | ||
To do this, we have 2 options: | To do this, we have 2 options: | ||
| Line 7: | Line 7: | ||
If you use the second option in ATK applications, you'll end up at the indexpage after confirming the URL.. | If you use the second option in ATK applications, you'll end up at the indexpage after confirming the URL.. | ||
But now there's option 3 :) I created a firefox | But now there's option 3 :) I created a firefox add-on to switch between debuglevels by just clicking the atkdebughelper-icon. | ||
Happy debugging!<br /> | |||
[[Jeroen van Sluijs]] | |||
= Using the ATK debughelper = | = Using the ATK debughelper = | ||
== The | == The Add-on == | ||
I'll place the XPI on a nice place later, for now: [[Media: | I'll place the XPI on a nice place later, for now: [[Media:Atkdebughelper_v122.xpi.zip]] | ||
* Unzip it | * Unzip it | ||
* Drag the XPI-file to your FireFox addons | * Drag the XPI-file to your FireFox addons | ||
| Line 88: | Line 91: | ||
return $default; | return $default; | ||
} | } | ||
= Feature requests = | |||
= | * Nice list to manage url/keys (with add/edit/remove buttons) | ||
* Popup when right-mouseclick on icon: | |||
** [√] nocache (on/off) | |||
* When watching a page where debugging is possible (URL in debughelper-settings matches the current URL), change the color of the icon | |||
* | |||
* | |||
* | |||
* | |||
Latest revision as of 16:18, 12 February 2010
Introduction
In my latest ATK project, I needed to switch quite often between debuglevel 1 and 2: in some cases I wanted to see the intermediate-screens after updating a record, but not everytime.
To do this, we have 2 options:
- change $config_debug value in your config.inc.php, or
- add debug-key and -level to your URL if smart-debugging is enabled.
If you use the second option in ATK applications, you'll end up at the indexpage after confirming the URL..
But now there's option 3 :) I created a firefox add-on to switch between debuglevels by just clicking the atkdebughelper-icon.
Happy debugging!
Jeroen van Sluijs
Using the ATK debughelper
The Add-on
I'll place the XPI on a nice place later, for now: Media:Atkdebughelper_v122.xpi.zip
- Unzip it
- Drag the XPI-file to your FireFox addons
Howto
First of all, you need the latest ATK version, which contains some additional checking for debug-keys and levels. If you don't have the latest version, or do not want to update (existing/old projects), you can make a local change yourself (see "Local ATK changes" below).
Then:
1. Make sure you enabled smart debugging in your project's config.inc.php (replace 'yourdebugkey' by your specific project-key):
$config_smart_debug[] = array("type"=>"request", "key"=>"yourdebugkey");
2. Add the domain name and key for your sites in the 'Site debug keys' (ATK debughelper preferences) to automatically enable debugging for that site
e.g. URL 1: http://www.achievo.org KEY 1: yourdebugkey
3. Press the ATK debughelper icon to change the debuglevel.
Troubleshooting
Clicking icon doesn't change application's debuglevel:
- Is smart debugging enabled in your
config.inc.php? - Did you set the domain-name and debug-key correctly in the 'Site debug keys' above?
- Do NOT use atkdebug[key] and atkdebug[level] in your URL, they overrule the ATK debughelper.
- Is your
atk/class.atkconfig.incup to date? - Check if
ATKDEBUG_LEVELandATKDEBUG_KEYcookies are present.
Tricks
If you don't want to add the debug url/keys to the ATK debughelper-settings, you can also enable debugging the old way by adding &atkdebug[key]=yourdebugkey to the URL. After this, you can switch the debuglevel by pressing the icon.
Local ATK changes
Changes in atk/class.atkconfig.inc needed for this plugin to work (already present in latest ATK version in SVN).
function requestDebugEnabled($params)
{
$session = &atkSessionManager::getSession();
if (isset($_REQUEST["atkdebug"]["key"]))
{
$session["debug"]["key"] = $_REQUEST["atkdebug"]["key"];
}
else if (isset($_COOKIE['ATKDEBUG_KEY']) && !empty($_COOKIE['ATKDEBUG_KEY']))
{
$session["debug"]["key"] = $_COOKIE['ATKDEBUG_KEY'];
}
return (isset($session["debug"]["key"]) && $session["debug"]["key"] == $params["key"]);
}
function smartDebugLevel($default, $options=array())
{
$session = &atkSessionManager::getSession();
$enabled = $default > 0;
foreach ($options as $option)
{
$method = $option["type"]."DebugEnabled";
if (is_callable(array("atkconfig", $method)))
$enabled = $enabled || atkconfig::$method($option);
}
if ($enabled)
{
if (isset($_REQUEST["atkdebug"]["level"]))
{
$session["debug"]["level"] = $_REQUEST["atkdebug"]["level"];
}
else if (isset($_COOKIE['ATKDEBUG_LEVEL']))
{
$session["debug"]["level"] = $_COOKIE['ATKDEBUG_LEVEL'];
}
if (isset($session["debug"]["level"]))
return $session["debug"]["level"];
else return max($default, 1);
}
return $default;
}
Feature requests
- Nice list to manage url/keys (with add/edit/remove buttons)
- Popup when right-mouseclick on icon:
- [√] nocache (on/off)
- When watching a page where debugging is possible (URL in debughelper-settings matches the current URL), change the color of the icon