• (转)openfire插件开发(二) 基于web的插件开发


    转:http://blog.csdn.net/lovexieyuan520/article/details/38935137

    在前面的博客中,我介绍了openfire插件开发,在那篇博客中我详细的说明怎样开发一个基于控制台的插件,这篇博客中我要介绍基于web的插件程序,同样,这篇博客实在openfire插件开发的基础上开发的,如果有网友不明白的,请移步至前面相关的文章,我写openfire是一系列连续性的文章,建议大家从前面开始看起,以释没头没尾之嫌,好了,进入正题:

            1、新建我们需要的jsp文件,在插件src目录下面增加web文件夹,在web文件夹中添加一个welcome.jsp文件,这个文件需要自己编写。 可以参考其他案例插件。截图如下:

             选择新建jsp文件,截图如下:

           

           在welcome.jsp中随便输入写内容,我的如下:

    [html] view plain copy
     
    1. <%@ page language="java" contentType="text/html; charset=UTF-8"  
    2.     pageEncoding="UTF-8"%>  
    3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
    4. <html>  
    5. <head>  
    6. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
    7. <title>helwo world welcome</title>  
    8. <meta name="pageID" content="welcome" />  
    9. </head>  
    10. <body>  
    11.     <h1>hello world</h1>  
    12.     <input type="text"/>  
    13.     <input type="submit" value="提交">  
    14. </body>  
    15. </html>  

    修改helloWorld控制台插件的plugin.xml文件,内容如下:

    [html] view plain copy
     
    1. <?xml version="1.0" encoding="UTF-8"?>  
    2.   
    3. <plugin>  
    4.     <class>com.helloworld.HelloWorldPlugin</class>  
    5.     <name>helloWorld</name>  
    6.     <description>First Openfire Custom Plugin.</description>  
    7.     <author>xieyuan</author>  
    8.     <version>1.0.0</version>  
    9.     <date>14/07/2014</date>  
    10.     <minServerVersion>3.9.0</minServerVersion>  
    11.       
    12.     <adminconsole>  
    13.          <tab id="tab-server">  
    14.             <sidebar id="sidebar-server-settings">  
    15.                 <item id="welcome" name="welcome"  
    16.                     url="welcome.jsp"  
    17.                     description="hello world" />  
    18.             </sidebar>  
    19.          </tab>  
    20.     </adminconsole>  
    21.   
    22. </plugin>  

    现在,我们来看看效果,刷新页面我们看到:

    现在解释一下上面各个选项的含义:

    welcome.jsp中<meta name="pageID" content="welcome" />,content对应的是plugin.xml中item中的id。

    plugin.xml中tab对应的是页面的顶部tab,比如服务器对应的是id为tab-server,用户/组对应的是tab-users,反正都有一个对应,然后sidebar对应每一个tab下面的子项,比如服务器下面有两个子项分别为服务器管理器,服务器设置,对应id为sidebar-server-manager,sidebar-server-settings,最后的item节点中,id前面说了,name指页面超链接的文本。这样呢就能将插件中的页面放到自己想要的地方去。当然不一定要放到现有的tab下面,也可以新建一个tab,来存放。具体可以参考Fastpath Service这个插件的plugin.xml,照着他的例子写就行了。

    最后使用ant build.xml文件,编译出最新的插件文件。ant之后,插件才会生效!

  • 相关阅读:
    CI框架 -- 核心文件 之 Loader.php(加载器)
    CI框架 -- 核心文件 之 Lang.php(加载语言包)
    CI框架 -- 核心文件 之 Input.php(输入数据处理文件)
    CI框架 -- 核心文件 之 Hooks.php
    CI框架 -- 核心文件 之 Exceptions.php
    CI框架 -- 配置文件config.php
    网站后台发通知页面效果图
    校内通知-Notifications表增加老师,家长,学生发送范围字段
    jqGrid设置指定行的背景色
    SQLServer数据库监控代码
  • 原文地址:https://www.cnblogs.com/wangle1001986/p/7229945.html
Copyright © 2020-2023  润新知