Changeset 155

Show
Ignore:
Timestamp:
12/14/07 20:40:30 (1 year ago)
Author:
dramirez
Message:

MESSAGES:
- Send messages to communities could be configurable
- 0.9 compatibility bug fixes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • messages/trunk/CHANGELOG.txt

    r152 r155  
     1Version 0.2.3 
     2        Translations to fi (Thanks to Pasi Havia) 
     3        Fixes for work with the 0.9 series (not backward compatibility) 
     4        Added a property for allow/disallow community messages 
    15Version 0.2.1 
    26  Translations to nl (Thanks to Daniel Dubbeldam) 
  • messages/trunk/CONTRIBUTORS.txt

    r152 r155  
    99  Daniel Dubbeldam 
    1010    Translations to nl 
     11  Pasi Havia (http://www.elgg.org/encore) 
     12        Translations to fi 
     13        Some 0.9 compatibility bug fixes 
  • messages/trunk/README.txt

    r152 r155  
    1818If you want to change this behavior you must change the value of MESSAGES_SIDEBAR_NO_MEMBER_LINK 
    1919in the 'messages/lib/messages_config.php' file. 
     20 
     21By default the plugin enable send messages for communities.  
     22 
     23If you want to change this behavior you must change the value of MESSAGES_COMMUNITY_MESSAGES in  
     24the 'messages/lib/messages_config.php' file. 
  • messages/trunk/default_template.php

    r153 r155  
    66 * @copyright Corporación Somos Más - 2007 
    77*/ 
    8 global $template; 
    9 global $template_definition; 
    108 
     9// Add CSS 
    1110templates_add_context('css', 'mod/messages/css.css', true, true); 
    1211 
    13 // Registering template definitions 
    14 $template_definition[] = array ('id' => 'plug_messages', 
    15                                 'name' => __gettext("Message List"), 
    16                                 'description' => __gettext("A template for the message list"), 
    17                                 'glossary' => array ('{{messages}}' => __gettext("The list of messages themselves"), 
    18                                                      '{{paging}}' => __gettext("The list of page links when there are lots of messages"), 
    19                                                      '{{from_to}}' => __gettext("From | To Label for the message list"), 
    20                                                      'action' => "", 
    21                                                      'date' => '', 
    22                                                      'subject' => '', 
    23                                                      'actionMsg' => '', 
    24                                                      'returnConfirm' => '' 
    25                                                      ) 
    26                               ); 
     12// Add page templates 
    2713 
    28  
    29 $template_definition[] = array ('id' => 'plug_message', 
    30                                 'name' => __gettext("Message"), 
    31                                 'description' => __gettext("A template for each message"), 
    32                                 'glossary' => array ('{{date}}' => __gettext("The time and date of the message"), 
    33                                                      '{{title}}' => __gettext("Message title"), 
    34                                                      '{{from_username}}' => __gettext("The username from the sender"), 
    35                                                      '{{from_name}}' => __gettext("The full name from the sender"), 
    36                                                      '{{from_icon}}' => __gettext("The icon from the sender"), 
    37                                                      '{{msg_style}}' => __gettext("The message status style (read|unread)") 
    38                                                      ) 
    39                                 ); 
    40  
    41 $template_definition[] = array ('id' => 'plug_detailedmessage', 
    42                                 'name' => __gettext("Message"), 
    43                                 'description' => __gettext("A template for each message"), 
    44                                 'glossary' => array ('{{date}}' => __gettext("The time and date of the message"), 
    45                                                      '{{title}}' => __gettext("Message title"), 
    46                                                      '{{from_username}}' => __gettext("The username from the sender"), 
    47                                                      '{{from_name}}' => __gettext("The full name from the sender"), 
    48                                                      '{{from_icon}}' => __gettext("The icon from the sender"), 
    49                                                      '{{body}}' => __gettext("The message body text"), 
    50                                                      '{{links}}' => __gettext("Links related with the message (delete|reply)") 
    51                                                      ) 
    52                                 ); 
    53  
    54  
    55 $template['plug_messages'] = file_get_contents(dirname(__FILE__)."/templates/messages_messages.html"); 
    56 $template['plug_message'] = file_get_contents(dirname(__FILE__)."/templates/messages_message.html"); 
    57 $template['plug_detailedmessage'] = file_get_contents(dirname(__FILE__)."/templates/messages_detailed_message.html"); 
     14templates_add_context('plug_messages',"mod/messages/templates/messages_messages.html"); 
     15templates_add_context('plug_message',"mod/messages/templates/messages_message.html"); 
     16templates_add_context('plug_detailedmessage',"mod/messages/templates/messages_detailed_message.html"); 
    5817 
    5918?> 
  • messages/trunk/lib/messages_config.php

    r152 r155  
    88 * @copyright Corporación Somos Más - 2007 
    99 */ 
     10  
    1011 /** 
    11   * Configure if the sidebar link display if available for no member communities 
     12  * Configure if the sidebar link display would be available for no member communities 
    1213  * Type: boolean 
    1314  */ 
    14  define("MESSAGES_SIDEBAR_NO_MEMBER_LINK",false); 
     15 define("MESSAGES_SIDEBAR_NO_MEMBER_LINK",true); 
     16 
     17 /** 
     18  * Configure if you want to enable to send messages to communities 
     19  * Type: boolean 
     20  */ 
     21 define("MESSAGES_COMMUNITY_MESSAGES",true);   
    1522?> 
  • messages/trunk/lib/messages_new.php

    r152 r155  
    2828      $friend = get_record("users", "ident", $friend->friend); 
    2929      if ($friend) { 
    30         $to_param[$friend->ident] = $friend->name; 
    31         if ($friend->user_type == "community") { 
    32           $to_param[$friend->ident] .= " " . __gettext("(Community)"); 
     30        if ($friend->user_type == "community" && MESSAGES_COMMUNITY_MESSAGES) { 
     31          $to_param[$friend->ident] = $friend->name." " . __gettext("(Community)"); 
     32        } 
     33        else if($friend->user_type != "community"){ 
     34          $to_param[$friend->ident] = $friend->name; 
    3335        } 
    3436      } 
  • messages/trunk/lib/messages_sidebar_link.php

    r152 r155  
    11<?php 
    2  
    3  
    42/* 
    53 * This script shows the 'Send Message' link in the sidebar 
    64 * 
    7  * @uses $CFG 
     5 * @uses $CFG,$USER 
    86 * 
    97 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
     
    2018if (isloggedin() && $page_owner != $_SESSION['userid'] && $page_owner != -1) { 
    2119  $messages_link = '<ul><li><a href="' . $CFG->wwwroot . "mod/messages/compose.php?action=compose&to=$page_owner" . '">' . __gettext("Send Message") . '</a></li></ul>'; 
    22   if (!MESSAGES_SIDEBAR_NO_MEMBER_LINK  
     20  if (!MESSAGES_SIDEBAR_NO_MEMBER_LINK 
    2321       && user_type($page_owner) == "community"  
    2422       && count_records_sql($community_membership_query, array ($USER->ident,$page_owner)) == 0) { 
    2523    $messages_link = ''; 
     24  } 
     25  else if(!MESSAGES_COMMUNITY_MESSAGES && user_type($page_owner) == "community" ){ 
     26        $messages_link = ''; 
    2627  } 
    2728  $run_result .= $messages_link; 
  • messages/trunk/messages_actions.php

    r152 r155  
    3737 
    3838require_once (dirname(dirname(__FILE__)) . "/../includes.php"); 
     39require_once (dirname(__FILE__) . "/lib/messages_config.php"); 
    3940 
    4041/** 
     
    103104        $recipients = array (); 
    104105        $recipient = get_record("users", "ident", $to); 
     106        
     107        if($recipient->user_type == "community" && !MESSAGES_COMMUNITY_MESSAGES){ 
     108                $messages[] = __gettext("The administrator doesn't allow send community messages"); 
     109          define('redirect_url', $redirect_url); 
     110          break; 
     111        } 
     112         
    105113        if ($recipient->user_type == "community") { 
    106114          $members = get_records_sql('SELECT u.*, f.ident AS friendident FROM ' . $CFG->prefix . 'friends f ' . 
    107115                                     'JOIN ' . $CFG->prefix . 'users u ON u.ident = f.owner ' . 
    108                                      'WHERE f.friend = ? AND u.user_type = ?', array ( 
    109             $to, 
    110             'person' 
    111           )); 
     116                                     'WHERE f.friend = ? AND u.user_type = ?', array ($to,'person')); 
    112117 
    113118          foreach ($members as $key => $infoMember) {