From 8863ad132387aad9eace8e1576230c4ae446c6e8 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Thu, 1 Oct 2020 13:55:30 +0000 Subject: [PATCH] wip #3739 @1 --- .../html5/master/class.ws.html5.links.php | 62 ++++++++++++------- 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/inc/ws/Util/html5/master/class.ws.html5.links.php b/inc/ws/Util/html5/master/class.ws.html5.links.php index 517878b61..b37975746 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -77,9 +77,8 @@ class wsHTML5Link case 4: if ($init['inline']) { return new videoLink($id, $init, $compiler); - } else { - return new videoPopupLink($id, $init, $compiler); } + return new videoPopupLink($id, $init, $compiler); case 7: switch ($compiler->book->parametres->customLinkClass) { case 'WescoLink': @@ -99,16 +98,14 @@ class wsHTML5Link default : return customLink::getCustomInstance($id, $init, $compiler); } - break; case 8: case 9: return null; case 10: if ($init['inline']) { return new webVideoLink($id, $init, $compiler); - } else { - return new webVideoPopupLink($id, $init, $compiler); } + return new webVideoPopupLink($id, $init, $compiler); case 11: return new actionLink($id, $init, $compiler); case 12: @@ -130,26 +127,22 @@ class wsHTML5Link case 14: return new colorLink($id, $init, $compiler); case 15: - if (stristr($init['to'], '.zip')) { return new inlineSlideshowLink($id, $init, $compiler); - } else { - return new imageLink($id, $init, $compiler); } + return new imageLink($id, $init, $compiler); case 16: return new fileLink($id, $init, $compiler); case 17: if ($init['inline']) { return new audioLink($id, $init, $compiler); - } else { - return new audioPopupLink($id, $init, $compiler); } + return new audioPopupLink($id, $init, $compiler); case 18: if ($init['inline']) { return new tooltipLink($id, $init, $compiler); - } else { - return new textPopupLink($id, $init, $compiler); } + return new textPopupLink($id, $init, $compiler); case 19: break; case 20: @@ -170,19 +163,16 @@ class wsHTML5Link break; case 27: return new eventOverlayLink($id, $init, $compiler); - break; + case 29: return new facebookLikeLink($id, $init, $compiler); - break; case 30: return new slideshowLink($id, $init, $compiler); - break; case 31: if ($init['inline']) { return new iframeLink($id, $init, $compiler); - } else { - return new iframePopupLink($id, $init, $compiler); } + return new iframePopupLink($id, $init, $compiler); case 32: return new showLinkLink($id, $init, $compiler); case 33: @@ -192,10 +182,8 @@ class wsHTML5Link break; case 35: return new textLink($id, $init, $compiler); - break; case 36: return new articleLink($id, $init, $compiler); - break; case 37: return new downloadPortionLink($id, $init, $compiler); case 38: @@ -203,6 +191,8 @@ class wsHTML5Link break; case 39: return new layerLink($id, $init, $compiler); + case 40: + return new anchorLink($id, $init, $compiler); default: return null; } @@ -610,6 +600,21 @@ class normalLink extends wsHTML5Link } +class anchorLink extends wsHTML5Link +{ + protected $role = ''; + + public function getHTMLContainer() + { + return '
getAdditionnalContent() . '>' . $this->getHTMLContent() . '
'; + } + + public function getHTMLContent() + { + return ''; + } +} + class showLinkLink extends normalLink { public function getURL() @@ -933,11 +938,24 @@ class internalLink extends normalLink public function getPage() { - if ($this->numerotation == 'physical') { - return $this->to; + $e = explode('#', $this->to, 2); + + $p = $e[0]; + $anchor = false; + if (count($e) > 1) { + $anchor = trim($e[1], '# '); + } + + if ($this->numerotation === 'physical') { + $res = $p; } else { - return $this->compiler->virtualToPhysical($this->to); + $res = $this->compiler->virtualToPhysical($p); } + if ($anchor) { + $res .= '/' . $anchor; + } + + return $res; } public function getAdditionnalContent() -- 2.39.5