我试着用一个简单的例子来帮助下面的弃权者。could-anyone-provide-aikau-form-example-with-data-loading
基本上,当表单对话框加载并希望在对话框中显示文档libray noderef时,我会执行回购请求。因此,我在对话框加载期间调用了makeRepoRequest(),但是网络选项卡会抛出401错误。
请告诉我,这个样品有什么问题吗?
/* studentForm.get.js */
function makeRepoRequest()
{
var alfDestination = "something";
var site = page.url.templateArgs.site;
var result = remote.call("/slingshot/doclib/container/" + site + "/documentLibrary");
return result.status.code;
if (result.status.code == status.STATUS_OK) {
alfDestination = JSON.parse(result).container.nodeRef;
}
}
var formControls = [
{
name: "alfresco/forms/controls/TextBox",
config: {
name: "name1",
label:"Name",
placeHolder:"Enter Name Here",
visibilityConfig: {
initialValue: true
}
}
},
{
name: "alfresco/forms/controls/TextBox",
config: {
label:"Age",
name: "age",
placeHolder:"Enter Age Here",
visibilityConfig: {
initialValue: true
}
}
}
,
{
name: "alfresco/forms/controls/TextBox",
config: {
label:"NodeRef",
name: "nodeRef",
visibilityConfig: {
initialValue: true
},
value : makeRepoRequest()
}
}
];
var showDialog = {
name: "alfresco/buttons/AlfButton",
config: {
readOnly:"true",
id:"dialog1",
label: "Create New Student",
additionalCssClasses: "call-to-action",
publishTopic: "ALF_CREATE_FORM_DIALOG_REQUEST",
publishPayloadType: "PROCESS",
publishPayload: {
dialogTitle: "Student Form",
dialogConfirmationButtonTitle: "Register",
dialogCancellationButtonTitle: "Cancel",
formSubmissionTopic: "ALF_CRUD_CREATE",
formSubmissionPayloadMixin: {
url: "api/type/cm%3Astudent/formprocessor"
},
fixedWidth: true,
widgets: formControls
}
}
};
model.jsonModel = {
widgets :[showDialog
],
services : [
"alfresco/dialogs/AlfDialogService",
"alfresco/services/CrudService"
]
};发布于 2016-12-12 09:06:44
401状态代码指示用户未经过身份验证。你在哪运行这段代码?它是在分享还是一个独立的Aikau客户?用户登录了吗?他们是否拥有访问该API所需的权限?他们是网站的成员吗?该网站有哪些隐私?
发布于 2016-12-14 08:21:55
我已经测试了您的代码,在alfreso中静态地给出了我的站点名(例如演示),它工作得很好,并给我使用这段代码的nodeRef。
function makeRepoRequest()
{
var alfDestination = "something";
var site = "demo";
var result = remote.call("/slingshot/doclib/container/" + site + "/documentLibrary");
if (result.status.code == status.STATUS_OK) {
alfDestination = JSON.parse(result).container.nodeRef;
}
return alfDestination ;
}你测试过网站名称是否正确吗?我使用浏览器url测试了这段代码。
https://stackoverflow.com/questions/41095326
复制相似问题