Index: lams_tool_images/conf/language/lams/ApplicationResources.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/conf/language/lams/ApplicationResources.properties,v
diff -u -r1.4 -r1.5
--- lams_tool_images/conf/language/lams/ApplicationResources.properties 11 Dec 2008 12:37:40 -0000 1.4
+++ lams_tool_images/conf/language/lams/ApplicationResources.properties 12 Dec 2008 15:31:28 -0000 1.5
@@ -59,7 +59,6 @@
label.learning.average.rating =Average rating :
label.learning.vote.here =Vote here
label.learning.unvote =Unvote
-label.learning.already.voted =Already voted
label.learning.add.comment =Add comment
label.learning.post =Post
label.learning.by =By
Index: lams_tool_images/conf/language/lams/ApplicationResources_en_AU.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/conf/language/lams/ApplicationResources_en_AU.properties,v
diff -u -r1.14 -r1.15
--- lams_tool_images/conf/language/lams/ApplicationResources_en_AU.properties 11 Dec 2008 12:37:40 -0000 1.14
+++ lams_tool_images/conf/language/lams/ApplicationResources_en_AU.properties 12 Dec 2008 15:31:28 -0000 1.15
@@ -59,7 +59,6 @@
label.learning.average.rating =Average rating :
label.learning.vote.here =Vote here
label.learning.unvote =Unvote
-label.learning.already.voted =Already voted
label.learning.add.comment =Add comment
label.learning.post =Post
label.learning.by =By
Index: lams_tool_images/conf/language/rams/ApplicationResources.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/conf/language/rams/Attic/ApplicationResources.properties,v
diff -u -r1.4 -r1.5
--- lams_tool_images/conf/language/rams/ApplicationResources.properties 11 Dec 2008 12:37:40 -0000 1.4
+++ lams_tool_images/conf/language/rams/ApplicationResources.properties 12 Dec 2008 15:31:28 -0000 1.5
@@ -59,7 +59,6 @@
label.learning.average.rating =Average rating :
label.learning.vote.here =Vote here
label.learning.unvote =Unvote
-label.learning.already.voted =Already voted
label.learning.add.comment =Add comment
label.learning.post =Post
label.learning.by =By
Index: lams_tool_images/conf/language/rams/ApplicationResources_en_AU.properties
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/conf/language/rams/Attic/ApplicationResources_en_AU.properties,v
diff -u -r1.4 -r1.5
--- lams_tool_images/conf/language/rams/ApplicationResources_en_AU.properties 11 Dec 2008 12:37:40 -0000 1.4
+++ lams_tool_images/conf/language/rams/ApplicationResources_en_AU.properties 12 Dec 2008 15:31:28 -0000 1.5
@@ -59,7 +59,6 @@
label.learning.average.rating =Average rating :
label.learning.vote.here =Vote here
label.learning.unvote =Unvote
-label.learning.already.voted =Already voted
label.learning.add.comment =Add comment
label.learning.post =Post
label.learning.by =By
Index: lams_tool_images/db/sql/create_lams_tool_imageGallery.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/db/sql/create_lams_tool_imageGallery.sql,v
diff -u -r1.9 -r1.10
--- lams_tool_images/db/sql/create_lams_tool_imageGallery.sql 10 Dec 2008 14:53:03 -0000 1.9
+++ lams_tool_images/db/sql/create_lams_tool_imageGallery.sql 12 Dec 2008 15:31:28 -0000 1.10
@@ -4,6 +4,7 @@
drop table if exists tl_laimag10_imageGallery_item;
drop table if exists tl_laimag10_image_comment;
drop table if exists tl_laimag10_image_rating;
+drop table if exists tl_laimag10_image_vote;
drop table if exists tl_laimag10_imageGallery_item_visit_log;
drop table if exists tl_laimag10_session;
drop table if exists tl_laimag10_user;
@@ -82,6 +83,13 @@
create_by bigint,
primary key (uid)
)TYPE=InnoDB;
+create table tl_laimag10_image_vote (
+ uid bigint not null auto_increment,
+ is_voted tinyint,
+ imageGallery_item_uid bigint,
+ create_by bigint,
+ primary key (uid)
+)TYPE=InnoDB;
create table tl_laimag10_item_log (
uid bigint not null auto_increment,
access_date datetime,
@@ -110,7 +118,6 @@
session_finished smallint,
session_uid bigint,
imageGallery_uid bigint,
- voted_image_uid bigint DEFAULT 0,
primary key (uid)
)type=innodb;
create table tl_laimag10_configuration (
@@ -129,6 +136,8 @@
alter table tl_laimag10_image_comment add index FK_tl_laimag10_image_comment_2 (create_by), add constraint FK_tl_laimag10_image_comment_2 foreign key (create_by) references tl_laimag10_user (uid);
alter table tl_laimag10_image_rating add index FK_tl_laimag10_image_rating_3 (imageGallery_item_uid), add constraint FK_tl_laimag10_image_rating_3 foreign key (imageGallery_item_uid) references tl_laimag10_imageGallery_item (uid);
alter table tl_laimag10_image_rating add index FK_tl_laimag10_image_rating_2 (create_by), add constraint FK_tl_laimag10_image_rating_2 foreign key (create_by) references tl_laimag10_user (uid);
+alter table tl_laimag10_image_vote add index FK_tl_laimag10_image_vote_3 (imageGallery_item_uid), add constraint FK_tl_laimag10_image_vote_3 foreign key (imageGallery_item_uid) references tl_laimag10_imageGallery_item (uid);
+alter table tl_laimag10_image_vote add index FK_tl_laimag10_image_vote_2 (create_by), add constraint FK_tl_laimag10_image_vote_2 foreign key (create_by) references tl_laimag10_user (uid);
alter table tl_laimag10_item_log add index FK_NEW_1821149711_693580A438BF8DFE (imageGallery_item_uid), add constraint FK_NEW_1821149711_693580A438BF8DFE foreign key (imageGallery_item_uid) references tl_laimag10_imageGallery_item (uid);
alter table tl_laimag10_item_log add index FK_NEW_1821149711_693580A441F9365D (user_uid), add constraint FK_NEW_1821149711_693580A441F9365D foreign key (user_uid) references tl_laimag10_user (uid);
alter table tl_laimag10_session add index FK_NEW_1821149711_24AA78C530E79035 (imageGallery_uid), add constraint FK_NEW_1821149711_24AA78C530E79035 foreign key (imageGallery_uid) references tl_laimag10_imageGallery (uid);
Index: lams_tool_images/db/sql/table-schema.sql
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/db/sql/table-schema.sql,v
diff -u -r1.9 -r1.10
--- lams_tool_images/db/sql/table-schema.sql 10 Dec 2008 14:53:03 -0000 1.9
+++ lams_tool_images/db/sql/table-schema.sql 12 Dec 2008 15:31:28 -0000 1.10
@@ -9,6 +9,8 @@
alter table tl_laimag10_image_comment drop foreign key FK_tl_laimag10_image_comment_3;
alter table tl_laimag10_image_rating drop foreign key FK_tl_laimag10_image_rating_2;
alter table tl_laimag10_image_rating drop foreign key FK_tl_laimag10_image_rating_3;
+alter table tl_laimag10_image_vote drop foreign key FK_tl_laimag10_image_vote_2;
+alter table tl_laimag10_image_vote drop foreign key FK_tl_laimag10_image_vote_3;
alter table tl_laimag10_session drop foreign key FK_NEW_1821149711_24AA78C530E79035;
alter table tl_laimag10_user drop foreign key FK_NEW_1821149711_30113BFC30E79035;
alter table tl_laimag10_user drop foreign key FK_NEW_1821149711_30113BFCEC0D3147;
@@ -18,6 +20,7 @@
drop table if exists tl_laimag10_imageGallery_item;
drop table if exists tl_laimag10_image_comment;
drop table if exists tl_laimag10_image_rating;
+drop table if exists tl_laimag10_image_vote;
drop table if exists tl_laimag10_session;
drop table if exists tl_laimag10_user;
drop table if exists tl_laimag10_configuration;
@@ -27,8 +30,9 @@
create table tl_laimag10_imageGallery_item (uid bigint not null auto_increment, description text, title varchar(255), create_by bigint, create_date datetime, create_by_author bit, sequence_id integer, is_hide bit, imageGallery_uid bigint, session_uid bigint, original_file_uuid bigint, original_image_width integer, original_image_height integer, medium_file_uuid bigint, medium_image_width integer, medium_image_height integer, thumbnail_file_uuid bigint, file_version_id bigint, file_type varchar(255), file_name varchar(255), average_rating FLOAT(7,1) DEFAULT 0, number_ratings integer DEFAULT 0, primary key (uid));
create table tl_laimag10_image_comment (uid bigint not null auto_increment, comment text, imageGallery_item_uid bigint, create_by bigint, create_date datetime, primary key (uid));
create table tl_laimag10_image_rating (uid bigint not null auto_increment, rating integer, imageGallery_item_uid bigint, create_by bigint, primary key (uid));
+create table tl_laimag10_image_vote (uid bigint not null auto_increment, is_voted bit, imageGallery_item_uid bigint, create_by bigint, primary key (uid));
create table tl_laimag10_session (uid bigint not null auto_increment, session_end_date datetime, session_start_date datetime, status integer, imageGallery_uid bigint, session_id bigint, session_name varchar(250), primary key (uid));
-create table tl_laimag10_user (uid bigint not null auto_increment, user_id bigint, last_name varchar(255), first_name varchar(255), login_name varchar(255), session_uid bigint, imageGallery_uid bigint, session_finished bit, voted_image_uid bigint DEFAULT 0, primary key (uid));
+create table tl_laimag10_user (uid bigint not null auto_increment, user_id bigint, last_name varchar(255), first_name varchar(255), login_name varchar(255), session_uid bigint, imageGallery_uid bigint, session_finished bit, primary key (uid));
create table tl_laimag10_configuration (uid bigint not null auto_increment, config_key varchar(30) unique, config_value varchar(255), primary key (uid));
alter table tl_laimag10_attachment add index FK_NEW_1821149711_1E7009430E79035 (imageGallery_uid), add constraint FK_NEW_1821149711_1E7009430E79035 foreign key (imageGallery_uid) references tl_laimag10_imageGallery (uid);
alter table tl_laimag10_item_log add index FK_NEW_1821149711_63195BC938BF8DFE (imageGallery_item_uid), add constraint FK_NEW_1821149711_63195BC938BF8DFE foreign key (imageGallery_item_uid) references tl_laimag10_imageGallery_item (uid);
@@ -41,6 +45,8 @@
alter table tl_laimag10_image_comment add index FK_tl_laimag10_image_comment_2 (create_by), add constraint FK_tl_laimag10_image_comment_2 foreign key (create_by) references tl_laimag10_user (uid);
alter table tl_laimag10_image_rating add index FK_tl_laimag10_image_rating_3 (imageGallery_item_uid), add constraint FK_tl_laimag10_image_rating_3 foreign key (imageGallery_item_uid) references tl_laimag10_imageGallery_item (uid);
alter table tl_laimag10_image_rating add index FK_tl_laimag10_image_rating_2 (create_by), add constraint FK_tl_laimag10_image_rating_2 foreign key (create_by) references tl_laimag10_user (uid);
+alter table tl_laimag10_image_vote add index FK_tl_laimag10_image_vote_3 (imageGallery_item_uid), add constraint FK_tl_laimag10_image_vote_3 foreign key (imageGallery_item_uid) references tl_laimag10_imageGallery_item (uid);
+alter table tl_laimag10_image_vote add index FK_tl_laimag10_image_vote_2 (create_by), add constraint FK_tl_laimag10_image_vote_2 foreign key (create_by) references tl_laimag10_user (uid);
alter table tl_laimag10_session add index FK_NEW_1821149711_24AA78C530E79035 (imageGallery_uid), add constraint FK_NEW_1821149711_24AA78C530E79035 foreign key (imageGallery_uid) references tl_laimag10_imageGallery (uid);
alter table tl_laimag10_user add index FK_NEW_1821149711_30113BFC30E79035 (imageGallery_uid), add constraint FK_NEW_1821149711_30113BFC30E79035 foreign key (imageGallery_uid) references tl_laimag10_imageGallery (uid);
alter table tl_laimag10_user add index FK_NEW_1821149711_30113BFCEC0D3147 (session_uid), add constraint FK_NEW_1821149711_30113BFCEC0D3147 foreign key (session_uid) references tl_laimag10_session (uid);
Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/ImageGalleryConstants.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/ImageGalleryConstants.java,v
diff -u -r1.11 -r1.12
--- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/ImageGalleryConstants.java 8 Dec 2008 22:56:06 -0000 1.11
+++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/ImageGalleryConstants.java 12 Dec 2008 15:31:28 -0000 1.12
@@ -46,7 +46,7 @@
public static final String PARAM_COMMENTS = "comments";
public static final String PARAM_CURRENT_IMAGE = "currentImage";
public static final String PARAM_CURRENT_RATING = "currentRating";
- public static final String PARAM_VOTED_IMAGE_UID = "votedImageUid";
+ public static final String PARAM_IS_VOTED = "isVoted";
// for request attribute name
public static final String ATTR_TOOL_CONTENT_ID = "toolContentID";
Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/imageGalleryApplicationContext.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/imageGalleryApplicationContext.xml,v
diff -u -r1.5 -r1.6
--- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/imageGalleryApplicationContext.xml 4 Dec 2008 12:01:36 -0000 1.5
+++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/imageGalleryApplicationContext.xml 12 Dec 2008 15:31:28 -0000 1.6
@@ -22,7 +22,8 @@
org/lamsfoundation/lams/tool/imageGallery/model/ImageGallery.hbm.xml
org/lamsfoundation/lams/tool/imageGallery/model/ImageGalleryItem.hbm.xml
org/lamsfoundation/lams/tool/imageGallery/model/ImageComment.hbm.xml
- org/lamsfoundation/lams/tool/imageGallery/model/ImageRating.hbm.xml
+ org/lamsfoundation/lams/tool/imageGallery/model/ImageRating.hbm.xml
+ org/lamsfoundation/lams/tool/imageGallery/model/ImageVote.hbm.xml
org/lamsfoundation/lams/tool/imageGallery/model/ImageGalleryItemVisitLog.hbm.xml
org/lamsfoundation/lams/tool/imageGallery/model/ImageGalleryAttachment.hbm.xml
org/lamsfoundation/lams/tool/imageGallery/model/ImageGallerySession.hbm.xml
@@ -56,6 +57,11 @@
+
+
+
+
+
@@ -105,7 +111,10 @@
-
+
+
+
+
Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dao/ImageGalleryUserDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dao/ImageGalleryUserDAO.java,v
diff -u -r1.2 -r1.3
--- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dao/ImageGalleryUserDAO.java 30 Nov 2008 15:02:59 -0000 1.2
+++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dao/ImageGalleryUserDAO.java 12 Dec 2008 15:31:28 -0000 1.3
@@ -34,6 +34,5 @@
ImageGalleryUser getUserByUserIDAndContentID(Long userId, Long contentId);
List getBySessionID(Long sessionId);
-
- int getNumberOfVotes(Long votedImageUid, Long sessionId);
+
}
Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dao/ImageVoteDAO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dao/ImageVoteDAO.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dao/ImageVoteDAO.java 12 Dec 2008 15:31:28 -0000 1.1
@@ -0,0 +1,65 @@
+/****************************************************************
+ * 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: ImageVoteDAO.java,v 1.1 2008/12/12 15:31:28 andreyb Exp $ */
+package org.lamsfoundation.lams.tool.imageGallery.dao;
+
+import java.util.List;
+
+import org.lamsfoundation.lams.tool.imageGallery.model.ImageVote;
+
+/**
+ * DAO interface for ImageVote
.
+ *
+ * @author Andrey Balan
+ * @see org.lamsfoundation.lams.tool.imageGallery.model.ImageRating
+ */
+public interface ImageVoteDAO extends DAO {
+
+ /**
+ * Return imageVote by the given imageUid and userId.
+ *
+ * @param imageUid
+ * @param userId
+ * @return
+ */
+ public ImageVote getImageVoteByImageAndUser(Long imageUid, Long userId);
+
+ /**
+ * Return number of imageVotes that users have done for this image.
+ *
+ * @param imageUid
+ * @param userId
+ * @return
+ */
+ public int getNumImageVotesByImageUid(Long imageUid, Long sessionId);
+
+ /**
+ * Return number of imageVotes made by user.
+ *
+ * @param userId
+ * @return
+ */
+ public int getNumImageVotesByUserId(Long userId);
+
+}
+
\ No newline at end of file
Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dao/hibernate/ImageGalleryUserDAOHibernate.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dao/hibernate/ImageGalleryUserDAOHibernate.java,v
diff -u -r1.2 -r1.3
--- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dao/hibernate/ImageGalleryUserDAOHibernate.java 30 Nov 2008 15:02:59 -0000 1.2
+++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dao/hibernate/ImageGalleryUserDAOHibernate.java 12 Dec 2008 15:31:28 -0000 1.3
@@ -36,8 +36,6 @@
+ " as u where u.userId =? and u.session.sessionId=?";
private static final String FIND_BY_SESSION_ID = "from " + ImageGalleryUser.class.getName()
+ " as u where u.session.sessionId=?";
- private static final String FIND_COUNT_OF_VOTES = "select count(*) from "
- + ImageGalleryUser.class.getName() + " as u where u.votedImageUid =? and u.session.sessionId=?";
public ImageGalleryUser getUserByUserIDAndSessionID(Long userID, Long sessionId) {
List list = this.getHibernateTemplate().find(FIND_BY_USER_ID_SESSION_ID, new Object[] { userID, sessionId });
@@ -56,12 +54,5 @@
public List getBySessionID(Long sessionId) {
return this.getHibernateTemplate().find(FIND_BY_SESSION_ID, sessionId);
}
-
- public int getNumberOfVotes(Long votedImageUid, Long sessionId) {
- List list = getHibernateTemplate().find(FIND_COUNT_OF_VOTES, new Object[] {votedImageUid, sessionId});
- if (list == null || list.size() == 0)
- return 0;
- return ((Number) list.get(0)).intValue();
- }
}
Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dao/hibernate/ImageVoteDAOHibernate.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dao/hibernate/ImageVoteDAOHibernate.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dao/hibernate/ImageVoteDAOHibernate.java 12 Dec 2008 15:31:28 -0000 1.1
@@ -0,0 +1,73 @@
+/****************************************************************
+ * 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: ImageVoteDAOHibernate.java,v 1.1 2008/12/12 15:31:28 andreyb Exp $ */
+package org.lamsfoundation.lams.tool.imageGallery.dao.hibernate;
+
+import java.util.List;
+
+import org.lamsfoundation.lams.tool.imageGallery.dao.ImageVoteDAO;
+import org.lamsfoundation.lams.tool.imageGallery.model.ImageVote;
+
+/**
+ * Hibernate implementation of ImageVoteDAO
.
+ *
+ * @author Andrey Balan
+ * @see org.lamsfoundation.lams.tool.imageGallery.dao.ImageVoteDAO
+ */
+public class ImageVoteDAOHibernate extends BaseDAOHibernate implements ImageVoteDAO {
+
+ private static final String FIND_BY_IMAGE_AND_USER = "from " + ImageVote.class.getName()
+ + " as r where r.createBy.userId = ? and r.imageGalleryItem.uid=?";
+
+ private static final String FIND_IMAGE_VOTES_COUNT_BY_USER = "select count(*) from " + ImageVote.class.getName()
+ + " as r where r.voted=true and r.createBy.userId = ?";
+
+ private static final String FIND_IMAGE_VOTES_COUNT_BY_IMAGE = "select count(*) from " + ImageVote.class.getName()
+ + " as r where r.voted=true and r.imageGalleryItem.uid = ? and r.createBy.session.sessionId=?";
+
+ public ImageVote getImageVoteByImageAndUser(Long imageUid, Long userId) {
+ List list = getHibernateTemplate().find(ImageVoteDAOHibernate.FIND_BY_IMAGE_AND_USER,
+ new Object[] { userId, imageUid });
+ if ((list == null) || (list.size() == 0)) {
+ return null;
+ }
+ return (ImageVote) list.get(0);
+ }
+
+ public int getNumImageVotesByImageUid(Long imageUid, Long sessionId) {
+ List list = getHibernateTemplate().find(ImageVoteDAOHibernate.FIND_IMAGE_VOTES_COUNT_BY_IMAGE, new Object[] {imageUid, sessionId});
+ if ((list == null) || (list.size() == 0)) {
+ return 0;
+ }
+ return ((Number) list.get(0)).intValue();
+ }
+
+ public int getNumImageVotesByUserId(Long userId) {
+ List list = getHibernateTemplate().find(ImageVoteDAOHibernate.FIND_IMAGE_VOTES_COUNT_BY_USER, userId);
+ if ((list == null) || (list.size() == 0)) {
+ return 0;
+ }
+ return ((Number) list.get(0)).intValue();
+ }
+
+}
Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dto/UserImageContributionDTO.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dto/UserImageContributionDTO.java,v
diff -u -r1.4 -r1.5
--- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dto/UserImageContributionDTO.java 8 Dec 2008 21:51:27 -0000 1.4
+++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/dto/UserImageContributionDTO.java 12 Dec 2008 15:31:28 -0000 1.5
@@ -46,7 +46,7 @@
private String sessionName;
private float averageRating;
private int numberRatings;
- private int numberOfVotes;
+ private int numberOfVotesForImage;
private ImageGalleryUser user;
private int rating;
@@ -119,22 +119,22 @@
}
/**
- * Returns image sequence number.
+ * Returns image number of votes.
*
* @return image sequence number
*/
- public int getNumberOfVotes() {
- return numberOfVotes;
+ public int getNumberOfVotesForImage() {
+ return numberOfVotesForImage;
}
/**
- * Sets image number of rates.
+ * Sets image number of votes.
*
* @param numberRates
* image number of rates
*/
- public void setNumberOfVotes(int numberOfVotes) {
- this.numberOfVotes = numberOfVotes;
+ public void setNumberOfVotesForImage(int numberOfVotesForImage) {
+ this.numberOfVotesForImage = numberOfVotesForImage;
}
public ImageGalleryUser getUser() {
Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/model/ImageGalleryItem.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/model/ImageGalleryItem.java,v
diff -u -r1.11 -r1.12
--- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/model/ImageGalleryItem.java 10 Dec 2008 14:53:03 -0000 1.11
+++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/model/ImageGalleryItem.java 12 Dec 2008 15:31:28 -0000 1.12
@@ -51,9 +51,11 @@
private int sequenceId;
private boolean isHide;
+
private boolean isCreateByAuthor;
private Date createDate;
+
private ImageGalleryUser createBy;
private Long originalFileUuid;
@@ -86,21 +88,21 @@
//*************** NON Persist Field (only for exporting) ********************
private String attachmentLocalUrl;
+ // *************** NON Persist Fields (used only for export needs) ********************
+ private ImageGalleryAttachment originalFile;
+
+ private ImageGalleryAttachment mediumFile;
+
+ private ImageGalleryAttachment thumbnailFile;
+
/**
* Default contruction method.
*
*/
public ImageGalleryItem() {
comments = new HashSet();
- }
-
- // *************** NON Persist Fields (used only for export needs) ********************
- private ImageGalleryAttachment originalFile;
+ }
- private ImageGalleryAttachment mediumFile;
-
- private ImageGalleryAttachment thumbnailFile;
-
@Override
public Object clone() {
ImageGalleryItem image = null;
Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/model/ImageGalleryUser.hbm.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/model/Attic/ImageGalleryUser.hbm.xml,v
diff -u -r1.2 -r1.3
--- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/model/ImageGalleryUser.hbm.xml 30 Nov 2008 15:02:59 -0000 1.2
+++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/model/ImageGalleryUser.hbm.xml 12 Dec 2008 15:31:28 -0000 1.3
@@ -88,14 +88,6 @@
column="session_finished"
/>
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/model/ImageVote.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/model/ImageVote.java,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/model/ImageVote.java 12 Dec 2008 15:31:28 -0000 1.1
@@ -0,0 +1,138 @@
+/****************************************************************
+ * 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: ImageVote.java,v 1.1 2008/12/12 15:31:28 andreyb Exp $ */
+package org.lamsfoundation.lams.tool.imageGallery.model;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.log4j.Logger;
+
+/**
+ * ImageVote
+ *
+ * @author Andrey Balan
+ *
+ * @hibernate.class table="tl_laimag10_image_vote"
+ */
+public class ImageVote implements Cloneable {
+
+ private static final Logger log = Logger.getLogger(ImageVote.class);
+
+ private Long uid;
+ private boolean isVoted;
+ private ImageGalleryUser createBy;
+ private ImageGalleryItem imageGalleryItem;
+
+ // **********************************************************
+ // Function method for ImageRating
+ // **********************************************************
+
+ public Object clone() {
+ ImageVote imageComment = null;
+ try {
+ imageComment = (ImageVote) super.clone();
+ ((ImageVote) imageComment).setUid(null);
+
+ // clone ImageGalleryUser as well
+ if (this.createBy != null) {
+ imageComment.setCreateBy((ImageGalleryUser) this.createBy.clone());
+ }
+ } catch (CloneNotSupportedException e) {
+ log.error("When clone " + ImageVote.class + " failed");
+ }
+
+ return imageComment;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (!(o instanceof ImageVote))
+ return false;
+
+ final ImageVote genericEntity = (ImageVote) o;
+
+ return new EqualsBuilder().append(this.uid, genericEntity.uid).append(this.isVoted, genericEntity.isVoted)
+ .append(this.createBy, genericEntity.createBy).isEquals();
+ }
+
+ public int hashCode() {
+ return new HashCodeBuilder().append(uid).append(isVoted).append(createBy).toHashCode();
+ }
+
+ // **********************************************************
+ // Get/Set methods
+ // **********************************************************
+
+ /**
+ * @hibernate.id generator-class="native" type="java.lang.Long" column="uid"
+ * @return Returns the log Uid.
+ */
+ public Long getUid() {
+ return uid;
+ }
+
+ public void setUid(Long uid) {
+ this.uid = uid;
+ }
+
+ /**
+ * @hibernate.many-to-one column="create_by" cascade="none"
+ * @return
+ */
+ public ImageGalleryUser getCreateBy() {
+ return createBy;
+ }
+
+ public void setCreateBy(ImageGalleryUser createBy) {
+ this.createBy = createBy;
+ }
+
+ /**
+ * @hibernate.property column="is_voted"
+ * @return
+ */
+ public boolean isVoted() {
+ return isVoted;
+ }
+
+ public void setVoted(boolean isVoted) {
+ this.isVoted = isVoted;
+ }
+
+ /**
+ * @hibernate.many-to-one column="imageGallery_item_uid" cascade="none"
+ * @return
+ */
+ public ImageGalleryItem getImageGalleryItem() {
+ return imageGalleryItem;
+ }
+
+ public void setImageGalleryItem(ImageGalleryItem item) {
+ this.imageGalleryItem = item;
+ }
+
+}
+
+
+
\ No newline at end of file
Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/IImageGalleryService.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/IImageGalleryService.java,v
diff -u -r1.13 -r1.14
--- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/IImageGalleryService.java 12 Dec 2008 11:02:20 -0000 1.13
+++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/IImageGalleryService.java 12 Dec 2008 15:31:28 -0000 1.14
@@ -40,6 +40,7 @@
import org.lamsfoundation.lams.tool.imageGallery.model.ImageGallerySession;
import org.lamsfoundation.lams.tool.imageGallery.model.ImageGalleryUser;
import org.lamsfoundation.lams.tool.imageGallery.model.ImageRating;
+import org.lamsfoundation.lams.tool.imageGallery.model.ImageVote;
/**
* @author Dapeng.Ni
@@ -163,9 +164,17 @@
* @return
*/
void saveOrUpdateImageRating(ImageRating rating);
-
/**
+ * Save/update ImageVote.
+ *
+ * @param vote
+ * ImageVote
+ * @return
+ */
+ void saveOrUpdateImageVote(ImageVote vote);
+
+ /**
* Get imageGallery which is relative with the special toolSession.
*
* @param sessionId
@@ -219,6 +228,23 @@
* @return
*/
ImageRating getImageRatingByImageAndUser(Long imageUid, Long userId);
+
+ /**
+ * Returns imageVote by the given imageUid and userId
+ *
+ * @param imageUid
+ * @param userId
+ * @return
+ */
+ ImageVote getImageVoteByImageAndUser(Long imageUid, Long userId);
+
+ /**
+ * Return number of imageVotes made by user.
+ *
+ * @param userId
+ * @return
+ */
+ int getNumberVotesByUserId(Long userId);
/**
* Save or update imageGallery session.
Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryOutputFactory.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryOutputFactory.java,v
diff -u -r1.2 -r1.3
--- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryOutputFactory.java 12 Dec 2008 11:02:20 -0000 1.2
+++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryOutputFactory.java 12 Dec 2008 15:31:28 -0000 1.3
@@ -164,22 +164,19 @@
}
/**
- * Get the number of images for a specific user. Will always return a ToolOutput object.
+ * Get the number of imageVotes for a specific user. Will always return a ToolOutput object.
*/
private ToolOutput getNumVotes(ImageGalleryUser user, ImageGallerySession session, IImageGalleryService imageGalleryService) {
ImageGallery imageGallery = session.getImageGallery();
int countVotes = 0;
if (user != null) {
- if ((user.getVotedImageUid() != null) && !user.getVotedImageUid().equals(new Long(0))){
- countVotes = 1;
- }
+ countVotes = imageGalleryService.getNumberVotesByUserId(user.getUserId());
} else {
List users = imageGalleryService.getUserListBySessionId(session.getSessionId());
for (ImageGalleryUser dbUser : users) {
- if ((dbUser.getVotedImageUid() != null) && !dbUser.getVotedImageUid().equals(new Long(0))){
- countVotes++;
- }
+ int userCountVotes = imageGalleryService.getNumberVotesByUserId(user.getUserId());
+ countVotes += userCountVotes;
}
}
Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryServiceImpl.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryServiceImpl.java,v
diff -u -r1.14 -r1.15
--- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryServiceImpl.java 10 Dec 2008 14:53:03 -0000 1.14
+++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/service/ImageGalleryServiceImpl.java 12 Dec 2008 15:31:28 -0000 1.15
@@ -84,6 +84,7 @@
import org.lamsfoundation.lams.tool.imageGallery.dao.ImageGallerySessionDAO;
import org.lamsfoundation.lams.tool.imageGallery.dao.ImageGalleryUserDAO;
import org.lamsfoundation.lams.tool.imageGallery.dao.ImageRatingDAO;
+import org.lamsfoundation.lams.tool.imageGallery.dao.ImageVoteDAO;
import org.lamsfoundation.lams.tool.imageGallery.dto.ReflectDTO;
import org.lamsfoundation.lams.tool.imageGallery.dto.Summary;
import org.lamsfoundation.lams.tool.imageGallery.dto.UserImageContributionDTO;
@@ -96,6 +97,7 @@
import org.lamsfoundation.lams.tool.imageGallery.model.ImageGallerySession;
import org.lamsfoundation.lams.tool.imageGallery.model.ImageGalleryUser;
import org.lamsfoundation.lams.tool.imageGallery.model.ImageRating;
+import org.lamsfoundation.lams.tool.imageGallery.model.ImageVote;
import org.lamsfoundation.lams.tool.imageGallery.util.ImageCommentComparator;
import org.lamsfoundation.lams.tool.imageGallery.util.ImageGalleryItemComparator;
import org.lamsfoundation.lams.tool.imageGallery.util.ImageGalleryToolContentHandler;
@@ -129,6 +131,8 @@
private ImageCommentDAO imageCommentDao;
private ImageRatingDAO imageRatingDao;
+
+ private ImageVoteDAO imageVoteDao;
private ImageGalleryAttachmentDAO imageGalleryAttachmentDao;
@@ -321,6 +325,18 @@
imageRatingDao.saveObject(rating);
}
+ public ImageVote getImageVoteByImageAndUser(Long imageUid, Long userId) {
+ return imageVoteDao.getImageVoteByImageAndUser(imageUid, userId);
+ }
+
+ public int getNumberVotesByUserId(Long userId) {
+ return imageVoteDao.getNumImageVotesByUserId(userId);
+ }
+
+ public void saveOrUpdateImageVote(ImageVote vote) {
+ imageVoteDao.saveObject(vote);
+ }
+
public ImageComment getImageCommentByUid(Long commentUid) {
return imageCommentDao.getCommentByUid(commentUid);
}
@@ -454,7 +470,7 @@
for (ImageGalleryItem image : groupImages) {
Summary sum = new Summary(session.getSessionId(), session.getSessionName(), image);
- int numberOfVotes = imageGalleryUserDao.getNumberOfVotes(image.getUid(), session.getUid());
+ int numberOfVotes = imageVoteDao.getNumImageVotesByImageUid(image.getUid(), session.getSessionId());
sum.setNumberOfVotes(numberOfVotes);
Object[] ratingForGroup = getRatingForGroup(image.getUid(),session.getSessionId());
@@ -490,11 +506,10 @@
// one new group for one session.
group = new ArrayList();
Object[] ratingForGroup = getRatingForGroup(image.getUid(),session.getSessionId());
- int numberOfVotes = imageGalleryUserDao.getNumberOfVotes(image.getUid(), session.getUid());
List users = imageGalleryUserDao.getBySessionID(session.getSessionId());
for (ImageGalleryUser user : users) {
- UserImageContributionDTO userContribution = createUserContribution(image, user, session, numberOfVotes, ratingForGroup);
+ UserImageContributionDTO userContribution = createUserContribution(image, user, session, ratingForGroup);
group.add(userContribution);
}
@@ -557,8 +572,7 @@
List userContributionList = new ArrayList();
Object[] ratingForGroup = getRatingForGroup(image.getUid(), session.getSessionId());
- int numberOfVotes = imageGalleryUserDao.getNumberOfVotes(image.getUid(), session.getUid());
- UserImageContributionDTO userContribution = createUserContribution(image, user, session, numberOfVotes, ratingForGroup);
+ UserImageContributionDTO userContribution = createUserContribution(image, user, session, ratingForGroup);
userContribution.setImage(image);
userContributionList.add(userContribution);
sessionList.add(userContributionList);
@@ -580,11 +594,10 @@
for(ImageGallerySession imageSession : imageGallerySessionList) {
List userContributionList = new ArrayList();
Object[] ratingForGroup = getRatingForGroup(image.getUid(), imageSession.getSessionId());
- int numberOfVotes = imageGalleryUserDao.getNumberOfVotes(image.getUid(), imageSession.getUid());
List userList = imageGalleryUserDao.getBySessionID(imageSession.getSessionId());
for (ImageGalleryUser user : userList) {
- UserImageContributionDTO userContribution = createUserContribution(image, user, imageSession, numberOfVotes, ratingForGroup);
+ UserImageContributionDTO userContribution = createUserContribution(image, user, imageSession, ratingForGroup);
userContribution.setImage(image);
userContributionList.add(userContribution);
}
@@ -719,6 +732,10 @@
public void setImageRatingDao(ImageRatingDAO imageRatingDao) {
this.imageRatingDao = imageRatingDao;
}
+
+ public void setImageVoteDao(ImageVoteDAO imageVoteDao) {
+ this.imageVoteDao = imageVoteDao;
+ }
public void setImageGallerySessionDao(ImageGallerySessionDAO imageGallerySessionDao) {
this.imageGallerySessionDao = imageGallerySessionDao;
@@ -1112,10 +1129,11 @@
return contentId;
}
- private UserImageContributionDTO createUserContribution(ImageGalleryItem image, ImageGalleryUser user, ImageGallerySession session, int numberOfVotes, Object[] ratingForGroup) {
+ private UserImageContributionDTO createUserContribution(ImageGalleryItem image, ImageGalleryUser user, ImageGallerySession session, Object[] ratingForGroup) {
UserImageContributionDTO userContribution = new UserImageContributionDTO(session.getSessionName(), user);
- userContribution.setNumberOfVotes(numberOfVotes);
+ int numberOfVotesForImage = imageVoteDao.getNumImageVotesByImageUid(image.getUid(), session.getSessionId());
+ userContribution.setNumberOfVotesForImage(numberOfVotesForImage);
userContribution.setNumberRatings(((Long)ratingForGroup[0]).intValue());
userContribution.setAverageRating(((Float)ratingForGroup[1]).floatValue());
@@ -1124,7 +1142,11 @@
userContribution.setRating(rating.getRating());
}
- boolean isVotedForThisImage = (image.getUid().equals(user.getVotedImageUid()));
+ boolean isVotedForThisImage = false;
+ ImageVote imageVote = imageVoteDao.getImageVoteByImageAndUser(image.getUid(), user.getUserId());
+ if ((imageVote != null) && imageVote.isVoted()) {
+ isVotedForThisImage = true;
+ }
userContribution.setVotedForThisImage(isVotedForThisImage);
Set dbComments = image.getComments();
Index: lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/LearningAction.java
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/LearningAction.java,v
diff -u -r1.11 -r1.12
--- lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/LearningAction.java 4 Dec 2008 17:15:01 -0000 1.11
+++ lams_tool_images/src/java/org/lamsfoundation/lams/tool/imageGallery/web/action/LearningAction.java 12 Dec 2008 15:31:28 -0000 1.12
@@ -56,6 +56,7 @@
import org.lamsfoundation.lams.tool.imageGallery.model.ImageGallerySession;
import org.lamsfoundation.lams.tool.imageGallery.model.ImageGalleryUser;
import org.lamsfoundation.lams.tool.imageGallery.model.ImageRating;
+import org.lamsfoundation.lams.tool.imageGallery.model.ImageVote;
import org.lamsfoundation.lams.tool.imageGallery.service.IImageGalleryService;
import org.lamsfoundation.lams.tool.imageGallery.service.ImageGalleryException;
import org.lamsfoundation.lams.tool.imageGallery.service.UploadImageGalleryFileException;
@@ -379,7 +380,12 @@
}
if (imageGallery.isAllowVote()) {
- sessionMap.put(ImageGalleryConstants.PARAM_VOTED_IMAGE_UID, imageGalleryUser.getVotedImageUid());
+ boolean isVotedForThisImage = false;
+ ImageVote imageVote = service.getImageVoteByImageAndUser(image.getUid(), imageGalleryUser.getUserId());
+ if ((imageVote != null) && imageVote.isVoted()) {
+ isVotedForThisImage = true;
+ }
+ sessionMap.put(ImageGalleryConstants.PARAM_IS_VOTED, isVotedForThisImage);
}
request.setAttribute(ImageGalleryConstants.ATTR_SESSION_MAP_ID, sessionMapID);
@@ -510,10 +516,16 @@
ImageGalleryUser imageGalleryUser = service.getUserByIDAndSession(new Long(user.getUserID().intValue()),sessionId);
//persist ImageGalleryItem changes in DB
- boolean vote = (((ImageRatingForm)form).getVote());
- Long votedImageUid = vote ? imageUid : 0;
- imageGalleryUser.setVotedImageUid(votedImageUid);
- service.saveUser(imageGalleryUser);
+ boolean formVote = (((ImageRatingForm)form).getVote());
+ ImageVote imageVote = service.getImageVoteByImageAndUser(imageUid, imageGalleryUser.getUserId());
+ if (imageVote == null) {
+ imageVote = new ImageVote();
+ imageVote.setCreateBy(imageGalleryUser);
+ ImageGalleryItem image = service.getImageGalleryItemByUid(imageUid);
+ imageVote.setImageGalleryItem(image);
+ }
+ imageVote.setVoted(formVote);
+ service.saveOrUpdateImageVote(imageVote);
request.setAttribute(ImageGalleryConstants.ATTR_SESSION_MAP_ID, sessionMapID);
return mapping.findForward(ImageGalleryConstants.SUCCESS);
Index: lams_tool_images/web/pages/export/exportimage.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/web/pages/export/Attic/exportimage.jsp,v
diff -u -r1.1 -r1.2
--- lams_tool_images/web/pages/export/exportimage.jsp 8 Dec 2008 21:51:27 -0000 1.1
+++ lams_tool_images/web/pages/export/exportimage.jsp 12 Dec 2008 15:31:28 -0000 1.2
@@ -33,7 +33,7 @@
-
- : ${userContribution.numberOfVotes}
+ : ${userContribution.numberOfVotesForImage}
Index: lams_tool_images/web/pages/learning/learning.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/web/pages/learning/learning.jsp,v
diff -u -r1.10 -r1.11
--- lams_tool_images/web/pages/learning/learning.jsp 10 Dec 2008 14:53:03 -0000 1.10
+++ lams_tool_images/web/pages/learning/learning.jsp 12 Dec 2008 15:31:28 -0000 1.11
@@ -224,31 +224,26 @@
}
if (${imageGallery.allowVote && (mode != 'teacher') && (not finishedLock)}) {
- var votedImageUid = $('#commentsArea_votedImageUid').val();
+ var isVoted = $('#commentsArea_isVoted').val();
var votingFormLabel;
- if (votedImageUid == 0) {
-
+ if (isVoted == "true") {
+
$('#votingForm_vote').attr('disabled', false);
- $('#votingForm_vote').attr('checked', false);
- votingFormLabel = "";
-
- } else if (imageUid == votedImageUid) {
-
- $('#votingForm_vote').attr('disabled', false);
$('#votingForm_vote').attr('checked', true);
- votingFormLabel = "";
-
+ votingFormLabel = "";
+
} else {
- $('#votingForm_vote').attr('disabled', true);
+ $('#votingForm_vote').attr('disabled', false);
$('#votingForm_vote').attr('checked', false);
- votingFormLabel = "";
+ votingFormLabel = "";
+
}
$('#votingForm_label').text(votingFormLabel);
$('#votingForm_imageUid').attr('value', imageUid);
} else if (${finishedLock}) {
- var votedImageUid = $('#commentsArea_votedImageUid').val();
- if (imageUid == votedImageUid) {
+ var isVoted = $('#commentsArea_isVoted').val();
+ if (isVoted == "true") {
$('#votingForm_vote').attr('checked', true);
} else {
$('#votingForm_vote').attr('checked', false);
Index: lams_tool_images/web/pages/learning/parts/commentsarea.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/web/pages/learning/parts/commentsarea.jsp,v
diff -u -r1.6 -r1.7
--- lams_tool_images/web/pages/learning/parts/commentsarea.jsp 10 Dec 2008 14:53:03 -0000 1.6
+++ lams_tool_images/web/pages/learning/parts/commentsarea.jsp 12 Dec 2008 15:31:28 -0000 1.7
@@ -15,7 +15,6 @@
-
@@ -25,7 +24,7 @@
-
+
Index: lams_tool_images/web/pages/monitoring/imagesummary.jsp
===================================================================
RCS file: /usr/local/cvsroot/lams_tool_images/web/pages/monitoring/imagesummary.jsp,v
diff -u -r1.3 -r1.4
--- lams_tool_images/web/pages/monitoring/imagesummary.jsp 3 Dec 2008 10:06:22 -0000 1.3
+++ lams_tool_images/web/pages/monitoring/imagesummary.jsp 12 Dec 2008 15:31:28 -0000 1.4
@@ -74,7 +74,7 @@
-
- : ${groupSummary[0].numberOfVotes}
+ : ${groupSummary[0].numberOfVotesForImage}