我想在Alfresco的alfresco-global.properties文件中有许多自定义变量,我希望在各种freemarker ftl文件以及各种YUI文件中使用这些自定义变量,这将大大改变Share的行为及其显示信息的方式。
I have numerous custom variables in Alfresco's alfresco-global.properties file that I'd like to use throughout various freemarker ftl files as well as the various YUI files, which will greatly alter the behavior of Share and how it displays information.
我具有可通过各种javascript调用访问的属性值(例如, getNetworkName()将返回自定义 appwork.name 在属性中设置的变量),但我不确定如何将这些javascript函数公开给freemarker或YUI文件,或者我是否需要
I have the property values accessible through various javascript calls (for example, getNetworkName() will return the custom appwork.name variable set in the properties), but I am uncertain of how I'd expose these javascript functions to either freemarker or the YUI files, or if I even need to, as opposed to just accessing the variables directly.
推荐答案如果已定义了全局变量和函数,则不需要
If you have defined global variables and functions you don't need to do anything special to access them from YUI.
您可以选择执行类似的操作,以利用YUI的 sandboxing 功能,以便每个沙箱都可以通过更改全局配置不会影响其他配置
You can optionally do something like this to take advantage of YUI's sandboxing ability so that each sandbox can't affect the other by changing the global configuration:
YUI_config = { app: { network: { name: 'foo' // or getNetworkName() } } }; YUI().use('node', function (Y) { console.log(Y.config.appwork.name); // foo Y.config.appwork.name = 'bar'; }); YUI().use('tabview', function (Y) { console.log(Y.config.appwork.name); // still foo! });更多推荐
如何从Freemarker和YUI javascript文件中的alfresco
发布评论