[svn r10674] Fixing the messages plugin

http://www.dokeos.com/forum/viewtopic.php?p=32871
skala
Bart Mollet 18 years ago
parent 052c2d9c2b
commit d13ad542a4
  1. 11
      plugin/messages/functions.inc.php
  2. 53
      plugin/messages/index.php

@ -20,7 +20,7 @@
/**
* @package dokeos.survey
* @author
* @version $Id: functions.inc.php 10244 2006-11-29 09:40:41Z bmol $
* @version $Id: functions.inc.php 10674 2007-01-11 12:37:20Z bmol $
* @todo use database library
*/
@ -129,11 +129,14 @@ function display_html_editor_area($name,$resp)
*/
function get_new_messages()
{
if (! isset($_SESSION['_uid'])) return false;
if (!api_get_user_id())
{
return false;
}
$i=0;
$query = "SELECT * FROM `".MESSAGES_DATABASE."` WHERE id_receiver=".$_SESSION['_uid']." AND status=1;";
$query = "SELECT * FROM `".MESSAGES_DATABASE."` WHERE id_receiver=".api_get_user_id()." AND status=1;";
$result = api_sql_query($query,__FILE__,__LINE__);
while ($result_row = mysql_fetch_array($result)) $i++;
$i = mysql_num_rows($result);
return $i;
}

@ -1,27 +1,27 @@
<?php // $Id: index.php 10419 2006-12-07 15:55:34Z pcool $
<?php // $Id: index.php 10674 2007-01-11 12:37:20Z bmol $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) Facultad de Matematicas, UADY (México)
Copyright (c) Evie, Free University of Brussels (Belgium)
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
include_once('functions.inc.php');
$e= api_get_path(WEB_PLUGIN_PATH).'messages/inbox.php';
$e= api_get_path(WEB_PLUGIN_PATH).'messages/inbox.php';
$e2= api_get_path(WEB_PLUGIN_PATH).'messages/new_message.php';
$inb = get_lang("Inbox");
$newm = get_lang("ComposeMessage");
@ -35,33 +35,40 @@ if(api_get_user_id())
"`date` DATETIME NOT NULL ,".
"`title` VARCHAR(255) NOT NULL,".
"`content` TEXT NOT NULL,".
"INDEX ( `id`,`id_receiver` )".
"INDEX ( `id`,`id_receiver` )".
") TYPE = MYISAM ;";
@api_sql_query($query,__FILE__,__LINE__);
echo '<script language="javascript" type="text/javascript" src="'.api_get_path(WEB_PLUGIN_PATH).'messages/cookies.js"> </script> ';
echo '<script language="javascript" type="text/javascript">set_url("'.api_get_path(WEB_PLUGIN_PATH).'messages/notify.php") ; notificar()</script> ';
echo "<a href=$e>".$inb."(<span id=\"nuevos\" style=\"none\">".get_new_messages()."</span>)</a>";
$number_of_new_messages = get_new_messages();
if(is_null($number_of_new_messages))
{
$number_of_new_messages = 0;
}
echo "<a href=$e>".$inb."(<span id=\"nuevos\" style=\"none\">".$number_of_new_messages."</span>)</a>";
echo " - ";
echo "<a href=$e2>".$newm."</a>";
if($number_of_new_messages > 0)
{
?>
<div class="aviso" id="box">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="2" id="table" class="content">
<tr>
<td width="28%" height="16" class="content" id="ref"><a style="color:red;font-size:10px" href="javascript:;" onclick="ocultar_aviso()">Close</a></td>
<td width="72%" rowspan="2" class="content" id="ref"><?php echo '<a href="'.$e.'" style="color:#000000" onclick="ocultar_aviso()">'.get_lang('YouHaveNewMessage').'</a>'; ?></td>
</tr>
<tr>
<td class="content" id="ref"><?php echo'<img src="'.api_get_path(WEB_PLUGIN_PATH).'messages/images/newmsg.gif" alt="new message" align="middle" class="images"></p>';?> </td>
</tr>
</table>
</div>
<div class="aviso" id="box">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="2" id="table" class="content">
<tr>
<td width="28%" height="16" class="content" id="ref"><a style="color:red;font-size:10px" href="javascript:;" onclick="ocultar_aviso()">Close</a></td>
<td width="72%" rowspan="2" class="content" id="ref"><?php echo '<a href="'.$e.'" style="color:#000000" onclick="ocultar_aviso()">'.get_lang('YouHaveNewMessage').'</a>'; ?></td>
</tr>
<tr>
<td class="content" id="ref"><?php echo'<img src="'.api_get_path(WEB_PLUGIN_PATH).'messages/images/newmsg.gif" alt="new message" align="middle" class="images"></p>';?> </td>
</tr>
</table>
</div>
<?php
}
}
else
{
echo '<script language="javascript" type="text/javascript" src="'.api_get_path(WEB_PLUGIN_PATH).'messages/cookies.js"> </script>';
echo '<script language="javascript" type="text/javascript">Set_Cookie( "nuevos", 0, 0, "/","","")</script> ';
echo '<script language="javascript" type="text/javascript" src="'.api_get_path(WEB_PLUGIN_PATH).'messages/cookies.js"> </script>';
echo '<script language="javascript" type="text/javascript">Set_Cookie( "nuevos", 0, 0, "/","","")</script> ';
}
?>
Loading…
Cancel
Save