From: gggeek Date: Sun, 18 Dec 2022 21:00:31 +0000 (+0000) Subject: give greater flexibility in locating the jsxmlrpc visualeditor X-Git-Tag: 4.9.2~2 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=25666d653ff67ef23eeed2327f3208afc1614eb6;p=plcapi.git give greater flexibility in locating the jsxmlrpc visualeditor --- diff --git a/debugger/controller.php b/debugger/controller.php index be85b30d..88e3372d 100644 --- a/debugger/controller.php +++ b/debugger/controller.php @@ -22,15 +22,19 @@ if ($action == '') { $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'));; + } } ?> @@ -204,7 +208,7 @@ if ($editorpath[0] !== '/') { } function activateeditor() { - var url = 'visualeditor.html?params='; + var url = 'visualeditor.html?params='; 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');