Skip to content

Commit

Permalink
fixes read mode
Browse files Browse the repository at this point in the history
issue #556
  • Loading branch information
rsoika committed Nov 8, 2023
1 parent 83bc75d commit c08305a
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 165 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
<f:subview>
<ui:include src="/pages/workitems/forms/custom_sections.xhtml">
<ui:param name="customFormSections" value="#{subform.sections}" />

<ui:param name="workitem" value="#{workflowController.workitem}" />
<ui:param name="readonly" value="#{section.readonly}" />
</ui:include>
</f:subview>
</div>
Expand All @@ -35,7 +36,8 @@
<!-- No Tabs -->
<ui:include src="/pages/workitems/forms/custom_sections.xhtml">
<ui:param name="customFormSections" value="#{customFormController.sections}" />

<ui:param name="workitem" value="#{workflowController.workitem}" />
<ui:param name="readonly" value="#{section.readonly}" />
</ui:include>
</c:if>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,114 +4,48 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:i="http://xmlns.jcp.org/jsf/composite/imixs"
xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty">

<c:forEach items="#{customFormController.sections}" var="section">
<h:panelGroup id="custom_subview_id" binding="#{customFormComponents}">

<!-- #{customFormController.setReadOnly(true)} -->

<c:if test="#{! empty section.label}">
<h3>#{section.label}</h3>
</c:if>

<!-- test if custom form section -->
<c:if test="#{! empty section.path}">
<ui:include src="/pages/workitems/forms/#{section.path}.xhtml">
<ui:param name="workitem" value="#{workflowController.workitem}" />
<ui:param name="readonly" value="#{true}" />
</ui:include>
</c:if>

<!-- standard form section -->
<c:if test="#{empty section.path}">
<div
class="imixs-form-section#{(empty section.columns)?'':'-'.concat(section.columns)}">

<c:forEach items="#{section.items}" var="item">
<c:if test="#{!item.hide}">
<dl>
<dt>
#{item.label}
<c:if test="#{item.required}">
<span class="imixs-required"> *</span>
</c:if>
</dt>
<dd>
<!-- text -->
<c:if test="#{item.type eq 'text'}">
<h:outputText value="#{workitem.item[item.name]}" />
</c:if>

<!-- long -->
<c:if test="#{item.type eq 'number'}">
<h:outputText value="#{workitem.item[item.name]}">
<f:convertNumber/>
</h:outputText>
</c:if>

<!-- currency -->
<c:if test="#{item.type eq 'currency'}">
<h:outputText value="#{workitem.item[item.name]}">
<f:convertNumber minFractionDigits="2" locale="de" />
</h:outputText>
</c:if>

<!-- date -->
<c:if test="#{item.type eq 'date'}">
<h:outputText value="#{workitem.item[item.name]}">
<f:convertDateTime timeZone="#{message.timeZone}"
pattern="#{message.datePatternShort}" />
</h:outputText>
</c:if>

<!-- text area -->
<c:if test="#{item.type eq 'textarea'}">
<h:outputText escape="true"
value="#{workitem.item[item.name]}" />
</c:if>


<!-- text list -->
<c:if test="#{item.type eq 'textlist'}">
<ui:repeat var="itemvalue"
value="#{workitem.itemList[item.name]}">
<h:outputText value="#{itemvalue}"></h:outputText>
<br />
</ui:repeat>
</c:if>
<!-- HTML -->
<c:if test="#{item.type eq 'html'}">
<h:outputText escape="false"
value="#{workitem.item[item.name]}" />
</c:if>

<!-- Options List -->
<c:if test="#{item.type eq 'selectBooleanCheckbox' or item.type eq 'selectOneMenu' or item.type eq 'selectOneRadio' or item.type eq 'selectManyCheckbox' or item.type eq 'selectManyCheckboxPageDirection' or item.type eq 'selectOneRadioPageDirection'}">
<ui:repeat var="itemvalue" value="#{workitem.itemList[item.name]}">
<h:outputText value="#{itemvalue}"></h:outputText><br />
</ui:repeat>
</c:if>



<!-- custom subview -->
<c:if test="#{item.type eq 'custom'}">

<ui:include src="/pages/workitems/parts/#{item.path}.xhtml">
<!-- test if sub-forms are defined -->
<c:if test="#{! empty customFormController.subforms}">
<div class="imixs-tabs">
<ul>
<c:forEach items="#{customFormController.subforms}" var="subform">
<li><a href="#tab-#{subform.id}">#{subform.label}</a></li>
</c:forEach>
</ul>
<c:forEach items="#{customFormController.subforms}" var="subform">
<div id="tab-#{subform.id}">
<f:subview>
<ui:include src="/pages/workitems/forms/custom_sections.xhtml">
<ui:param name="customFormSections" value="#{subform.sections}" />
<ui:param name="workitem" value="#{workflowController.workitem}" />
<ui:param name="required" value="#{item.required}" />
<ui:param name="readonly" value="#{true}" />
<ui:param name="name" value="#{item.name}" />
<ui:param name="options" value="#{item.options}" />
<ui:param name="readonly" value="#{section.readonly}" />
</ui:include>


</c:if>
</dd>
</dl>
</c:if>
</c:forEach>
</div>
</f:subview>
</div>
</c:forEach>
</div>
</c:if>


<c:if test="#{empty customFormController.subforms}">
<!-- No Tabs -->
<ui:include src="/pages/workitems/forms/custom_sections.xhtml">
<ui:param name="customFormSections" value="#{customFormController.sections}" />
<ui:param name="workitem" value="#{workflowController.workitem}" />
<ui:param name="readonly" value="#{section.readonly}" />
</ui:include>
</c:if>

</h:panelGroup>

</c:forEach>
</ui:composition>

Original file line number Diff line number Diff line change
Expand Up @@ -124,60 +124,59 @@
<!-- Options List -->
<c:if
test="#{item.type eq 'selectBooleanCheckbox' or item.type eq 'selectOneMenu' or item.type eq 'selectOneRadio' or item.type eq 'selectManyCheckbox' or item.type eq 'selectManyCheckboxPageDirection' or item.type eq 'selectOneRadioPageDirection'}">
<c:choose>
<!-- read only mode -->
<c:when test="#{item.readonly}">
<ui:repeat var="itemvalue"

<ui:fragment rendered="#{item.readonly}">
<ui:repeat var="itemvalue"
value="#{workitem.itemList[item.name]}">
<h:outputText value="#{itemvalue}"></h:outputText>
<br />
</ui:repeat>
</c:when>
<!-- Edit mode -->
<c:otherwise>
<c:if test="#{item.type eq 'selectBooleanCheckbox'}">
<h:selectBooleanCheckbox required="#{item.required?validationController.required:false}"
pt:data-item="#{item.name}" disabled="#{item.disabled}"
value="#{workitem.item[item.name]}">
</h:selectBooleanCheckbox>
</c:if>
<c:if test="#{item.type eq 'selectOneMenu'}">
<h:selectOneMenu required="#{item.required?validationController.required:false}"
pt:data-item="#{item.name}" disabled="#{item.disabled}"
value="#{workitem.item[item.name]}">
<f:selectItems value="#{item.selectItems}" />
</h:selectOneMenu>
</c:if>
<c:if test="#{item.type eq 'selectOneRadio'}">
<h:selectOneRadio required="#{item.required?validationController.required:false}"
pt:data-item="#{item.name}" disabled="#{item.disabled}"
value="#{workitem.item[item.name]}">
<f:selectItems value="#{item.selectItems}" />
</h:selectOneRadio>
</c:if>
<c:if test="#{item.type eq 'selectOneRadioPageDirection'}">
<h:selectOneRadio required="#{item.required?validationController.required:false}"
pt:data-item="#{item.name}" layout="pageDirection" disabled="#{item.disabled}"
value="#{workitem.item[item.name]}">
<f:selectItems value="#{item.selectItems}" />
</h:selectOneRadio>
</c:if>
<c:if test="#{item.type eq 'selectManyCheckbox'}">
<h:selectManyCheckbox required="#{item.required?validationController.required:false}"
pt:data-item="#{item.name}" disabled="#{item.disabled}"
value="#{workitem.itemListArray[item.name]}">
<f:selectItems value="#{item.selectItems}" />
</h:selectManyCheckbox>
</c:if>
<c:if test="#{item.type eq 'selectManyCheckboxPageDirection'}">
<h:selectManyCheckbox required="#{item.required?validationController.required:false}"
pt:data-item="#{item.name}" layout="pageDirection" disabled="#{item.disabled}"
value="#{workitem.itemListArray[item.name]}">
<f:selectItems value="#{item.selectItems}" />
</h:selectManyCheckbox>
</c:if>
</c:otherwise>
</c:choose>
</ui:repeat>
</ui:fragment>
<ui:fragment rendered="#{!item.readonly}">
<c:if test="#{item.type eq 'selectBooleanCheckbox'}">
<h:selectBooleanCheckbox required="#{item.required?validationController.required:false}"
pt:data-item="#{item.name}" disabled="#{item.disabled}"
value="#{workitem.item[item.name]}">
</h:selectBooleanCheckbox>
</c:if>
<c:if test="#{item.type eq 'selectOneMenu'}">
<h:selectOneMenu required="#{item.required?validationController.required:false}"
pt:data-item="#{item.name}" disabled="#{item.disabled}"
value="#{workitem.item[item.name]}">
<f:selectItems value="#{item.selectItems}" />
</h:selectOneMenu>
</c:if>
<c:if test="#{item.type eq 'selectOneRadio'}">
<h:selectOneRadio required="#{item.required?validationController.required:false}"
pt:data-item="#{item.name}" disabled="#{item.disabled}"
value="#{workitem.item[item.name]}">
<f:selectItems value="#{item.selectItems}" />
</h:selectOneRadio>
</c:if>
<c:if test="#{item.type eq 'selectOneRadioPageDirection'}">
<h:selectOneRadio required="#{item.required?validationController.required:false}"
pt:data-item="#{item.name}" layout="pageDirection" disabled="#{item.disabled}"
value="#{workitem.item[item.name]}">
<f:selectItems value="#{item.selectItems}" />
</h:selectOneRadio>
</c:if>
<c:if test="#{item.type eq 'selectManyCheckbox'}">
<h:selectManyCheckbox required="#{item.required?validationController.required:false}"
pt:data-item="#{item.name}" disabled="#{item.disabled}"
value="#{workitem.itemListArray[item.name]}">
<f:selectItems value="#{item.selectItems}" />
</h:selectManyCheckbox>
</c:if>
<c:if test="#{item.type eq 'selectManyCheckboxPageDirection'}">
<h:selectManyCheckbox required="#{item.required?validationController.required:false}"
pt:data-item="#{item.name}" layout="pageDirection" disabled="#{item.disabled}"
value="#{workitem.itemListArray[item.name]}">
<f:selectItems value="#{item.selectItems}" />
</h:selectManyCheckbox>
</c:if>
</ui:fragment>

</c:if>
<!-- custom subview -->
<c:if test="#{item.type eq 'custom'}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
xmlns:i="http://xmlns.jcp.org/jsf/composite/imixs"
xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty">

<ui:fragment rendered="#{!item.readonly}" >
<ui:fragment rendered="#{!readonly}" >
<h:selectManyListbox style="height:5em;" required="#{required}" value="#{workitem.itemListArray[item.name]}">
<f:selectItem itemLabel=""></f:selectItem>
<f:selectItems itemDisabled="#{readonly}"
value="#{countryController.getCountriesSelectItems()}"></f:selectItems>
</h:selectManyListbox>
</ui:fragment>
<ui:fragment rendered="#{item.readonly}" >
<ui:fragment rendered="#{readonly}" >
<h:outputText value="#{countryController.getCountryNames(workitem.itemList[item.name])}"></h:outputText>
</ui:fragment>
</ui:composition>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,16 @@
xmlns:i="http://xmlns.jcp.org/jsf/composite/imixs"
xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty">

<ui:fragment rendered="#{!item.readonly}">


<ui:fragment rendered="#{!readonly}">
<h:inputText value="#{workitem.item[item.name]}" pt:data-item="#{item.name}"
required="#{item.required?validationController.required:false}" rendered="#{!item.readonly}"
required="#{required?validationController.required:false}" rendered="#{!readonly}"
onkeyup="imixsOfficeWorkitem.formatIBAN(this);"
disabled="#{item.disabled}">


disabled="#{disabled}">
</h:inputText>


</ui:fragment>
<ui:fragment rendered="#{item.readonly}">
<ui:fragment rendered="#{readonly}">
<h:outputText value="#{workitem.item[item.name]}"></h:outputText>
</ui:fragment>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
xmlns:i="http://xmlns.jcp.org/jsf/composite/imixs"
xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty">

<ui:fragment rendered="#{!item.readonly}" >
<ui:fragment rendered="#{!readonly}" >
<div class="imixs-signature-pad">
<canvas height="150" width="360"><!-- Signature field --></canvas>
<p><a href="#" class="imixs-signature-clear-action">Clear</a></p>
<h:inputHidden class="imixs-signature-input" value="#{workitem.item[item.name]}"/>
</div>
</ui:fragment>
<ui:fragment rendered="#{item.readonly}" >
<ui:fragment rendered="#{readonly}" >
<h:graphicImage
value="#{workitem.item[item.name]}"/>
</ui:fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,21 @@ public void computeFieldDefinition(ItemCollection workitem) throws ModelExceptio

}

/**
* This method overwrite the 'readOnly' status flag for all sections.
*
* @param readOnly
*/
public void setReadOnly(boolean readOnly) {
for (CustomFormSection _section : getSections()) {
_section.setReadonly(readOnly);
for (CustomFormItem _item : _section.getItems()) {
_item.setReadonly(readOnly);
}

}
}

/**
* This helper method pareses a parent-node for 'imixs-form-section'
* tags and returns a list of CustomFormSections
Expand Down

0 comments on commit c08305a

Please sign in to comment.