]> _ Git - cubeextranet.git/commitdiff
wip #3739 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 1 Oct 2020 13:55:30 +0000 (13:55 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 1 Oct 2020 13:55:30 +0000 (13:55 +0000)
inc/ws/Util/html5/master/class.ws.html5.links.php

index 517878b61305a2a6fecbaba5abce3abd8dbf2fe5..b37975746c929f2c9e57a6aa61133e6ab87d0606 100644 (file)
@@ -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 '<div aria-hidden="false" data-anchor="' . trim($this->to, '# ') . '" class="anchor ' . $this->getHTMLContainerClass() . '" data-hidden="' . $this->hidden . '" data-scorm="' . $this->scorm . '" data-id="' . $this->uid . '" id="l_' . $this->id . '"' . $this->getAdditionnalContent() . '>' . $this->getHTMLContent() . '</div>';
+    }
+
+    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()