Răsfoiți Sursa

#28 - Ajax popup update.

AntonLV 13 ani în urmă
părinte
comite
51e602ec39
3 a modificat fișierele cu 24 adăugiri și 13 ștergeri
  1. 3 1
      inc/classes/BxDolTemplate.php
  2. 17 12
      inc/js/jquery.dolPopup.js
  3. 4 0
      template/popup_loading.html

+ 3 - 1
inc/classes/BxDolTemplate.php

@@ -928,8 +928,10 @@ class BxDolTemplate extends BxDol implements iBxDolSingleton {
                 $sRet = BxTemplFunctions::getInstance()->getMetaIcons();
                 break;
             case 'popup_loading':
+            	$sContent = $this->parsePageByName('popup_loading.html', array());
+
                 bx_import('BxTemplFunctions');
-                $sRet = BxTemplFunctions::getInstance()->transBox('bx-popup-loading', '<div class="bx-def-padding bx-popup-content-wrapped"></div>', true);
+                $sRet = BxTemplFunctions::getInstance()->transBox('bx-popup-loading', $sContent, true);
                 break;
             case 'main_div_width':
                 if(!empty($this->aPage['width']))

+ 17 - 12
inc/js/jquery.dolPopup.js

@@ -251,8 +251,10 @@
                 if (!$.isWindow(e[0]))
                     bx_menu_on(e, true);
 
-                $('body').append('<div id="' + sPopupId + '" style="display:none;">' + $('#bx-popup-loading').html() + '</div>');
-                bx_loading_content($('#' + sPopupId + ' .bx-popup-content-wrapped'), true, true);
+                $('<div id="' + sPopupId + '" style="display:none;">' + $('#bx-popup-loading').html() + '</div>').appendTo('body').find(options.container).hide();
+
+                var oLoading = $('#' + sPopupId + ' .bx-popup-loading-wrapped');
+                bx_loading_content(oLoading, true, true);
 
                 $('#' + sPopupId).dolPopup($.extend({}, options, {
                     pointer: oPointerOptions,
@@ -262,18 +264,21 @@
                     }
                 }));
 
-                $('#' + sPopupId).find(options.container).load(sUrlRoot + options.url, function () {
-                    $(this).bxTime();
+                var fOnLoad = function() {
+                	bx_loading_content(oLoading, false);
 
-                    $('#' + sPopupId)._dolPopupSetPosition({
-                        pointer: oPointerOptions
-                    });
+                	$('#' + sPopupId + ' ' + options.container).bxTime().show();
 
-                    $('#' + sPopupId).find('img').load(function() {
-                    	$('#' + sPopupId)._dolPopupSetPosition({
-                            pointer: oPointerOptions
-                        });
-                    });
+					$('#' + sPopupId)._dolPopupSetPosition({
+						pointer: oPointerOptions
+					});
+                };
+                
+                $('#' + sPopupId).find(options.container).load(sUrlRoot + options.url, function () {
+                	if($('#' + sPopupId).find('img').length > 0)
+                		$('#' + sPopupId).find('img').load(fOnLoad);
+                	else
+                		fOnLoad();
                 });
             }
         });

+ 4 - 0
template/popup_loading.html

@@ -0,0 +1,4 @@
+<div class="bx-popup-content-indent bx-def-padding">
+	<div class="bx-popup-content-wrapped"></div>
+	<div class="bx-popup-loading-wrapped"></div>
+</div>