Changeset 113

Show
Ignore:
Timestamp:
06/11/07 05:08:57 (1 year ago)
Author:
diego
Message:

Updates for: messages and template_wrapper

Files:

Legend:

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

    r103 r113  
     1Version 0.2.1 
     2  Translations to pt_BR (Thanks to Renato) 
     3  Sidebar links display improvements 
     4  Fixed but with the delete of system messages that didn't be read 
     5  Added the CONTRIBUTORS.txt file 
     6  Added the lib/messages_config.php for configuration options 
    17Version 0.2 
    28  Bug fixes 
  • messages/README.txt

    r93 r113  
    99RewriteRule ^([A-Za-z0-9]+)\/messages\/compose$ mod/messages/compose.php?profile_name=$1 
    1010RewriteRule ^([A-Za-z0-9]+)\/messages\/view\/([0-9]+)\/([0-1])$ mod/messages/view.php?profile_name=$1&message=$2&sent=$3 
     11 
     12Configuration Options 
     13===================== 
     14 
     15By default the plugin disables the 'Send Message' sidebar link for communities where 
     16you are not member.  
     17 
     18If you want to change this behavior you must change the value of MESSAGES_SIDEBAR_NO_MEMBER_LINK 
     19in the 'messages/lib/messages_config.php' file. 
  • messages/compose.php

    r102 r113  
    22/* 
    33 * This script initialize the enviroment for create a new message 
    4  * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
    5  * @copyright Corporación Somos Más - 2007 
     4 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
     5 * @copyright Corporación Somos Más - 2007 
    66 */ 
    77require_once (dirname(dirname(__FILE__)) . "/../includes.php"); 
  • messages/default_template.php

    r102 r113  
    33 * This script configure the templates used for the private messages plug-in 
    44 * 
    5  * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
    6  * @copyright Corporación Somos Más - 2007 
     5 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
     6 * @copyright Corporación Somos Más - 2007 
    77*/ 
    88global $template; 
  • messages/index.php

    r102 r113  
    22/* 
    33 * This script initialize the enviroment for show the message list 
    4  * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
    5  * @copyright Corporación Somos Más - 2007 
     4 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
     5 * @copyright Corporación Somos Más - 2007 
    66 */ 
    77require_once (dirname(dirname(__FILE__)) . "/../includes.php"); 
  • messages/lib.php

    r103 r113  
    66  $pgowner= $profile_id; 
    77 
     8  require_once $CFG->dirroot . "mod/messages/lib/messages_config.php"; 
    89  require_once $CFG->dirroot . "mod/messages/default_template.php"; 
    910 
     
    1516    $metatags .= "<link rel=\"stylesheet\" href=\"" . $CFG->wwwroot . "mod/messages/css.css\" type=\"text/css\" media=\"screen\" />"; 
    1617 
    17     //$messages = count_records_select('messages','to_id='.$USER->ident." AND status='unread' and from_id >= 0"); 
    1818    $messages = count_records_select('messages','to_id='.$USER->ident." AND status='unread'"); 
    1919    if (defined("context") && context == "messages" && $pgowner == $_SESSION['userid']) { 
     
    8888    $CFG->display_field_module["as_select"]= "messages"; 
    8989  } 
    90  
    91   $CFG->templates->variables_substitute['contact'] = 'messages_contact_user'; 
    92  
    9390} 
    9491 
  • messages/lib/messages_init.php

    r102 r113  
    33 * This script initialize the enviroment for the private messages plug-in. 
    44 * It checks if the user is logged and if he is trying to access another Inbox 
    5  *  
    6  * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
    7  * @copyright Corporación Somos Más - 2007 
     5 * 
     6 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
     7 * @copyright Corporación Somos Más - 2007 
    88*/ 
    99 
  • messages/lib/messages_message_detailedview.php

    r103 r113  
    1010 * @uses $CFG 
    1111 * 
    12  * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
    13  * @copyright Corporación Somos Más - 2007 
     12 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
     13 * @copyright Corporación Somos Más - 2007 
    1414*/ 
    1515if (isset ($parameter)) { 
  • messages/lib/messages_message_view.php

    r103 r113  
    1010 * @uses $CFG 
    1111 * 
    12  * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
    13  * @copyright Corporación Somos Más - 2007 
     12 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
     13 * @copyright Corporación Somos Más - 2007 
    1414*/ 
    1515 
  • messages/lib/messages_new.php

    r103 r113  
    1111 * @uses $CFG 
    1212 * 
    13  * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
    14  * @copyright Corporación Somos Más - 2007 
     13 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
     14 * @copyright Corporación Somos Más - 2007 
    1515*/ 
    1616 
  • messages/lib/messages_sidebar_link.php

    r103 r113  
    11<?php 
    2     global $CFG; 
    3     $page_owner = page_owner(); 
    4     if(isloggedin() && $page_owner != $_SESSION['userid']) { 
    5         $run_result.= '<a href="'.$CFG->wwwroot."mod/messages/compose.php?action=compose&to=$page_owner".'">'.__gettext("Send Message").'</a>'; 
    6     } else { 
    7         $run_result.= ''; 
    8     } 
     2 
     3 
     4/* 
     5 * This script shows the 'Send Message' link in the sidebar 
     6 * 
     7 * @uses $CFG 
     8 * 
     9 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
     10 * @copyright Corporación Somos Más - 2007 
     11*/ 
     12 
     13global $CFG, $USER; 
     14$page_owner = page_owner(); 
     15 
     16$community_membership_query = 'SELECT COUNT(u.ident) FROM ' . $CFG->prefix . 'friends f'; 
     17$community_membership_query .= ' LEFT JOIN ' . $CFG->prefix . 'users u ON u.ident = f.friend'; 
     18$community_membership_query .= ' WHERE f.owner = ? AND f.friend = ?'; 
     19 
     20if (isloggedin() && $page_owner != $_SESSION['userid'] && $page_owner != -1) { 
     21  $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  
     23       && user_type($page_owner) == "community"  
     24       && count_records_sql($community_membership_query, array ($USER->ident,$page_owner)) == 0) { 
     25    $messages_link = ''; 
     26  } 
     27  $run_result .= $messages_link; 
     28} else { 
     29  $run_result .= ''; 
     30
    931?> 
  • messages/lib/messages_view.php

    r103 r113  
    1010 * @uses $db 
    1111 * 
    12  * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
    13  * @copyright Corporación Somos Más - 2007 
     12 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
     13 * @copyright Corporación Somos Más - 2007 
    1414*/ 
    1515 
  • messages/messages_actions.php

    r103 r113  
    3232 * @uses $messages 
    3333 * 
    34  * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
    35  * @copyright Corporación Somos Más - 2007 
     34 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
     35 * @copyright Corporación Somos Más - 2007 
    3636*/ 
    3737 
     
    4747  global $messages; 
    4848  if ($msg_info = get_record('messages', 'ident', $msg)) { 
    49 error_log("borrando $msg, $user, $sent"); 
    5049    if($sent){ 
    5150      $msg_info->hidden_from = '1'; 
     
    5453      $msg_info->hidden_to = '1'; 
    5554    } 
     55    $msg_info->status = "read"; 
    5656    update_record('messages', $msg_info); 
    5757    if ($msg_info->hidden_from && $msg_info->hidden_to) { 
  • messages/view.php

    r102 r113  
    33 * This script initialize the enviroment for view a message 
    44 * @param int $message The msg Id 
    5  * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
    6  * @copyright Corporación Somos Más - 2007 
     5 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
     6 * @copyright Corporación Somos Más - 2007 
    77 */ 
    88require_once (dirname(dirname(__FILE__)) ."/../includes.php"); 
  • template_wrapper/README.txt

    r99 r113  
    1515============== 
    1616 
    17 The use of the 'template_wrapper' its straightforward. 
     17To use the 'template_wrapper' you must to follow the following steps: 
    1818 
    19 - First at all you need to specify the default_template_wrapper for your wrapped 
    20   pages. That its doing by the 'set_default_wrapper' function. 
     19- If you will be 'wrap' many pages you should configure an template wrapper for it. 
     20  To do that you must to specify the default template wrapper through 
     21  the 'set_default_wrapper' function in the 'template_wrapper_init' at 'template_wrapper/lib.php'. 
    2122  For example: 
    2223    set_default_wrapper($CFG->dirroot."mod/template/templates/Default_Template/searchtemplate"); 
    2324 
    24 - Then you can add a template_wrapper for each page that you want to have an special 
    25   layout. 
     25- Add a template_wrapper for each page that you want to have an special layout. 
     26  Add it in the 'template_wrapper_init' at 'template_wrapper/lib.php'  
     27  If you configure a default template wrapper an you want to use it you could ommit the third argument. 
    2628  For example: 
    27     add_template_wrapper("register",$CFG->dirroot."mod/invite/register.php",$CFG->dirroot."mod/template/templates/Default_Template/logintemplate"); 
     29    add_template_wrapper("register",$CFG->dirroot."mod/invite/register.php"); 
    2830    add_template_wrapper("join",$CFG->dirroot."mod/invite/join.php",$CFG->dirroot."mod/template/templates/Default_Template/logintemplate"); 
    29     add_template_wrapper("forgottenpassword",$CFG->dirroot."mod/invite/forgotten_password.php",$CFG->dirroot."mod/template/templates/Default_Template/logintemplate"); 
    30     add_template_wrapper("newpassword",$CFG->dirroot."mod/invite/new_password.php",$CFG->dirroot."mod/template/templates/Default_Template/logintemplate"); 
    3131 
    32 - Finally you must to configure in your .htaccess file the redirection 
     32- Finally you must to configure in your .htaccess file the redirection. 
     33  Note: the 'page' parameter ist the SAME name that you configure through  
     34        the 'add_template_wrapper' function. 
    3335  For example: 
    3436    ReWriteRule ^register$ mod/template_wrapper/globalwrapper.php?page=register 
    35   ReWriteRule ^invite\/join\/([A-Za-z0-9]+)$ mod/template_wrapper/globalwrapper.php?page=join&invitecode=$1 
    36   RewriteRule ^forgottenpassword$ mod/template_wrapper/globalwrapper.php?page=forgottenpassword 
    37   RewriteRule ^newpassword\/([A-Za-z0-9]+)$ mod/template_wrapper/globalwrapper.php?page=newpassword&passwordcode=$1 
     37        ReWriteRule ^invite\/join\/([A-Za-z0-9]+)$ mod/template_wrapper/globalwrapper.php?page=join&invitecode=$1 
    3838 
    39 Note that in some cases to make it work you need to change some elgg code for generate 
    40 the links or form actions in the redirect form that you are configuring. 
    41  
     39Notes:  
     40  - Personaly, I suggest to add your wrapper templates with your Elgg theme. 
     41  - Note that in some cases to make it work you need to change some elgg code for generate 
     42    the links or form actions in the redirect form that you are configuring. 
  • template_wrapper/globalwrapper.php

    r99 r113  
    55 * Created on Apr 19, 2007 
    66 * 
    7  * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
    8  * @copyright Corporación Somos más - 2007 
     7 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
     8 * @copyright Corporación Somos más - 2007 
    99 */ 
    1010require_once(dirname(dirname(__FILE__))."/../includes.php"); 
    1111global $default_template_wrapper; 
    1212global $template_wrapper; 
     13global $template; 
    1314 
    1415$page = optional_param("page"); 
  • template_wrapper/lib.php

    r99 r113  
    55 * Created on Apr 23, 2007 
    66 * 
    7  * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
    8  * @copyright Corporación Somos más - 2007 
     7 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org> 
     8 * @copyright Corporación Somos más - 2007 
    99 */ 
    1010 global $template_wrapper; 
     
    1515 
    1616 function template_wrapper_pagesetup(){ 
     17 } 
     18  
     19 function template_wrapper_init(){ 
     20  // Setup the default template_wrapper. It is usefull if you will share a wrapped template 
     21  // for many pages 
     22    //set_default_wrapper($CFG->dirroot."mod/template/templates/Default_Template/searchtemplate"); 
     23  // Add a template wrapper using the default wrapper   
     24    //add_template_wrapper("register",$CFG->dirroot."mod/invite/register.php"); 
     25  // Add a template wrapper using a specific template for it 
     26    //add_template_wrapper("join",$CFG->dirroot."mod/invite/join.php",$CFG->dirroot."mod/template/templates/Default_Template/logintemplate"); 
    1727 } 
    1828