diff --git a/SkylineToolsStore/resources/schemas/dbscripts/postgresql/skylinetoolsstore-25.000-25.001.sql b/SkylineToolsStore/resources/schemas/dbscripts/postgresql/skylinetoolsstore-25.000-25.001.sql new file mode 100644 index 00000000..a3cc3841 --- /dev/null +++ b/SkylineToolsStore/resources/schemas/dbscripts/postgresql/skylinetoolsstore-25.000-25.001.sql @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2026 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +-- Remove the Rating table as the rating system has been removed +DROP TABLE IF EXISTS skylinetoolsstore.Rating; diff --git a/SkylineToolsStore/resources/schemas/skylinetoolsstore.xml b/SkylineToolsStore/resources/schemas/skylinetoolsstore.xml index 2c88f3d1..0de79e2f 100644 --- a/SkylineToolsStore/resources/schemas/skylinetoolsstore.xml +++ b/SkylineToolsStore/resources/schemas/skylinetoolsstore.xml @@ -40,17 +40,4 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/SkylineToolsStore/src/org/labkey/skylinetoolsstore/RatingManager.java b/SkylineToolsStore/src/org/labkey/skylinetoolsstore/RatingManager.java deleted file mode 100644 index 800dde04..00000000 --- a/SkylineToolsStore/src/org/labkey/skylinetoolsstore/RatingManager.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2013 LabKey Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.labkey.skylinetoolsstore; - -import org.labkey.api.data.Container; -import org.labkey.api.data.Filter; -import org.labkey.api.data.SimpleFilter; -import org.labkey.api.data.Sort; -import org.labkey.api.data.Table; -import org.labkey.api.data.TableSelector; -import org.labkey.api.query.FieldKey; -import org.labkey.api.security.User; -import org.labkey.skylinetoolsstore.model.Rating; -import org.labkey.skylinetoolsstore.model.SkylineTool; - -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class RatingManager -{ - private static final RatingManager _instance = new RatingManager(); - - private RatingManager() - { - // prevent external construction with a private default constructor - } - - public static RatingManager get() - { - return _instance; - } - - public void deleteAllData(Container c) throws SQLException - { - // delete all tools when the container is deleted - Filter containerFilter = SimpleFilter.createContainerFilter(c); - Table.delete(SkylineToolsStoreSchema.getInstance().getTableInfoSkylineTool(), containerFilter); - } - - public Rating[] getRatings(Filter filter) - { - Sort sort = new Sort(); - FieldKey fieldKey = FieldKey.fromParts("modified"); - sort.insertSortColumn(fieldKey, Sort.SortDirection.DESC); - return new TableSelector(SkylineToolsStoreSchema.getInstance().getTableInfoRating(), - filter, sort).getArray(Rating.class); - } - public Rating getRatingById(Integer rowId) - { - SimpleFilter filter = new SimpleFilter(); - filter.addCondition(FieldKey.fromParts("rowId"), rowId); - Rating[] ratings = getRatings(filter); - return (ratings != null && ratings.length > 0) ? ratings[0] : null; - } - - public Rating[] getRatingsByToolId(Integer toolId) - { - SimpleFilter filter = new SimpleFilter(); - filter.addCondition(FieldKey.fromParts("toolId"), toolId); - return getRatings(filter); - } - - public Rating[] getRatingsByToolAllVersions(String toolLsid) - { - List ratings = new ArrayList<>(); - SkylineTool[] tools = SkylineToolsStoreManager.get().getToolsByIdentifier(toolLsid); - if (tools != null) - { - Collections.reverse(Arrays.asList(tools)); - for (SkylineTool tool : tools) - ratings.addAll(Arrays.asList(getRatingsByToolId(tool.getRowId()))); - } - return ratings.toArray(new Rating[0]); - } - - public boolean userLeftRating(String toolLsid, User user) - { - SimpleFilter filter = new SimpleFilter(); - filter.addCondition(FieldKey.fromParts("toolId"), SkylineToolsStoreManager.get().getToolLatestByIdentifier(toolLsid).getRowId()); - filter.addCondition(FieldKey.fromParts("createdBy"), user.getUserId()); - Rating[] ratings = getRatings(filter); - return ratings != null && ratings.length > 0; - } - - public void deleteRating(int rowId) throws SQLException - { - Table.delete(SkylineToolsStoreSchema.getInstance().getTableInfoRating(), rowId); - } - - public Rating editRating(Rating rating, User user) throws SQLException - { - return Table.update(user, SkylineToolsStoreSchema.getInstance().getTableInfoRating(), - rating, rating.getRowId()); - } - - public void deleteRatings(Filter filter) throws SQLException - { - Table.delete(SkylineToolsStoreSchema.getInstance().getTableInfoRating(), filter); - } - - public void deleteRatingsByToolId(int toolId) throws SQLException - { - SimpleFilter filter = new SimpleFilter(); - filter.addCondition(FieldKey.fromParts("toolId"), toolId); - deleteRatings(filter); - } - - public Rating insertRating(User user, Rating rating) throws SQLException - { - return Table.insert(user, SkylineToolsStoreSchema.getInstance().getTableInfoRating(), rating); - } -} \ No newline at end of file diff --git a/SkylineToolsStore/src/org/labkey/skylinetoolsstore/SkylineToolsStoreController.java b/SkylineToolsStore/src/org/labkey/skylinetoolsstore/SkylineToolsStoreController.java index a54bac74..ae44422c 100644 --- a/SkylineToolsStore/src/org/labkey/skylinetoolsstore/SkylineToolsStoreController.java +++ b/SkylineToolsStore/src/org/labkey/skylinetoolsstore/SkylineToolsStoreController.java @@ -78,7 +78,6 @@ import org.labkey.api.view.UnauthorizedException; import org.labkey.api.webdav.WebdavResource; import org.labkey.api.webdav.WebdavService; -import org.labkey.skylinetoolsstore.model.Rating; import org.labkey.skylinetoolsstore.model.SkylineTool; import org.labkey.skylinetoolsstore.view.SkylineToolDetails; import org.labkey.skylinetoolsstore.view.SkylineToolStoreUrls; @@ -613,7 +612,8 @@ else if (!getContainer().hasPermission(getUser(), InsertPermission.class)) @Override public void addNavTrail(NavTree root) { - root.addChild(getToolStoreNav(getContainer())).addChild("Upload Tool", getURL()); + root.addChild(getToolStoreNav(getContainer())); + root.addChild("Upload Tool", getURL()); } public ActionURL getURL() @@ -645,151 +645,6 @@ private void redirectToToolStoreContainer(SkylineTool tool, ActionURL originalUr } } - @RequiresNoPermission - public class SubmitRatingAction extends AbstractController implements PermissionCheckable - { - private static final String NO_TITLE = "You did not enter a valid title."; - private static final String NO_RATING = "You did not submit a valid rating. Ratings must be between 1 and 5."; - private static final String NO_REVIEW = "You did not submit a valid review."; - private static final String ALREADY_REVIEWED = "You have already left a review for this tool."; - - public SubmitRatingAction() - { - } - - @Override - protected ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception - { - final User user = getUser(); - final String toolIdString = httpServletRequest.getParameter("toolId"); - int toolId = (toolIdString != null && !toolIdString.isEmpty()) ? Integer.parseInt(toolIdString) : -1; - - final String ratingIdString = httpServletRequest.getParameter("ratingId"); - int ratingId; - try { - ratingId = (ratingIdString != null && !ratingIdString.isEmpty()) ? Integer.parseInt(ratingIdString) : -1; - } catch(Exception e) { - return new JspView<>("/org/labkey/skylinetoolsstore/view/SkylineRating.jsp", null); - } - Rating rating = (ratingId < 0) ? null : RatingManager.get().getRatingById(ratingId); - final SkylineTool tool = SkylineToolsStoreManager.get().getTool((toolId >= 0) ? toolId : rating.getToolId()); - - final String ratingValueString = httpServletRequest.getParameter("value"); - final int ratingValue; - try { - ratingValue = Integer.parseInt(ratingValueString); - } catch(Exception e) { - return new JspView<>("/org/labkey/skylinetoolsstore/view/SkylineRating.jsp", null); - } - final String ratingTitle = httpServletRequest.getParameter("title"); - final String review = httpServletRequest.getParameter("review"); - - if (ratingId < 0 && RatingManager.get().userLeftRating(tool.getIdentifier(), getUser())) - { - getViewContext().getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "form", - ALREADY_REVIEWED); - getViewContext().getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "hideForm", - true); - } - else if (ratingTitle == null || ratingTitle.isEmpty()) - { - getViewContext().getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "form", - NO_TITLE); - } - else if (ratingValue < 1 || ratingValue > 5) - { - getViewContext().getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "form", - NO_RATING); - } - else if (review == null || review.isEmpty()) - { - getViewContext().getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "form", - NO_REVIEW); - } - else if (user.isGuest()) - { - throw new Exception(); - } - else if (tool == null || (ratingId >= 0 && rating == null)) - { - throw new Exception(); - } - else - { - if (rating == null) - { - // Adding new rating - rating = new Rating(ratingValue, review, toolId, ratingTitle); - rating.setContainer(getContainer().getId()); - RatingManager.get().insertRating(user, rating); - } - else - { - // Editing existing rating - if (rating.getCreatedBy() != user.getUserId() && !getUser().hasSiteAdminPermission()) - { - throw new Exception(); - } - rating.setTitle(ratingTitle); - rating.setRating(ratingValue); - rating.setReview(review); - RatingManager.get().editRating(rating, user); - } - return HttpView.redirect(SkylineToolStoreUrls.getToolDetailsUrl(tool)); - } - - if (toolId >= 0) - getViewContext().getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "toolId", toolId); - if (ratingId >= 0) - getViewContext().getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "ratingId", ratingId); - if (ratingTitle != null) - getViewContext().getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "formTitle", ratingTitle); - getViewContext().getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "formValue", ratingValue); - if (review != null) - getViewContext().getRequest().setAttribute(BindingResult.MODEL_KEY_PREFIX + "formReview", review); - - return new JspView<>("/org/labkey/skylinetoolsstore/view/SkylineRating.jsp", null); - } - - @Override - public void checkPermissions() throws UnauthorizedException - { - - } - } - - @RequiresNoPermission - public class DeleteRatingAction extends AbstractController implements PermissionCheckable - { - public DeleteRatingAction() - { - } - - @Override - public ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception - { - int id = NumberUtils.toInt(httpServletRequest.getParameter("id"), -1); - int user = getUser().getUserId(); - final Rating rating = RatingManager.get().getRatingById(id); - if(rating != null) - { - if (user == rating.getCreatedBy() || getUser().hasSiteAdminPermission()) - RatingManager.get().deleteRating(id); - else - throw new Exception(); - } - - final SkylineTool tool = SkylineToolsStoreManager.get().getTool(rating.getToolId()); - return HttpView.redirect(SkylineToolStoreUrls.getToolDetailsUrl(tool)); - } - - @Override - public void checkPermissions() throws UnauthorizedException - { - - } - } - @RequiresNoPermission public class InsertSupplementAction extends AbstractController implements PermissionCheckable { @@ -948,7 +803,6 @@ public boolean handlePost(IdForm idForm, BindException errors) throws Exception // TODO: Should be in a transaction for (SkylineTool toDelete : SkylineToolsStoreManager.get().getToolsByIdentifier(tool.getIdentifier())) { - RatingManager.get().deleteRatingsByToolId(toDelete.getRowId()); ContainerManager.delete(toDelete.lookupContainer(), getUser()); } @@ -1027,7 +881,6 @@ public ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, if (tools.length == 1) throw new Exception(); - RatingManager.get().deleteRatingsByToolId(tool.getRowId()); ContainerManager.delete(tools[0].lookupContainer(), getUser()); if (tools.length > 1) diff --git a/SkylineToolsStore/src/org/labkey/skylinetoolsstore/SkylineToolsStoreModule.java b/SkylineToolsStore/src/org/labkey/skylinetoolsstore/SkylineToolsStoreModule.java index ca43fbc0..5e18f513 100644 --- a/SkylineToolsStore/src/org/labkey/skylinetoolsstore/SkylineToolsStoreModule.java +++ b/SkylineToolsStore/src/org/labkey/skylinetoolsstore/SkylineToolsStoreModule.java @@ -52,7 +52,7 @@ public String getName() @Override public @Nullable Double getSchemaVersion() { - return 16.2; + return 25.001; } @Override diff --git a/SkylineToolsStore/src/org/labkey/skylinetoolsstore/SkylineToolsStoreSchema.java b/SkylineToolsStore/src/org/labkey/skylinetoolsstore/SkylineToolsStoreSchema.java index 76552dd5..2cfac3ef 100644 --- a/SkylineToolsStore/src/org/labkey/skylinetoolsstore/SkylineToolsStoreSchema.java +++ b/SkylineToolsStore/src/org/labkey/skylinetoolsstore/SkylineToolsStoreSchema.java @@ -56,9 +56,4 @@ public TableInfo getTableInfoSkylineTool() { return getSchema().getTable("SkylineTool"); } - - public TableInfo getTableInfoRating() - { - return getSchema().getTable("Rating"); - } } diff --git a/SkylineToolsStore/src/org/labkey/skylinetoolsstore/model/Rating.java b/SkylineToolsStore/src/org/labkey/skylinetoolsstore/model/Rating.java deleted file mode 100644 index c84cd1c5..00000000 --- a/SkylineToolsStore/src/org/labkey/skylinetoolsstore/model/Rating.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.labkey.skylinetoolsstore.model; - -import org.labkey.api.data.Entity; - -import java.util.Objects; - -public class Rating extends Entity -{ - private Integer _rating; - private Integer _toolId; - private String _review; - private String _title; - private Integer _rowId; - - public Rating() - { - } - - public Rating(int rating, String review, int toolId, String title) - { - _rating = rating; - _review = review; - _toolId = toolId; - _title = title; - } - - public Integer getRating() - { - return _rating; - } - - public void setRating(Integer rating) - { - _rating = rating; - } - - public String getReview() - { - return _review; - } - - public void setReview(String review) - { - _review = review; - } - - public Integer getToolId() - { - return _toolId; - } - - public void setToolId(Integer toolId) - { - _toolId = toolId; - } - - public String getTitle() - { - return _title; - } - - public void setTitle(String title) - { - _title = title; - } - - public Integer getRowId() - { - return _rowId; - } - - public void setRowId(Integer rowId) - { - _rowId = rowId; - } - - public boolean equals(Object obj) - { - if (!(obj instanceof Rating p)) - return false; - - return Objects.equals(_rating, p.getRating()) && - Objects.equals(_toolId, p.getToolId()) && - Objects.equals(_review, p.getReview()) && - Objects.equals(_title, p.getTitle()); - } - -} diff --git a/SkylineToolsStore/src/org/labkey/skylinetoolsstore/view/SkylineRating.jsp b/SkylineToolsStore/src/org/labkey/skylinetoolsstore/view/SkylineRating.jsp deleted file mode 100644 index 6b5f34d9..00000000 --- a/SkylineToolsStore/src/org/labkey/skylinetoolsstore/view/SkylineRating.jsp +++ /dev/null @@ -1,88 +0,0 @@ -<%@ page import="org.springframework.validation.BindingResult" %> -<%@ page import="org.labkey.skylinetoolsstore.SkylineToolsStoreController" %> -<%@ page import="org.labkey.api.util.PageFlowUtil" %> -<%@ page import="org.labkey.api.view.template.ClientDependencies" %> -<%@ page import="org.labkey.api.settings.AppProps" %> -<%@ page extends="org.labkey.api.jsp.JspBase" %> - -<%! - @Override - public void addClientDependencies(ClientDependencies dependencies) - { - dependencies.add("internal/jQuery"); - dependencies.add("skylinetoolsstore/js/functions.js"); - } -%> - -<% - Object errorAttribute = request.getAttribute(BindingResult.MODEL_KEY_PREFIX + "form"); - Object hideForm = request.getAttribute(BindingResult.MODEL_KEY_PREFIX + "hideForm"); - - Object formTitleObj = request.getAttribute(BindingResult.MODEL_KEY_PREFIX + "formTitle"); - final String formTitle = (formTitleObj != null) ? formTitleObj.toString() : ""; - Object formValueObj = request.getAttribute(BindingResult.MODEL_KEY_PREFIX + "formValue"); - final int formValue = (formValueObj != null) ? (int)formValueObj : 0; - Object formReviewObj = request.getAttribute(BindingResult.MODEL_KEY_PREFIX + "formReview"); - final String formReview = (formReviewObj != null) ? formReviewObj.toString() : ""; - - Object toolId = request.getAttribute(BindingResult.MODEL_KEY_PREFIX + "toolId"); - Object ratingId = request.getAttribute(BindingResult.MODEL_KEY_PREFIX + "ratingId"); - - final String contextPath = AppProps.getInstance().getContextPath(); - final String imgDir = contextPath + "/skylinetoolsstore/img/"; -%> - -<% - if (errorAttribute != null) { -%> -<%= h(errorAttribute.toString()) %> -<% - } - if (hideForm == null || (boolean)hideForm != true) - { -%> - - Title: - - - - - <%= h(formReview) %> -<% if (toolId != null) { %> - -<% } %> -<% if (ratingId != null) { %> - -<% } %> - - -<% } %> - - -<%= PageFlowUtil.generateBackButton() %> - - diff --git a/SkylineToolsStore/src/org/labkey/skylinetoolsstore/view/SkylineToolDetails.java b/SkylineToolsStore/src/org/labkey/skylinetoolsstore/view/SkylineToolDetails.java index b521a456..99a5f26c 100644 --- a/SkylineToolsStore/src/org/labkey/skylinetoolsstore/view/SkylineToolDetails.java +++ b/SkylineToolsStore/src/org/labkey/skylinetoolsstore/view/SkylineToolDetails.java @@ -2,19 +2,14 @@ import org.labkey.api.view.JspView; -import org.labkey.skylinetoolsstore.RatingManager; - import org.labkey.skylinetoolsstore.model.SkylineTool; -import java.util.Arrays; - public class SkylineToolDetails extends JspView { public SkylineToolDetails(SkylineTool tool) { super("/org/labkey/skylinetoolsstore/view/SkylineToolDetails.jsp", null); setModelBean(tool); - getViewContext().getRequest().setAttribute("ratings", Arrays.asList(RatingManager.get().getRatingsByToolId(tool.getRowId()))); setTitle(tool.getName()); setTitleHref(SkylineToolStoreUrls.getToolDetailsUrl(tool)); } diff --git a/SkylineToolsStore/src/org/labkey/skylinetoolsstore/view/SkylineToolDetails.jsp b/SkylineToolsStore/src/org/labkey/skylinetoolsstore/view/SkylineToolDetails.jsp index 26a97fce..86bd347a 100644 --- a/SkylineToolsStore/src/org/labkey/skylinetoolsstore/view/SkylineToolDetails.jsp +++ b/SkylineToolsStore/src/org/labkey/skylinetoolsstore/view/SkylineToolDetails.jsp @@ -10,16 +10,11 @@ <%@ page import="org.labkey.api.view.HttpView" %> <%@ page import="org.labkey.api.view.JspView" %> <%@ page import="org.labkey.api.view.template.ClientDependencies" %> -<%@ page import="org.labkey.skylinetoolsstore.RatingManager" %> <%@ page import="org.labkey.skylinetoolsstore.SkylineToolsStoreController" %> <%@ page import="org.labkey.skylinetoolsstore.SkylineToolsStoreManager" %> -<%@ page import="org.labkey.skylinetoolsstore.model.Rating" %> <%@ page import="org.labkey.skylinetoolsstore.model.SkylineTool" %> <%@ page import="org.labkey.skylinetoolsstore.view.SkylineToolStoreUrls" %> <%@ page import="java.io.File" %> -<%@ page import="java.text.DateFormat" %> -<%@ page import="java.text.SimpleDateFormat" %> -<%@ page import="java.util.ArrayList" %> <%@ page import="java.util.Arrays" %> <%@ page import="java.util.HashMap" %> <%@ page import="java.util.Iterator" %> @@ -63,7 +58,6 @@ final SkylineTool[] allVersions = SkylineToolsStoreController.sortToolsByCreateDate(SkylineToolsStoreManager.get().getToolsByIdentifier(tool.getIdentifier())); final boolean multipleVersions = allVersions.length > 1; final boolean isLatestVersion = SkylineToolsStoreManager.get().getToolLatestByIdentifier(tool.getIdentifier()).getVersion().equals(tool.getVersion()); - final boolean leftReview = RatingManager.get().userLeftRating(tool.getIdentifier(), getUser()); final int numDownloads = Arrays.stream(allVersions).mapToInt(SkylineTool::getDownloads).sum(); ActionURL toolDetailsUrl = SkylineToolStoreUrls.getToolDetailsUrl(tool); @@ -83,7 +77,6 @@ a { text-decoration: none; } .headerwrap h3 {margin: 0 !important; padding: 5px 0 0; font-weight: 500 !important;} .headerwrap p {margin: 0;} .headerwrap h2 {margin: 0 !important; padding: 0 !important; font-weight: 500 !important;} -.reviewwrap {width: 100%; min-height: 40px;} .block { float: left; margin: 0 0 0 3px !important; @@ -100,22 +93,6 @@ a { text-decoration: none; } float: left; width: 100%; } -.reviewwrap h2 { - float: left; - font-weight: 600; - font-size: 1.2em; - margin: -3px 0 0 30px; - padding: 0 !important; -} -.reviewwrap h3 { - float: left; - padding: 0 !important; - margin: 1px 0 0 50px !important; - font-weight: 300 !important; -} -.reviewwrap h4 {margin: 0 !important; padding: 0 !important;} -.reviewwrap p {padding: 0; margin: 6px 0 0 30px !important;} -.reviewdate {float: right; margin: -12px 2% 0 0;} .bottombar a > div {color: #126495;} #allVersionsPop a {color: #126495;} #allVersionsPop a:hover {color: #000;} @@ -136,26 +113,6 @@ a { text-decoration: none; } background-size: cover; z-index: 99; } -.ratingfull { - height: 15px; - background: url('<%= h(imgDir) %>star_full15x15.png') repeat-x left; -} -.ratingempty { - width: 74px; - height: 100%; - background-size: 15px 15px; - padding: 0 !important; - margin: 0 !important; - background: url('<%= h(imgDir) %>star_empty15x15.png') repeat-x left; -} -.ratingstars { - width: 74px !important; - height: 15px; - float: left; - overflow: hidden !important; - margin: -1px 0 0 30px !important; - border-spacing: 0 !important; -} .noCloseDlg .ui-dialog-titlebar-close {display: none;} .itemsbox { min-height: 60px; @@ -246,69 +203,6 @@ a { text-decoration: none; } .sprocket {cursor: pointer; float: right; margin: 0 0 8px 12px;} .noCloseDlg .ui-dialog-titlebar-close {display: none;} .boldfont {font-weight: 700;} -.ratingbutton {float: right;} -#ratingSlider, #ratingSliderPop -{ - border: 0 !important; - width: 100px; - height: 20px; - background: #8e8d8d url('<%= h(imgDir) %>star_empty20x20.png') repeat-x; - z-index: 0; - overflow: hidden; - cursor:pointer; -} -#ratingSliderOver, #ratingSliderOverPop -{ - width:100px; - height:20px; - background: url('<%= h(imgDir) %>star_full20x20.png') repeat-x; - z-index:99; -} -.ratinginput -{ - width:400px; - float:left; - border:0 !important; -} -#ratingform -{ - margin-top:24px; - width:400px; - border-radius: 5px 5px 5px 5px; - -moz-border-radius: 5px 5px 5px 5px; - -webkit-border-radius: 5px 5px 5px 5px; - background-color: #e9e9e9; - padding:12px 15px 20px 10px; - height:170px; - float:left; - border: 1px #6E6E6E solid; -} -#ratingform legend -{ - font-weight: bold; - font-size:14px; - margin: -23px 10px 10px 0; - position: relative; - background-color: #e9e9e9; - color: #000; - border: 1px #6E6E6E solid; - max-width:150px; - text-shadow: 1px 1px #fff; -} -#ratingform h3 -{ - padding: 0 0 8px; - margin: 0; -} -#separatorborder -{ - border-bottom: 1px solid #d9d9d9; - width:100%; - padding-top:20px; - margin-bottom:10px; -} -.ui-slider-handle {display: none;} -.versionheader {margin:0; padding:0;} @@ -364,24 +258,6 @@ a { text-decoration: none; } - - - - Title: - - - - - - - - - - - - - Delete review? - Are you sure you want to completely delete <%= h(tool.getName()) %>? @@ -518,94 +394,9 @@ a { text-decoration: none; } <% } %> -<% if (!getUser().isGuest() && isLatestVersion && !leftReview) { %> - - - Leave a Review - - - - - - - - - - - - - -<% } %> - - - -<% - Rating[] ratings = RatingManager.get().getRatingsByToolAllVersions(tool.getIdentifier()); - - if (!tool.getVersion().equals(SkylineToolsStoreManager.get().getToolLatestByIdentifier(tool.getIdentifier()).getVersion())) - ratings = RatingManager.get().getRatingsByToolId(tool.getRowId()); - - List usedVersions = new ArrayList<>(); - - for (Rating rating : ratings) - { - final String tableId2 = "table-" + rating.getRowId(); - final String reviewTitle = rating.getTitle(); - final String review = h(rating.getReview()).toString(); - pageContext.setAttribute("review", review); - pageContext.setAttribute("reviewEscaped", review.replace("'", "\\'")); - final Integer ratingValue = rating.getRating(); - final String ratingVersion = SkylineToolsStoreManager.get().getTool(rating.getToolId()).getVersion(); - - DateFormat df = new SimpleDateFormat("MM/dd/yy"); - String formattedDate = df.format(rating.getModified()); - - if (!usedVersions.contains(ratingVersion)) { - usedVersions.add(ratingVersion); - if (tool.getVersion().equals(SkylineToolsStoreManager.get().getToolLatestByIdentifier(tool.getIdentifier()).getVersion()) && multipleVersions) { -%> -Version <%= h(ratingVersion) %> ratings -<% - } - } -%> - - - - <%= h(reviewTitle) %> - - - - - - - <%= h(formattedDate) %> - - - ${review} -<% if (rating.getCreatedBy() == getUser().getUserId() || admin) { %> - - - Edit Review - - - Delete Review - -<% } %> - - - - -<% - } -%> - - diff --git a/SkylineToolsStore/src/org/labkey/skylinetoolsstore/view/SkylineToolsStoreWebPart.jsp b/SkylineToolsStore/src/org/labkey/skylinetoolsstore/view/SkylineToolsStoreWebPart.jsp index 4f602334..68730ba3 100644 --- a/SkylineToolsStore/src/org/labkey/skylinetoolsstore/view/SkylineToolsStoreWebPart.jsp +++ b/SkylineToolsStore/src/org/labkey/skylinetoolsstore/view/SkylineToolsStoreWebPart.jsp @@ -7,14 +7,11 @@ <%@ page import="org.labkey.api.view.HttpView" %> <%@ page import="org.labkey.api.view.JspView" %> <%@ page import="org.labkey.api.view.template.ClientDependencies" %> -<%@ page import="org.labkey.skylinetoolsstore.RatingManager" %> <%@ page import="org.labkey.skylinetoolsstore.SkylineToolsStoreController" %> <%@ page import="org.labkey.skylinetoolsstore.SkylineToolsStoreManager" %> -<%@ page import="org.labkey.skylinetoolsstore.model.Rating" %> <%@ page import="org.labkey.skylinetoolsstore.model.SkylineTool" %> <%@ page import="org.labkey.skylinetoolsstore.view.SkylineToolStoreUrls" %> <%@ page import="java.io.File" %> -<%@ page import="java.util.ArrayList" %> <%@ page import="java.util.Arrays" %> <%@ page import="java.util.HashMap" %> <%@ page import="java.util.Iterator" %> @@ -44,28 +41,6 @@ final String contextPath = AppProps.getInstance().getContextPath(); final String imgDir = contextPath + "/skylinetoolsstore/img/"; - HashMap toolRatings = new HashMap(); - HashMap toolRatingSplit = new HashMap(); - Rating[] allRatings = RatingManager.get().getRatings(null); - if (allRatings != null) - { - for (Rating rating : allRatings) - { - int toolId = rating.getToolId(); - int value = rating.getRating(); - toolRatings.put(toolId, (toolRatings.containsKey(toolId)) ? - toolRatings.get(rating.getToolId()) + value : value); - - if (toolRatingSplit.containsKey(toolId)) - ++toolRatingSplit.get(toolId)[value - 1]; - else - { - Integer ratingBreakDown[] = new Integer[] {0, 0, 0, 0, 0}; - ++ratingBreakDown[value - 1]; - toolRatingSplit.put(toolId, ratingBreakDown); - } - } - } %> @@ -169,19 +88,6 @@ <% addHandler("add-new-tool-btn", "click", "$('#uploadPopOwners').show(); $('#updatetarget').val(''); $('#uploadPop').dialog('open')"); %> <% } %> - - - - Title: - - - - - - - - - @@ -254,9 +160,6 @@ final SkylineTool[] allVersions = SkylineToolsStoreManager.get().getToolsByIdentifier(tool.getIdentifier()); final boolean multipleVersions = allVersions.length > 1; final int numDownloads = Arrays.stream(allVersions).mapToInt(SkylineTool::getDownloads).sum(); - final Rating[] ratings = RatingManager.get().getRatingsByToolAllVersions(tool.getIdentifier()); - final Rating[] ratingsCurVer = RatingManager.get().getRatingsByToolId(tool.getRowId()); - final boolean leftReview = RatingManager.get().userLeftRating(tool.getIdentifier(), getUser()); %> <% if (tool.getProvider() != null) { %> <%= h(tool.getProvider()) %> -<% } %> -<% - if (ratings != null && ratings.length > 0) - { - int totalReviews = ratings.length; - List ratingValues = new ArrayList<>(); - double averageRating = 0; - double averageRatingRounded = 0; - double percentOfTotal[] = new double[]{0,0,0,0,0}; - int ratingsBreakDown[] = new int[]{0,0,0,0,0}; - List usedIds = new ArrayList<>(); - - for (Rating getRatings: ratings) { - if (toolRatings.containsKey(getRatings.getToolId())) - ratingValues.add(getRatings.getRating()); - - if (toolRatingSplit.containsKey(getRatings.getToolId())) - { - if (!usedIds.contains(getRatings.getToolId())) - { - for (int j = 0; j < 5; j++) - ratingsBreakDown[j] = ratingsBreakDown[j] + toolRatingSplit.get(getRatings.getToolId())[j]; - usedIds.add(getRatings.getToolId()); - } - } - } - - for (int j = 0; j < 5; j++) - percentOfTotal[j]= ((double)ratingsBreakDown[j]/totalReviews) * 100; - - for (int i = 0; i < ratingValues.size(); i++) - { - averageRating = averageRating + ratingValues.get(i); - if (i == ratingValues.size() - 1) - { - averageRating = averageRating / totalReviews; - averageRatingRounded = Math.round(averageRating * 100.0) / 100.0; - break; - } - } -%> - - - - <%--98% because of css properties inherited. Actual ratingfull size is not exactly 75px--%> - - - - <%= averageRatingRounded %> out of 5 stars - 5 stars:<%=ratingsBreakDown[4]%> - 4 stars:<%=ratingsBreakDown[3]%> - 3 stars:<%=ratingsBreakDown[2]%> - 2 stars:<%=ratingsBreakDown[1]%> - 1 stars:<%=ratingsBreakDown[0]%> - - - <% } %> <%= h(tool.getDescription(), true) %>[Tool Details, Support Board] @@ -363,10 +202,7 @@ Download <% addHandler("download-tool-btn-" + tool.getRowId(), "click", "window.location.href = " + q(urlFor(SkylineToolsStoreController.DownloadToolAction.class).addParameter("id", tool.getRowId()))); %> -<% if ((ratingsCurVer == null || ratingsCurVer.length == 0) && loggedIn) { %> - <%--Leave the first Review!--%> <% - } if (suppFiles.size() == 1) { Map.Entry suppPair = (Map.Entry)suppIter.next(); %> @@ -398,10 +234,6 @@ var BASE_SLIDE_TIME = 100; var LINE_THRESHOLD = 2.0; - $(function() { - initRatingSlider($("#slider"), $("#sliderover"), "value"); - }); - function adjustContent(element) { var newP = $("").html($("").text(READ_MORE_TEXT).click(function() { var content = $(this).parent().prev(); @@ -455,42 +287,9 @@ $(".menuMouseArea").each(function() {initMenu($(this));}); - function ratinghover(){ - - $(function() { - $(".content").each(function() {adjustContent($(this));}); - - $(".rating").each(function() { - var containingTable = $(this).parents(".tablewrap:first"); - containingTable.height(containingTable.height()); - var toShift = $(this).next(); - var oldTop = toShift.position().top; - $(this).css("visibility", "visible"); - $(this).css("position", "absolute"); - var newTop = toShift.position().top; - toShift.css("margin-top", ((parseInt(toShift.css("margin-top")) + (oldTop - newTop)) + "px")); - }); - }); - var REVIEW_EXPAND_TIME = 250; - var lastExpanded = false; - $(".rating").mouseenter(function() { - lastExpanded = true; - $(this).css("background", "#ffffff").css("box-shadow", "7px 7px 8px #888888"); - $(this).animate( - {height: $(this).prop("scrollHeight"), width: "250px", height: "131px"}, - {queue: false, duration: REVIEW_EXPAND_TIME} - ); - }).mouseleave(function() { - lastExpanded = false; - $(this).animate( - {height: $(this).children(":first").height(), width: $(this).children(":first").width()}, - {queue: false, duration: REVIEW_EXPAND_TIME, always: function() { - if (!lastExpanded) - $(this).css("background", "").css("box-shadow", "0px 0px 0px 0px #fff"); - }} - ); - }); - } + $(function() { + $(".content").each(function() {adjustContent($(this));}); + }); <% if (admin) { %> var toolOwners = new Array(); @@ -537,7 +336,6 @@ $("#uploadPop").dialog({modal:true, autoOpen:false, create:function(){fixDlg($(this));}, width:'auto', show:DLG_EFFECT_SHOW, hide:DLG_EFFECT_HIDE}); $("#manageOwnersPop").dialog({modal:true, autoOpen:false, create:function(){fixDlg($(this));}, width:'auto', show:DLG_EFFECT_SHOW, hide:DLG_EFFECT_HIDE}); - $("#reviewPop").dialog({modal:true, autoOpen:false, create:function(){fixDlg($(this));}, width:'auto', show:DLG_EFFECT_SHOW, hide:DLG_EFFECT_HIDE}); $("#uploadSuppPop").dialog({modal:true, autoOpen:false, create:function(){fixDlg($(this));}, width:'auto', show:DLG_EFFECT_SHOW, hide:DLG_EFFECT_HIDE}); $("#delToolAllDlg").dialog({modal:true, autoOpen:false, create:function(){fixDlg($(this));}, width:'auto', show:DLG_EFFECT_SHOW, hide:DLG_EFFECT_HIDE, dialogClass:"noCloseDlg", @@ -578,13 +376,11 @@ var newToolTable = extractToolTable(data, toolTable.attr("data-toolLsid")); newToolTable.hide(); newToolTable.find(".menuMouseArea").each(function() {initMenu($(this));}); - newToolTable.find(".rating").each(function() {initMenu($(this));}); $("#delToolLatestDlg").dialog("close"); toolTable.hide("explode", function() { $(this).replaceWith(newToolTable); $(newToolTable).show("explode", function() { adjustContent($(newToolTable).find(".content:first")); - ratinghover(); }); }); }).fail(function() { @@ -630,5 +426,4 @@ $(sortSelector).val("name-asc").change(); initJqueryUiImages("<%= h(imgDir + "jquery-ui") %>"); - window.onload = ratinghover; diff --git a/SkylineToolsStore/webapp/SkylineToolsStore/img/star_empty15x15.png b/SkylineToolsStore/webapp/SkylineToolsStore/img/star_empty15x15.png deleted file mode 100644 index bee1cf3c..00000000 Binary files a/SkylineToolsStore/webapp/SkylineToolsStore/img/star_empty15x15.png and /dev/null differ diff --git a/SkylineToolsStore/webapp/SkylineToolsStore/img/star_empty20x20.png b/SkylineToolsStore/webapp/SkylineToolsStore/img/star_empty20x20.png deleted file mode 100644 index 25156149..00000000 Binary files a/SkylineToolsStore/webapp/SkylineToolsStore/img/star_empty20x20.png and /dev/null differ diff --git a/SkylineToolsStore/webapp/SkylineToolsStore/img/star_full15x15.png b/SkylineToolsStore/webapp/SkylineToolsStore/img/star_full15x15.png deleted file mode 100644 index fe5aaf73..00000000 Binary files a/SkylineToolsStore/webapp/SkylineToolsStore/img/star_full15x15.png and /dev/null differ diff --git a/SkylineToolsStore/webapp/SkylineToolsStore/img/star_full20x20.png b/SkylineToolsStore/webapp/SkylineToolsStore/img/star_full20x20.png deleted file mode 100644 index 02847576..00000000 Binary files a/SkylineToolsStore/webapp/SkylineToolsStore/img/star_full20x20.png and /dev/null differ diff --git a/SkylineToolsStore/webapp/SkylineToolsStore/js/functions.js b/SkylineToolsStore/webapp/SkylineToolsStore/js/functions.js index 143ff13c..5915ac1a 100644 --- a/SkylineToolsStore/webapp/SkylineToolsStore/js/functions.js +++ b/SkylineToolsStore/webapp/SkylineToolsStore/js/functions.js @@ -59,22 +59,3 @@ function initJqueryUiImages(dir) { setBg(".ui-widget-overlay", "ui-bg_flat_0_aaaaaa_40x100.png"); setBg(".ui-widget-shadow", "ui-bg_flat_0_aaaaaa_40x100.png"); } - -function initRatingSlider(sliderElement, sliderOverElement, valueInput) { - var sliderWidth = $(sliderElement).width(); - var starWidth = sliderWidth / 5; - $(sliderElement).mousemove(function(e) { - var value = Math.ceil(((e.pageX - $(this).offset().left) / sliderWidth) * 5); - var newWidth = value * starWidth; - if (newWidth != $(sliderOverElement).width()) { - $(sliderOverElement).fadeTo(250, 0.5); - $(sliderOverElement).width(newWidth); - } - }).click(function() { - $(valueInput).val($(sliderOverElement).width() / starWidth); - $(sliderOverElement).fadeTo(250, 1.0); - }).mouseleave(function() { - $(sliderOverElement).width($(valueInput).val() * starWidth); - $(sliderOverElement).fadeTo(250, 1.0); - }); -}
<%= h(errorAttribute.toString()) %>
Delete review?
Are you sure you want to completely delete <%= h(tool.getName()) %>?
- ${review} -<% if (rating.getCreatedBy() == getUser().getUserId() || admin) { %> - - - Edit Review - - - Delete Review - -<% } %> -
<%= h(tool.getProvider()) %>
<%= averageRatingRounded %> out of 5 stars
<%= h(tool.getDescription(), true) %>[Tool Details, Support Board]