2017-01-20 42 views
1

私は数日の間Googleを検索していましたが、私の問題の解決策を見つけることはできません。Alfresco dashlet投稿フォーム

私は、カスタムのAlfresco Aukaiのダッシュレットを作成して、その中のフォームを配置している:

define(["dojo/_base/declare", 
    "dijit/_WidgetBase", 
    "alfresco/core/Core", 
    "alfresco/core/I18nUtils", 
    "alfresco/dashlets/Dashlet"], 
function(declare, AlfCore, I18nUtils, Dashlet) { 
    // First define a form... 
    var form = { 
     name: "alfresco/forms/Form", 
     config: { 
      showOkButton: true, 
      okButtonLabel: "Save", 
      showCancelButton: false, 
      cancelButtonLabel: "Doesn't Matter", 
      okButtonPublishTopic: "PUBLISH_TOPIC", 
      okButtonPublishGlobal: true, 
      widgets: [] 
     } 
    }; 
// Define a text box... 
    var textBox = { 
     name: "alfresco/forms/controls/DojoValidationTextBox", 
     config: { 
      fieldId: "EMAIL", 
      name: "email", 
      label: "Contact", 
      description: "Your e-mail address", 
      placeHolder: "[email protected]", 
      validationConfig: [ 
       { 
        validation: "regex", 
        regex: "^([0-9a-zA-Z]([-.w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-w]*[0-9a-zA-Z].)+[a-zA-Z]{2,9})$", 
        errorMessage: "Valid E-mail Address Required" 
       } 
      ] 
     } 
    }; 
    form.config.widgets.push(textBox); 
// Define a checkbox... 
    var checkbox = { 
     name: "alfresco/forms/controls/DojoCheckBox", 
     config: { 
      fieldId: "SHOW", 
      name: "showEmail", 
      label: "Show E-mail", 
      description: "Uncheck to hide the e-mail field", 
      value: true 
     } 
    }; 
    form.config.widgets.push(checkbox); 
// Update the textbox to respond to checkbox changes... 
    textBox.config.visibilityConfig = { 
     initialValue: true, 
     rules: [ 
      { 
       targetId: "SHOW", 
       is: [true] 
      } 
     ] 
    }; 
    return declare([Dashlet], { 
     /* 
     * Add padding to the body. 
     * smallpad (4px padding), mediumpad (10px padding - recommended) and largepad (16px padding) 
     */ 
     additionalCssClasses: "mediumpad", 
     /** 
     * Explicit height in pixels of the Dashlet body. 
     */ 
     bodyHeight: 200, 
     /** 
     * Id that will be used to store properties for this Dashlet. 
     * i.e. the Dashlet height when using the resizer. 
     */ 
     componentId: "component.messaging-dashlet", 
     /** 
     * The i18n scope to use for this Dashlet. 
     */ 
     i18nScope: "dashlets.MessagingDashlet", 
     /** 
     * An array of the i18n files to use with this Dashlet. 
     */ 
     i18nRequirements: [{i18nFile: "./i18n/MessagingDashlet.properties"}], 
     /** 
     * The widgets to be acting as title bar actions. 
     */ 
     widgetsForTitleBarActions: [ 
      { 
       id: "MESSAGING_DASHLET_ACTIONS", 
       name: "alfresco/html/Label", 
       config: { 
        label: "Title-bar actions" 
       } 
      } 
     ], 
     /** 
     * The widgets to be placed in the top toolbar. 
     */ 
     widgetsForToolbar: [ 
      { 
       id: "MESSAGING_DASHLET_TOOLBAR", 
       name: "alfresco/html/Label", 
       config: { 
        label: "Toolbar" 
       } 
      } 
     ], 
     /** 
     * The widgets to be placed in the body of the dashlet. 
     */ 
     widgetsForBody: [ 
      { 
       id: "HELLO_DASHLET_VERTICAL_LAYOUT", 
       name: "alfresco/layout/VerticalWidgets", 
       config: { 
        widgetWidth: 50, 
        widgets: [ 
         form 
        ] 
       } 
      } 
     ] 
    }); 
}); 

フォームが表示されますが、[保存]ボタンは非アクティブです。

火災のバグを確認すると、ページにjavascriptがないことが通知されます。

無効な電子メールアドレスが入力された場合でも、これ以外にも問題なく、エラーメッセージが表示されます。

提案がありますか?代わりに、ダッシュレットのポスティングでフォームの作業例がいいでしょう:)

私はこれをさらに調べて、OptionsServiceで選択ボックスにデータを入力しようとしました。

optionsConfig: { 
    publishTopic: "ALF_GET_FORM_CONTROL_OPTIONS", 
    publishPayload: { 
     url: url.context + "/proxy/alfresco/api/people", 
     itemsAttribute: "people", 
     labelAttribute: "firstName", 
     valueAttribute: "userName" 
    } 

デバッグで私はこれを見ることができますが、ワイヤでは何も起こりません、対応するリクエストがサーバーに送信されていません!

これは、私のコードでより根本的な問題を示唆するように、これは私が投稿で得ているのと同じ問題です。

答えて

0

フォームにウィジェット/コントロールが定義されていません。 aikauを使った簡単なCRUDの例を参照してください

okButtonPublishGlobal: true, 
      widgets: [] 

http://www.codingfreaks.net/2015/03/aikau-form-example-for-simple-student.html

https://github.com/Alfresco/Aikau/blob/develop/aikau/src/main/resources/alfresco/reports/TopSiteContributorReport.js

enter image description here

は、あなたがこのリンクを見てくださいことはできますか?

Alfrescoの共有は、サイト貢献者Breakdown Dashletであり、入力フォームコントロールはaikauを使用しています。

+0

それ以外の多くのオプションを試してみました。完全にリヤアンドされたコード!ウィジェットと変更ウィジェットのタイプが追加されました!あらゆる種類のサービスにサービスを追加しました。 エラーのために読み込まれないダッシュレットや、投稿されなかった予定のフォームのダッシュレットがあります。 FirefoxとChromeの両方のデバッグを使用すると、ボタンをクリックしたときに何も起こりません:( – user2120275

+0

私は基本的なものが欠けているはずですか? 私はガイドとして与えられた例を試しましたが、どこにもありません。 私の問題は、レポートであり、円グラフのイベントからサブミットして、ダッシュレットのフォームのボタンからサブミットを実行したいところです。 フォームが非常に混乱し、例が非常に限定されています。 私の仕事はJavaシステムの主な問題は、Alfrescoによって確実に提供される文書管理です。そこに問題はありません。 – user2120275

+0

Alfrescoの方法で既存の機能を提供したいと考えています。そのように新しいシステムは有能なAlfresco開発者によって維持されます。 POCの計画は、メッセージングシステムをAlfrescoに移行することです。 これは編集不可能で、送受信する人だけが見ることができるタイプMESSAGEの文書を作成するダッシュレットです。ドキュメントの添付機能を備えたシステムSMSのようなもの。それよりも複雑ですが、それは一般的な考えです。 – user2120275