2009-02-19 Evi Vanoost <vanooste@rcbi.rochester.edu>
* pandoradb_migrate_20_to_21.sql, pandora_db.sql: Altered tmensajes for unixtime * general/header.php: New messages function added flashing acknowledgment in case of new messages * general/logon_ok.php: Since messages are now in header, they don't need to be there per se * images/close.png, images/transparent.png: Background and close button for overlays. * include/javascript/jquery.pandora.js: Used for loop for flashing thing and added overlay function * include/javascript/jquery.overlay.js: You'll need this for overlay * include/functions_messages.php: Message functions are here. Messages are fully abstracted so they can be drop-in replaced with something else * include/functions_ui.php: Small fixes. Not necessary to load en language files for javascript since they're empty, it only adds to load/interpret * include/functions_db.php: Added get_group_users and get_db_array. Useful * include/functions_html.php: Small doc fixes and fixed table heads * include/styles/pandora.css: Added Overlay classes * ajax.php: We need to call safe_url_extraclean for cross scripting * operation/messages/message.php: Rebuilt to use new functions * operation/menu.php: New message link instead of group link * operation/visual_console/render_view.php: Fixed conflict with timer * index.php: Added div for overlay (not in pure mode) and fixed erroneous div in pure mode. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1469 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
94e68ab74b
commit
fd22412aed
|
@ -1,3 +1,45 @@
|
|||
2009-02-19 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||
|
||||
* pandoradb_migrate_20_to_21.sql, pandora_db.sql: Altered tmensajes for
|
||||
unixtime
|
||||
|
||||
* general/header.php: New messages function added flashing
|
||||
acknowledgment in case of new messages
|
||||
|
||||
* general/logon_ok.php: Since messages are now in header, they don't need
|
||||
to be there per se
|
||||
|
||||
* images/close.png, images/transparent.png: Background and close button
|
||||
for overlays.
|
||||
|
||||
* include/javascript/jquery.pandora.js: Used for loop for flashing thing
|
||||
and added overlay function
|
||||
|
||||
* include/javascript/jquery.overlay.js: You'll need this for overlay
|
||||
|
||||
* include/functions_messages.php: Message functions are here. Messages are
|
||||
fully abstracted so they can be drop-in replaced with something else
|
||||
|
||||
* include/functions_ui.php: Small fixes. Not necessary to load en language
|
||||
files for javascript since they're empty, it only adds to load/interpret
|
||||
|
||||
* include/functions_db.php: Added get_group_users and get_db_array. Useful
|
||||
|
||||
* include/functions_html.php: Small doc fixes and fixed table heads
|
||||
|
||||
* include/styles/pandora.css: Added Overlay classes
|
||||
|
||||
* ajax.php: We need to call safe_url_extraclean for cross scripting
|
||||
|
||||
* operation/messages/message.php: Rebuilt to use new functions
|
||||
|
||||
* operation/menu.php: New message link instead of group link
|
||||
|
||||
* operation/visual_console/render_view.php: Fixed conflict with timer
|
||||
|
||||
* index.php: Added div for overlay (not in pure mode) and fixed erroneous
|
||||
div in pure mode.
|
||||
|
||||
2009-02-19 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* godmode/agentes/manage_delete.php: Fixed an error when no agent is
|
||||
|
|
|
@ -39,12 +39,13 @@ check_login ();
|
|||
define ('AJAX', true);
|
||||
|
||||
$page = (string) get_parameter ('page');
|
||||
$page = safe_url_extraclean ($page);
|
||||
$page .= '.php';
|
||||
$config["id_user"] = $_SESSION["id_usuario"];
|
||||
session_write_close ();
|
||||
if (file_exists ($page)) {
|
||||
require_once ($page);
|
||||
} else {
|
||||
echo "<br><b class='error'>Sorry! I can't find the page $page!</b>";
|
||||
echo '<br /><b class="error">Sorry! I can\'t find the page $page!</b>';
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - the Flexible Monitoring System
|
||||
// ============================================
|
||||
// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||
|
@ -16,6 +15,8 @@
|
|||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require_once ("include/functions_messages.php");
|
||||
|
||||
//First column (logo)
|
||||
echo '<table width="100%" cellpadding="0" cellspacing="0" style="margin:0px; padding:0px;" border="0"><tr><td>';
|
||||
|
||||
|
@ -33,7 +34,13 @@ echo '<a href="index.php"><img src="images/pandora_logo_head.png" alt="logo" sty
|
|||
echo '</td><td width="20"> </td>';
|
||||
|
||||
// First column (identifier)
|
||||
echo '<td width="20%"><img src="images/user_'.((is_user_admin ($config["id_user"]) == 1) ? 'suit' : 'green' ).'.png" class="bot" alt="user" /> '.'<a class="white">'.__('You are').' [<b>'.$config["id_user"].'</b>]</a>';
|
||||
echo '<td width="20%"><img src="images/user_'.((is_user_admin ($config["id_user"]) == 1) ? 'suit' : 'green' ).'.png" class="bot" alt="user" /> '.'<a href="index.php?sec=usuarios&sec2=operation/users/user_edit" class="white">'.__('You are').' [<b>'.$config["id_user"].'</b>]</a> ';
|
||||
$msg_cnt = get_message_count ($config["id_user"]);
|
||||
if ($msg_cnt > 0) {
|
||||
echo '<a href="ajax.php?page=operation/messages/message&refr=60" rel="#overlay">';
|
||||
print_image ("images/email.png", false, array ("title" => __('You have').' '.$msg_cnt.' '.__('unread message(s)'), "id" => "yougotmail", "class" => "bot"));
|
||||
echo '</a>';
|
||||
}
|
||||
|
||||
//First column, second row (logout button)
|
||||
echo '<br /><br />';
|
||||
|
@ -66,10 +73,9 @@ echo "</a>";
|
|||
// Third column
|
||||
// Autorefresh
|
||||
echo '</td><td width="20%">';
|
||||
$refr = (int) get_parameter ("refr");
|
||||
if ($refr) {
|
||||
if ($config["refr"]) {
|
||||
echo '<a id="autorefresh" class="white_grey_bold" href="'.((substr ($_SERVER['REQUEST_URI'],-1) != "/") ? safe_input ($_SERVER['REQUEST_URI']) : 'index.php?' ).'&refr=0"><img src="images/page_lightning.png" class="bot" alt="lightning" /> '. __('Autorefresh');
|
||||
echo ' (<span id="refr">'.date ("i:s", $refr).'</span>)';
|
||||
echo ' (<span id="refrcounter">'.date ("i:s", $config["refr"]).'</span>)';
|
||||
echo '</a>';
|
||||
} else {
|
||||
echo '<a id="autorefresh" class="white_bold" href="'.((substr ($_SERVER['REQUEST_URI'],-1) != "/") ? safe_input ($_SERVER['REQUEST_URI']) : "index.php?" ).(count($_GET) ? "&" : "?").'refr="><img src="images/page_lightning.png" class="bot" alt="lightning" /> '.__('Autorefresh').'</a>';
|
||||
|
@ -101,10 +107,11 @@ require_jquery_file ('countdown');
|
|||
<script language="javascript" type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
$(document).ready (function () {
|
||||
<?php if ($refr): ?>
|
||||
$("#yougotmail").pulsate ();
|
||||
<?php if ($config["refr"]): ?>
|
||||
t = new Date();
|
||||
t.setTime (t.getTime () + <?php echo $refr * 1000; ?>);
|
||||
$("#refr").countdown ({until: t,
|
||||
t.setTime (t.getTime () + <?php echo $config["refr"] * 1000; ?>);
|
||||
$("#refrcounter").countdown ({until: t,
|
||||
layout: '%M%nn%M:%S%nn%S',
|
||||
labels: ['', '', '', '', '', '', ''],
|
||||
onExpiry: function () {
|
||||
|
|
|
@ -36,14 +36,6 @@ echo __('This is the Web Management System for Pandora FMS. From here you can ma
|
|||
echo "</p>";
|
||||
echo '</div>';
|
||||
|
||||
// Private messages pending to read !
|
||||
$sql = sprintf ("SELECT COUNT(id_mensaje) FROM tmensajes WHERE id_usuario_destino='%s' AND estado='FALSE';", $config["id_user"]);
|
||||
$resultado = get_db_sql ($sql);
|
||||
if ($resultado > 0) {
|
||||
echo '<h2>'.__('You have ').'<a href="index.php?sec=messages&sec2=operation/messages/message">'.$resultado.
|
||||
'<img src="images/email.png" border="0" />'.__(' unread message(s).').'</a></h2>';
|
||||
}
|
||||
|
||||
// Site news !
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo '<div style="width:350px; float:left; padding-right: 30px;" id="leftcolumn">';
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.0 KiB |
|
@ -2765,4 +2765,68 @@ function process_sql_delete ($table, $where, $where_join = 'AND') {
|
|||
|
||||
return process_sql ($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the users belonging to a group.
|
||||
*
|
||||
* @param int $id_group The group id to look for
|
||||
*
|
||||
* @return array An array with all the users or an empty array
|
||||
*/
|
||||
function get_group_users ($id_group) {
|
||||
$result = get_db_array ("id_usuario", "tusuario_perfil", array ("id_grupo" => (int) $id_group), "AND");
|
||||
|
||||
//This removes stale users from the list. This can happen if switched to another auth scheme
|
||||
//(internal users still exist) or external auth has users removed/inactivated from the list (eg. LDAP)
|
||||
foreach ($result as $key => $user) {
|
||||
if (!is_user ($user)) {
|
||||
unset ($result[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty ($result)) {
|
||||
return array ();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the row of a table in the database.
|
||||
*
|
||||
* @param string Field name to get (warning: not cleaned)
|
||||
* @param string Table to retrieve the data (warning: not cleaned)
|
||||
* @param string Filter elements (array ("field" => "value", "field2" => "value2"))
|
||||
* @param string Condition of the filter (AND, OR)
|
||||
*
|
||||
* @return mixed Array of the row or false in case of error.
|
||||
*/
|
||||
function get_db_array ($field, $table, $filter_arr = false, $filter_cond = "AND") {
|
||||
$filter = '';
|
||||
if (!empty ($filter_arr)) {
|
||||
foreach ($filter_arr as $filter_field => $value) {
|
||||
if (!empty ($filter)) {
|
||||
$filter .= 'AND ';
|
||||
}
|
||||
if (is_numeric ($value)) {
|
||||
$filter .= '`'.$filter_field.'` = '.$value.' ';
|
||||
} else {
|
||||
$filter .= '`'.$filter_field.'` = "'.$value.'" ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = sprintf ("SELECT %s FROM %s WHERE %s", $field, $table, trim ($filter));
|
||||
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
|
||||
if ($result === false)
|
||||
return false;
|
||||
|
||||
$return = array ();
|
||||
foreach ($result as $row) {
|
||||
$return[] = $row[$field];
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -221,7 +221,7 @@ function print_input_password ($name, $value, $alt = '', $size = 50, $maxlength
|
|||
*
|
||||
* @param string $name Input name.
|
||||
* @param string $value Input value.
|
||||
* @param string $alt Alternative HTML string (optional).
|
||||
* @param string $alt Alternative HTML string (invalid - not used).
|
||||
* @param int $size Size of the input (optional).
|
||||
* @param int $maxlength Maximum length allowed (optional).
|
||||
* @param bool $return Whether to return an output string or echo now (optional, echo by default).
|
||||
|
@ -229,11 +229,7 @@ function print_input_password ($name, $value, $alt = '', $size = 50, $maxlength
|
|||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
function print_input_text ($name, $value, $alt = '', $size = 50, $maxlength = 0, $return = false) {
|
||||
$output = print_input_text_extended ($name, $value, 'text-'.$name, $alt, $size, $maxlength, false, '', '', true);
|
||||
|
||||
if ($return)
|
||||
return $output;
|
||||
echo $output;
|
||||
return print_input_text_extended ($name, $value, 'text-'.$name, '', $size, $maxlength, false, '', '', $return);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -374,7 +370,7 @@ function print_textarea ($name, $rows, $columns, $value = '', $attributes = '',
|
|||
* $table->data[] - An array of arrays containing the data.
|
||||
* $table->width - A percentage of the page
|
||||
* $table->border - Border of the table.
|
||||
* $table->tablealign - Align the whole table
|
||||
* $table->tablealign - Align the whole table (float left or right)
|
||||
* $table->cellpadding - Padding on each cell
|
||||
* $table->cellspacing - Spacing between cells
|
||||
* $table->class - CSS table class
|
||||
|
@ -456,7 +452,7 @@ function print_table (&$table, $return = false) {
|
|||
if (empty ($table->tablealign) || $table->tablealign != 'left' || $table->tablealign != 'right') {
|
||||
$table->tablealign = '';
|
||||
} else {
|
||||
$table->tablealign = 'float:'.$table->tablealign.';'; //Align is deprecated. Use float instead
|
||||
$table->tablealign = 'style="float:'.$table->tablealign.';"'; //Align is deprecated. Use float instead
|
||||
}
|
||||
|
||||
if (!isset ($table->cellpadding)) {
|
||||
|
@ -471,9 +467,13 @@ function print_table (&$table, $return = false) {
|
|||
$table->class = 'databox';
|
||||
}
|
||||
|
||||
if (empty ($table->titlestyle)) {
|
||||
$table->titlestyle = 'text-align:center;';
|
||||
}
|
||||
|
||||
$tableid = empty ($table->id) ? 'table'.$table_count : $table->id;
|
||||
|
||||
$output .= '<table width="'.$table->width.'" style="'.$table->tablealign.'"';
|
||||
$output .= '<table width="'.$table->width.'"'.$table->tablealign;
|
||||
$output .= ' cellpadding="'.$table->cellpadding.'" cellspacing="'.$table->cellspacing.'"';
|
||||
$output .= ' border="'.$table->border.'" class="'.$table->class.'" id="'.$tableid.'">';
|
||||
$countcols = 0;
|
||||
|
|
|
@ -0,0 +1,220 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - the Flexible Monitoring System
|
||||
// ============================================
|
||||
// Copyright (c) 2009 Evi Vanoost, vanooste@rcbi.rochester.edu
|
||||
// Please see http://pandora.sourceforge.net for full contribution list
|
||||
|
||||
// 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 for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
/**
|
||||
* Creates a private message to be forwarded to other people
|
||||
*
|
||||
* @param string $usuario_origen The sender of the message
|
||||
* @param string $usuario_destino The receiver of the message
|
||||
* @param string $subject Subject of the message (much like E-Mail)
|
||||
* @param string $mensaje The actual message. This message will be cleaned by safe_input
|
||||
* (html is allowed but loose html chars will be translated)
|
||||
*
|
||||
* @return bool true when delivered, false in case of error
|
||||
*/
|
||||
function create_message ($usuario_origen, $usuario_destino, $subject, $mensaje) {
|
||||
$users = get_users_info ();
|
||||
|
||||
if (!array_key_exists ($usuario_origen, $users) || !array_key_exists ($usuario_destino, $users)) {
|
||||
return false; //Users don't exist so don't send to them
|
||||
}
|
||||
|
||||
$values = array ("id_usuario_origen" => $usuario_origen,
|
||||
"id_usuario_destino" => $usuario_destino,
|
||||
"subject" => safe_input ($subject),
|
||||
"mensaje" => safe_input ($mensaje),
|
||||
"timestamp" => get_system_time ()
|
||||
);
|
||||
|
||||
$return = process_sql_insert ("tmensajes", $values);
|
||||
|
||||
if ($return === false) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates private messages to be forwarded to groups
|
||||
*
|
||||
* @param string $usuario_origen The sender of the message
|
||||
* @param string $dest_group The receivers (group) of the message
|
||||
* @param string $subject Subject of the message (much like E-Mail)
|
||||
* @param string $mensaje The actual message. This message will be cleaned by safe_input
|
||||
* (html is allowed but loose html chars will be translated)
|
||||
*
|
||||
* @return bool true when delivered, false in case of error
|
||||
*/
|
||||
function create_message_group ($usuario_origen, $dest_group, $subject, $mensaje) {
|
||||
$users = get_users_info ();
|
||||
$group_users = get_group_users ($dest_group);
|
||||
|
||||
if (!array_key_exists ($usuario_origen, $users)) {
|
||||
return false; //Users don't exist so don't send to them
|
||||
} elseif (empty ($group_users)) {
|
||||
return true; //There are no users in the group, so it hasn't failed although it hasn't done anything.
|
||||
}
|
||||
|
||||
//Start transaction so that if it fails somewhere along the way, we roll back
|
||||
process_sql ("SET AUTOCOMMIT = 0;");
|
||||
process_sql ("START TRANSACTION;");
|
||||
|
||||
foreach ($group_users as $user) {
|
||||
$return = create_message ($usuario_origen, $user, $subject, $mensaje);
|
||||
if ($return === false) {
|
||||
//Error sending message, rollback and return false
|
||||
process_sql ("ROLLBACK;");
|
||||
process_sql ("SET AUTOCOMMIT = 1;");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//We got here, so we can commit - if this function gets extended, make sure to do SQL above these lines
|
||||
process_sql ("COMMIT;");
|
||||
process_sql ("SET AUTOCOMMIT = 1;");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a private message
|
||||
*
|
||||
* @param int $id_message
|
||||
*
|
||||
* @return bool true when deleted, false in case of error
|
||||
*/
|
||||
function delete_message ($id_message) {
|
||||
global $config;
|
||||
|
||||
$sql = sprintf ("DELETE FROM tmensajes WHERE id_usuario_destino='%s' AND id_mensaje=%d", $config["id_user"], $id_message);
|
||||
return (bool) process_sql ($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks a private message as read/unread
|
||||
*
|
||||
* @param int $message_id The message to modify
|
||||
* @param bool $read To set unread pass 0, false or empty value
|
||||
*
|
||||
* @return bool true when marked, false in case of error
|
||||
*/
|
||||
function process_message_read ($message_id, $read = true) {
|
||||
if (empty ($read)) {
|
||||
$read = 0;
|
||||
} else {
|
||||
$read = 1;
|
||||
}
|
||||
|
||||
return (bool) process_sql ("UPDATE tmensajes SET estado = ".$read." WHERE id_mensaje = ".$message_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a private message
|
||||
*
|
||||
* This function abstracts the database backend so it can simply be replaced with another system
|
||||
*
|
||||
* @param int $message_id
|
||||
*
|
||||
* @return mixed False if it doesn't exist or a filled array otherwise
|
||||
*/
|
||||
function get_message ($message_id) {
|
||||
global $config;
|
||||
|
||||
$sql = sprintf("SELECT id_usuario_origen, subject, mensaje, timestamp FROM tmensajes WHERE id_usuario_destino='%s' AND id_mensaje=%d" , $config["id_user"], $message_id);
|
||||
$row = get_db_row_sql ($sql);
|
||||
|
||||
if (empty ($row)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$return["sender"] = $row["id_usuario_origen"];
|
||||
$return["subject"] = safe_input ($row["subject"]); //Although not strictly necessary, we don't know what other systems might dump in this. So we clean up
|
||||
$return["message"] = safe_input ($row["mensaje"]);
|
||||
$return["timestamp"] = $row["timestamp"];
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Counts private messages
|
||||
*
|
||||
* @param string $user
|
||||
* @param bool $incl_read Whether or not to include read messages
|
||||
*
|
||||
* @return int The number of messages this user has
|
||||
*/
|
||||
function get_message_count ($user = false, $incl_read = false) {
|
||||
if (empty ($user)) {
|
||||
global $config;
|
||||
$user = $config["id_user"];
|
||||
}
|
||||
if (empty ($incl_read)) {
|
||||
$filter = "AND estado = 0";
|
||||
} else {
|
||||
$filter = "";
|
||||
}
|
||||
$sql = sprintf("SELECT COUNT(*) FROM tmensajes WHERE id_usuario_destino='%s' %s", $user, $filter);
|
||||
|
||||
return (int) get_db_sql ($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get message overview in array
|
||||
*
|
||||
* @param string $order How to order them valid:
|
||||
* (status (default), subject, timestamp, sender)
|
||||
* @param string $order_dir Direction of order (ASC = Ascending, DESC = Descending)
|
||||
*
|
||||
* @return int The number of messages this user has
|
||||
*/
|
||||
function get_message_overview ($order = "status", $order_dir = "ASC") {
|
||||
global $config;
|
||||
|
||||
switch ($order) {
|
||||
case "timestamp":
|
||||
case "sender":
|
||||
case "subject":
|
||||
break;
|
||||
case "status":
|
||||
default:
|
||||
$order = "estado";
|
||||
}
|
||||
|
||||
if ($order_dir != "ASC") {
|
||||
$order .= " DESC";
|
||||
}
|
||||
|
||||
$result = array ();
|
||||
$return = get_db_all_rows_field_filter ('tmensajes', 'id_usuario_destino', $config["id_user"], $order);
|
||||
|
||||
if ($return === false) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
foreach ($return as $message) {
|
||||
$result[$message["id_mensaje"]]["sender"] = $message["id_usuario_origen"];
|
||||
$result[$message["id_mensaje"]]["subject"] = $message["subject"];
|
||||
$result[$message["id_mensaje"]]["timestamp"] = $message["timestamp"];
|
||||
$result[$message["id_mensaje"]]["status"] = $message["estado"];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
|
@ -131,7 +131,7 @@ function print_timestamp ($unixtime, $return = false, $option = array ()) {
|
|||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
function print_username ($username, $return = false) {
|
||||
$string = '<a href="index.php?sec=usuario&sec2=operation/users/user_edit&id='.$username.'">'.get_user_fullname ($username).'</a>';
|
||||
$string = '<a href="index.php?sec=usuario&sec2=operation/users/user_edit&id='.$username.'">'.get_user_fullname ($username).'</a>';
|
||||
|
||||
if ($return)
|
||||
return $string;
|
||||
|
@ -155,7 +155,7 @@ function print_group_icon ($id_group, $return = false, $path = "groups_small") {
|
|||
return "-";
|
||||
}
|
||||
|
||||
$output = '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$id_group.'">';
|
||||
$output = '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$id_group.'">';
|
||||
$output .= '<img class="bot" src="images/'.$path.'/'.$icon.'.png" alt="'.get_group_name ($id_group).'" title="'.get_group_name ($id_group).'" />';
|
||||
$output .= '</a>';
|
||||
|
||||
|
@ -572,10 +572,15 @@ function process_page_head ($string, $bitfield) {
|
|||
<![endif]-->
|
||||
<script type="text/javascript" src="include/javascript/pandora.js"></script>
|
||||
<script type="text/javascript" src="include/javascript/jquery.js"></script>
|
||||
<script type="text/javascript" src="include/javascript/jquery.pandora.js"></script>
|
||||
<script type="text/javascript" src="include/languages/time_'.$config['language'].'.js"></script>
|
||||
<script type="text/javascript" src="include/languages/date_'.$config['language'].'.js"></script>
|
||||
<script type="text/javascript" src="include/languages/countdown_'.$config['language'].'.js"></script>'."\n\t";
|
||||
<script type="text/javascript" src="include/javascript/jquery.pandora.js"></script>';
|
||||
|
||||
if ($config["language"] != "en") {
|
||||
//Load translated strings
|
||||
echo '<script type="text/javascript" src="include/languages/time_'.$config['language'].'.js"></script>
|
||||
<script type="text/javascript" src="include/languages/date_'.$config['language'].'.js"></script>
|
||||
<script type="text/javascript" src="include/languages/countdown_'.$config['language'].'.js"></script>';
|
||||
}
|
||||
$output .= "\n\t";
|
||||
|
||||
if (!empty ($config['css'])) {
|
||||
//We can't load empty and we loaded current style and ie
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
/*!
|
||||
* jquery.overlay 1.0.1. Overlay HTML with eyecandy.
|
||||
*
|
||||
* Copyright (c) 2009 Tero Piirainen
|
||||
* http://flowplayer.org/tools/overlay.html
|
||||
*
|
||||
* Dual licensed under MIT and GPL 2+ licenses
|
||||
* http://www.opensource.org/licenses
|
||||
*
|
||||
* Launch : March 2008
|
||||
* Version : 1.0.1 - Wed Feb 18 2009 05:18:25 GMT-0000 (GMT+00:00)
|
||||
*/
|
||||
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(4($){6 q=[];4 H(a,c,d,e){6 b=a[c];3($.17(b)){1K{5 b.1y(d,e)}1s(V){3(a.U){U("21 1X 7."+c+": "+V)}1c{18 V;}5 y}}5 9}4 13(l,p){6 f=r;6 j=G;6 w=$(T);6 k=p.S||l.I("20");6 o=k?$(k):G;3(!o){o=l}1c{j=l}6 h=o.I("7");3(!h){h=o.v("1d");h=h.1Q(h.10("(")+1,h.10(")"));o.v("1d","1N");o.I("7",h)}3(!h){18"1M-1L 1J 1I 1G 1F 1E 7 1C: "+k;}h=h.1B(/\\"/g,"");3(p.Y){$(T).L(4(){1u(4(){6 a=X 1r();a.1l=h},1o)})}6 g=o.1m({1k:9});6 m=o.2a({1k:9});6 i=$(\'<25 1l="\'+h+\'"/>\');i.v({23:0,1g:\'x\'}).s(g).R();$(\'1Y\').1W(i);3(j){j.F("Q.7",4(e){f.L(e.1U-w.O(),e.1T-w.N());5 e.1S()})}3(!p.8||!o.1b(p.8).1a){o.1P(\'<J 1O="8"></J>\');p.8="J.8"}6 n=o.1b(p.8);$.W(f,{L:4(a,b){3(f.K()){5 f}3(p.16){$.15(q,4(){r.8()})}3(H(p,"Z",f)===y){5 f}a=a||p.A.t;b=b||p.A.u;6 d=p.E.t;6 c=p.E.u;3(d==\'D\'){d=C.12((w.11()-m)/2-1D,0)}3(c==\'D\'){c=C.12((w.s()-g)/2,0)}3(!p.A.x){a+=w.O();b+=w.N()}3(!p.E.x){d+=w.O();c+=w.N()}i.v({t:a,u:b,s:p.A.s,B:p.B}).1H();i.1A({t:d,u:c,s:g},p.14,4(){o.v({1g:\'x\',t:d,u:c});6 z=i.v("B");n.1z(o).v("B",++z);o.1x(p.19,4(){H(p,"1w",f)})});5 f},1v:4(){5 i},1t:4(){5 o},1R:4(){5 j},K:4(){5 o.P(":M")},1q:4(){5 p},8:4(){3(!f.K()){5 f}3(H(p,"1V",f)===y){5 f}3(i.P(":M")){i.R();o.R()}5 f},1p:4(){5[1,0,0]},1f:4(){i.1f()}});n.F("Q.7",4(){f.8()});w.F("1n.7",4(a){3(a.1Z==27){f.8()}});3(p.1e){w.F("Q.7",4(a){3(!o.P(":M, :2f")){5}6 b=$(a.S);3(b.I("7")){5}3(b.2e("[7]").1a){5}f.8()})}}1j.2b.7=4(d){6 c=r.29(28 d==\'26\'?d:0).1i("7");3(c){5 c}6 w=$(T);6 b={A:{t:C.1h(w.11()/2),u:C.1h(w.s()/2),s:0,x:y},E:{t:\'D\',u:\'D\',x:y},14:\'24\',19:\'2c\',8:G,16:9,1e:9,Y:9,B:2d,S:G,U:9};3($.17(d)){d={Z:d}}$.W(9,b,d);r.15(4(){6 a=X 13($(r),b);q.22(a);$(r).1i("7",a)});5 r}})(1j);',62,140,'|||if|function|return|var|overlay|close|true||||||||||||||||||this|width|top|left|css||absolute|false||start|zIndex|Math|center|finish|bind|null|fireEvent|attr|div|isOpened|load|visible|scrollLeft|scrollTop|is|click|hide|target|window|alert|error|extend|new|preload|onBeforeLoad|indexOf|height|max|Overlay|speed|each|oneInstance|isFunction|throw|fadeInSpeed|length|find|else|backgroundImage|closeOnClick|expose|position|round|data|jQuery|margin|src|outerWidth|keypress|2000|getVersion|getConf|Image|catch|getContent|setTimeout|getBackgroundImage|onLoad|fadeIn|call|add|animate|replace|element|30|for|set|not|show|property|CSS|try|image|background|none|class|prepend|substring|getTrigger|preventDefault|pageX|pageY|onClose|append|calling|body|keyCode|rel|Error|push|border|normal|img|number||typeof|eq|outerHeight|prototype|fast|9999|parents|animated'.split('|'),0,{}))
|
|
@ -18,15 +18,11 @@ $(document).ready (function () {
|
|||
};
|
||||
|
||||
$.fn.pulsate = function () {
|
||||
return $(this).fadeIn ("normal", function () {
|
||||
$(this).fadeOut ("normal", function () {
|
||||
$(this).fadeIn ("normal", function () {
|
||||
$(this).fadeOut ("normal", function () {
|
||||
$(this).fadeIn ().focus ();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
var i=0;
|
||||
for (i=0; i<=2; i++) {
|
||||
$(this).fadeOut ("slow");
|
||||
$(this).fadeIn ("slow");
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.showMessage = function (msg) {
|
||||
|
@ -34,4 +30,9 @@ $(document).ready (function () {
|
|||
.text (msg)
|
||||
.slideDown ();
|
||||
};
|
||||
|
||||
$("a[rel]").overlay (function() {
|
||||
var wrap = this.getContent().find("div.wrap");
|
||||
wrap.load(this.getTrigger().attr("href"));
|
||||
});
|
||||
});
|
||||
|
|
|
@ -286,6 +286,7 @@ table, img {
|
|||
th {
|
||||
color: #fff;
|
||||
background-color: #786;
|
||||
text-align:center;
|
||||
}
|
||||
tr.datos, tr.datost, tr.datosb , tr.datos_id,
|
||||
tr.datosf9, tr.datos2, tr.datos2t,
|
||||
|
@ -912,3 +913,36 @@ div.actions_container label {
|
|||
vertical-align: middle;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
/* the overlay element */
|
||||
#overlay {
|
||||
background-image:url(../../images/transparent.png);
|
||||
|
||||
/* dimensions after the growing animation finishes */
|
||||
width:600px;
|
||||
height:470px;
|
||||
|
||||
/* initially overlay is hidden */
|
||||
display:none;
|
||||
|
||||
/* some padding to layout nested elements nicely */
|
||||
padding:55px;
|
||||
overflow:auto;
|
||||
}
|
||||
|
||||
/* default close button positioned on upper right corner */
|
||||
#overlay div.close {
|
||||
background-image:url(../../images/close.png);
|
||||
position:absolute;
|
||||
right:5px;
|
||||
top:5px;
|
||||
cursor:pointer;
|
||||
height:35px;
|
||||
width:35px;
|
||||
}
|
||||
|
||||
/* external content */
|
||||
#overlay div.wrap {
|
||||
height:441px;
|
||||
overflow:auto;
|
||||
}
|
||||
|
|
|
@ -208,6 +208,10 @@ if ($config["pure"] == 0) {
|
|||
// Main block of content
|
||||
if ($config["pure"] == 0) {
|
||||
echo '<div id="main">';
|
||||
//This is a generic overlay (hidden) which can be filled with jQuery
|
||||
// To use you have to use <a href="ajax.php?page=operation/page" rel="#overlay">Load overlay</a>
|
||||
echo '<div class="overlay" id="overlay"><div class="wrap"></div></div>';
|
||||
require_jquery_file ('overlay');
|
||||
}
|
||||
|
||||
// Page loader / selector
|
||||
|
@ -244,8 +248,8 @@ if ($config["pure"] == 0) {
|
|||
echo '<div id="foot">';
|
||||
require ("general/footer.php");
|
||||
echo '</div>';
|
||||
echo '</div>'; //container div
|
||||
}
|
||||
echo '</div>'; //container div
|
||||
while (@ob_end_flush ());
|
||||
echo '</html>';
|
||||
?>
|
||||
|
|
|
@ -160,9 +160,7 @@ if (give_acl ($config['id_user'], 0, "AR")) {
|
|||
$menu["messages"]["id"] = "oper-messages";
|
||||
|
||||
$sub = array ();
|
||||
$sub["operation/messages/message"]["text"] = __('Messages to groups');
|
||||
$sub["operation/messages/message"]["options"]["name"] = "nuevo_g";
|
||||
$sub["operation/messages/message"]["options"]["value"] = 1;
|
||||
$sub["operation/messages/message&new_msg=1"]["text"] = __('New message');
|
||||
|
||||
$menu["messages"]["sub"] = $sub;
|
||||
|
||||
|
|
|
@ -17,212 +17,203 @@
|
|||
|
||||
// Load global vars
|
||||
require_once ("include/config.php");
|
||||
require_once ("include/functions_messages.php");
|
||||
|
||||
function create_message ($usuario_origen, $usuario_destino, $subject, $mensaje) {
|
||||
$sql = sprintf ("INSERT INTO tmensajes (id_usuario_origen, id_usuario_destino, subject, mensaje, timestamp)
|
||||
VALUES ('%s', '%s', '%s', '%s',NOW())",$usuario_origen,$usuario_destino,$subject,$mensaje);
|
||||
(int) $result = process_sql ($sql);
|
||||
if ($result == 1) {
|
||||
echo '<h3 class="suc">'.__('Message successfully sent').'</h3>';
|
||||
} else {
|
||||
echo '<h3 class="error">'.__('There was a problem sending message').' - Dest: '.$usuario_destino.'</h3>';
|
||||
}
|
||||
//First Queries - also inits the variables so it can be passed along
|
||||
$dest_user = get_parameter ("dest_user");
|
||||
$dest_group = get_parameter ("dest_group");
|
||||
$subject = urldecode (get_parameter ("subject"));
|
||||
$message = urldecode (get_parameter ("message"));
|
||||
|
||||
if (isset ($_POST["delete_message"])) {
|
||||
$id = (int) get_parameter_post ("delete_message");
|
||||
$result = delete_message ($id); //Delete message function will actually check the credentials
|
||||
|
||||
print_error_message ($result, __('Message successfully deleted'), __('There was a problem deleting the message'));
|
||||
}
|
||||
|
||||
//First Queries
|
||||
$iduser = $_SESSION['id_usuario'];
|
||||
|
||||
if (isset ($_GET["nuevo_mensaje"])){
|
||||
if (!empty ($dest_user) && isset ($_GET["send_message"])) {
|
||||
// Create message
|
||||
$usuario_destino = get_parameter ("u_destino");
|
||||
$subject = get_parameter ("subject");
|
||||
$mensaje = get_parameter ("mensaje");
|
||||
create_message ($iduser, $usuario_destino, $subject, $mensaje);
|
||||
$return = create_message ($config["id_user"], $dest_user, $subject, $message);
|
||||
print_error_message ($return, __('Message successfully sent to user: ').get_user_fullname ($dest_user), __('Error sending message to user: ').get_user_fullname ($dest_user));
|
||||
}
|
||||
|
||||
if (isset ($_GET["nuevo_mensaje_g"])){
|
||||
if (!empty ($dest_group) && isset ($_GET["send_message"])) {
|
||||
// Create message to groups
|
||||
$dest_group = get_parameter ("g_destino");
|
||||
$subject = get_parameter ("subject");
|
||||
$message = get_parameter ("mensaje");
|
||||
$sql = sprintf ("SELECT id_usuario FROM tusuario_perfil WHERE id_grupo ='%d'",$dest_group);
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
if ($result === false) {
|
||||
echo "<h3 class='error'>".__('There was a problem sending message')."</h3>";
|
||||
} else {
|
||||
foreach ($result as $row) {
|
||||
create_message ($iduser, $row["id_usuario"], $subject, $message);
|
||||
}
|
||||
$return = create_message_group ($config["id_user"], $dest_group, $subject, $message);
|
||||
print_error_message ($return, __('Message successfully sent'), __('Error sending message to group: ').get_group_name ($dest_group));
|
||||
}
|
||||
|
||||
if (isset ($_GET["mark_read"]) || isset ($_GET["mark_unread"])) {
|
||||
$id_r = (int) get_parameter ("mark_read");
|
||||
$id_u = (int) get_parameter ("mark_unread");
|
||||
if (!empty ($id_r)) {
|
||||
//Set to read
|
||||
process_message_read ($id_r);
|
||||
} elseif (!empty ($id_u)) {
|
||||
//Set to unread
|
||||
process_message_read ($id_u, 0);
|
||||
}
|
||||
}
|
||||
echo "<h2>".__('Messages')." > ";
|
||||
|
||||
if (isset ($_GET["nuevo"])) { //create message
|
||||
echo __('New message').'</h2>';
|
||||
echo '<form name="new_mes" method="POST" action="index.php?sec=messages&sec2=operation/messages/message&nuevo_mensaje=1">
|
||||
<table width="600" class="databox_color" cellpadding="4" cellspacing="4"><tr>
|
||||
<td class="datos">'.__('From').':</td>
|
||||
<td class="datos"><strong>'.$iduser.'</strong></td>
|
||||
if (isset ($_GET["new_msg"])) { //create message
|
||||
echo "<h2>".__('Messages')." > ".__('New message').'</h2>';
|
||||
echo '<form method="POST" action="index.php?sec=messages&sec2=operation/messages/message&send_message=1">
|
||||
<table width="600" class="databox_color" cellpadding="4" cellspacing="4">
|
||||
<tr>
|
||||
<td class="datos">'.__('From').':</td>
|
||||
<td class="datos"><b>'.print_username ($config["id_user"], true).'</b></td>
|
||||
</tr><tr>
|
||||
<td class="datos2">'.__('To').':</td>
|
||||
<td class="datos2">';
|
||||
if (isset ($_POST["u_destino"])) {
|
||||
echo '<b>'.$_POST["u_destino"].'</b><input type="hidden" name="u_destino" value='.$_POST["u_destino"].'>';
|
||||
} else {
|
||||
echo '<select name="u_destino" width="120">';
|
||||
$groups = get_user_groups ($iduser);
|
||||
foreach ($groups as $id => $group) {
|
||||
if (!isset ($group_id)) {
|
||||
$group_id = "id_grupo = ".$id;
|
||||
} else {
|
||||
$group_id .= " OR id_grupo = ".$id;
|
||||
}
|
||||
}
|
||||
$sql = sprintf ("SELECT DISTINCT(id_usuario) FROM tusuario_perfil WHERE %s",$group_id);
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
foreach ($result as $row) {
|
||||
echo '<option value="'.$row["id_usuario"].'">'.$row["id_usuario"].'</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
}
|
||||
<td class="datos2">'.__('To').':</td>
|
||||
<td class="datos2">';
|
||||
|
||||
$users = get_users_info (); //Get a list of all users
|
||||
$groups = get_user_groups ($config["id_user"], "AR"); //Get a list of all groups
|
||||
|
||||
print_select ($users, "dest_user", $dest_user, '', __('-Select user-'), false, false, false, '', false);
|
||||
echo ' - '.__('OR').' - ';
|
||||
print_select ($groups, "dest_group", $dest_group, '', __('-Select group-'), false, false, false, '', false);
|
||||
|
||||
echo '</td></tr><tr><td class="datos">'.__('Subject').':</td><td class="datos">';
|
||||
if (isset ($_POST["subject"])) {
|
||||
echo '<input name="subject" value="'.get_parameter_post ("subject").'" size=70>';
|
||||
} else {
|
||||
echo '<input name="subject" size=60>';
|
||||
}
|
||||
echo '</td></tr><tr><td class="datos2">'.__('Message').':</td>
|
||||
<td class="datos"><textarea name="mensaje" rows="15" cols="70">';
|
||||
if (isset ($_POST["mensaje"])) {
|
||||
echo get_parameter_post ("mensaje");
|
||||
}
|
||||
echo '</textarea></td></tr><tr><td></td><td colspan="3">
|
||||
<input type="submit" class="sub wand" name="send_mes" value="'.__('Send message').'"></form></td></tr></table>';
|
||||
} elseif (isset ($_GET["nuevo_g"])) {
|
||||
echo __('New message').'</h2>';
|
||||
echo '<form name="new_mes" method="post" action="index.php?sec=messages&sec2=operation/messages/message&nuevo_mensaje_g=1">
|
||||
<table width=600 class="databox_color" cellpadding=4 cellspacing=4>
|
||||
<tr><td class="datos">'.__('From').':</td>
|
||||
<td class="datos"><strong>'.$iduser.'</strong></td></tr>
|
||||
<tr><td class="datos2">'.__('To').':</td><td class="datos2">';
|
||||
echo '<select name="g_destino" class="w130">';
|
||||
$groups = get_user_groups ($iduser);
|
||||
foreach ($groups as $id => $group) {
|
||||
if(!isset ($group_id)) {
|
||||
$group_id = "id_grupo = ".$id;
|
||||
} else {
|
||||
$group_id .= " OR id_grupo = ".$id;
|
||||
}
|
||||
}
|
||||
// This query makes that we can send messages to groups we have access
|
||||
// to, not only the ones we belong to
|
||||
$sql = sprintf ("SELECT DISTINCT(id_grupo) FROM tusuario_perfil WHERE %s",$group_id);
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
foreach ($result as $row) {
|
||||
echo '<option value="'.$row["id_grupo"].'">'.get_group_name ($row["id_grupo"]).'</option>';
|
||||
}
|
||||
echo '</select></td></tr>
|
||||
<tr><td class="datos">'.__('Subject').':</td><td class="datos"><input name="subject" size="60"></td></tr><tr>
|
||||
<td class="datos2">'.__('Message').':</td>
|
||||
<td class="datos"><textarea name="mensaje" rows="12" cols="60"></textarea></td>
|
||||
</tr><tr><td></td><td colspan="3">
|
||||
<input type="submit" class="sub wand" name="send_mes" value="'.__('Send message').'"></form></td></tr></table>';
|
||||
} elseif (isset($_GET["leer"])) {
|
||||
print_input_text ("subject", $subject, '', 50, 70, false);
|
||||
|
||||
echo '</td></tr><tr><td class="datos2">'.__('Message').':</td><td class="datos">';
|
||||
|
||||
print_textarea ("mensaje", 15, 70, $message, '', false);
|
||||
|
||||
echo '</td></tr><tr><td></td><td colspan="3">';
|
||||
|
||||
print_submit_button (__('Send message'), 'send_mes', false, 'class="sub wand"', false);
|
||||
|
||||
echo '</td></tr></table></form>';
|
||||
|
||||
$id_mensaje = get_parameter_get("id_mensaje");
|
||||
$sql = sprintf("SELECT id_usuario_origen, subject, mensaje FROM tmensajes WHERE id_usuario_destino='%s' AND id_mensaje=%d" , $iduser, $id_mensaje);
|
||||
$row = get_db_row_sql ($sql);
|
||||
process_sql ("UPDATE tmensajes SET estado=1 WHERE id_mensaje = ".$id_mensaje);
|
||||
|
||||
echo '<table class="databox_color" width=650 cellpadding=4 cellspacing=4>
|
||||
<form method="post" name="reply_mes" action="index.php?sec=messages&sec2=operation/messages/message&nuevo">
|
||||
<tr><td class="datos">'.__('From').':</td>
|
||||
<td class="datos"><b>'.$row["id_usuario_origen"].'</b></td></tr>';
|
||||
} elseif (isset ($_GET["read_message"])) {
|
||||
echo "<h2>".__('Messages')." > ".__('Read message').'</h2>';
|
||||
|
||||
$message_id = (int) get_parameter ("read_message");
|
||||
$message = get_message ($message_id);
|
||||
|
||||
if ($message == false) {
|
||||
echo '<div>'.__('This message does not exist in the system').'</div>';
|
||||
return; //Move out of this page and go processing other pages
|
||||
}
|
||||
|
||||
process_message_read ($message_id);
|
||||
|
||||
echo '<form method="post" action="index.php?sec=messages&sec2=operation/messages/message&new_msg=1">
|
||||
<table class="databox_color" width="650" cellpadding="4" cellspacing="4">
|
||||
<tr><td class="datos">'.__('From').':</td>
|
||||
<td class="datos"><b>'.print_username ($message["sender"], true).' '.__('at').' '.print_timestamp ($message["timestamp"], true, array ("prominent" => "timestamp")).'</b></td></tr>';
|
||||
|
||||
// Subject
|
||||
echo '<tr><td class="datos2">'.__('Subject').':</td>
|
||||
<td class="datos2" valign="top"><b>'.$row["subject"].'</b></td></tr>';
|
||||
<td class="datos2" valign="top"><b>'.$message["subject"].'</b></td></tr>';
|
||||
|
||||
// text
|
||||
echo '<tr><td class="datos" valign="top">'.__('Message').':</td>
|
||||
<td class="datos"><textarea name="mensaje" rows="15" cols=70 readonly>'.$row["mensaje"].'</textarea></td></tr>
|
||||
</table>
|
||||
<input type="hidden" name="u_destino" value="'.$row["id_usuario_origen"].'">
|
||||
<input type="hidden" name="subject" value="Re: '.$row["subject"].'">
|
||||
<input type="hidden" name="mensaje" value="'.$row["id_usuario_origen"].__(' wrote').': '.$row["mensaje"].'">';
|
||||
echo '<table width=650 cellpadding=4 cellspacing=4>';
|
||||
echo "<tr><td align=right>";
|
||||
echo '<input type="submit" class="sub next" name="send_mes" value="'.__('Reply').'">';
|
||||
echo '</form>';
|
||||
echo "</td></tr></table>";
|
||||
}
|
||||
if (isset ($_GET["leer"]) || (!isset ($_GET["nuevo"]) && !isset ($_GET["nuevo_g"]))) {
|
||||
echo __('Read messages')."</h2>";
|
||||
|
||||
//Delete messages if borrar is set
|
||||
if (isset ($_GET["borrar"])){
|
||||
$id_message = get_parameter_get ("id_mensaje");
|
||||
$sql = sprintf ("DELETE FROM tmensajes WHERE id_usuario_destino='%s' AND id_mensaje=%d",$iduser,$id_message);
|
||||
(int) $result = process_sql ($sql);
|
||||
if ($result > 0) {
|
||||
echo '<h3 class="suc">'.__('Message sucessfully deleted').'</h3>';
|
||||
} else {
|
||||
echo '<h3 class="error">'.__('There was a problem deleting message').'</h3>';
|
||||
}
|
||||
<td class="datos"><pre>'.$message["message"].'</pre></td></tr></table>';
|
||||
|
||||
//Prevent RE: RE: RE:
|
||||
if (strstr ($message["subject"], "RE:")) {
|
||||
$new_subj = $message["subject"];
|
||||
} else {
|
||||
$new_subj = "RE: ".$message["subject"];
|
||||
}
|
||||
|
||||
//Start the message much like an e-mail reply
|
||||
$new_msg = "\n\n\nOn ".date ($config["date_format"], $message["timestamp"]).' '.get_user_fullname ($message["sender"]).' '.__('wrote').":\n\n".$message["message"];
|
||||
|
||||
print_input_hidden ("dest_user", $message["sender"]);
|
||||
print_input_hidden ("subject", urlencode ($new_subj));
|
||||
print_input_hidden ("message", urlencode ($new_msg));
|
||||
|
||||
echo '<div style="text-align:right; width:600px;">';
|
||||
print_submit_button (__('Reply'), "reply_btn", false, 'class="sub next"');
|
||||
echo '</div></form>';
|
||||
}
|
||||
|
||||
if (isset ($_GET["read_message"]) || !isset ($_GET["new_msg"])) {
|
||||
if (empty ($config["pure"]) && !defined ('AJAX')) {
|
||||
echo "<h2>".__('Messages')." > ".__('Message overview').'</h2>';
|
||||
}
|
||||
|
||||
//Get number of messages
|
||||
$sql = sprintf("SELECT COUNT(id_mensaje) FROM tmensajes WHERE id_usuario_destino='%s' AND estado=0",$iduser);
|
||||
$num_messages = get_db_sql ($sql);
|
||||
|
||||
if ($num_messages > 0){
|
||||
echo '<p>'.__('You have ').' <b>'.$num_messages.'</b> <img src="images/email.png">'.__(' unread message(s).').'</p>';
|
||||
$num_messages = get_message_count ($config["id_user"]);
|
||||
|
||||
$order = get_parameter ("msg_overview_order", "status");
|
||||
$order_dir = get_parameter ("msg_overview_orddir", "ASC");
|
||||
|
||||
$messages = get_message_overview ($order, $order_dir);
|
||||
|
||||
if ($num_messages > 0 && empty ($config["pure"]) && !defined ('AJAX')) {
|
||||
echo '<p>'.__('You have').' <b>'.$num_messages.'</b> '.print_image ("images/email.png", true).' '.__('unread message(s)').'.</p>';
|
||||
}
|
||||
$sql = sprintf ("SELECT id_mensaje, id_usuario_origen, subject, timestamp, estado FROM tmensajes WHERE id_usuario_destino='%s' ORDER BY `timestamp` DESC",$iduser);
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
if ($result === false) {
|
||||
echo "<div class='nf'>".__('There are no messages')."</div>";
|
||||
|
||||
if (empty ($messages)) {
|
||||
echo '<div class="nf">'.__('There are no messages').'</div>';
|
||||
} else {
|
||||
$color = 1;
|
||||
echo '<table width="650" class="databox" cellpadding="4" cellspacing="4"><tr>
|
||||
<th>'.__('Read').'</th>
|
||||
<th>'.__('Sender').'</th>
|
||||
<th>'.__('Subject').'</th>
|
||||
<th>'.__('Timestamp').'</th>
|
||||
<th>'.__('Delete').'</th></tr>';
|
||||
|
||||
foreach ($result as $row) {
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
$table->width = "100%";
|
||||
$table->class = "databox";
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->head = array ();
|
||||
$table->data = array ();
|
||||
$table->align = array ();
|
||||
$table->size = array ();
|
||||
|
||||
$table->head[0] = __('Status');
|
||||
$table->head[1] = __('Sender');
|
||||
$table->head[2] = __('Subject');
|
||||
$table->head[3] = __('Timestamp');
|
||||
$table->head[4] = __('Delete');
|
||||
|
||||
$table->align[0] = "center";
|
||||
$table->align[1] = "center";
|
||||
$table->align[2] = "center";
|
||||
$table->align[3] = "center";
|
||||
$table->align[4] = "center";
|
||||
|
||||
$table->size[0] = "20px";
|
||||
$table->size[1] = "120px";
|
||||
$table->size[3] = "80px";
|
||||
$table->size[4] = "20px";
|
||||
|
||||
foreach ($messages as $message_id => $message) {
|
||||
$data = array ();
|
||||
$data[0] = '';
|
||||
if ($message["status"] == 1) {
|
||||
$data[0] .= '<a href="index.php?sec=messages&sec2=operation/messages/message&mark_unread='.$message_id.'">';
|
||||
$data[0] .= print_image ("images/email_open.png", true, array ("border" => 0, "title" => __('Mark as unread')));
|
||||
$data[0] .= '</a>';
|
||||
} else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
$data[0] .= '<a href="index.php?sec=messages&sec2=operation/messages/message&read_message='.$message_id.'">';
|
||||
$data[0] .= print_image ("images/email.png", true, array ("border" => 0, "title" => __('Message unread - click to read')));
|
||||
$data[0] .= '</a>';
|
||||
}
|
||||
echo '<tr><td align="center" class="'.$tdcolor.'">';
|
||||
echo '<a href="index.php?sec=messages&sec2=operation/messages/message&leer=1&id_mensaje='.$row["id_mensaje"].'">';
|
||||
if ($row["estado"]==1) {
|
||||
$img = "email_open.png";
|
||||
|
||||
$data[1] = print_username ($message["sender"], true);
|
||||
|
||||
$data[2] = '<a href="index.php?sec=messages&sec2=operation/messages/message&read_message='.$message_id.'">';
|
||||
if ($message["subject"] == "") {
|
||||
$data[2] .= __('No Subject');
|
||||
} else {
|
||||
$img = "email.png";
|
||||
$data[2] .= $message["subject"];
|
||||
}
|
||||
echo '<img src="images/'.$img.'" border="0"></a></td>';
|
||||
echo '<td class="'.$tdcolor.'">'. $row["id_usuario_origen"].'</td>';
|
||||
echo '<td class="'.$tdcolor.'"><a href="index.php?sec=messages&sec2=operation/messages/message&leer=1&id_mensaje='.$row["id_mensaje"].'"><b>';
|
||||
if ($row["subject"]) {
|
||||
echo $row["subject"];
|
||||
} else {
|
||||
echo __('No subject');
|
||||
}
|
||||
echo '</b></a></td><td class="'.$tdcolor.'">'.print_timestamp ($row["timestamp"], true).'</td>
|
||||
<td class="'.$tdcolor.'" align="center"><a href="index.php?sec=messages&sec2=operation/messages/message&borrar=1&id_mensaje='.$row["id_mensaje"].'">
|
||||
<img src="images/cross.png" border="0"></a></td></tr>';
|
||||
$data[2] .= '</a>';
|
||||
|
||||
$data[3] = print_timestamp ($message["timestamp"], true, array ("prominent" => "timestamp"));
|
||||
|
||||
$data[4] = print_input_image ("delete_message", "images/cross.png", $message_id, 'border:0px;', true);
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
echo '<form method="post" action="index.php?sec=messages&sec2=operation/messages/message&new_msg=1">';
|
||||
print_table ($table);
|
||||
echo '</form>';
|
||||
}
|
||||
echo '<div class="action-buttons" style="width: 650px">';
|
||||
echo '<form method="post" name="new_mes" action="index.php?sec=messages&sec2=operation/messages/message&nuevo">
|
||||
<input type="submit" class="sub next" name="send_mes" value="'.__('New message').'"></form>';
|
||||
echo "</div>";
|
||||
echo '<div class="action-buttons" style="width:100%">';
|
||||
echo '<form method="post" action="index.php?sec=messages&sec2=operation/messages/message&new_msg=1">';
|
||||
print_submit_button (__('New message'), "send_mes", false, 'class="sub next"');
|
||||
echo '</form></div>';
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -22,7 +22,6 @@ require ('include/functions_visual_map.php');
|
|||
check_login ();
|
||||
|
||||
$id_layout = (int) get_parameter ('id');
|
||||
$refr = (int) get_parameter ('refr');
|
||||
|
||||
// Get input parameter for layout id
|
||||
if (! $id_layout) {
|
||||
|
@ -58,11 +57,11 @@ if (! give_acl ($config["id_user"], $id_group, "AR")) {
|
|||
echo "<h1>".$layout_name." ";
|
||||
|
||||
if ($config["pure"] == 0) {
|
||||
echo '<a href="index.php?sec=visualc&sec2=operation/visual_console/render_view&id='.$id_layout.'&refr='.$refr.'&pure=1">';
|
||||
echo '<a href="index.php?sec=visualc&sec2=operation/visual_console/render_view&id='.$id_layout.'&refr='.$config["refr"].'&pure=1">';
|
||||
print_image ("images/monitor.png", false, array ("title" => __('Full screen mode')));
|
||||
echo "</a>";
|
||||
} else {
|
||||
echo '<a href="index.php?sec=visualc&sec2=operation/visual_console/render_view&id='.$id_layout.'&refr='.$refr.'">';
|
||||
echo '<a href="index.php?sec=visualc&sec2=operation/visual_console/render_view&id='.$id_layout.'&refr='.$config["refr"].'">';
|
||||
print_image ("images/monitor.png", false, array ("title" => __('Back to normal mode')));
|
||||
echo "</a>";
|
||||
}
|
||||
|
@ -83,12 +82,12 @@ $values[1800] = "30 ". __('minutes');
|
|||
$table->width = 500;
|
||||
$table->data = array ();
|
||||
$table->data[0][0] = __('Autorefresh time');
|
||||
$table->data[0][1] = print_select ($values, 'refr', $refr, '', 'N/A', 0, true, false, false);
|
||||
$table->data[0][1] = print_select ($values, 'refr', $config["refr"], '', 'N/A', 0, true, false, false);
|
||||
$table->data[0][2] = print_submit_button (__('Refresh'), '', false, 'class="sub next"', true);
|
||||
|
||||
echo '<div style="height:30px"> </div>';
|
||||
|
||||
if ($config['pure'] && $refr != 0) {
|
||||
if ($config['pure'] && $config["refr"] != 0) {
|
||||
echo '<div id="countdown"><br /></div>';
|
||||
}
|
||||
|
||||
|
@ -100,7 +99,7 @@ print_input_hidden ('id', $id_layout);
|
|||
print_table ($table);
|
||||
echo '</form>';
|
||||
|
||||
if ($config["pure"] && $refr != 0) {
|
||||
if ($config["pure"] && $config["refr"] != 0) {
|
||||
require_jquery_file ('countdown');
|
||||
require_css_file ('countdown');
|
||||
}
|
||||
|
@ -109,9 +108,9 @@ $config['js'][] = 'pandora_visual_console';
|
|||
<script language="javascript" type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
$(document).ready (function () {
|
||||
<?php if ($config["pure"] && $refr != 0): ?>
|
||||
<?php if ($config["pure"] && $config["refr"] > 0): ?>
|
||||
t = new Date();
|
||||
t.setTime (t.getTime() + 1);
|
||||
t.setTime (t.getTime() + <?php echo $config["refr"] * 1000; ?>);
|
||||
$("#countdown").countdown({until: t, format: 'MS', description: '<?php echo __('Until refresh'); ?>'});
|
||||
<?php endif; ?>
|
||||
draw_lines (lines, 'layout_map');
|
||||
|
|
|
@ -448,7 +448,7 @@ CREATE TABLE IF NOT EXISTS `tmensajes` (
|
|||
`id_usuario_origen` varchar(60) NOT NULL default '',
|
||||
`id_usuario_destino` varchar(60) NOT NULL default '',
|
||||
`mensaje` tinytext NOT NULL,
|
||||
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
|
||||
`timestamp` bigint (20) unsigned NOT NULL default '0',
|
||||
`subject` varchar(255) NOT NULL default '',
|
||||
`estado` int(4) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id_mensaje`)
|
||||
|
|
|
@ -271,3 +271,6 @@ ALTER TABLE treport_content ADD `description` mediumtext;
|
|||
ALTER TABLE treport_content MODIFY `type` varchar(30) default 'simple_graph';
|
||||
ALTER TABLE treport_content ADD `id_agent` int(10) unsigned NOT NULL default 0;
|
||||
|
||||
-- Changes added 19 February 2009
|
||||
|
||||
ALTER TABLE `tmensajes` CHANGE `timestamp` `timestamp` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT '0'
|
||||
|
|
Loading…
Reference in New Issue