Skip to content

Commit

Permalink
give greater flexibility in locating the jsxmlrpc visualeditor
Browse files Browse the repository at this point in the history
  • Loading branch information
gggeek committed Dec 18, 2022
1 parent 132ea51 commit 25666d6
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions debugger/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,19 @@
$action = 'list';
}

// Relative path to the visual xmlrpc editing dialog
// Path to the visual xmlrpc editing dialog's containing folder. Can be absolute, or relative to this debugger's folder.
// We allow to easily configure this path via defines
$editorpath = (defined('JSXMLRPC_PATH') ? JSXMLRPC_PATH : '../..') . '/jsxmlrpc/debugger/';
if ($editorpath[0] !== '/') {
$haseditor = true;//is_file(realpath(__DIR__.'/'.$editorpath.'visualeditor.html'));
// In case the webserver is set up so that the url to that folder is different. We default to JSXMLRPC_PATH for BC
$editorurlpath = defined('JSXMLRPC_BASEURL') ? JSXMLRPC_BASEURL : $editorpath;
if (defined('JSXMLRPC_BASEURL')) {
$haseditor = true;
} else {
/// @todo path to editing dialog is absolute - we need to figure out where he webserver doc root is on disk, and
/// check there. We should be able to do that based on our own on-disk path...
$haseditor = false;
if ($editorpath[0] !== '/') {
$haseditor = is_file(realpath(__DIR__ . '/' . $editorpath . 'visualeditor.html'));
} else {
$haseditor = is_file(realpath($editorpath . 'visualeditor.html'));;
}
}

?><!DOCTYPE html>
Expand Down Expand Up @@ -204,7 +208,7 @@ function displaydialogeditorbtn(show) {
}

function activateeditor() {
var url = '<?php echo $editorpath; ?>visualeditor.html?params=<?php echo str_replace(array("\\", "'"), array( "\\\\","\\'"), $alt_payload); ?>';
var url = '<?php echo $editorurlpath; ?>visualeditor.html?params=<?php echo str_replace(array("\\", "'"), array( "\\\\","\\'"), $alt_payload); ?>';
if (document.frmaction.wstype.value == "1")
url += '&type=jsonrpc';
var wnd = window.open(url, '_blank', 'width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=1');
Expand Down

0 comments on commit 25666d6

Please sign in to comment.