⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 slideshow2.jsp

📁 HomePlayer is an extention of the FreePlayer software provided by the french internet provider Free
💻 JSP
字号:
<%@page contentType="text/html;charset=ISO-8859-15" pageEncoding="ISO-8859-1"%>
<%@page import="org.homeplayer.util.*"%>
<%@page import="org.homeplayer.data.*"%>
<%@page import="java.net.*"%>
<jsp:useBean id="hppc" class="org.homeplayer.web.HPPageContext" scope="request">
	<jsp:setProperty name="hppc" property="request" 		value="<%=request%>"/>
</jsp:useBean> 
<!DOCTYPE HTML PUBLIC "-//Freebox//DTD HTML 3.2//EN">
<%
boolean refreshed = WebUtil.getParam(request, "refreshed", false);
if (! refreshed) {
	// it's the first hit to the slideshow, so we're coming from a page that is still displayed on the screen ...
	// if the image take time to be adapted, during this time the old page will still be displayed on the screen
	// so for the user, it will be like HomePlayer is "blocked". To avoid this, display a intermediary screen
	// whom goal is only to display something to the screen to hide the old page
	hppc.setRefresh(WebUtil.setParam(hppc.getLocalURL(), "refreshed=true"));
	hppc.setVolumeKeyEnabled(true);
%>	
	<html>
	<head><jsp:include page="/WEB-INF/jsp/head.jsp" /></head>
	<body background="ts://127.0.0.1?ox=0&oy=0&ow=1&oh=1">
		<table width="90%" height="100%" align="center">
			<tr height="10%"><td>&nbsp;</td></tr>
			<tr><td>Chargement des images...</td></tr>
		</table>
	</body>
	</html>	<% 
	return;
}




final int LEFT = 0;
final int CENTER = 1;
final int RIGHT = 2;
final int UP = 3;
final int MIDDLE = 4;
final int DOWN = 5;

final int[] HORIZONTAL = {LEFT, CENTER, RIGHT};
final int[] VERTICAL = {UP, MIDDLE, DOWN};

final int SCREEN_WIDTH = 590;
final int SCREEN_HEIGHT = 510;
%>

<%
String currentUrl = hppc.getLocalURL();
String refreshUrl = WebUtil.getParam(request, "refreshUrl", currentUrl);
refreshUrl = WebUtil.removeParam(refreshUrl, "go");
boolean pause = WebUtil.getParam(request, "pause", false);
int speedDif = WebUtil.getParam(request, "speed", 0);

int speed = HPSession.get("SLIDES_SPEED", 5);
speed += speedDif;
if (speed < 1) {
	speed = 1;
}
HPSession.set( "SLIDES_SPEED", new Integer(speed));

String pausedUrl;
String unPausedUrl;
if (pause) {
	pausedUrl = refreshUrl;
	unPausedUrl = WebUtil.removeParam(refreshUrl, "pause");
} else {
	pausedUrl = WebUtil.addParam(refreshUrl, "pause=true");
	unPausedUrl = refreshUrl;
}

if (speedDif != 0) { 
	hppc.setRefresh(3, WebUtil.removeParam(refreshUrl, "speed"));
	hppc.setLeftLink(WebUtil.setParam(unPausedUrl, "speed=1"));
	hppc.setRightLink(WebUtil.setParam(unPausedUrl, "speed=-1"));
%>
<html>
	<head><jsp:include page="/WEB-INF/jsp/head.jsp" /></head>
	<body background="ts://127.0.0.1?ox=0&oy=0&ow=1&oh=1">
	<jsp:include page="skins/default/exttoppage.jsp"/>
		<table width="95%" align="center">
			<tr><td height="<%= (SCREEN_HEIGHT - 20) / 2 %>">&nbsp;</td></tr>
			<tr>
				<td align="center">
					Vitesse <% if (speedDif < 0) { %>augment&eacute;e<% } else { %>diminu&eacute;e<% } %> <br>
					Temps de pause = <%= speed %> s.
				</td>
			</tr>
		</table>
	<jsp:include page="skins/default/extbottompage.jsp"/>
	</body>
</html>
<% 
	return;
}

String goStr = request.getParameter("go");
int go = 0;
if (goStr != null) {
	go = Integer.parseInt(goStr);
}


////////////////////////////////////////////////////
//SIZE

int maxWidth=SCREEN_WIDTH; // when more, no display on the FB
int maxHeight=SCREEN_HEIGHT; // when more, no display on the FB

boolean fullScreen = WebUtil.getParam(request, "fullscreen", HPConf.getBool(HPConf.SLIDESHOW_FULLSCREEN));
String title = (String) HPSession.get( "SLIDES_TITLE" );
boolean displayTitle = (title != null) && (! title.trim().equals(""));

if (! fullScreen) {
	maxWidth = 400;
	maxHeight = 400;
} else if (displayTitle) {
	maxHeight -= 50;
}


////////////////////////////////////////////////////
// GET THE SLIDE

URL slide=null;
ImageUtil.ImageInfo ii = null;
boolean imageAdaptationSucess = false;
	while (! imageAdaptationSucess) {
		URL[] slides = (URL[]) HPSession.get( "SLIDES" );
		if ((slides == null) || (slides.length == 0)) {
			break; // no slide to display leave the loop with imageAdaptationSucess = false
		}
		Integer posInteger = (Integer) HPSession.get( "SLIDES_IDX" ) ;
		if (posInteger == null) {
			posInteger = new Integer(0);
		}
		int pos = posInteger.intValue();
		/*
		if ((! pause) && (speedDif == 0)) {
			pos++;		
		}
		*/
		pos += go;
		if (pos >= slides.length) {
			pos = pos % slides.length;
		} else if (pos < 0) {
			pos = slides.length + pos;
		}
		slide = slides[pos];
		HPSession.set( "SLIDES_IDX", new Integer(pos));	
		
		////////////////////////////////////////////////////
		// IMAGE ADAPTATION
		try {
			ii = ImageUtil.getCachedResizedImageInfo(slide, maxWidth, maxHeight, 255);
			imageAdaptationSucess = true;
		} catch (ImageUtil.ImageException e) {
			if (e.getCause() instanceof java.io.FileNotFoundException) {
				System.out.println("slideshow : image not found url " + slide + " suppress this image from the slideshow and continue");
			} else {
				System.out.println("slideshow : image adaptation failed for url " + slide + " suppress this image from the slideshow and continue");
				e.printStackTrace();
			}
			// the image adaptation failed
			URL[] newSlides = new URL[slides.length-1];
			System.arraycopy(slides, 0, newSlides, 0, pos);
			System.arraycopy(slides, pos+1, newSlides, pos, newSlides.length - pos);
			HPSession.set( "SLIDES", newSlides ) ;
			HPSession.set( "SLIDES_IDX", new Integer(pos-1));	
		}
	}
if (! imageAdaptationSucess) {
	hppc.setRefresh(0, refreshUrl);
	hppc.setVolumeKeyEnabled(true);
	%><jsp:include page="/WEB-INF/jsp/empty.jsp" /><% 
	return;
}

	
int width = ii.getWidth();
int height = ii.getHeight();


///////////////////////////////////////////////////
// POSITIONING
int idx;
Integer posInteger;

String align;

posInteger = (Integer) HPSession.get( "SLIDES_POS_X" ) ;
if (fullScreen) {
	idx = 1;
} else if ((pause) && (posInteger != null) && (go == 0)) {
	idx = posInteger.intValue();
} else {
	idx = (int) (Math.random() * 3);
	HPSession.set("SLIDES_POS_X", new Integer(idx));
}
switch (HORIZONTAL[idx]) {
case LEFT: 
	align="left"; break;
case CENTER: 
	align="center"; break;
default: 
	align="right";
}

posInteger = (Integer) HPSession.get( "SLIDES_POS_Y" ) ;
if (fullScreen) {
	idx = 1;
} else if ((pause) && (posInteger != null) && (go == 0)) {
	idx = posInteger.intValue();
} else {
	idx = (int) (Math.random() * 3);
	HPSession.set("SLIDES_POS_Y", new Integer(idx));
}

int upperTrHeight;
switch (VERTICAL[idx]) {
case UP: 
	upperTrHeight=0; break;
case MIDDLE: 
	upperTrHeight=(SCREEN_HEIGHT - height) / 2; break;
default: 
	upperTrHeight=(SCREEN_HEIGHT - height);
}
if (displayTitle) {
	upperTrHeight -= 50;
}
if (pause) {
	hppc.setPauseLink(unPausedUrl);
} else {
	hppc.setRefresh(speed, WebUtil.setParam(unPausedUrl, "go=1"));
	// set the pause link only if it has not been set before (by musicslideshow.jsp for example)
	if (hppc.getLinks().get("pause") == null) {
		hppc.setPauseLink(pausedUrl);
	}
}
if (request.getAttribute("vlcInfo") == null) {
	hppc.setPreviousPageUrl(WebUtil.setParam(pausedUrl, "go=-1"));
	hppc.setNextPageUrl(WebUtil.setParam(pausedUrl, "go=1") );
	hppc.setLeftLink(WebUtil.setParam(unPausedUrl, "speed=1"));
	hppc.setRightLink(WebUtil.setParam(unPausedUrl, "speed=-1"));
	hppc.setStopLink(hppc.getUpUrl());
}
if( !hppc.isFreeBoxHD() ) { 
	hppc.addHeaderCode("<meta name=\"max_images_in_cache\" content=\"-1\">") ; 
}

%>
<html>
	<head><jsp:include page="/WEB-INF/jsp/head.jsp" /></head>
	<body background="ts://127.0.0.1?ox=0&oy=0&ow=1&oh=1">
	<jsp:include page="skins/default/exttoppage.jsp"/>
		<table align="center">
			<% if (upperTrHeight > 0) { %><tr><td height="<%= upperTrHeight %>">&nbsp;</td></tr><% } %>
			<tr>
				<td width="3%"><a href="<%= hppc.getUpUrl() %>">&nbsp;</a></td>
				<td align="<%=align %>">
					<table width="<%= Math.max(width, displayTitle ? 350 : 150) %>" cellpadding="0" cellspacing="0">
						<tr>
							<td align="center">
								<table border="0" cellpadding="0" cellspacing="0" width="<%= width %>">
									<tr>
										<td bgcolor="#FFFFFFFF">
											<img src="<%= ii.getPath() %>">
										</td>
									</tr>
								</table>
							</td>
						</tr>
<% if (displayTitle) { %>
						<tr><td height="5"><img width="1" height="1" src="/images/blanck.gif"></td></tr>
						<tr><td align="center"><table border="2" cellpadding="3" cellspacing="0"><tr><td align="center" bgcolor="<%= hppc.color("#88888833") %>"><% 
						if(title.equals(WebUtil.displayPhotoNameSlideshow)) {
		if(slide!=null) {
			String path = slide.getPath();
			String sub = path.substring(path.lastIndexOf('/')+1,path.length());
			sub = IOUtil.getFileName(sub);
			String color=WebUtil.convertColorFromVLCToFreebox(HPConf.getString(HPConf.SUBTITLES_COLOR));
			String size = WebUtil.convertSizeFromVLCToFreebox(HPConf.getString(HPConf.SUBTITLES_SIZE));
			%>
			<font size="<%= size%>" color="<%= color%>"><%=sub %>
			<%
			String tag = Photo.getIPTC( path ) ;
			if( tag != null ) {
				%>
				&nbsp;-&nbsp;<%=tag %>
				<%	
			}
			%></font><%
		}
	} else {
		%>
		<%=title %>
		<%
	}
						%></td></tr></table></td></tr>
						<% } %>
					</table>
				</td>
				<td width="2%">&nbsp;</td>
			</tr>
		</table>
	<jsp:include page="skins/default/extbottompage.jsp"/>
	</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -