Skip to content

Commit

Permalink
Another attempt to fix AJAX loading endpoint for all scenarios.
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianbj committed Nov 28, 2024
1 parent 1498869 commit c3e0af5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions panels/ConsolePanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function getTab() {
public function getPanel() {

$rootPath = $this->wire('config')->paths->root;
$rootUrl = $this->wire('config')->urls->root;
$currentUrl = $_SERVER['REQUEST_URI'];
$tracyModuleUrl = $this->wire('config')->urls->TracyDebugger;
$inAdmin = \TracyDebugger::$inAdmin;

Expand Down Expand Up @@ -406,7 +406,7 @@ public function getPanel() {
var backupFilename = document.getElementById("backupFilename").value;
var accessTemplateVars = !this.inAdmin ? document.getElementById("accessTemplateVars").checked : "false";
xmlhttp.open("POST", "$rootUrl", true);
xmlhttp.open("POST", "$currentUrl", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xmlhttp.send("tracyConsole=1&codeReturn=codeReturn&allowBluescreen="+allowBluescreen+"&dbBackup="+dbBackup+"&backupFilename="+backupFilename+"&accessTemplateVars="+accessTemplateVars+"&pid={$pid}&fid={$fid}&tid={$tid}&mid={$mid}&code="+encodeURIComponent(code));
Expand Down Expand Up @@ -448,7 +448,7 @@ public function getPanel() {
xmlhttp.getAllResponseHeaders();
}
};
xmlhttp.open("POST", "$rootUrl", true);
xmlhttp.open("POST", "$currentUrl", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xmlhttp.send("tracysnippets=1&snippetname=" + name);
Expand Down Expand Up @@ -505,7 +505,7 @@ public function getPanel() {
xmlhttp.getAllResponseHeaders();
}
};
xmlhttp.open("POST", "$rootUrl", true);
xmlhttp.open("POST", "$currentUrl", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
if(deleteSnippet) {
Expand Down
4 changes: 2 additions & 2 deletions panels/FileEditorPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function getTab() {
public function getPanel() {

$tracyModuleUrl = $this->wire('config')->urls->TracyDebugger;
$rootUrl = $this->wire('config')->urls->root;
$currentUrl = $_SERVER['REQUEST_URI'];

$filePath = $this->wire('config')->paths->root . $this->tracyFileEditorFilePath;

Expand Down Expand Up @@ -144,7 +144,7 @@ public function getPanel() {
tfe: {},
tracyModuleUrl: "$tracyModuleUrl",
rootUrl: "$rootUrl",
currentUrl: "$currentUrl",
tracyFileEditorFilePath: "{$this->tracyFileEditorFilePath}",
errorMessage: "{$this->errorMessage}",
customSnippetsUrl: "$customSnippetsUrl",
Expand Down
4 changes: 2 additions & 2 deletions panels/ProcesswireInfoPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function getPanel() {

$out = '';
$panelSections = \TracyDebugger::getDataValue('processwireInfoPanelSections');
$rootUrl = $this->wire('config')->urls->root;
$currentUrl = $_SERVER['REQUEST_URI'];

if(in_array('gotoId', $panelSections)) {
$out .= <<< HTML
Expand Down Expand Up @@ -125,7 +125,7 @@ function tracyClearGoToPageID(matchStatus) {
}
}
xmlhttp.open("POST", "$rootUrl", true);
xmlhttp.open("POST", "$currentUrl", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xmlhttp.send("goToPage="+pid);
Expand Down
4 changes: 2 additions & 2 deletions panels/TracyExceptionsPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function getTab() {
public function getPanel() {

$tracyModuleUrl = $this->wire('config')->urls->TracyDebugger;
$rootUrl = $this->wire('config')->urls->root;
$currentUrl = $_SERVER['REQUEST_URI'];

$filePath = $this->wire('config')->paths->root . $this->tracyExceptionFile;

Expand All @@ -63,7 +63,7 @@ public function getPanel() {
var tracyExceptionsViewer = {
tracyModuleUrl: "$tracyModuleUrl",
rootURL: "$rootUrl",
currentURL: "$currentUrl",
};
function clearTracyExceptionsViewer() {
Expand Down

0 comments on commit c3e0af5

Please sign in to comment.