예제 #1
0
 /**
  * Gets the wallpaper of the specified space. If the space or one of its parent have no specific
  * wallpaper set, then returns the default one.
  *
  * @see SilverpeasLook#getWallpaperOfSpace(java.lang.String)
  * @param spaceId the identifier of the space.
  * @return the URL of the wallpaper image or the default one if the space or its parents have no
  *     wallpaper.
  */
 public String getWallpaperOfSpaceOrDefaultOne(String spaceId) {
   String wallpaperURL = getWallpaperOfSpace(spaceId);
   if (!isDefined(wallpaperURL)) {
     GraphicElementFactory elementFactory =
         new GraphicElementFactory(GraphicElementFactory.defaultLookName);
     wallpaperURL = elementFactory.getIcon(DEFAULT_WALLPAPER_PROPERTY);
     if (!isDefined(wallpaperURL)) {
       wallpaperURL =
           FileServerUtils.getApplicationContext()
               + "/admin/jsp/icons/silverpeasV5/bandeauTop.jpg";
     }
   }
   return wallpaperURL;
 }
 /**
  * Computes the URL of the video to display from the identifier of the attached video file and by
  * taking into account the displaying context.
  *
  * @param attachmentId the identifier of the attached video file.
  * @param pageContext the displaying page context.
  * @return the URL of the video file as String.
  */
 private String computeVideoURL(final String attachmentId, final PagesContext pageContext) {
   String videoURL = "";
   if (StringUtil.isDefined(attachmentId)) {
     if (attachmentId.startsWith("/")) {
       videoURL = attachmentId;
     } else {
       AttachmentDetail attachment =
           AttachmentController.searchAttachmentByPK(
               new AttachmentPK(attachmentId, pageContext.getComponentId()));
       if (attachment != null) {
         String webContext = FileServerUtils.getApplicationContext();
         videoURL = webContext + attachment.getAttachmentURL();
       }
     }
   }
   return videoURL;
 }
 /**
  * Creates an XHTML element that represents the video player that will play the video located at
  * the specified URL.
  *
  * @param videoURL the URL of the video to play.
  * @param parameters the parameters to pass to the video player.
  * @return the XHTML representation of the video player.
  */
 private Element createVideoPlayer(String videoURL, Map<String, String> parameters) {
   boolean autoplay =
       (parameters.containsKey(PARAMETER_AUTOPLAY)
           ? Boolean.valueOf(parameters.get(PARAMETER_AUTOPLAY))
           : false);
   String playerPath = FileServerUtils.getApplicationContext() + SWF_PLAYER_PATH;
   String videoId = VIDEO_PLAYER_ID + videoURL.hashCode();
   script js =
       new script(
           "flowplayer('"
               + videoId
               + "', '"
               + playerPath
               + "', {wmode: 'opaque', clip: { autoBuffering: "
               + !autoplay
               + ", autoPlay: "
               + autoplay
               + " } });");
   js.setLanguage("javascript");
   js.setType("text/javascript");
   return js;
 }