-3

Alfresco Forms Service が正しく動作しません。

基本的なフォーム機能がフォーム構成 ( control-param name="nameHere") を Web スクリプトに渡さないようです。

順次再現していきます。

  • Freemarker テンプレートを作成し、/share プロジェクトの下のドキュメントに従って登録します。コンポーネントがレンダリングされ、正常に表示されます。すべてがうまく機能します。

  • wiki フォーム ページのドキュメントに従ってフォームを作成します。ディレクトリに登録し、<TOMCAT_INST/shared/classes/alfresco/web- extension/myclok-form-config.xml>次の方法でロード用に渡します。

    <bean id="sampleShareConfig" class="org.springframework.extensions.config.ConfigBootstrap" init-method="register">
      <property name="configService" ref="web.config" />
      <property name="configs">
      <list>
        <value>classpath:alfresco/web-extension/myclok-form-config.xml</value>
      </list>
      </property>
    </bean>
    <!-- ... share/WEB-INF/classes/org/springframework/extensions/surf/bootstrap/forms-bootstrap-context.xml -->
    

フォームインスト:

<config>
 <forms>
  <form id="myclok">
   <view-form template="/org/alfresco/components/myclok/myclok.get.html.ftl" />
   <edit-form template="/org/alfresco/components/myclok/myclok.get.html.ftl" />
   <create-form template="/org/alfresco/components/myclok/myclok.get.html.ftl" />

   <field-visibility>
    <show id="currentPath" />
   </field-visibility>
   <appearance>
    <field id="currentPath">
     <control name="currentPath" template="/org/alfresco/components/myclok/myclok.get.html.ftl">
     <control-param name="currentPath">sampleData1</control-param>
     </control>
    </field>    
    <control name="currentPath" template="/org/alfresco/components/myclok/myclok.get.html.ftl">
    <control-param name="currentPath">sampleData2</control-param>
    </control>
    </appearance>
   </form>
  </forms>
</config>

公式ドキュメントには次のように書かれています。

form 要素がエバリュエーターなしで config 要素内に存在し、フォームが常に見つかるという条件が存在する場合、これは、特定のフィールドをアプリケーションのすべてのフォームに表示する場合に役立ちます。

そのため、myclok-form-config.xml ファイルで指定しましたが、この方法では結果が得られません。したがって、このような param への参照を含むコンポーネントが次の URL < http://localhost:8080/share/page/site/wcmqs/myclok> によってロードされると、Alfresco は例外で失敗します。

Exception: freemarker.core.InvalidReferenceException - Expression field is undefined on line 6, column 6 in org/alfresco/components/myclok/myclok.get.html.ftl.
freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:125)
freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:135)
freemarker.core.Dot._getAsTemplateModel(Dot.java:78)

currentPathつまり、 で定義されているのパラメータの値を受け取ることはできませんFormConfigs。そのため、FormsService / ConfigService の最小限の機能が動作しません。

<#if field.control.params.currentPath??>
  <#assign path=field.control.params.currentPath>
<#else>
  <#assign path="someOtherDataValue">
</#if>

誰かがそれを解決する方法を知っていますか、または実際のサンプルを示すことができますか?

PS: 上記のすべてのフォームの構成FormServiceと webscript コンポーネントが添付されています。次のコマンドを呼び出すためだけに、クイック インストール用の .AMP ファイルが必要です。

java -jar alfresco-mmt.jar install myclokStubFormComponent.amp ../tomcat/webapps/share.war

AMP ファイル. 構成ファイル.

4

1 に答える 1

4

フォームテンプレートとフィールドテンプレートの違いを誤解されていると思います。同じファイル/org/alfresco/components/myclok/myclok.get.html.ftlを指定して、フォームのレイアウトを制御したり、フィールドをレンダリングしたりしています。

フィールドテンプレートを使用してフォームをレンダリングすると、fieldオブジェクトが入力されていないことを示すエラーが発生します。フレームワークはまだ個々のフィールドのレンダリングを開始していないため、これは非常に正しいです。フォームをレンダリングしています。

独自のより複雑なフォームの実装を開始する前、特にフレームワークが文書化されたとおりに機能しないと主張する前に、Forms Development Kit(FDK)に付属する例などのより基本的な例を試すことをお勧めします。

于 2012-09-10T21:42:26.750 に答える