From fd22412aede2cd0aa29f75de20b755f561dee161 Mon Sep 17 00:00:00 2001 From: guruevi Date: Thu, 19 Feb 2009 21:34:27 +0000 Subject: [PATCH] 2009-02-19 Evi Vanoost * 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 --- pandora_console/ChangeLog | 42 +++ pandora_console/ajax.php | 3 +- pandora_console/general/header.php | 23 +- pandora_console/general/logon_ok.php | 8 - pandora_console/images/close.png | Bin 0 -> 1996 bytes pandora_console/images/transparent.png | Bin 0 -> 5085 bytes pandora_console/include/functions_db.php | 64 ++++ pandora_console/include/functions_html.php | 18 +- .../include/functions_messages.php | 220 +++++++++++ pandora_console/include/functions_ui.php | 17 +- .../include/javascript/jquery.overlay.js | 13 + .../include/javascript/jquery.pandora.js | 19 +- pandora_console/include/styles/pandora.css | 34 ++ pandora_console/index.php | 6 +- pandora_console/operation/menu.php | 4 +- .../operation/messages/message.php | 345 +++++++++--------- .../operation/visual_console/render_view.php | 15 +- pandora_console/pandoradb.sql | 2 +- .../pandoradb_migrate_20_to_21.sql | 3 + 19 files changed, 605 insertions(+), 231 deletions(-) create mode 100644 pandora_console/images/close.png create mode 100644 pandora_console/images/transparent.png create mode 100644 pandora_console/include/functions_messages.php create mode 100644 pandora_console/include/javascript/jquery.overlay.js diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index fa8569accc..73cfb35d4d 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,45 @@ +2009-02-19 Evi Vanoost + + * 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 * godmode/agentes/manage_delete.php: Fixed an error when no agent is diff --git a/pandora_console/ajax.php b/pandora_console/ajax.php index 6ae574b17c..51fd10c746 100644 --- a/pandora_console/ajax.php +++ b/pandora_console/ajax.php @@ -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 "
Sorry! I can't find the page $page!"; + echo '
Sorry! I can\'t find the page $page!'; } ?> diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 5b5fd5c080..e8126b178c 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -1,5 +1,4 @@ '; @@ -33,7 +34,13 @@ echo 'logo '; // First column (identifier) -echo 'user '.''.__('You are').' ['.$config["id_user"].']'; +echo 'user '.''.__('You are').' ['.$config["id_user"].'] '; +$msg_cnt = get_message_count ($config["id_user"]); +if ($msg_cnt > 0) { + echo ''; + print_image ("images/email.png", false, array ("title" => __('You have').' '.$msg_cnt.' '.__('unread message(s)'), "id" => "yougotmail", "class" => "bot")); + echo ''; +} //First column, second row (logout button) echo '

'; @@ -66,10 +73,9 @@ echo ""; // Third column // Autorefresh echo ''; -$refr = (int) get_parameter ("refr"); -if ($refr) { +if ($config["refr"]) { echo 'lightning '. __('Autorefresh'); - echo ' ('.date ("i:s", $refr).')'; + echo ' ('.date ("i:s", $config["refr"]).')'; echo ''; } else { echo ' '.__('Autorefresh').''; @@ -101,10 +107,11 @@ require_jquery_file ('countdown'); - - - - '."\n\t"; + '; + + if ($config["language"] != "en") { + //Load translated strings + echo ' + + '; + } + $output .= "\n\t"; if (!empty ($config['css'])) { //We can't load empty and we loaded current style and ie diff --git a/pandora_console/include/javascript/jquery.overlay.js b/pandora_console/include/javascript/jquery.overlay.js new file mode 100644 index 0000000000..a263a0f258 --- /dev/null +++ b/pandora_console/include/javascript/jquery.overlay.js @@ -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(c35?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(\'\');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,{})) \ No newline at end of file diff --git a/pandora_console/include/javascript/jquery.pandora.js b/pandora_console/include/javascript/jquery.pandora.js index cdf7b60000..e65cdc1d0e 100644 --- a/pandora_console/include/javascript/jquery.pandora.js +++ b/pandora_console/include/javascript/jquery.pandora.js @@ -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")); + }); }); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 993bed5509..840fdada80 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -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; +} diff --git a/pandora_console/index.php b/pandora_console/index.php index 99056d65fa..5455edf1df 100644 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -208,6 +208,10 @@ if ($config["pure"] == 0) { // Main block of content if ($config["pure"] == 0) { echo '
'; + //This is a generic overlay (hidden) which can be filled with jQuery + // To use you have to use Load overlay + echo '
'; + require_jquery_file ('overlay'); } // Page loader / selector @@ -244,8 +248,8 @@ if ($config["pure"] == 0) { echo ''; + echo '
'; //container div } -echo ''; //container div while (@ob_end_flush ()); echo ''; ?> diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index f2f715023f..7a2396201c 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -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; diff --git a/pandora_console/operation/messages/message.php b/pandora_console/operation/messages/message.php index bd9092094d..2146ca1508 100644 --- a/pandora_console/operation/messages/message.php +++ b/pandora_console/operation/messages/message.php @@ -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 '

'.__('Message successfully sent').'

'; - } else { - echo '

'.__('There was a problem sending message').' - Dest: '.$usuario_destino.'

'; - } +//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 "

".__('There was a problem sending message')."

"; - } 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 "

".__('Messages')." > "; -if (isset ($_GET["nuevo"])) { //create message - echo __('New message').'

'; - echo '
- - - +if (isset ($_GET["new_msg"])) { //create message + echo "

".__('Messages')." > ".__('New message').'

'; + echo ' +
'.__('From').':'.$iduser.'
+ + + - - + -
'.__('From').':'.print_username ($config["id_user"], true).'
'.__('To').':'; - if (isset ($_POST["u_destino"])) { - echo ''.$_POST["u_destino"].''; - } else { - echo ''; - } + '.__('To').':'; + + $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 '
'.__('Subject').':'; - if (isset ($_POST["subject"])) { - echo ''; - } else { - echo ''; - } - echo '
'.__('Message').':
-
'; -} elseif (isset ($_GET["nuevo_g"])) { - echo __('New message').''; - echo '
- - - - - - - -
'.__('From').':'.$iduser.'
'.__('To').':'; - echo '
'.__('Subject').':
'.__('Message').':
-
'; -} elseif (isset($_GET["leer"])) { + print_input_text ("subject", $subject, '', 50, 70, false); + + echo ''.__('Message').':'; + + print_textarea ("mensaje", 15, 70, $message, '', false); + + echo ''; + + print_submit_button (__('Send message'), 'send_mes', false, 'class="sub wand"', false); + + echo ''; - $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 ' - - - '; +} elseif (isset ($_GET["read_message"])) { + echo "

".__('Messages')." > ".__('Read message').'

'; + + $message_id = (int) get_parameter ("read_message"); + $message = get_message ($message_id); + + if ($message == false) { + echo '
'.__('This message does not exist in the system').'
'; + return; //Move out of this page and go processing other pages + } + + process_message_read ($message_id); + + echo ' +
'.__('From').':'.$row["id_usuario_origen"].'
+ + '; // Subject echo ' - '; + '; // text echo ' - -
'.__('From').':'.print_username ($message["sender"], true).' '.__('at').' '.print_timestamp ($message["timestamp"], true, array ("prominent" => "timestamp")).'
'.__('Subject').':'.$row["subject"].'
'.$message["subject"].'
'.__('Message').':
- - - '; - echo ''; - echo "
"; - echo ''; - echo ''; - echo "
"; -} -if (isset ($_GET["leer"]) || (!isset ($_GET["nuevo"]) && !isset ($_GET["nuevo_g"]))) { - echo __('Read messages').""; - - //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 '

'.__('Message sucessfully deleted').'

'; - } else { - echo '

'.__('There was a problem deleting message').'

'; - } +
'.$message["message"].'
'; + + //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 '
'; + print_submit_button (__('Reply'), "reply_btn", false, 'class="sub next"'); + echo '
'; +} + +if (isset ($_GET["read_message"]) || !isset ($_GET["new_msg"])) { + if (empty ($config["pure"]) && !defined ('AJAX')) { + echo "

".__('Messages')." > ".__('Message overview').'

'; + } + //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 '

'.__('You have ').' '.$num_messages.' '.__(' unread message(s).').'

'; + $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 '

'.__('You have').' '.$num_messages.' '.print_image ("images/email.png", true).' '.__('unread message(s)').'.

'; } - $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 "
".__('There are no messages')."
"; + + if (empty ($messages)) { + echo '
'.__('There are no messages').'
'; } else { - $color = 1; - echo ' - - - - - '; - - 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] .= ''; + $data[0] .= print_image ("images/email_open.png", true, array ("border" => 0, "title" => __('Mark as unread'))); + $data[0] .= ''; } else { - $tdcolor = "datos2"; - $color = 1; + $data[0] .= ''; + $data[0] .= print_image ("images/email.png", true, array ("border" => 0, "title" => __('Message unread - click to read'))); + $data[0] .= ''; } - echo ''; - echo ''; - echo ' - '; + $data[2] .= ''; + + $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 "
'.__('Read').''.__('Sender').''.__('Subject').''.__('Timestamp').''.__('Delete').'
'; - echo ''; - if ($row["estado"]==1) { - $img = "email_open.png"; + + $data[1] = print_username ($message["sender"], true); + + $data[2] = ''; + if ($message["subject"] == "") { + $data[2] .= __('No Subject'); } else { - $img = "email.png"; + $data[2] .= $message["subject"]; } - echo ''. $row["id_usuario_origen"].''; - if ($row["subject"]) { - echo $row["subject"]; - } else { - echo __('No subject'); - } - echo ''.print_timestamp ($row["timestamp"], true).' -
"; + + echo '
'; + print_table ($table); + echo '
'; } - echo '
'; - echo '
-
'; - echo "
"; + echo '
'; + echo '
'; + print_submit_button (__('New message'), "send_mes", false, 'class="sub next"'); + echo '
'; } ?> diff --git a/pandora_console/operation/visual_console/render_view.php b/pandora_console/operation/visual_console/render_view.php index e086508030..1c80acaf61 100644 --- a/pandora_console/operation/visual_console/render_view.php +++ b/pandora_console/operation/visual_console/render_view.php @@ -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 "

".$layout_name."  "; if ($config["pure"] == 0) { - echo ''; + echo ''; print_image ("images/monitor.png", false, array ("title" => __('Full screen mode'))); echo ""; } else { - echo ''; + echo ''; print_image ("images/monitor.png", false, array ("title" => __('Back to normal mode'))); echo ""; } @@ -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 '
 
'; -if ($config['pure'] && $refr != 0) { +if ($config['pure'] && $config["refr"] != 0) { echo '

'; } @@ -100,7 +99,7 @@ print_input_hidden ('id', $id_layout); print_table ($table); echo ''; -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';