XWIKI APPWITHINMINUTES添加自定义速度脚本显示
我是Xwiki的新手,也不是Java开发人员。我想开发一个简单的AppWithinMinutes应用程序(让我们称其为ServerCatalog),以使用其属性(例如OS,环境等)的服务器列表。这都是可行的。我可以从AppWithinminites UI开发它。
我还开发了一个宏,该宏列出了标签所有页面。
例如,例如,当某人在我的ServerCatalog中创建一个条目Say Server d 56其中 d 代表开发环境。
当我们显示该条目时,我还想执行我开发的宏,以便它可以列出与标签服务器 x 56的所有页面。
请注意,我用 d x ,所以在执行宏之前,我想操纵该页面标题并删除环境前缀(在这种情况下为 d 开发环境) x 。
我希望这清楚我想完成的工作。请让我知道是否不清楚。
如果有人可以帮助我这样做,我将真正感谢。
编辑:
正如爱德华·莫拉鲁(Eduard Moraru)所建议的那样,我尝试了以下内容:
我创建了一个称为“ PagelistByTag”的自定义宏。 由于Python对字符串操作具有更多的控制权,因此我在ServerCatalogSheet的末尾补充说,
.
.
.
.
{{/html}}
{{/velocity}}
{{python}}
title = document.getTitle()
newTitle = title[:6] + "X" + title[6+1:]
print(newTitle)
{{/python}}
它有几个问题。.
- 我的HTML标签已经结束。我不能再注入任何新内容,
- 我不能在速度标签中添加python代码,因为xwiki不允许嵌套脚本,
- 我想使用python,我仍然不知道如何在python代码中调用我的宏
如果 我可以使用速度在字符串中替换第六个字符,然后一切都起作用。我可以在速度脚本内使用宏,因为它在HTML边界内。
I am new to XWiki and not a Java Developer. I would like to develop a simple AppWithinMinutes app (Let us call it ServerCatalog) for a list of servers with their properties like OS, Environment, etc.. That is all doable. I can develop that from AppWithinMinites UI.
I also have developed a macro which lists all pages by tags.
Now for example, when Someone creates an entry in my ServerCatalog say SERVERD56 Where D stands for Development environment.
when we display that Entry, I also want to execute my macro that I developed so that it can list all pages that matches the tag SERVERX56.
Note that I replaced D with X So before executing macro, I want to manipulate that page title and remove Environment prefix (in this case D for Development Environment) with X.
I hope it is clear of what I want to accomplish. Please let me know if it is unclear.
If someone can assist me on doing it, I will truly appreciate that.
EDITS:
As suggested by Eduard Moraru, I tried following things:
I have created a custom macro called "PageListByTag".
Since python has more control over string operations, I added following at the end of ServerCatalogSheet
.
.
.
.
{{/html}}
{{/velocity}}
{{python}}
title = document.getTitle()
newTitle = title[:6] + "X" + title[6+1:]
print(newTitle)
{{/python}}
There are several problems with it..
- my html tag is already ended. I can't inject any new content in it anymore
- I can't add python code inside velocity tags as nested scripting is not allowed by XWiki
- I still don't know how to call my macro inside python code if I want to use python
If I can replace 6th character in a string using velocity, then everything works. I can use macro inside velocity script since it is within that html boundaries.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我了解,您要自定义显示应用程序条目时使用的应用程序的“表”。
如果您有关于自定义的文档部分,则可以在应该查找的位置获得很多起点:
https://extensions.xwiki.org/xwiki/xwiki/bin/bin/bin/bin/view/extension/eppension/app%20within%20within%20within%20minutes%20minutes%20minutes%20applicatimplication#hcustlication#hcustlication#hcustomization>
%20WITHIN%20分钟% 20 有趣(但也有关Xwiki应用程序如何工作的上述链接):
在您的情况下,它是自定义的文档(编辑
Wiki
语法模式)应为server> servercatalog.code.code.code.servercatalogshogsheet < /代码>
在该文档内部,您拥有AWM自动生成的代码,您可以将呼叫添加到宏中。
然后,在此宏内部(称为
displayAssociatedPages
,在此示例中),您可以执行以下操作:API文档和更多信息,请 https://www.xwiki.org/xwiki/xwiki/bin/bin/view/documentation/documentation/devguide/api/api/api/
您也应该了解,您还应该了解,自定义AWM应用程序后,使用AWM本身进行编辑时,应该要小心。例如,如果您添加了一个新字段Afaik,则可能会像上面的示例一样,将自定义完成为单位,因此您应该从文档历史记录中恢复它们并重新应用它们。
As far as I understand, you want to customize the "sheet" of the application which is used when displaying an application entry.
If you have a look a the documentation's section on customization, you get a lot of starting points on where you should be looking:
https://extensions.xwiki.org/xwiki/bin/view/Extension/App%20Within%20Minutes%20Application#HCustomization
This line would be interesting (but also the above links on how XWiki applications work):
In your case, it the document to customize (edit in
wiki
syntax mode) should beServerCatalog.Code.ServerCatalogSheet
Inside that document, you have code automatically generated by AWM to which you can add a call to your macro.
Then, inside this macro (called
displayAssociatedPages
, in this example), you could do something like:API documentation and more info at https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/API/
Also, you should understand that once you customize an AWM application, you should be careful when editing it with AWM itself. For example, if you add a new field, AFAIK, you risk having the customizations done to your sheet, as in the above example, overwritten, so you should recover them from document history and re-apply them.