Просмотр исходного кода

Ticket #923 - Examples of usage for dolPopupConfirm and dolPopupPrompt.

AntonLV 9 лет назад
Родитель
Сommit
5c3e7c2c41
2 измененных файлов с 46 добавлено и 34 удалено
  1. 30 26
      inc/js/classes/BxDolCmts.js
  2. 16 8
      studio/classes/BxDolStudioToolsAudit.php

+ 30 - 26
inc/js/classes/BxDolCmts.js

@@ -185,39 +185,43 @@ BxDolCmts.prototype.cmtEdit = function(oLink, iCmtId) {
 };
 
 BxDolCmts.prototype.cmtRemove = function(e, iCmtId) {
-    if (!this._confirm()) 
-    	return;
+	var $this = this;
 
-    var $this = this;
-    var oParams = this._getDefaultActions();
-    oParams['action'] = 'Remove';
-    oParams['Cmt'] = iCmtId;
+	$(e).parents('.bx-popup-active:first').dolPopupHide();
 
-    this._loadingInContent(e, true);
+	$(document).dolPopupConfirm({
+		onClickYes: function() {
+			var oParams = $this._getDefaultActions();
+		    oParams['action'] = 'Remove';
+		    oParams['Cmt'] = iCmtId;
 
-    jQuery.post (
-        this._sActionsUrl,
-        oParams,
-        function(oData) {
-            $this._loadingInContent(e, false);
+		    $this._loadingInContent(e, true);
 
-            if(oData && oData.msg != undefined)
-                alert(oData.msg);
+		    jQuery.post (
+		        $this._sActionsUrl,
+		        oParams,
+		        function(oData) {
+		            $this._loadingInContent(e, false);
 
-            if(oData && oData.id != undefined) {
-            	$(e).parents('.bx-popup-applied:first:visible').dolPopupHide();
+		            if(oData && oData.msg != undefined)
+		                alert(oData.msg);
 
-            	$('#cmt' + oData.id).bx_anim('hide', $this._sAnimationEffect, $this._iAnimationSpeed, function() {
-                	var oCounter = $(this).parent('ul.cmts').siblings('.cmt-cont').find('.cmt-actions a.cmt-comment-replies span');
-                	if(oCounter)
-                		oCounter.html(oCounter.html() - 1);
+		            if(oData && oData.id != undefined) {
+		            	$(e).parents('.bx-popup-applied:first:visible').dolPopupHide();
 
-                	$(this).remove();
-                });
-            }
-        },
-        'json'
-    );
+		            	$('#cmt' + oData.id).bx_anim('hide', $this._sAnimationEffect, $this._iAnimationSpeed, function() {
+		                	var oCounter = $(this).parent('ul.cmts').siblings('.cmt-cont').find('.cmt-actions a.cmt-comment-replies span');
+		                	if(oCounter)
+		                		oCounter.html(oCounter.html() - 1);
+
+		                	$(this).remove();
+		                });
+		            }
+		        },
+		        'json'
+		    );
+		}
+	});
 };
 
 BxDolCmts.prototype.cmtLoad = function(oLink, iCmtParentId, iStart, iPerView)

+ 16 - 8
studio/classes/BxDolStudioToolsAudit.php

@@ -175,14 +175,22 @@ class BxDolStudioToolsAudit extends BxDol
         <script language="javascript">
             function bx_sys_adm_audit_test_email()
             {
-                var sEmail = prompt('<?php echo _t('_Email'); ?>', '<?php echo class_exists('BxDolDb') && BxDolDb::getInstance() ? BxDolDb::getInstance()->getParam('site_email') : ''; ?>');
-                if (null == sEmail || ('string' == (typeof sEmail) && !sEmail.length))
-                    return;
-
-                $('#bx-sys-adm-audit-test-email').html('Sending...');
-                $.post('<?php echo bx_append_url_params($sUrlSelf, array('action' => 'audit_send_test_email')); ?>&email=' + sEmail, function(data) {
-                    $('#bx-sys-adm-audit-test-email').html(data);
-                });
+            	$(document).dolPopupPrompt({
+            		message: '<?php echo _t('_Email'); ?>',
+            		value: '<?php echo class_exists('BxDolDb') && BxDolDb::getInstance() ? BxDolDb::getInstance()->getParam('site_email') : ''; ?>',
+            		onClickOk: function(oPopup) {
+            			var sEmail = oPopup.getValue();
+                        if (null == sEmail || ('string' == (typeof sEmail) && !sEmail.length))
+                            return;
+
+                        $('#bx-sys-adm-audit-test-email').html('Sending...');
+                        $.post('<?php echo bx_append_url_params($sUrlSelf, array('action' => 'audit_send_test_email')); ?>&email=' + sEmail, function(data) {
+                            $('#bx-sys-adm-audit-test-email').html(data);
+                        });
+					}
+            	});
+
+            	return false;
             }
 
             function bx_sys_adm_audit_phpinfo()