Michael Fürmann
2015-02-17 d2ba64924092d7695b4e126e2e8248926ee8700b
Added XMPP Users List and DB Table
3 files modified
4 files added
263 ■■■■■ changed files
install/sql/incremental/upd_0081.sql 28 ●●●●● patch | view | raw | blame | history
install/sql/ispconfig3.sql 29 ●●●●● patch | view | raw | blame | history
interface/web/mail/lib/lang/en_xmpp_user_list.lng 8 ●●●●● patch | view | raw | blame | history
interface/web/mail/lib/module.conf.php 4 ●●●● patch | view | raw | blame | history
interface/web/mail/list/xmpp_user.list.php 81 ●●●●● patch | view | raw | blame | history
interface/web/mail/templates/xmpp_user_list.htm 74 ●●●●● patch | view | raw | blame | history
interface/web/mail/xmpp_user_list.php 39 ●●●●● patch | view | raw | blame | history
install/sql/incremental/upd_0081.sql
@@ -52,4 +52,30 @@
  PRIMARY KEY  (`domain_id`),
  KEY `server_id` (`server_id`,`domain`),
  KEY `domain_active` (`domain`,`active`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
--
-- Table structure for table  `xmpp_user`
--
CREATE TABLE `xmpp_user` (
  `xmppuser_id` int(11) unsigned NOT NULL auto_increment,
  `sys_userid` int(11) unsigned NOT NULL default '0',
  `sys_groupid` int(11) unsigned NOT NULL default '0',
  `sys_perm_user` varchar(5) NOT NULL default '',
  `sys_perm_group` varchar(5) NOT NULL default '',
  `sys_perm_other` varchar(5) NOT NULL default '',
  `server_id` int(11) unsigned NOT NULL default '0',
  `xmpp_domain_id` int(11) unsigned NOT NULL default '0',
  `login` varchar(255) NOT NULL default '',
  `jid` varchar(255) NOT NULL default '',
  `password` varchar(255) NOT NULL default '',
  `is_domain_admin` enum('n','y') NOT NULL default 'n',
  `is_muc_admin` enum('n','y') NOT NULL default 'n',
  `active` enum('n','y') NOT NULL DEFAULT 'n',
  PRIMARY KEY  (`xmppuser_id`),
  KEY `server_id` (`server_id`,`jid`),
  KEY `jid_active` (`jid`,`active`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
install/sql/ispconfig3.sql
@@ -1964,7 +1964,7 @@
-- --------------------------------------------------------
--
-- Table structure for table  `xmpp_domain`
-- Table structure for table `xmpp_domain`
--
CREATE TABLE `xmpp_domain` (
@@ -2008,6 +2008,33 @@
  KEY `domain_active` (`domain`,`active`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table  `xmpp_user`
--
CREATE TABLE `xmpp_user` (
  `xmppuser_id` int(11) unsigned NOT NULL auto_increment,
  `sys_userid` int(11) unsigned NOT NULL default '0',
  `sys_groupid` int(11) unsigned NOT NULL default '0',
  `sys_perm_user` varchar(5) NOT NULL default '',
  `sys_perm_group` varchar(5) NOT NULL default '',
  `sys_perm_other` varchar(5) NOT NULL default '',
  `server_id` int(11) unsigned NOT NULL default '0',
  `xmpp_domain_id` int(11) unsigned NOT NULL default '0',
  `login` varchar(255) NOT NULL default '',
  `jid` varchar(255) NOT NULL default '',
  `password` varchar(255) NOT NULL default '',
  `is_domain_admin` enum('n','y') NOT NULL default 'n',
  `is_muc_admin` enum('n','y') NOT NULL default 'n',
  `active` enum('n','y') NOT NULL DEFAULT 'n',
  PRIMARY KEY  (`xmppuser_id`),
  KEY `server_id` (`server_id`,`jid`),
  KEY `jid_active` (`jid`,`active`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
-- --------------------------------------------------------
-- --------------------------------------------------------
interface/web/mail/lib/lang/en_xmpp_user_list.lng
New file
@@ -0,0 +1,8 @@
<?php
$wb["list_head_txt"] = 'XMPP User Accounts';
$wb["jid_txt"] = 'Jabber ID';
$wb["is_domain_admin_txt"] = 'Domain admin';
$wb["is_muc_admin_txt"] = 'MUC admin';
$wb["add_new_record_txt"] = 'Add new user';
$wb["active_txt"] = 'Active';
?>
interface/web/mail/lib/module.conf.php
@@ -163,8 +163,8 @@
{
    $items[] = array( 'title'  => 'XMPP Account',
        'target'  => 'content',
        'link' => 'mail/xmpp_account_list.php',
        'html_id' => 'xmpp_account_list');
        'link' => 'mail/xmpp_user_list.php',
        'html_id' => 'xmpp_user_list');
}
if(count($items))
interface/web/mail/list/xmpp_user.list.php
New file
@@ -0,0 +1,81 @@
<?php
/*
    Datatypes:
    - INTEGER
    - DOUBLE
    - CURRENCY
    - VARCHAR
    - TEXT
    - DATE
*/
// Name of the list
$liste["name"]    = "xmpp_user";
// Database table
$liste["table"]   = "xmpp_user";
// Index index field of the database table
$liste["table_idx"]  = "xmppuser_id";
// Search Field Prefix
$liste["search_prefix"]  = "search_";
// Records per page
$liste["records_per_page"]  = "15";
// Script File of the list
$liste["file"]   = "xmpp_user_list.php";
// Script file of the edit form
$liste["edit_file"]  = "xmpp_user_edit.php";
// Script File of the delete script
$liste["delete_file"]  = "xmpp_user_del.php";
// Paging Template
$liste["paging_tpl"]  = "templates/paging.tpl.htm";
// Enable auth
$liste["auth"]   = "yes";
/*****************************************************
* Suchfelder
*****************************************************/
$liste["item"][] = array(   'field'     => "JID",
    'datatype'  => "VARCHAR",
    'filters'   => array( 0 => array( 'event' => 'SHOW',
            'type' => 'IDNTOUTF8')
    ),
    'formtype'  => "TEXT",
    'op'        => "like",
    'prefix'    => "%",
    'suffix'    => "%",
    'width'     => "",
    'value'     => "");
$liste["item"][] = array( 'field'  => "is_domain_admin",
    'datatype' => "VARCHAR",
    'formtype' => "SELECT",
    'op'  => "=",
    'prefix' => "",
    'suffix' => "",
    'width'  => "",
    'value'  => array('n' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'y' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
$liste["item"][] = array( 'field'  => "is_muc_admin",
    'datatype' => "VARCHAR",
    'formtype' => "SELECT",
    'op'  => "=",
    'prefix' => "",
    'suffix' => "",
    'width'  => "",
    'value'  => array('n' => "<div id=\"ir-Yes\" class=\"swap\"><span>Yes</span></div>", 'y' => "<div class=\"swap\" id=\"ir-No\"><span>No</span></div>"));
?>
interface/web/mail/templates/xmpp_user_list.htm
New file
@@ -0,0 +1,74 @@
<div class='page-header'>
    <h1><tmpl_var name="list_head_txt"></h1>
</div>
<p><tmpl_var name="list_desc_txt"></p>
        <tmpl_if name='datalog_changes_count' op='>' value='0'>
        <div>
            <div class="systemmonitor-state state-info">
                <div class="status"></div>
                <div class="statusMsg">
                    {tmpl_var name="datalog_changes_txt"}
                    <ul>
                    <tmpl_loop name="datalog_changes">
                        <li><strong>{tmpl_var name="text"}:</strong> {tmpl_var name="count"}</li>
                    </tmpl_loop>
                    </ul>
                    {tmpl_var name="datalog_changes_end_txt"}
                </div>
            </div><br />
        </div>
        </tmpl_if>
        <p class="fieldset-legend">{tmpl_var name="toolsarea_head_txt"}</p>
                <button class="btn btn-default formbutton-success" type="button" data-load-content="mail/xmpp_user_edit.php">{tmpl_var name="add_new_record_txt"}</button>
        <p class="fieldset-legend"><tmpl_var name="list_head_txt"></p>
            <div class="table-wrapper marginTop15">
<table class="table">
                <thead class="dark form-group-sm">
                    <tr>
                        <th data-column="jid"><tmpl_var name="jid_txt"></th>
                        <th class="small-col" data-column="is_domain_admin"><tmpl_var name="is_domain_admin_txt"></th>
                        <th class="small-col" data-column="is_muc_admin"><tmpl_var name="is_muc_admin_txt"></th>
                        <th class="small-col text-right">{tmpl_var name='search_limit'}</th>
                    </tr>
                    <tr>
                        <td><input class="form-control" type="text" name="search_jid" value="{tmpl_var name='search_jid'}" /></td>
                        <td><select class="form-control" name="search_is_domain_admin">{tmpl_var name='search_is_domain_admin'}</select></td>
                        <td><select class="form-control" name="search_is_muc_admin">{tmpl_var name='search_is_muc_admin'}</select></td>
                        <td class="text-right">
                            <button type="button" class="btn btn-default formbutton-default formbutton-narrow" name="Filter" id="Filter" value="{tmpl_var name="filter_txt"}" data-submit-form="pageForm" data-form-action="mail/xmpp_user_list.php"><span class="icon icon-filter"></span></button>
                        </td>
                    </tr>
                </thead>
                <tbody>
                <tmpl_loop name="records">
                    <tr>
                        <td><a href="#" data-load-content="mail/xmpp_user_edit.php?id={tmpl_var name='id'}">{tmpl_var name="jid"}</a></td>
                        <td><a href="#" data-load-content="mail/xmpp_user_edit.php?id={tmpl_var name='id'}">{tmpl_var name="is_domain_admin"}</a></td>
                        <td><a href="#" data-load-content="mail/xmpp_user_edit.php?id={tmpl_var name='id'}">{tmpl_var name="is_muc_admin"}</a></td>
                        <td class="text-right">
                            <a class="btn btn-default formbutton-danger formbutton-narrow" href="javascript: ISPConfig.confirm_action('mail/xmpp_user_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span class="icon icon-delete"></span></button>
                        </td>
                    </tr>
                </tmpl_loop>
                <tmpl_unless name="records">
                    <tr class="tbl_row_noresults tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
                        <td colspan="4">{tmpl_var name='globalsearch_noresults_text_txt'}</td>
                    </tr>
                </tmpl_unless>
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="4"><tmpl_var name="paging"></td>
                    </tr>
                </tfoot>
            </table>
</div>
interface/web/mail/xmpp_user_list.php
New file
@@ -0,0 +1,39 @@
<?php
require_once '../../lib/config.inc.php';
require_once '../../lib/app.inc.php';
/******************************************
* Begin Form configuration
******************************************/
$list_def_file = "list/xmpp_user.list.php";
/******************************************
* End Form configuration
******************************************/
//* Check permissions for module
$app->auth->check_module_permissions('mail');
$app->load('listform_actions');
class list_action extends listform_actions {
    function onShow() {
        global $app, $conf;
        $app->uses('getconf');
        $global_config = $app->getconf->get_global_config('xmpp');
        parent::onShow();
    }
}
$list = new list_action;
$list->SQLOrderBy = 'ORDER BY xmpp_user.jid';
$list->onLoad();
?>