[vlma-devel] commit: Automatic update of the mediaProgramAdd view. (Adrien Grand )

git version control git at videolan.org
Sun Oct 26 02:01:00 CEST 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sun Oct 26 01:44:13 2008 +0200| [3543ede855b8dbcc4a07b0f9541bc99387e7603c] | committer: Adrien Grand 

Automatic update of the mediaProgramAdd view.

Automatically update the mediaProgramAdd page when the form is updated in
order to take into account compatibility issues between output methods and
muxers.

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

 .../WEB-INF/jsp/media/mediaprogramadd_right.jsp    |   55 ++++++++++++++++++-
 1 files changed, 52 insertions(+), 3 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 39c76ea..2000465 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
@@ -30,7 +30,7 @@
     <tr>
         <td align="right"><fmt:message key="medias.program.add.protocol" /></td>
         <spring:bind path="mediaProgramAdd.protocol">
-            <td><select name="protocol">
+            <td><select name="protocol" id="protocol" onchange="onProtocolUpdate();">
                 <c:forEach items="${mediaProgramAdd.protocols}" var="protocolOption">
                     <option name="${protocolOption}" <c:if test="${mediaProgramAdd.protocol == protocolOption}">selected="true"</c:if>>
                         <c:out value="${protocolOption}" />
@@ -43,7 +43,7 @@
     <tr>
         <td align="right"><fmt:message key="medias.program.add.mux" /></td>
         <spring:bind path="mediaProgramAdd.mux">
-            <td><select name="mux">
+            <td><select id="mux" name="mux" onchange="onMuxUpdate();">
                 <c:forEach items="${mediaProgramAdd.muxs}" var="muxOption">
                     <option name="${muxOption}" <c:if test="${mediaProgramAdd.mux == muxOption}">selected="true"</c:if>>
                         <c:out value="${muxOption}" />
@@ -58,7 +58,7 @@
         <td><c:forEach items="${mediaProgramAdd.announcementCheckboxes}" var="announcementOption" varStatus="loopStatus">
             <spring:bind path="mediaProgramAdd.announcementCheckboxes[${loopStatus.index}].checked">
                 <input type="hidden" name="_<c:out value="${status.expression}"/>" />
-                <input type="checkbox" name="<c:out value="${status.expression}"/>" <c:if test="${announcementOption.checked}">checked="checked"</c:if> />
+                <input id="announcements_<c:out value="${announcementOption.announcement}"/>" type="checkbox" name="<c:out value="${status.expression}"/>" <c:if test="${announcementOption.checked}">checked="checked"</c:if> />
                 <c:out value="${announcementOption.announcement}" />
                 ${status.errorCode}
                 <br />
@@ -71,3 +71,52 @@
 </spring:hasBindErrors> <br />
 <input type="submit" value="<fmt:message key="medias.program.add.run" />">
 </form>
+
+<script type="text/javascript">
+
+/**
+ * See http://www.videolan.org/streaming-features.html and 
+ * http://wiki.videolan.org/Documentation:Streaming_HowTo/Advanced_Streaming_Using_the_Command_Line#sap
+ */
+
+function isCompatible(protocol, mux) {
+    if(protocol == "UDP_MULTICAST") {
+        return mux == "TS";
+    }
+    if(protocol == "VOD") {
+        return mux == "TS" || mux == "PS";
+    }
+    return true;
+}
+
+function onProtocolUpdate() {
+    var select = document.getElementById("protocol");
+    var protocol = select.options[select.selectedIndex].value;
+    if(protocol == "UDP_MULTICAST") {
+        document.getElementById("announcements_SAP").disabled = false;
+    } else {
+        var input = document.getElementById("announcements_SAP");
+        input.checked = false;
+        input.disabled = true;
+    }
+    var options = document.getElementById("mux").options;
+    for(var i=0; i < options.length; i++) {
+        var mux = options[i].value;
+        options[i].disabled = !isCompatible(protocol, mux);
+    }
+}
+
+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 = !isCompatible(protocol, mux);
+    }
+}
+
+onProtocolUpdate();
+onMuxUpdate();
+
+</script>
\ No newline at end of file



More information about the vlma-devel mailing list