core

Changeset 24892

Show
Ignore:
Timestamp:
11/20/08 20:29:05 (7 weeks ago)
Author:
Landseer
Message:

added InterCom? detection, this fixes #397 (part one for 1.0.3)

Location:
branches/zikula-1.0
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • branches/zikula-1.0/modules/Members_List/pnblocks/membersonline.php

    r24342 r24892  
    9292    $pnRender = pnRender::getInstance('Members_List', false); 
    9393 
    94     // check if pnMessages is available and add the necessary info 
    95     $pnmessages = pnModAvailable('pnMessages'); 
    96     $pnRender->assign('pnmessages', $pnmessages); 
    97     if ($pnmessages && pnUserLoggedIn()) { 
    98         pnModLangLoad('pnMessages', 'user'); 
    99         $pnRender->assign('messages', pnModAPIFunc('pnMessages', 'user', 'getmessagecount')); 
     94    // check which messaging module is available and add the necessary info 
     95    $msgmodule = pnModAPIFunc('Members_List', 'user', 'getmessagingmodule'); 
     96    $pnRender->assign('msgmodule', $msgmodule); 
     97    if (!empty($msgmodule) && pnUserLoggedIn()) { 
     98        $pnRender->assign('messages', pnModAPIFunc($msgmodule, 'user', 'getmessagecount')); 
    10099    } 
    101100 
  • branches/zikula-1.0/modules/Members_List/pntemplates/memberslist_block_membersonline.htm

    r23454 r24892  
    66            <li> 
    77                        <a href="<!--[pnmodurl modname=Profile func=view uname=$user.uname]-->" title="<!--[$user.uname]-->"><!--[$user.unameshort]--></a> 
    8                         <!--[if $pnmessages]--> 
     8                        <!--[if $msgmodule eq 'pnMessages']--> 
    99                                <!--[if $user.uid eq $uid]--> 
    1010                                        (<a href="<!--[pnmodurl modname="pnMessages" func="inbox"]-->" title="<!--[pnml name='_PNMESSAGES_UNREAD']-->"><!--[$messages.totalin]--></a> | <a href="<!--[pnmodurl modname="pnMessages" func="inbox"]-->" title="<!--[pnml name='_PNMESSAGES_TOTAL']-->"><!--[$messages.unread]--></a>) 
    1111                                <!--[/if]--> 
    12                                 <a href="<!--[pnmodurl modname="pnMessages" func="newpm" uname="`$user.uname`"]-->" title="<!--[pnml name='_PNMESSAGES_PM']--> <!--[$user.uname]-->"><!--[pnimg modname=pnMessages src='pm.gif' alt=_PNMESSAGES_PM altml=true style='vertical-align:middle; margin-left:2px;']--></a> 
     12                                <a href="<!--[pnmodurl modname="pnMessages" func="newpm" uid="`$user.uid`"]-->" title="<!--[pnml name='_PNMESSAGES_PM']--> <!--[$user.uname]-->"><!--[pnimg modname=pnMessages src='pm.gif' alt=_PNMESSAGES_PM altml=true style='vertical-align:middle; margin-left:2px;']--></a> 
     13                        <!--[/if]--> 
     14                        <!--[if $msgmodule eq 'InterCom']--> 
     15                                <!--[if $user.uid eq $uid]--> 
     16                                        (<a href="<!--[pnmodurl modname="InterCom" func="inbox"]-->" title="<!--[pnml name='_IC_UNREAD']-->"><!--[$messages.totalin]--></a> | <a href="<!--[pnmodurl modname="InterCom" func="inbox"]-->" title="<!--[pnml name='_IC_TOTAL']-->"><!--[$messages.unread]--></a>) 
     17                                <!--[/if]--> 
     18                                <a href="<!--[pnmodurl modname="InterCom" func="newpm" uid="`$user.uid`"]-->" title="<!--[pnml name='_IC_PM']--> <!--[$user.uname]-->"><!--[pnimg modname=InterCom src='pm.gif' alt=_IC_PM altml=true style='vertical-align:middle; margin-left:2px;']--></a> 
    1319                        <!--[/if]--> 
    1420                </li> 
  • branches/zikula-1.0/modules/Members_List/pntemplates/memberslist_user_online.htm

    r24862 r24892  
    99        <th><!--[pnml name="_USERNAME"]--></th> 
    1010        <th><!--[pnml name="_UREALNAME"]--></th> 
    11         <!--[if $pnmessages eq true]--> 
     11        <!--[if $msgmodule eq 'pnMessages']--> 
    1212        <th><!--[pnml name="_PNMESSAGES_PM"]--></th> 
     13                <!--[/if]--> 
     14        <!--[if $msgmodule eq 'InterCom']--> 
     15        <th><!--[pnml name="_IC_PM"]--></th> 
    1316                <!--[/if]--> 
    1417        <th><!--[pnml name="_URL"]--></th> 
     
    2528    <!--[ /if ]--> 
    2629        <td><strong><!--[$user.uname|userprofilelink]--></strong></td> 
    27         <td><!--[$users._UREALNAME|default:"&nbsp;"]--></td> 
    28        <!--[if $pnmessages eq true]--> 
     30        <td><!--[$user._UREALNAME|default:"&nbsp;"]--></td> 
     31        <!--[if $msgmodule eq 'pnMessages']--> 
    2932        <td><a href="<!--[pnmodurl modname="pnMessages" func="newpm" uid="`$user.uid`"]-->"><!--[pnimg modname=core set=icons/extrasmall src="mail_new.gif" alt=_PNMESSAGES_SENDPM altml=true]--></a></td> 
     33                <!--[/if]--> 
     34        <!--[if $msgmodule eq 'InterCom']--> 
     35        <td><a href="<!--[pnmodurl modname="InterCom" func="newpm" uid="`$user.uid`"]-->"><!--[pnimg modname=core set=icons/extrasmall src="mail_new.gif" alt=_IC_SENDPM altml=true]--></a></td> 
    3036                <!--[/if]--> 
    3137        <td> 
  • branches/zikula-1.0/modules/Members_List/pntemplates/memberslist_user_recent.htm

    r24862 r24892  
    1313        <th><!--[pnml name="_UREALNAME"]--></th> 
    1414                <!--[/if]--> 
    15         <!--[if $pnmessages eq true]--> 
     15        <!--[if $msgmodule eq 'pnMessages']--> 
    1616        <th><!--[pnml name="_PNMESSAGES_PM"]--></th> 
     17                <!--[/if]--> 
     18        <!--[if $msgmodule eq 'InterCom']--> 
     19        <th><!--[pnml name="_IC_PM"]--></th> 
    1720                <!--[/if]--> 
    1821        <!--[ if @in_array('_YOURHOMEPAGE', $dudarray) ]--> 
     
    4548        <td><!--[$users[users]._UREALNAME|default:"&nbsp;"]--></td> 
    4649                <!--[/if]--> 
    47         <!--[if $pnmessages eq true]--> 
     50        <!--[if $msgmodule eq 'pnMessages']--> 
    4851        <td><a href="<!--[pnmodurl modname="pnMessages" func="newpm" uid="`$users[users].uid`"]-->"><!--[pnimg modname=core set=icons/extrasmall src="mail_new.gif" alt=_PNMESSAGES_SENDPM altml=true]--></a></td> 
     52                <!--[/if]--> 
     53        <!--[if $msgmodule eq 'InterCom']--> 
     54        <td><a href="<!--[pnmodurl modname="InterCom" func="newpm" uid="`$users[users].uid`"]-->"><!--[pnimg modname=core set=icons/extrasmall src="mail_new.gif" alt=_IC_SENDPM altml=true]--></a></td> 
    4955                <!--[/if]--> 
    5056        <!--[ if @in_array('_YOURHOMEPAGE', $dudarray) ]--> 
  • branches/zikula-1.0/modules/Members_List/pntemplates/memberslist_user_view.htm

    r24862 r24892  
    2929        <th><!--[pnml name="_UREALNAME"]--></th> 
    3030        <!--[ /if ]--> 
    31         <!--[if $pnmessages eq true]--> 
     31        <!--[if $msgmodule eq 'pnMessages']--> 
    3232        <th><!--[pnml name="_PNMESSAGES_PM"]--></th> 
     33                <!--[/if]--> 
     34        <!--[if $msgmodule eq 'InterCom']--> 
     35        <th><!--[pnml name="_IC_PM"]--></th> 
    3336                <!--[/if]--> 
    3437        <!--[ if @in_array('_YOURHOMEPAGE', $dudarray) ]--> 
     
    6063        <td><!--[$users[users]._UREALNAME|pnvarprepfordisplay|default:"&nbsp;"]--></td> 
    6164        <!--[ /if ]--> 
    62         <!--[if $pnmessages eq true]--> 
     65        <!--[if $msgmodule eq 'pnMessages']--> 
    6366        <td><a href="<!--[pnmodurl modname="pnMessages" func="newpm" uid="`$users[users].uid`"]-->"><!--[pnimg modname=core set=icons/extrasmall src="mail_new.gif" alt=_PNMESSAGES_SENDPM altml=true]--></a></td> 
     67                <!--[/if]--> 
     68        <!--[if $msgmodule eq 'InterCom']--> 
     69        <td><a href="<!--[pnmodurl modname="InterCom" func="newpm" uid="`$users[users].uid`"]-->"><!--[pnimg modname=core set=icons/extrasmall src="mail_new.gif" alt=_IC_SENDPM altml=true]--></a></td> 
    6470                <!--[/if]--> 
    6571        <!--[ if @in_array('_YOURHOMEPAGE', $dudarray) ]--> 
  • branches/zikula-1.0/modules/Members_List/pnuserapi.php

    r24847 r24892  
    495495    return $items; 
    496496} 
     497 
     498/** 
     499 * Utility function to find out which messages module is installed 
     500 * can find pnMessages and InterCom 
     501 * @author Frank Schmmertz 
     502 * @return string name of the messaging module found, empty if none 
     503 */ 
     504function Members_List_userapi_getmessagingmodule() 
     505{ 
     506    $modname = ''; 
     507    if (pnModAvailable('pnMessages')) { 
     508        pnModLangLoad('pnMessages', 'user'); 
     509        $modname = 'pnMessages'; 
     510    } else if (pnModAvailable('InterCom')) { 
     511        pnModLangLoad('InterCom'); 
     512        $modname = 'InterCom'; 
     513    } 
     514    return $modname;     
     515} 
  • branches/zikula-1.0/modules/Members_List/pnuser.php

    r24847 r24892  
    147147    pnModLangLoad('Profile', 'user'); 
    148148 
    149     // check if pnMessages is available and add the necessary info 
    150     $pnmessages = pnModAvailable('pnMessages'); 
    151     $pnRender->assign('pnmessages', $pnmessages); 
    152     if ($pnmessages) { 
    153         pnModLangLoad('pnMessages', 'user'); 
    154     } 
     149    // check which messaging module is available and add the necessary info 
     150    $pnRender->assign('msgmodule', pnModAPIFunc('Members_List', 'user', 'getmessagingmodule')); 
    155151 
    156152    // Assign the values for the smarty plugin to produce a pager 
     
    231227    pnModLangLoad('Profile', 'user'); 
    232228 
    233     // check if pnMessages is available and add the necessary info 
    234     $pnmessages = pnModAvailable('pnMessages'); 
    235     $pnRender->assign('pnmessages', $pnmessages); 
    236     if ($pnmessages) { 
    237         pnModLangLoad('pnMessages', 'user'); 
    238     } 
     229    // check which messaging module is available and add the necessary info 
     230    $pnRender->assign('msgmodule', pnModAPIFunc('Members_List', 'user', 'getmessagingmodule')); 
    239231 
    240232    // get all active profile fields 
     
    286278    pnModLangLoad('Profile', 'user'); 
    287279 
    288     // check if pnMessages is available and add the necessary info 
    289     $pnmessages = pnModAvailable('pnMessages'); 
    290     $pnRender->assign('pnmessages', $pnmessages); 
    291     if ($pnmessages) { 
    292         pnModLangLoad('pnMessages', 'user'); 
    293     } 
     280    // check which messaging module is available and add the necessary info 
     281    $pnRender->assign('msgmodule', pnModAPIFunc('Members_List', 'user', 'getmessagingmodule')); 
    294282 
    295283    // get all active profile fields 
  • branches/zikula-1.0/system/Theme/plugins/function.pncountnewmessages.php

    r24342 r24892  
    3232    unset($params); 
    3333 
    34     $newmessages = 0; 
     34    $unread = 0; 
    3535    if (pnUserLoggedIn()) { 
    36         if (pnModAvailable('Messages'))    { 
    37             $dbconn = pnDBGetConn(true); 
    38             $pntable = pnDBGetTables(); 
    39             $column = &$pntable['priv_msgs_column']; 
    40             // get unread messages 
    41             $result = $dbconn->Execute("SELECT count(*) FROM $pntable[priv_msgs] WHERE $column[to_userid]='" . DataUtil::formatForStore(pnUserGetVar('uid')) . "' AND $column[read_msg]='0'"); 
    42             list($newmessages) = $result->fields;  // new messages 
    43             $result->Close(); 
     36        if (pnModAvailable('pnMessages')) { 
     37            $messages = pnModAPIFunc('pnMessages', 'user', 'getmessagecount'); 
     38            $unread = $messages['unread']; 
     39        } else if (pnModAvailable('InterCom')) { 
     40            $messages = pnModAPIFunc('InterCom', 'user', 'getmessagecount'); 
     41            $unread = $messages['unread']; 
    4442        } 
    4543    } 
    4644 
    4745    if (isset($assign)) { 
    48         $smarty->assign($assign, $newmessages); 
     46        $smarty->assign($assign, $unread); 
    4947    } else { 
    50         return $newmessages; 
     48        return $unread; 
    5149    } 
    5250} 
 
 
Powered by Trac
Design by Arcsin