Skip to content
Snippets Groups Projects
Commit e1c48dfc authored by Ghislain Loas's avatar Ghislain Loas
Browse files

hotline #16530: add html5 attribute 'download' to epub download link in...

hotline #16530: add html5 attribute 'download' to epub download link in viewnotice notice resnum widget
parent 7e0df913
Branches
Tags
5 merge requests!529Hotline 6.56,!512Master,!484Master,!483Hotline 6.54,!472Hotline #16530 download issue on epub download link
- ticket: #16530: add html5 attribute 'download' to epub download link in viewnotice notice resnum widget
\ No newline at end of file
......@@ -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;
}
......
......@@ -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');
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment