From 5c4859125631359ced37ce3113f199de4b499324 Mon Sep 17 00:00:00 2001 From: Adrian Jones Date: Thu, 24 Oct 2024 20:12:23 -0700 Subject: [PATCH] Show unpublished, hidden, and trashed status along with path (via tooltip) for Goto Page ID feature. --- TracyDebugger.module.php | 2 +- includes/GetPageById.php | 6 +++++- panels/ProcesswireInfoPanel.php | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/TracyDebugger.module.php b/TracyDebugger.module.php index 4604584c..a68609f7 100644 --- a/TracyDebugger.module.php +++ b/TracyDebugger.module.php @@ -27,7 +27,7 @@ public static function getModuleInfo() { 'summary' => __('Tracy debugger from Nette with many PW specific custom tools.', __FILE__), 'author' => 'Adrian Jones', 'href' => 'https://processwire.com/talk/forum/58-tracy-debugger/', - 'version' => '4.26.40', + 'version' => '4.26.41', 'autoload' => 100000, // in PW 3.0.114+ higher numbers are loaded first - we want Tracy first 'singular' => true, 'requires' => 'ProcessWire>=2.7.2, PHP>=5.4.4', diff --git a/includes/GetPageById.php b/includes/GetPageById.php index 45f69409..cee4cf4d 100644 --- a/includes/GetPageById.php +++ b/includes/GetPageById.php @@ -8,6 +8,10 @@ $pageInfo['url'] = $p->url; $pageInfo['template_id'] = $p->template->id; $pageInfo['template_name'] = $p->template->name; + $pageInfo['path'] = $p->path; + $pageInfo['unpublished'] = $p->isUnpublished(); + $pageInfo['hidden'] = $p->isHidden(); + $pageInfo['trash'] = $p->isTrash(); } echo json_encode($pageInfo); exit; @@ -21,4 +25,4 @@ function truncateText($rawText, $maxlength) { $text = substr($text, 0, strrpos($text, ' ')); } return trim($text) . (strlen($rawText) > $maxlength ? '…' : ''); -} \ No newline at end of file +} diff --git a/panels/ProcesswireInfoPanel.php b/panels/ProcesswireInfoPanel.php index 62d42e98..887d3467 100644 --- a/panels/ProcesswireInfoPanel.php +++ b/panels/ProcesswireInfoPanel.php @@ -112,7 +112,8 @@ function tracyClearGoToPageID(matchStatus) { if(xmlhttp.readyState == XMLHttpRequest.DONE) { if(xmlhttp.status == 200 && xmlhttp.responseText !== "[]") { var pageDetails = JSON.parse(xmlhttp.responseText); - document.getElementById("pageDetails").innerHTML = "" + pageDetails.title + "  urls->admin}setup/template/edit?id=" + pageDetails.template_id + "' style='color:#888'>" + pageDetails.template_name + ""; + console.log(pageDetails.trash); + document.getElementById("pageDetails").innerHTML = "" + (pageDetails.trash ? '🗑︎ ' : '') + pageDetails.title + " (urls->admin}setup/template/edit?id=" + pageDetails.template_id + "' style='color:#888'>" + pageDetails.template_name + ")"; document.getElementById("idGoToEdit").href = "{$this->wire('config')->urls->admin}page/edit/?id=" + pageDetails.id; document.getElementById("idGoToView").href = pageDetails.url; document.getElementById("idGoToOpen").href = "{$this->wire('config')->urls->admin}page/?open=" + pageDetails.id;