0

テスト結果の表を表示するOrbeonアプリがあります。この表には、分析に必要なデータをユーザーがアップロードできるようにするアップロードコントロールがあります。このテーブルを設定するxforms:uploadと、初期化データのフィールドに応じてコントロールを無効にする必要があります。

私はAVTを使用してdisplay:noneスタイルを呼び出しようとしていましたが、コードがrequired="true"インスタンスデータで見つかった場合は常に、これはFormRunnerからの表示出力に影響を与えません。誰か助けてもらえますか?

xforms:upload私のXMLデータとコードは以下のとおりです-私の問題の場所のタグを参照してください( display: none):

サンプル出力:

+------+------+---------------------+------------------------+--------+
| Test | Case |     EB Log          |     COM Log            | Status |   
+------+------+---------------------+------------------------+--------+
| 022  | 01   | Upload              |                        |        |
+------+------+---------------------+------------------------+--------+
| 022  | 02   | Upload              |                        |        |
+------+------+---------------------+------------------------+--------+
| 032  | 01   |                     | Upload                 |        |
+------+------+---------------------+------------------------+--------+
| 032  | 02   | Upload              | Upload                 |        |
+------+------+---------------------+------------------------+--------+
| 032  | 03   | Upload              |                        |        |
+------+------+---------------------+------------------------+--------+
| 032  | 04   | Upload              |                        |        |
+------+------+---------------------+------------------------+--------+

サンプルデータ:

<test_view>
    <test id="022">
        <case id="01"><eb_log required="true" filename="" mediatype="" size=""></eb_log><com_log required="false" filename="" mediatype="" size=""></com_log><status>PASS</status></case>
        <case id="02"><eb_log required="true" filename="" mediatype="" size=""></eb_log><com_log required="false" filename="" mediatype="" size=""></com_log><status>FAIL</status></case>
    </test>
    <test id="032">
        <case id="01"><eb_log required="false" filename="" mediatype="" size=""></eb_log><com_log required="true" filename="" mediatype="" size=""></com_log><status>none</status></case>
        <case id="02"><eb_log required="true" filename="" mediatype="" size=""></eb_log><com_log required="true" filename="" mediatype="" size=""></com_log><status>none</status></case>
        <case id="03"><eb_log required="true" filename="" mediatype="" size=""></eb_log><com_log required="false" filename="" mediatype="" size=""></com_log><status>Run</status></case>
        <case id="04"><eb_log required="true" filename="" mediatype="" size=""></eb_log><com_log required="false" filename="" mediatype="" size=""></com_log><status>Run</status></case>
    </test>
</test_view>

テストコード:

<xhtml:html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner" 
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms">
    <xhtml:head>
        <xhtml:title>XForms Log Analyser</xhtml:title>

        <xforms:model>
            <!-- <xforms:instance id="tests-instance" src="test-view.xml" xmlns=""/> -->
            <!-- <xforms:submission id="tests-submission" serialization="none" method="get" resource="http://localhost:8080/orbeon/log-analyser/test-view.xml" replace="instance" instance="tests-instance"/>  -->
            <!-- <xforms:bind nodeset="instance('tests-instance')" type="xs:anyURI"/> -->

                <!-- Load tests when the XForms engine is ready -->
                <xforms:send ev:event="xforms-ready" submission="list-submission"/>

                <!-- Autosave instance data if any value changes in the instance data -->
                <xforms:send ev:event="xxforms-value-changed" ev:observer="tests-instance" submission="save-submission"/>           

                <!-- Instance that contains all the books -->
                <xforms:instance id="tests-instance">
                <swate_view>
                    <test id="">
                        <case id=""><eb_log required="" filename="" mediatype="" size=""></eb_log><com_log required="" filename="" mediatype="" size=""></com_log><status></status></case>
                    </test>
                </swate_view>
                </xforms:instance>

                <xforms:bind nodeset="instance('tests-instance')"/>

                <!-- Submission to load/reset the default data -->
                <xforms:submission id="reset-submission" serialization="none"
                    method="get" action="oxf:/apps/log-analyser/test-view.xml"
                    replace="instance" instance="tests-instance"/>

                <!-- Submission to get the document containing all the tests -->
                <xforms:submission id="list-submission" serialization="none"
                    method="get" action="/exist/rest/db/orbeon/log-analyser/tests.xml"
                    replace="instance" instance="tests-instance"/>

                <!-- Submission to save the document containing all the tests -->
                <xforms:submission id="save-submission" ref="instance('tests-instance')"
                    action="/exist/rest/db/orbeon/log-analyser/tests.xml"
                    method="put" replace="none">
                    <xforms:message ev:event="xforms-submit-error" level="modal">An error occurred while saving!</xforms:message>
                </xforms:submission>

        </xforms:model>
    </xhtml:head>
    <xhtml:body>
        <fr:datatable paginated="true" rowsPerPage="5" maxNbPagesToDisplay="7">
            <thead>
                <xhtml:tr>
                    <xhtml:th fr:sortable="true" fr:resizeable="true">Test</xhtml:th>
                    <xhtml:th fr:sortable="true" fr:resizeable="true">Case</xhtml:th>
                    <xhtml:th fr:sortable="true" fr:resizeable="true">EB Log</xhtml:th>
                    <xhtml:th fr:sortable="true" fr:resizeable="true">Com Log</xhtml:th>
                    <xhtml:th fr:sortable="true" fr:resizeable="true">Status</xhtml:th>
                </xhtml:tr>
            </thead>
            <tbody>
            <xhtml:tr repeat-nodeset="test/case">
                <xhtml:td>
                    <xforms:output ref="../@id"/>
                </xhtml:td>
                <xhtml:td>
                    <xforms:output value="@id"/>
                </xhtml:td>
                <xhtml:td> 
                    <!-- <xforms:output value="if(eb_log[@required='true']) then ('Upload') else ('-')"/> -->
                    **<xforms:upload style="{if(eb_log[@required='false']) then ('display: none')}" ref="eb_log"><xforms:filename ref="@filename"/><xforms:mediatype ref="@mediatype"/><xxforms:size ref="@size"/></xforms:upload>**
                </xhtml:td>
                <xhtml:td>
                    <!-- <xforms:output value="if(com_log[@required='true']) then ('Upload') else ('-')"/> -->
                    **<xforms:upload style="{if(com_log[@required='false']) then ('display: none')}" ref="com_log"><xforms:filename ref="@filename"/><xforms:mediatype ref="@mediatype"/><xxforms:size ref="@size"/></xforms:upload>**
                </xhtml:td>
                <xhtml:td>
                    <xforms:output ref="status/text()"/>
                </xhtml:td>
            </xhtml:tr>
            </tbody>
        </fr:datatable>
        <xforms:submit submission="save-submission">
            <xforms:label>Save</xforms:label>
        </xforms:submit>
        <xforms:submit submission="reset-submission">
            <xforms:label>Reset</xforms:label>
        </xforms:submit>
    </xhtml:body>
</xhtml:html>
4

2 に答える 2

1

一般的なトリックは、ref属性を使用して条件を設定することです。したがって、アップロードは次のようになります。

<xforms:upload ref="com_log[@required = 'false']" ...>

これが機能するのは、条件がfalseの場合、ref属性が空のシーケンスを指しているからです。また、空のシーケンスを指すバインディングを持つコントロールは、自動的に無関係になります。

于 2012-10-19T17:55:39.923 に答える
0

以下のスニペットは、xforms:upload既に Yahoo! Form Runner の UI ライブラリ。

xforms:uploadただし、コントロールの表示を無効にする公式のアプローチがあるかどうかを知りたいと思います。

<xhtml:td class="if{(eb_log[@required='false']) then 'yui-dt-hidden' else ''}">
于 2012-10-19T10:36:08.430 に答える