Skip to content

Commit

Permalink
Merge dc6a9f7 into f529607
Browse files Browse the repository at this point in the history
  • Loading branch information
mnsuccess committed Nov 17, 2020
2 parents f529607 + dc6a9f7 commit 53146db
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/imap/output_modules.php
Expand Up @@ -252,6 +252,7 @@ protected function output() {
$txt .= ' | <a id="flag_msg" class="unflagged_link hlink" data-state="unflagged" href="#">'.$this->trans('Flag').'</a>';
$txt .= '<a style="display: none;" class="flagged_link hlink" id="unflag_msg" data-state="flagged" href="#">'.$this->trans('Unflag').'</a>';
}
$txt .= ' | <a class="hlink" id="unread_message" href="#" >'.$this->trans('Unread').'</a>';
$txt .= ' | <a class="delete_link hlink" id="delete_message" href="#">'.$this->trans('Delete').'</a>';
$txt .= ' | <a class="hlink" id="copy_message" href="#">'.$this->trans('Copy').'</a>';
$txt .= ' | <a class="hlink" id="move_message" href="#">'.$this->trans('Move').'</a>';
Expand Down
44 changes: 44 additions & 0 deletions modules/imap/site.js
Expand Up @@ -182,6 +182,49 @@ var imap_delete_message = function(state, supplied_uid, supplied_detail) {
return false;
};

var imap_unread_message = function(supplied_uid, supplied_detail) {
var uid = hm_msg_uid();
var detail = Hm_Utils.parse_folder_path(hm_list_path(), 'imap');
if (supplied_uid) {
uid = supplied_uid;
}
if (supplied_detail) {
detail = supplied_detail;
}
if (detail && uid) {
var selected = detail.type+'_'+detail.server_id+'_'+uid+'_'+detail.folder;
Hm_Ajax.request(
[{'name': 'hm_ajax_hook', 'value': 'ajax_message_action'},
{'name': 'action_type', 'value': 'unread'},
{'name': 'message_ids', 'value': selected}],
function(res) {
if (Hm_Utils.get_from_global('uid', false)) {
return;
}
var nlink = $('.nlink');
if (nlink.length) {
window.location.href = nlink.attr('href');
}
else {
if (!hm_list_parent()) {
window.location.href = "?page=message_list&list_path="+hm_list_path();
}
else {
window.location.href = "?page=message_list&list_path="+hm_list_parent();
}
}
},
[],
false,
function() {
var cache = $('<tbody></tbody>').append($(Hm_Utils.get_from_local_storage('formatted_unread_data')));
Hm_Message_List.adjust_unread_total($('tr', cache).length, true);
}
);
}
return false;
}

var imap_flag_message = function(state, supplied_uid, supplied_detail) {
var uid = hm_msg_uid();
var detail = Hm_Utils.parse_folder_path(hm_list_path(), 'imap');
Expand Down Expand Up @@ -590,6 +633,7 @@ var imap_message_view_finished = function(msg_uid, detail, skip_links) {
$('#move_message').on("click", function(e) { return imap_move_copy(e, 'move', 'message');});
$('#copy_message').on("click", function(e) { return imap_move_copy(e, 'copy', 'message');});
$('#archive_message').on("click", function(e) { return imap_archive_message();});
$('#unread_message').on("click", function() { return inline_imap_unread_message(msg_uid, detail);});
};

var get_local_message_content = function(msg_uid, path) {
Expand Down
7 changes: 7 additions & 0 deletions modules/inline_message/site.js
Expand Up @@ -41,6 +41,10 @@ var inline_msg_prep_imap_delete = function(path, uid, details) {
return imap_delete_message(false, uid, details);
};

var inline_imap_unread_message = function(uid, details) {
return imap_unread_message(uid, details);
};

var inline_imap_msg = function(details, uid, list_path, inline_msg_loaded_callback) {
details['uid'] = uid;
var path = '.'+details['type']+'_'+details['server_id']+'_'+uid+'_'+details['folder'];
Expand Down Expand Up @@ -116,9 +120,11 @@ var update_imap_links = function(uid, details) {
$('#unflag_msg').off('click');
$('#flag_msg').off('click');
$('#delete_message').off('click');
$('#unread_message').off('click');
$('#delete_message').on("click", function() { return inline_msg_prep_imap_delete(path, uid, details); });
$('#flag_msg').on("click", function() { return imap_flag_message($(this).data('state'), uid, details); });
$('#unflag_msg').on("click", function() { return imap_flag_message($(this).data('state', uid, details)); });
$('#unread_message').on("click", function() { return inline_imap_unread_message(uid, details);});
};

var capture_subject_click = function() {
Expand Down Expand Up @@ -171,6 +177,7 @@ $(function() {
Hm_Ajax.add_callback_hook('*', capture_subject_click);
Hm_Ajax.add_callback_hook('ajax_imap_delete_message', msg_inline_close);
Hm_Ajax.add_callback_hook('ajax_imap_move_copy_action', msg_inline_close);
Hm_Ajax.add_callback_hook('ajax_imap_unread',msg_inline_close);
if (hm_list_path().substr(0, 4) === 'imap') {
Hm_Ajax.add_callback_hook('ajax_imap_folder_display', capture_subject_click);
}
Expand Down

0 comments on commit 53146db

Please sign in to comment.