[vlma-devel] commit: Cleanup of the removal of a program. (Adrien Grand )
git version control
git at videolan.org
Thu Jan 1 20:30:28 CET 2009
vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Thu Jan 1 18:07:06 2009 +0100| [2f7e0c5ca9ea447f15908a29fc4d5e59c46947e0] | committer: Adrien Grand
Cleanup of the removal of a program.
> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=2f7e0c5ca9ea447f15908a29fc4d5e59c46947e0
---
.../web/controller/media/MediaProgramRemove.java | 10 +++++-----
.../media/MediaProgramRemoveController.java | 16 ++++++++++++----
.../WEB-INF/jsp/dtt/dttchannellist_right.jsp | 2 +-
.../WEB-INF/jsp/file/filechannellist_right.jsp | 2 +-
.../WEB-INF/jsp/satellite/satchannellist_right.jsp | 2 +-
.../WEB-INF/jsp/stream/streamchannellist_right.jsp | 2 +-
6 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/controller/media/MediaProgramRemove.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/controller/media/MediaProgramRemove.java
index 9de9e29..226cb6f 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/controller/media/MediaProgramRemove.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/controller/media/MediaProgramRemove.java
@@ -23,7 +23,7 @@ package org.videolan.vlma.web.controller.media;
public class MediaProgramRemove {
private int mediaId;
- private int programIndex;
+ private String programId;
public int getMediaId() {
return mediaId;
@@ -33,12 +33,12 @@ public class MediaProgramRemove {
this.mediaId = mediaId;
}
- public int getProgramIndex() {
- return programIndex;
+ public String getProgramId() {
+ return programId;
}
- public void setProgramIndex(int programIndex) {
- this.programIndex = programIndex;
+ public void setProgramId(String programId) {
+ this.programId = programId;
}
}
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/controller/media/MediaProgramRemoveController.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/controller/media/MediaProgramRemoveController.java
index 3b9227e..4a62242 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/controller/media/MediaProgramRemoveController.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/controller/media/MediaProgramRemoveController.java
@@ -21,6 +21,7 @@
package org.videolan.vlma.web.controller.media;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
import javax.servlet.ServletException;
@@ -34,6 +35,7 @@ import org.springframework.web.servlet.view.RedirectView;
import org.videolan.vlma.Data;
import org.videolan.vlma.model.FilesChannel;
import org.videolan.vlma.model.Media;
+import org.videolan.vlma.model.Program;
import org.videolan.vlma.model.SatChannel;
import org.videolan.vlma.model.StreamChannel;
@@ -93,9 +95,15 @@ public class MediaProgramRemoveController extends SimpleFormController {
public ModelAndView onSubmit(Object command) throws Exception {
MediaProgramRemove mediaProgramRemove = (MediaProgramRemove) command;
int mediaId = mediaProgramRemove.getMediaId();
- int programIndex = mediaProgramRemove.getProgramIndex();
+ String programId = mediaProgramRemove.getProgramId();
Media media = data.getMedia(mediaId);
- media.getPrograms().remove(programIndex);
+ Iterator<Program> it = media.getPrograms().iterator();
+ while (it.hasNext()) {
+ Program program = it.next();
+ if (programId.equals(program.getId())) {
+ it.remove();
+ }
+ }
data.update(media);
// Determine the success view with the media class
@@ -120,9 +128,9 @@ public class MediaProgramRemoveController extends SimpleFormController {
throws ServletException {
MediaProgramRemove mediasProgramRemove = new MediaProgramRemove();
int media = Integer.parseInt(request.getParameter("media"));
- int program = Integer.parseInt(request.getParameter("program"));
+ String program = request.getParameter("program");
mediasProgramRemove.setMediaId(media);
- mediasProgramRemove.setProgramIndex(program);
+ mediasProgramRemove.setProgramId(program);
return mediasProgramRemove;
}
diff --git a/vlma-webapp/src/main/webapp/WEB-INF/jsp/dtt/dttchannellist_right.jsp b/vlma-webapp/src/main/webapp/WEB-INF/jsp/dtt/dttchannellist_right.jsp
index 2101c9e..a00ce1d 100644
--- a/vlma-webapp/src/main/webapp/WEB-INF/jsp/dtt/dttchannellist_right.jsp
+++ b/vlma-webapp/src/main/webapp/WEB-INF/jsp/dtt/dttchannellist_right.jsp
@@ -63,7 +63,7 @@
<td class="program"><vlma:program program="${program}" /></td>
<c:url value="mediaprogramremove.htm" var="programRemoveUrl">
<c:param name="media" value="${dttChannel.id}" />
- <c:param name="program" value="${status.index}" />
+ <c:param name="program" value="${program.id}" />
</c:url>
<td><a href="${programRemoveUrl}"><img src="<c:url value="/img/stop.png" />" title="<fmt:message key="medias.list.action.stop" />" /></a></td>
</tr>
diff --git a/vlma-webapp/src/main/webapp/WEB-INF/jsp/file/filechannellist_right.jsp b/vlma-webapp/src/main/webapp/WEB-INF/jsp/file/filechannellist_right.jsp
index 450c3d2..d6f0e00 100644
--- a/vlma-webapp/src/main/webapp/WEB-INF/jsp/file/filechannellist_right.jsp
+++ b/vlma-webapp/src/main/webapp/WEB-INF/jsp/file/filechannellist_right.jsp
@@ -59,7 +59,7 @@
<td class="program"><vlma:program program="${program}" /></td>
<c:url value="mediaprogramremove.htm" var="programRemoveUrl">
<c:param name="media" value="${filesChannel.id}" />
- <c:param name="program" value="${status.index}" />
+ <c:param name="program" value="${program.id}" />
</c:url>
<td><a href="${programRemoveUrl}"><img src="<c:url value="/img/stop.png" />" title="<fmt:message key="medias.list.action.stop" />" /></a></td>
</tr>
diff --git a/vlma-webapp/src/main/webapp/WEB-INF/jsp/satellite/satchannellist_right.jsp b/vlma-webapp/src/main/webapp/WEB-INF/jsp/satellite/satchannellist_right.jsp
index 0f6b963..5637fa3 100644
--- a/vlma-webapp/src/main/webapp/WEB-INF/jsp/satellite/satchannellist_right.jsp
+++ b/vlma-webapp/src/main/webapp/WEB-INF/jsp/satellite/satchannellist_right.jsp
@@ -73,7 +73,7 @@
<td class="program"><vlma:program program="${program}" /></td>
<c:url value="mediaprogramremove.htm" var="programRemoveUrl">
<c:param name="media" value="${satChannel.id}" />
- <c:param name="program" value="${status.index}" />
+ <c:param name="program" value="${program.id}" />
</c:url>
<td><a href="${programRemoveUrl}"><img src="<c:url value="/img/stop.png" />" title="<fmt:message key="medias.list.action.stop" />" /></a></td>
</tr>
diff --git a/vlma-webapp/src/main/webapp/WEB-INF/jsp/stream/streamchannellist_right.jsp b/vlma-webapp/src/main/webapp/WEB-INF/jsp/stream/streamchannellist_right.jsp
index 4718b76..f445601 100755
--- a/vlma-webapp/src/main/webapp/WEB-INF/jsp/stream/streamchannellist_right.jsp
+++ b/vlma-webapp/src/main/webapp/WEB-INF/jsp/stream/streamchannellist_right.jsp
@@ -51,7 +51,7 @@
<td class="program"><vlma:program program="${program}" /></td>
<c:url value="mediaprogramremove.htm" var="programRemoveUrl">
<c:param name="media" value="${streamChannel.id}" />
- <c:param name="program" value="${status.index}" />
+ <c:param name="program" value="${program.id}" />
</c:url>
<td><a href="${programRemoveUrl}"><img src="<c:url value="/img/stop.png" />" title="<fmt:message key="medias.list.action.stop" />" /></a></td>
</tr>
More information about the vlma-devel
mailing list