#191 #403

Merged
merged 1 commit into from May 23, 2012
View
2 dotCMS/WEB-INF/messages/Language.properties
@@ -4806,5 +4806,7 @@ LOG_button=Update System Logging
cron-pattern-format=Seconds  Minutes  Hours  Day-of-month  Month  Day-of-week  Year
+Multiple-File-Upload-does-not-upload-custom-files-with-explicit-required-fields=Multiple File Upload does not upload custom files with explicit required fields
+
## BEGIN PLUGINS
## END PLUGINS
View
43 dotCMS/html/portlet/ext/files/upload_multiple.jsp
@@ -1,3 +1,5 @@
+<%@page import="com.dotmarketing.cache.FieldsCache"%>
+<%@page import="com.dotmarketing.portlets.structure.model.Field"%>
<%@page import="com.dotmarketing.portlets.structure.model.Structure"%>
<%@page import="com.dotmarketing.portlets.workflows.model.WorkflowScheme"%>
<%@page import="com.dotmarketing.portlets.fileassets.business.FileAssetAPI"%>
@@ -24,6 +26,19 @@ String selectedStructure = (request.getParameter("selectedStructure") != null )
Structure s = StructureFactory.getStructureByInode(selectedStructure);
WorkflowScheme scheme = APILocator.getWorkflowAPI().findSchemeForStruct(s);
+boolean hasExplicitRequiredFields = false;//GIT-191
+List<Field> fields = FieldsCache.getFieldsByStructureInode(selectedStructure);
+for (Field field : fields) {
+ if(field.isRequired()
+ // the below required fields values are implicitly set to content in UploadMultipleFilesAction._saveFileAsset()
+ && (!field.getVelocityVarName().equalsIgnoreCase("title")
+ && !field.getVelocityVarName().equalsIgnoreCase("fileName")
+ && !field.getVelocityVarName().equalsIgnoreCase("fileAsset")
+ && !field.getVelocityVarName().equalsIgnoreCase("hostFolder"))){
+ hasExplicitRequiredFields = true;
+ }
+}
+
PermissionAPI perAPI = APILocator.getPermissionAPI();
FileAPI fileAPI = APILocator.getFileAPI();
@@ -89,6 +104,31 @@ if(request.getParameter("in_frame")!=null){
}
</style>
<body>
+
+
+ <% if(hasExplicitRequiredFields){ %>
+
+ <div class="callOutBox" style="margin-left:40px;margin-right:40px;margin-bottom:10px" >
+ <b><%= LanguageUtil.get(pageContext, "Note") %></b>: <%= LanguageUtil.get(pageContext, "Multiple-File-Upload-does-not-upload-custom-files-with-explicit-required-fields") %>
+ </div>
+
+ <div class="buttonRow">
+ <button dojoType="dijit.form.Button" iconClass="cancelIcon">
+ <%= UtilMethods.escapeSingleQuotes(LanguageUtil.get(pageContext, "cancel")) %>
+ <script type="dojo/method" event="onClick" args="evt">
+ if(dijit.byId('addFileDialog')){
+ dijit.byId('addFileDialog').hide();
+ }else {
+ if(parent.closeAddFileDialog) {
+ parent.closeAddFileDialog();
+ }
+ }
+ </script>
+ </button>
+ </div>
+
+ <% }else{ %>
+
<div id="tableDiv" style="display: ; position:relative; z-index: 100">
<html:form action="/ext/files/upload_multiple" method="POST" styleId="fm" enctype="multipart/form-data" onsubmit="return false;">
@@ -323,10 +363,11 @@ if(request.getParameter("in_frame")!=null){
</script>
</button>
</div>
- </div>
</html:form>
</div>
+<% } %>
+
<div id="messageDiv" class="messageBox shadowBox" style="display: none;">
<b><%= LanguageUtil.get(pageContext, "File-Uploading") %> . . .</b><BR>
<%= LanguageUtil.get(pageContext, "Note") %>: <%= LanguageUtil.get(pageContext, "This-window-will-redirect-you-back-when-the-file-has-been-uploaded") %>