Index: lams_tool_images/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -rd135b890fdc2d5b58c6bd02c48c8b3365d9a2ffe -r4b47f86b588e38c9e7e9f2760c75f775cb080831 --- lams_tool_images/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d135b890fdc2d5b58c6bd02c48c8b3365d9a2ffe) +++ lams_tool_images/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 4b47f86b588e38c9e7e9f2760c75f775cb080831) @@ -98,6 +98,9 @@ label.monitoring.updatecomment.save =Save label.monitoring.updatecomment.posted.by =Posted by label.monitoring.updatecomment.posted.on =Posted on +label.export.uploaded.by =Uploaded by +label.export.voted.for.this.image =Voted for this image +label.export.images =Images message.monitoring.edit.activity.not.editable =This Activity is no longer editable output.desc.learner.number.of.images.uploaded =Number of images uploaded by user output.desc.learner.number.of.comments =Number of comments posted by user Index: lams_tool_images/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -rd135b890fdc2d5b58c6bd02c48c8b3365d9a2ffe -r4b47f86b588e38c9e7e9f2760c75f775cb080831 --- lams_tool_images/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision d135b890fdc2d5b58c6bd02c48c8b3365d9a2ffe) +++ lams_tool_images/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 4b47f86b588e38c9e7e9f2760c75f775cb080831) @@ -98,6 +98,9 @@ label.monitoring.updatecomment.save =Save label.monitoring.updatecomment.posted.by =Posted by label.monitoring.updatecomment.posted.on =Posted on +label.export.uploaded.by =Uploaded by +label.export.voted.for.this.image =Voted for this image +label.export.images =Images message.monitoring.edit.activity.not.editable =This Activity is no longer editable output.desc.learner.number.of.images.uploaded =Number of images uploaded by user output.desc.learner.number.of.comments =Number of comments posted by user Index: lams_tool_images/conf/language/rams/ApplicationResources.properties =================================================================== diff -u -rd135b890fdc2d5b58c6bd02c48c8b3365d9a2ffe -r4b47f86b588e38c9e7e9f2760c75f775cb080831 --- lams_tool_images/conf/language/rams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d135b890fdc2d5b58c6bd02c48c8b3365d9a2ffe) +++ lams_tool_images/conf/language/rams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 4b47f86b588e38c9e7e9f2760c75f775cb080831) @@ -98,6 +98,9 @@ label.monitoring.updatecomment.save =Save label.monitoring.updatecomment.posted.by =Posted by label.monitoring.updatecomment.posted.on =Posted on +label.export.uploaded.by =Uploaded by +label.export.voted.for.this.image =Voted for this image +label.export.images =Images message.monitoring.edit.activity.not.editable =This Activity is no longer editable output.desc.learner.number.of.images.uploaded =Number of images uploaded by user output.desc.learner.number.of.comments =Number of comments posted by user Index: lams_tool_images/conf/language/rams/ApplicationResources_en_AU.properties =================================================================== diff -u -rd135b890fdc2d5b58c6bd02c48c8b3365d9a2ffe -r4b47f86b588e38c9e7e9f2760c75f775cb080831 --- lams_tool_images/conf/language/rams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision d135b890fdc2d5b58c6bd02c48c8b3365d9a2ffe) +++ lams_tool_images/conf/language/rams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 4b47f86b588e38c9e7e9f2760c75f775cb080831) @@ -98,6 +98,9 @@ label.monitoring.updatecomment.save =Save label.monitoring.updatecomment.posted.by =Posted by label.monitoring.updatecomment.posted.on =Posted on +label.export.uploaded.by =Uploaded by +label.export.voted.for.this.image =Voted for this image +label.export.images =Images message.monitoring.edit.activity.not.editable =This Activity is no longer editable output.desc.learner.number.of.images.uploaded =Number of images uploaded by user output.desc.learner.number.of.comments =Number of comments posted by user Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryServiceImpl.java =================================================================== diff -u -rd135b890fdc2d5b58c6bd02c48c8b3365d9a2ffe -r4b47f86b588e38c9e7e9f2760c75f775cb080831 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryServiceImpl.java (.../ImageGalleryServiceImpl.java) (revision d135b890fdc2d5b58c6bd02c48c8b3365d9a2ffe) +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryServiceImpl.java (.../ImageGalleryServiceImpl.java) (revision 4b47f86b588e38c9e7e9f2760c75f775cb080831) @@ -557,41 +557,42 @@ return null; } - //imageList-->sessionList-->contributionList + //sessionList-->imageList-->contributionList ImageGallery imageGallery = session.getImageGallery(); - List>> imageList = new ArrayList(); + List>> sessionList = new ArrayList(); + List> imageList = new ArrayList(); + sessionList.add(imageList); - Set dbImages = imageGallery.getImageGalleryItems(); + Set dbImages = new TreeSet(new ImageGalleryItemComparator()); + dbImages.addAll(getImagesForGroup(imageGallery, session.getSessionId())); for (ImageGalleryItem image : dbImages) { if (skipHide && image.isHide()) { continue; } - List> sessionList = new ArrayList(); - List userContributionList = new ArrayList(); Object[] ratingForGroup = getRatingForGroup(image.getUid(), session.getSessionId()); UserImageContributionDTO userContribution = createUserContribution(image, user, session, ratingForGroup); userContribution.setImage(image); userContributionList.add(userContribution); - sessionList.add(userContributionList); - imageList.add(sessionList); + imageList.add(userContributionList); } - return imageList; + return sessionList; } public List>> exportByContentId(Long contentId) { ImageGallery imageGallery = imageGalleryDao.getByContentId(contentId); - List>> imageList = new ArrayList(); + List>> sessionList = new ArrayList(); - Set dbImages = imageGallery.getImageGalleryItems(); - for (ImageGalleryItem image : dbImages) { + List imageGallerySessionList = imageGallerySessionDao.getByContentId(contentId); + for(ImageGallerySession imageSession : imageGallerySessionList) { - List> sessionList = new ArrayList(); - List imageGallerySessionList = imageGallerySessionDao.getByContentId(contentId); - for(ImageGallerySession imageSession : imageGallerySessionList) { + List> imageList = new ArrayList(); + Set dbImages = new TreeSet(new ImageGalleryItemComparator()); + dbImages.addAll(imageGallery.getImageGalleryItems()); + for (ImageGalleryItem image : dbImages) { List userContributionList = new ArrayList(); Object[] ratingForGroup = getRatingForGroup(image.getUid(), imageSession.getSessionId()); @@ -601,14 +602,14 @@ userContribution.setImage(image); userContributionList.add(userContribution); } - sessionList.add(userContributionList); + imageList.add(userContributionList); } - imageList.add(sessionList); + sessionList.add(imageList); } - return imageList; + return sessionList; } public void uploadImageGalleryItemFile(ImageGalleryItem image, FormFile file) Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/util/ImageGalleryBundler.java =================================================================== diff -u --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/util/ImageGalleryBundler.java (revision 0) +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/util/ImageGalleryBundler.java (revision 4b47f86b588e38c9e7e9f2760c75f775cb080831) @@ -0,0 +1,119 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +/* $Id$ */ +package org.lamsfoundation.lams.tool.imageGallery.util; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.MalformedURLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; + +import org.lamsfoundation.lams.learning.export.web.action.Bundler; +import org.lamsfoundation.lams.tool.imageGallery.ImageGalleryConstants; +import org.lamsfoundation.lams.util.Configuration; +import org.lamsfoundation.lams.util.ConfigurationKeys; +import org.lamsfoundation.lams.util.HttpUrlConnectionUtil; + +public class ImageGalleryBundler extends Bundler { + + public ImageGalleryBundler() { + } + + /** + * This method bundles the files to the given output dir + * + * @param request + * the request for the export + * @param cookies + * cookies for the request + * @param outputDirectory + * the location where the files should be written + * @throws Exception + */ + public void bundle(HttpServletRequest request, Cookie[] cookies, String outputDirectory) throws Exception { + bundleViaHTTP(request, cookies, outputDirectory); + } + + /** + * See bundle + * + * @param request + * @param cookies + * @param outputDirectory + * @throws MalformedURLException + * @throws FileNotFoundException + * @throws IOException + */ + private void bundleViaHTTP(HttpServletRequest request, Cookie[] cookies, String outputDirectory) + throws MalformedURLException, FileNotFoundException, IOException { + + String[] directoriesNames = { "css", "javascript", "images"}; + + List directories = new ArrayList(); + for (String directoryName : directoriesNames) { + directories.add(outputDirectory + File.separator + directoryName); + } + this.createDirectories(directories); + + String urlToConnectTo = getImagesUrlDir() + File.separator + "javascript" + File.separator + "jquery.rating.1.1.js"; + String directoryToStoreFile = outputDirectory + File.separator + "javascript"; + HttpUrlConnectionUtil.writeResponseToFile(urlToConnectTo, directoryToStoreFile, "jquery.rating.1.1.js", cookies); + log.debug("Copying image from source: " + urlToConnectTo + "to desitnation: " + directoryToStoreFile); + + urlToConnectTo = getImagesUrlDir() + File.separator + "javascript" + File.separator + "jquery-1.2.6.pack.js"; + directoryToStoreFile = outputDirectory + File.separator + "javascript"; + HttpUrlConnectionUtil.writeResponseToFile(urlToConnectTo, directoryToStoreFile, "jquery-1.2.6.pack.js", cookies); + log.debug("Copying image from source: " + urlToConnectTo + "to desitnation: " + directoryToStoreFile); + + urlToConnectTo = getImagesUrlDir() + File.separator + "css" + File.separator + "jquery.rating.css"; + directoryToStoreFile = outputDirectory + File.separator + "css"; + HttpUrlConnectionUtil.writeResponseToFile(urlToConnectTo, directoryToStoreFile, "jquery.rating.css", cookies); + log.debug("Copying image from source: " + urlToConnectTo + "to desitnation: " + directoryToStoreFile); + + urlToConnectTo = getImagesUrlDir() + File.separator + "images" + File.separator + "star.gif"; + directoryToStoreFile = outputDirectory + File.separator + "images"; + HttpUrlConnectionUtil.writeResponseToFile(urlToConnectTo, directoryToStoreFile, "star.gif", cookies); + log.debug("Copying image from source: " + urlToConnectTo + "to desitnation: " + directoryToStoreFile); + + } + + private String getImagesUrlDir() { + String imageGalleryUrlPath = Configuration.get(ConfigurationKeys.SERVER_URL); + if (imageGalleryUrlPath == null) { + log.error("Unable to get path to the LAMS ImageGallery URL from the configuration table. ImageGallery javascript files export failed"); + return ""; + } else { + imageGalleryUrlPath = imageGalleryUrlPath + File.separator + "tool" + File.separator + + ImageGalleryConstants.TOOL_SIGNATURE + File.separator + "includes"; + return imageGalleryUrlPath; + } + } + +} Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/servlet/ExportServlet.java =================================================================== diff -u -r7dac65b89adddab2b602b5d57d8e3ddd4cab2060 -r4b47f86b588e38c9e7e9f2760c75f775cb080831 --- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/servlet/ExportServlet.java (.../ExportServlet.java) (revision 7dac65b89adddab2b602b5d57d8e3ddd4cab2060) +++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/servlet/ExportServlet.java (.../ExportServlet.java) (revision 4b47f86b588e38c9e7e9f2760c75f775cb080831) @@ -55,6 +55,7 @@ import org.lamsfoundation.lams.tool.imageGallery.service.IImageGalleryService; import org.lamsfoundation.lams.tool.imageGallery.service.ImageGalleryException; import org.lamsfoundation.lams.tool.imageGallery.service.ImageGalleryServiceProxy; +import org.lamsfoundation.lams.tool.imageGallery.util.ImageGalleryBundler; import org.lamsfoundation.lams.tool.imageGallery.util.ImageGalleryToolContentHandler; import org.lamsfoundation.lams.tool.imageGallery.util.ReflectDTOComparator; import org.lamsfoundation.lams.util.FileUtil; @@ -109,6 +110,16 @@ String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath(); + + // Attempting to export required images + try { + ImageGalleryBundler imageBundler = new ImageGalleryBundler(); + imageBundler.bundle(request, cookies, directoryName); + } catch (Exception e) { + logger.error( + "Could not export spreadsheet javascript files, some files may be missing in export portfolio", e); + } + writeResponseToFile(basePath + "/pages/export/exportportfolio.jsp?sessionMapID=" + sessionMap.getSessionID(), directoryName, FILENAME, cookies); @@ -180,6 +191,7 @@ sessionMap.put(ImageGalleryConstants.ATTR_REFLECT_LIST, map); } + // put it into HTTPSession sessionMap.put(ImageGalleryConstants.ATTR_RESOURCE, content); sessionMap.put(ImageGalleryConstants.ATTR_TITLE, content.getTitle()); sessionMap.put(ImageGalleryConstants.ATTR_INSTRUCTIONS, content.getInstructions()); @@ -230,11 +242,11 @@ * @param directoryName * @throws IOException */ - private void saveFileToLocal(List>> exportImageList, String directoryName) { + private void saveFileToLocal(List>> sessionList, String directoryName) { handler = getToolContentHandler(); - for (List> sessionList : exportImageList) { - for (List userContributionList : sessionList) { + for (List> imageList : sessionList) { + for (List userContributionList : imageList) { for (UserImageContributionDTO userContribution : userContributionList) { try { ImageGalleryItem image = userContribution.getImage(); @@ -250,17 +262,17 @@ } idx++; } - image.setAttachmentLocalUrl(userName + "/" + idx + "/" + image.getThumbnailFileUuid() + '.' + image.setAttachmentLocalUrl(userName + "/" + idx + "/" + image.getMediumFileUuid() + '.' + FileUtil.getFileExtension(image.getFileName())); - handler.saveFile(image.getThumbnailFileUuid(), FileUtil.getFullPath(directoryName, image + handler.saveFile(image.getMediumFileUuid(), FileUtil.getFullPath(directoryName, image .getAttachmentLocalUrl())); } catch (Exception e) { logger.error("Export forum topic attachment failed: " + e.toString()); } break; } - break; } + break; } } Fisheye: Tag 4b47f86b588e38c9e7e9f2760c75f775cb080831 refers to a dead (removed) revision in file `lams_tool_images/web/pages/export/exportimage.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_images/web/pages/export/exportimagelearner.jsp =================================================================== diff -u --- lams_tool_images/web/pages/export/exportimagelearner.jsp (revision 0) +++ lams_tool_images/web/pages/export/exportimagelearner.jsp (revision 4b47f86b588e38c9e7e9f2760c75f775cb080831) @@ -0,0 +1,92 @@ + + +
+ + + + + + + + + + + + + + + + +
colspan="2" + > +

+ +

+
+

+ : +

+
+

+ +

+
+
+ + + +
+ + checked = 'checked' + /> + +
+

+ ${userContribution.numberRatings} + +

+
+ + + : ${userContribution.votedForThisImage} +
+
+
+ +
+
+ +
+
+ + +
+ + + + + + + + + +
+ + + ${author} + - + +
+ +
+
+
+ +
+
+ +
+
\ No newline at end of file Index: lams_tool_images/web/pages/export/exportimageteacher.jsp =================================================================== diff -u --- lams_tool_images/web/pages/export/exportimageteacher.jsp (revision 0) +++ lams_tool_images/web/pages/export/exportimageteacher.jsp (revision 4b47f86b588e38c9e7e9f2760c75f775cb080831) @@ -0,0 +1,142 @@ + + + +

+ ${userContribution2.sessionName} +

+ +
+ + + + + + + + + + + + + + + + +
colspan="2" + > +

+ +

+
+

+ : +

+
+

+ +

+
+
+ + + +
+ + checked = 'checked' + /> + +
+

+ ${userContribution.numberRatings} + +

+
+ + + : ${userContribution.numberOfVotesForImage} +
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ ${userContribution.user.loginName} + + + + + + + + + + + + ${userContribution.rating} + + +
    + +
  • + +
  • +
    +
+ +
+ +

+
+
\ No newline at end of file Index: lams_tool_images/web/pages/export/exportportfolio.jsp =================================================================== diff -u -r7dac65b89adddab2b602b5d57d8e3ddd4cab2060 -r4b47f86b588e38c9e7e9f2760c75f775cb080831 --- lams_tool_images/web/pages/export/exportportfolio.jsp (.../exportportfolio.jsp) (revision 7dac65b89adddab2b602b5d57d8e3ddd4cab2060) +++ lams_tool_images/web/pages/export/exportportfolio.jsp (.../exportportfolio.jsp) (revision 4b47f86b588e38c9e7e9f2760c75f775cb080831) @@ -4,7 +4,7 @@ - + @@ -14,6 +14,18 @@ + + + + + + @@ -23,16 +35,27 @@

${title}

+ +

${instructions}

- - +
- <%@ include file="exportimage.jsp"%> + + + <%@ include file="exportimagelearner.jsp"%> + + + + + <%@ include file="exportimageteacher.jsp"%> + + +