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

Ticket #923 - alert to bx_alert in Studio.

AntonLV 9 лет назад
Родитель
Сommit
dbb3ee2379

+ 4 - 0
inc/js/functions.js

@@ -43,6 +43,10 @@ function processJsonData(oData) {
 		bx_alert(oData.message, function() {
 			fContinue(oData);
 		});
+	else if(oData && oData.msg != undefined && oData.msg.length != 0)
+		bx_alert(oData.msg, function() {
+			fContinue(oData);
+		});
 	else
 		fContinue(oData);
 };

+ 1 - 1
studio/js/builder_page.js

@@ -109,7 +109,7 @@ BxDolStudioBuilderPage.prototype.reorder = function(oDraggable) {
 		},
 		function(oData) {
 			if(oData.code != 0) {
-				alert(oData.message);
+				bx_alert(oData.message);
 				return;
 			}
 		},

+ 1 - 1
studio/js/design.js

@@ -55,7 +55,7 @@ BxDolStudioDesign.prototype.activate = function(sTemplateName, oChecbox) {
 		},
 		function(oData) {
 			if(oData.code != 0) {
-				alert(oData.message);
+				bx_alert(oData.message);
 
 				$(oChecbox).attr('checked', 'checked').trigger('enable');
 				return;

+ 3 - 3
studio/js/designer.js

@@ -44,7 +44,7 @@ BxDolStudioDesigner.prototype.makeDefault = function(sUri) {
 		},
 		function(oData) {
 			if(oData.code != 0 && oData.message.length > 0) {
-				alert(oData.message);
+				bx_alert(oData.message);
 				return;
 			}
 
@@ -66,7 +66,7 @@ BxDolStudioDesigner.prototype.deleteLogo = function() {
 		},
 		function(oData) {
 			if(oData.code != 0 && oData.message.length > 0) {
-				alert(oData.message);
+				bx_alert(oData.message);
 				return;
 			}
 
@@ -89,7 +89,7 @@ BxDolStudioDesigner.prototype.deleteCover = function(sType, iId) {
 		},
 		function(oData) {
 			if(oData.code != 0 && oData.message.length > 0) {
-				alert(oData.message);
+				bx_alert(oData.message);
 				return;
 			}
 

+ 1 - 1
studio/js/forms.js

@@ -22,7 +22,7 @@ function fviuDelete(sName, oLink) {
 		},
 		function(oData) {
 			if(oData.code != 0 && oData.message.length > 0) {
-				alert(oData.message);
+				bx_alert(oData.message);
 				return;
 			}
 

+ 1 - 1
studio/js/forms_displays.js

@@ -37,7 +37,7 @@ BxDolStudioFormsDisplays.prototype.onChangeModule = function() {
 			bx_loading($('body'), false);
 
 			if(oData.code != 0) {
-				alert(oData.message);
+				bx_alert(oData.message);
 				return;
 			}
 

+ 1 - 1
studio/js/forms_fields.js

@@ -37,7 +37,7 @@ BxDolStudioFormsFields.prototype.onChangeModule = function() {
 			bx_loading($('body'), false);
 
 			if(oData.code != 0) {
-				alert(oData.message);
+				bx_alert(oData.message);
 				return;
 			}
 

+ 1 - 1
studio/js/forms_search_fields.js

@@ -37,7 +37,7 @@ BxDolStudioFormsSearchFields.prototype.onChangeModule = function() {
 			bx_loading($('body'), false);
 
 			if(oData.code != 0) {
-				alert(oData.message);
+				bx_alert(oData.message);
 				return;
 			}
 

+ 1 - 1
studio/js/forms_values.js

@@ -37,7 +37,7 @@ BxDolStudioFormsPreValues.prototype.onChangeModule = function() {
 			bx_loading($('body'), false);
 
 			if(oData.code != 0) {
-				alert(oData.message);
+				bx_alert(oData.message);
 				return;
 			}
 

+ 1 - 1
studio/js/language.js

@@ -24,7 +24,7 @@ BxDolStudioLanguage.prototype.activate = function(sLanguageName, oChecbox) {
 		},
 		function(oData) {
 			if(oData.code != 0) {
-				alert(oData.message);
+				bx_alert(oData.message);
 
 				$(oChecbox).attr('checked', 'checked').trigger('enable');
 				return;

+ 1 - 1
studio/js/launcher.js

@@ -105,7 +105,7 @@ BxDolStudioLauncher.prototype.reorder = function(oDraggable) {
 		},
 		function(oData) {
 			if(oData.code != 0) {
-				alert(oData.message);
+				bx_alert(oData.message);
 				return;
 			}
 		},

+ 1 - 1
studio/js/navigation_items.js

@@ -50,7 +50,7 @@ BxDolStudioNavigationItems.prototype.onChangeModule = function() {
 			bx_loading($('body'), false);
 
 			if(oData.code != 0) {
-				alert(oData.message);
+				bx_alert(oData.message);
 				return;
 			}
 

+ 2 - 38
studio/js/page.js

@@ -22,32 +22,7 @@ function BxDolStudioPage(oOptions) {
 BxDolStudioPage.prototype.processJson = function (oData) {
 	bx_loading('bx-std-page-columns', false);
 
-    //--- Show Message
-    if(oData && oData.msg != undefined)
-        alert(oData.msg);
-    if(oData && oData.message != undefined)
-        alert(oData.message);
-
-    //--- Show Popup
-    if(oData && oData.popup != undefined) {
-    	if (typeof(oData.popup) == 'object') {
-    		var oPopup = $(oData.popup.html).hide(); 
-    		var oPopupOptions = $.extend({}, this.oPopupOptions, oData.popup.options);
-
-	    	$('#' + oPopup.attr('id')).remove();
-	        oPopup.prependTo('body').dolPopup(oPopupOptions);
-    	}
-    	else {
-	    	var oPopup = $(oData.popup).hide(); 
-	
-	    	$('#' + oPopup.attr('id')).remove();
-	        oPopup.prependTo('body').dolPopup(this.oPopupOptions);
-    	}
-    }
-
-    //--- Evaluate JS code
-    if (oData && oData.eval != undefined)
-        eval(oData.eval);
+	processJsonData(oData);
 };
 
 BxDolStudioPage.prototype.togglePopup = function(sName, oLink) {
@@ -99,17 +74,6 @@ BxDolStudioPage.prototype.togglePopup = function(sName, oLink) {
 		$(sId).dolPopup(oPopupOptions);
 };
 
-BxDolStudioPage.prototype.showMessage = function(oData) {
-	if(oData.message)
-		alert(oData.message);
-
-	if(oData.on_result)
-		eval(oData.on_result);
-
-	if(oData.redirect)
-		window.location.href = oData.redirect;
-};
-
 BxDolStudioPage.prototype.bookmark = function(sPageName, oLink) {
 	var oDate = new Date();
 
@@ -122,7 +86,7 @@ BxDolStudioPage.prototype.bookmark = function(sPageName, oLink) {
 		},
 		function(oData) {
 			if(oData.code != 0) {
-				alert(oData.message);
+				bx_alert(oData.message);
 				return;
 			}
 

+ 1 - 4
studio/js/polyglot.js

@@ -44,9 +44,6 @@ BxDolStudioPolyglot.prototype.changePage = function(sType, iStart, iLength) {
 		_t:oDate.getTime()
 	};
 
-	if(this.bShowWarning && !confirm(aDolLang['_adm_pgt_wrn_need_to_save']))
-		return true;
-
 	if(sType == 'keys') {
 		oParams.pgt_category = $('#pgt-keys-category').val();
 		oParams.pgt_language = $('#pgt-keys-language').val();
@@ -62,7 +59,7 @@ BxDolStudioPolyglot.prototype.changePage = function(sType, iStart, iLength) {
 		oParams,
 		function(oData) {
 			if(oData.code != 0) {
-				alert(oData.message);
+				bx_alert(oData.message);
 				return true;
 			}
 

+ 1 - 1
studio/js/settings.js

@@ -153,7 +153,7 @@ BxDolStudioSettings.prototype.changePage = function(sType) {
 		},
 		function(oData) {
 			if(oData.code != 0) {
-				alert(oData.message);
+				bx_alert(oData.message);
 				return;
 			}
 

+ 2 - 2
studio/template/scripts/BxBaseStudioPage.php

@@ -318,9 +318,9 @@ class BxBaseStudioPage extends BxDolStudioPage
             $aResult['redirect'] = $sRedirect != '' ? $sRedirect : BX_DOL_URL_STUDIO;
 
         if(!empty($sOnResult))
-            $aResult['on_result'] = $sOnResult;
+            $aResult['eval'] = $sOnResult;
 
-        $sResult = "window.parent." . BX_DOL_STUDIO_PAGE_JS_OBJECT . ".showMessage(" . json_encode($aResult) . ");";
+        $sResult = "window.parent.processJsonData(" . json_encode($aResult) . ");";
 
         return BxDolStudioTemplate::getInstance()->_wrapInTagJsCode($sResult);
     }