我一直试图在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 get desc xml
<webscript>
<shortname>Dashlet</shortname>
<description>An Aikau dashlet</description>
<family>dashlet</family>
<url>/dashlets/messaging</url>
</webscript>
答案 0 :(得分:1)
我稍微修改了您的代码以获取用户并显示inal下拉列表。 让我尝试使用Option Service并更新您。 创建了一个新函数getUserList并调用/ api / people来获取数据并显示在下拉列表中。
希望这对你有帮助。
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);
}
}