Repository: roller Updated Branches: refs/heads/bootstrap-ui 67fa3a5cc -> 44b008d5d
Converted Ping Target management pages to Struts Bootstrap. Project: http://git-wip-us.apache.org/repos/asf/roller/repo Commit: http://git-wip-us.apache.org/repos/asf/roller/commit/44b008d5 Tree: http://git-wip-us.apache.org/repos/asf/roller/tree/44b008d5 Diff: http://git-wip-us.apache.org/repos/asf/roller/diff/44b008d5 Branch: refs/heads/bootstrap-ui Commit: 44b008d5d761e08eead9a643821b2d66684c7382 Parents: 67fa3a5 Author: Dave Johnson <[email protected]> Authored: Sat Nov 17 17:40:52 2018 -0500 Committer: Dave Johnson <[email protected]> Committed: Sat Nov 17 17:40:52 2018 -0500 ---------------------------------------------------------------------- app/src/main/resources/struts.xml | 24 +-- .../WEB-INF/jsps/admin/PingTargetEdit.jsp | 75 ++++--- .../WEB-INF/jsps/admin/PingTargetRemove.jsp | 42 ---- .../webapp/WEB-INF/jsps/admin/PingTargets.jsp | 198 +++++++++++-------- .../webapp/WEB-INF/jsps/editor/Bookmarks.jsp | 91 ++++----- 5 files changed, 211 insertions(+), 219 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/roller/blob/44b008d5/app/src/main/resources/struts.xml ---------------------------------------------------------------------- diff --git a/app/src/main/resources/struts.xml b/app/src/main/resources/struts.xml index 8ab6f6a..3f302f1 100644 --- a/app/src/main/resources/struts.xml +++ b/app/src/main/resources/struts.xml @@ -569,29 +569,7 @@ <result name="list" type="chain">templates</result> <result name="input" type="tiles">.TemplateEdit</result> </action> - - <action name="templateRemove" - class="org.apache.roller.weblogger.ui.struts2.editor.TemplateRemove"> - <result name="confirm" type="tiles">.TemplateRemove</result> - <result name="cancel" type="redirectAction"> - <param name="actionName">templates</param> - <param name="weblog">${weblog}</param> - </result> - <result name="success" type="chain">templates</result> - </action> - - <action name="templatesRemove" - class="org.apache.roller.weblogger.ui.struts2.editor.TemplatesRemove"> - <result name="input" type="tiles">.TemplatesRemove</result> - <result name="confirm" type="tiles">.TemplatesRemove</result> - <result name="success" type="chain">templates</result> - <result name="cancel" type="redirectAction"> - <param name="actionName">templates</param> - <param name="weblog">${weblog}</param> - </result> - <result name="error" type="chain">templates</result> - </action> - + <action name="members" class="org.apache.roller.weblogger.ui.struts2.editor.Members"> <result name="list" type="tiles">.Members</result> http://git-wip-us.apache.org/repos/asf/roller/blob/44b008d5/app/src/main/webapp/WEB-INF/jsps/admin/PingTargetEdit.jsp ---------------------------------------------------------------------- diff --git a/app/src/main/webapp/WEB-INF/jsps/admin/PingTargetEdit.jsp b/app/src/main/webapp/WEB-INF/jsps/admin/PingTargetEdit.jsp index be84eb7..48ee4ef 100644 --- a/app/src/main/webapp/WEB-INF/jsps/admin/PingTargetEdit.jsp +++ b/app/src/main/webapp/WEB-INF/jsps/admin/PingTargetEdit.jsp @@ -27,33 +27,52 @@ <s:set var="subtitleKey">pingTargetAdd.subtitle</s:set> </s:else> -<p class="subtitle"> -<s:text name="%{#subtitleKey}"/> -</p> - -<s:form> - <s:hidden name="salt" /> - <s:if test="actionName == 'commonPingTargetEdit'"> - <%-- bean for add does not have a bean id yet --%> - <s:hidden name="bean.id" /> - </s:if> - - <div class="formrow"> - <label for="name" class="formrow"><s:text name="generic.name" /></label> - <s:textfield name="bean.name" size="30" maxlength="30" style="width:50%"/> - </div> - - <div class="formrow"> - <label for="pingUrl" class="formrow"><s:text name="pingTarget.pingUrl" /></label> - <s:textfield name="bean.pingUrl" size="100" maxlength="255" style="width:50%"/> - </div> - - <p/> - - <div class="formrow"> - <label for="" class="formrow"> </label> - <s:submit value="%{getText('generic.save')}" action="%{#mainAction}!save"/> - <s:submit value="%{getText('generic.cancel')}" action="commonPingTargets" /> - </div> +<p class="subtitle"> <s:text name="%{#subtitleKey}"/> </p> + +<s:form theme="bootstrap" cssClass="form-horizontal"> + <s:hidden name="salt"/> + + <s:if test="actionName == 'commonPingTargetEdit'"> <s:hidden name="bean.id"/> </s:if> + + <s:textfield name="bean.name" size="30" maxlength="30" style="width:50%" + onchange="validate()" onkeyup="validate()" + label="%{getText('generic.name')}" /> + + <s:textfield name="bean.pingUrl" size="100" maxlength="255" style="width:50%" + onchange="validate()" onkeyup="validate()" + label="%{getText('pingTarget.pingUrl')}" /> + + <s:submit id="save-button" cssClass="btn btn-default" + value="%{getText('generic.save')}" action="%{#mainAction}!save"/> + + <s:submit cssClass="btn" value="%{getText('generic.cancel')}" action="commonPingTargets"/> </s:form> + +<script type="application/javascript"> + + function validate() { + var savePingTargetButton = $('#save-button:first'); + var name = $('#commonPingTargetAdd_bean_name:first').val().trim(); + var url = $('#commonPingTargetAdd_bean_pingUrl:first').val().trim(); + if ( name.length > 0 && url.length > 0 && isValidUrl(url) ) { + savePingTargetButton.attr("disabled", false); + } else { + savePingTargetButton.attr("disabled", true); + } + } + + function isValidUrl(url) { + if (/^(http|https|ftp):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/i.test(url)) { + return true; + } else { + return false; + } + } + + $( document ).ready(function() { + var savePingTargetButton = $('#save-button:first'); + savePingTargetButton.attr("disabled", true); + }); + +</script> http://git-wip-us.apache.org/repos/asf/roller/blob/44b008d5/app/src/main/webapp/WEB-INF/jsps/admin/PingTargetRemove.jsp ---------------------------------------------------------------------- diff --git a/app/src/main/webapp/WEB-INF/jsps/admin/PingTargetRemove.jsp b/app/src/main/webapp/WEB-INF/jsps/admin/PingTargetRemove.jsp deleted file mode 100644 index 93fb9b7..0000000 --- a/app/src/main/webapp/WEB-INF/jsps/admin/PingTargetRemove.jsp +++ /dev/null @@ -1,42 +0,0 @@ -<%-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. The ASF licenses this file to You - 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. For additional information regarding - copyright in this work, please see the NOTICE file in the top level - directory of this distribution. ---%> -<%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %> - -<h2> - <s:text name="pingTarget.confirmRemoveTitle"/> -</h2> - -<p/> -<s:text name="pingTarget.confirmCommonRemove" /> -<p/> - -<table> - <tr><td><s:text name="generic.name" /> </td><td><b><s:property value="pingTarget.name" /></b></td></tr> - <tr><td><s:text name="pingTarget.pingUrl" /> </td><td><b><s:property value="pingTarget.pingUrl" /></b></td></tr> -</table> - -<br/> - -<div class="control"> - <s:form> - <s:hidden name="salt" /> - <s:hidden name="pingTargetId" /> - <s:submit value="%{getText('generic.yes')}" action="commonPingTargets!delete"/> - <s:submit value="%{getText('generic.cancel')}" action="commonPingTargets"/> - </s:form> -</div> http://git-wip-us.apache.org/repos/asf/roller/blob/44b008d5/app/src/main/webapp/WEB-INF/jsps/admin/PingTargets.jsp ---------------------------------------------------------------------- diff --git a/app/src/main/webapp/WEB-INF/jsps/admin/PingTargets.jsp b/app/src/main/webapp/WEB-INF/jsps/admin/PingTargets.jsp index 94c20f6..d0e1892 100644 --- a/app/src/main/webapp/WEB-INF/jsps/admin/PingTargets.jsp +++ b/app/src/main/webapp/WEB-INF/jsps/admin/PingTargets.jsp @@ -17,89 +17,131 @@ --%> <%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %> -<p class="subtitle"> - <s:text name="commonPingTargets.subtitle" /> -</p> - -<p/><s:text name="commonPingTargets.explanation"/><p/> - -<table class="rollertable"> - -<%-- Headings --%> -<tr class="rollertable"> - <th class="rollertable" width="20%%"><s:text name="generic.name" /></th> - <th class="rollertable" width="55%"><s:text name="pingTarget.pingUrl" /></th> - <th class="rollertable" width="15%" colspan="2"><s:text name="pingTarget.autoEnabled" /></th> - <th class="rollertable" width="5%"><s:text name="generic.edit" /></th> - <th class="rollertable" width="5%"><s:text name="pingTarget.remove" /></th> -</tr> - -<%-- Listing of current common targets --%> -<s:iterator var="pingTarget" value="pingTargets" status="rowstatus"> - - <s:if test="#rowstatus.odd == true"> - <tr class="rollertable_odd"> - </s:if> - <s:else> - <tr class="rollertable_even"> - </s:else> - - <td class="rollertable"><s:property value="#pingTarget.name" /></td> - - <td class="rollertable"><s:property value="#pingTarget.pingUrl" /></td> - - <!-- TODO: Use icons here --> - <td class="rollertable" align="center" > - <s:if test="#pingTarget.autoEnabled"> - <span style="color: #00aa00; font-weight: bold;"><s:text name="pingTarget.enabled"/></span> - </s:if> - <s:else> - <span style="color: #aaaaaa; font-weight: bold;"><s:text name="pingTarget.disabled"/></span> - </s:else> - </td> - - <!-- TODO: Use icons here --> - <td class="rollertable" align="center" > - <s:if test="#pingTarget.autoEnabled"> - <s:url var="disablePing" action="commonPingTargets!disable"> - <s:param name="pingTargetId" value="#pingTarget.id" /> - </s:url> - <s:a href="%{disablePing}"><s:text name="pingTarget.disable"/></s:a> - </s:if> - <s:else> - <s:url var="enablePing" action="commonPingTargets!enable"> - <s:param name="pingTargetId" value="#pingTarget.id" /> - </s:url> - <s:a href="%{enablePing}"><s:text name="pingTarget.enable"/></s:a> - </s:else> - </td> - - <td class="rollertable" align="center"> - <s:url var="editPing" action="commonPingTargetEdit"> - <s:param name="bean.id" value="#pingTarget.id" /> - </s:url> - <s:a href="%{editPing}"> - <img src='<c:url value="/images/page_white_edit.png"/>' border="0" alt="<s:text name="generic.edit" />" /> - </s:a> - </td> - - <td class="rollertable" align="center"> - <s:url var="removePing" action="commonPingTargets!deleteConfirm"> - <s:param name="pingTargetId" value="#pingTarget.id" /> - </s:url> - <s:a href="%{removePing}"> - <img src='<c:url value="/images/delete.png"/>' border="0" alt="<s:text name="pingTarget.remove" />" /> - </s:a> - </td> - +<p class="subtitle"><s:text name="commonPingTargets.subtitle"/></p> + +<p><s:text name="commonPingTargets.explanation"/></p> + +<table class="rollertable table table-striped"> + + <%-- Headings --%> + <tr class="rollertable"> + <th class="rollertable" width="20%%"><s:text name="generic.name"/></th> + <th class="rollertable" width="55%"><s:text name="pingTarget.pingUrl"/></th> + <th class="rollertable" width="15%" colspan="2"><s:text name="pingTarget.autoEnabled"/></th> + <th class="rollertable" width="5%"><s:text name="generic.edit"/></th> + <th class="rollertable" width="5%"><s:text name="pingTarget.remove"/></th> </tr> -</s:iterator> + + <%-- Listing of current common targets --%> + <s:iterator var="pingTarget" value="pingTargets" status="rowstatus"> + + <tr class="rollertable_odd"> + + <td class="rollertable"><s:property value="#pingTarget.name"/></td> + + <td class="rollertable"><s:property value="#pingTarget.pingUrl"/></td> + + <td class="rollertable" align="center"> + <s:if test="#pingTarget.autoEnabled"> + <span style="color: #00aa00; font-weight: bold;"><s:text name="pingTarget.enabled"/></span> + </s:if> + <s:else> + <span style="color: #aaaaaa; font-weight: bold;"><s:text name="pingTarget.disabled"/></span> + </s:else> + </td> + + <td class="rollertable" align="center"> + <s:if test="#pingTarget.autoEnabled"> + <s:url var="disablePing" action="commonPingTargets!disable"> + <s:param name="pingTargetId" value="#pingTarget.id"/> + </s:url> + <s:a href="%{disablePing}"> + <s:text name="pingTarget.disable"/> + </s:a> + </s:if> + <s:else> + <s:url var="enablePing" action="commonPingTargets!enable"> + <s:param name="pingTargetId" value="#pingTarget.id"/> + </s:url> + <s:a href="%{enablePing}"> + <s:text name="pingTarget.enable"/></s:a> + </s:else> + </td> + + <td class="rollertable" align="center"> + <s:url var="editPing" action="commonPingTargetEdit"> + <s:param name="bean.id" value="#pingTarget.id"/> + </s:url> + <s:a href="%{editPing}"> + <span class="glyphicon glyphicon-edit" aria-hidden="true"> </span> + </s:a> + </td> + + <td class="rollertable" align="center"> + <s:url var="removePing" action="commonPingTargets!deleteConfirm"> + <s:param name="pingTargetId" value="#pingTarget.id"/> + </s:url> + <a href="#" onclick="showDeleteModal('<s:property value="#pingTarget.id"/>')"> + <span class="glyphicon glyphicon-trash" aria-hidden="true"> </span> + </a> + </td> + + </tr> + </s:iterator> </table> <div style="padding: 4px; font-weight: bold;"> <s:url var="addPing" action="commonPingTargetAdd"> - <s:param name="weblog" value="actionWeblog.handle" /> + <s:param name="weblog" value="actionWeblog.handle"/> </s:url> - <img src='<s:url value="/images/add.png"/>' border="0" alt="icon" /><s:a href="%{addPing}"><s:text name="pingTarget.addTarget" /></s:a> + <s:a href="%{addPing}"> + <span class="glyphicon glyphicon-plus-sign" aria-hidden="true"> </span> + <s:text name="pingTarget.addTarget"/> + </s:a> +</div> + + +<div id="delete-ping-target-modal" class="modal fade ping-target-modal" tabindex="-1" role="dialog"> + + <div class="modal-dialog modal-lg"> + + <div class="modal-content"> + + <s:form theme="bootstrap" cssClass="form-horizontal"> + <s:hidden name="salt"/> + <s:hidden id="removeId" name="pingTargetId"/> + + <div class="modal-header"> + <div class="modal-title"> + <h3><s:text name="pingTarget.confirmRemoveTitle"/></h3> + </div> + </div> + + <div class="modal-body"> + <s:text name="pingTarget.confirmCommonRemove"/> + </div> + + <div class="modal-footer"> + <s:submit cssClass="btn btn-danger" + value="%{getText('generic.yes')}" action="commonPingTargets!delete"/> + <s:submit cssClass="btn btn-default" + value="%{getText('generic.cancel')}" action="commonPingTargets"/> + </div> + + </s:form> + + </div> + + </div> + </div> + + +<script> + function showDeleteModal( removeId ) { + $('#removeId').val(removeId); + $('#delete-ping-target-modal').modal({show: true}); + } +</script> + http://git-wip-us.apache.org/repos/asf/roller/blob/44b008d5/app/src/main/webapp/WEB-INF/jsps/editor/Bookmarks.jsp ---------------------------------------------------------------------- diff --git a/app/src/main/webapp/WEB-INF/jsps/editor/Bookmarks.jsp b/app/src/main/webapp/WEB-INF/jsps/editor/Bookmarks.jsp index 3c2e364..928e93c 100644 --- a/app/src/main/webapp/WEB-INF/jsps/editor/Bookmarks.jsp +++ b/app/src/main/webapp/WEB-INF/jsps/editor/Bookmarks.jsp @@ -112,50 +112,45 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and <%-- Bookmarks --%> <s:iterator var="bookmark" value="folder.bookmarks" status="rowstatus"> - <s:if test="#rowstatus.odd == true"> - <tr class="rollertable_odd"> - </s:if> - <s:else> - <tr class="rollertable_even"> - </s:else> - - <td class="rollertable center" style="vertical-align:middle"> - <input type="checkbox" name="selectedBookmarks" onchange="selectionChanged()" - title="<s:text name="bookmarksForm.selectOneLabel"><s:param value="#bookmark.name"/></s:text>" - value="<s:property value="#bookmark.id"/>"/> - </td> - - <td> - <str:truncateNicely lower="40" upper="50"> - <s:property value="#bookmark.name"/> - </str:truncateNicely> - </td> - - <td> - <s:if test="#bookmark.url != null"> - <a href='<s:property value="#bookmark.url" />' target='_blank'> - <str:truncateNicely lower="70" upper="90"> - <s:property value="#bookmark.url"/> - </str:truncateNicely> - <span class="glyphicon glyphicon-play-circle"></span> + <tr class="rollertable_odd"> + + <td class="rollertable center" style="vertical-align:middle"> + <input type="checkbox" name="selectedBookmarks" onchange="selectionChanged()" + title="<s:text name="bookmarksForm.selectOneLabel"><s:param value="#bookmark.name"/></s:text>" + value="<s:property value="#bookmark.id"/>"/> + </td> + + <td> + <str:truncateNicely lower="40" upper="50"> + <s:property value="#bookmark.name"/> + </str:truncateNicely> + </td> + + <td> + <s:if test="#bookmark.url != null"> + <a href='<s:property value="#bookmark.url" />' target='_blank'> + <str:truncateNicely lower="70" upper="90"> + <s:property value="#bookmark.url"/> + </str:truncateNicely> + <span class="glyphicon glyphicon-play-circle"></span> + </a> + </s:if> + + </td> + + <td align="center"> + + <a href="#" onclick="editBookmark( + '<s:property value="#bookmark.id"/>', + '<s:property value="#bookmark.name"/>', + '<s:property value="#bookmark.url"/>', + '<s:property value="#bookmark.feedUrl"/>', + '<s:property value="#bookmark.description"/>', + '<s:property value="#bookmark.image"/>' )"> + <span class="glyphicon glyphicon-edit"></span> </a> - </s:if> - - </td> - <td align="center"> - - <a href="#" onclick="editBookmark( - '<s:property value="#bookmark.id"/>', - '<s:property value="#bookmark.name"/>', - '<s:property value="#bookmark.url"/>', - '<s:property value="#bookmark.feedUrl"/>', - '<s:property value="#bookmark.description"/>', - '<s:property value="#bookmark.image"/>' )"> - <span class="glyphicon glyphicon-edit"></span> - </a> - - </td> + </td> </tr> @@ -277,7 +272,7 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and function nameChanged() { var newName = $("#bookmarks_folder_name:first").val(); - if (newName && newName != originalName && newName.trim().length > 0) { + if (newName && newName !== originalName && newName.trim().length > 0) { renameButton.attr("disabled", false); renameButton.addClass("btn-success"); @@ -345,7 +340,7 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and function onMoveToFolder() { var bookmarksForm = $("#bookmarks")[0]; - bookmarksForm.action = "bookmarks!move.rol"; + bookmarksForm.action = "bookmarks!move.rol"; bookmarksForm.submit(); } @@ -354,7 +349,7 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and var bookmarksForm = $("#bookmarks")[0]; var folderEditForm = $("#folderEditForm")[0]; - if ("new_blogroll" == bookmarksForm.viewFolderId.value) { + if ("new_blogroll" === bookmarksForm.viewFolderId.value) { newBlogroll(); } else { @@ -458,7 +453,7 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and var feedbackAreaBlogrollEdit = $("#feedback-area-blogroll-edit"); // if name is empty reject and show error message - if ($("#folderEditForm_bean_name").val().trim() == "") { + if ($("#folderEditForm_bean_name").val().trim() === "") { feedbackAreaBlogrollEdit.html('<s:text name="bookmarksForm.blogroll.requiredFields" />'); feedbackAreaBlogrollEdit.css("color", "red"); return; @@ -763,7 +758,7 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and var elem = $('#bookmark_required_fields:first'); var message = ''; - if (name.length > 0 && url.length > 0 && badUrls.length == 0) { + if (name.length > 0 && url.length > 0 && badUrls.length === 0) { saveBookmarkButton.attr("disabled", false); message = '<s:text name="generic.looksGood" />'; @@ -775,7 +770,7 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and } else { saveBookmarkButton.attr("disabled", true); - if (name.length == 0 || url.length == 0) { + if (name.length === 0 || url.length === 0) { message = '<s:text name="bookmarkForm.required" />'; } if (badUrls.length > 0) {
