`
scropo
  • 浏览: 2666 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

Web Item Plugin Module

    博客分类:
  • jira
 
阅读更多
Purpose of this Module Type
Web Item plugin modules allow plugins to define new links in application menus.

Configuration
The root element for the Web Item plugin module is web-item. It allows the following attributes and child elements for configuration:

Attributes
Name Required Description Default
class The class which implements this plugin module. The class you need to provide depends on the module type. For example, Confluence theme, layout and colour-scheme modules can use classes already provided in Confluence. So you can write a theme-plugin without any Java code. But for macro and listener modules you need to write your own implementing class and include it in your plugin. See the plugin framework guide to creating plugin module instances.
state Indicate whether the plugin module should be disabled by default (value='disabled') or enabled by default (value='enabled'). enabled
i18n-name-key The localisation key for the human-readable name of the plugin module.
key The identifier of the plugin module. This key must be unique within the plugin where it is defined.
Sometimes, in other contexts, you may need to uniquely identify a module. Do this with the complete module key. A module with key fred in a plugin with key com.example.modules will have a complete key of com.example.modules:fred. N/A
name The human-readable name of the plugin module. Used only in the plugin's administrative user interface.
section Location into which this web item should be placed. For non-sectioned locations, this is just the location key. For sectioned locations it is the location key, followed by a slash ('/'), and the name of the web section in which it should appear. N/A
system Indicates whether this plugin module is a system plugin module (value='true') or not (value='false'). Only available for non-OSGi plugins. false
weight Determines the order in which web items appear. Items are displayed top to bottom or left to right in order of ascending weight. The 'lightest' weight is displayed first, the 'heaviest' weights sink to the bottom. The weights for most applications' system sections start from 100, and the weights for the links generally start from 10. The weight is incremented by 10 for each in sequence so that there is ample space to insert your own sections and links. 1000
Elements
The table summarises the elements. The sections below contain further information.

Name Required Description Default
condition Defines a condition that must be satisfied for the web item to be displayed. If you want to 'invert' a condition, add an attribute 'invert="true"' to it. The web item will then be displayed if the condition returns false (not true). N/A
conditions Defines the logical operator type to evaluate its condition elements. By default 'AND' will be used. AND
context-provider Allows dynamic addition to the velocity context available for various web item elements (in XML descriptors only). Currently only one context-provider can be specified per web item and section.
description The description of the plugin module. The 'key' attribute can be specified to declare a localisation key for the value instead of text in the element body. I.e. the description of the web item.
icon Defines an icon to display with or as the link. Note: In some cases the icon element is required. Try adding it if your web section is not displaying properly. N/A
label Is the i18n key that will be used to look up the textual representation of the link. N/A
link Defines where the web item should link to. The contents of the link element will be rendered using Velocity, allowing you to put dynamic content in links. For more complex examples of links, see below. N/A
param Parameters for the plugin module. Use the 'key' attribute to declare the parameter key, then specify the value in either the 'value' attribute or the element body. This element may be repeated. An example is the configuration link described in Adding a Configuration UI for your Plugin. This is handy if you want to use additional custom values from the UI. N/A
resource A resource for this plugin module. This element may be repeated. A 'resource' is a non-Java file that a plugin may need in order to operate. Refer to Adding Plugin and Module Resources for details on defining a resource. N/A
tooltip Is the i18n key that will be used to look up the textual mouse-over text of the link. N/A

Label Elements
Label elements may contain optional parameters, as shown below:

<label key="common.concepts.create.new.issue">
    <param name="param0">$helper.project.name</param>
</label>
The parameters allow you to insert values into the label using Java's MessageFormat syntax.
Parameter names must start with param and will be mapped in alphabetical order to the substitutions in the format string. I.e. param0 is {0}, param1 is {1}, param2 is {2}, etc.
Parameter values are rendered using Velocity, allowing you to include dynamic content.

Tooltip Elements
Tooltip elements have the same attributes and parameters as the label elements. See above.


Link Elements
Link elements may contain additional information:

<link linkId="create_link" absolute="false">/secure/CreateIssue!default.jspa</link>
The linkId is optional, and provides an XML id for the link being generated.
The absolute is optional and defaults to false unless the link starts with http:// or https://
The body of the link element is its URL. The URL is rendered with Velocity, so you can include dynamic information in the link. For example, in Confluence, the following link would include the page ID:

<link linkId="view-attachments-link">/pages/viewpageattachments.action?pageId=$page.id</link>

Icon Elements
Icon elements have a height and a width attribute. The location of the icon is specified within a link element:

<icon height="16" width="16">
    <link>/images/icons/print.gif</link>
</icon>

Param Elements
Param elements represent a map of key/value pairs, where each entry corresponds to the param elements attribute: name and value respectively.

<param name="key" value="value" />
The value can be retrieved from within the Velocity view with the following code, where $item is a WebItemModuleDescriptor:

$item.webParams.get("key") <!-- retrieve the value -->
$item.webParams.getRenderedParam("key", $user, $helper) <!-- retrieve the Velocity rendered value -->
If the value attribute is not specified, the value will be set to the body of the element. I.e. the following two param elements are equivalent:

<param name="isPopupLink" value="true" />
<param name="isPopupLink">true</param>

Context-provider Element
Available: Atlassian Plugins 2.5, Confluence 2.5, Bamboo 3.0, JIRA 4.2 and later
The context-provider element adds to the Velocity context available to the web section and web item modules. You can add what you need to the context, to build more flexible section and item elements. Currently only one context-provider can be specified per module. Additional context-providers are ignored.

The context-provider element must contain a class attribute with the fully-qualified name of a Java class. The referenced class:

must implement com.atlassian.plugin.web.ContextProvider, and
will be auto-wired by Spring before any additions to the Velocity context.
For example, the following context-provider will add historyWindowHeight and filtersWindowHeight to the context.

In the following example, HeightContextProvider extends AbstractJiraContextProvider, which is only available in JIRA and happens to implement ContextProvider. The AbstractJiraContextProvider conveniently extracts the User and JiraHelper from the context map, which you would otherwise have to do manually.

public class HeightContextProvider extends AbstractJiraContextProvider
{
    private final ApplicationProperties applicationProperties;

    public HeightContextProvider(ApplicationProperties applicationProperties)
    {
        this.applicationProperties = applicationProperties;
    }

    public Map getContextMap(User user, JiraHelper jiraHelper)
    {
        int historyIssues = 0;
        if (jiraHelper != null && jiraHelper.getRequest() != null)
        {
            UserHistory history = (UserHistory) jiraHelper.getRequest().getSession().getAttribute(SessionKeys.USER_ISSUE_HISTORY);
            if (history != null)
            {
                historyIssues = history.getIssues().size();
            }
        }
        int logoHeight = TextUtils.parseInt(applicationProperties.getDefaultBackedString(APKeys.JIRA_LF_LOGO_HEIGHT));
        String historyHeight = String.valueOf(80 + logoHeight + (25 * historyIssues));
        String filterHeight = String.valueOf(205 + logoHeight);
        return EasyMap.build("historyWindowHeight", historyHeight,
                             "filtersWindowHeight", filterHeight);
    }
}
The above HeightContextProvider can be used by nesting the following element in a web item module.

<context-provider class="com.atlassian.jira.plugin.web.contextproviders.HeightContextProvider" />
The newly added context entries historyWindowHeight and filtersWindowHeight can be used in the XML module descriptors just like normal velocity context variables, by prefixing them with the dollar symbol ($):

<!-- pass the value of historyWindowHeight as a parameter called windowHeight (see param element above for its usage) -->
<param name="windowHeight">$historyWindowHeight</param>

<!-- set the link's label to print the value of filtersWindowHeight -->
<label>filter window height is: $filtersWindowHeight</label>

Condition and Conditions Elements
Conditions can be added to the web section, web item and web panel modules, to display them only when all the given conditions are true.

Condition elements must contain a class attribute with the fully-qualified name of a Java class. The referenced class:

must implement com.atlassian.plugin.web.Condition, and
will be auto-wired by Spring before any condition checks are performed.
Condition elements can take optional parameters. These parameters will be passed in to the condition's init() method as a map of string key/value pairs after autowiring, but before any condition checks are performed. For example:

<condition class="com.atlassian.jira.plugin.web.conditions.JiraGlobalPermissionCondition">
    <param name="permission">admin</param>
</condition>
To invert a condition, add the attribute 'invert="true"' to the condition element. This is useful where you want to show the section if a certain condition is not satisfied.
Conditions elements are composed of a collection of condition/conditions elements and a type attribute. The type attribute defines what logical operator is used to evaluate its collection of condition elements. The type can be one of AND or OR.

For example: The following condition is true if the current user is a system administrator OR a project administrator:


<conditions type="OR">
    <condition class="com.atlassian.jira.plugin.web.conditions.JiraGlobalPermissionCondition">
        <param name="permission">admin</param>
    </condition>
    <condition class="com.atlassian.jira.plugin.web.conditions.UserHasProjectsCondition">
        <param name="permission">project</param>
    </condition>
</conditions>
Example
Here is an example atlassian-plugin.xml file containing a single web item:

<atlassian-plugin name="Hello World Plugin" key="example.plugin.helloworld" plugins-version="2">
    <plugin-info>
        <description>A basic web item module test</description>
        <vendor name="Atlassian Software Systems" url="http://www.atlassian.com"/>
        <version>1.0</version>
    </plugin-info>

    <web-item key="google_home" name="Google Home" section="system.admin/example1" weight="10">
        <description key="item.google.home.desc">Simple link to google.com.</description>
        <label key="item.google.home.label" />
        <link linkId="google_home"></link>
    </web-item>
</atlassian-plugin>
See Also
Web Fragments — This reference guide describes how to combine Web Items, Web Sections and Web Panels together to generate links, sections of links and panels at specific locations of the JIRA user interface.
分享到:
评论

相关推荐

    webplugin 视频插件

    Webplugin视频插件是一款专为增强网页视频播放体验而设计的软件组件。它主要用于解决浏览器对某些特定视频格式不支持的问题,或者提供额外的功能,如高清播放、快进快退、弹幕互动等。在互联网内容日益丰富的今天,...

    大华摄像头web3.0二次开发webplugin

    【大华摄像头Web3.0二次开发WebPlugin详解】 大华摄像头Web3.0二次开发WebPlugin是一款专为开发者设计的工具,旨在帮助用户利用Web技术进行摄像头的高级功能定制和扩展。它允许开发者通过浏览器插件的方式,接入...

    大华控件webplugin.zip

    《大华视频控件WebPlugin详解及安装指南》 大华视频控件WebPlugin是一款专为互联网环境设计的多媒体插件,主要用于在IE浏览器中实现流畅的视频播放和监控功能。该控件由大华公司开发,是其监控系统的重要组成部分,...

    大华摄像头直连插件webplugin及文档说明 demo

    《大华摄像头直连插件WebPlugin及其文档说明详解》 在现代的监控系统中,摄像头的直连功能显得尤为重要,特别是在远程监控和实时视频流传输的场景下。大华作为国内知名的安防设备提供商,其推出的摄像头直连插件Web...

    大华摄像头直连插件webplugin.exe

    标题中的“大华摄像头直连插件webplugin.exe”指的是由大华公司开发的一款用于摄像头直连的软件组件,主要用于视频监控系统。该插件的核心功能是帮助用户实现实时查看摄像头拍摄的现场视频,包括播放、停止、截图、...

    webplugin.exe插件

    大华摄像头web3.0二次开发 webplugin.exe视频插件。。

    大华 webplugin.exe

    大华摄像头视频监控OCX控件 webplugin.exe 4.1.63.0 在浏览器中在线浏览大华视频。

    webplugin.exe

    浙江大华摄像头 web调用监控所需控件,下载之后双击安装即可 webplugin 3.1.0.4

    大华摄像头直连插件webplugin.exe和文档

    标题中的“大华摄像头直连插件webplugin.exe和文档”指的是大华公司提供的一个用于摄像头直连的软件组件,其主要功能是帮助用户或开发者通过Web浏览器与大华品牌的摄像头进行交互。这个插件名为“webplugin.exe”,...

    WebServer Plugin for Websphere Application Server 6.1

    WebServer Plugin是IBM针对Websphere Application Server (WAS) 的一种组件,它允许将Web请求路由到WAS,以实现更高效的Web服务器与应用程序服务器之间的集成。在本例中,我们关注的是专为WAS 6.1版本设计的Web...

    大华webplugin_demo.zip

    标题中的“大华webplugin_demo.zip”表明这是一个与大华摄像头相关的Web插件的示例程序,用于二次开发。大华是一家知名的安防设备制造商,其产品包括各种类型的摄像头。这个压缩包提供了开发者需要的工具和资源,...

    大华摄像头_WEB_DEMO_基于webplugin插件.zip

    标题 "大华摄像头_WEB_DEMO_基于webplugin插件.zip" 暗示这是一个关于大华品牌的网络摄像头的Web演示项目,它依赖于一个名为"webplugin"的浏览器插件来实现。这个压缩包可能包含了运行该Web DEMO所需的所有文件。 ...

    大华摄像头通过webplugin.exe实现web界面视频预览,亲测可用,免费下载

    公司要把大华摄像头集成到网页上预览,海康的有现成的sdk开发...通过调用大华的plugin实现的摄像头控制,兼容IE11亲测可用,内涵demo,只需要安装webplugin.exe,之后重启浏览器即可.文件内包括使用说明,示例代码,开发文档.

    webplugin海康网站视频插件

    “Webplugin海康网站视频插件”是一款专为海康威视(Hikvision)开发的浏览器扩展程序,旨在优化用户在访问海康威视官方网站时观看监控视频的体验。这款插件使得用户无需安装额外的桌面客户端或软件,即可在网页端...

    maven-smartweb-plugin-0.2.0.jar

    maven-smartweb-plugin-0.2.0.jar

    大华摄像头IE浏览器插件webplugin.exe

    有时候,当你想在浏览器上查看摄像头的时候,它提示你要下载插件,而你的浏览器又无法下载,诶,这时候你就需要大华摄像头IE浏览器插件webplugin,我已经给你们下载好了。

    Dahua_web3.0控件二次开发_直连DVR.rar_Web3.0_dahua web webplugin_大华web开发_

    再web端集成了大华摄像头实时监控功能,测试时 只需要替换里边的摄像头ip和登录账户即可

    手动解决Cannot find module '@sentry/webpack-plugin'等问题

    解决Cannot find module '@sentry/webpack-plugin',Cannot find module '@sentry/browser',Cannot find module '@sentry/cli'等问题。 下载后,解压后文件夹,放在vue项目的node_modules文件夹下,即可。

Global site tag (gtag.js) - Google Analytics