2323<%@ page import =" java.util.Map" %>
2424<%@ page import =" java.util.Arrays" %>
2525<%@ page import =" org.labkey.api.portal.ProjectUrls" %>
26+ <%@ page import =" org.labkey.api.view.template.ClientDependencies" %>
27+ <%@ page import =" org.labkey.api.settings.AppProps" %>
28+ <%@ page import =" org.labkey.api.util.DOM" %>
29+ <%@ page import =" static org.labkey.api.util.DOM.IMG" %>
30+ <%@ page import =" static org.labkey.api.util.DOM.Attribute.src" %>
31+ <%@ page import =" static org.labkey.api.util.DOM.Attribute.alt" %>
32+ <%@ page import =" org.labkey.api.util.PageFlowUtil" %>
2633<%@ page extends =" org.labkey.api.jsp.JspBase" %>
34+
35+ <%!
36+ @Override
37+ public void addClientDependencies(ClientDependencies dependencies)
38+ {
39+ dependencies. add(" internal/jQuery" );
40+ dependencies. add(" skylinetoolsstore/js/functions.js" );
41+ }
42+
43+ public final HtmlString editIconImgHtml = DOM . createHtml(IMG (DOM . at(src, getWebappURL(" skylinetoolsstore/img/pencil.png" )). at(alt, " Pencil" )));
44+ % >
45+ <script src =" https://code.jquery.com/ui/1.13.2/jquery-ui.min.js" nonce =" <%= getScriptNonce() % >" ></script >
46+ <link rel =" stylesheet" href =" https://code.jquery.com/ui/1.13.2/themes/smoothness/jquery-ui.min.css" >
47+
2748<%
2849 JspView<?> me = (JspView<?> ) HttpView . currentView();
2950 final SkylineTool tool = (SkylineTool )me. getModelBean();
3051 final boolean admin = getUser(). hasSiteAdminPermission();
3152
3253 final String contextPath = AppProps . getInstance(). getContextPath();
33- final String cssDir = contextPath + " /skylinetoolsstore/css/" ;
3454 final String imgDir = contextPath + " /skylinetoolsstore/img/" ;
35- final String jsDir = contextPath + " /skylinetoolsstore/js/" ;
3655
3756 final SafeToRender autocompleteUsers = admin ? SkylineToolsStoreController . getUsersForAutocomplete() : HtmlString . unsafe(" \"\" " );
3857
@@ -385,16 +404,14 @@ a { text-decoration: none; }
385404 <div style =" float :left ; width :351px ;" >
386405 <img id =" toolIcon" src =" <%= h(tool. getIconUrl()) % >" class =" logoWrap" alt =" <%= h(tool. getName()) % >" >
387406<% if (toolEditor) { % >
388- <a id =" editIcon" class =" toolProperty" title =" Icon" onclick =" editTool($(this), 'Icon')" >
389- <img src =" <%= h(imgDir) % > pencil.png" />
390- </a >
407+ <%= link(editIconImgHtml). clearClasses(). addClass(" toolProperty" ). id(" editIcon" ). title(" Icon" ). onClick(" editTool($(this), 'Icon')" ) % >
391408<% } % >
392409 <div class =" block" >
393410 <h2 ><%= h(tool. getName()) % > </h2 >
394411 <p >
395412 Version <%= h(tool. getVersion()) % >
396413<% if (allVersions. length > 1 ) { % >
397- [<a onclick = " $('#allVersionsPop').dialog('open')" >View All</ a >]
414+ [<%= link( " View All " ) . clearClasses() . onClick( " $('#allVersionsPop').dialog('open')" ) % > ]
398415 </p >
399416<% } % >
400417 </p >
@@ -407,20 +424,21 @@ a { text-decoration: none; }
407424<% } % >
408425 </div >
409426
410- <button class =" banner-button-small" onclick =" window.open('<%= h(urlProvider(ProjectUrls . class). getBeginURL(getContainer(). getChild(" Support" ). getChild(tool. getName()))) % > ', '_blank')" >Support Board</button >
427+ <button id =" tool-support-board-btn" class =" banner-button-small" >Support Board</button >
428+ <% addHandler(" tool-support-board-btn" , " click" , " window.open(" + q(urlProvider(ProjectUrls . class). getBeginURL(getContainer(). getChild(" Support" ). getChild(tool. getName()))) + " , '_blank', 'noopener,noreferrer')" ); % >
411429 </div >
412430<% if (toolEditor) { % >
413431 <div class =" menuMouseArea sprocket" >
414432 <img src =" <%= h(imgDir) % > gear.png" title =" Settings" alt =" Sprocket" />
415433 <ul class =" dropMenu" >
416- <li ><a onclick = " $('#uploadPop').dialog('open')" >Upload new version</ a ></li >
417- <li ><a onclick = " $('#uploadSuppPop').dialog('open')" >Upload supplementary file</ a ></li >
434+ <li ><%= link( " Upload new version " ) . clearClasses() . onClick( " $('#uploadPop').dialog('open')" ) % > </li >
435+ <li ><%= link( " Upload supplementary file " ) . clearClasses() . onClick( " $('#uploadSuppPop').dialog('open')" ) % > </li >
418436<% if (multipleVersions) { % >
419- <li ><a onclick = " $('#delToolLatestDlg').dialog('open')" >Delete latest version</ a ></li >
437+ <li ><%= link( " Delete latest version " ) . clearClasses() . onClick( " $('#delToolLatestDlg').dialog('open')" ) % > </li >
420438<% } % >
421439<% if (admin) { % >
422- <li ><a onclick = " $('#delToolAllDlg').dialog('open')" >Delete</ a ></li >
423- <li ><a onclick = " popToolOwners() " > Manage tool owners</ a ></li >
440+ <li ><%= link( " Delete " ) . clearClasses() . onClick( " $('#delToolAllDlg').dialog('open')" ) % > </li >
441+ <li ><%= link( " Manage tool owners" ) . clearClasses() . onClick( " popToolOwners() " ) % > </li >
424442<% } % >
425443 </ul >
426444 </div >
@@ -429,11 +447,12 @@ a { text-decoration: none; }
429447 <p id =" toolDescription" class =" toolProperty" title =" Description" >
430448 <span class =" toolPropertyValue" ><%= h(tool. getDescription(), true ) % > </span >
431449<% if (toolEditor) { % >
432- <a onclick = " editTool($(this))" >< img src = " <%= h(imgDir) % > pencil.png " alt = " Pencil " title = " Edit " /></ a >
450+ <%= link(editIconImgHtml) . clearClasses() . onClick( " editTool($(this))" ) % >
433451<% } % >
434452 </p >
435453 <div id =" downloadArea" >
436- <button class =" banner-button" onclick =" downloadTool(<%= h(tool. getRowId()) % > );" >Download <%= h(tool. getName()) % > </button >
454+ <button id =" download-tool-btn" class =" banner-button" >Download <%= h(tool. getName()) % > </button >
455+ <% addHandler(" download-tool-btn" , " click" , " downloadTool(" + tool. getRowId() + " )" ); % >
437456 <br >
438457 <strong >Downloaded: <span id =" downloadcounter" ><%= numDownloads % > </span ></strong >
439458 </div >
@@ -463,7 +482,7 @@ a { text-decoration: none; }
463482 <span class =" boldfont" >Organization:</span >
464483 <span class =" toolPropertyValue" ><%= h(tool. getOrganization()) % > </span >
465484<% if (toolEditor) { % >
466- < a onclick = " editTool($(this))" >< img src = " <%= h(imgDir) % > pencil.png " alt = " Pencil " title = " Edit " /></ a >
485+ <%= link(editIconImgHtml) . clearClasses() . onClick( " editTool($(this))" ) % >
467486<% } % >
468487 </div >
469488<% } % >
@@ -473,7 +492,7 @@ a { text-decoration: none; }
473492 <span class =" boldfont" >Authors:</span >
474493 <span class =" toolPropertyValue" ><%= h(tool. getAuthors()) % > </span >
475494<% if (toolEditor) { % >
476- <a onclick = " editTool($(this), 'author')" >< img src = " <%= h(imgDir) % > pencil.png " alt = " Pencil " title = " Edit " /></ a >
495+ <%= link(editIconImgHtml) . clearClasses() . onClick( " editTool($(this), 'author')" ) % >
477496<% } % >
478497 </div >
479498<% } % >
@@ -483,17 +502,17 @@ a { text-decoration: none; }
483502 <span class =" boldfont" >Languages:</span >
484503 <span class =" toolPropertyValue" ><%= h(tool. getLanguages()) % > </span >
485504<% if (toolEditor) { % >
486- <a onclick = " editTool($(this))" >< img src = " <%= h(imgDir) % > pencil.png " alt = " Pencil " title = " Edit " /></ a >
505+ <%= link(editIconImgHtml) . clearClasses() . onClick( " editTool($(this))" ) % >
487506<% } % >
488507 </div >
489508<% } % >
490509<% if (tool. getProvider() != null || toolEditor) { % >
491510 <div class =" barItem toolProperty" title =" Provider's Website" >
492511 <!-- <img src="<%= h(imgDir) %>link.png" alt="Provider" />-->
493512 <span class =" boldfont" >More Information:</span >
494- <a href =" <%= h(tool. getProvider()) % >" target =" _blank" ><span class =" toolPropertyValue" ><%= h(tool. getProvider()) % > </span ></a >
513+ <a href =" <%= h(tool. getProvider()) % >" target =" _blank" rel = " noopener noreferrer " ><span class =" toolPropertyValue" ><%= h(tool. getProvider()) % > </span ></a >
495514<% if (toolEditor) { % >
496- <a onclick = " editTool($(this), 'provider')" >< img src = " <%= h(imgDir) % > pencil.png " alt = " Pencil " title = " Edit " /></ a >
515+ <%= link(editIconImgHtml) . clearClasses() . onClick( " editTool($(this), 'provider')" ) % >
497516<% } % >
498517 </div >
499518
@@ -582,17 +601,8 @@ a { text-decoration: none; }
582601<%
583602 }
584603% >
585- <%-- <% if (!getUser().isGuest() && isLatestVersion && !leftReview) { %>--%>
586- <%-- <p style="text-align: center;">--%>
587- <%-- <a onclick="$('#reviewPop').dialog('open')">Leave a review</a>--%>
588- <%-- </p>--%>
589- <%-- <% } %>--%>
590- </div >
591604
592- <link rel =" stylesheet" type =" text/css" href =" <%= h(cssDir) % > jquery-ui.css" >
593- <script type =" text/javascript" src =" <%= h(jsDir) % > functions.js" ></script >
594- <script src =" //ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ></script >
595- <script src =" //ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js" ></script >
605+ </div >
596606
597607<script type =" text/javascript" nonce =" <%= getScriptNonce() % >" >
598608 $ (function () {
@@ -706,7 +716,7 @@ a { text-decoration: none; }
706716 $ (" #delRatingDlg" ).dialog ({modal: true , autoOpen: false , create : function (){fixDlg ($ (this ));}, width: ' auto' , show: DLG_EFFECT_SHOW , hide: DLG_EFFECT_HIDE , dialogClass: " noCloseDlg" ,
707717 buttons: {
708718 Ok : function () {
709- window .location = " <%= h(urlFor( SkylineToolsStoreController . DeleteRatingAction . class)) % > id= " + $ (" #delRatingDlg" ).data (" ratingId" );
719+ window .location = LABKEY . ActionURL . buildURL ( " skyts " , " deleteRating.view " , null , {id : $ (" #delRatingDlg" ).data (" ratingId" )} );
710720 },
711721 Cancel : function () {$ (this ).dialog (" close" );}
712722 }
0 commit comments