Changeset 93
- Timestamp:
- 04/13/07 21:38:53 (2 years ago)
- Files:
-
- contenttoolbar/KNOWN_BUGS (added)
- messages/CHANGELOG.txt (modified) (3 diffs)
- messages/README.txt (modified) (1 diff)
- messages/css.css (modified) (1 diff)
- messages/default_template.php (modified) (4 diffs)
- messages/lib.php (modified) (6 diffs)
- messages/messages_actions.php (modified) (9 diffs)
- messages/messages_message_detailedview.php (modified) (5 diffs)
- messages/messages_message_view.php (modified) (3 diffs)
- messages/messages_view.php (modified) (5 diffs)
- messages/strings.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
messages/CHANGELOG.txt
r80 r93 1 Version 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 1 5 Version 0.1.2 2 6 Fix some language issues … … 5 9 Version 0.1.1 6 10 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 8 12 Version 0.1 9 13 Initial release … … 13 17 - Send messages to communities 14 18 - Delete messages 15 - Mark messages as ( read | unread)19 - Mark messages as ( read | unread ) messages/README.txt
r80 r93 8 8 RewriteRule ^([A-Za-z0-9]+)\/messages\/sent\/msg_offset/([0-9]+)$ mod/messages/index.php?profile_name=$1&sent=1&msg_offset=$2 9 9 RewriteRule ^([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=$210 RewriteRule ^([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 4 4 #messages_table th{ 5 5 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; 9 8 text-align: center; 10 9 padding: 6px 6px 6px 12px; 11 background: #EFEFEF; 10 background: #EFEFEF; 12 11 } 13 12 #messages_table td{ 14 border-bottom: 1px solid #C1DAD7;15 13 background: #fff; 16 14 padding: 2px 2px 2px 10px; 17 15 font-weight: bold; 16 border-right: 1px solid #CCCCCC; 17 border-left: 1px solid #CCCCCC; 18 18 } 19 19 #messages_table td.message_read{ 20 20 background: #F5FAFA; 21 border-bottom: 1px solid #C1DAD7;22 21 padding: 2px 2px 2px 10px; 23 22 font-weight: normal; messages/default_template.php
r80 r93 2 2 /* 3 3 * This script configure the templates used for the private messages plug-in 4 * 4 * 5 5 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 6 6 * @copyright Corporación Somos Más - 2007 … … 75 75 $template['plug_message'] =<<< END 76 76 <tr> 77 <td {{msg_style}} >{{mark}}</td>78 <td {{msg_style}} valign=" center">{{from_icon}} {{from_name}}</td>77 <td {{msg_style}} >{{mark}}</td> 78 <td {{msg_style}} valign="middle">{{from_icon}} {{from_name}}</td> 79 79 <td {{msg_style}}>{{title}}</td> 80 80 <td {{msg_style}}>{{date}}</td> … … 86 86 <h2>{{title}}</h2> 87 87 <div class="user"><!-- Open class user --> 88 {{from_icon}} {{from_name}}88 {{from_icon}} <small>{{from_name}}</small> 89 89 </div><!-- Close class user --> 90 90 <div class="post"><!-- Open class post --> … … 98 98 </div><!-- Close weblog_post --> 99 99 <div class="clearing"></div> 100 100 101 101 END; 102 102 ?> messages/lib.php
r80 r93 1 1 <?php 2 2 function 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; 8 5 9 $pgowner = $profile_id; 6 $pgowner= $profile_id; 7 8 /* 9 foreach($function['display:sidebar'] as $key => $file) 10 { 11 echo "$key => $file<br>"; 12 } 13 14 */ 10 15 11 16 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 12 23 if (defined("context") && context == "messages" && $pgowner == $_SESSION['userid']) { 13 $PAGE->menu[] = array (24 $PAGE->menu[]= array ( 14 25 'name' => 'messages', 15 26 'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/" class="selected">' . __gettext("Your Messages" 16 27 ) . '</a></li>'); 17 28 } else { 18 $PAGE->menu[] = array (29 $PAGE->menu[]= array ( 19 30 'name' => 'messages', 20 31 'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/">' . __gettext("Your Messages" … … 25 36 26 37 if (user_type($pgowner) == "person") { 27 $PAGE->menu_sub[] = array (38 $PAGE->menu_sub[]= array ( 28 39 'name' => 'messages:list', 29 40 'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/">' . __gettext("View Messages" 30 41 ) . '</a>'); 31 42 32 $PAGE->menu_sub[] = array (43 $PAGE->menu_sub[]= array ( 33 44 'name' => 'messages:compose', 34 45 'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/compose">' . __gettext("Compose" 35 46 ) . '</a>'); 36 47 37 $PAGE->menu_sub[] = array (48 $PAGE->menu_sub[]= array ( 38 49 'name' => 'messages:sent', 39 50 'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/sent">' . __gettext("Sent Messages" … … 41 52 } 42 53 } 43 44 // Add the JavaScript functions45 // Lose the trailing slash46 $url = substr($CFG->wwwroot, 0, -1);47 $metatags .= "<script language=\"javascript\" type=\"text/javascript\" src=\"$url/mod/messages/messages.js\"></script>";48 54 } 49 55 } … … 52 58 global $CFG, $function, $db, $METATABLES; 53 59 if (in_array($CFG->prefix . "messages", $METATABLES)) { 54 $messagesTable = $db->MetaColumnNames($CFG->prefix . "messages", true);60 $messagesTable= $db->MetaColumnNames($CFG->prefix . "messages", true); 55 61 // If dosn't exists adding the colummns 'hidden_from' and 'hidden_to' 56 62 if (!in_array("hidden_from", $messagesTable) || !in_array("hidden_to", $messagesTable)) { … … 65 71 // I know, I know this is a big cannon to kill a fly, but I want to use the display_input_field function :P 66 72 if (!isset ($CFG->display_field_module)) { 67 $CFG->display_field_module = array ();73 $CFG->display_field_module= array (); 68 74 } 69 75 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"; 71 77 } 78 72 79 } 73 80 … … 88 95 */ 89 96 function messages_display_input_field($parameter) { 90 $cleanid = $parameter[0];97 $cleanid= $parameter[0]; 91 98 switch ($parameter[2]) { 99 case "asoc_select": 92 100 case "as_select" : 93 101 $run_result .= "<select name=\"" . $parameter[0] . "\" id=\"" . $cleanid . "\" />"; 94 102 foreach ($parameter[6] as $option_value => $option) { 95 103 $run_result .= "<option value=\"" . htmlspecialchars(stripslashes($option_value), ENT_COMPAT, 'utf-8') . "\" "; 96 if ($parameter[1] == $option ) {104 if ($parameter[1] == $option_value) { 97 105 $run_result .= " selected "; 98 106 } messages/messages_actions.php
r80 r93 2 2 /* 3 3 * This script defines the actions avaible for the private messages plug-in. 4 * 4 * 5 5 * Actions avaible: 6 6 * - Delete Allows to delete the specified message … … 8 8 * $msg_id 9 9 * Uses: 10 * $USER 10 * $USER 11 11 * - Compose Allows to create a new message 12 12 * Params: … … 16 16 * $new_msg_body 17 17 * Uses: 18 * $USER 18 * $USER 19 19 * - Multiple Allows to do the following operations over several messages: 20 20 * (Mark as read | mark as unread | delete) … … 24 24 * $sent if the requirement comes from the sent messages list 25 25 * Uses: 26 * $USER 27 * 26 * $USER 27 * 28 28 * @param string $action Action to be executed 29 * 29 * 30 30 * @uses $USER 31 31 * @uses $CFG 32 32 * @uses $messages 33 * 33 * 34 34 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 35 35 * @copyright Corporación Somos Más - 2007 … … 43 43 * @param int $msg Message id 44 44 * @param int $user Current user id 45 * @param boolean $sent If the message its a sent message or not 45 46 */ 46 function deleteMessage($msg, $user ) {47 function deleteMessage($msg, $user,$sent=0) { 47 48 global $messages; 48 $sent = false;49 49 if ($msg_info = get_record('messages', 'ident', $msg)) { 50 51 if ($msg_info->from_id == $user){50 error_log("borrando $msg, $user, $sent"); 51 if($sent){ 52 52 $msg_info->hidden_from = '1'; 53 $sent = true;54 } else{53 } 54 else{ 55 55 $msg_info->hidden_to = '1'; 56 56 } 57 if ($msg_info->to_id == $user) {58 $msg_info->hidden_to = '1';59 }60 61 57 update_record('messages', $msg_info); 62 58 if ($msg_info->hidden_from && $msg_info->hidden_to) { … … 74 70 global $USER; 75 71 global $CFG; 76 77 72 // Actions to perform 78 73 $action = optional_param('action'); 79 74 switch ($action) { 80 75 case "delete" : 81 // @todo Arreglar esto, como está ahora si uno borra un mensaje que uno envió tambien lo borra del 'inbox' del receptor :-|82 76 $msg = optional_param('msg_id', 0, PARAM_INT); 83 $sent = false;77 $sent = optional_param('sent',0,PARAM_INT); 84 78 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); 87 81 if ($sent) { 88 82 $redirect_url .= "sent"; … … 100 94 $body = optional_param('new_msg_body'); 101 95 102 //echo "AVER $from - $to<br>";103 96 if ($from != -1 && $to != -1) { 104 97 if (trim($body) != "" && trim($subject) != "") { … … 109 102 $msg->posted = time(); 110 103 111 // @todo If the 'to' param its a community send the message to all the members112 104 $recipients = array (); 113 105 $recipient = get_record("users", "ident", $to); … … 194 186 break; 195 187 case "delete"; 196 deleteMessage($option, $USER->ident );188 deleteMessage($option, $USER->ident,$sent); 197 189 break; 198 190 } messages/messages_message_detailedview.php
r80 r93 2 2 /* 3 3 * This script loads and append to $run_result the data for the specified message 4 * 4 * 5 5 * @param object $msg ($parameter) The message to be showed 6 6 * @param int $sent If the list must to show the sent messages (optional) 7 * 7 * 8 8 * @uses $profile_id 9 9 * @uses $CFG 10 * 10 * 11 11 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 12 12 * @copyright Corporación Somos Más - 2007 … … 16 16 $msg = $parameter; 17 17 18 $sent = ($profile_id == $msg->from_id);18 $sent = optional_param('sent'); 19 19 $author = new StdClass; 20 20 21 $authorid = ($sent == =1) ? $msg->to_id : $msg->from_id;21 $authorid = ($sent == 1) ? $msg->to_id : $msg->from_id; 22 22 $authorInfo = get_record('users', 'ident', $authorid); 23 23 $author->username = $authorInfo->username; … … 41 41 $returnConfirm = __gettext("Are you sure you want to permanently delete this message?"); 42 42 $Delete = __gettext("Delete"); 43 43 $from_msg = __gettext("To:"); 44 44 if (!$sent) { 45 $from_msg = __gettext("From:"); 45 46 $links = '<a href="' . $CFG->wwwroot . 'mod/messages/compose.php?action=reply&msg_id=' . $msg->ident . '&to=' . $msg->from_id . '">' . $reply . '</a> |'; 46 47 } 47 $links .= ' <a href="' . $CFG->wwwroot . 'mod/messages/messages_actions.php?action=delete& msg_id=' . $msg->ident . '" onclick="return confirm(\'' . $returnConfirm . '\')">' . $Delete . '</a> |';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> |'; 48 49 49 50 // Updated the message to the read status … … 52 53 update_record('messages', $msg); 53 54 } 54 55 55 56 $run_result .= templates_draw(array ( 56 57 'context' => 'plug_detailedmessage', … … 58 59 'title' => $title, 59 60 '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>", 61 62 'from_icon' => $author->icon, 62 63 'body' => $body, messages/messages_message_view.php
r80 r93 2 2 /* 3 3 * This script loads and append to $run_result the basic data for the specified message 4 * 4 * 5 5 * @param object $msg ($parameter) The message to be showed 6 6 * @param int $sent If the list must to show the sent messages (optional) 7 * 7 * 8 8 * @uses $profile_id 9 9 * @uses $CFG 10 * 10 * 11 11 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 12 12 * @copyright Corporación Somos Más - 2007 … … 15 15 if (isset ($parameter)) { 16 16 global $CFG, $profile_id; 17 $msg = $parameter; 17 $msg = $parameter[0]; 18 $sent = $parameter[1]; 18 19 19 20 $sent = optional_param('sent', 0, PARAM_INT); … … 48 49 'context' => 'plug_message', 49 50 '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>", 51 52 'from_username' => $author->username, 52 53 'from_name' => '<a href="' . url . $author->username . '/">' . $author->fullname . "</a>", messages/messages_view.php
r80 r93 2 2 /* 3 3 * This script loads and append to $run_result the message's list data 4 * 4 * 5 5 * @param int $msg_offset Msg offset (optional) 6 6 * @param int $sent If the list must to show the sent messages (optional) 7 * 7 * 8 8 * @uses $profile_id 9 9 * @uses $CFG 10 10 * @uses $db 11 * 11 * 12 12 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 13 13 * @copyright Corporación Somos Más - 2007 … … 47 47 48 48 $msgs = ""; 49 $pagging = " ";49 $pagging = " "; 50 50 if (!empty ($posts)) { 51 51 foreach ($posts as $post) { 52 $msgs .= run("messages:message:view", $post);52 $msgs .= run("messages:message:view", array($post,$sent)); 53 53 } 54 54 … … 59 59 $back = __gettext("Back"); 60 60 $pagging .=<<< END 61 61 62 62 <a href="{$CFG->wwwroot}{$msg_name}/messages/{$filterlink}msg_offset/{$display_msg_offset}"><< $back</a> 63 63 64 64 END; 65 65 } … … 71 71 $next = __gettext("Next"); 72 72 $pagging .=<<< END 73 73 74 74 <a href="{$CFG->wwwroot}{$msg_name}/messages/{$filterlink}msg_offset/{$display_msg_offset}">$next >></a> 75 75 76 76 END; 77 77 } … … 85 85 'from_to' => $from, 86 86 '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", 88 88 'action_options' => $action_options, 89 89 'sent' => $sent messages/strings.txt
r80 r93 1 #: lib.php:15: 1 #: lib.php:15: 2 2 msgid "Your Messages" 3 3 msgstr "" 4 4 5 #: lib.php:20: 5 #: lib.php:20: 6 6 msgid "Your Messages" 7 7 msgstr "" 8 8 9 #: lib.php:29: 9 #: lib.php:29: 10 10 msgid "View Messages" 11 11 msgstr "" 12 12 13 #: lib.php:34: 13 #: lib.php:34: 14 14 msgid "Compose" 15 15 msgstr "" 16 16 17 #: lib.php:39: 17 #: lib.php:39: 18 18 msgid "Sent Messages" 19 19 msgstr "" … … 31 31 msgstr "" 32 32 33 #: messages_actions.php:65: 33 #: messages_actions.php:65: 34 34 msgid "The selected message was deleted." 35 35 msgstr "" 36 36 37 #: messages_actions.php:67: 37 #: messages_actions.php:67: 38 38 msgid "The message ID its not valid!." 39 39 msgstr "" 40 40 41 #: messages_actions.php:148: 41 #: messages_actions.php:148: 42 42 msgid "You have received a message from %s." 43 43 msgstr "" 44 44 45 #: messages_actions.php:150: 45 #: messages_actions.php:150: 46 46 msgid "To reply, click here: %s" 47 47 msgstr "" 48 48 49 #: messages_actions.php:155: 49 #: messages_actions.php:155: 50 50 msgid "You cannot reply to this message by email." 51 51 msgstr "" 52 52 53 #: messages_actions.php:156: 53 #: messages_actions.php:156: 54 54 msgid "Failed to send email. An unknown error occurred." 55 55 msgstr "" 56 56 57 #: messages_actions.php:163: 57 #: messages_actions.php:163: 58 58 msgid "Your message was sent" 59 59 msgstr "" 60 60 61 #: messages_actions.php:168: 61 #: messages_actions.php:168: 62 62 msgid "You can't send an empty message!" 63 63 msgstr "" 64 64 65 #: messages_actions.php:171: 65 #: messages_actions.php:171: 66 66 msgid "You must specify the sender a recipient!" 67 67 msgstr "" … … 91 91 msgstr "" 92 92 93 #: default_template.php:24: 93 #: default_template.php:24: 94 94 msgid "Message List" 95 95 msgstr "" … … 115 115 msgstr "" 116 116 117 #: messages_view.php:38: 117 #: messages_view.php:38: 118 118 msgid "Sent to" 119 119 msgstr "" 120 120 121 #: messages_view.php:39: 121 #: messages_view.php:39: 122 122 msgid "Sent messages" 123 123 msgstr "" 124 124 125 #: messages_view.php:59: 125 #: messages_view.php:59: 126 126 msgid "Back" 127 127 msgstr "" 128 128 129 #: messages_view.php:71: 129 #: messages_view.php:71: 130 130 msgid "Next" 131 131 msgstr "" 132 132 133 #: messages_new.php:32: 133 #: messages_new.php:32: 134 134 msgid "(Community)" 135 135 msgstr "" 136 136 137 #: messages_new.php:38: 137 #: messages_new.php:38: 138 138 msgid "No friends on your friends list to send to!" 139 139 msgstr "" … … 159 159 msgstr "" 160 160 161 #: messages_message_detailedview.php:40: 161 #: messages_message_detailedview.php:40: 162 162 msgid "Reply" 163 163 msgstr "" 164 164 165 #: messages_message_detailedview.php:41: 165 #: messages_message_detailedview.php:41: 166 166 msgid "Are you sure you want to permanently delete this message?" 167 167 msgstr "" 168 168 169 #: messages_message_detailedview.php:42: 169 #: messages_message_detailedview.php:42: 170 170 msgid "Delete" 171 171 msgstr "" 172 172 173 #: messages_init.php:26: 173 #: messages_init.php:26: 174 174 msgid "You may view only your own messages" 175 175 msgstr ""
