Skip to content

Commit

Permalink
Fixed redirection to server page when cypht is used as plugin in tiki
Browse files Browse the repository at this point in the history
  • Loading branch information
josaphatim committed Apr 15, 2024
1 parent 8409da5 commit a718ea7
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 21 deletions.
3 changes: 1 addition & 2 deletions modules/contacts/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ var add_contact_from_message_view = function() {
function (res) {
$('.add_contact_controls').toggle();
window.location.reload();
remove_message_content();
}
);
}
Expand Down Expand Up @@ -251,7 +250,7 @@ if (hm_page_name() == 'contacts') {
return false;
});
$('.reset_contact').on("click", function() {
window.location.href = '?page=contacts';
Hm_Utils.redirect('?page=contacts');
});
$('.server_title').on("click", function() {
$(this).next().toggle();
Expand Down
7 changes: 7 additions & 0 deletions modules/core/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -1681,6 +1681,13 @@ var Hm_Utils = {
var style = window.getComputedStyle(elem);
return style.display !== 'none' && style.visibility !== 'hidden' && elem.offsetWidth > 0 && elem.offsetHeight > 0;
},

redirect: function (path) {
if (! path) {
path = window.location.href;
}
window.location.href = path;
}
};

var Hm_Crypt = {
Expand Down
28 changes: 14 additions & 14 deletions modules/imap/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,14 @@ var imap_delete_message = function(state, supplied_uid, supplied_detail) {
remove_from_cached_imap_pages(msg_cache_key);
var nlink = $('.nlink');
if (nlink.length && Hm_Utils.get_from_global('auto_advance_email_enabled')) {
window.location.href = nlink.attr('href');
Hm_Utils.redirect(nlink.attr('href'));
}
else {
if (!hm_list_parent()) {
window.location.href = "?page=message_list&list_path="+hm_list_path();
Hm_Utils.redirect("?page=message_list&list_path="+hm_list_path());
}
else {
window.location.href = "?page=message_list&list_path="+hm_list_parent();
Hm_Utils.redirect("?page=message_list&list_path="+hm_list_parent());
}
}
}
Expand Down Expand Up @@ -208,14 +208,14 @@ var imap_unread_message = function(supplied_uid, supplied_detail) {
}
var nlink = $('.nlink');
if (nlink.length && Hm_Utils.get_from_global('auto_advance_email_enabled')) {
window.location.href = nlink.attr('href');
Hm_Utils.redirect(nlink.attr('href'));
}
else {
if (!hm_list_parent()) {
window.location.href = "?page=message_list&list_path="+hm_list_path();
Hm_Utils.redirect("?page=message_list&list_path="+hm_list_path());
}
else {
window.location.href = "?page=message_list&list_path="+hm_list_parent();
Hm_Utils.redirect("?page=message_list&list_path="+hm_list_parent());
}
}
},
Expand Down Expand Up @@ -976,16 +976,16 @@ var imap_perform_move_copy = function(dest_id, context) {
if (action == 'move') {
var nlink = $('.nlink');
if (nlink.length && Hm_Utils.get_from_global('auto_advance_email_enabled')) {
window.location.href = nlink.attr('href');
Hm_Utils.redirect(nlink.attr('href'));
}
else {
if(hm_page_name() == 'search'){
if (hm_page_name() == 'search') {
window.location.reload();
}
else if(hm_page_name() == 'advanced_search'){
else if (hm_page_name() == 'advanced_search'){
process_advanced_search();
}else{
window.location.href = "?page=message_list&list_path="+hm_list_parent();
} else {
Hm_Utils.redirect("?page=message_list&list_path="+hm_list_parent());
}
}
}
Expand Down Expand Up @@ -1237,14 +1237,14 @@ var imap_archive_message = function(state, supplied_uid, supplied_detail) {
}
var nlink = $('.nlink');
if (nlink.length && Hm_Utils.get_from_global('auto_advance_email_enabled')) {
window.location.href = nlink.attr('href');
Hm_Utils.redirect(nlink.attr('href'));
}
else {
if (!hm_list_parent()) {
window.location.href = "?page=message_list&list_path="+hm_list_path();
Hm_Utils.redirect("?page=message_list&list_path="+hm_list_path());
}
else {
window.location.href = "?page=message_list&list_path="+hm_list_parent();
Hm_Utils.redirect("?page=message_list&list_path="+hm_list_parent());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion modules/keyboard_shortcuts/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ $(function() {
}
if (hm_page_name() == 'shortcuts') {
$('.reset_shortcut').on("click", function() {
window.location.href = '?page=shortcuts';
Hm_Utils.redirect('?page=shortcuts');
});
}
});
6 changes: 2 additions & 4 deletions modules/nux/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,11 @@ var display_final_nux_step = function(res) {
[{'name': 'hm_ajax_hook', 'value': 'ajax_imap_accept_special_folders'},
{'name': 'imap_server_id', value: res.nux_server_id},
{'name': 'imap_service_name', value: res.nux_service_name}],
function(res) {
window.location.href = "?page=servers";
}
false
);
}

window.location.href = "?page=servers";
Hm_Utils.redirect();
}
};

Expand Down

0 comments on commit a718ea7

Please sign in to comment.