ich möchte gerne ein eigenes Portal Modul für den Ajax Chat erstellen, eine Shoutbox.
Ich habe nun schon einiges ergoogled, mit einem workaround funktioniert es auch.
Basierend auf diesem Thread: viewtopic.php?f=23&t=9253
insbesondere auf den Post von Kirk viewtopic.php?f=23&t=9253#p32936
habe ich folgendes gemacht:
Folgende Änderungen an includes/functions.php
Code: Select all
'SHOUTBOX'                      => getShoutBoxContent(),Code: Select all
/**
* Shoutbox function
*
*/
function getShoutBoxContent() {
        // URL to the chat directory:
        if(!defined('AJAX_CHAT_URL')) {
                define('AJAX_CHAT_URL', './chat/');
        }
        // Path to the chat directory:
        if(!defined('AJAX_CHAT_PATH')) {
                define('AJAX_CHAT_PATH', realpath(dirname($_SERVER['SCRIPT_FILENAME']).'/chat').'/');
        }
        // Validate the path to the chat:
        if(@is_file(AJAX_CHAT_PATH.'lib/classes.php')) {
                // Include Class libraries:
                require_once(AJAX_CHAT_PATH.'lib/classes.php');
                // Initialize the shoutbox:
                $ajaxChat = new CustomAJAXChatShoutBox();
                // Parse and return the shoutbox template content:
                return $ajaxChat->getShoutBoxContent();
        }
        return null;
}Code: Select all
<?php
/**
*
* @package - Board3portal v2 Shoutbox
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
    exit;
}
/**
* @package Shoutbox
*/
class portal_shoutbox_module
{
    /**
    * Allowed columns: Just sum up your options (Exp: left + right = 10)
    * top        1
    * left        2
    * center    4
    * right        8
    * bottom    16
    */
    public $columns = 21;
    /**
    * Default modulename
    */
    public $name = 'SHOUTBOX';
    /**
    * Default module-image:
    * file must be in "{T_THEME_PATH}/images/portal/"
    */
    public $image_src = '';
    /**
    * module-language file
    * file must be in "language/{$user->lang}/mods/portal/"
    */
    public $language = 'portal_shoutbox_module';
    /**
    * custom acp template
    * file must be in "adm/style/portal/"
    */
    public $custom_acp_tpl = '';
    /**
    * hide module name in ACP configuration page
    */
    public $hide_name = false;
    public function get_template_center($module_id)
    {
        global $config, $template, $user, $phpbb_root_path, $phpEx;
// Show all errors:
error_reporting(E_ALL);
// Path to the chat directory:
define('AJAX_CHAT_PATH', dirname($_SERVER['SCRIPT_FILENAME']).'/chat/');
// Include custom libraries and initialization code:
require(AJAX_CHAT_PATH.'lib/custom.php');
// Include Class libraries:
require(AJAX_CHAT_PATH.'lib/classes.php');
// Initialize the chat:
$ajaxChat = new CustomAJAXChat();
        return 'portal_shoutbox_side.html';
    }
    public function get_template_acp($module_id)
    {
        return array(
            'title'    => 'PORTAL_SHOUTBOX',
            'vars'    => array(),
        );
    }
    /**
    * API functions
    */
    public function install($module_id)
    {
        return true;
    }
    public function uninstall($module_id)
    {
        return true;
    }
}
?>Code: Select all
<?php
/**
*
* @package - Board3portal v2 Shoutbox
* @version 1.0.0
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* DO NOT CHANGE
*/
if (!defined('IN_PHPBB'))
{
    exit;
}
if (empty($lang) || !is_array($lang))
{
    $lang = array();
}
// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
$lang = array_merge($lang, array(
    'PORTAL_SHOUTBOX'             => 'Shoutbox',
));
?>
Code: Select all
<!--version $Id: latest_members.html 544 2009-09-10 12:35:25Z christian_n $ //-->
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{T_IMAGESET_PATH}/prosilver/portal/portal_members.png" width="16" height="16" alt="" /> <!-- ENDIF -->SHOUTBOX{$LR_BLOCK_H_R}
        <!-- IF not S_IS_BOT -->
        <div style="font-size: 1.2em; margin-bottom: 20px;">{SHOUTBOX}</div>
        <!-- ELSE -->
        <div id="ajaxChatCopyright"><a href="https://blueimp.net/ajax/">AJAX Chat</a> © <a href="https://blueimp.net">blueimp.net</a></div>
        <!-- ENDIF -->
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}
Nun zum eigentlichen Problem:
Wie kann ich das Modul nun zum Portal hinzufügen? Im ACP ist es bei den Portal Modulen nicht auswählbar?
Als workarround habe ich nun einfach portal_shoutbox_side.html in attachments_side.html umbenannt, und das Attachments Modul hinzugefügt.
Hätte es aber gern als eigenständiges Modul, damit es auch beim nächsten Portalupdate noch funktioniert.
