Changeset 93

Show
Ignore:
Timestamp:
04/13/07 21:38:53 (2 years ago)
Author:
diego
Message:

Messages: Bug fixes.
Contenttoolbar

Added the KNOW_BUGS file to compatibility issues with the elgg 0.7 version

Files:

Legend:

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

    r80 r93  
     1Version 0.1.3 
     2  Fix a problem with the css 
     3  Fix a problem with the redirect when you delete a message 
     4  Changes in the rewrite rules 
    15Version 0.1.2 
    26  Fix some language issues 
     
    59Version 0.1.1 
    610  A depedence with the display_input_field function was fixed. 
    7   A code standard fix withe the <? <?php thing  
     11  A code standard fix withe the <? <?php thing 
    812Version 0.1 
    913  Initial release 
     
    1317  - Send messages to communities 
    1418  - Delete messages 
    15   - Mark messages as (read | unread
     19  - Mark messages as ( read | unread
  • messages/README.txt

    r80 r93  
    88RewriteRule ^([A-Za-z0-9]+)\/messages\/sent\/msg_offset/([0-9]+)$ mod/messages/index.php?profile_name=$1&sent=1&msg_offset=$2 
    99RewriteRule ^([A-Za-z0-9]+)\/messages\/compose$ mod/messages/compose.php?profile_name=$1 
    10 RewriteRule ^([A-Za-z0-9]+)\/messages\/view\/([0-9]+)$ mod/messages/view.php?profile_name=$1&message=$2 
     10RewriteRule ^([A-Za-z0-9]+)\/messages\/view\/([0-9]+)\/([0-1])$ mod/messages/view.php?profile_name=$1&message=$2&sent=$3 
  • messages/css.css

    r80 r93  
    44#messages_table th{ 
    55        color: #6D929B; 
    6         border-right: 1px solid #C1DAD7; 
    7         border-bottom: 1px solid #C1DAD7; 
    8         border-top: 1px solid #C1DAD7; 
     6        border-right: 1px solid #CCCCCC; 
     7        border-left: 1px solid #CCCCCC; 
    98        text-align: center; 
    109        padding: 6px 6px 6px 12px; 
    11         background: #EFEFEF;    
     10        background: #EFEFEF; 
    1211} 
    1312#messages_table td{ 
    14         border-bottom: 1px solid #C1DAD7; 
    1513        background: #fff; 
    1614        padding: 2px 2px 2px 10px; 
    1715        font-weight: bold; 
     16        border-right: 1px solid #CCCCCC; 
     17        border-left: 1px solid #CCCCCC; 
    1818} 
    1919#messages_table td.message_read{ 
    2020        background: #F5FAFA; 
    21         border-bottom: 1px solid #C1DAD7; 
    2221        padding: 2px 2px 2px 10px; 
    2322        font-weight: normal; 
  • messages/default_template.php

    r80 r93  
    22/* 
    33 * This script configure the templates used for the private messages plug-in 
    4  *  
     4 * 
    55 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
    66 * @copyright Corporación Somos Más - 2007 
     
    7575$template['plug_message'] =<<< END 
    7676     <tr> 
    77       <td {{msg_style}}>{{mark}}</td> 
    78       <td {{msg_style}} valign="center">{{from_icon}}&nbsp;{{from_name}}</td> 
     77      <td {{msg_style}} >{{mark}}</td> 
     78      <td {{msg_style}} valign="middle">{{from_icon}}&nbsp;{{from_name}}</td> 
    7979      <td {{msg_style}}>{{title}}</td> 
    8080      <td {{msg_style}}>{{date}}</td> 
     
    8686   <h2>{{title}}</h2> 
    8787        <div class="user"><!-- Open class user --> 
    88         {{from_icon}}&nbsp;{{from_name}} 
     88        {{from_icon}}&nbsp;<small>{{from_name}}</small> 
    8989        </div><!-- Close class user --> 
    9090        <div class="post"><!-- Open class post --> 
     
    9898</div><!-- Close weblog_post --> 
    9999<div class="clearing"></div> 
    100      
     100 
    101101END; 
    102102?> 
  • messages/lib.php

    r80 r93  
    11<?php 
    22function messages_pagesetup() { 
    3   // register links --  
    4   global $profile_id; 
    5   global $PAGE; 
    6   global $CFG; 
    7   global $metatags; 
     3  // register links -- 
     4  global $profile_id,$PAGE,$CFG,$metatags,$function; 
    85 
    9   $pgowner = $profile_id; 
     6  $pgowner= $profile_id; 
     7 
     8/* 
     9    foreach($function['display:sidebar'] as $key => $file) 
     10    { 
     11echo "$key => $file<br>"; 
     12    } 
     13 
     14*/ 
    1015 
    1116  if (isloggedin() && user_info("user_type", $_SESSION['userid']) != "external") { 
     17    // Add the JavaScript functions 
     18    // Lose the trailing slash 
     19    $url= substr($CFG->wwwroot, 0, -1); 
     20    $metatags .= "<script language=\"javascript\" type=\"text/javascript\" src=\"$url/mod/messages/messages.js\"></script>"; 
     21    $metatags .= "<link rel=\"stylesheet\" href=\"" . $CFG->wwwroot . "mod/messages/css.css\" type=\"text/css\" media=\"screen\" />"; 
     22 
    1223    if (defined("context") && context == "messages" && $pgowner == $_SESSION['userid']) { 
    13       $PAGE->menu[] = array ( 
     24      $PAGE->menu[]= array ( 
    1425        'name' => 'messages', 
    1526        'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/" class="selected">' . __gettext("Your Messages" 
    1627      ) . '</a></li>'); 
    1728    } else { 
    18       $PAGE->menu[] = array ( 
     29      $PAGE->menu[]= array ( 
    1930        'name' => 'messages', 
    2031        'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/">' . __gettext("Your Messages" 
     
    2536 
    2637      if (user_type($pgowner) == "person") { 
    27         $PAGE->menu_sub[] = array ( 
     38        $PAGE->menu_sub[]= array ( 
    2839          'name' => 'messages:list', 
    2940          'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/">' . __gettext("View Messages" 
    3041        ) . '</a>'); 
    3142 
    32         $PAGE->menu_sub[] = array ( 
     43        $PAGE->menu_sub[]= array ( 
    3344          'name' => 'messages:compose', 
    3445          'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/compose">' . __gettext("Compose" 
    3546        ) . '</a>'); 
    3647 
    37         $PAGE->menu_sub[] = array ( 
     48        $PAGE->menu_sub[]= array ( 
    3849          'name' => 'messages:sent', 
    3950          'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/sent">' . __gettext("Sent Messages" 
     
    4152      } 
    4253    } 
    43  
    44     // Add the JavaScript functions 
    45     // Lose the trailing slash 
    46     $url = substr($CFG->wwwroot, 0, -1); 
    47     $metatags .= "<script language=\"javascript\" type=\"text/javascript\" src=\"$url/mod/messages/messages.js\"></script>"; 
    4854  } 
    4955} 
     
    5258  global $CFG, $function, $db, $METATABLES; 
    5359  if (in_array($CFG->prefix . "messages", $METATABLES)) { 
    54     $messagesTable = $db->MetaColumnNames($CFG->prefix . "messages", true); 
     60    $messagesTable= $db->MetaColumnNames($CFG->prefix . "messages", true); 
    5561    // If dosn't exists adding the colummns 'hidden_from' and 'hidden_to' 
    5662    if (!in_array("hidden_from", $messagesTable) || !in_array("hidden_to", $messagesTable)) { 
     
    6571  // I know, I know this is a big cannon to kill a fly, but I want to use the display_input_field function :P 
    6672  if (!isset ($CFG->display_field_module)) { 
    67     $CFG->display_field_module = array (); 
     73    $CFG->display_field_module= array (); 
    6874  } 
    6975  if (!array_key_exists("as_select", $CFG->display_field_module)) { 
    70     $CFG->display_field_module["as_select"] = "messages"; 
     76    $CFG->display_field_module["as_select"]= "messages"; 
    7177  } 
     78 
    7279} 
    7380 
     
    8895 */ 
    8996function messages_display_input_field($parameter) { 
    90   $cleanid = $parameter[0]; 
     97  $cleanid= $parameter[0]; 
    9198  switch ($parameter[2]) { 
     99    case "asoc_select": 
    92100    case "as_select" : 
    93101      $run_result .= "<select name=\"" . $parameter[0] . "\" id=\"" . $cleanid . "\" />"; 
    94102      foreach ($parameter[6] as $option_value => $option) { 
    95103        $run_result .= "<option value=\"" . htmlspecialchars(stripslashes($option_value), ENT_COMPAT, 'utf-8') . "\" "; 
    96         if ($parameter[1] == $option) { 
     104        if ($parameter[1] == $option_value) { 
    97105          $run_result .= " selected "; 
    98106        } 
  • messages/messages_actions.php

    r80 r93  
    22/* 
    33 * This script defines the actions avaible for the private messages plug-in. 
    4  *  
     4 * 
    55 * Actions avaible: 
    66 *      - Delete    Allows to delete the specified message 
     
    88 *                    $msg_id 
    99 *                  Uses: 
    10  *                    $USER   
     10 *                    $USER 
    1111 *      - Compose   Allows to create a new message 
    1212 *                  Params: 
     
    1616 *                    $new_msg_body 
    1717 *                  Uses: 
    18  *                    $USER   
     18 *                    $USER 
    1919 *      - Multiple  Allows to do the following operations over several messages: 
    2020 *                  (Mark as read | mark as unread | delete) 
     
    2424 *                    $sent if the requirement comes from the sent messages list 
    2525 *                  Uses: 
    26  *                    $USER   
    27  *  
     26 *                    $USER 
     27 * 
    2828 * @param string $action Action to be executed 
    29  *  
     29 * 
    3030 * @uses $USER 
    3131 * @uses $CFG 
    3232 * @uses $messages 
    33  *  
     33 * 
    3434 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
    3535 * @copyright Corporación Somos Más - 2007 
     
    4343 * @param int $msg Message id 
    4444 * @param int $user Current user id 
     45 * @param boolean $sent If the message its a sent message or not 
    4546 */ 
    46 function deleteMessage($msg, $user) { 
     47function deleteMessage($msg, $user,$sent=0) { 
    4748  global $messages; 
    48   $sent = false; 
    4949  if ($msg_info = get_record('messages', 'ident', $msg)) { 
    50  
    51     if ($msg_info->from_id == $user)
     50error_log("borrando $msg, $user, $sent"); 
     51    if($sent)
    5252      $msg_info->hidden_from = '1'; 
    53       $sent = true; 
    54     } else
     53    } 
     54    else
    5555      $msg_info->hidden_to = '1'; 
    5656    } 
    57     if ($msg_info->to_id == $user) { 
    58       $msg_info->hidden_to = '1'; 
    59     } 
    60  
    6157    update_record('messages', $msg_info); 
    6258    if ($msg_info->hidden_from && $msg_info->hidden_to) { 
     
    7470global $USER; 
    7571global $CFG; 
    76  
    7772// Actions to perform 
    7873$action = optional_param('action'); 
    7974switch ($action) { 
    8075  case "delete" : 
    81     // @todo Arreglar esto, como está ahora si uno borra un mensaje que uno envió tambien lo borra del 'inbox' del receptor :-| 
    8276    $msg = optional_param('msg_id', 0, PARAM_INT); 
    83     $sent = false
     77    $sent = optional_param('sent',0,PARAM_INT)
    8478    if (logged_on && !empty ($msg)) { 
    85       $redirect_url = url . user_info('username', $msg_info->from_id) . "/messages/"; 
    86       $sent = deleteMessage($msg, $USER->ident); 
     79      $redirect_url = url . user_info('username', $USER->ident) . "/messages/"; 
     80      $sent = deleteMessage($msg, $USER->ident,$sent); 
    8781      if ($sent) { 
    8882        $redirect_url .= "sent"; 
     
    10094    $body = optional_param('new_msg_body'); 
    10195 
    102     //echo "AVER $from - $to<br>"; 
    10396    if ($from != -1 && $to != -1) { 
    10497      if (trim($body) != "" && trim($subject) != "") { 
     
    109102        $msg->posted = time(); 
    110103 
    111         // @todo If the 'to' param its a community send the message to all the members 
    112104        $recipients = array (); 
    113105        $recipient = get_record("users", "ident", $to); 
     
    194186            break; 
    195187          case "delete"; 
    196             deleteMessage($option, $USER->ident); 
     188            deleteMessage($option, $USER->ident,$sent); 
    197189            break; 
    198190        } 
  • messages/messages_message_detailedview.php

    r80 r93  
    22/* 
    33 * This script loads and append to $run_result the data for the specified message 
    4  *  
     4 * 
    55 * @param object $msg ($parameter) The message to be showed 
    66 * @param int $sent If the list must to show the sent messages (optional) 
    7  *  
     7 * 
    88 * @uses $profile_id 
    99 * @uses $CFG 
    10  *  
     10 * 
    1111 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
    1212 * @copyright Corporación Somos Más - 2007 
     
    1616  $msg = $parameter; 
    1717 
    18   $sent = ($profile_id == $msg->from_id); 
     18  $sent = optional_param('sent'); 
    1919  $author = new StdClass; 
    2020 
    21   $authorid = ($sent === 1) ? $msg->to_id : $msg->from_id; 
     21  $authorid = ($sent == 1) ? $msg->to_id : $msg->from_id; 
    2222  $authorInfo = get_record('users', 'ident', $authorid); 
    2323  $author->username = $authorInfo->username; 
     
    4141  $returnConfirm = __gettext("Are you sure you want to permanently delete this message?"); 
    4242  $Delete = __gettext("Delete"); 
    43  
     43  $from_msg = __gettext("To:"); 
    4444  if (!$sent) { 
     45    $from_msg = __gettext("From:"); 
    4546    $links = '<a href="' . $CFG->wwwroot . 'mod/messages/compose.php?action=reply&amp;msg_id=' . $msg->ident . '&amp;to=' . $msg->from_id . '">' . $reply . '</a> |'; 
    4647  } 
    47   $links .= '&nbsp;<a href="' . $CFG->wwwroot . 'mod/messages/messages_actions.php?action=delete&amp;msg_id=' . $msg->ident . '" onclick="return confirm(\'' . $returnConfirm . '\')">' . $Delete . '</a> |'; 
     48  $links .= '&nbsp;<a href="' . $CFG->wwwroot . 'mod/messages/messages_actions.php?action=delete&amp;sent='.$sent.'&amp;msg_id=' . $msg->ident . '" onclick="return confirm(\'' . $returnConfirm . '\')">' . $Delete . '</a> |'; 
    4849 
    4950  // Updated the message to the read status 
     
    5253    update_record('messages', $msg); 
    5354  } 
    54    
     55 
    5556  $run_result .= templates_draw(array ( 
    5657    'context' => 'plug_detailedmessage', 
     
    5859    'title' => $title, 
    5960    'from_username' => $author->username, 
    60     'from_name' => '<a href="' . url . $author->username . '/">' . $author->fullname . "</a>", 
     61    'from_name' => $from_msg.' <a href="' . url . $author->username . '/">' . $author->fullname . "</a>", 
    6162    'from_icon' => $author->icon, 
    6263    'body' => $body, 
  • messages/messages_message_view.php

    r80 r93  
    22/* 
    33 * This script loads and append to $run_result the basic data for the specified message 
    4  *  
     4 * 
    55 * @param object $msg ($parameter) The message to be showed 
    66 * @param int $sent If the list must to show the sent messages (optional) 
    7  *  
     7 * 
    88 * @uses $profile_id 
    99 * @uses $CFG 
    10  *  
     10 * 
    1111 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
    1212 * @copyright Corporación Somos Más - 2007 
     
    1515if (isset ($parameter)) { 
    1616  global $CFG, $profile_id; 
    17   $msg = $parameter; 
     17  $msg = $parameter[0]; 
     18  $sent = $parameter[1]; 
    1819 
    1920  $sent = optional_param('sent', 0, PARAM_INT); 
     
    4849    'context' => 'plug_message', 
    4950    'date' => $date, 
    50     'title' => '<a href="' . url . $_SESSION['username'] . '/messages/view/' . $msg->ident . '">' . $title . "</a>", 
     51    'title' => '<a href="' . url . $_SESSION['username'] . '/messages/view/' . $msg->ident . "/$sent\">" . $title . "</a>", 
    5152    'from_username' => $author->username, 
    5253    'from_name' => '<a href="' . url . $author->username . '/">' . $author->fullname . "</a>", 
  • messages/messages_view.php

    r80 r93  
    22/* 
    33 * This script loads and append to $run_result the message's list data 
    4  *  
     4 * 
    55 * @param int $msg_offset Msg offset (optional) 
    66 * @param int $sent If the list must to show the sent messages (optional) 
    7  *  
     7 * 
    88 * @uses $profile_id 
    99 * @uses $CFG 
    1010 * @uses $db 
    11  *  
     11 * 
    1212 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
    1313 * @copyright Corporación Somos Más - 2007 
     
    4747 
    4848$msgs = ""; 
    49 $pagging = ""; 
     49$pagging = "&nbsp;"; 
    5050if (!empty ($posts)) { 
    5151  foreach ($posts as $post) { 
    52     $msgs .= run("messages:message:view", $post); 
     52    $msgs .= run("messages:message:view", array($post,$sent)); 
    5353  } 
    5454 
     
    5959    $back = __gettext("Back"); 
    6060    $pagging .=<<< END 
    61                  
     61 
    6262                <a href="{$CFG->wwwroot}{$msg_name}/messages/{$filterlink}msg_offset/{$display_msg_offset}">&lt;&lt; $back</a> 
    63                  
     63 
    6464END; 
    6565  } 
     
    7171    $next = __gettext("Next"); 
    7272    $pagging .=<<< END 
    73                  
     73 
    7474                <a href="{$CFG->wwwroot}{$msg_name}/messages/{$filterlink}msg_offset/{$display_msg_offset}">$next &gt;&gt;</a> 
    75                  
     75 
    7676END; 
    7777  } 
     
    8585  'from_to' => $from, 
    8686  'title' => $title, 
    87   'action_form' => url . "mod/messages/messages_actions.php?action=multiple", 
     87  'action_form' => url . "mod/messages/messages_actions.php?action=multiple&sent=$sent", 
    8888  'action_options' => $action_options, 
    8989  'sent' => $sent 
  • messages/strings.txt

    r80 r93  
    1 #: lib.php:15:         
     1#: lib.php:15: 
    22msgid "Your Messages" 
    33msgstr "" 
    44 
    5 #: lib.php:20:         
     5#: lib.php:20: 
    66msgid "Your Messages" 
    77msgstr "" 
    88 
    9 #: lib.php:29:           
     9#: lib.php:29: 
    1010msgid "View Messages" 
    1111msgstr "" 
    1212 
    13 #: lib.php:34:           
     13#: lib.php:34: 
    1414msgid "Compose" 
    1515msgstr "" 
    1616 
    17 #: lib.php:39:           
     17#: lib.php:39: 
    1818msgid "Sent Messages" 
    1919msgstr "" 
     
    3131msgstr "" 
    3232 
    33 #: messages_actions.php:65:     
     33#: messages_actions.php:65: 
    3434msgid "The selected message was deleted." 
    3535msgstr "" 
    3636 
    37 #: messages_actions.php:67:     
     37#: messages_actions.php:67: 
    3838msgid "The message ID its not valid!." 
    3939msgstr "" 
    4040 
    41 #: messages_actions.php:148:             
     41#: messages_actions.php:148: 
    4242msgid "You have received a message from %s." 
    4343msgstr "" 
    4444 
    45 #: messages_actions.php:150:             
     45#: messages_actions.php:150: 
    4646msgid "To reply, click here: %s" 
    4747msgstr "" 
    4848 
    49 #: messages_actions.php:155:               
     49#: messages_actions.php:155: 
    5050msgid "You cannot reply to this message by email." 
    5151msgstr "" 
    5252 
    53 #: messages_actions.php:156:                 
     53#: messages_actions.php:156: 
    5454msgid "Failed to send email. An unknown error occurred." 
    5555msgstr "" 
    5656 
    57 #: messages_actions.php:163:           
     57#: messages_actions.php:163: 
    5858msgid "Your message was sent" 
    5959msgstr "" 
    6060 
    61 #: messages_actions.php:168:         
     61#: messages_actions.php:168: 
    6262msgid "You can't send an empty message!" 
    6363msgstr "" 
    6464 
    65 #: messages_actions.php:171:       
     65#: messages_actions.php:171: 
    6666msgid "You must specify the sender a recipient!" 
    6767msgstr "" 
     
    9191msgstr "" 
    9292 
    93 #: default_template.php:24:   
     93#: default_template.php:24: 
    9494msgid "Message List" 
    9595msgstr "" 
     
    115115msgstr "" 
    116116 
    117 #: messages_view.php:38:   
     117#: messages_view.php:38: 
    118118msgid "Sent to" 
    119119msgstr "" 
    120120 
    121 #: messages_view.php:39:   
     121#: messages_view.php:39: 
    122122msgid "Sent messages" 
    123123msgstr "" 
    124124 
    125 #: messages_view.php:59:     
     125#: messages_view.php:59: 
    126126msgid "Back" 
    127127msgstr "" 
    128128 
    129 #: messages_view.php:71:     
     129#: messages_view.php:71: 
    130130msgid "Next" 
    131131msgstr "" 
    132132 
    133 #: messages_new.php:32:           
     133#: messages_new.php:32: 
    134134msgid "(Community)" 
    135135msgstr "" 
    136136 
    137 #: messages_new.php:38:     
     137#: messages_new.php:38: 
    138138msgid "No friends on your friends list to send to!" 
    139139msgstr "" 
     
    159159msgstr "" 
    160160 
    161 #: messages_message_detailedview.php:40:   
     161#: messages_message_detailedview.php:40: 
    162162msgid "Reply" 
    163163msgstr "" 
    164164 
    165 #: messages_message_detailedview.php:41:   
     165#: messages_message_detailedview.php:41: 
    166166msgid "Are you sure you want to permanently delete this message?" 
    167167msgstr "" 
    168168 
    169 #: messages_message_detailedview.php:42:   
     169#: messages_message_detailedview.php:42: 
    170170msgid "Delete" 
    171171msgstr "" 
    172172 
    173 #: messages_init.php:26:   
     173#: messages_init.php:26: 
    174174msgid "You may view only your own messages" 
    175175msgstr ""