2017-02-02 47 views
0

我一直試圖在Aukai dashlet中獲得一個窗體,工作了一個多星期。它很容易讓它出現在儀表板上,但我所做的一切都沒有導致任何這種情況發送到服務器!窗體查詢

有人或知道任何人有一個窗體完全在Dashlet中工作嗎?

我不會從OPtionsService中讀取(不填充選擇的下拉列表),也不會提交給任何提交的主題,只是坐在那裏,什麼都不做。我可以在調試窗口中看到事件,但在chrome和firefox調試視圖中沒有網絡活動,服務器什麼都不做。

dashlet GET JS

model.jsonModel = { 
    rootNodeId: args.htmlid, 
    pubSubScope: instance.object.id, 
    bodyHeight: "400px", 
    services: [ 
     { name: "alfresco/services/LoggingService", 
      config: { 
       loggingPreferences:{ 
        enabled: true, 
        all: true 
       } 
      } 
     }, 
     "alfresco/services/OptionsService" 
    ], 
    widgets: [ 
     { 
      name: "alfresco/dashlets/Dashlet", 
      config: { 
       title: "My Messages", 
       bodyHeight: args.height || null, 
       componentId: instance.object.id, 
       widgetsForTitleBarActions: [ 
        { 
         id: "MESSAGING_DASHLET_ACTIONS", 
         name: "alfresco/html/Label", 
         config: { 
          label: "Title-bar actions" 
         } 
        } 
       ], 
       widgetsForToolbar: [ 
        { 
         id: "MESSAGING_DASHLET_TOOLBAR", 
         name: "alfresco/html/Label", 
         config: { 
          label: "Toolbar" 
         } 
        } 
       ], 
       widgetsForBody: [ 
        { 
         id: "HELLO_DASHLET_VERTICAL_LAYOUT", 
         name: "alfresco/layout/VerticalWidgets", 
         config: { 
          widgetWidth: "350px", 
          widgets: [ 
           { name: "alfresco/forms/Form", 
            config: { 
             showOkButton: true, 
             okButtonLabel: "Send", 
             showCancelButton: false, 
             okButtonPublishTopic: "PUBLISH_TOPIC_MESSAGE", 
             okButtonPublishGlobal: true, 
             widgets: [{ 
              name: "alfresco/forms/controls/TinyMCE", 
              config: { 
               fieldId: "MESSAGE_TEXT", 
               name: "message", 
               label: "Message", 
               widgetWidth: 200 
              } 
             }, 
             { 
              name: "alfresco/forms/controls/Select", 
              config: { 
               fieldId: "RECIPENT", 
               name: "recipient", 
               label: "Send to", 
               optionsConfig:{ 
                publishTopic: "ALF_GET_FORM_CONTROL_OPTIONS", 
                publishPayload: { 
                 url: url.context + "/proxy/alfresco/api/people", 
                 itemsAttribute: "people", 
                 labelAttribute: "firstName", 
                 valueAttribute: "userName" 
                } 
               } 
              } 
             }] 
            } 
           } 
          ] 
         } 
        }, 
        { 
         name: "alfresco/logging/DebugLog", 
        } 
       ] 
      } 
     } 
    ] 
}; 

dashlet獲取HTML FTL

<@markup id="widgets"> 
    <@processJsonModel group="share-dashlets" rootModule="alfresco/core/Page"/> 
</@> 

<@markup id="html"> 
<div id="${args.htmlid?html}"></div> 
</@> 

dashlet得到遞減XML

<webscript> 
    <shortname>Dashlet</shortname> 
    <description>An Aikau dashlet</description> 
    <family>dashlet</family> 
    <url>/dashlets/messaging</url> 
</webscript> 
+2

請包括[最小的,完整的,可覈查的示例](http://stackoverflow.com/help/mcve),說明你的問題。 –

+0

已編輯以包含當前的Dashlet狀態。 – user2120275

回答

1

我稍微修改你的代碼,以獲取用戶和顯示INA下拉。 讓我試用Option Service並更新你。 創建一個新的函數getUserList並調用/ api/people來獲取數據並顯示在下拉列表中。

希望這可以幫助你。

enter image description here

model.jsonModel = { 
    rootNodeId: args.htmlid, 
    pubSubScope: instance.object.id, 
    bodyHeight: "400px", 
    services: [ 
     { name: "alfresco/services/LoggingService", 
      config: { 
       loggingPreferences:{ 
        enabled: false, 
        all: true 
       } 
      } 
     }, 
     "alfresco/services/OptionsService" 
    ], 
    widgets: [ 
     { 
      name: "alfresco/dashlets/Dashlet", 
      config: { 
       title: "My Messages", 
       bodyHeight: args.height || null, 
       componentId: instance.object.id, 
       widgetsForTitleBarActions: [ 
        { 
         id: "MESSAGING_DASHLET_ACTIONS", 
         name: "alfresco/html/Label", 
         config: { 
          label: "Title-bar actions" 
         } 
        } 
       ], 
       widgetsForToolbar: [ 
        { 
         id: "MESSAGING_DASHLET_TOOLBAR", 
         name: "alfresco/html/Label", 
         config: { 
          label: "Toolbar" 
         } 
        } 
       ], 
       widgetsForBody: [ 
        { 
         id: "HELLO_DASHLET_VERTICAL_LAYOUT", 
         name: "alfresco/layout/VerticalWidgets", 
         config: { 
          widgetWidth: "350px", 
          widgets: [ 
           { name: "alfresco/forms/Form", 
            config: { 
             showOkButton: true, 
             okButtonLabel: "Send", 
             showCancelButton: false, 
             okButtonPublishTopic: "PUBLISH_TOPIC_MESSAGE", 
             okButtonPublishGlobal: true, 
             widgets: [{ 
              name: "alfresco/forms/controls/TinyMCE", 
              config: { 
               fieldId: "MESSAGE_TEXT", 
               name: "message", 
               label: "Message", 
               widgetWidth: 200 
              } 
             },           
             { 
              name: "alfresco/forms/controls/Select", 
              config: {             
               fieldId: "RECIPENT", 
               name: "recipient", 
               label: "Send to", 
               optionsConfig: { 
                fixed: getUsersList() 
               }, 
               requirementConfig: { 
                initialValue: true 
               } 
              } 
             } 

             ] 
            } 
           } 
          ] 
         } 
        }, 
        { 
         name: "alfresco/logging/DebugLog", 
        } 
       ] 
      } 
     } 
    ] 
}; 

function getUsersList() { 
    try { 
     var result = remote.call("/api/people?sortBy=fullName&dir=asc"); 
     var userList = []; 
     if (result.status == status.STATUS_OK) { 
      var rawData = JSON.parse(result); 
      if (rawData && rawData.people) { 
       var dummyPerson = { 
        label: "Select Recipient", 
        value: " ", 
        selected: true 
       }; 
       userList.push(dummyPerson); 
       for (var x = 0; x < rawData.people.length; x++) { 
        var item = rawData.people[x]; 
        if (item.firstName != null && item.firstName != "" && item.userName.indexOf("@") == -1 && item.enabled == true) { 
         var displayName = item.firstName + " " + item.lastName; 
         var person = { 
          label: displayName, 
          value: item.userName 
         }; 
         userList.push(person); 
        } 
       } 
      } 
     } else { 
      throw new Error("Unable to fetch User List " + result.status); 
     } 
     return userList; 
    } catch(err) { 
     throw new Error(err); 
    } 
} 
+0

我看不到你的錯誤。你能否提供更多信息? –