Alfresco bean 无法识别
Alfresco bean not recognized
我在文档库中配置了新的多select按钮:
单击按钮时,它应该执行 javascript 函数 onActionAddToList,稍后调用 bean 函数插入。除 bean 函数外,一切正常 - 它不是 called/recognized。难道我做错了什么?我想知道我是否应该在其他地方配置 bean?我使用的是Alfresco 5.2.0 SDK 3.0.1 下面你可以找到对应的代码:
<!-- /alfresco/web-extension/site-data/extensions/my-extension.xml in share-jar -->
<configurations>
<config evaluator="string-compare" condition="DocumentLibrary">
<multi-select>
<action type="action-link" id="onActionAddToList" icon="document-approve" label="Add item to a list" />
</multi-select>
</config>
<config evaluator="string-compare" condition="DocLibCustom" replace="true">
<dependencies>
<js src="/components/documentlibrary/custom-documentlibrary-actions.js" />
</dependencies>
</config>
</configurations>
<!-- resources/components/documentlibrary/custom-documentlibrary-actions.js in share-jar
YAHOO.Bubbling.fire("registerAction", {
actionName: "onActionAddToList",
fn: function custom_onActionAddToList(record)
{
Alfresco.util.PopupManager.displayMessage({ title: "Info", text: listManagement.insert("Hello")});
}
});
<!-- alfresco/module/project/context/service-context.xml in platform-jar -->
<beans>
<bean id="com.test.actions.ListManagement" class="com.test.actions.ListManagement" parent="baseJavaScriptExtension">
<property name="extensionName" value="listManagement"/>
</bean>
</beans>
<!-- java/com/test/actions/ListManagement.java in platform-jar -->
public class ListManagement extends BaseProcessorExtension {
public String insert(String text) {
return text;
}
}
请参考此 question and refer this documentation 调用 javabacked 操作。
我在文档库中配置了新的多select按钮:
单击按钮时,它应该执行 javascript 函数 onActionAddToList,稍后调用 bean 函数插入。除 bean 函数外,一切正常 - 它不是 called/recognized。难道我做错了什么?我想知道我是否应该在其他地方配置 bean?我使用的是Alfresco 5.2.0 SDK 3.0.1 下面你可以找到对应的代码:
<!-- /alfresco/web-extension/site-data/extensions/my-extension.xml in share-jar -->
<configurations>
<config evaluator="string-compare" condition="DocumentLibrary">
<multi-select>
<action type="action-link" id="onActionAddToList" icon="document-approve" label="Add item to a list" />
</multi-select>
</config>
<config evaluator="string-compare" condition="DocLibCustom" replace="true">
<dependencies>
<js src="/components/documentlibrary/custom-documentlibrary-actions.js" />
</dependencies>
</config>
</configurations>
<!-- resources/components/documentlibrary/custom-documentlibrary-actions.js in share-jar
YAHOO.Bubbling.fire("registerAction", {
actionName: "onActionAddToList",
fn: function custom_onActionAddToList(record)
{
Alfresco.util.PopupManager.displayMessage({ title: "Info", text: listManagement.insert("Hello")});
}
});
<!-- alfresco/module/project/context/service-context.xml in platform-jar -->
<beans>
<bean id="com.test.actions.ListManagement" class="com.test.actions.ListManagement" parent="baseJavaScriptExtension">
<property name="extensionName" value="listManagement"/>
</bean>
</beans>
<!-- java/com/test/actions/ListManagement.java in platform-jar -->
public class ListManagement extends BaseProcessorExtension {
public String insert(String text) {
return text;
}
}
请参考此 question and refer this documentation 调用 javabacked 操作。