Index: lams_tool_images/conf/xdoclet/struts-actions.xml =================================================================== diff -u -r5d9ada1b3b139591dc6f1fffec04990beb727522 -r4b9aac6879339e46cb0a163a8f72400aed80c041 --- lams_tool_images/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 5d9ada1b3b139591dc6f1fffec04990beb727522) +++ lams_tool_images/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 4b9aac6879339e46cb0a163a8f72400aed80c041) @@ -144,37 +144,32 @@ - + - - - - - + - - - + + imageGalleryItemList, ImageGalleryUser user); - - void setItemComplete(Long imageGalleryItemUid, Long userId, Long sessionId); - void setItemAccess(Long imageGalleryItemUid, Long userId, Long sessionId); /** Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryServiceImpl.java =================================================================== diff -u -r5d9ada1b3b139591dc6f1fffec04990beb727522 -r4b9aac6879339e46cb0a163a8f72400aed80c041 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryServiceImpl.java (.../ImageGalleryServiceImpl.java) (revision 5d9ada1b3b139591dc6f1fffec04990beb727522) +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryServiceImpl.java (.../ImageGalleryServiceImpl.java) (revision 4b9aac6879339e46cb0a163a8f72400aed80c041) @@ -433,33 +433,6 @@ imageGallerySessionDao.saveObject(resSession); } - public void retrieveComplete(SortedSet imageGalleryItemList, ImageGalleryUser user) { - for (ImageGalleryItem item : imageGalleryItemList) { - ImageGalleryItemVisitLog log = imageGalleryItemVisitDao.getImageGalleryItemLog(item.getUid(), user - .getUserId()); - if (log == null) { - item.setComplete(false); - } else { - item.setComplete(log.isComplete()); - } - } - } - - public void setItemComplete(Long imageGalleryItemUid, Long userId, Long sessionId) { - ImageGalleryItemVisitLog log = imageGalleryItemVisitDao.getImageGalleryItemLog(imageGalleryItemUid, userId); - if (log == null) { - log = new ImageGalleryItemVisitLog(); - ImageGalleryItem item = imageGalleryItemDao.getByUid(imageGalleryItemUid); - log.setImageGalleryItem(item); - ImageGalleryUser user = imageGalleryUserDao.getUserByUserIDAndSessionID(userId, sessionId); - log.setUser(user); - log.setSessionId(sessionId); - log.setAccessDate(new Timestamp(new Date().getTime())); - } - log.setComplete(true); - imageGalleryItemVisitDao.saveObject(log); - } - public void setItemAccess(Long imageGalleryItemUid, Long userId, Long sessionId) { ImageGalleryItemVisitLog log = imageGalleryItemVisitDao.getImageGalleryItemLog(imageGalleryItemUid, userId); if (log == null) { Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/AuthoringAction.java =================================================================== diff -u -rfd6a44adca1e0d4ee031b0b8b442de4ee8974d74 -r4b9aac6879339e46cb0a163a8f72400aed80c041 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision fd6a44adca1e0d4ee031b0b8b442de4ee8974d74) +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/AuthoringAction.java (.../AuthoringAction.java) (revision 4b9aac6879339e46cb0a163a8f72400aed80c041) @@ -900,7 +900,7 @@ } /** - * Extract web from content to imageGallery item. + * Extract web form content to imageGallery item. * * @param request * @param imageForm Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/LearningAction.java =================================================================== diff -u -r5d9ada1b3b139591dc6f1fffec04990beb727522 -r4b9aac6879339e46cb0a163a8f72400aed80c041 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/LearningAction.java (.../LearningAction.java) (revision 5d9ada1b3b139591dc6f1fffec04990beb727522) +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/LearningAction.java (.../LearningAction.java) (revision 4b9aac6879339e46cb0a163a8f72400aed80c041) @@ -61,6 +61,7 @@ import org.lamsfoundation.lams.tool.imageGallery.model.ImageGalleryUser; import org.lamsfoundation.lams.tool.imageGallery.model.ImageRating; import org.lamsfoundation.lams.tool.imageGallery.service.IImageGalleryService; +import org.lamsfoundation.lams.tool.imageGallery.service.ImageGalleryApplicationException; import org.lamsfoundation.lams.tool.imageGallery.service.UploadImageGalleryFileException; import org.lamsfoundation.lams.tool.imageGallery.util.ImageCommentComparator; import org.lamsfoundation.lams.tool.imageGallery.util.ImageGalleryItemComparator; @@ -95,17 +96,14 @@ if (param.equals("start")) { return start(mapping, form, request, response); } - if (param.equals("complete")) { - return complete(mapping, form, request, response); - } if (param.equals("finish")) { return finish(mapping, form, request, response); } - if (param.equals("addimage")) { - return addImage(mapping, form, request, response); + if (param.equals("newImageInit")) { + return newImageInit(mapping, form, request, response); } - if (param.equals("saveOrUpdateImage")) { - return saveOrUpdateImage(mapping, form, request, response); + if (param.equals("saveNewImage")) { + return saveNewImage(mapping, form, request, response); } // ================ Comments ======================= @@ -145,18 +143,17 @@ // initial Session Map SessionMap sessionMap = new SessionMap(); request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); - - // save toolContentID into HTTPSession + Long sessionId = new Long(request.getParameter(ImageGalleryConstants.PARAM_TOOL_SESSION_ID)); ToolAccessMode mode = WebUtil.readToolAccessModeParam(request, AttributeNames.PARAM_MODE, true); + IImageGalleryService service = getImageGalleryService(); + ImageGallery imageGallery = service.getImageGalleryBySessionId(sessionId); - Long sessionId = new Long(request.getParameter(ImageGalleryConstants.PARAM_TOOL_SESSION_ID)); - + // save toolContentID into HTTPSession request.setAttribute(ImageGalleryConstants.ATTR_SESSION_MAP_ID, sessionMap.getSessionID()); request.setAttribute(AttributeNames.ATTR_MODE, mode); request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID, sessionId); // get back the imageGallery and item list and display them on page - IImageGalleryService service = getImageGalleryService(); ImageGalleryUser imageGalleryUser = null; if ((mode != null) && mode.isTeacher()) { // monitoring mode - user is specified in URL @@ -166,12 +163,11 @@ } else { imageGalleryUser = getCurrentUser(service, sessionId); } + + // Get contentFolderID and save to form. +// String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); +// sessionMap.put(ImageGalleryConstants.ATTR_CONTENT_FOLDER_ID, contentFolderID); - List items = null; - ImageGallery imageGallery; - items = service.getImageGalleryItemsBySessionId(sessionId); - imageGallery = service.getImageGalleryBySessionId(sessionId); - // check whehter finish lock is on/off boolean lock = imageGallery.getLockWhenFinished() && (imageGalleryUser != null) && imageGalleryUser.isSessionFinished(); @@ -186,21 +182,6 @@ } } - // basic information - sessionMap.put(ImageGalleryConstants.ATTR_TITLE, imageGallery.getTitle()); - sessionMap.put(ImageGalleryConstants.ATTR_RESOURCE_INSTRUCTION, imageGallery.getInstructions()); - sessionMap.put(ImageGalleryConstants.ATTR_FINISH_LOCK, lock); - sessionMap.put(ImageGalleryConstants.ATTR_LOCK_ON_FINISH, imageGallery.getLockWhenFinished()); - sessionMap.put(ImageGalleryConstants.ATTR_USER_FINISHED, (imageGalleryUser != null) - && imageGalleryUser.isSessionFinished()); - - sessionMap.put(AttributeNames.PARAM_TOOL_SESSION_ID, sessionId); - sessionMap.put(AttributeNames.ATTR_MODE, mode); - // reflection information - sessionMap.put(ImageGalleryConstants.ATTR_REFLECTION_ON, imageGallery.isReflectOnActivity()); - sessionMap.put(ImageGalleryConstants.ATTR_REFLECTION_INSTRUCTION, imageGallery.getReflectInstructions()); - sessionMap.put(ImageGalleryConstants.ATTR_REFLECTION_ENTRY, entryText); - // add define later support if (imageGallery.isDefineLater()) { return mapping.findForward("defineLater"); @@ -220,53 +201,44 @@ } // init imageGallery item list - SortedSet imageGalleryItemList = getImageList(sessionMap); - imageGalleryItemList.clear(); + List items = service.getImageGalleryItemsBySessionId(sessionId); + SortedSet imageGalleryItemList = new TreeSet( + new ImageGalleryItemComparator()); if (items != null) { - // remove hidden items. for (ImageGalleryItem item : items) { // becuase in webpage will use this login name. Here is just // initial it to avoid session close error in proxy object. if (item.getCreateBy() != null) { item.getCreateBy().getLoginName(); } + // remove hidden items. if (!item.isHide()) { imageGalleryItemList.add(item); } } } + // basic information + sessionMap.put(ImageGalleryConstants.ATTR_TITLE, imageGallery.getTitle()); + sessionMap.put(ImageGalleryConstants.ATTR_RESOURCE_INSTRUCTION, imageGallery.getInstructions()); + sessionMap.put(ImageGalleryConstants.ATTR_FINISH_LOCK, lock); + sessionMap.put(ImageGalleryConstants.ATTR_LOCK_ON_FINISH, imageGallery.getLockWhenFinished()); + sessionMap.put(ImageGalleryConstants.ATTR_USER_FINISHED, (imageGalleryUser != null) + && imageGalleryUser.isSessionFinished()); - // set complete flag for display purpose - if (imageGalleryUser != null) { - service.retrieveComplete(imageGalleryItemList, imageGalleryUser); - } + sessionMap.put(AttributeNames.PARAM_TOOL_SESSION_ID, sessionId); + sessionMap.put(AttributeNames.ATTR_MODE, mode); + // reflection information + sessionMap.put(ImageGalleryConstants.ATTR_REFLECTION_ON, imageGallery.isReflectOnActivity()); + sessionMap.put(ImageGalleryConstants.ATTR_REFLECTION_INSTRUCTION, imageGallery.getReflectInstructions()); + sessionMap.put(ImageGalleryConstants.ATTR_REFLECTION_ENTRY, entryText); + sessionMap.put(ImageGalleryConstants.ATTR_RESOURCE_ITEM_LIST, imageGalleryItemList); + sessionMap.put(ImageGalleryConstants.ATTR_RESOURCE, imageGallery); return mapping.findForward(ImageGalleryConstants.SUCCESS); } /** - * Mark imageGallery item as complete status. - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - private ActionForward complete(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) { - String mode = request.getParameter(AttributeNames.ATTR_MODE); - String sessionMapID = request.getParameter(ImageGalleryConstants.ATTR_SESSION_MAP_ID); - - doComplete(request); - - request.setAttribute(AttributeNames.ATTR_MODE, mode); - request.setAttribute(ImageGalleryConstants.ATTR_SESSION_MAP_ID, sessionMapID); - return mapping.findForward(ImageGalleryConstants.SUCCESS); - } - - /** * Finish learning session. * * @param mapping @@ -310,10 +282,9 @@ * @param response * @return */ - private ActionForward addImage(ActionMapping mapping, ActionForm form, HttpServletRequest request, + private ActionForward newImageInit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { ImageGalleryItemForm itemForm = (ImageGalleryItemForm) form; - itemForm.setMode(WebUtil.readStrParam(request, AttributeNames.ATTR_MODE)); itemForm.setSessionMapID(WebUtil.readStrParam(request, ImageGalleryConstants.ATTR_SESSION_MAP_ID)); return mapping.findForward(ImageGalleryConstants.SUCCESS); } @@ -327,73 +298,36 @@ * @param response * @return */ - private ActionForward saveOrUpdateImage(ActionMapping mapping, ActionForm form, HttpServletRequest request, + private ActionForward saveNewImage(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { - // get back SessionMap - String sessionMapID = request.getParameter(ImageGalleryConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); - request.setAttribute(ImageGalleryConstants.ATTR_SESSION_MAP_ID, sessionMapID); - - Long sessionId = (Long) sessionMap.get(ImageGalleryConstants.ATTR_TOOL_SESSION_ID); - - String mode = request.getParameter(AttributeNames.ATTR_MODE); ImageGalleryItemForm itemForm = (ImageGalleryItemForm) form; ActionErrors errors = validateImageGalleryItem(itemForm); if (!errors.isEmpty()) { this.addErrors(request, errors); - return mapping.findForward("file"); + return mapping.findForward("image"); } - // create a new ImageGalleryItem - ImageGalleryItem item = new ImageGalleryItem(); - IImageGalleryService service = getImageGalleryService(); - ImageGalleryUser imageGalleryUser = getCurrentUser(service, sessionId); - item.setTitle(itemForm.getTitle()); - item.setDescription(itemForm.getDescription()); - item.setCreateDate(new Timestamp(new Date().getTime())); - item.setCreateByAuthor(false); - item.setCreateBy(imageGalleryUser); - - // special attribute for URL or FILE try { - service.uploadImageGalleryItemFile(item, itemForm.getFile()); - } catch (UploadImageGalleryFileException e) { - LearningAction.log.error("Failed upload ImageGallery File " + e.toString()); - return mapping.findForward(ImageGalleryConstants.ERROR); + extractFormToImageGalleryItem(request, itemForm); + } catch (Exception e) { + // any upload exception will display as normal error message rather then throw exception directly + errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(ImageGalleryConstants.ERROR_MSG_UPLOAD_FAILED, + e.getMessage())); + if (!errors.isEmpty()) { + this.addErrors(request, errors); + return mapping.findForward("image"); + } } - // save and update session - - ImageGallerySession resSession = service.getImageGallerySessionBySessionId(sessionId); - if (resSession == null) { - LearningAction.log.error("Failed update ImageGallerySession by ID[" + sessionId + "]"); - return mapping.findForward(ImageGalleryConstants.ERROR); - } - Set items = resSession.getImageGalleryItems(); - if (items == null) { - items = new HashSet(); - resSession.setImageGalleryItems(items); - } - items.add(item); - service.saveOrUpdateImageGallerySession(resSession); - - // update session value - SortedSet imageGalleryItemList = getImageList(sessionMap); - imageGalleryItemList.add(item); - - // URL or file upload + + //redirect + String sessionMapID = itemForm.getSessionMapID(); + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + ToolAccessMode mode = (ToolAccessMode) sessionMap.get(AttributeNames.ATTR_MODE); request.setAttribute(AttributeNames.ATTR_MODE, mode); + Long sessionId = (Long) sessionMap.get(ImageGalleryConstants.ATTR_TOOL_SESSION_ID); + request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID, sessionId); - // ImageGallery imageGallery = resSession.getImageGallery(); - // if (imageGallery.isAllowRank() - // && service.getEventNotificationService().eventExists(ImageGalleryConstants.TOOL_SIGNATURE, - // ImageGalleryConstants.EVENT_NAME_NOTIFY_TEACHERS_ON_ASSIGMENT_SUBMIT, - // imageGallery.getContentId())) { - // String fullName = imageGalleryUser.getLastName() + " " + imageGalleryUser.getFirstName(); - // service.getEventNotificationService().trigger(ImageGalleryConstants.TOOL_SIGNATURE, - // ImageGalleryConstants.EVENT_NAME_NOTIFY_TEACHERS_ON_ASSIGMENT_SUBMIT, imageGallery.getContentId(), - // new Object[] { fullName }); - // } return mapping.findForward(ImageGalleryConstants.SUCCESS); } @@ -698,61 +632,92 @@ } return imageGalleryUser; } - + /** - * @param itemForm - * @return + * Extract web form content to imageGallery item. + * + * @param request + * @param imageForm + * @throws ImageGalleryApplicationException */ - private ActionErrors validateImageGalleryItem(ImageGalleryItemForm itemForm) { - ActionErrors errors = new ActionErrors(); - if (StringUtils.isBlank(itemForm.getTitle())) { - errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(ImageGalleryConstants.ERROR_MSG_TITLE_BLANK)); + private void extractFormToImageGalleryItem(HttpServletRequest request, ImageGalleryItemForm imageForm) + throws Exception { + SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(imageForm.getSessionMapID()); + IImageGalleryService service = getImageGalleryService(); + ImageGallery imageGallery = (ImageGallery) sessionMap.get(ImageGalleryConstants.ATTR_RESOURCE); + + ImageGalleryItem image = new ImageGalleryItem(); + image.setCreateDate(new Timestamp(new Date().getTime())); + + // upload ImageGalleryItem file + // and setting file properties' fields: item.setFileUuid(); item.setFileVersionId(); item.setFileType(); item.setFileName(); + if (imageForm.getFile() != null) { + try { + service.uploadImageGalleryItemFile(image, imageForm.getFile()); + } catch (UploadImageGalleryFileException e) { + // remove new image! + throw e; + } } - if ((itemForm.getFile() != null) && FileUtil.isExecutableFile(itemForm.getFile().getFileName())) { - ActionMessage msg = new ActionMessage("error.attachment.executable"); - errors.add(ActionMessages.GLOBAL_MESSAGE, msg); + String title = imageForm.getTitle(); + if (StringUtils.isBlank(title)) { + Long nextConsecutiveImageTitle = imageGallery.getNextImageTitle(); + imageGallery.setNextImageTitle(nextConsecutiveImageTitle + 1); + + String imageLocalized = service.getLocalisedMessage("label.authoring.image", null); + title = imageLocalized + " " + nextConsecutiveImageTitle; } + image.setTitle(title); - // validate item size - FileValidatorUtil.validateFileSize(itemForm.getFile(), false, errors); - - // for edit validate: file already exist - if (!itemForm.isHasFile() - && ((itemForm.getFile() == null) || StringUtils.isEmpty(itemForm.getFile().getFileName()))) { - errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(ImageGalleryConstants.ERROR_MSG_FILE_BLANK)); + image.setDescription(imageForm.getDescription()); + image.setCreateByAuthor(true); + image.setHide(false); + + //setting SequenceId + Set imageList = imageGallery.getImageGalleryItems(); + int maxSeq = 0; + for (ImageGalleryItem dbImage : imageList) { + if (dbImage.getSequenceId() > maxSeq) maxSeq = dbImage.getSequenceId(); } - return errors; + maxSeq++; + image.setSequenceId(maxSeq); + + imageList.add(image); + service.saveOrUpdateImageGallery(imageGallery); + + service.saveOrUpdateImageGalleryItem(image); } /** - * Set complete flag for given imageGallery item. + * Validate imageGallery item. * - * @param request - * @param sessionId + * @param itemForm + * @return */ - private void doComplete(HttpServletRequest request) { - // get back sessionMap - String sessionMapID = request.getParameter(ImageGalleryConstants.ATTR_SESSION_MAP_ID); - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(sessionMapID); + private ActionErrors validateImageGalleryItem(ImageGalleryItemForm itemForm) { + ActionErrors errors = new ActionErrors(); - Long imageGalleryItemUid = new Long(request.getParameter(ImageGalleryConstants.PARAM_IMAGE_UID)); - IImageGalleryService service = getImageGalleryService(); - HttpSession ss = SessionManager.getSession(); - // get back login user DTO - UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + // validate file size + FileValidatorUtil.validateFileSize(itemForm.getFile(), true, errors); + // for edit validate: file already exist + if ((itemForm.getFile() == null) || StringUtils.isEmpty(itemForm.getFile().getFileName())) { + errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(ImageGalleryConstants.ERROR_MSG_FILE_BLANK)); + } - Long sessionId = (Long) sessionMap.get(ImageGalleryConstants.ATTR_TOOL_SESSION_ID); - service.setItemComplete(imageGalleryItemUid, new Long(user.getUserID().intValue()), sessionId); - - // set imageGallery item complete tag - SortedSet imageGalleryItemList = getImageList(sessionMap); - for (ImageGalleryItem item : imageGalleryItemList) { - if (item.getUid().equals(imageGalleryItemUid)) { - item.setComplete(true); - break; + // check for allowed format : gif, png, jpg + if (itemForm.getFile() != null) { + String contentType = itemForm.getFile().getContentType(); + if (StringUtils.isEmpty(contentType) + || !(contentType.equals("image/gif") || contentType.equals("image/png") + || contentType.equals("image/jpg") || contentType.equals("image/jpeg") || contentType + .equals("image/pjpeg"))) { + errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage( + ImageGalleryConstants.ERROR_MSG_NOT_ALLOWED_FORMAT)); } } + + return errors; } } Index: lams_tool_images/web/common/headerWithoutPrototype.jsp =================================================================== diff -u --- lams_tool_images/web/common/headerWithoutPrototype.jsp (revision 0) +++ lams_tool_images/web/common/headerWithoutPrototype.jsp (revision 4b9aac6879339e46cb0a163a8f72400aed80c041) @@ -0,0 +1,16 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + + + + + + + Index: lams_tool_images/web/includes/css/thickbox.css =================================================================== diff -u --- lams_tool_images/web/includes/css/thickbox.css (revision 0) +++ lams_tool_images/web/includes/css/thickbox.css (revision 4b9aac6879339e46cb0a163a8f72400aed80c041) @@ -0,0 +1,163 @@ +/* ----------------------------------------------------------------------------------------------------------------*/ +/* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/ +/* ----------------------------------------------------------------------------------------------------------------*/ +*{padding: 0; margin: 0;} + +/* ----------------------------------------------------------------------------------------------------------------*/ +/* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/ +/* ----------------------------------------------------------------------------------------------------------------*/ +#TB_window { + font: 12px Arial, Helvetica, sans-serif; + color: #333333; +} + +#TB_secondLine { + font: 10px Arial, Helvetica, sans-serif; + color:#666666; +} + +#TB_window a:link {color: #666666;} +#TB_window a:visited {color: #666666;} +#TB_window a:hover {color: #000;} +#TB_window a:active {color: #666666;} +#TB_window a:focus{color: #666666;} + +/* ----------------------------------------------------------------------------------------------------------------*/ +/* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/ +/* ----------------------------------------------------------------------------------------------------------------*/ +#TB_overlay { + position: fixed; + z-index:100; + top: 0px; + left: 0px; + height:100%; + width:100%; +} + +.TB_overlayMacFFBGHack {background: url(../images/macFFBgHack.png) repeat;} +.TB_overlayBG { + background-color:#000; + filter:alpha(opacity=75); + -moz-opacity: 0.75; + opacity: 0.75; +} + +* html #TB_overlay { /* ie6 hack */ + position: absolute; + height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'); +} + +#TB_window { + position: fixed; + background: #ffffff; + z-index: 102; + color:#000000; + display:none; + border: 4px solid #525252; + text-align:left; + top:50%; + left:50%; +} + +* html #TB_window { /* ie6 hack */ +position: absolute; +margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); +} + +#TB_window img#TB_Image { + display:block; + margin: 15px 0 0 15px; + border-right: 1px solid #ccc; + border-bottom: 1px solid #ccc; + border-top: 1px solid #666; + border-left: 1px solid #666; +} + +#TB_caption{ + height:25px; + padding:7px 30px 10px 25px; + float:left; +} + +#TB_closeWindow{ + height:25px; + padding:11px 25px 10px 0; + float:right; +} + +#TB_closeAjaxWindow{ + padding:7px 10px 5px 0; + margin-bottom:1px; + text-align:right; + float:right; +} + +#TB_ajaxWindowTitle{ + float:left; + padding:7px 0 5px 10px; + margin-bottom:1px; +} + +#TB_title{ + background-color:#e8e8e8; + height:27px; +} + +#TB_ajaxContent{ + clear:both; + padding:2px 15px 15px 15px; + overflow:auto; + text-align:left; + line-height:1.4em; +} + +#TB_ajaxContent.TB_modal{ + padding:15px; +} + +#TB_ajaxContent p{ + padding:5px 0px 5px 0px; +} + +#TB_load{ + position: fixed; + display:none; + height:13px; + width:208px; + z-index:103; + top: 50%; + left: 50%; + margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */ +} + +* html #TB_load { /* ie6 hack */ +position: absolute; +margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); +} + +#TB_HideSelect{ + z-index:99; + position:fixed; + top: 0; + left: 0; + background-color:#fff; + border:none; + filter:alpha(opacity=0); + -moz-opacity: 0; + opacity: 0; + height:100%; + width:100%; +} + +* html #TB_HideSelect { /* ie6 hack */ + position: absolute; + height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'); +} + +#TB_iframeContent{ + clear:both; + border:none; + margin-bottom:-1px; + margin-top:1px; + _margin-bottom:1px; +} Index: lams_tool_images/web/includes/images/loadingAnimation.gif =================================================================== diff -u Binary files differ Index: lams_tool_images/web/includes/images/macFFBgHack.png =================================================================== diff -u Binary files differ Index: lams_tool_images/web/includes/javascript/thickbox.js =================================================================== diff -u --- lams_tool_images/web/includes/javascript/thickbox.js (revision 0) +++ lams_tool_images/web/includes/javascript/thickbox.js (revision 4b9aac6879339e46cb0a163a8f72400aed80c041) @@ -0,0 +1,319 @@ +/* + * Thickbox 3.1 - One Box To Rule Them All. + * By Cody Lindley (http://www.codylindley.com) + * Copyright (c) 2007 cody lindley + * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php +*/ + +var tb_pathToImage = pathToImageFolder + "loadingAnimation.gif"; + +/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/ + +//on page load call tb_init +$(document).ready(function(){ + tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox + imgLoader = new Image();// preload image + imgLoader.src = tb_pathToImage; +}); + +//add thickbox to href & area elements that have a class of .thickbox +function tb_init(domChunk){ + $(domChunk).click(function(){ + var t = this.title || this.name || null; + var a = this.href || this.alt; + var g = this.rel || false; + tb_show(t,a,g); + this.blur(); + return false; + }); +} + +function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link + + try { + if (typeof document.body.style.maxHeight === "undefined") {//if IE 6 + $("body","html").css({height: "100%", width: "100%"}); + $("html").css("overflow","hidden"); + if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6 + $("body").append("
"); + $("#TB_overlay").click(tb_remove); + } + }else{//all others + if(document.getElementById("TB_overlay") === null){ + $("body").append("
"); + $("#TB_overlay").click(tb_remove); + } + } + + if(tb_detectMacXFF()){ + $("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash + }else{ + $("#TB_overlay").addClass("TB_overlayBG");//use background and opacity + } + + if(caption===null){caption="";} + $("body").append("
");//add loader to the page + $('#TB_load').show();//show loader + + var baseURL; + if(url.indexOf("?")!==-1){ //ff there is a query string involved + baseURL = url.substr(0, url.indexOf("?")); + }else{ + baseURL = url; + } + + var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/; + var urlType = baseURL.toLowerCase().match(urlString); + + if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images + + TB_PrevCaption = ""; + TB_PrevURL = ""; + TB_PrevHTML = ""; + TB_NextCaption = ""; + TB_NextURL = ""; + TB_NextHTML = ""; + TB_imageCount = ""; + TB_FoundURL = false; + if(imageGroup){ + TB_TempArray = $("a[@rel="+imageGroup+"]").get(); + for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) { + var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString); + if (!(TB_TempArray[TB_Counter].href == url)) { + if (TB_FoundURL) { + TB_NextCaption = TB_TempArray[TB_Counter].title; + TB_NextURL = TB_TempArray[TB_Counter].href; + TB_NextHTML = "  Next >"; + } else { + TB_PrevCaption = TB_TempArray[TB_Counter].title; + TB_PrevURL = TB_TempArray[TB_Counter].href; + TB_PrevHTML = "  < Prev"; + } + } else { + TB_FoundURL = true; + TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length); + } + } + } + + imgPreloader = new Image(); + imgPreloader.onload = function(){ + imgPreloader.onload = null; + + // Resizing large images - orginal by Christian Montoya edited by me. + var pagesize = tb_getPageSize(); + var x = pagesize[0] - 150; + var y = pagesize[1] - 150; + var imageWidth = imgPreloader.width; + var imageHeight = imgPreloader.height; + if (imageWidth > x) { + imageHeight = imageHeight * (x / imageWidth); + imageWidth = x; + if (imageHeight > y) { + imageWidth = imageWidth * (y / imageHeight); + imageHeight = y; + } + } else if (imageHeight > y) { + imageWidth = imageWidth * (y / imageHeight); + imageHeight = y; + if (imageWidth > x) { + imageHeight = imageHeight * (x / imageWidth); + imageWidth = x; + } + } + // End Resizing + + TB_WIDTH = imageWidth + 30; + TB_HEIGHT = imageHeight + 60; + $("#TB_window").append(""+caption+"" + "
"+caption+"
" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "
close or Esc Key
"); + + $("#TB_closeWindowButton").click(tb_remove); + + if (!(TB_PrevHTML === "")) { + function goPrev(){ + if($(document).unbind("click",goPrev)){$(document).unbind("click",goPrev);} + $("#TB_window").remove(); + $("body").append("
"); + tb_show(TB_PrevCaption, TB_PrevURL, imageGroup); + return false; + } + $("#TB_prev").click(goPrev); + } + + if (!(TB_NextHTML === "")) { + function goNext(){ + $("#TB_window").remove(); + $("body").append("
"); + tb_show(TB_NextCaption, TB_NextURL, imageGroup); + return false; + } + $("#TB_next").click(goNext); + + } + + document.onkeydown = function(e){ + if (e == null) { // ie + keycode = event.keyCode; + } else { // mozilla + keycode = e.which; + } + if(keycode == 27){ // close + tb_remove(); + } else if(keycode == 190){ // display previous image + if(!(TB_NextHTML == "")){ + document.onkeydown = ""; + goNext(); + } + } else if(keycode == 188){ // display next image + if(!(TB_PrevHTML == "")){ + document.onkeydown = ""; + goPrev(); + } + } + }; + + tb_position(); + $("#TB_load").remove(); + $("#TB_ImageOff").click(tb_remove); + $("#TB_window").css({display:"block"}); //for safari using css instead of show + }; + + imgPreloader.src = url; + }else{//code to show html + + var queryString = url.replace(/^[^\?]+\??/,''); + var params = tb_parseQuery( queryString ); + + TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL + TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL + ajaxContentW = TB_WIDTH - 30; + ajaxContentH = TB_HEIGHT - 45; + + if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window + urlNoQuery = url.split('TB_'); + $("#TB_iframeContent").remove(); + if(params['modal'] != "true"){//iframe no modal + $("#TB_window").append("
"+caption+"
close or Esc Key
"); + }else{//iframe modal + $("#TB_overlay").unbind(); + $("#TB_window").append(""); + } + }else{// not an iframe, ajax + if($("#TB_window").css("display") != "block"){ + if(params['modal'] != "true"){//ajax no modal + $("#TB_window").append("
"+caption+"
close or Esc Key
"); + }else{//ajax modal + $("#TB_overlay").unbind(); + $("#TB_window").append("
"); + } + }else{//this means the window is already up, we are just loading new content via ajax + $("#TB_ajaxContent")[0].style.width = ajaxContentW +"px"; + $("#TB_ajaxContent")[0].style.height = ajaxContentH +"px"; + $("#TB_ajaxContent")[0].scrollTop = 0; + $("#TB_ajaxWindowTitle").html(caption); + } + } + + $("#TB_closeWindowButton").click(tb_remove); + + if(url.indexOf('TB_inline') != -1){ + $("#TB_ajaxContent").append($('#' + params['inlineId']).children()); + $("#TB_window").unload(function () { + $('#' + params['inlineId']).append( $("#TB_ajaxContent").children() ); // move elements back when you're finished + }); + tb_position(); + $("#TB_load").remove(); + $("#TB_window").css({display:"block"}); + }else if(url.indexOf('TB_iframe') != -1){ + tb_position(); + if($.browser.safari){//safari needs help because it will not fire iframe onload + $("#TB_load").remove(); + $("#TB_window").css({display:"block"}); + } + }else{ + $("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method + tb_position(); + $("#TB_load").remove(); + tb_init("#TB_ajaxContent a.thickbox"); + $("#TB_window").css({display:"block"}); + }); + } + + } + + if(!params['modal']){ + document.onkeyup = function(e){ + if (e == null) { // ie + keycode = event.keyCode; + } else { // mozilla + keycode = e.which; + } + if(keycode == 27){ // close + tb_remove(); + } + }; + } + + } catch(e) { + //nothing here + } +} + +//helper functions below +function tb_showIframe(){ + $("#TB_load").remove(); + $("#TB_window").css({display:"block"}); +} + +function tb_remove() { + $("#TB_imageOff").unbind("click"); + $("#TB_closeWindowButton").unbind("click"); + $("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();}); + $("#TB_load").remove(); + if (typeof document.body.style.maxHeight == "undefined") {//if IE 6 + $("body","html").css({height: "auto", width: "auto"}); + $("html").css("overflow",""); + } + document.onkeydown = ""; + document.onkeyup = ""; + return false; +} + +function tb_position() { +$("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'}); + if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6 + $("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'}); + } +} + +function tb_parseQuery ( query ) { + var Params = {}; + if ( ! query ) {return Params;}// return empty object + var Pairs = query.split(/[;&]/); + for ( var i = 0; i < Pairs.length; i++ ) { + var KeyVal = Pairs[i].split('='); + if ( ! KeyVal || KeyVal.length != 2 ) {continue;} + var key = unescape( KeyVal[0] ); + var val = unescape( KeyVal[1] ); + val = val.replace(/\+/g, ' '); + Params[key] = val; + } + return Params; +} + +function tb_getPageSize(){ + var de = document.documentElement; + var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; + var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight; + arrayPageSize = [w,h]; + return arrayPageSize; +} + +function tb_detectMacXFF() { + var userAgent = navigator.userAgent.toLowerCase(); + if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) { + return true; + } +} + + Index: lams_tool_images/web/pages/authoring/parts/addfile.jsp =================================================================== diff -u -r2ded08a63789390122f15ab1c3c70075ed0d2a2e -r4b9aac6879339e46cb0a163a8f72400aed80c041 --- lams_tool_images/web/pages/authoring/parts/addfile.jsp (.../addfile.jsp) (revision 2ded08a63789390122f15ab1c3c70075ed0d2a2e) +++ lams_tool_images/web/pages/authoring/parts/addfile.jsp (.../addfile.jsp) (revision 4b9aac6879339e46cb0a163a8f72400aed80c041) @@ -1,6 +1,8 @@ - + <%@ include file="/common/taglibs.jsp"%> + <%@ include file="/common/header.jsp"%> Fisheye: Tag 4b9aac6879339e46cb0a163a8f72400aed80c041 refers to a dead (removed) revision in file `lams_tool_images/web/pages/learning/addimage.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_images/web/pages/learning/learning.jsp =================================================================== diff -u -r5d9ada1b3b139591dc6f1fffec04990beb727522 -r4b9aac6879339e46cb0a163a8f72400aed80c041 --- lams_tool_images/web/pages/learning/learning.jsp (.../learning.jsp) (revision 5d9ada1b3b139591dc6f1fffec04990beb727522) +++ lams_tool_images/web/pages/learning/learning.jsp (.../learning.jsp) (revision 4b9aac6879339e46cb0a163a8f72400aed80c041) @@ -4,7 +4,8 @@ <%@ include file="/common/taglibs.jsp"%> - <fmt:message key="label.learning.title" /> + <title> + <fmt:message key="label.learning.title" /> <%@ include file="/common/header.jsp"%> @@ -22,6 +23,7 @@ + - - + + + + +