[vlma-devel] commit: Fix the update of <select/> inputs when adding a program. ( Adrien Grand )

git version control git at videolan.org
Fri Jan 2 01:38:24 CET 2009


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Fri Jan  2 00:34:32 2009 +0100| [ff44d87899c9e6ec4da34bc111df6738e67deaa8] | committer: Adrien Grand 

Fix the update of <select/> inputs when adding a program.

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=ff44d87899c9e6ec4da34bc111df6738e67deaa8
---

 .../WEB-INF/jsp/media/mediaprogramadd_right.jsp    |   31 ++++++++++++-------
 1 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/vlma-webapp/src/main/webapp/WEB-INF/jsp/media/mediaprogramadd_right.jsp b/vlma-webapp/src/main/webapp/WEB-INF/jsp/media/mediaprogramadd_right.jsp
index 262f69f..85a3991 100644
--- a/vlma-webapp/src/main/webapp/WEB-INF/jsp/media/mediaprogramadd_right.jsp
+++ b/vlma-webapp/src/main/webapp/WEB-INF/jsp/media/mediaprogramadd_right.jsp
@@ -142,7 +142,7 @@ function isCompatible2(protocol, mux) {
     return true;
 }
 
-function onTypeUpdate() {
+function updateProtocol() {
     var select = document.getElementById("type");
     var type = select.options[select.selectedIndex].value;
     var protocolSelect = document.getElementById("protocol");
@@ -157,10 +157,9 @@ function onTypeUpdate() {
             currentOptionCompatible = true;
         }
     }
-    onProtocolUpdate();
 }
 
-function onProtocolUpdate() {
+function updateMux() {
     var select = document.getElementById("protocol");
     var protocol = select.options[select.selectedIndex].value;
     if(protocol == "UDP_MULTICAST") {
@@ -188,17 +187,25 @@ function onProtocolUpdate() {
     }
 }
 
+/**
+ * Modification chain:
+ *   Type -> Protocol -> Mux
+ */
+
+function onTypeUpdate() {
+    updateProtocol();
+    onProtocolUpdate();
+}
+
+function onProtocolUpdate() {
+     updateMux();
+     onMuxUpdate();
+}
+
 function onMuxUpdate() {
-    var select = document.getElementById("mux");
-    var mux = select.options[select.selectedIndex].value;
-    var options = document.getElementById("protocol").options;
-    for(var i=0; i < options.length; i++) {
-        var protocol = options[i].value;
-        options[i].disabled = !isCompatible2(protocol, mux);
-    }
+    // Nothing to to.
 }
 
-onProtocolUpdate();
-onMuxUpdate();
+onTypeUpdate();
 
 </script>
\ No newline at end of file



More information about the vlma-devel mailing list