Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
Issue #874
  • Loading branch information
rsoika committed Sep 6, 2024
1 parent 6b750b5 commit fba92dc
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 138 deletions.
Original file line number Diff line number Diff line change
@@ -1,81 +1,73 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:cc="http://xmlns.jcp.org/jsf/composite">

<cc:interface>
<cc:attribute name="hideattachments" default="false" type="java.lang.Boolean"></cc:attribute>
<cc:attribute name="workitem"></cc:attribute>
<cc:attribute name="context_url"></cc:attribute>
<cc:attribute name="styleClass"></cc:attribute>
<cc:attribute name="labelButton" default="File Upload"></cc:attribute>
<cc:attribute name="labelHelp" default="drop files here..."></cc:attribute>

</cc:interface>
<!--
<cc:interface>
<cc:attribute name="hideattachments" default="false" type="java.lang.Boolean"></cc:attribute>
<cc:attribute name="workitem"></cc:attribute>
<cc:attribute name="context_url"></cc:attribute>
<cc:attribute name="styleClass"></cc:attribute>
<cc:attribute name="labelButton" default="File Upload"></cc:attribute>
<cc:attribute name="labelHelp" default="drop files here..."></cc:attribute>
</cc:interface>
<!--
This component uses jquery fileupload plugin
This component uses jquery fileupload plugin
-->
<cc:implementation>
-->
<cc:implementation>

<!-- We inject the workitem into the fileUploadController to receive new file data from the AjaxFileUploadServlet
<!-- We inject the workitem into the fileUploadController to receive new file data from the AjaxFileUploadServlet
#{fileUploadController.setWorkitem(cc.attrs.workitem)}"
-->
<h:panelGroup class="imixsFileUpload #{cc.attrs.styleClass}">
<div class="imixsFileUpload_control">
<button class="imixsFileUpload_button">#{cc.attrs.labelButton}</button>
<!-- we need to append the converstaion id to the AjaxFileUploadServlet url here -->
<input class="imixsFileUpload_input" type="file" name="files[]"
data-url="#{facesContext.externalContext.requestContextPath}/fileupload/?cid=#{fileUploadController.getCID()}"
multiple="multiple" />
<div class="imixsFileUpload_help">#{cc.attrs.labelHelp}</div>
</div>
<div class="imixsFileUpload_progress_bar" />
<h:panelGroup id="imixsFileUpload_dataTable">
<h:panelGroup class="imixsFileUpload #{cc.attrs.styleClass}">
<div class="imixsFileUpload_control">
<button class="imixsFileUpload_button">#{cc.attrs.labelButton}</button>
<!-- we need to append the converstaion id to the AjaxFileUploadServlet url here -->
<input class="imixsFileUpload_input" type="file" name="files[]"
data-url="/fileupload/?cid=#{fileUploadController.getCID()}" multiple="multiple" />
<div class="imixsFileUpload_help">#{cc.attrs.labelHelp}</div>
</div>
<div class="imixsFileUpload_progress_bar" />
<h:panelGroup id="imixsFileUpload_dataTable">

<!-- show no attachments (dummy table) -->
<ui:fragment rendered="#{cc.attrs.hideattachments}">
<table class="imixsFileUpload_uploadlist">
</table>
</ui:fragment>
<!-- show no attachments (dummy table) -->
<ui:fragment rendered="#{cc.attrs.hideattachments}">
<table class="imixsFileUpload_uploadlist">
</table>
</ui:fragment>

<!-- show no attachments from workitem -->
<ui:fragment rendered="#{!cc.attrs.hideattachments}">
<!-- attached files -->
<h:dataTable value="#{fileUploadController.persistedFiles}" var="fileData"
styleClass="imixsFileUpload_uploadlist" >
<!-- show no attachments from workitem -->
<ui:fragment rendered="#{!cc.attrs.hideattachments}">
<!-- attached files -->
<h:dataTable value="#{fileUploadController.persistedFiles}" var="fileData"
styleClass="imixsFileUpload_uploadlist">
<h:column>
<h:outputText escape="false" value="&lt;a class='imixsFileUpload_file' target='_blank' href='" />
<h:outputText escape="false"
value="#{cc.attrs.context_url}/file/#{fileData.name}" />
value="&lt;a class='imixsFileUpload_file' target='_blank' href='" />
<h:outputText escape="false" value="#{cc.attrs.context_url}/file/#{fileData.name}" />
<h:outputText escape="false" value="'&gt;#{fileData.name}&lt;/a&gt;" />
</h:column>
<h:column>
#{fileUploadController.getFileSize(fileData.name)}
#{fileUploadController.getFileSize(fileData.name)}
</h:column>
<!-- delete stored file -->
<h:column>
<h:commandLink value="#{global.delete}"
styleClass="imixsFileUpload_delete"
<h:commandLink value="#{global.delete}" styleClass="imixsFileUpload_delete"
actionListener="#{fileUploadController.removePersistedFile(fileData.name)}">
<f:ajax
render=":#{component.parent.parent.parent.parent.clientId}"
<f:ajax render=":#{component.parent.parent.parent.parent.clientId}"
onevent="function(data) { $('.imixsFileUpload').imixsLayout();updateFileUpload(); }" />
<f:param name="cid" value="#{fileUploadController.getCID()}" />
</h:commandLink>
</h:column>
</h:dataTable>
</ui:fragment>
</h:panelGroup>


</h:panelGroup>
</cc:implementation>
</h:dataTable>
</ui:fragment>
</h:panelGroup>


</h:panelGroup>
</cc:implementation>

</ui:composition>


</ui:composition>
Original file line number Diff line number Diff line change
@@ -1,85 +1,53 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:cc="http://xmlns.jcp.org/jsf/composite">

<!-- INTERFACE -->
<cc:interface>

<cc:attribute name="disablecss" default="false"
type="java.lang.Boolean"></cc:attribute>

<cc:attribute name="disablejquery" default="false"
type="java.lang.Boolean"></cc:attribute>

<cc:attribute name="disablefileupload" default="false"
type="java.lang.Boolean"></cc:attribute>

<cc:attribute name="dateformat" default="yyyy-MM-dd"
type="java.lang.String"></cc:attribute>

<cc:attribute name="build" default=""
type="java.lang.String"></cc:attribute>

<cc:attribute name="theme"
default="#{facesContext.externalContext.requestContextPath}/imixs/jquery/themes/imixs/jquery-ui.min.css" />

</cc:interface>

<!-- IMPLEMENTATION -->
<cc:implementation>
<c:if test="#{!cc.attrs.disablejquery}">
<script type="text/javascript"
src="#{facesContext.externalContext.requestContextPath}/imixs/jquery/jquery-3.5.1.min.js"></script>
</c:if>

<!-- Theme: #{cc.attrs.theme} disabled:#{cc.attrs.disablecss} -->
<c:if test="#{!cc.attrs.disablecss}">
<link type="text/css" href="#{cc.attrs.theme}" rel="stylesheet" />
<script type="text/javascript"
src="#{facesContext.externalContext.requestContextPath}/imixs/jquery/themes/imixs/jquery-ui.min.js"></script>
</c:if>

<!-- Disable jquery fileupload plugin -->
<c:if test="#{!cc.attrs.disablefileupload}">
<script type="text/javascript"
src="#{facesContext.externalContext.requestContextPath}/imixs/jquery/jquery.iframe-transport.js"></script>
<script type="text/javascript"
src="#{facesContext.externalContext.requestContextPath}/imixs/jquery/jquery.fileupload.js"></script>
</c:if>


<script type="text/javascript"
src="#{facesContext.externalContext.requestContextPath}/imixs/imixs-faces.js?build=#{cc.attrs.build}"></script>

<!-- Init script -->
<script type="text/javascript">
/*<![CDATA[*/

var disablecss=#{cc.attrs.disablecss};

$(document)
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core" xmlns:cc="http://xmlns.jcp.org/jsf/composite">

<!-- INTERFACE -->
<cc:interface>
<cc:attribute name="disablecss" default="false" type="java.lang.Boolean"></cc:attribute>
<cc:attribute name="disablejquery" default="false" type="java.lang.Boolean"></cc:attribute>
<cc:attribute name="disablefileupload" default="false" type="java.lang.Boolean"></cc:attribute>
<cc:attribute name="dateformat" default="yyyy-MM-dd" type="java.lang.String"></cc:attribute>
<cc:attribute name="build" default="" type="java.lang.String"></cc:attribute>
<cc:attribute name="theme" default="/imixs/jquery/themes/imixs/jquery-ui.min.css" />
</cc:interface>

<!-- IMPLEMENTATION -->
<cc:implementation>
<c:if test="#{!cc.attrs.disablejquery}">
<script type="text/javascript" src="/imixs/jquery/jquery-3.5.1.min.js"></script>
</c:if>

<!-- Theme: #{cc.attrs.theme} disabled:#{cc.attrs.disablecss} -->
<c:if test="#{!cc.attrs.disablecss}">
<link type="text/css" href="#{cc.attrs.theme}" rel="stylesheet" />
<script type="text/javascript" src="/imixs/jquery/themes/imixs/jquery-ui.min.js"></script>
</c:if>

<!-- Disable jquery fileupload plugin -->
<c:if test="#{!cc.attrs.disablefileupload}">
<script type="text/javascript" src="/imixs/jquery/jquery.iframe-transport.js"></script>
<script type="text/javascript" src="/imixs/jquery/jquery.fileupload.js"></script>
</c:if>

<script type="text/javascript" src="/imixs/imixs-faces.js?build=#{cc.attrs.build}"></script>

<!-- Init script -->
<script type="text/javascript">
/*<![CDATA[*/

var disablecss =#{ cc.attrs.disablecss };
$(document)
.ready(
function() {

if (!disablecss) {
setDateFormat('#{cc.attrs.dateformat}');
$(this).imixsInitFileUpload();
$(this).imixsLayout();

$("span.imixs-tooltip").layoutImixsTooltip();

}
});

/*]]>*/
</script>


</cc:implementation>



</ui:composition>


function () {
if (!disablecss) {
setDateFormat('#{cc.attrs.dateformat}');
$(this).imixsInitFileUpload();
$(this).imixsLayout();
$("span.imixs-tooltip").layoutImixsTooltip();
}
});

/*]]>*/
</script>
</cc:implementation>
</ui:composition>

0 comments on commit fba92dc

Please sign in to comment.