From 1bc79d0ce2fc01f4ea964794bfb43d13ddd5a86f Mon Sep 17 00:00:00 2001
From: gloas <gloas@git-test.afi-sa.fr>
Date: Fri, 14 Jun 2013 08:03:18 +0000
Subject: [PATCH] Correction comportement barre de lien mur + skin + tests

---
 .gitattributes                                |   1 +
 .../modules/opac/views/scripts/subModal.phtml |   6 ++---
 library/ZendAfi/View/Helper/IconeSupport.php  |  22 ++++++++--------
 .../View/Helper/Notice/LienReserver.php       |   5 ++++
 library/ZendAfi/View/Helper/Notice/Mur.php    |   7 ++---
 public/opac/css/global.css                    |  16 +++++++++---
 public/opac/images/patience.gif               | Bin 0 -> 1553 bytes
 public/opac/js/liste_notices_mur.js           |  24 +++++++++++++++---
 public/opac/js/recherche.js                   |   5 ++--
 .../ZendAfi/View/Helper/Notice/MurTest.php    |   2 +-
 10 files changed, 63 insertions(+), 25 deletions(-)
 create mode 100644 public/opac/images/patience.gif

diff --git a/.gitattributes b/.gitattributes
index d2dbf32c432..8afd4d48869 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -4251,6 +4251,7 @@ public/opac/images/box/menu/separ.gif -text
 public/opac/images/earth-logo.jpg -text svneol=unset#unset
 public/opac/images/epub.png -text svneol=unset#unset
 public/opac/images/flash-logo.jpg -text
+public/opac/images/patience.gif -text svneol=unset#unset
 public/opac/images/quicktime-logo.png -text svneol=unset#unset
 public/opac/images/read_speaker_listen.gif -text
 public/opac/images/resa.png -text svneol=unset#unset
diff --git a/application/modules/opac/views/scripts/subModal.phtml b/application/modules/opac/views/scripts/subModal.phtml
index 59dfca94e45..ed5ae176954 100644
--- a/application/modules/opac/views/scripts/subModal.phtml
+++ b/application/modules/opac/views/scripts/subModal.phtml
@@ -1,8 +1,8 @@
 <?php 
 $script_loader = Class_ScriptLoader::getInstance()
-								 ->addAdminStyleSheet('subModalContenu')
-								 ->addAdminScript('global')
-	               ->addSkinStyleSheet('iframe');
+	->addAdminStyleSheet('subModalContenu')
+	->addAdminScript('global')
+	->addSkinStyleSheet('iframe');
 
 ob_start(); 
 echo $this->render($this->actionScript);
diff --git a/library/ZendAfi/View/Helper/IconeSupport.php b/library/ZendAfi/View/Helper/IconeSupport.php
index a80ad6e1cd6..8e3b540fda4 100644
--- a/library/ZendAfi/View/Helper/IconeSupport.php
+++ b/library/ZendAfi/View/Helper/IconeSupport.php
@@ -62,15 +62,17 @@ class ZendAfi_View_Helper_IconeSupport extends Zend_View_Helper_HtmlElement {
 	}
 
 
-	public function imageForSupport($id) {
+	public function imageForSupport($type_doc_id) {
 		//keep format support_xxx_.gif for backward compatibility
-		$filename = 'support_'.$id.'.gif';
-	
-		if ($this->fileExists($this->pathInSkin($filename)))
-			return $this->urlInSkin($filename);
+		foreach(['gif', 'png'] as $extension) {
+			$filename = 'support_'.$type_doc_id.'.'.$extension;
+			
+			if ($this->fileExists($this->pathInSkin($filename)))
+				return $this->urlInSkin($filename);
+		}
 		
 		//then back to new icons
-		$filename = $this->getFileNameBySupport($id);
+		$filename = $this->getFileNameBySupport($type_doc_id);
 		if ($this->fileExists($this->pathInSkin($filename)))
 			return $this->urlInSkin($filename);
 
@@ -78,11 +80,11 @@ class ZendAfi_View_Helper_IconeSupport extends Zend_View_Helper_HtmlElement {
 	}
 
 
-	public function getFilenameBySupport($id) {
-		if (array_key_exists($id, $this->_filename_by_support))
-			return $this->_filename_by_support[$id];
+	public function getFilenameBySupport($type_doc_id) {
+		if (array_key_exists($type_doc_id, $this->_filename_by_support))
+			return $this->_filename_by_support[$type_doc_id];
 
-		if ($id >= Class_TypeDoc::LIVRE_NUM) //ressources numeriques
+		if ($type_doc_id >= Class_TypeDoc::LIVRE_NUM) //ressources numeriques
 			return 'mls_s.png';
 
 		return 'aut_s.png';
diff --git a/library/ZendAfi/View/Helper/Notice/LienReserver.php b/library/ZendAfi/View/Helper/Notice/LienReserver.php
index 274ddfbd948..a0c4a98ed3b 100644
--- a/library/ZendAfi/View/Helper/Notice/LienReserver.php
+++ b/library/ZendAfi/View/Helper/Notice/LienReserver.php
@@ -32,6 +32,8 @@ class ZendAfi_View_Helper_Notice_LienReserver extends Zend_View_Helper_HtmlEleme
 			}
 
 			var openDialogExemplaires = function(id_notice, anchor) {
+        disableDblclick(anchor);
+        addLoadingClass(anchor);
 				$.ajax({url: "'.$this->view->url(['controller' => 'noticeajax', 'action' => 'exemplaires'], null, true).'/id_notice/"+id_notice})
 				.done(function(data) {
 						var dialog_reserver = $(\'<div id="dialog_reserver"></div>\')
@@ -40,6 +42,7 @@ class ZendAfi_View_Helper_Notice_LienReserver extends Zend_View_Helper_HtmlEleme
 										   modal: true, 
                        dialogClass: "reservation-exemplaires",
 										   title: "'.$this->view->_("Réserver ").'",
+                       close: removeLoadingClass(anchor),
 								       open: function() {
 									             $(\'div.ui-widget-overlay\').click(closeDialogExemplaires);
 									            }});
@@ -50,6 +53,7 @@ class ZendAfi_View_Helper_Notice_LienReserver extends Zend_View_Helper_HtmlEleme
 								var onclick = link.attr(\'onclick\');
 								link.attr(\'onclick\', \'\');
 								link.click(function() {
+                    removeLoadingClass(anchor);
 										closeDialogExemplaires();
 										eval(onclick);
 									});			
@@ -74,6 +78,7 @@ class ZendAfi_View_Helper_Notice_LienReserver extends Zend_View_Helper_HtmlEleme
 	public function loadScript() {
 			Class_ScriptLoader::getInstance()
 				->addOPACScript('subModal')
+				->addOPACScript('liste_notices_mur.js')
 				->addInlineScript($this->getScriptDialog());
 			$this->_script_added = true;
 	}
diff --git a/library/ZendAfi/View/Helper/Notice/Mur.php b/library/ZendAfi/View/Helper/Notice/Mur.php
index cd6d2296898..0b3bd280bbb 100644
--- a/library/ZendAfi/View/Helper/Notice/Mur.php
+++ b/library/ZendAfi/View/Helper/Notice/Mur.php
@@ -66,15 +66,16 @@ class ZendAfi_View_Helper_Notice_Mur extends Zend_View_Helper_HtmlElement {
 		
 		public function barreDeLienAvis($url, $count, $title) {
 			if (0 < $count)
-        return '<li data-avis="true"><a href="' . $url .'" data-prettyphoto="true" title="Voir les ' . $title . '"><span>'. sprintf('%02s', $count) . '</span></a></li>';
+        return '<li data-avis="true"><a href="' . $url .'" title="Voir les ' . $title . '"><span>'. sprintf('%02s', $count) . '</span></a></li>';
 			return '<li></li>';
 		}
 
 		public function barreDeLienPanier($notice) {
 			Class_ScriptLoader::getInstance()->addOPACScript("subModal");
-			return '<li><a href="' . $this->view->url(['controller' => 'panier', 
+			$url = $this->view->url(['controller' => 'panier', 
 																								 'action' => 'ajout-ajax',
-																								 'id_notice' => $notice->getId()], null, true) . '" title="Ajouter au panier">&nbsp;</a></li>';
+															 'id_notice' => $notice->getId()], null, true);
+			return '<li><a href="' . $url . '" data-action="'. $url.'"  title="Ajouter au panier">&nbsp;</a></li>';
 		}
 }
 
diff --git a/public/opac/css/global.css b/public/opac/css/global.css
index 69de5bf8676..1d659ff9749 100644
--- a/public/opac/css/global.css
+++ b/public/opac/css/global.css
@@ -26,7 +26,7 @@ a {
 }
 
 .siteWeb div#right_col_color{
-    float: left;
+    float: left;.
 }
 
 #site_web_wrapper {
@@ -37,7 +37,7 @@ a {
 /* Boites bannière*/
 .configuration_module {
     float: right;
-    position: relative;
+    position: relative; 
     height: 0px;
     z-index: 100;
 }
@@ -1933,6 +1933,10 @@ button.vodeclic_link + img {
     height:16px;
 }
 
+ul.barre-de-lien li.image-loading-status {
+    background: url(../images/patience.gif) no-repeat center center !important;
+}
+
 .permalien-img+div>div:first-child {
     position:absolute;
     left:54px;
@@ -1976,4 +1980,10 @@ button.vodeclic_link + img {
 .liste_mur .vignette-reseaux-sociaux img {
     margin:0px;
     padding:1px;
-}
\ No newline at end of file
+}
+
+form.zend_form.reservation_pickup label {
+    width: 300px;
+    margin-bottom: 5px;
+}
+
diff --git a/public/opac/images/patience.gif b/public/opac/images/patience.gif
new file mode 100644
index 0000000000000000000000000000000000000000..085ccaecaf5fa5c34bc14cd2c2ed5cbbd8e25dcb
GIT binary patch
literal 1553
zcma)+TTl~c6vwlh>n<VLV61^sn`|N^0W=V(@iI19!X;{*a0v}4n9#t)qE(cNZL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Cg3kq-^KY>?-Ls6S#GoV0tbt6ku7B&*0
z;i9QM$W1Rj*rRIdceL)rAOSl+sDe3LkB87<%){;ZdHp6|SNl<OIeBfYJ^OGoVC|jD
zcj|NrO0)Z%BOuq3YT)!JC)v;7%cHj=+`Ob^2$Vkq`P{n^zZen9w+$o2yd>opDXRx<
zxBDF9-lTo&v`8$humFygUij@qgT=Qzhj8{ym2-{Xciwqq_Xwk%=O3B-MNAL_6e`3U
zyxwmXex4`g0^1RYw~Dth3av3Dl^AAlpO3mG!nLr#&ZZ7c_wUboI+deC+&%TFjK2Lm
z!Y&f1h|T_On%RCV&=4bx`!>(YezqGVhl&QpED?N6GV)HmzJ9&rh$x*i?*@o9#6QI<
z5ZI_MR<T&BR{~4JK$);*Lc}>X;0+p<?a4bIc*y(Xi3cp5d?^0LhPu<3u^J|nbF?~l
z5p;s4bEF-J@g5$=A7ZajUFdkSSl>Y8$`j)eF#TlUyG(eE%E7S!rj;mj^M5vhUicPm
zVWQ2z+imFyg}SRABmOBY_@osR!>7Ov!ioK`NB6_Rv}7Ud?35ed5Sb@?yND?kv~RCa
wqs^a3Sh>&&L4)!LKI?D2&k@))k(LESaga|C278ChSzn3NWVkcuNoY&{0f?~U_5c6?

literal 0
HcmV?d00001

diff --git a/public/opac/js/liste_notices_mur.js b/public/opac/js/liste_notices_mur.js
index af549f358df..da0f0913729 100644
--- a/public/opac/js/liste_notices_mur.js
+++ b/public/opac/js/liste_notices_mur.js
@@ -1,6 +1,5 @@
 var liste_resumes = {};
 
-
 function vignetteHover(vignettes) {
     vignettes.each(function() {
 	var notice = $(this);
@@ -47,6 +46,7 @@ function noticeMurTooltip(item) {
 	})});
 
     $(item).find('a[href*="panier/ajout-ajax"]').click(function(event){
+	disableDblclick(this);
 	event.preventDefault();
 	noticeMurPanier($(this));
     });
@@ -63,11 +63,26 @@ function noticeMurTooltip(item) {
 }
 
 function noticeMurPanier(anchor) {
-    $.getJSON(anchor.attr('href'), function(data){
+    addLoadingClass(anchor);
+    var json = $.getJSON(anchor.data('action'), function(data){
 	noticeMurPanierWithData(data, anchor);
     });
 }
 
+var loading = 'image-loading-status';
+
+function disableDblclick(anchor) {
+
+}
+
+function addLoadingClass(anchor) {
+    $(anchor).parent().first().addClass(loading);
+}
+
+function removeLoadingClass(anchor) {
+    $(anchor).parent().first().removeClass(loading);
+}
+
 
 function noticeMurAvis(url,titleDialog) {
     opacShowModal(url, 500, 400,function(){},'',titleDialog);
@@ -78,9 +93,11 @@ function noticeMurAvis(url,titleDialog) {
 function noticeMurPanierWithData(data, anchor){
     if ('AUTH' == data['result']) {
 	opacShowModal(data['redirect'], 500, 345, function(event, ui){
+	    removeLoadingClass(anchor);
 	    opacHideModal();
 	    if (undefined == event.currentTarget)
 		noticeMurPanier(anchor);
+		
 	})
     }
     
@@ -91,7 +108,8 @@ function noticeMurPanierWithData(data, anchor){
 	    width:500,
 	    modal:true,
 	    title: titre,
-	    dialogClass: 'ajout-panier'
+	    dialogClass: 'ajout-panier',
+	    close: removeLoadingClass(anchor)
 	});
 
 	dialogContent.find('a[href="#"]').click(function(event){
diff --git a/public/opac/js/recherche.js b/public/opac/js/recherche.js
index b17319b163b..78150bd698c 100644
--- a/public/opac/js/recherche.js
+++ b/public/opac/js/recherche.js
@@ -373,9 +373,10 @@ function reservationPickupAjax(oImg,nIdBib,sIdOrigine,sCodeAnnexe)
 		var sCodeAnnexe = $(form).find('input:radio[name="code_annexe"]:checked').val();
 		reservationAjax(oImg, nIdBib, sIdOrigine, sCodeAnnexe);
 	};
-
+    
+    var img = $(oImg).attr('src');
 	$(oImg).attr('src',imagesUrl+'patience.gif');
-	showPopWin(sUrl, 500, 345, null);
+	showPopWin(sUrl, 500, 345, function(){$(oImg).attr('src',img);});
 }
 
 
diff --git a/tests/library/ZendAfi/View/Helper/Notice/MurTest.php b/tests/library/ZendAfi/View/Helper/Notice/MurTest.php
index be99eb83f29..7b3dffd076e 100644
--- a/tests/library/ZendAfi/View/Helper/Notice/MurTest.php
+++ b/tests/library/ZendAfi/View/Helper/Notice/MurTest.php
@@ -161,7 +161,7 @@ class ZendAfi_View_Helper_Notice_Mur_BarreDeLienTest extends ZendAfi_View_Helper
 
 	/** @test */
 	public function barreDeLienShouldContainUrlAjoutPanier() {
-		$this->assertXPath($this->_html, '//a[contains(@href, "panier/ajout-ajax/id_notice/34")]', $this->_html);
+		$this->assertXPath($this->_html, '//a[contains(@data-action, "panier/ajout-ajax/id_notice/34")]', $this->_html);
 	}
 
 	/** @test */
-- 
GitLab