Changeset 102

Show
Ignore:
Timestamp:
05/03/07 13:28:27 (2 years ago)
Author:
diego
Message:

messages plugin update to the 0.1.4 version

Files:

Legend:

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

    r93 r102  
     1Version 0.1.4 
     2  Added the messages counter in the toolbar string 
     3  Code refactor 
     4  Spanish translation 
    15Version 0.1.3 
    26  Fix a problem with the css 
  • messages/compose.php

    r80 r102  
    66 */ 
    77require_once (dirname(dirname(__FILE__)) . "/../includes.php"); 
    8 require_once (dirname(__FILE__) . "/main.php"); 
    98 
    109run("profile:init"); 
  • messages/css.css

    r93 r102  
    33 
    44#messages_table th{ 
    5        color: #6D929B; 
    6        border-right: 1px solid #CCCCCC; 
    7        border-left: 1px solid #CCCCCC; 
    8        text-align: center; 
    9        padding: 6px 6px 6px 12px; 
    10        background: #EFEFEF; 
     5  color: #6D929B; 
     6  border-right: 1px solid #CCCCCC; 
     7  border-left: 1px solid #CCCCCC; 
     8  text-align: center; 
     9  padding: 6px 6px 6px 12px; 
     10  background: #EFEFEF; 
    1111} 
    1212#messages_table td{ 
    13        background: #fff; 
    14        padding: 2px 2px 2px 10px; 
    15        font-weight: bold; 
    16        border-right: 1px solid #CCCCCC; 
    17        border-left: 1px solid #CCCCCC; 
     13  background: #fff; 
     14  padding: 2px 2px 2px 10px; 
     15  font-weight: bold; 
     16  border-bottom: 1px solid #CCCCCC; 
     17  border-left: 1px solid #CCCCCC; 
    1818} 
    1919#messages_table td.message_read{ 
    20        background: #F5FAFA; 
    21        padding: 2px 2px 2px 10px; 
    22        font-weight: normal; 
     20  background: #F5FAFA; 
     21  padding: 2px 2px 2px 10px; 
     22  font-weight: normal; 
    2323} 
    2424#detailed_message h3{ 
    25        color: #000; 
     25  color: #000; 
    2626} 
  • messages/default_template.php

    r93 r102  
    99global $template_definition; 
    1010 
    11 $postedby = __gettext("Sent by"); 
    12 $date = __gettext("Date"); 
    13 $subject = __gettext("Subject"); 
    14  
    15 $action = __gettext("Action:"); 
    16 $actionMsg = __gettext("Select an action"); 
    17 $returnConfirm = __gettext("Are you sure you want to permanently delete this message(s)?"); 
    18  
    1911$template['css'] .= file_get_contents($CFG->dirroot . "mod/messages/css.css"); 
    2012 
    2113// Registering template definitions 
    22 $template_definition[] = array ( 
    23   'id' => 'plug_messages', 
    24   'name' => __gettext("Message List" 
    25 ), 'description' => __gettext("A template for the message list"), 'glossary' => array ( 
    26   '{{messages}}' => __gettext("The list of messages themselves" 
    27 ), '{{paging}}' => __gettext("The list of page links when there are lots of messages"), '{{from_to}}' => __gettext("From | To Label for the message list"))); 
     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                              ); 
    2827 
    29 $template_definition[] = array ( 
    30   'id' => 'plug_message', 
    31   'name' => __gettext("Message" 
    32 ), 'description' => __gettext("A template for each message"), 'glossary' => array ( 
    33   '{{date}}' => __gettext("The time and date of the message" 
    34 ), '{{title}}' => __gettext("Message title"), '{{from_username}}' => __gettext("The username from the sender"), '{{from_name}}' => __gettext("The full name from the sender"), '{{from_icon}}' => __gettext("The icon from the sender"), '{{msg_style}}' => __gettext("The message status style (read|unread)"))); 
    3528 
    36 $template_definition[] = array ( 
    37   'id' => 'plug_detailedmessage', 
    38   'name' => __gettext("Message" 
    39 ), 'description' => __gettext("A template for each message"), 'glossary' => array ( 
    40   '{{date}}' => __gettext("The time and date of the message" 
    41 ), '{{title}}' => __gettext("Message title"), '{{from_username}}' => __gettext("The username from the sender"), '{{from_name}}' => __gettext("The full name from the sender"), '{{from_icon}}' => __gettext("The icon from the sender"), '{{body}}' => __gettext("The message body text"), '{{links}}' => __gettext("Links related with the message (delete|reply)"))); 
     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                                ); 
    4240 
    43 $template['plug_messages'] =<<< END 
    44 <div id="messages"><!-- start comments div --> 
    45 <form method="post" name="message_form" action="{{action_form}}" onsubmit="return submitForm();"> 
    46    <input type="hidden" name="sent" value="{{sent}}"> 
    47    <h2>{{title}}</h2> 
    48     <table id="messages_table" cellspacing="0" width="100%"> 
    49      <tr> 
    50       <th colspan="3" style="text-align:left"> 
    51         $action&nbsp; 
    52         <select name="message_action_type" id="message_action_type" onchange="submitMessagesAction(this,message_form,'$returnConfirm')"> 
    53           <option value="-1">$actionMsg</option> 
    54           {{action_options}} 
    55         </select> 
    56       </th> 
    57       <th>{{paging}}</th> 
    58      </tr> 
    59      <tr> 
    60       <th width="2%">&nbsp;</th> 
    61       <th width="23%">{{from_to}}</th> 
    62       <th width="50%">$subject</th> 
    63       <th width="35%">$date</th> 
    64      </tr> 
    65         {{messages}} 
    66      <tr> 
    67       <th colspan="3">&nbsp;</th> 
    68       <th>{{paging}}</th> 
    69      </tr> 
    70     </table> 
    71 </form> 
    72 </div><!-- end comments div --> 
    73 END; 
     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                                ); 
    7453 
    75 $template['plug_message'] =<<< END 
    76      <tr> 
    77       <td {{msg_style}} >{{mark}}</td> 
    78       <td {{msg_style}} valign="middle">{{from_icon}}&nbsp;{{from_name}}</td> 
    79       <td {{msg_style}}>{{title}}</td> 
    80       <td {{msg_style}}>{{date}}</td> 
    81      </tr> 
    82 END; 
    8354 
    84 $template['plug_detailedmessage'] =<<< END 
    85 <div id="detailed_message"><!-- Holds all aspects of a blog post --> 
    86    <h2>{{title}}</h2> 
    87         <div class="user"><!-- Open class user --> 
    88         {{from_icon}}&nbsp;<small>{{from_name}}</small> 
    89         </div><!-- Close class user --> 
    90         <div class="post"><!-- Open class post --> 
    91             {{body}} 
    92         </div><!-- Close class post --> 
    93     <div class="info"><!-- Open class info --> 
    94             <p> 
    95                  {{links}} 
    96             </p> 
    97         </div><!-- Close class info --> 
    98 </div><!-- Close weblog_post --> 
    99 <div class="clearing"></div> 
     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"); 
    10058 
    101 END; 
    10259?> 
  • messages/index.php

    r80 r102  
    66 */ 
    77require_once (dirname(dirname(__FILE__)) . "/../includes.php"); 
    8 require_once (dirname(__FILE__) . "/main.php"); 
    98 
    109run("profile:init"); 
  • messages/lib.php

    r93 r102  
    22function messages_pagesetup() { 
    33  // register links -- 
    4   global $profile_id,$PAGE,$CFG,$metatags,$function
     4  global $profile_id,$PAGE,$CFG,$metatags,$function,$USER
    55 
    66  $pgowner= $profile_id; 
    77 
    8 /* 
    9     foreach($function['display:sidebar'] as $key => $file) 
    10     { 
    11 echo "$key => $file<br>"; 
    12     } 
    13  
    14 */ 
     8  require_once $CFG->dirroot . "mod/messages/default_template.php"; 
    159 
    1610  if (isloggedin() && user_info("user_type", $_SESSION['userid']) != "external") { 
     
    2115    $metatags .= "<link rel=\"stylesheet\" href=\"" . $CFG->wwwroot . "mod/messages/css.css\" type=\"text/css\" media=\"screen\" />"; 
    2216 
     17    //$messages = count_records_select('messages','to_id='.$USER->ident." AND status='unread' and from_id >= 0"); 
     18    $messages = count_records_select('messages','to_id='.$USER->ident." AND status='unread'"); 
    2319    if (defined("context") && context == "messages" && $pgowner == $_SESSION['userid']) { 
    2420      $PAGE->menu[]= array ( 
    2521        'name' => 'messages', 
    26         'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/" class="selected">' . __gettext("Your Messages" 
    27       ) . '</a></li>'); 
     22        'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/" class="selected">' . 
     23                  __gettext("Your Messages") . " ($messages)".'</a></li>'); 
    2824    } else { 
    2925      $PAGE->menu[]= array ( 
    3026        'name' => 'messages', 
    31         'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/">' . __gettext("Your Messages" 
    32       ) . '</a></li>'); 
     27        'html' => '<li><a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/">' . __gettext("Your Messages") . 
     28                  " ($messages)". '</a></li>'); 
    3329    } 
    3430 
     
    3834        $PAGE->menu_sub[]= array ( 
    3935          'name' => 'messages:list', 
    40           'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/">' . __gettext("View Messages" 
    41         ) . '</a>'); 
     36          'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/">' . __gettext("View Messages") . '</a>'); 
    4237 
    4338        $PAGE->menu_sub[]= array ( 
    4439          'name' => 'messages:compose', 
    45           'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/compose">' . __gettext("Compose" 
    46         ) . '</a>'); 
     40          'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/compose">' . __gettext("Compose") . '</a>'); 
    4741 
    4842        $PAGE->menu_sub[]= array ( 
    4943          'name' => 'messages:sent', 
    50           'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/sent">' . __gettext("Sent Messages" 
    51         ) . '</a>'); 
     44          'html' => '<a href="' . $CFG->wwwroot . $_SESSION['username'] . '/messages/sent">' . __gettext("Sent Messages") . '</a>'); 
    5245      } 
    5346    } 
     
    6861    } 
    6962  } 
     63 
     64  // Functions to perform initializacion 
     65 
     66  $function['messages:init'][] = $CFG->dirroot . "mod/messages/lib/messages_init.php"; 
     67 
     68  // Compose / Delete messages 
     69  $function['messages:new'][] = $CFG->dirroot . "mod/messages/lib/messages_new.php"; 
     70  $function['messages:new:body'][] = $CFG->dirroot . "units/tinymce/tinymce_js.php"; 
     71 
     72  // View a message 
     73  $function['messages:view'][] = $CFG->dirroot . "mod/messages/lib/messages_view.php"; 
     74  $function['messages:message:view'][] = $CFG->dirroot . "mod/messages/lib/messages_message_view.php"; 
     75  $function['messages:detailedview'][] = $CFG->dirroot . "mod/messages/lib/messages_message_detailedview.php"; 
     76 
    7077  // Inits the display field module param for the 'select' input field 
    7178  // I know, I know this is a big cannon to kill a fly, but I want to use the display_input_field function :P 
  • messages/messages_actions.php

    r93 r102  
    3737 
    3838require_once (dirname(dirname(__FILE__)) . "/../includes.php"); 
    39 require_once (dirname(__FILE__) . "/main.php"); 
    4039 
    4140/** 
  • messages/view.php

    r80 r102  
    77 */ 
    88require_once (dirname(dirname(__FILE__)) ."/../includes.php"); 
    9 require_once (dirname(__FILE__) . "/main.php"); 
    109 
    1110run("profile:init");