|
25 | 25 | ShortURLRecord exampleRecord = new ShortURLRecord();
|
26 | 26 | exampleRecord.setShortURL("SHORT_URL");
|
27 | 27 | String exampleURL = exampleRecord.renderShortURL();
|
| 28 | + boolean isAppAdmin = getUser().hasRootPermission(ApplicationAdminPermission.class); |
28 | 29 | %>
|
| 30 | +<script type="text/javascript" nonce="<%=getScriptNonce()%>"> |
| 31 | + let _form; |
| 32 | +
|
| 33 | + LABKEY.Utils.onReady(function() { |
| 34 | + _form = new LABKEY.Form({formElement: 'form-shortUrls'}); |
| 35 | + }); |
| 36 | +</script> |
29 | 37 | <div style="width: 700px">
|
30 | 38 | <p>
|
31 | 39 | Short URLs allow you to create convenient, memorable links to specific content on your server.
|
32 | 40 | They are similar to TinyURL or bit.ly links. Users can access a short URL using a link like <%= h(exampleURL) %>
|
33 | 41 | </p>
|
| 42 | +<% |
| 43 | + if (isAppAdmin) |
| 44 | + { |
| 45 | +%> |
34 | 46 | <p>
|
35 | 47 | If the server or port number are incorrect, you can correct the Base Server URL in <a href="<%= h(urlProvider(AdminUrls.class).getCustomizeSiteURL()) %>">Site Settings</a>
|
36 | 48 | </p>
|
| 49 | +<% |
| 50 | + } |
| 51 | +%> |
37 | 52 | </div>
|
38 | 53 |
|
39 |
| -<labkey:form method="post"> |
| 54 | +<labkey:form id="form-shortUrls" method="post"> |
40 | 55 | <table>
|
| 56 | +<% |
| 57 | + if (isAppAdmin) |
| 58 | + { |
| 59 | +%> |
41 | 60 | <tr>
|
42 | 61 | <td class="labkey-form-label"><label for="shortURLTextField">Short URL</label><%= helpPopup("Short URL", "The unique name for this short URL")%></td>
|
43 | 62 | <td><input name="shortURL" id="shortURLTextField" size="40" /></td>
|
|
46 | 65 | <td class="labkey-form-label"><label for="targetURLTextField">Target URL</label><%= helpPopup("Target URL", "The URL on this server that will be the redirect target. The server portion of the URL will be stripped off - only the path portion will be retained")%></td>
|
47 | 66 | <td><input name="fullURL" id="targetURLTextField" size="40" /></td>
|
48 | 67 | </tr>
|
| 68 | + <tr><td> </td></tr> |
| 69 | +<% |
| 70 | + } |
| 71 | +%> |
49 | 72 | <tr>
|
50 |
| - <td></td> |
51 |
| - <td><%= button("Submit").submit(true).enabled(getUser().hasRootPermission(ApplicationAdminPermission.class)) %></td> |
| 73 | + <td colspan="2"><%=isAppAdmin ? |
| 74 | + button("Submit").submit(true).onClick("_form.setClean();") : |
| 75 | + button("Done").href(urlProvider(AdminUrls.class).getAdminConsoleURL()) |
| 76 | + %> |
| 77 | + </td> |
52 | 78 | </tr>
|
53 | 79 | </table>
|
54 | 80 | </labkey:form>
|
0 commit comments