From e560b9277935811ed7ffcaa148efe0d746ebf94d Mon Sep 17 00:00:00 2001
From: srosse <none@none>
Date: Thu, 4 Jul 2013 16:06:59 +0200
Subject: [PATCH] OO-619: automatic height need "non standard" + "javascript"

---
 ...eliveryOptionsConfigurationController.java | 15 ++++++------
 .../iframe/_i18n/LocalStrings_de.properties   |  1 +
 .../iframe/_i18n/LocalStrings_en.properties   |  1 +
 src/main/webapp/static/js/openolat/iframe.js  | 23 -------------------
 4 files changed, 10 insertions(+), 30 deletions(-)

diff --git a/src/main/java/org/olat/core/gui/control/generic/iframe/DeliveryOptionsConfigurationController.java b/src/main/java/org/olat/core/gui/control/generic/iframe/DeliveryOptionsConfigurationController.java
index b614864b5f3..aaf515103b8 100644
--- a/src/main/java/org/olat/core/gui/control/generic/iframe/DeliveryOptionsConfigurationController.java
+++ b/src/main/java/org/olat/core/gui/control/generic/iframe/DeliveryOptionsConfigurationController.java
@@ -242,7 +242,6 @@ public class DeliveryOptionsConfigurationController extends FormBasicController
 			//disabled all
 			jsOptionEl.setEnabled(false);
 			cssOptionEl.setEnabled(false);
-			heightEl.setEnabled(false);
 			glossarEl.setEnabled(false);
 			//set inherited values
 		} else {
@@ -250,7 +249,6 @@ public class DeliveryOptionsConfigurationController extends FormBasicController
 			boolean jQueryEnabled = jsOptionEl.isSelected(1);
 			jsOptionEl.setEnabled(!standard);
 			cssOptionEl.setEnabled(!standard);
-			heightEl.setEnabled(!standard);
 			glossarEl.setEnabled(!standard && jQueryEnabled);
 		}
 	}
@@ -312,8 +310,6 @@ public class DeliveryOptionsConfigurationController extends FormBasicController
 	protected void doDispose() {
 		//
 	}
-	
-	
 
 	@Override
 	protected boolean validateFormLogic(UserRequest ureq) {
@@ -327,6 +323,12 @@ public class DeliveryOptionsConfigurationController extends FormBasicController
 					glossarEl.setErrorKey("glossary.need.jQuery", null);
 				}	
 			}
+			
+			heightEl.clearError();
+			if(standardModeEl.isSelected(0) || jsOptionEl.isSelected(0)) {
+				heightEl.setErrorKey("automatic.need.js", null);
+				allOk = false;
+			}
 		}
 		
 		return allOk & super.validateFormLogic(ureq);
@@ -377,7 +379,7 @@ public class DeliveryOptionsConfigurationController extends FormBasicController
 			options.setjQueryEnabled(Boolean.FALSE);
 			options.setPrototypeEnabled(Boolean.FALSE);
 			options.setGlossaryEnabled(Boolean.FALSE);
-			options.setHeight(null);
+			options.setHeight(heightEl.getSelectedKey());
 			options.setOpenolatCss(Boolean.FALSE);
 		} else {
 			options.setStandardMode(Boolean.FALSE);
@@ -386,14 +388,13 @@ public class DeliveryOptionsConfigurationController extends FormBasicController
 				options.setjQueryEnabled(Boolean.FALSE);
 				options.setPrototypeEnabled(Boolean.FALSE);
 				options.setGlossaryEnabled(Boolean.FALSE);
-				options.setHeight(null);
 			} else {
 				options.setjQueryEnabled(jsOptionEl.isSelected(1));
 				options.setPrototypeEnabled(jsOptionEl.isSelected(2));
 				options.setGlossaryEnabled(glossarEl.isAtLeastSelected(1));
-				options.setHeight(heightEl.getSelectedKey());
 			}
 			//css
+			options.setHeight(heightEl.getSelectedKey());
 			options.setOpenolatCss(cssOptionEl.isSelected(1));
 		}
 		persistEncoding(config);
diff --git a/src/main/java/org/olat/core/gui/control/generic/iframe/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/core/gui/control/generic/iframe/_i18n/LocalStrings_de.properties
index cc09cca4488..ee28d32b199 100644
--- a/src/main/java/org/olat/core/gui/control/generic/iframe/_i18n/LocalStrings_de.properties
+++ b/src/main/java/org/olat/core/gui/control/generic/iframe/_i18n/LocalStrings_de.properties
@@ -24,6 +24,7 @@ inherit.label=Standardwerte 
 inherit=Aus Lernressourcenverwaltung übernehmen
 custom=Anpassen
 glossary.need.jQuery=Glossar braucht jQuery
+automatic.need.js=Automatic braucht javascript
 
 chelp.display-options.title=Optionen für die Anzeige
 chelp.inherit=Werden Lernressourcen aus der Lernressourcenverwaltung in Kursen eingebunden, so können die Einstellungen für die Darstellung aus der Lernressourcenverwaltung übernommen werden (Option "$\:inherit"). Möchten Sie für diesen Kurs die Standardwerte überschreiben, so wählen Sie die Option "$\:custom". 
diff --git a/src/main/java/org/olat/core/gui/control/generic/iframe/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/core/gui/control/generic/iframe/_i18n/LocalStrings_en.properties
index c3254d95ac9..f7fc02748a7 100644
--- a/src/main/java/org/olat/core/gui/control/generic/iframe/_i18n/LocalStrings_en.properties
+++ b/src/main/java/org/olat/core/gui/control/generic/iframe/_i18n/LocalStrings_en.properties
@@ -17,6 +17,7 @@ encoding.content=Content character set
 encoding.js=Javascript character set
 encoding.same=Same as content
 glossary.need.jQuery=Glossary needs jQuery
+automatic.need.js=Automatic needs javascript
 height.auto=Automatic
 height.label=Display height
 iframe.content=Page content within iframe
diff --git a/src/main/webapp/static/js/openolat/iframe.js b/src/main/webapp/static/js/openolat/iframe.js
index 1ef1434a506..e19dcb3314e 100644
--- a/src/main/webapp/static/js/openolat/iframe.js
+++ b/src/main/webapp/static/js/openolat/iframe.js
@@ -133,29 +133,6 @@ function b_glossaryHighlight(){
 		o_tm_doHighlightAll(window.document, b_getGlossaryArray(), "");
 	}
 }
- 
-function b_hideExtMessageBox(){
-// temporary hack to remove back-message in iframe
-	var mainwindow = b_getMainWindow(window.parent);
-	var counter = 0;
-	if (mainwindow != null && mainwindow != 'undefined' && mainwindow["Ext"]) {
-		var activ = setInterval(function(){
-			try {
-				if (!mainwindow.tinyMCE && mainwindow.Ext.MessageBox.isVisible()){
-					mainwindow.Ext.MessageBox.hide();
-					clearInterval(activ);
-				} else if (counter == 10) {
-				//stop interval after some tries
-					clearInterval(activ);
-				}
-				counter++;
-			} catch (e) {
-				//console.log(e);			
-				clearInterval(activ);
-			}
-		} ,50);
-	};
-};
 
 function b_sendNewUriEventToParent() {
 //console.log("b_sendNewUriEventToParent window.name=" + window.name + " b_iframeid=" + b_iframeid + " window.location=" + window.location);
-- 
GitLab