/** * @see org.radeox.macro.Macro#execute(java.io.Writer, org.radeox.macro.parameter.MacroParameter) */ @Override public void execute(Writer writer, MacroParameter params) throws IllegalArgumentException, IOException { String name = params.get(NAME); String starttime = params.get(STARTTIME); String endtime = params.get(ENDTIME); String address = params.get(ADDRESS); String displayduration = params.get(DISPLAYDURATION); String displayname = params.getContent(); StringBuilder movieInfo = new StringBuilder(); movieInfo.append("<movieinfo>"); if (address != null) { movieInfo.append("<address>"); movieInfo.append(address); movieInfo.append("</address>"); } if (name != null) { movieInfo.append("<name>"); movieInfo.append(name); movieInfo.append("</name>"); } else { // default name movieInfo.append("<name>remotelyControlled</name>"); } if (starttime != null) { movieInfo.append("<starttime>"); movieInfo.append(starttime); movieInfo.append("</starttime>"); } if (endtime != null) { movieInfo.append("<endtime>"); movieInfo.append(endtime); movieInfo.append("</endtime>"); } if (displayname != null) { movieInfo.append("<label>"); movieInfo.append(displayname); movieInfo.append("</label>"); } if (displayname != null) { movieInfo.append("<displayname>"); movieInfo.append(displayname); movieInfo.append("</displayname>"); } movieInfo.append("</movieinfo>"); writer.write( "<span class=\"b_wiki_timemarker_play\"><object classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" width=\"17\" height=\"16\" codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\">"); writer.write("<param name=\"SRC\" value=\"" + CONTROLLER_MOV + "\">"); writer.write("<param name=\"CONTROLLER\" value=\"FALSE\">"); writer.write("<param name=\"AUTOPLAY\" value=\"FALSE\">"); writer.write("<param name=\"CACHE\" value=\"FALSE\">"); writer.write("<param name = \"MovieQTList\" value="); writer.write("\""); writer.write(movieInfo.toString()); writer.write("\">"); writer.write("<embed"); writer.write(" src=\"" + CONTROLLER_MOV + "\""); writer.write(" width=\"17\" height=\"16\""); writer.write(" controller=\"FALSE\""); writer.write(" autoplay=\"FALSE\""); writer.write(" cache=\"FALSE\""); writer.write(" MovieQTList="); writer.write("\""); writer.write(movieInfo.toString()); writer.write("\""); writer.write(" type=\"video/quicktime\""); writer.write(" pluginspage=\"http://www.apple.com/quicktime/download/\">"); writer.write("</embed>"); writer.write("</object> "); if (displayname != null) { writer.write(displayname); if (displayduration != null) { writer.write(": "); } } if (displayduration != null) { writer.write(displayduration); } writer.write("</span>"); }
/** * @see org.radeox.macro.Macro#execute(java.io.Writer, org.radeox.macro.parameter.MacroParameter) */ @Override public void execute(Writer writer, MacroParameter params) throws IllegalArgumentException, IOException { String name = params.get(NAME); String address = params.get(ADDRESS); String height = params.get(HEIGHT); String width = params.get(WIDTH); String displayduration = params.get(DISPLAYDURATION); String displayname = params.getContent(); if (address == null) { writer.write("<p>movieViewer: illegal format: missing attribute " + ADDRESS + "</p>"); return; } // default values for unset optional parameter if (name == null) name = "remotelyControlled"; if (width == null) width = Integer.toString(DEFAULT_WIDTH); if (height == null) height = Integer.toString(DEFAULT_HEIGHT); try { int iHeigt = Integer.parseInt(height); height = Integer.toString(iHeigt + CONTROLLER_HEIGHT); } catch (NumberFormatException e) { // using default values width = Integer.toString(DEFAULT_WIDTH); height = Integer.toString(DEFAULT_HEIGHT + CONTROLLER_HEIGHT); } writer.write("<span class=\"b_wiki_timemarker_viewer\">"); // show popup link writer.write("<a href=\"javascript:void("); // open window a bit bitter than the movie size itself String args = "width=" + (Integer.parseInt(width) + WIDTH_OFFSET) + ",height=" + (Integer.parseInt(height) + HEIGHT_OFFSET) + ",resizable=yes,scrollbars=yes"; writer.write( "window.open(o_info.o_baseURI + '/movie/popup.html?maddress=' + encodeURIComponent('" + address + "') + '&mname=' + encodeURIComponent('" + name + "') + '&displayname=' + encodeURIComponent('" + displayname + "') + '&displayduration=' + encodeURIComponent('" + displayduration + "') + '&width=" + width + "&height=" + height + "', '" + name + "', '" + args + "')"); writer.write(")\">Open movie player"); if (displayname != null) { writer.write(": "); writer.write(displayname); if (displayduration != null) { writer.write(": "); } } if (displayduration != null) { writer.write(displayduration); } writer.write("</a>"); writer.write("</span>"); }