1

我是 AEM 的新手,我想在 cq 对话框中创建一个带有文件上传(pdf、jpeg)的页面模板。我只找到了缩略图的方法,但我找不到正确上传的方法。

缩略图想法/结构来自“创建集合”。

我的xml结构:

<form
    jcr:primaryType="nt:unstructured"
    sling:resourceType="granite/ui/components/coral/foundation/form"
    class="foundation-form content-container"
    foundationForm="{Boolean}true"
    maximized="{Boolean}true"
    method="post"
    style="vertical">
    <items jcr:primaryType="nt:unstructured">
        <thumbnail
            granite:class="share-resource-image grid"
            jcr:primaryType="nt:unstructured"
            sling:resourceType="dam/gui/coral/components/commons/thumbnail"
            asset="${empty param.item ? requestPathInfo.suffix : param.item}"
            defaultPreview="{Boolean}true">
            <actions jcr:primaryType="nt:unstructured">
                <upload
                granite:id="thumbnail-upload-button"
                jcr:primaryType="nt:unstructured"
                sling:resourceType="granite/ui/components/coral/foundation/form/fileupload"
                autoStart="{Boolean}false"
                mimeTypes="[image/png,image/jpeg,application/pdf]"
                multiple="{Boolean}false"
                name="coverImage"
                renderReadOnly="{Boolean}true"
                sizeLimit="100000000"
                text="Dokument hochladen"
                uploadUrl="will_be_replaced"
                useHTML5="{Boolean}false"/>
            </actions>
        </thumbnail>
        <removemanualthumbnail
            granite:id="removemanualthumbnail"
            jcr:primaryType="nt:unstructured"
            sling:resourceType="granite/ui/components/coral/foundation/form/hidden"
            name="removemanualthumbnail"
            value="false"/>
    </items>
</form>
4

2 回答 2

1

尝试使用这个:

<fileupload
    jcr:primaryType="nt:unstructured"
    jcr:title="files"
    sling:resourceType="granite/ui/components/foundation/form/fieldset">
    <items jcr:primaryType="nt:unstructured">
    <file
        jcr:primaryType="nt:unstructured" 
        sling:resourceType="granite/ui/components/coral/foundation/form/fileupload"
        autoStart="{Boolean}true"
        cq-msm-lockable="/file"
        fieldLabel="the label for the field"
        mimeTypes="[image/png,image/jpeg,application/pdf]"
        multiple="{Boolean}false"
        name="./file"
        sizeLimit="100000000"
        text="Dokument hochladen"
        uploadUrl="/content/dam/someurl"
        uploadUrlBuilder=""/>
    </items>
</fileupload>
于 2017-08-20T01:18:12.227 回答
0

我也面临着这个。有两件事帮助了我:

引用核心组件http://localhost:4502/crx/de/index.jsp#/apps/core/wcm/components/page/v1/page/cq%3Adialog/content/items/tabs/items/thumbnail/items /column/items/thumbnail/upload创建以下对话框...

<upload jcr:primaryType="nt:unstructured" 
    sling:resourceType="granite/ui/components/coral/foundation/form/fileupload" 
    text="Upload Image" name="./image/file.sftmp" 
    sizeLimit="1000000"
    multiple="{Boolean}false"
    async="{Boolean}true"  
    autostart="{Boolean}false"  
    granite:class="cq-wcm-fileupload" 
    uploadUrl="will_be_replaced">
      <granite:data jcr:primaryType="nt:unstructured" cq-msm-lockable="./image" />
</upload> 

但是,如果没有 cq:dialog 节点http://localhost:4502/crx/de/index.jsp#/apps/core/wcm/components/page/v1/page/cq%3Adialog上的额外客户端库,上述内容将无法工作

<jcr:root jcr:primaryType="nt:unstructured" 
  sling:resourceType="cq/gui/components/authoring/dialog"
  extraClientlibs="[cq.common.wcm,core.wcm.page.properties,cq.wcm.msm.properties]" 
 ...
于 2018-01-12T19:34:10.330 回答