[vlma-devel] commit: Remember already used urls for satellite channels update. ( Adrien Grand )
git version control
git at videolan.org
Sun Jan 25 05:30:34 CET 2009
vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sun Jan 25 04:26:46 2009 +0100| [6dacb287730655c0521e1b92e8f28bc6bd6b45d1] | committer: Adrien Grand
Remember already used urls for satellite channels update.
> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=6dacb287730655c0521e1b92e8f28bc6bd6b45d1
---
.../media/satellite/SatChannelUpdate.java | 14 +++++++++++++-
.../satellite/SatChannelUpdateController.java | 19 +++++++++++++++++--
vlma-webapp/src/main/resources/messages.properties | 1 +
.../src/main/resources/messages_fr.properties | 1 +
.../jsp/satellite/satchannelupdate_right.jsp | 17 +++++++++++++++--
5 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/controller/media/satellite/SatChannelUpdate.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/controller/media/satellite/SatChannelUpdate.java
index e9559df..0df1a94 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/controller/media/satellite/SatChannelUpdate.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/controller/media/satellite/SatChannelUpdate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 the VideoLAN team
+ * Copyright (C) 2006-2009 the VideoLAN team
*
* This file is part of VLMa.
*
@@ -20,10 +20,14 @@
package org.videolan.vlma.web.controller.media.satellite;
+import java.util.List;
+
public class SatChannelUpdate {
private String url;
+ private List<String> urls;
+
public String getUrl() {
return url;
}
@@ -32,4 +36,12 @@ public class SatChannelUpdate {
this.url = url;
}
+ public List<String> getUrls() {
+ return urls;
+ }
+
+ public void setUrls(List<String> urls) {
+ this.urls = urls;
+ }
+
}
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/controller/media/satellite/SatChannelUpdateController.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/controller/media/satellite/SatChannelUpdateController.java
index b37d3b3..105c4a9 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/controller/media/satellite/SatChannelUpdateController.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/controller/media/satellite/SatChannelUpdateController.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2008 the VideoLAN team
+ * Copyright (C) 2006-2009 the VideoLAN team
*
* This file is part of VLMa.
*
@@ -23,6 +23,8 @@ package org.videolan.vlma.web.controller.media.satellite;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.rmi.RemoteException;
+import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -45,19 +47,32 @@ public class SatChannelUpdateController extends SimpleFormController {
this.data = data;
}
+ @SuppressWarnings("unchecked")
@Override
public ModelAndView onSubmit(Object command) throws ServletException,
MalformedURLException, IOException {
- URL url = new URL(((SatChannelUpdate) command).getUrl());
+ String urlAsString = ((SatChannelUpdate) command).getUrl();
+ URL url = new URL(urlAsString);
data.updateSatChannels(url);
+ List<String> urls = data.getList("vlma.satellite.update.url");
+ if (!urls.contains(urlAsString)) {
+ urls.add(urlAsString);
+ }
+ data.setProperty("vlma.satellite.update.url", urls);
return new ModelAndView(new RedirectView(getSuccessView()));
}
+ @SuppressWarnings("unchecked")
@Override
protected Object formBackingObject(HttpServletRequest request)
throws ServletException {
SatChannelUpdate mediasSatUpdate = new SatChannelUpdate();
mediasSatUpdate.setUrl("http://");
+ try {
+ mediasSatUpdate.setUrls(data.getList("vlma.satellite.update.url"));
+ } catch (RemoteException e) {
+ logger.error("Exception while retrieving the list of already downloaded urls");
+ }
return mediasSatUpdate;
}
diff --git a/vlma-webapp/src/main/resources/messages.properties b/vlma-webapp/src/main/resources/messages.properties
index 8a94b9c..5626e52 100644
--- a/vlma-webapp/src/main/resources/messages.properties
+++ b/vlma-webapp/src/main/resources/messages.properties
@@ -306,6 +306,7 @@ medias.sat.update.error.not-specified = Can't update with those parrameters.
medias.sat.update.error.invalidurl = The address is not valid.
medias.sat.update.error.fix = Please correct those mistakes to continue.
medias.sat.update.url = Source:
+medias.sat.update.urls = URLs already used for the update of satellite channels
medias.sat.updated = Satellite channel updated
medias.sat.updated.text = The satelitte channel has been updated.
medias.sat.updated.back = Go back
diff --git a/vlma-webapp/src/main/resources/messages_fr.properties b/vlma-webapp/src/main/resources/messages_fr.properties
index 82415b0..96cdd49 100644
--- a/vlma-webapp/src/main/resources/messages_fr.properties
+++ b/vlma-webapp/src/main/resources/messages_fr.properties
@@ -303,6 +303,7 @@ medias.sat.update.error.not-specified = Impossible de mettre à jour avec ces par
medias.sat.update.error.invalidurl = L'adresse est invalide.
medias.sat.update.error.fix = Veuillez corriger les erreurs pour continuer.
medias.sat.update.url = Source :
+medias.sat.update.urls = URLs déjà utilisées pour la mise à jour des chaînes satellite
medias.sat.updated = Chaînes satellites mises à jour
medias.sat.updated.text = Les chaînes satellite ont été mises à jour avec succès.
medias.sat.updated.back = Retour
diff --git a/vlma-webapp/src/main/webapp/WEB-INF/jsp/satellite/satchannelupdate_right.jsp b/vlma-webapp/src/main/webapp/WEB-INF/jsp/satellite/satchannelupdate_right.jsp
index e8a24e8..5df4dfb 100644
--- a/vlma-webapp/src/main/webapp/WEB-INF/jsp/satellite/satchannelupdate_right.jsp
+++ b/vlma-webapp/src/main/webapp/WEB-INF/jsp/satellite/satchannelupdate_right.jsp
@@ -1,4 +1,3 @@
-
<%@ include file="/WEB-INF/jsp/include.jsp"%>
<h1><fmt:message key="medias.sat.updating" /></h1>
@@ -8,7 +7,7 @@
<tr>
<td align="right"><fmt:message key="medias.sat.update.url" /></td>
<spring:bind path="satChannelUpdate.url">
- <td><input type="text" name="url"
+ <td><input id="satChannelUpdateUrl" type="text" name="url"
value="<c:out value="${status.value}"/>"></td>
<td><span class="error"><c:out
value="${status.errorMessage}" /></span></td>
@@ -21,6 +20,20 @@
</spring:hasBindErrors> <br />
<input type="submit" value="<fmt:message key="medias.sat.update.run" />"></form>
+<c:if test="${not empty satChannelUpdate.urls}">
+<h2><fmt:message key="medias.sat.update.urls" /></h2>
+
+<c:forEach items="${satChannelUpdate.urls}" var="url">
+ <li><a href="#" onclick="setUrl(this.innerHTML);"><c:out value="${url}"/></a></li>
+</c:forEach>
+</c:if>
+
+<script type="text/javascript">
+function setUrl(url) {
+ document.getElementById("satChannelUpdateUrl").value = url;
+}
+</script>
+
<div class="help">
<table><tr><td style="width: 30px">
<img src="<c:url value="/img/help.png" />" alt="Help" />
More information about the vlma-devel
mailing list