Changeset 1495

Show
Ignore:
Timestamp:
08/21/11 15:04:36 (21 months ago)
Author:
Torben Brodt
Message:

update xmpp chat with lots of configuration

Location:
xmpp
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • xmpp/de.xml

    r1492 r1495  
    1212                <item name="wcf.acp.option.module_xmpp"><![CDATA[XMPP Integration]]></item> 
    1313                <item name="wcf.acp.option.module_xmpp.description"><![CDATA[Aktiviert die XMPP Integration.]]></item> 
    14                 <item name="wcf.acp.option.category.general.http.chat"><![CDATA[Chat]]></item> 
    15                 <item name="wcf.acp.option.category.general.http.chat.description"><![CDATA[]]></item> 
    16                 <item name="wcf.acp.option.xmpp_http"><![CDATA[XMPP HTTP-binding]]></item> 
    17                 <item name="wcf.acp.option.xmpp_http.description"><![CDATA[To run the example you'll also need an HTTP server with proxy capabilities because it's not allowed to make cross-domain AJAX requests.]]></item> 
     14                <item name="wcf.acp.option.category.general.http.xmpp"><![CDATA[XMPP]]></item> 
     15                <item name="wcf.acp.option.category.general.http.xmpp.description"><![CDATA[]]></item> 
     16                <item name="wcf.acp.option.category.general.http.xmpp.chat"><![CDATA[Chat]]></item> 
     17                <item name="wcf.acp.option.category.general.http.xmpp.chat.description"><![CDATA[]]></item> 
     18 
     19                <item name="wcf.acp.option.xmpp_domain"><![CDATA[Domain]]></item> 
     20                <item name="wcf.acp.option.xmpp_domain.description"><![CDATA[Server ÃŒber den sich der Benutzer anmeldet. Beispiel: talk.easy-coding.de]]></item> 
     21                <item name="wcf.acp.option.xmpp_auth_cookie"><![CDATA[Cookie Login]]></item> 
     22                <item name="wcf.acp.option.xmpp_auth_cookie.description"><![CDATA[Insofern der XMPP Server die Authentifizierung mit Cookie & Salz erlaubt, mÃŒssen registrierte Benutzer durch Aktivieren dieser Funktion kein Passwort fÃŒr XMPP Anfragen eingeben.]]></item> 
     23                 
     24                <item name="wcf.acp.option.xmpp_chat_http"><![CDATA[HTTP-binding]]></item> 
     25                <item name="wcf.acp.option.xmpp_chat_http.description"><![CDATA[Der Pfad ÃŒber den das HTTP-bindung des Jabber Servers erreichbar ist. Unter UmstÀnden muss eine .htaccess angelegt werden, siehe <a href="{@RELATIVE_WCF_DIR}acp/dereferrer.php?url=http://amiadogroup.github.com/candy/">github</a>.]]></item> 
     26                <item name="wcf.acp.option.xmpp_chat_autojoin"><![CDATA[RÀume]]></item> 
     27                <item name="wcf.acp.option.xmpp_chat_autojoin.description"><![CDATA[Der HTTP Chat wird automatisch diese RÀume betreten. Mehrere RÀume können durch Zeilenumbruch getrennt eingegeben werden.]]></item> 
     28                <item name="wcf.acp.option.xmpp_chat_anonymous"><![CDATA[Anonymer Zugang]]></item> 
     29                <item name="wcf.acp.option.xmpp_chat_anonymous.description"><![CDATA[Insofern der XMPP Serer anonyme Logins erlaubt, kann diese Option aktiviert werden, damit sich GÀste ÃŒber den Web-Chat anmelden können.]]></item> 
    1830        </category> 
    1931</language> 
  • xmpp/en.xml

    r1492 r1495  
    1212                <item name="wcf.acp.option.module_xmpp"><![CDATA[XMPP Integration]]></item> 
    1313                <item name="wcf.acp.option.module_xmpp.description"><![CDATA[Enables the XMPP Integration.]]></item> 
    14                 <item name="wcf.acp.option.category.general.http.chat"><![CDATA[Chat]]></item> 
    15                 <item name="wcf.acp.option.category.general.http.chat.description"><![CDATA[]]></item> 
    16                 <item name="wcf.acp.option.xmpp_http"><![CDATA[XMPP HTTP-binding]]></item> 
    17                 <item name="wcf.acp.option.xmpp_http.description"><![CDATA[To run the example you'll also need an HTTP server with proxy capabilities because it's not allowed to make cross-domain AJAX requests.]]></item> 
     14                <item name="wcf.acp.option.category.general.http.xmpp"><![CDATA[XMPP]]></item> 
     15                <item name="wcf.acp.option.category.general.http.xmpp.description"><![CDATA[]]></item> 
     16                <item name="wcf.acp.option.category.general.http.xmpp.chat"><![CDATA[Chat]]></item> 
     17                <item name="wcf.acp.option.category.general.http.xmpp.chat.description"><![CDATA[]]></item> 
     18 
     19                <item name="wcf.acp.option.xmpp_domain"><![CDATA[Domain]]></item> 
     20                <item name="wcf.acp.option.xmpp_domain.description"><![CDATA[Server to authenticate. Example: talk.easy-coding.de]]></item> 
     21                <item name="wcf.acp.option.xmpp_auth_cookie"><![CDATA[Cookie Login]]></item> 
     22                <item name="wcf.acp.option.xmpp_auth_cookie.description"><![CDATA[Depending on the server authentication with cookie and salt may be allowed. Active this so that registered users don't need to enter their password for xmpp queries.]]></item> 
     23 
     24                <item name="wcf.acp.option.xmpp_chat_http"><![CDATA[XMPP HTTP-binding]]></item> 
     25                <item name="wcf.acp.option.xmpp_chat_http.description"><![CDATA[To run the chat you'll also need an HTTP server with proxy capabilities because it's not allowed to make cross-domain AJAX requests, see <a href="{@RELATIVE_WCF_DIR}acp/dereferrer.php?url=http://amiadogroup.github.com/candy/">github</a>.]]></item> 
     26                <item name="wcf.acp.option.xmpp_chat_autojoin"><![CDATA[Rooms]]></item> 
     27                <item name="wcf.acp.option.xmpp_chat_autojoin.description"><![CDATA[Autojoin to the following rooms. Enter multiple rooms divided by linebreak.]]></item> 
     28                <item name="wcf.acp.option.xmpp_chat_anonymous"><![CDATA[Anonymous Access]]></item> 
     29                <item name="wcf.acp.option.xmpp_chat_anonymous.description"><![CDATA[Depending on the server communication anonymous access is granted. Enable this to allow anonymous access via the webchat.]]></item> 
    1830        </category> 
    1931</language> 
  • xmpp/files/lib/page/ChatPage.class.php

    r1493 r1495  
    1212 
    1313        /** 
     14         * supported languages 
     15         * @var array<string> 
     16         */ 
     17        protected $valid_languages = array( 
     18                'de', 
     19                'en', 
     20                'fr', 
     21        ); 
     22 
     23        /** 
     24         * @return      string 
     25         */ 
     26        protected function getLanguageCode() { 
     27                return in_array(WCF::getLanguage()->getLanguageCode(), $this->valid_languages)  
     28                        ? WCF::getLanguage()->getLanguageCode()  
     29                        : 'en'; 
     30        } 
     31 
     32        /** 
    1433         * @see Page::assignVariables() 
    1534         */ 
    1635        public function assignVariables() { 
    1736                parent::assignVariables(); 
     37                 
     38                $autojoin_str = ''; 
     39                foreach(explode("\n", XMPP_CHAT_AUTOJOIN) as $row) { 
     40                        $autojoin_str .= ',[\''.$row.'\']'; 
     41                } 
     42                $autojoin_str = ltrim($autojoin_str, ','); 
     43                 
     44                 
     45                $username = ''; 
     46                $password = ''; 
     47                if(WCF::getUser()->userID) { 
     48                        $username = urlencode(WCF::getUser()->username).'@'.XMPP_DOMAIN; 
     49                        if(XMPP_AUTH_COOKIE) { 
     50                                $password = WCF::getUser()->password.WCF::getUser()->salt; 
     51                        } 
     52                } else if (XMPP_CHAT_ANONYMOUS) { 
     53                        $username = XMPP_DOMAIN; 
     54                } 
    1855 
    1956                WCF::getTPL()->assign(array( 
    2057                        'allowSpidersToIndexThisPage' => true, 
    21                         'username' => WCF::getUser()->userID ? WCF::getUser()->username : false 
     58                        'xmpp_lang' => $this->getLanguageCode(), 
     59                        'xmpp_http' => XMPP_HTTP, 
     60                        'xmpp_domain' => XMPP_DOMAIN, 
     61                        'xmpp_username' => $username, 
     62                        'xmpp_password' => $password, 
     63                        'xmpp_chat_autojoin' => $autojoin_str 
    2264                )); 
    2365        } 
     
    3072                        throw new IllegalLinkException(); 
    3173                } 
    32                  
     74 
    3375                require_once(WCF_DIR.'lib/page/util/menu/PageMenu.class.php'); 
    3476                PageMenu::setActiveMenuItem('wcf.header.menu.chat'); 
    35                  
     77 
    3678                parent::show(); 
    3779        } 
  • xmpp/options.xml

    r1492 r1495  
    33        <import> 
    44                <categories> 
    5                         <category name="general.http.chat"> 
     5                        <category name="general.http.xmpp"> 
    66                                <parent>general.http</parent> 
     7                                <showorder>1</showorder> 
     8                        </category> 
     9                        <category name="general.http.xmpp.chat"> 
     10                                <parent>general.http.xmpp</parent> 
    711                                <showorder>1</showorder> 
    812                        </category> 
     
    1519                                <defaultvalue>1</defaultvalue> 
    1620                        </option> 
    17                         <option name="xmpp_http"> 
    18                                 <categoryname>general.http.chat</categoryname> 
     21 
     22                        <option name="xmpp_domain"> 
     23                                <categoryname>general.http.xmpp</categoryname> 
    1924                                <optiontype>text</optiontype> 
    20                                 <defaultvalue></defaultvalue> 
     25                                <defaultvalue></defaultvalue><!-- e.g. talk.easy-coding.de --> 
    2126                                <showorder>1</showorder> 
     27                        </option> 
     28                        <option name="xmpp_auth_cookie"> 
     29                                <categoryname>general.http.xmpp</categoryname> 
     30                                <optiontype>boolean</optiontype> 
     31                                <defaultvalue>false</defaultvalue> 
     32                                <showorder>2</showorder> 
     33                        </option> 
     34                         
     35                        <option name="xmpp_chat_http"> 
     36                                <categoryname>general.http.xmpp.chat</categoryname> 
     37                                <optiontype>text</optiontype> 
     38                                <defaultvalue>http-bind/</defaultvalue> 
     39                                <showorder>1</showorder> 
     40                        </option> 
     41                        <option name="xmpp_chat_autojoin"> 
     42                                <categoryname>general.http.xmpp.chat</categoryname> 
     43                                <optiontype>textarea</optiontype> 
     44                                <defaultvalue></defaultvalue><!-- line separated e.g. www@conference.talk.easy-coding.de --> 
     45                                <showorder>2</showorder> 
     46                        </option> 
     47                        <option name="xmpp_chat_anonymous"> 
     48                                <categoryname>general.http.xmpp.chat</categoryname> 
     49                                <optiontype>boolean</optiontype> 
     50                                <defaultvalue>true</defaultvalue> 
     51                                <showorder>3</showorder> 
    2252                        </option> 
    2353                </options> 
  • xmpp/package.xml

    r1491 r1495  
    44        <packageinformation> 
    55                <packagename>XMPP Integration</packagename> 
    6                 <packagedescription>Includes a JavaScript-based multi-user chat client for xmpp/jabber.</packagedescription> 
    7                 <version>0.2.0</version> 
     6                <packagedescription>Includes a JavaScript-based multi-user chat client for xmpp/jabber. For features will follow.</packagedescription> 
     7                <version>1.0.0 Beta 1</version> 
    88                <date>DATE</date> 
    99                <plugin>com.woltlab.wcf.page.user.profile</plugin> 
  • xmpp/templates/chat.tpl

    r1493 r1495  
    22<head> 
    33        <title>{lang}wcf.header.menu.chat{/lang} - {lang}{PAGE_TITLE}{/lang}</title> 
     4        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> 
     5        <script type="text/javascript">jQuery.noConflict();</script> 
    46        {include file='headInclude' sandbox=false} 
     7 
     8        <link rel="stylesheet" type="text/css" href="{@RELATIVE_WCF_DIR}images/candy/default.css" /> 
     9        <script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/3rdParty/candy.libs.bundle.js"></script> 
     10        <script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/3rdParty/candy.min.js"></script> 
     11        <script type="text/javascript"> 
     12        //<![CDATA[ 
     13                onloadEvents.push(function(){ 
     14                        Candy.init('{$xmpp_http}', { 
     15                                core: { 
     16                                        debug: false 
     17                                        {if $autojoin_str},autojoin: [{@$autojoin_str}]{/if} 
     18                                }, 
     19                                view: { 
     20                                        resources: '{@RELATIVE_WCF_DIR}images/candy/', 
     21                                        language: '{$xmpp_lang}' 
     22                                } 
     23                        }); 
     24                        Candy.Core.connect({if $xmpp_username}'{$xmpp_username}'{/if}{if $xmpp_password}, '{$xmpp_password}'{/if}); 
     25                }); 
     26        //]]> 
     27        </script> 
    528</head> 
    629<body{if $templateName|isset} id="tpl{$templateName|ucfirst}"{/if}> 
     
    1336        </ul> 
    1437        <div class="mainHeadline"> 
    15                 <img src="{icon}chatL.png{/icon}" alt="" />  
     38                <img src="{icon}chatL.png{/icon}" alt="" /> 
    1639                <div class="headlineContainer"> 
    1740                        <h2>{lang}wcf.header.menu.chat{/lang}</h2> 
     
    1942        </div> 
    2043 
    21         <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> 
    22         <script type="text/javascript">jQuery.noConflict();</script> 
    23         <link rel="stylesheet" type="text/css" href="{@RELATIVE_WCF_DIR}images/candy/default.css" /> 
    24         <script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/3rdParty/candy.libs.bundle.js"></script> 
    25         <script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/3rdParty/candy.min.js"></script> 
    26         <script type="text/javascript"> 
    27         //<![CDATA[ 
    28                 onloadEvents.push(function(){ 
    29                         Candy.init('http-bind/', { 
    30                                 core: {  
    31                                         debug: false, 
    32                                         autojoin: ['www@conference.talk.easy-coding.de'] 
    33                                 }, 
    34                                 view: { 
    35                                         resources: '{@RELATIVE_WCF_DIR}images/candy/',  
    36                                         language: 'de'  
    37                                 } 
    38                         }); 
    39                         Candy.Core.connect({if $username}{$username|json_encode}{/if}); 
    40                 }); 
    41         //]]> 
    42         </script> 
     44        {if $userMessages|isset}{@$userMessages}{/if} 
    4345 
    44         {if $userMessages|isset}{@$userMessages}{/if} 
    45         <p class="info">Die Chat Integration in das Forum befindet sich noch im Aufbau. Mit eurem Jabber Client könnt ihr aber schon fleißig mitchatten. Mehr unter : <a href="http://www.easy-coding.de/easy-coding-xmpp-server-talk-easy-coding-de-t7173.html">easy-coding XMPP Server - talk.easy-coding.de</a></p> 
     46        <p class="info">Die Chat Integration in das Forum befindet sich noch im Aufbau. Mehr unter : <a href="http://www.easy-coding.de/easy-coding-xmpp-server-talk-easy-coding-de-t7173.html">easy-coding XMPP Server - talk.easy-coding.de</a></p> 
    4647 
    4748        <div style="position:relative"><div id="candy"></div></div>