commit dc59b4bd363e991b154d45736fdc0278b8bc1163
parent e1f5986c4b346b0f4b879f43376615d3e8ee769c
Author: markseu <mark2011@mayberg.se>
Date: Fri, 29 Apr 2022 08:00:08 +0200
Updated edit shortcut, target argument
Diffstat:
3 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/system/extensions/core.php b/system/extensions/core.php
@@ -2,7 +2,7 @@
// Core extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/core
class YellowCore {
- const VERSION = "0.8.74";
+ const VERSION = "0.8.75";
const RELEASE = "0.8.19";
public $page; // current page
public $content; // content files
@@ -207,12 +207,12 @@ class YellowCore {
$this->page->setRequestInformation($scheme, $address, $base, $location, $fileName);
$this->page->parseData($rawData, $cacheable, $statusCode, $pageError);
$this->language->set($this->page->get("language"));
- $this->page->parseContent();
return $fileName;
}
// Send page response
public function sendPage() {
+ $this->page->parseContent();
$this->page->parsePage();
$statusCode = $this->page->statusCode;
$lastModifiedFormatted = $this->page->getHeader("Last-Modified");
@@ -516,7 +516,7 @@ class YellowPage {
$this->yellow->system->get("coreServerAddress"),
$this->yellow->system->get("coreServerBase"),
rtrim($this->yellow->system->get("editLocation"), "/").$this->location));
- $this->setPage("main", $this);
+ $this->parseMetaShared();
} else {
$this->set("type", $this->yellow->toolbox->getFileType($this->fileName));
$this->set("group", $this->yellow->toolbox->getFileGroup($this->fileName, $this->yellow->system->get("coreMediaDirectory")));
@@ -547,6 +547,19 @@ class YellowPage {
}
}
+ // Parse page meta data with shared pages
+ public function parseMetaShared() {
+ $this->sharedPages["main"] = $this;
+ if ($this->available && $this->statusCode!=0) {
+ foreach ($this->yellow->content->getShared($this->location) as $page) {
+ if ($page->get("status")=="shared") {
+ $this->sharedPages[basename($page->location)] = $page;
+ $page->sharedPages["main"] = $this;
+ }
+ }
+ }
+ }
+
// Parse page content on demand
public function parseContent($sizeMax = 0) {
if (!is_null($this->rawData) && !is_object($this->parser)) {
@@ -638,12 +651,6 @@ class YellowPage {
// Parse page layout
public function parsePageLayout($name) {
- foreach ($this->yellow->content->getShared($this->location) as $page) {
- if ($page->get("status")=="shared") {
- $this->sharedPages[basename($page->location)] = $page;
- $page->sharedPages["main"] = $this;
- }
- }
$this->outputData = null;
foreach ($this->yellow->extension->data as $key=>$value) {
if (method_exists($value["object"], "onParsePageLayout")) {
diff --git a/system/extensions/edit.php b/system/extensions/edit.php
@@ -2,7 +2,7 @@
// Edit extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/edit
class YellowEdit {
- const VERSION = "0.8.58";
+ const VERSION = "0.8.59";
public $yellow; // access to API
public $response; // web response
public $merge; // text merge
@@ -88,9 +88,11 @@ class YellowEdit {
public function onParseContentShortcut($page, $name, $text, $type) {
$output = null;
if ($name=="edit" && $type=="inline") {
- $editText = "$name $text";
- if (substru($text, 0, 2)=="- ") $editText = trim(substru($text, 2));
- $output = "<a href=\"".$page->get("pageEditUrl")."\">".htmlspecialchars($editText)."</a>";
+ list($target, $description) = $this->yellow->toolbox->getTextList($text, " ", 2);
+ if (empty($target) || $target=="-") $target = "main";
+ if (empty($description)) $description = ucfirst($name);
+ $pageTarget = $target=="main" ? $page->getPage("main") : $page->getPage("main")->getPage($target);
+ $output = "<a href=\"".$pageTarget->get("pageEditUrl")."\">".htmlspecialchars($description)."</a>";
}
return $output;
}
diff --git a/system/extensions/update-current.ini b/system/extensions/update-current.ini
@@ -21,11 +21,11 @@ Tag: feature
system/extensions/command.php: command.php, create, update
Extension: Core
-Version: 0.8.74
+Version: 0.8.75
Description: Core functionality of the website.
DocumentationUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/core
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/core.zip
-Published: 2022-04-28 08:48:31
+Published: 2022-04-29 07:50:15
Developer: Datenstrom
Tag: feature
system/extensions/core.php: core.php, create, update
@@ -37,11 +37,11 @@ system/layouts/navigation.html: navigation.html, create, update, careful
system/layouts/pagination.html: pagination.html, create, update, careful
Extension: Edit
-Version: 0.8.58
+Version: 0.8.59
Description: Edit your website in a web browser.
DocumentationUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/edit
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/edit.zip
-Published: 2022-04-19 22:33:56
+Published: 2022-04-29 07:51:22
Developer: Datenstrom
Tag: feature
system/extensions/edit.php: edit.php, create, update