Changeset 103
- Timestamp:
- 05/04/07 20:28:57 (2 years ago)
- Files:
-
- messages/CHANGELOG.txt (modified) (1 diff)
- messages/ROADMAP.txt (deleted)
- messages/languages/es_CO/LC_MESSAGES/elgg.mo (modified) (previous)
- messages/languages/es_CO/LC_MESSAGES/es_CO.po (modified) (1 diff)
- messages/lib.php (modified) (4 diffs)
- messages/lib/messages_message_detailedview.php (modified) (3 diffs)
- messages/lib/messages_message_view.php (modified) (2 diffs)
- messages/lib/messages_new.php (modified) (3 diffs)
- messages/lib/messages_sidebar_link.php (added)
- messages/lib/messages_view.php (modified) (1 diff)
- messages/messages_actions.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
messages/CHANGELOG.txt
r102 r103 1 Version 0.2 2 Bug fixes 3 Added the sidebar link to allow send messages to every user (Thanks to Renato [http://elgg.org/renato/]) 4 Added the {{contact}} keyword to be used in templates 1 5 Version 0.1.4 2 6 Added the messages counter in the toolbar string 3 7 Code refactor 4 Spanish translation 8 Spanish translations 5 9 Version 0.1.3 6 10 Fix a problem with the css messages/languages/es_CO/LC_MESSAGES/es_CO.po
r102 r103 228 228 msgstr "Siguiente" 229 229 230 #: messages_sidebar_link.php:71 231 msgid "Send Message" 232 msgstr "Enviar mensaje" messages/lib.php
r102 r103 75 75 $function['messages:detailedview'][] = $CFG->dirroot . "mod/messages/lib/messages_message_detailedview.php"; 76 76 77 // Sidebar display function 78 $function['messages:contact:link'][] = $CFG->dirroot ."/mod/messages/lib/messages_sidebar_link.php"; 79 $function['users:infobox:menu:text'][] = $CFG->dirroot ."/mod/messages/lib/messages_sidebar_link.php"; 80 81 77 82 // Inits the display field module param for the 'select' input field 78 83 // I know, I know this is a big cannon to kill a fly, but I want to use the display_input_field function :P … … 83 88 $CFG->display_field_module["as_select"]= "messages"; 84 89 } 90 91 $CFG->templates->variables_substitute['contact'] = 'messages_contact_user'; 85 92 86 93 } … … 106 113 case "asoc_select": 107 114 case "as_select" : 108 $run_result .= "<select name=\"" . $parameter[0] . "\" id=\"" . $cleanid . "\" />";115 $run_result = "<select name=\"" . $parameter[0] . "\" id=\"" . $cleanid . "\" />"; 109 116 foreach ($parameter[6] as $option_value => $option) { 110 117 $run_result .= "<option value=\"" . htmlspecialchars(stripslashes($option_value), ENT_COMPAT, 'utf-8') . "\" "; … … 120 127 return $run_result; 121 128 } 129 130 /** 131 * Function that replaces the '{{contact}}' keyword by the 'Send Message' link 132 */ 133 function messages_contact_user(){ 134 return run("messages:contact:link"); 135 } 136 122 137 ?> messages/lib/messages_message_detailedview.php
r102 r103 1 1 <?php 2 2 3 /* 3 4 * This script loads and append to $run_result the data for the specified message … … 14 15 if (isset ($parameter)) { 15 16 global $CFG, $profile_id; 16 $msg = $parameter;17 $msg= $parameter; 17 18 18 $sent = optional_param('sent');19 $author = new StdClass;19 $sent= optional_param('sent'); 20 $author= new StdClass; 20 21 21 $authorid = ($sent == 1) ? $msg->to_id : $msg->from_id; 22 $authorInfo = get_record('users', 'ident', $authorid); 23 $author->username = $authorInfo->username; 24 $author->fullname = htmlspecialchars($authorInfo->name, ENT_COMPAT, 'utf-8'); 25 if ($authorInfo->icon == -1 || $post->owner == -1) { 26 $author->icon = 0; 22 $authorid= ($sent == 1) ? $msg->to_id : $msg->from_id; 23 if ($authorInfo= get_record('users', 'ident', $authorid)) { 24 $author->username= $authorInfo->username; 25 $author->fullname= htmlspecialchars($authorInfo->name, ENT_COMPAT, 'utf-8'); 26 $author->ident = $authorInfo->ident; 27 27 } else { 28 if ($icon = get_record('icons', 'ident', $authorInfo->icon)) { 29 $author->icon = $icon->ident; 30 } else { 31 $author->icon = 0; 32 } 28 $author->username= ""; 29 $author->fullname= ""; 30 $author->ident= -1; 33 31 } 34 $author->icon = '<a href="' . url . $author->username . '/">' . "<img src=\"" . $CFG->wwwroot . "_icon/user/" . $author->icon . "\" border=\"0\" align=\"left\" alt=\"\" /></a>";32 $author->icon= '<a href="' . url . $author->username . '/">' .user_icon_html($author->ident)."</a>"; 35 33 36 $date = strftime("%d %b %Y, %H:%M", $msg->posted);37 $title = run("weblogs:text:process", $msg->title);38 $body = run("weblogs:text:process", $msg->body);34 $date= strftime("%d %b %Y, %H:%M", $msg->posted); 35 $title= run("weblogs:text:process", $msg->title); 36 $body= run("weblogs:text:process", $msg->body); 39 37 40 $reply = __gettext("Reply");41 $returnConfirm = __gettext("Are you sure you want to permanently delete this message?");42 $Delete = __gettext("Delete");43 $from_msg = __gettext("To:");38 $reply= __gettext("Reply"); 39 $returnConfirm= __gettext("Are you sure you want to permanently delete this message?"); 40 $Delete= __gettext("Delete"); 41 $from_msg= __gettext("To:"); 44 42 if (!$sent) { 45 $from_msg = __gettext("From:");46 $links = '<a href="' . $CFG->wwwroot . 'mod/messages/compose.php?action=reply&msg_id=' . $msg->ident . '&to=' . $msg->from_id . '">' . $reply . '</a> |';43 $from_msg= __gettext("From:"); 44 $links= '<a href="' . $CFG->wwwroot . 'mod/messages/compose.php?action=reply&msg_id=' . $msg->ident . '&to=' . $msg->from_id . '">' . $reply . '</a> |'; 47 45 } 48 $links .= ' <a href="' . $CFG->wwwroot . 'mod/messages/messages_actions.php?action=delete&sent=' .$sent.'&msg_id=' . $msg->ident . '" onclick="return confirm(\'' . $returnConfirm . '\')">' . $Delete . '</a> |';46 $links .= ' <a href="' . $CFG->wwwroot . 'mod/messages/messages_actions.php?action=delete&sent=' . $sent . '&msg_id=' . $msg->ident . '" onclick="return confirm(\'' . $returnConfirm . '\')">' . $Delete . '</a> |'; 49 47 50 48 // Updated the message to the read status 51 49 if ($msg->status == "unread" && $msg->to_id == $profile_id) { 52 $msg->status = "read";50 $msg->status= "read"; 53 51 update_record('messages', $msg); 54 52 } … … 59 57 'title' => $title, 60 58 'from_username' => $author->username, 61 'from_name' => $from_msg .' <a href="' . url . $author->username . '/">' . $author->fullname . "</a>",59 'from_name' => $from_msg . ' <a href="' . url . $author->username . '/">' . $author->fullname . "</a>", 62 60 'from_icon' => $author->icon, 63 61 'body' => $body, messages/lib/messages_message_view.php
r102 r103 1 1 <?php 2 2 3 /* 3 4 * This script loads and append to $run_result the basic data for the specified message … … 15 16 if (isset ($parameter)) { 16 17 global $CFG, $profile_id; 17 $msg = $parameter[0];18 $sent = $parameter[1];19 $index = $parameter[2];18 $msg= $parameter[0]; 19 $sent= $parameter[1]; 20 $index= $parameter[2]; 20 21 21 $sent = optional_param('sent', 0, PARAM_INT);22 $author = new StdClass;22 $sent= optional_param('sent', 0, PARAM_INT); 23 $author= new StdClass; 23 24 24 $authorid = ($sent === 1) ? $msg->to_id : $msg->from_id; 25 $authorInfo = get_record('users', 'ident', $authorid); 26 $author->username = $authorInfo->username; 27 $author->fullname = htmlspecialchars($authorInfo->name, ENT_COMPAT, 'utf-8'); 28 if ($authorInfo->icon == -1 || $post->owner == -1) { 29 $author->icon = 0; 25 $authorid= ($sent === 1) ? $msg->to_id : $msg->from_id; 26 if ($authorInfo= get_record('users', 'ident', $authorid)) { 27 $author->username= $authorInfo->username; 28 $author->fullname= htmlspecialchars($authorInfo->name, ENT_COMPAT, 'utf-8'); 29 $author->ident = $authorInfo->ident; 30 30 } else { 31 if ($icon = get_record('icons', 'ident', $authorInfo->icon)) { 32 $author->icon = $icon->ident; 33 } else { 34 $author->icon = 0; 35 } 31 $author->username= ""; 32 $author->fullname= ""; 33 $author->ident= -1; 36 34 } 37 $author->icon = '<a href="' . url . $author->username . '/">' . "<img src=\"" . $CFG->wwwroot . "_icon/user/" . $author->icon . "/w/50/h/50\" border=\"0\" align=\"left\" alt=\"\" /></a>";38 35 39 $ mark = "<input type=\"checkbox\" name=\"selected[]\" value=\"".$msg->ident."\" onclick=\"mark(this)\">";36 $author->icon= '<a href="' . url . $author->username . '/">' .user_icon_html($author->ident,50). "</a>"; 40 37 41 $date = strftime("%d/%m/%Y, %H:%M", $msg->posted); 42 $username = user_info('username', $msg->from_id); 43 $title = run("weblogs:text:process", $msg->title); 44 $msg_style = ""; 38 $mark= "<input type=\"checkbox\" name=\"selected[]\" value=\"" . $msg->ident . "\" onclick=\"mark(this)\">"; 39 40 $date= strftime("%d/%m/%Y, %H:%M", $msg->posted); 41 $username= user_info('username', $msg->from_id); 42 $title= run("weblogs:text:process", $msg->title); 43 $msg_style= ""; 45 44 if ($msg->status == "read" || $sent === 1) { 46 $msg_style = "class='message_read'";45 $msg_style= "class='message_read'"; 47 46 } 48 47 messages/lib/messages_new.php
r102 r103 2 2 /* 3 3 * This script loads and append to $run_result the data for the specified message 4 * 4 * 5 5 * @param int $from The sender Id 6 6 * @param int $to The recipient Id 7 7 * @param int $msg_id The messge id (optional, used if the new message its a reply) 8 8 * @param int $action If the message is a reply (optional) 9 * 9 * 10 10 * @uses $profile_id 11 11 * @uses $CFG 12 * 12 * 13 13 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 14 14 * @copyright Corporación Somos Más - 2007 … … 56 56 } 57 57 58 $ reply= optional_param('action');58 $action = optional_param('action'); 59 59 60 60 $redirect = url . "mod/messages/messages_actions.php?action=compose"; … … 130 130 </form> 131 131 END; 132 132 133 ?> messages/lib/messages_view.php
r102 r103 41 41 $action_options .= "<option value=\"delete\">$delete</option>"; 42 42 43 $filterlink = ""; 43 44 $where_sent = "to_id=$profile_id AND hidden_to='0'"; 44 45 if ($sent === 1) { messages/messages_actions.php
r102 r103 86 86 87 87 case "compose" : 88 $redirect_url = url . user_info('username', $ USER->ident) . "/messages/compose";88 $redirect_url = url . user_info('username', $_SESSION['userid']) . "/messages/compose"; 89 89 90 90 $from = optional_param('new_msg_from', -1, PARAM_INT); … … 118 118 } 119 119 120 $msgs = 0; 120 121 foreach ($recipients as $rcpt) { 121 122 $msg->to_id = trim($rcpt); … … 124 125 $msg->title = "[" . $recipient->name . "] " . $subject; 125 126 } 126 127 127 $insert_id = insert_record('messages', $msg); 128 128 if ($insert_id != -1) { 129 129 $msgs++; 130 130 } 131 132 131 // Send the email confirmation if configured 133 132 // Don't use the weblog plug-in hook because it inserts data in the messages table too … … 153 152 if ($msgs == count($recipients)) { 154 153 $messages[] = __gettext("Your message was sent"); 155 $redirect_url = url . user_info('username', $ msg->from_id) . "/messages/sent";154 $redirect_url = url . user_info('username', $USER->ident) . "/messages/sent"; 156 155 } 157 156
