diff --git a/VERSIONS_HOTLINE/#16530 b/VERSIONS_HOTLINE/#16530 new file mode 100644 index 0000000000000000000000000000000000000000..cb7b4fc051581d1390abc89f759d43f12f1bfb95 --- /dev/null +++ b/VERSIONS_HOTLINE/#16530 @@ -0,0 +1 @@ +- ticket: #16530: add html5 attribute 'download' to epub download link in viewnotice notice resnum widget \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/MonocleReaderServerSide.php b/library/ZendAfi/View/Helper/MonocleReaderServerSide.php index 7a71891a0728fb33a0dfb7906e589e0cb5fd72b1..0f688f6bd5812c48c0f94b75dfaf4fa4ad427e60 100644 --- a/library/ZendAfi/View/Helper/MonocleReaderServerSide.php +++ b/library/ZendAfi/View/Helper/MonocleReaderServerSide.php @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with AFI-OPAC 2.0; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -33,7 +33,7 @@ class ZendAfi_View_Helper_MonocleReaderServerSide extends Zend_View_Helper_HtmlE } } - if ($epub = $this->createEpubFromResource($res_epub)) + if ($epub = $this->createEpubFromResource($res_epub)) return $this->showUrls($album).$this->fillJsForMonocle($epub); return $this->showUrls($album); @@ -59,7 +59,7 @@ class ZendAfi_View_Helper_MonocleReaderServerSide extends Zend_View_Helper_HtmlE $label = str_replace("'","\'",$label); $contents[] = ['title' => $label, 'src' => $nav['src']]; - + } $components = []; @@ -67,7 +67,7 @@ class ZendAfi_View_Helper_MonocleReaderServerSide extends Zend_View_Helper_HtmlE $href=$epub->getItemElById($item['id'])->getAttribute('href') ; $components[$item['id']]= $href; } - + Class_ScriptLoader::getInstance() ->addStyleSheet(URL_ADMIN_JS."efm/css/monocore.css") @@ -76,13 +76,13 @@ class ZendAfi_View_Helper_MonocleReaderServerSide extends Zend_View_Helper_HtmlE ->addAdminScript("efm/js/monocore.js") ->addAdminScript("efm/js/monoctrl.js") ->addOpacScript("monocle-server") - + ->addInlineScript(sprintf('initMonocleServer(%s,\'%s\',%s,\'%s\');', json_encode($contents),$urlepub,json_encode($components),$this->getIdAjaxDiv())); - + return ' <BASE href="'.$urlepub.'" /><div id='.$this->getIdAjaxDiv().'><p></p></div>'.Class_ScriptLoader::getInstance()->html(); } - + public function getIdAjaxDiv() { return 'reader'; @@ -94,12 +94,15 @@ class ZendAfi_View_Helper_MonocleReaderServerSide extends Zend_View_Helper_HtmlE $ressources = $album->getRessources(); foreach($ressources as $ressource) { + $libelle = $ressource->getTitre() ? $ressource->getTitre() : $ressource->getFichier(); $html .= '<li data-role="list-divider">'. - sprintf('<a href="%s" data-ajax="false"><img src=%s alt="'.$this->view->_('Télécharger').'">%s</a>', - $this->view->absoluteUrl($ressource->getOriginalUrl()), - $this->view->absoluteurl($ressource->getThumbnailUrl()), - $ressource->getTitre() ? $ressource->getTitre() : $ressource->getFichier()); - + $this->view->tagAnchor($this->view->absoluteUrl($ressource->getOriginalUrl()), + $this->view->tagImg($this->view->absoluteurl($ressource->getThumbnailUrl()), + ['alt' => $this->view->_('Télécharger')]) + . $libelle, + ['data-ajax' => 'false', + 'download' => $libelle]); + if ($ressource->getFileExtension()=='epub') { $html .= $this->view->tagAnchor(['module' => 'opac', 'controller' => 'bib-numerique', @@ -112,7 +115,7 @@ class ZendAfi_View_Helper_MonocleReaderServerSide extends Zend_View_Helper_HtmlE $html .= '</li>'; } - + $html .= '</ul>'; return $html; } diff --git a/tests/library/ZendAfi/View/Helper/RenderAlbumTest.php b/tests/library/ZendAfi/View/Helper/RenderAlbumTest.php index 98aa436bf20e9ec5529fef24484197a442188ed4..61d27906ef8ef687a4f6de695434c6e32eace75b 100644 --- a/tests/library/ZendAfi/View/Helper/RenderAlbumTest.php +++ b/tests/library/ZendAfi/View/Helper/RenderAlbumTest.php @@ -63,7 +63,7 @@ class ZendAfi_View_Helper_RenderAlbumEPUBTest extends ZendAfi_View_Helper_Render /** @test */ public function pageShouldContainsLinkToDownloadEPUB() { $this->assertXPathContentContains($this->html, - '//a[contains(@href,"/userfiles/album/999/big/media/versailles.epub")]', + '//a[@download="versailles.epub"][contains(@href,"/userfiles/album/999/big/media/versailles.epub")]', 'versailles.epub'); }