[vlma-devel] commit: Display the URL of programs. (Adrien Grand )

git version control git at videolan.org
Sat Jan 3 00:56:13 CET 2009


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sat Jan  3 00:24:58 2009 +0100| [27a193815b1b09fb6ac90f39c685194b2fb7e29f] | committer: Adrien Grand 

Display the URL of programs.

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

 .../java/org/videolan/vlma/web/tag/Program.java    |   40 +++++++++++++-------
 vlma-webapp/src/main/webapp/css/style.css          |    4 ++
 2 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/tag/Program.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/tag/Program.java
index 429f4b2..da3e6c9 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/tag/Program.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/tag/Program.java
@@ -24,12 +24,14 @@ import java.io.IOException;
 
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.JspWriter;
-import javax.servlet.jsp.tagext.TagSupport;
 import javax.servlet.jsp.jstl.fmt.LocaleSupport;
 
 import org.apache.log4j.Logger;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.servlet.tags.RequestContextAwareTag;
+import org.videolan.vlma.Data;
 
-public class Program extends TagSupport {
+public class Program extends RequestContextAwareTag {
 
     private static final long serialVersionUID = 2L;
     private static final Logger logger = Logger.getLogger(Program.class);
@@ -37,34 +39,44 @@ public class Program extends TagSupport {
     private static final String RUNNING = "medias.list.status.programmed-running";
     private static final String ASSIGNED = "medias.list.status.programmed-assigned";
 
+    private Data data;
     private org.videolan.vlma.model.Program program;
 
     public void setProgram(org.videolan.vlma.model.Program program) {
         this.program = program;
     }
 
-    public int doStartTag() throws JspException {
+    public int doStartTagInternal() throws JspException {
+        WebApplicationContext webAppContext = getRequestContext().getWebApplicationContext();
+        data = (Data) webAppContext.getBean("dataImporter");
         Object[] params;
         JspWriter out = pageContext.getOut();
         try {
-            out.print("<span class=\"program group\">");
+            out.print("<span class=\"program sap group\">");
             out.print(program.getSapGroup());
-            out.print("</span> / <span class=\"program name\">");
+            out.print("</span> / <span class=\"program sap name\">");
             out.print(program.getSapName());
-            out.print("</span>: ");
+            out.print("</span>");
+            out.println(": ");
             out.print(program.getStreamingStrategy().getType().getName());
-            out.print(" ");
-            out.print(program.getStreamingStrategy().getProtocol().getName());
-            out.print(", ");
+            out.println(" ");
             if (program.getPlayer() == null) {
                 params = new Object[]{ Integer.valueOf(program.getPriority()) };
                 out.print(LocaleSupport.getLocalizedMessage(pageContext, NOT_RUNNING, params));
-            } else if (!program.getBroadcastState()) {
-                params = new Object[]{ program.getPriority(), program.getPlayer().getName() };
-                out.print(LocaleSupport.getLocalizedMessage(pageContext, ASSIGNED, params));
             } else {
-                params = new Object[]{ program.getPriority(), program.getPlayer().getName() };
-                out.print(LocaleSupport.getLocalizedMessage(pageContext, RUNNING, params));
+                out.print("(<a href=\"");
+                String url = data.getUrl(program);
+                out.print(url);
+                out.print("\">");
+                out.print(url);
+                out.print("</a>) ");
+                if (program.getBroadcastState()) {
+                    params = new Object[]{ program.getPriority(), program.getPlayer().getName() };
+                    out.print(LocaleSupport.getLocalizedMessage(pageContext, RUNNING, params));
+                } else {
+                    params = new Object[]{ program.getPriority(), program.getPlayer().getName() };
+                    out.print(LocaleSupport.getLocalizedMessage(pageContext, ASSIGNED, params));
+                }
             }
         } catch(IOException e) {
             logger.error(e);
diff --git a/vlma-webapp/src/main/webapp/css/style.css b/vlma-webapp/src/main/webapp/css/style.css
index 2c12ab2..a5717d7 100644
--- a/vlma-webapp/src/main/webapp/css/style.css
+++ b/vlma-webapp/src/main/webapp/css/style.css
@@ -179,6 +179,10 @@ div.help {
     width: 100%;
 }
 
+.sap {
+    font-weight: bold;
+}
+
 .footer {
     clear: both;
     color: #999;



More information about the vlma-devel mailing list