Completed Media File Add page.
diff --git a/app/src/main/resources/ApplicationResources.properties b/app/src/main/resources/ApplicationResources.properties
index c887a55..5e7b5f8 100644
--- a/app/src/main/resources/ApplicationResources.properties
+++ b/app/src/main/resources/ApplicationResources.properties
@@ -756,10 +756,9 @@
# -- Media File Add
-mediaFileAdd.title=Add new media file(s)
-mediaFileAdd.pageTip=Use this page to upload up to five new media files. \
-Form fields that you set below will be applied to all files uploaded.
-mediaFileAdd.fileLocation=Choose file to upload
+mediaFileAdd.title=Add new media file
+mediaFileAdd.pageTip=Use this page to upload up to five new media files. The name, description, tags and other properties will be applied to all files uploaded.
+mediaFileAdd.fileLocation=Choose media files to upload
mediaFileAdd.tags=Tags (space separated)
mediaFileAdd.copyright=Copyright statement
mediaFileAdd.directory=Folder
@@ -809,7 +808,7 @@
mediaFileEdit.fileInfo=File info
mediaFileEdit.fileTypeSize=<b>Type</b>: {0} <b>Size</b>: {1} bytes
mediaFileEdit.fileDimensions=<b>Image</b>: {0} X {1} pixels
-mediaFileEdit.includeGallery=Include in Gallery?
+mediaFileEdit.includeGallery=Include in Gallery
mediaFileEdit.includeGalleryHelp=Check this box if you would like this media \
file included in the new media file RSS and Atom feeds for your weblog.
mediaFileEdit.updateFileContents=Update File Contents
diff --git a/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileAdd.jsp b/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileAdd.jsp
index e2e96a9..3cf419f 100644
--- a/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileAdd.jsp
+++ b/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileAdd.jsp
@@ -18,167 +18,104 @@
<%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %>
+<p class="subtitle"> <s:text name="mediaFileAdd.title"/> </p>
+<p class="pagetip"> <s:text name="mediaFileAdd.pageTip"/> </p>
+
+<s:form id="entry" action="mediaFileAdd!save"
+ method="POST" enctype="multipart/form-data" theme="bootstrap" cssClass="form-horizontal">
+ <s:hidden name="salt"/>
+ <s:hidden name="weblog"/>
+ <s:hidden name="directoryName"/>
+
+ <s:textfield name="bean.name" maxlength="255" label="%{getText('generic.name')}"/>
+
+ <s:textarea name="bean.description" rows="3" label="%{getText('generic.description')}"/>
+
+ <s:textarea name="bean.copyrightText" rows="3" label="%{getText('mediaFileAdd.copyright')}"/>
+
+ <s:textfield name="bean.tagsAsString" maxlength="255" label="%{getText('mediaFileAdd.tags')}"/>
+
+ <s:select name="bean.directoryId" list="allDirectories"
+ listKey="id" listValue="name" label="%{getText('mediaFileAdd.directory')}"/>
+
+ <s:checkbox name="bean.sharedForGallery"
+ label="%{getText('mediaFileAdd.includeGallery')}"
+ tooltip="%{getText('mediaFileEdit.includeGalleryHelp')}"/>
+
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h4 class="panel-title">
+ <s:text name="mediaFileAdd.fileLocation"/>
+ </h4>
+ </div>
+ <div class="panel-body">
+ <s:file id="fileControl0" name="uploadedFiles" size="30" />
+ <s:file id="fileControl1" name="uploadedFiles" size="30" />
+ <s:file id="fileControl2" name="uploadedFiles" size="30" />
+ <s:file id="fileControl3" name="uploadedFiles" size="30" />
+ <s:file id="fileControl4" name="uploadedFiles" size="30" />
+ </div>
+ </div>
+
+ <s:submit id="uploadButton" cssClass="btn btn-default"
+ value="%{getText('mediaFileAdd.upload')}" action="mediaFileAdd!save"/>
+ <s:submit cssClass="btn" value="%{getText('generic.cancel')}" action="mediaFileAdd!cancel"/>
+
+</s:form>
+
+
+<%-- ================================================================== --%>
+
<script>
- $(document).ready(function() {
- $("input[type='file']").change(function() {
+
+ $(document).ready(function () {
+
+ $("input[type='file']").change(function () {
+
var name = '';
var count = 0;
var fileControls = $("input[type='file']");
- for (var i=0; i<fileControls.size(); i++) {
+
+ for (var i = 0; i < fileControls.length; i++) {
if (jQuery.trim(fileControls.get(i).value).length > 0) {
count++;
name = fileControls.get(i).value;
}
}
- if (count == 1) {
- $("#entry_bean_name").get(0).disabled = false;
- $("#entry_bean_name").get(0).value = name;
+
+ var entryBean = $("#entry_bean_name");
+ if (count === 1) {
+ entryBean.get(0).disabled = false;
+ entryBean.get(0).value = getFileName(name);
+
} else if (count > 1) {
- $("#entry_bean_name").css("font-style","italic");
- $("#entry_bean_name").css("color","grey");
- $("#entry_bean_name").get(0).value = "<s:text name="mediaFileAdd.multipleNames" />";
- $("#entry_bean_name").get(0).disabled = true;
+ entryBean.css("font-style", "italic");
+ entryBean.css("color", "grey");
+ entryBean.get(0).value = "<s:text name="mediaFileAdd.multipleNames" />";
+ entryBean.get(0).disabled = true;
+ }
+
+ if (count > 0) {
+ $("#uploadButton:first").attr("disabled", false)
}
});
+
+ $("#uploadButton:first").attr("disabled", true)
});
function getFileName(fullName) {
- var backslashIndex = fullName.lastIndexOf('/');
- var fwdslashIndex = fullName.lastIndexOf('\\');
- var fileName;
- if (backslashIndex >= 0) {
- fileName = fullName.substring(backslashIndex + 1);
- } else if (fwdslashIndex >= 0) {
- fileName = fullName.substring(fwdslashIndex + 1);
- }
- else {
- fileName = fullName;
- }
- return fileName;
+ var backslashIndex = fullName.lastIndexOf('/');
+ var fwdslashIndex = fullName.lastIndexOf('\\');
+ var fileName;
+ if (backslashIndex >= 0) {
+ fileName = fullName.substring(backslashIndex + 1);
+ } else if (fwdslashIndex >= 0) {
+ fileName = fullName.substring(fwdslashIndex + 1);
+ }
+ else {
+ fileName = fullName;
+ }
+ return fileName;
}
-</script>
-
-<p class="subtitle">
- <s:text name="mediaFileAdd.title" />
-</p>
-<p class="pagetip">
- <s:text name="mediaFileAdd.pageTip" />
-</p>
-
-<s:form id="entry" action="mediaFileAdd!save" method="POST" enctype="multipart/form-data">
- <s:hidden name="salt" />
- <s:hidden name="weblog" />
- <s:hidden name="directoryName" />
-
- <%-- ================================================================== --%>
- <%-- Title, category, dates and other metadata --%>
-
- <table class="entryEditTable" cellpadding="0" cellspacing="0" width="100%">
-
- <tr>
- <td class="entryEditFormLabel">
- <label for="status"><s:text name="generic.name" /></label>
- </td>
- <td>
- <s:textfield name="bean.name" size="50" maxlength="255" style="width:30%"/>
- </td>
- </tr>
-
- <tr>
- <td class="entryEditFormLabel">
- <label for="status"><s:text name="generic.description" /></label>
- </td>
- <td>
- <s:textarea name="bean.description" cols="50" rows="5" style="width:30%"/>
- </td>
- </tr>
-
- <tr>
- <td class="entryEditFormLabel">
- <label for="status"><s:text name="mediaFileAdd.copyright" /></label>
- </td>
- <td>
- <s:textarea name="bean.copyrightText" cols="50" rows="3" style="width:30%"/>
- </td>
- </tr>
-
- <tr>
- <td class="entryEditFormLabel">
- <label for="status"><s:text name="mediaFileAdd.tags" /></label>
- </td>
- <td>
- <s:textfield name="bean.tagsAsString" size="50" maxlength="255" style="width:30%"/>
- </td>
- </tr>
-
- <tr>
- <td class="entryEditFormLabel">
- <label for="status"><s:text name="mediaFileAdd.directory" /></label>
- </td>
- <td>
- <s:select name="bean.directoryId" list="allDirectories" listKey="id" listValue="name" />
- </td>
- </tr>
-
- <tr>
- <td class="entryEditFormLabel">
- <label for="status"><s:text name="mediaFileAdd.includeGallery" /></label>
- </td>
- <td>
- <s:checkbox name="bean.sharedForGallery" />
- <s:text name="mediaFileEdit.includeGalleryHelp" />
- </td>
- </tr>
-
- <tr>
- <td>
- <br />
- <br />
- <br />
- </td>
- <td>
- </td>
- </tr>
-
- <tr>
- <td class="entryEditFormLabel">
- <label for="title"><s:text name="mediaFileAdd.fileLocation" /></label>
- </td>
- <td>
- <div id="fileControl0div" class="miscControl">
- <s:file id="fileControl0" name="uploadedFiles" size="30" />
- <br />
- </div>
-
- <div id="fileControl1div" class="miscControl">
- <s:file id="fileControl1" name="uploadedFiles" size="30" />
- <br />
- </div>
-
- <div id="fileControl2div" class="miscControl">
- <s:file id="fileControl2" name="uploadedFiles" size="30" />
- <br />
- </div>
-
- <div id="fileControl3div" class="miscControl">
- <s:file id="fileControl3" name="uploadedFiles" size="30" />
- <br />
- </div>
-
- <div id="fileControl4div" class="miscControl">
- <s:file id="fileControl4" name="uploadedFiles" size="30" />
- <br />
- </div>
- </td>
- </tr>
-
- </table>
-
- <br />
- <div class="control">
- <s:submit value="%{getText('mediaFileAdd.upload')}" action="mediaFileAdd!save" />
- <s:submit value="%{getText('generic.cancel')}" action="mediaFileAdd!cancel" />
- </div>
-
-</s:form>
+</script>
\ No newline at end of file
diff --git a/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileView.jsp b/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileView.jsp
index c30f863..09f5621 100644
--- a/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileView.jsp
+++ b/app/src/main/webapp/WEB-INF/jsps/editor/MediaFileView.jsp
@@ -337,7 +337,7 @@
</p>
<s:form id="entry" action="mediaFileEdit!save" method="POST" enctype="multipart/form-data"
- theme="bootd=strap" class="form-vertical">
+ theme="bootstrap" class="form-vertical">
<s:hidden name="salt"/>
<s:hidden name="weblog"/>