1 <!--ProductCategory.xml--> 2 3 <?xml version="1.0" encoding="UTF-8"?> 4 <screen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/xml-screen-2.0.xsd" 5 default-menu-title="ProductCategory" default-menu-index="1"> 6 7 <subscreens default-item="ProductCategoryList"/> 8 9 <widgets> 10 <subscreens-panel id="productCategory-panel" type="popup" title="ProductCategory"/> 11 </widgets> 12 </screen>
1 <!--ProductCategoryList.xml--> 2 3 <?xml version="1.0" encoding="UTF-8"?> 4 <screen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/xml-screen-2.0.xsd" 5 default-menu-title="ProductCategoryList" default-menu-index="1"> 6 7 <transition name="editProductCategoryContent"><default-response url="../EditProductCategoryContent"/></transition> 8 9 <actions> 10 <entity-find entity-name="mantle.product.category.ProductCategory" list="productCategoryList"> 11 <search-form-inputs /> 12 </entity-find> 13 </actions> 14 <widgets> 15 <form-list name="ListProductCategory" list="productCategoryList"> 16 <field name="productCategoryId"> 17 <default-field> 18 <link url="editProductCategoryContent" text="${productCategoryId}"/> 19 </default-field> 20 </field> 21 <auto-fields-entity entity-name="mantle.product.category.ProductCategory" field-type="find-display" include="nonpk"/> 22 </form-list> 23 </widgets> 24 </screen>
1 <!--EditProductCategoryContent.xml--> 2 3 <?xml version="1.0" encoding="UTF-8"?> 4 <screen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/xml-screen-2.0.xsd" 5 default-menu-title="ProductCategoryList" default-menu-index="1"> 6 <parameter name="productCategoryId" required="true"/> 7 8 <transition name="updateProductCategoryContent"><service-call name="update#mantle.product.category.ProductCategoryContent"/> 9 <default-response url="."/></transition> 10 <transition name="deleteProductCategoryContent"><service-call name="delete#mantle.product.category.ProductCategoryContent"/> 11 <default-response url="."/></transition> 12 13 <transition name="uploadProductCategoryContent"> 14 <actions><script><![CDATA[ 15 import org.moqui.context.ResourceReference 16 org.moqui.context.ExecutionContext ec = context.ec 17 18 org.apache.commons.fileupload.FileItem contentFile = context.contentFile 19 String fileName = contentFile.getName() 20 ec.logger.info("Uploading file [${fileName}] for ProductCategory [${productCategoryId}] in repository [${repositoryName}] with content type [${categoryContentTypeEnumId}] and locale [${locale}]") 21 22 // String contentLocation = "content://${repositoryName}/mantle/ProductCategory/${productCategoryId}/content/${fileName}" 23 String contentLocation = "dbresource://mantle/productCategory/${productCategoryId}/content/${fileName}" 24 ResourceReference newRr = ec.resource.getLocationReference(contentLocation) 25 InputStream fileStream = contentFile.getInputStream() 26 newRr.putStream(fileStream) 27 fileStream.close() 28 29 ec.service.sync().name("create", "mantle.product.category.ProductCategoryContent").parameters([productCategoryId: productCategoryId, 30 contentLocation: contentLocation, categoryContentTypeEnumId: categoryContentTypeEnumId, locale: locale]).call() 31 ]]></script></actions> 32 <default-response url="."/> 33 </transition> 34 35 <actions> 36 <entity-find entity-name="mantle.product.category.ProductCategoryContent" list="productCategoryContentList"> 37 <econdition field-name="productCategoryId" from="productCategoryId"/> 38 <order-by field-name="contentLocation"/> 39 </entity-find> 40 </actions> 41 <widgets> 42 <container> 43 <container-dialog id="UploadCategoryContentDialog" button-text="Upload Content"> 44 <form-single name="UploadCategoryProductContent" transition="uploadProductCategoryContent"> 45 <field name="productCategoryId"><default-field><hidden/></default-field></field> 46 <field name="contentFile"><default-field><file/></default-field></field> 47 <field name="categoryContentTypeEnumId"><default-field> 48 <drop-down><entity-options> 49 <entity-find entity-name="moqui.basic.Enumeration"> 50 <econdition field-name="enumTypeId" value="ProductCategoryContentType"/> 51 <order-by field-name="description"/> 52 </entity-find> 53 </entity-options></drop-down> 54 </default-field></field> 55 <field name="locale"><default-field><text-line size="6"/></default-field></field> 56 <field name="submitButton"><default-field><submit confirmation="Really Add?"/></default-field></field> 57 </form-single> 58 </container-dialog> 59 </container> 60 <form-list name="ListProductCategoryContent" transition="updateProductCategoryContent" list="productCategoryContentList"> 61 <field name="productCategoryContentId"><default-field><display/></default-field></field> 62 <field name="productCategoryId"><default-field><display/></default-field></field> 63 <field name="contentLocation"><default-field title="Location"><display/></default-field></field> 64 <field name="categoryContentTypeEnumId"><default-field title="Content Type"> 65 <drop-down><entity-options><entity-find entity-name="moqui.basic.Enumeration"> 66 <econdition field-name="enumTypeId" value="ProductCategoryContentType"/> 67 <order-by field-name="description"/> 68 </entity-find></entity-options></drop-down> 69 </default-field></field> 70 <field name="locale"><default-field><text-line size="6"/></default-field></field> 71 <field name="submitButton"><default-field title="Update"><submit/></default-field></field> 72 <field name="deleteLink"> 73 <default-field title=" "> 74 <!-- the parameters for this will be auto-mapped: productId, contentLocation --> 75 <link url="deleteProductCategoryContent" text="Delete" confirmation="Really Delete?"/> 76 </default-field> 77 </field> 78 </form-list> 79 80 </widgets> 81 </screen>