Author: amarkhel
Date: 2009-05-28 09:03:43 -0400 (Thu, 28 May 2009)
New Revision: 14394
Added:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/LoggedUserTracker.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/UserExpiredPhaseListener.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/SessionExpirationChecker.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/Utils.java
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/AlbumManager.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/Authenticator.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/Controller.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/DnDManager.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/Model.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/ShelfManager.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/SlideshowManager.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/UserManager.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/ISearchOption.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/ImageSearchHelper.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByAlbum.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByImage.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByShelf.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByTag.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByUser.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/DirectLinkHelper.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/Help.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/ImageSizeHelper.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/UserPrefsHelper.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/CopyImageStuff.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/Environment.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/FileUtils.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/HashUtils.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/ImageDimension.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/SessionListener.java
branches/community/3.3.X/examples/photoalbum/source/web/src/main/resources/messages_en.properties
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/WEB-INF/faces-config.xml
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/album/albumInfo.xhtml
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/album/createAlbum.xhtml
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/contextMenu/CMForShelf.xhtml
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/fileUpload/fileUploader.xhtml
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/image/imageAdditionalInfo.xhtml
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/image/imageEditInfo.xhtml
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/image/imageInfo.xhtml
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/index/header.xhtml
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/index/menu.xhtml
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/index/tree.xhtml
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/search/result/userResult.xhtml
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/shelf/shelfInfo.xhtml
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/userPrefs/userPrefsEdit.xhtml
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/stylesheet/photoalbum.css
Log:
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/AlbumManager.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/AlbumManager.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/AlbumManager.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -98,10 +98,11 @@
/**
* Method, that invoked when user want to create new album. Only registered users can
create new albums.
* @param shelf - shelf, that will contain new album
+ * @param isShowAlbumAfterCreate - indicate is we need to show created album after
create.
*
*/
@Restrict("#{s:hasRole('admin')}")
- public void createAlbum(Shelf shelf){
+ public void createAlbum(Shelf shelf, boolean isShowAlbumAfterCreate){
Album album = new Album();
if(shelf == null){
if(user.getShelves().size() > 0){
@@ -114,6 +115,7 @@
}
}
album.setShelf(shelf);
+ album.setShowAfterCreate(isShowAlbumAfterCreate);
//Reset 'album' component in conversation scope
Contexts.getConversationContext().set(Constants.ALBUM_VARIABLE, album);
}
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/Authenticator.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/Authenticator.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/Authenticator.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -27,8 +27,6 @@
import java.io.File;
import java.io.Serializable;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.security.auth.login.LoginException;
@@ -47,6 +45,7 @@
import org.richfaces.photoalbum.service.IUserAction;
import org.richfaces.photoalbum.util.Environment;
import org.richfaces.photoalbum.util.HashUtils;
+import org.richfaces.photoalbum.util.Utils;
@Name("authenticator")
@Scope(ScopeType.CONVERSATION)
@@ -54,6 +53,8 @@
private static final long serialVersionUID = -4585673256547342140L;
+ @In LoggedUserTracker userTracker;
+
@In @Out
User user;
@@ -91,6 +92,10 @@
user = new User();
return false;
}
+ //Remove previous session id from users store
+ userTracker.removeUserId(user.getId());
+ //Mark current user as actual
+ userTracker.addUserId(user.getId(), Utils.getSession().getId());
identity.addRole(Constants.ADMIN_ROLE);
//Raise event to controller to update Model
Events.instance().raiseEvent(Constants.AUTHENTICATED_EVENT, user);
@@ -112,6 +117,8 @@
*/
public String logout() {
identity.logout();
+ //Remove user from users store
+ userTracker.removeUserId(user.getId());
setConversationStarted(false);
return Constants.LOGOUT_OUTCOME;
}
@@ -193,7 +200,7 @@
private boolean checkUserExist(User user) {
if (userAction.isUserExist(user.getLogin())) {
- addFacesMessage(Constants.REGISTER_LOGIN_NAME_ID,
Constants.USER_WITH_THIS_LOGIN_ALREADY_EXIST);
+ Utils.addFacesMessage(Constants.REGISTER_LOGIN_NAME_ID,
Constants.USER_WITH_THIS_LOGIN_ALREADY_EXIST);
return true;
}
return false;
@@ -201,22 +208,17 @@
private boolean checkEmailExist(String email) {
if (userAction.isEmailExist(email)) {
- addFacesMessage(Constants.REGISTER_EMAIL_ID,
Constants.USER_WITH_THIS_EMAIL_ALREADY_EXIST);
+ Utils.addFacesMessage(Constants.REGISTER_EMAIL_ID,
Constants.USER_WITH_THIS_EMAIL_ALREADY_EXIST);
return true;
}
return false;
}
- private void addFacesMessage(String componentId, String message) {
- UIComponent root = FacesContext.getCurrentInstance().getViewRoot();
- UIComponent component = root.findComponent(componentId);
- FacesContext.getCurrentInstance().addMessage(component
- .getClientId(FacesContext.getCurrentInstance()),new
FacesMessage(FacesMessage.SEVERITY_ERROR, message, message));
- }
+
private boolean checkPassword(User user) {
if (!user.getPassword().equals(user.getConfirmPassword())) {
- addFacesMessage(Constants.REGISTER_CONFIRM_PASSWORD_ID,
Constants.CONFIRM_PASSWORD_NOT_EQUALS_PASSWORD);
+ Utils.addFacesMessage(Constants.REGISTER_CONFIRM_PASSWORD_ID,
Constants.CONFIRM_PASSWORD_NOT_EQUALS_PASSWORD);
return true;
}
return false;
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/Controller.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/Controller.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/Controller.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -233,7 +233,9 @@
*/
@Observer(Constants.ALBUM_ADDED_EVENT)
public void onAlbumAdded(Album album){
- model.resetModel(NavigationEnum.ALBUM_PREVIEW, album.getOwner(), album.getShelf(),
album, null, album.getImages());
+ if(album.isShowAfterCreate()){
+ model.resetModel(NavigationEnum.ALBUM_PREVIEW, album.getOwner(), album.getShelf(),
album, null, album.getImages());
+ }
}
/**
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/DnDManager.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/DnDManager.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/DnDManager.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -24,10 +24,6 @@
*
* @author Andrey Markhel
*/
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.context.AjaxContext;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.security.Restrict;
@@ -41,6 +37,7 @@
import org.richfaces.photoalbum.domain.User;
import org.richfaces.photoalbum.service.Constants;
import org.richfaces.photoalbum.service.IAlbumAction;
+import org.richfaces.photoalbum.util.Utils;
@Name("dndManager")
public class DnDManager implements DropListener {
@@ -90,7 +87,7 @@
return;
}
Events.instance().raiseEvent(Constants.ALBUM_DRAGGED_EVENT, dragValue, pathOld);
- addTreeToRerender();
+ Utils.addToRerender(Constants.TREE_ID);
}
private void handleImage(Image dragValue, Album dropValue) {
@@ -106,17 +103,8 @@
return;
}
Events.instance().raiseEvent(Constants.IMAGE_DRAGGED_EVENT, dragValue, pathOld);
- addTreeToRerender();
+ Utils.addToRerender(Constants.TREE_ID);
}
- private void addTreeToRerender() {
- try {
- FacesContext fc = FacesContext.getCurrentInstance();
- AjaxContext ac = AjaxContext.getCurrentInstance();
- UIComponent destTree = fc.getViewRoot().findComponent(Constants.TREE_ID);
- ac.addComponentToAjaxRender(destTree);
- } catch (Exception e) {
- System.err.print(e.getMessage());
- }
- }
+
}
Added:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/LoggedUserTracker.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/LoggedUserTracker.java
(rev 0)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/LoggedUserTracker.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -0,0 +1,79 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.photoalbum.manager;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Startup;
+
+/**
+ * Special wrapper for Map, that contains pairs(userId, sessionId) to track what
sessionId is actual by specified user.
+ * Used to determine need to expire user's session, that session's id not equal
to stored in this map.
+ * @author Andrey Markhel
+ */
+@Name("userTracker")
+(a)Scope(ScopeType.APPLICATION)
+@Startup
+public class LoggedUserTracker {
+
+ private Map<Long, String> loginnedUserIds = new HashMap<Long, String>();
+
+ /**
+ * Add user id and session id to store after each successfull authentication. Last
authentication will be current
+ * @param id - user id to add
+ * @param sessionId - sessionId
+ */
+ public void addUserId(Long id, String sessionId){
+ loginnedUserIds.put(id, sessionId);
+ }
+
+ /**
+ * Remove user id from store after each logout
+ * @param id - user id to remove
+ */
+ public void removeUserId(Long id){
+ loginnedUserIds.remove(id);
+ }
+
+ /**
+ * Checks if in the store contained user with specified user id and session id
+ * @param id - user id to check
+ * @param sessionId - session id to check
+ * @return true if such user contained in the store, that indicating that current user
is actual.
+ */
+ public boolean containsUser(Long id, String sessionId){
+ String sessId = loginnedUserIds.get(id);
+ return sessId != null && sessId.equals(sessionId);
+ }
+
+ /**
+ * Checks if in the store contained user with specified user id
+ * @param id - user id to check
+ * @return true if user with specified id contained in the store
+ */
+ public boolean containsUserId(Long id){
+ return loginnedUserIds.containsKey(id);
+ }
+}
Property changes on:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/LoggedUserTracker.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/Model.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/Model.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/Model.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.photoalbum.manager;
import java.io.Serializable;
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/ShelfManager.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/ShelfManager.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/ShelfManager.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -157,16 +157,6 @@
return shelves;
}
- /**
- * This method used to populate 'my shelves' tree
- *
- * @return List of users shelves
- *
- */
- public List<Shelf> getUserShelves(){
- return user.getShelves();
- }
-
public boolean isValidationSuccess() {
return validationSuccess;
}
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/SlideshowManager.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/SlideshowManager.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/SlideshowManager.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -26,10 +26,6 @@
*/
import java.io.Serializable;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.context.AjaxContext;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
@@ -39,6 +35,7 @@
import org.jboss.seam.core.Events;
import org.richfaces.photoalbum.domain.Image;
import org.richfaces.photoalbum.service.Constants;
+import org.richfaces.photoalbum.util.Utils;
@Name("slideshow")
@Scope(ScopeType.CONVERSATION)
@@ -81,28 +78,16 @@
*
*/
public void startSlideshow(){
- active = true;
- errorDetected = false;
- this.slideshowIndex = 0;
- this.startSlideshowIndex = 0;
+ initSlideshow();
if(model.getImages() == null || model.getImages().size() < 1){
- stopSlideshow();
- errorDetected = true;
- Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT,
Constants.NO_IMAGES_FOR_SLIDESHOW_ERROR);
+ onError(true);
return;
}
this.selectedImage = model.getImages().get(this.slideshowIndex);
//mark image as 'visited'
this.selectedImage.setVisited(true);
//Check if that image was recently deleted. If yes, immediately stop slideshow process
- FileManager fileManager =
(FileManager)Contexts.getApplicationContext().get(Constants.FILE_MANAGER_COMPONENT);
- if(!fileManager.isFilePresent(this.selectedImage.getFullPath())){
- Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT,
Constants.IMAGE_RECENTLY_DELETED_ERROR);
- active = false;
- errorDetected = true;
- model.resetModel(NavigationEnum.ALBUM_IMAGE_PREVIEW,
this.selectedImage.getAlbum().getOwner(), this.selectedImage.getAlbum().getShelf(),
this.selectedImage.getAlbum(), null, this.selectedImage.getAlbum().getImages());
- return;
- }
+ checkIsFileRecentlyDeleted();
}
/**
@@ -111,12 +96,9 @@
*@param selectedImage - first image to show during slideshow
*/
public void startSlideshow(Image selectedImage){
- errorDetected = false;
- active = true;
+ initSlideshow();
if(model.getImages() == null || model.getImages().size() < 1){
- stopSlideshow();
- errorDetected = true;
- Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT,
Constants.NO_IMAGES_FOR_SLIDESHOW_ERROR);
+ onError(true);
return;
}
this.slideshowIndex = model.getImages().indexOf(selectedImage);
@@ -125,14 +107,7 @@
//mark image as 'visited'
this.selectedImage.setVisited(true);
//Check if that image was recently deleted. If yes, immediately stop slideshow
- FileManager fileManager =
(FileManager)Contexts.getApplicationContext().get(Constants.FILE_MANAGER_COMPONENT);
- if(!fileManager.isFilePresent(this.selectedImage.getFullPath())){
- Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT,
Constants.IMAGE_RECENTLY_DELETED_ERROR);
- active = false;
- errorDetected = true;
- model.resetModel(NavigationEnum.ALBUM_IMAGE_PREVIEW,
this.selectedImage.getAlbum().getOwner(), this.selectedImage.getAlbum().getShelf(),
this.selectedImage.getAlbum(), null, this.selectedImage.getAlbum().getImages());
- return;
- }
+ checkIsFileRecentlyDeleted();
}
/**
@@ -170,8 +145,7 @@
*/
public void showNextImage(){
if(!active){
- errorDetected = true;
- addMainAreaToRerender();
+ onError(false);
return;
}
//reset index if we reached last image
@@ -181,24 +155,14 @@
slideshowIndex++;
//To prevent slideshow mechanism working in cycle.
if(slideshowIndex == startSlideshowIndex){
- stopSlideshow();
- errorDetected = true;
- addMainAreaToRerender();
+ onError(false);
return;
}
selectedImage = model.getImages().get(slideshowIndex);
//mark image as 'visited'
this.selectedImage.setVisited(true);
//Check if that image was recently deleted. If yes, stopping slideshow
- FileManager fileManager =
(FileManager)Contexts.getApplicationContext().get(Constants.FILE_MANAGER_COMPONENT);
- if(!fileManager.isFilePresent(this.selectedImage.getFullPath())){
- Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT,
Constants.IMAGE_RECENTLY_DELETED_ERROR);
- active = false;
- errorDetected = true;
- addMainAreaToRerender();
- model.resetModel(NavigationEnum.ALBUM_IMAGE_PREVIEW,
this.selectedImage.getAlbum().getOwner(), this.selectedImage.getAlbum().getShelf(),
this.selectedImage.getAlbum(), null, this.selectedImage.getAlbum().getImages());
- return;
- }
+ checkIsFileRecentlyDeleted();
}
public Integer getStartSlideshowIndex() {
@@ -217,14 +181,32 @@
this.errorDetected = errorDetected;
}
- private void addMainAreaToRerender() {
- try {
- FacesContext fc = FacesContext.getCurrentInstance();
- AjaxContext ac = AjaxContext.getCurrentInstance();
- UIComponent mainArea = fc.getViewRoot().findComponent(Constants.MAINAREA_ID);
- ac.addComponentToAjaxRender(mainArea);
- } catch (Exception e) {
- System.err.print(e.getMessage());
+ private void initSlideshow() {
+ active = true;
+ errorDetected = false;
+ this.slideshowIndex = 0;
+ this.startSlideshowIndex = 0;
+ }
+
+ private void onError(boolean isShowOnUI) {
+ stopSlideshow();
+ errorDetected = true;
+ Utils.addToRerender(Constants.MAINAREA_ID);
+ if(isShowOnUI){
+ Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT,
Constants.NO_IMAGES_FOR_SLIDESHOW_ERROR);
}
+ return;
}
+
+ private void checkIsFileRecentlyDeleted() {
+ FileManager fileManager =
(FileManager)Contexts.getApplicationContext().get(Constants.FILE_MANAGER_COMPONENT);
+ if(!fileManager.isFilePresent(this.selectedImage.getFullPath())){
+ Events.instance().raiseEvent(Constants.ADD_ERROR_EVENT,
Constants.IMAGE_RECENTLY_DELETED_ERROR);
+ active = false;
+ errorDetected = true;
+ Utils.addToRerender(Constants.MAINAREA_ID);
+ model.resetModel(NavigationEnum.ALBUM_IMAGE_PREVIEW,
this.selectedImage.getAlbum().getOwner(), this.selectedImage.getAlbum().getShelf(),
this.selectedImage.getAlbum(), null, this.selectedImage.getAlbum().getImages());
+ return;
+ }
+ }
}
\ No newline at end of file
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/UserManager.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/UserManager.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/manager/UserManager.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -35,6 +35,7 @@
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.core.Events;
+import org.richfaces.photoalbum.domain.Album;
import org.richfaces.photoalbum.domain.User;
import org.richfaces.photoalbum.service.Constants;
import org.richfaces.photoalbum.service.IUserAction;
@@ -83,6 +84,15 @@
}
/**
+ * This method observes <code>Constants.ALBUM_ADDED_EVENT</code> and invoked
after the user add new album
+ * @param album - added album
+ */
+ @Observer(Constants.ALBUM_ADDED_EVENT)
+ public void onAlbumAdded(Album album){
+ user = userAction.refreshUser();
+ }
+
+ /**
* Method, that invoked when user click 'Cancel' button during edit her
profile.
*
*/
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/ISearchOption.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/ISearchOption.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/ISearchOption.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.richfaces.photoalbum.search;
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/ImageSearchHelper.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/ImageSearchHelper.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/ImageSearchHelper.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.photoalbum.search;
import java.io.Serializable;
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByAlbum.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByAlbum.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByAlbum.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.photoalbum.search;
import java.util.ArrayList;
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByImage.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByImage.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByImage.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.richfaces.photoalbum.search;
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByShelf.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByShelf.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByShelf.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.richfaces.photoalbum.search;
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByTag.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByTag.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByTag.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.richfaces.photoalbum.search;
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByUser.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByUser.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/search/SearchOptionByUser.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.richfaces.photoalbum.search;
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/DirectLinkHelper.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/DirectLinkHelper.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/DirectLinkHelper.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.photoalbum.ui;
import java.io.IOException;
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/Help.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/Help.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/Help.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.photoalbum.ui;
import org.jboss.seam.ScopeType;
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/ImageSizeHelper.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/ImageSizeHelper.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/ImageSizeHelper.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.richfaces.photoalbum.ui;
Added:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/UserExpiredPhaseListener.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/UserExpiredPhaseListener.java
(rev 0)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/UserExpiredPhaseListener.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -0,0 +1,60 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.photoalbum.ui;
+
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.core.Events;
+import org.richfaces.photoalbum.service.Constants;
+import org.richfaces.photoalbum.util.Utils;
+/**
+ * Special <code>PhaseListener</code> for check is the user session was
expired or user were login in another browser.
+ * By default phaseListener works on <code>PhaseId.RESTORE_VIEW</code> JSF
lifecycle phase.
+ * @author Andrey Markhel
+ */
+@Name("phaseListener")
+(a)Scope(ScopeType.EVENT)
+public class UserExpiredPhaseListener implements PhaseListener {
+
+ private static final long serialVersionUID = 1L;
+ private PhaseId phase = PhaseId.RESTORE_VIEW;
+
+ public void beforePhase(PhaseEvent e)
+ {
+ Events.instance().raiseEvent(Constants.CHECK_USER_EXPIRED_EVENT, Utils.getSession());
+ }
+
+ public void afterPhase(PhaseEvent e) {
+ }
+
+ public void setPhase(PhaseId phase) {
+ this.phase = phase;
+ }
+
+ public PhaseId getPhaseId() {
+ return phase;
+ }
+ }
Property changes on:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/UserExpiredPhaseListener.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/UserPrefsHelper.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/UserPrefsHelper.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/ui/UserPrefsHelper.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.richfaces.photoalbum.ui;
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/CopyImageStuff.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/CopyImageStuff.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/CopyImageStuff.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -1,5 +1,22 @@
/**
- *
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.richfaces.photoalbum.util;
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/Environment.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/Environment.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/Environment.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.photoalbum.util;
/**
* Convenience class to determine in which environment application running.
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/FileUtils.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/FileUtils.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/FileUtils.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.photoalbum.util;
import java.awt.Graphics2D;
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/HashUtils.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/HashUtils.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/HashUtils.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.photoalbum.util;
/**
* Convenience class to hash user passwords.
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/ImageDimension.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/ImageDimension.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/ImageDimension.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.photoalbum.util;
/**
* Convenience UI class for represent image object in different dimensions. Each image
have 5 thumbnails with different
Added:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/SessionExpirationChecker.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/SessionExpirationChecker.java
(rev 0)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/SessionExpirationChecker.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -0,0 +1,73 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.photoalbum.util;
+
+import java.io.IOException;
+
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpSession;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Observer;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.security.Identity;
+import org.jboss.seam.web.Session;
+import org.richfaces.photoalbum.domain.User;
+import org.richfaces.photoalbum.manager.LoggedUserTracker;
+import org.richfaces.photoalbum.service.Constants;
+/**
+ * Utility class for check is the user session was expired or user were login in another
browser.
+ * Observes <code>Constants.CHECK_USER_EXPIRED_EVENT</code> event
+ * @author Andrey Markhel
+ */
+(a)Scope(ScopeType.EVENT)
+@Name("sessionExpirationChecker")
+@AutoCreate
+public class SessionExpirationChecker {
+
+ @In User user;
+ @In Identity identity;
+ @In LoggedUserTracker userTracker;
+ /**
+ * Utility method for check is the user session was expired or user were login in
another browser.
+ * Observes <code>Constants.CHECK_USER_EXPIRED_EVENT</code> event.
+ * Redirects to error page if user were login in another browser.
+ * @param session - user's session
+ */
+ @Observer(Constants.CHECK_USER_EXPIRED_EVENT)
+ public void checkUserExpiration(HttpSession session){
+ if(isShouldExpireUser(session)){
+ try {
+ Session.instance().invalidate();
+ FacesContext.getCurrentInstance().getExternalContext().redirect("error.seam");
+ } catch (IOException e1) {
+ FacesContext.getCurrentInstance().responseComplete();
+ }
+ }
+ }
+
+ private boolean isShouldExpireUser(HttpSession session) {
+ return identity.isLoggedIn() && user!= null &&
userTracker.containsUserId(user.getId()) &&
!userTracker.containsUser(user.getId(), session.getId());
+ }
+}
Property changes on:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/SessionExpirationChecker.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/SessionListener.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/SessionListener.java 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/SessionListener.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.richfaces.photoalbum.util;
/**
* This class is session listener that observes
<code>"org.jboss.seam.sessionExpired"</code> event to delete in
production systems users when it's session is expired
@@ -20,6 +40,7 @@
import org.jboss.seam.core.Events;
import org.richfaces.photoalbum.domain.Comment;
import org.richfaces.photoalbum.domain.User;
+import org.richfaces.photoalbum.manager.LoggedUserTracker;
import org.richfaces.photoalbum.service.Constants;
import org.richfaces.photoalbum.service.IImageAction;
@@ -35,7 +56,7 @@
private IImageAction imageAction;
@In(value="entityManager")
private EntityManager em;
-
+ @In LoggedUserTracker userTracker;
@Destroy
@Transactional
@Observer("org.jboss.seam.sessionExpired")
@@ -44,7 +65,7 @@
return;
}
- if(user.getId() != null && !user.isPreDefined()){
+ if(user.getId() != null && !user.isPreDefined() &&
!userTracker.containsUserId(user.getId())){
user = em.merge(user);
final List<Comment> userComments = imageAction.findAllUserComments(user);
for (Comment c : userComments) {
Added:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/Utils.java
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/Utils.java
(rev 0)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/Utils.java 2009-05-28
13:03:43 UTC (rev 14394)
@@ -0,0 +1,73 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.photoalbum.util;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpSession;
+
+import org.ajax4jsf.context.AjaxContext;
+/**
+ * Utility class for actions, related to direct access or modification of current
request
+ * @author Andrey Markhel
+ */
+public class Utils {
+
+ private Utils(){
+
+ }
+
+ /**
+ * Utility method for adding FacesMessages to specified component
+ * @param componentId - component identifier
+ * @param message - message to add
+ */
+ public static void addFacesMessage(String componentId, String message) {
+ UIComponent root = FacesContext.getCurrentInstance().getViewRoot();
+ UIComponent component = root.findComponent(componentId);
+ FacesContext.getCurrentInstance().addMessage(component
+ .getClientId(FacesContext.getCurrentInstance()),new
FacesMessage(FacesMessage.SEVERITY_ERROR, message, message));
+ }
+
+ /**
+ * Utility method for get reference to current HTTPSession
+ * @return session object
+ */
+ public static HttpSession getSession(){
+ return
(HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(true);
+ }
+
+ /**
+ * Utility method for programmatically adding specified component to rerender after AJAX
request complete.
+ * @param componentId - id of component should be added to rerender
+ */
+ public static void addToRerender(String componentId) {
+ try {
+ FacesContext fc = FacesContext.getCurrentInstance();
+ AjaxContext ac = AjaxContext.getCurrentInstance();
+ UIComponent destComponent = fc.getViewRoot().findComponent(componentId);
+ ac.addComponentToAjaxRender(destComponent);
+ } catch (Exception e) {
+ System.err.print(e.getMessage());
+ }
+ }
+}
Property changes on:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/java/org/richfaces/photoalbum/util/Utils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/resources/messages_en.properties
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/resources/messages_en.properties 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/resources/messages_en.properties 2009-05-28
13:03:43 UTC (rev 14394)
@@ -88,7 +88,7 @@
javax.faces.converter.STRING=value could not be converted to a string
error=Error
-errorStub=Something bad happened :-(
+errorStub=Your session is expired.
comment.label=View comments(#{model.selectedImage.comments.size})
comment.author=Author: #{comment.author.login}
@@ -215,7 +215,7 @@
show_albums=Show albums
author=Author
close=Close
-myAlbumShelfs=My album shelves
+myAlbumShelfs=My shelves
newPhotos=New images
created.shelf=Created
created.album=Created
@@ -261,16 +261,16 @@
keywords=Keywords:
user_profile_=User profile
message_authorHeader=Author
-all_new_images_shelf=All new images(#{model.images.size()}) in shelf
#{model.selectedShelf.name}
-all_new_images_album=All new images(#{model.images.size()}) in album
#{model.selectedAlbum.name}
+all_new_images_shelf=All new images (#{model.images.size()}) in shelf
#{model.selectedShelf.name}
+all_new_images_album=All new images (#{model.images.size()}) in album
#{model.selectedAlbum.name}
in_album=in album
-public_shelves=Pre-defined Shelves
-all_images=All images(#{model.images.size()}) related to tag #{model.selectedTag.tag}
+public_shelves=Pre-defined shelves
+all_images_tag=All images (#{model.images.size()}) related to tag
#{model.selectedTag.tag}
my_all_albums=My all albums
my_all_photos=My all images
ok=Ok
-all_shared_albums=All shared albums(#{model.selectedUser.sharedAlbums.size()}) of user
#{model.selectedUser.login}
-all_shared_images=All shared images(#{model.selectedUser.sharedImages.size()}) of user
#{model.selectedUser.login}
+all_shared_albums=All shared albums (#{model.selectedUser.sharedAlbums.size()}) of user
#{model.selectedUser.login}
+all_shared_images=All shared images (#{model.selectedUser.sharedImages.size()}) of user
#{model.selectedUser.login}
my_album_shelves=My album shelves
cancel=Cancel
save=Save
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/WEB-INF/faces-config.xml 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/WEB-INF/faces-config.xml 2009-05-28
13:03:43 UTC (rev 14394)
@@ -12,5 +12,7 @@
</locale-config>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
-
+ <lifecycle>
+
<phase-listener>org.richfaces.photoalbum.ui.UserExpiredPhaseListener</phase-listener>
+ </lifecycle>
</faces-config>
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/album/albumInfo.xhtml
===================================================================
(Binary files differ)
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/album/createAlbum.xhtml
===================================================================
(Binary files differ)
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/contextMenu/CMForShelf.xhtml
===================================================================
(Binary files differ)
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/fileUpload/fileUploader.xhtml
===================================================================
(Binary files differ)
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/image/imageAdditionalInfo.xhtml
===================================================================
(Binary files differ)
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/image/imageEditInfo.xhtml
===================================================================
(Binary files differ)
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/image/imageInfo.xhtml
===================================================================
(Binary files differ)
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/index/header.xhtml
===================================================================
(Binary files differ)
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/index/menu.xhtml
===================================================================
(Binary files differ)
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/index/tree.xhtml
===================================================================
(Binary files differ)
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/search/result/userResult.xhtml
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/search/result/userResult.xhtml 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/search/result/userResult.xhtml 2009-05-28
13:03:43 UTC (rev 14394)
@@ -20,7 +20,7 @@
</h:panelGroup>
</h:panelGrid>
<h:panelGroup layout="block" styleClass="photo_name">
- <h:outputText class="bold" value="#{searchedUser.firstName}
#{searchedUser.secondName}"/>
+ <h:outputText styleClass="bold" value="#{searchedUser.firstName}
#{searchedUser.secondName}"/>
</h:panelGroup>
<h:panelGroup layout="block" styleClass="photo_data">
<h:outputText value="#{searchedUser.birthDate}" >
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/shelf/shelfInfo.xhtml
===================================================================
(Binary files differ)
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/includes/userPrefs/userPrefsEdit.xhtml
===================================================================
(Binary files differ)
Modified:
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/stylesheet/photoalbum.css
===================================================================
---
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/stylesheet/photoalbum.css 2009-05-28
13:03:11 UTC (rev 14393)
+++
branches/community/3.3.X/examples/photoalbum/source/web/src/main/webapp/stylesheet/photoalbum.css 2009-05-28
13:03:43 UTC (rev 14394)
@@ -269,7 +269,6 @@
.name {
font-weight: bold;
- width: 115px;
padding: 5px;
margin-top: 3px;
}