Changed display way on um messages view and other changes

This commit is contained in:
fermin831 2016-06-17 09:27:28 +02:00
parent 0035b74f47
commit f2d51ebad1
6 changed files with 96 additions and 83 deletions

View File

@ -21,19 +21,33 @@
global $config;
include_once("include/functions_update_manager.php");
$last_message = update_manger_get_last_message ();
if ($last_message === false) return false;
$message = array();
if (is_ajax()) {
$message_id = get_parameter ('message_id', false);
if ($message_id === false) return false;
$message = update_manger_get_single_message ($message_id);
} else {
$message = update_manger_get_last_message ();
if ($message === false) return false;
update_manger_set_read_message($message["svn_version"], 1);
update_manager_remote_read_messages ($message["svn_version"]);
}
update_manger_set_read_message($last_message["svn_version"], 1);
update_manager_remote_read_messages ($last_message["svn_version"]);
// Prints first step pandora registration
echo '<div id="message_id_dialog" title="' .
'[' . $last_message["svn_version"] . '] ' . $last_message['db_field_value'] . '">';
'[' . $message["svn_version"] . '] ' . $message['db_field_value'] . '">';
echo '<div>';
echo $last_message["data"];
echo $message["data"];
echo '</div>';
echo '</div>';

View File

@ -162,7 +162,7 @@ echo '<div id="login_accept_register" title="' .
echo "<br>";
echo '<div id="email_container">';
echo '&nbsp;<span id="label-email-newsletter"style="font-size: 12px; display: none">' .__("Email") . ': </span>';
html_print_input_text_extended ('email-newsletter', $email, 'text-email-newsletter', '', 30, 255, false, '', array ("style" => "display:none; width: 180px;")); echo '&nbsp;<span id="label-email-newsletter"style="font-size: 12px; display: none">' .__("Email") . ': </span>';
html_print_input_text_extended ('email-newsletter', $email, 'text-email-newsletter', '', 30, 255, false, '', array ("style" => "display:none; width: 200px;")); echo '&nbsp;<span id="label-email-newsletter"style="font-size: 12px; display: none">' .__("Email") . ': </span>';
echo '&nbsp;<span id="required-email-newsletter">*'.__("Required") .' </span>';
echo '</div>';
echo '</div>';
@ -359,15 +359,15 @@ $(document).ready (function () {
#required-email-newsletter{
font-size : 9px;
color: red;
float:right;
left: 5px;
top: -17px;
position: relative;
margin-left: -2px;
margin-top: 3px;
position: absolute;
display: none;
}
#email_container{
margin-top: 3px;
width: 500px;
}
#license_newsletter {

View File

@ -23,6 +23,7 @@ global $config;
if (is_ajax()) {
$save_identification = get_parameter ('save_required_wizard', 0);
$change_language = get_parameter ('change_language', 0);
// Updates the values get on the identification wizard
if ($save_identification) {
@ -43,8 +44,12 @@ if (is_ajax()) {
'field1_recovery' => $email));
}
config_update_value ('initial_wizard', 1);
config_update_value ('initial_wizard', 1);
}
//Change the language if is change in checkbox
if ($change_language !== 0) {
config_update_value ('language', $change_language);
}
return;
@ -125,6 +130,8 @@ echo '</div>';
<script type="text/javascript" language="javascript">
/* <![CDATA[ */
var default_language_displayed;
////////////////////////////////////////////////////////////////////////
//HELPER FUNCTIONS
function show_timezone () {
@ -172,6 +179,18 @@ $("#submit-id_dialog_button").click (function () {
}
});
$("#language").click(function () {
var change_language = $("#language").val();
if (change_language === default_language_displayed) return;
jQuery.post ("ajax.php",
{"page": "general/login_required",
"change_language": change_language},
function (data) {}
);
location.reload();
});
////////////////////////////////////////////////////////////////////////
//DISPLAY
$(document).ready (function () {
@ -190,6 +209,8 @@ $(document).ready (function () {
open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
});
default_language_displayed = $("#language").val();
$(".ui-widget-overlay").css("background", "#000");
$(".ui-widget-overlay").css("opacity", 0.6);
});

View File

@ -431,11 +431,11 @@ if (check_acl ($config['id_user'], 0, "PM")) {
$menu_godmode["messages"]["id"] = "god-um_messages";
$sub = array ();
$sub["godmode/update_manager/update_manager&tab=offline"]["text"] = __('Offline');
$sub["godmode/update_manager/update_manager&tab=offline"]["text"] = __('Update Manager offline');
$sub["godmode/update_manager/update_manager&tab=offline"]["id"] = 'Offline';
$sub["godmode/update_manager/update_manager&tab=online"]["text"] = __('Online');
$sub["godmode/update_manager/update_manager&tab=online"]["text"] = __('Update Manager online');
$sub["godmode/update_manager/update_manager&tab=online"]["id"] = 'Online';
$sub["godmode/update_manager/update_manager&tab=setup"]["text"] = __('Options');
$sub["godmode/update_manager/update_manager&tab=setup"]["text"] = __('Update Manager options');
$sub["godmode/update_manager/update_manager&tab=setup"]["id"] = 'Options';
if (license_free() && is_user_admin ($config['id_user'])) {

View File

@ -25,17 +25,9 @@ if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_us
}
if (is_ajax()) {
$charge_message = get_parameter ('charge_message', 0);
$not_read_single = get_parameter ('not_read_single', 0);
if ($charge_message) {
$message_id = get_parameter ('message_id', 0);
if ($message_id == 0) return;
$message_html = db_get_value ('data', 'tupdate', 'svn_version', $message_id);
echo $message_html;
}
if ($not_read_single) {
$message_id = get_parameter ('message_id', 0);
update_manger_set_read_message ($message_id, 1);
@ -109,7 +101,8 @@ if ($total_messages){
html_print_submit_button (__('Mark as read'), 'read_button', false,
'class="sub upd"');
echo '</div>';
// Pagination
if ($total_messages > $config['block_size']) {
ui_pagination (update_manager_get_total_messages (), false, 0);
}
@ -137,11 +130,10 @@ if ($total_messages){
$table->size[4] = "60px";
$table->style[0] = "padding-left: 20px";
$table->style[1] = "display: none";
$table->head[0] = html_print_checkbox_extended('all_selection[]', 0, false, false, '', '', true);
$table->head[1] = __('Message Id');
$table->head[2] = __('Subject');
$table->head[3] = __('Expiration date');
$i = 0;
@ -155,9 +147,6 @@ if ($total_messages){
$data[2] = $message['db_field_value'];
$table->cellclass[count($table->data)][2] = 'um_individual_subject';
$data[3] = $message['filename'];
$table->cellclass[count($table->data)][3] = 'um_individual_info';
// Change row class if message is read or not by this user
if (update_manger_get_read_message ($message['svn_version'], $message['data_rollback'])) {
@ -169,14 +158,6 @@ if ($total_messages){
}
array_push ($table->data, $data);
// Insert an empty row too. Here the message will be displayed
$empty[0] = "";
$table->colspan[count($table->data)][0] = 4;
$table->cellclass[count($table->data)][0] = "um_message_" . $i;
$table->cellstyle[count($table->data)][0] = "display: none;";
array_push ($table->data, $empty);
$i++;
}
html_print_table($table);
@ -226,55 +207,41 @@ if ($total_messages){
// Delete and mark as not read column will do not open the message
if (column == 0) return;
// Class where object will be displayed
var current_class = ".um_message_" + row;
var message_id = $("#"+target).parent().find(":nth-child(2)").html();
var className = $("#"+target).parent().attr('class');
if (row%2 == 0) {
// Clicking a tittle
// Class where object will be displayed
var current_class = ".um_message_" + row/2;
var message_id = $("#"+target).parent().find(":nth-child(2)").html();
var div_id = 'um_individual_message' + row/2;
// Get the message via Ajax (only if it is not checked now
$(current_class).append('<div class="' + div_id + '"></div>');
if ($("." + div_id).length == 1) {
jQuery.get ("ajax.php",
{"page": "godmode/update_manager/update_manager.messages",
"charge_message": 1,
"message_id": message_id},
function (data) {
$("." + div_id).hide ()
.empty ()
.append (data)
.show ();
},
"html"
);
if (className == 'um_not_read_message'){
// Update message if it is not readed
var className = $("#"+target).parent().attr('class');
if (className == 'um_not_read_message'){
jQuery.post ("ajax.php",
{"page": "godmode/update_manager/update_manager.messages",
"not_read_single": 1,
"message_id": message_id},
function (data) {}
);
$("#"+target).parent().children().each(function(){
var full_class = $(this).attr('class');
full_class = full_class.replace (/um_not_read_message/g, "um_read_message");
$(this).attr('class', full_class);
});
}
}
// Display message
$(current_class).toggle ();
jQuery.post ("ajax.php",
{"page": "godmode/update_manager/update_manager.messages",
"not_read_single": 1,
"message_id": message_id},
function (data) {}
);
$("#"+target).parent().children().each(function(){
var full_class = $(this).attr('class');
full_class = full_class.replace (/um_not_read_message/g, "um_read_message");
$(this).attr('class', full_class);
});
}
// Display message
$("#container").append('<div class="id_wizard"></div>');
jQuery.get ("ajax.php",
{"page": "general/last_message",
"message_id": message_id},
function (data) {
$(".id_wizard").hide ()
.empty ()
.append (data);
},
"html"
);
});
$(".check_selection").click(function (event) {

View File

@ -787,6 +787,17 @@ function update_manger_get_last_message () {
return $message;
}
// Get the a single message message
function update_manger_get_single_message ($message_id) {
global $config;
$sql = 'SELECT data, svn_version, db_field_value FROM tupdate ';
$sql .= 'WHERE svn_version=' . $message_id;
html_debug ("S: " . $sql, true);
$message = db_get_row_sql($sql);
return $message;
}
function update_manager_get_total_messages () {
global $config;