piler/webui/view/javascript/piler.js

854 lines
21 KiB
JavaScript
Raw Normal View History

2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
var Piler =
{
/*
* which search type is active, it's set by clicking on the 'Search' button
*/
search:'',
// legacy variable(s)
expsrc: 0,
health_refresh: 60,
piler_ui_lang: 'en-GB', // TODO: it should be 'LANG' from config.php
prev_message_id: 0,
pos: -1,
/*
* variables used at search listing
*/
Shared: {
page:0,
sort:1,
order:'date',
type: 'search'
},
/*
* search data
*/
Searches:{},
/*
* message meta ids
*/
Messages:[],
/*
* System logger
*/
log:function( )
{
if ( window.console )
{
var
a = arguments,
b = +new Date,
c = window.console;
if ( !a.length )
c.clear();
else if ( a.length > 1 )
c.log(b, a[0], [].slice.call(arguments, 1));
// c.log(b, a[0], JSON.stringify([].slice.call(a, 1)));
else
c.log(b, a[0]);
}
},
/**
* Returns the javascript event source.
*
* @param {Object} a Javascript event
* @param {Logical} [b] If exist the event propagation NOT! stoped
*
* @return {Object<jQuery>} Javascript event source
**/
getSource:function( a, b )
{
Piler.log("[getSource]", a, b );
if ( !b )
{
try {
if ( a.stopPropagation )
a.stopPropagation();
else
a.cancelBubble = !0;
}
catch ( e )
{
Piler.log("[getSource]", e );
}
}
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
return $( a.target ? a.target : a.srcElement );
},
/*
* Change the list order.
*
* HTML: <a class="VALAMI" onclick="Piler.changeOrder(this)" xid="date" xorder="0"></a>
* CSS: .VALAMI {
* background: url("/view/theme/default/images/arrowup.gif") no-repeat scroll center center transparent;
* cursor: pointer;
* float: left;
* height: 10px;
* width: 10px;
* }
* @param {Object} a Javascript event
*
*/
changeOrder:function( a )
{
a = $( a );// a == DOM element
// a = Piler.getSource( a );// a == Javascript event
Piler.Shared.sort = a.attr('xid');// {String} (date|from|subject|size)
Piler.Shared.order = a.attr('xorder');// {Number} (0|1) -> (ASC|DESC)
Piler.log("[changeOrder]", Piler.Shared.sort, Piler.Shared.order);
Piler.load_search_results( );
},
/*
* load search results to div
*
*/
load_search_results:function( )
{
var url;
Piler.Shared.type == 'search' ? url = '/search-helper.php' : url = '/audit-helper.php';
Piler.log("[load_search_results]", url);
Piler.spinner('start');
jQuery.ajax( url, {
data: $.extend(!0, {}, Piler.Shared, Piler.Searches[Piler.search]),
type: "POST"
})
.done( function( a )// data, textStatus, jqXHR
{
$('#mailcontframe').html( a );
Piler.fill_current_messages_array();
Piler.spinner('stop');
$('#resultsheader').show();
})
.fail(function( a, b )// jqXHR, textStatus, errorThrown
{
alert("Problem retrieving XML data:" + b)
});
},
/*
* show/hide spinner
*/
spinner:function(cmd)
{
Piler.log("[spinner]", cmd);
if(cmd == 'start') {
$('#sspinner').show();
$('#messagelistcontainer').hide();
}
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
if(cmd == 'stop') {
$('#sspinner').hide();
$('#messagelistcontainer').show();
}
},
2012-02-08 23:14:28 +01:00
2012-09-06 15:27:20 +02:00
2013-02-11 20:24:19 +01:00
/*
* save current search criteria
*/
2012-09-06 15:27:20 +02:00
2013-02-11 20:24:19 +01:00
saved_search_terms:function(msg)
{
Piler.log("[saved_search_terms]");
2012-09-06 15:27:20 +02:00
2013-02-11 20:24:19 +01:00
jQuery.ajax( '/index.php?route=search/save', {
data: $.extend(!0, { }, Piler.Shared, Piler.Searches[Piler.search], {save: '1'} ),
type: "POST"
})
.done( function( a )
{
})
.fail(function( a, b )
{
alert("Problem retrieving XML data:" + b)
});
2012-02-10 14:06:00 +01:00
2013-02-11 20:24:19 +01:00
Piler.show_message('messagebox1', msg, 0.85);
},
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
/*
* load saved search criteria list by ajax
*/
2012-09-17 16:49:27 +02:00
2013-02-11 20:24:19 +01:00
load_saved_search_terms:function()
{
Piler.log("[load_saved_search_terms]");
2012-09-17 16:49:27 +02:00
2013-02-11 20:24:19 +01:00
jQuery.ajax( '/index.php?route=search/load', {
})
.done( function( a )
{
$('#mailcontframe').html( a );
})
.fail(function( a, b )
{
alert("Problem retrieving XML data:" + b)
});
},
2012-09-15 15:30:35 +02:00
2013-02-11 20:24:19 +01:00
/*
* load the selected message to preview area
*/
2012-09-06 15:27:20 +02:00
2013-02-11 20:24:19 +01:00
view_message:function(pos)
{
Piler.log("[view_message]", pos, Piler.Messages[pos]);
2012-09-06 15:27:20 +02:00
2013-02-11 20:24:19 +01:00
id = Piler.Messages[pos];
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
Piler.pos = pos;
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
Piler.log("[view_message]", id);
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
if(Piler.prev_message_id > 0) { $('#e_' + Piler.prev_message_id).attr('class', 'resultrow'); }
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
$('#e_' + id).attr('class', 'resultrow selected');
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
Piler.prev_message_id = id;
2013-02-11 20:24:19 +01:00
jQuery.ajax('/message.php/' + id, { cache: true })
.done( function(a) {
$('#mailpreviewframe').html(a);
})
.fail(function(a, b) { alert("Problem retrieving XML data:" + b) });
},
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
view_headers:function(id)
{
Piler.log("[view_headers]");
Piler.load_url_to_preview_pane('/index.php?route=message/headers&id=' + id);
},
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
restore_message:function(id)
{
Piler.log("[restore_message]");
Piler.load_url_to_preview_pane('/index.php?route=message/restore&id=' + id);
},
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
bulk_restore_messages:function(msg)
{
Piler.log("[bulk_restore_messages]");
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
var idlist = Piler.get_selected_messages_list();
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
if(!idlist) return;
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
jQuery.ajax('/bulkrestore.php', {
data: { download: '0', idlist: idlist },
type: "POST"
})
.done( function( a ) {})
.fail(function( a, b ) { alert("Problem retrieving XML data:" + b) });
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
Piler.show_message('messagebox1', msg, 0.8);
},
2012-02-10 14:06:00 +01:00
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
/*
* bulk toggle all the checkboxes for the result set
*/
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
toggle_bulk_check:function()
{
Piler.log("[toggle_bulk_check]", Piler.Messages.length);
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
$('#bulkcheck').prop('checked') ? bulkcheck = 1 : bulkcheck = 0;
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
Piler.log("[toggle_bulk_check], bulkcheck=", bulkcheck);
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
for(i=0; i<Piler.Messages.length; i++) {
bulkcheck == 1 ? $("#r_" + Piler.Messages[i]).prop('checked', true) : $("#r_" + Piler.Messages[i]).prop('checked', false);
}
},
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
add_note_to_message:function(id, msg)
{
Piler.log("[add_note_to_message]", id, msg);
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
jQuery.ajax('index.php?route=message/note', {
data: { id: id, note: encodeURI($('#note').val()) },
type: "POST"
})
.done( function(a) {})
.fail(function(a, b) { alert("Problem retrieving XML data:" + b) });
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
Piler.show_message('messagebox1', msg, 0.85);
},
2012-02-10 14:06:00 +01:00
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
tag_search_results:function(msg)
{
Piler.log("[tag_search_results]", msg);
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
var idlist = Piler.get_selected_messages_list();
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
if(!idlist) return;
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
jQuery.ajax('index.php?route=search/tag', {
data: { tag: encodeURI($('#tag_value').val()), idlist: idlist },
type: "POST"
})
.done( function(a) {})
.fail(function(a, b) { alert("Problem retrieving XML data:" + b) });
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
Piler.show_message('messagebox1', msg, 0.85);
},
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
/*
* load the given url to the preview pane
*/
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
load_url_to_preview_pane:function(url)
{
Piler.log("[load_url_to_preview_pane]", url);
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
jQuery.ajax(url, { cache: true })
.done( function(a) { $('#mailpreviewframe').html(a); })
.fail(function(a, b) { alert("Problem retrieving XML data:" + b) });
},
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
/*
* return a comma separated list of selected messages
*/
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
get_selected_messages_list:function()
{
Piler.log("[get_selected_messages_list]");
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
var idlist = '';
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
for(i=0; i<Piler.Messages.length; i++) {
if($('#r_' + Piler.Messages[i]).prop('checked')) {
if(idlist) idlist += ",";
idlist += Piler.Messages[i];
//Piler.log("[selected message, id:]", Piler.Messages[i]);
}
}
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
Piler.log("[get_selected_messages_list], result:", idlist);
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
return idlist;
},
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
/*
* fill Messages array with search results
*/
fill_current_messages_array:function()
{
Piler.log("[fill_current_messages_array]" );
var z = $('#results').children(), y = z.length, x;
var u = [];
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
Piler.log("[fill_current_messages_array] y", y );
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
for (i=0; i<y; i++)
{
x = z[i];
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
if ( x.nodeName == "DIV" && x.id.charAt( 0 ) == 'e' && x.id.charAt( 1 ) == '_' )
{
Piler.log("[fill_current_messages_array], i/id", i, x.id.substring(2, 1000));
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
u[i] = x.id.substring(2, 1000);
}
}
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
Piler.Messages = u;
Piler.pos = -1;
Piler.prev_message_id = 0;
},
2012-02-08 23:14:28 +01:00
2013-02-11 20:24:19 +01:00
show_next_message:function()
{
if(Piler.pos < Piler.Messages.length-1) { Piler.pos++; }
2012-03-10 14:52:50 +01:00
2013-02-11 20:24:19 +01:00
Piler.log("[show_next_message]", Piler.pos);
2012-03-10 14:52:50 +01:00
2013-02-11 20:24:19 +01:00
Piler.view_message(Piler.pos);
},
2012-03-10 14:52:50 +01:00
2013-02-11 20:24:19 +01:00
show_prev_message:function()
{
if(Piler.pos > 0) { Piler.pos--; }
2012-03-10 14:52:50 +01:00
2013-02-11 20:24:19 +01:00
Piler.log("[show_prev_message]", Piler.pos);
2012-03-10 14:52:50 +01:00
2013-02-11 20:24:19 +01:00
Piler.view_message(Piler.pos);
},
2012-03-10 14:52:50 +01:00
2013-02-11 20:24:19 +01:00
/*
* load the search results for a saved query
* TODO: fix searchtype, it can be even 'complex', too
*/
2012-03-10 14:52:50 +01:00
2013-02-11 20:24:19 +01:00
load_search_results_for_saved_query:function(terms)
{
Piler.log("[load_search_results_for_saved_query]", terms);
2012-03-10 14:52:50 +01:00
2013-02-11 20:24:19 +01:00
var pairs = terms.split('&');
$.each(pairs, function(i, v){
var pair = v.split('=');
if(pair[0] == 'search') {
$("input#_search").val(pair[1]);
}
});
2012-05-07 09:38:47 +02:00
2013-02-11 20:24:19 +01:00
Piler.expsrc++;
$('#_search').css('color', 'black');
2012-05-07 09:38:47 +02:00
2013-02-11 20:24:19 +01:00
Piler.expert();
},
2012-05-07 09:38:47 +02:00
2013-02-11 20:24:19 +01:00
/*
* expert search
*
* HTML: <button onclick="Piler.simple(this)">Search</button>
* <button onclick="script:var a=document.getElementById('ref'); if(a) a.value=''; a = document.getElementById('prefix'); if(a) a.value='';
* load_search_results('http://demo.mailpiler.org/search-helper.php', assemble_search_term(count), 0);"
* style="margin-left: 10px; margin-right: 0px; height: 20px; width: 70px;" class="active" id="button_search">Search</button>
**/
expert:function( )// a )
{
Piler.log("[expert]")//, a );
2012-05-07 09:38:47 +02:00
2013-02-11 20:24:19 +01:00
// a = $( a );// a == DOM element
// a = Piler.getSource( a );// a == Javascript event
2012-05-07 09:38:47 +02:00
2013-02-11 20:24:19 +01:00
$('#prefix').val('');
2012-05-07 09:38:47 +02:00
2013-02-11 20:24:19 +01:00
Piler.search = 'Expert';
Piler.Shared.page = 0;
Piler.Shared.type = 'search';
Piler.Searches.Expert = {
search : $('input#_search').val().trim(),
searchtype : 'expert',
ref: $('#ref').val()
}
$('#ref').val('');
Piler.load_search_results();
},
/**
* complex search
*
* HTML: <button id="simple" class="active" onclick="Piler.complex(this)">Search</button>
* CSS: #expert { margin-left: 10px; margin-right: 0px; height: 20px; width: 70px; }
*
**/
complex:function( )// a )
{
Piler.log("[complex]")//, a );
// a = $( a );// a == DOM element
// a = Piler.getSource( a );// a == Javascript event
var z = $('div#searchpopup1');
Piler.search = 'Complex';
Piler.Shared.page = 0;
Piler.Shared.type = 'search';
Piler.Searches.Complex = {
from : $('input#xfrom', z).val().trim(),
to : $('input#xto', z).val().trim(),
subject : $('input#xsubject', z).val().trim(),
body : $('input#xbody', z).val().trim(),
tag : $('input#xtag', z).val().trim(),
note : $('input#xnote', z).val().trim(),
attachment_type : $('input#xhas_attachment', z)[0].checked ? 'any' : '',
date1 : $('input#date1', z).val().trim(),
date2 : $('input#date2', z).val().trim(),
searchtype : 'simple'
}
Piler.load_search_results();//, Piler.assemble_search_term( count ), 0);
$('#searchpopup1').hide();
},
/*
* paging function
*
* HTML: <a onclick="Piler.navigation(${PHP_PAGE})" class="navlink">${next page}</a>
*
*/
navigation:function( a )
{
Piler.log("[navigation]")//, a );
// a = $( a );// a == DOM element
// a = Piler.getSource( a );// a == Javascript event
Piler.Shared.page = a;
Piler.load_search_results();
},
/*
* reset search fields
*
* HTML: <input type="button" onclick="Piler.cancel()" value="Cancel">
* CSS: input.advsecondary[type="button"]{ height: 20px; width: 70px; }
*/
cancel:function( )//a )
{
Piler.log("[cancel]")//, a );
// a = $( a );// a == DOM element
// a = Piler.getSource( a );// a == Javascript event
$('#_search').val('');
$('#ref').val( '' );
Piler.Searches.Expert = {};
$('input#xfrom').val('');
$('input#xto').val('');
$('input#xsubject').val('');
$('input#xbody').val('');
$('input#xtag').val('');
$('input#xnote').val('');
$('input#xhas_attachment')[0].checked = 0;
$('input#date1').val('');
$('input#date2').val('');
Piler.Searches.Complex = {};
},
/*
* show a temporary message to the user
*/
show_message:function(id, msg, timeout)
{
msg = '<p>' + msg.replace("\n", "<br />") + '</p>';
Piler.log("[show_message]", id, msg);
$('#'+id).html(msg);
$('#'+id).show();
setTimeout(function() { $('#'+id).hide(); }, timeout*1000);
},
load_health:function()
{
Piler.log("[load_health]");
document.body.style.cursor = 'wait';
jQuery.ajax('/index.php?route=health/worker', { })
.done( function(a) {
$('#A1').html(a);
document.body.style.cursor = 'default';
})
.fail(function(a, b) { alert("Problem retrieving XML data:" + b) });
setInterval('Piler.load_health()', Piler.health_refresh * 1000);
},
/*
* show a hint message for an autocomplete field on user/group editing
*/
toggle_hint:function(id, s, focus)
{
Piler.log("[toggle_hint]", id);
if(focus == 1){
if($('#' + id).val() == s) $('#' + id).val('');
}
else {
if($('#' + id).val() == '') $('#' + id).val(s);
}
},
2012-05-07 09:38:47 +02:00
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
/*
* toggle the class of the main search field
*/
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
toggle_search_class:function()
{
Piler.log("[toggle_search_class]");
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
if(Piler.expsrc == 0) {
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
$('#_search').val('');
$('#_search').css('color', 'black');
Piler.expsrc++;
}
},
2012-05-07 09:38:47 +02:00
2013-02-11 20:24:19 +01:00
/*
* assemble a space separated list of the selected email addresses of the given message
*/
2012-05-07 09:38:47 +02:00
2013-02-11 20:24:19 +01:00
restore_message_for_recipients:function(id, msgok, msgerr)
{
Piler.log("[restore_message_for_recipients]", id);
2012-05-07 09:38:47 +02:00
2013-02-11 20:24:19 +01:00
var z = $('#restorebox').children(), y = z.length, x;
var emails = '';
2012-05-07 09:38:47 +02:00
2013-02-11 20:24:19 +01:00
for ( ; --y >= 0 ; )
{
x = z[y];
2012-05-07 09:38:47 +02:00
2013-02-11 20:24:19 +01:00
if (x.id.substring(0, 5) == "rcpt_" )
{
if(document.getElementById(x.id).checked == 1){
if(emails) emails += ' ';
emails += x.id.substring(5, 1000);
}
2012-05-07 09:38:47 +02:00
}
2013-02-11 20:24:19 +01:00
}
2012-05-07 09:38:47 +02:00
2013-02-11 20:24:19 +01:00
if(emails) {
jQuery.ajax('index.php?route=message/restore', {
data: { rcpt: encodeURI(emails), id: id },
type: "POST"
})
.done( function(a) {})
.fail(function(a, b) { alert("Problem retrieving XML data:" + b) });
2012-05-07 09:38:47 +02:00
2013-02-11 20:24:19 +01:00
Piler.show_message('messagebox1', msgok, 0.85);
$('#restorebox').hide();
}
else {
Piler.show_message('messagebox1', msgerr, 0.85);
}
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
},
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
download_messages:function()
{
var idlist = Piler.get_selected_messages_list();
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
Piler.log("[download_selected_emails]", idlist);
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
if(idlist) {
var form = document.createElement("form");
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
form.setAttribute("method", "post");
form.setAttribute("action", '/bulkrestore.php');
form.setAttribute("name", "download");
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
var hiddenField = document.createElement("input");
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", "download");
hiddenField.setAttribute("value", "1");
form.appendChild(hiddenField);
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
hiddenField = document.createElement("input");
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", "idlist");
hiddenField.setAttribute("value", idlist);
form.appendChild(hiddenField);
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
document.body.appendChild(form);
form.submit();
}
},
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
auditexpert:function()
{
Piler.log("[auditexpert]");
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
Piler.search = 'Expert';
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
Piler.Shared.page = 0;
Piler.Shared.type = 'audit';
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
Piler.Searches.Expert = {
search : $('input#_search').val().trim(),
searchtype : 'expert'
}
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
Piler.load_search_results();
},
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
/*
* add shortcuts on the search page
*/
2012-05-11 23:42:55 +02:00
2013-02-11 20:24:19 +01:00
add_shortcuts:function()
{
Piler.log("[add_shortcuts]");
2012-05-07 09:38:47 +02:00
2013-02-11 20:24:19 +01:00
$(document).keypress(function(e){
if(e.which == 13){
$("#button_search").click();
}
2012-03-10 14:52:50 +01:00
2013-02-11 20:24:19 +01:00
// 37: left, 38: up, 39: right, 40: down
2012-06-27 11:17:23 +02:00
2013-02-11 20:24:19 +01:00
if(e.keyCode == 38){
Piler.show_prev_message();
}
2012-06-27 11:17:23 +02:00
2013-02-11 20:24:19 +01:00
if(e.keyCode == 40){
Piler.show_next_message();
}
2012-06-27 11:17:23 +02:00
2013-02-11 20:24:19 +01:00
});
2012-06-27 11:17:23 +02:00
2013-02-11 20:24:19 +01:00
}
2013-01-05 16:42:36 +01:00
}
2013-02-11 20:24:19 +01:00
var split = new rcube_webmail();
2013-02-11 20:24:19 +01:00
$.datepicker.setDefaults($.datepicker.regional[Piler.piler_ui_lang]);
2012-02-08 23:14:28 +01:00
$(function() {
$("#s_piler_email").autocomplete({
2013-02-11 20:24:19 +01:00
source: '/index.php?route=group/email&',
minLength: 2,
select: function( event, ui ) {
if(ui.item){
var prefix = '\n';
2013-02-11 20:24:19 +01:00
if($('#email').val() == '') prefix = '';
$('#email').val($('#email').val() + prefix + ui.item.value);
}
ui.item.value = '';
}
});
2013-01-05 16:42:36 +01:00
$("#s_piler_domain").autocomplete({
2013-02-11 20:24:19 +01:00
source: '/index.php?route=domain/domains&',
2013-01-05 16:42:36 +01:00
minLength: 2,
select: function( event, ui ) {
if(ui.item){
var prefix = '\n';
2013-02-11 20:24:19 +01:00
if($('#domains').val() == '') prefix = '';
2013-01-05 16:42:36 +01:00
$('#domains').val($('#domains').val() + prefix + ui.item.value);
}
ui.item.value = '';
}
});
$("#s_piler_group").autocomplete({
2013-02-11 20:24:19 +01:00
source: '/index.php?route=group/group&',
minLength: 2,
select: function( event, ui ) {
if(ui.item){
var prefix = '\n';
2013-02-11 20:24:19 +01:00
if($('#group').val() == '') prefix = '';
$('#group').val($('#group').val() + prefix + ui.item.value);
}
ui.item.value = '';
}
});
2012-09-06 15:27:20 +02:00
$("#s_piler_folder").autocomplete({
2013-02-11 20:24:19 +01:00
source: '/index.php?route=folder/folder&',
2012-09-06 15:27:20 +02:00
minLength: 2,
select: function( event, ui ) {
if(ui.item){
var prefix = '\n';
2013-02-11 20:24:19 +01:00
if($('#folder').val() == '') prefix = '';
2012-09-06 15:27:20 +02:00
$('#folder').val($('#folder').val() + prefix + ui.item.value);
}
ui.item.value = '';
}
});
2012-09-15 15:30:35 +02:00
2013-02-11 20:24:19 +01:00
$("ul.dropdown li").hover(function(){
$(this).addClass("hover");
$('ul:first',this).css('visibility', 'visible');
}, function(){
$(this).removeClass("hover");
$('ul:first',this).css('visibility', 'hidden');
});
2013-02-11 20:24:19 +01:00
$("#date1").datepicker( {dateFormat: 'yy-mm-dd' });
$("#date2").datepicker( {dateFormat: 'yy-mm-dd' });
2013-02-11 20:24:19 +01:00
});