Display contact import and advanced search in popup dialogs

pull/5838/head
Aleksander Machniak 8 years ago
parent 879f1dd2a0
commit 2d9444bef0

@ -932,11 +932,8 @@ function rcube_webmail()
case 'save':
var input, form = this.gui_objects.editform;
if (form) {
// adv. search
if (this.env.action == 'search') {
}
// user prefs
else if ((input = $("input[name='_pagesize']", form)) && input.length && isNaN(parseInt(input.val()))) {
if ((input = $("input[name='_pagesize']", form)) && input.length && isNaN(parseInt(input.val()))) {
alert(this.get_label('nopagesizewarning'));
input.focus();
break;
@ -1349,19 +1346,41 @@ function rcube_webmail()
break;
case 'import':
if (this.env.action == 'import' && this.gui_objects.importform) {
var file = document.getElementById('rcmimportfile');
if (file && !file.value) {
alert(this.get_label('selectimportfile'));
aborted = true;
break;
}
this.gui_objects.importform.submit();
this.set_busy(true, 'importwait');
this.lock_form(this.gui_objects.importform, true);
}
else
this.goto_url('import', (this.env.source ? '_target='+urlencode(this.env.source)+'&' : ''));
var reload = false,
dialog = $('<iframe>').attr('src', this.url('import', {_framed: 1, _target: this.env.source})),
import_func = function(e) {
var win = dialog[0].contentWindow,
form = win.rcmail.gui_objects.importform;
if (form) {
var lock, file = win.$('#rcmimportfile')[0];
if (file && !file.value) {
alert(win.rcmail.get_label('selectimportfile'));
return;
}
lock = win.rcmail.set_busy(true, 'importwait');
$('input[name="_unlock"]', form).val(lock);
form.submit();
win.rcmail.lock_form(form, true);
// disable Import button
$(e.target).attr('disabled', true);
reload = true;
}
},
close_func = function(event, ui) {
$(this).remove();
if (reload)
ref.command('list');
};
this.simple_dialog(dialog, this.gettext('importcontacts'), import_func, {
close: close_func,
button: 'import',
width: 500,
height: 300
});
break;
case 'export':
@ -6539,15 +6558,28 @@ function rcube_webmail()
// load advanced search page
this.advanced_search = function()
{
var win, url = {_form: 1, _action: 'search'}, target = window;
var dialog = $('<iframe>').attr('src', this.url('search', {_form: 1, _framed: 1})),
search_func = function() {
var valid = false, form = {_adv: 1};
if (win = this.get_frame_window(this.env.contentframe)) {
url._framed = 1;
target = win;
this.contact_list.clear_selection();
}
$.each($(dialog[0].contentWindow.rcmail.gui_objects.editform).serializeArray(), function() {
if (this.name.match(/^_search/) && this.value != '') {
form[this.name] = this.value;
valid = true;
}
});
this.location_href(url, target, true);
if (valid) {
ref.http_post('search', form, ref.set_busy(true, 'searching'));
return true;
}
};
this.simple_dialog(dialog, this.gettext('advsearch'), search_func, {
button: 'search',
width: 600,
height: 500
});
return true;
};
@ -7605,8 +7637,11 @@ function rcube_webmail()
var popup = $('<div class="popup">');
if (typeof content == 'object')
if (typeof content == 'object') {
popup.append(content);
if ($(content).is('iframe'))
popup.addClass('iframe');
}
else
popup.html(content);

@ -261,7 +261,8 @@ function rcmail_directory_list($attrib)
// add some labels to client
$OUTPUT->add_label('deletegroupconfirm', 'groupdeleting', 'addingmember', 'removingmember',
'newgroup', 'grouprename', 'searchsave', 'namex', 'save'
'newgroup', 'grouprename', 'searchsave', 'namex', 'save', 'import', 'importcontacts',
'advsearch', 'search'
);
return html::tag('ul', $attrib, $out, html::$common_attrib);

@ -180,12 +180,15 @@ $OUTPUT->set_pagetitle($RCMAIL->gettext('importcontacts'));
$OUTPUT->add_handlers(array(
'importstep' => $importstep,
'importnav' => 'rcmail_import_buttons',
));
// render page
$OUTPUT->send('importcontacts');
if ($OUTPUT->template_exists('contactimport')) {
$OUTPUT->send('contactimport');
}
else {
$OUTPUT->send('importcontacts'); // deprecated
}
/**
@ -227,6 +230,8 @@ function rcmail_import_form($attrib)
$form .= $abook->show();
}
$form .= html::tag('input', array('type' => 'hidden', 'name' => '_unlock', 'value' => ''));
// selector for group import options
if (count($writable_books) >= 1 || $writable_books[0]->groups) {
$select = new html_select(array('name' => '_groups', 'id' => 'rcmimportgroups', 'is_escaped' => true));
@ -291,33 +296,6 @@ function rcmail_import_confirm($attrib)
return html::div($attrib, $content);
}
/**
* Create navigation buttons for the current import step
*/
function rcmail_import_buttons($attrib)
{
global $IMPORT_STATS, $OUTPUT;
$target = rcube_utils::get_input_value('_target', rcube_utils::INPUT_GPC);
$attrib += array('type' => 'input');
unset($attrib['name']);
if (is_object($IMPORT_STATS)) {
$attrib['class'] = trim($attrib['class'] . ' mainaction');
$out = $OUTPUT->button(array('command' => 'list', 'prop' => $target, 'label' => 'done') + $attrib);
}
else {
$cancel = $OUTPUT->button(array('command' => 'list', 'label' => 'cancel') + $attrib);
$attrib['class'] = trim($attrib['class'] . ' mainaction');
$out = $OUTPUT->button(array('command' => 'import', 'label' => 'import') + $attrib);
$out .= '&nbsp;';
$out .= $cancel;
}
return $out;
}
/**
* Returns the matching group id. If group doesn't exist, it'll be created if allowed.
*/

@ -240,16 +240,6 @@ function rcmail_contact_search()
// Re-set list header
$OUTPUT->command('set_group_prop', null);
if ($adv) {
$OUTPUT->command('parent.set_env', array(
'search_request' => $search_request,
'pagecount' => ceil($result->count / $PAGE_SIZE),
'search_id' => $sid,
'source' => '',
'group' => '',
));
}
if (!$sid) {
// unselect currently selected directory/group
$OUTPUT->command('unselect_directory');
@ -259,7 +249,7 @@ function rcmail_contact_search()
$OUTPUT->command('update_group_commands');
// send response
$OUTPUT->send($adv ? 'iframe' : null);
$OUTPUT->send();
}
function rcmail_contact_search_form($attrib)

@ -671,6 +671,18 @@ img.uploading
margin-left: 10px;
}
.ui-dialog iframe {
width: 100%;
height: 100%;
border: 0;
}
.ui-dialog-content.iframe {
padding: 0 !important;
overflow: hidden !important;
}
/***** common table settings ******/
table.records-table thead tr th,

@ -7,10 +7,8 @@
</head>
<body class="iframe">
<div id="contact-title" class="boxtitle"><roundcube:label name="advsearch" /></div>
<div id="contact-details" class="boxcontent">
<div class="boxcontent">
<roundcube:object name="searchform" id="advsearchform" size=30 />
<p><roundcube:button command="save" type="input" class="button mainaction" label="search" /></p>
</div>
<script type="text/javascript">rcube_init_tabs('advsearchform')</script>

@ -4,22 +4,10 @@
<title><roundcube:object name="pagetitle" /></title>
<roundcube:include file="/includes/links.html" />
</head>
<body>
<roundcube:include file="/includes/taskbar.html" />
<roundcube:include file="/includes/header.html" />
<div id="mainscreen" class="box darkbg">
<div class="boxtitle"><roundcube:label name="importcontacts" /></div>
<body class="iframe">
<div class="boxcontent">
<roundcube:object name="importstep" />
<p><br />
<roundcube:object name="importnav" class="button" />
</p>
</div>
</div>
</body>

@ -2527,6 +2527,17 @@ ul.toolbarmenu li span.copy {
margin: 8px 0;
}
.ui-dialog iframe {
width: 100%;
height: 100%;
border: 0;
}
.ui-dialog-content.iframe {
padding: 0 !important;
overflow: hidden !important;
}
.hint {
margin: 4px 0;
color: #999;

@ -4,15 +4,12 @@
<title><roundcube:object name="pagetitle" /></title>
<roundcube:include file="/includes/links.html" />
</head>
<body class="iframe">
<body class="iframe fullheight">
<h1 class="boxtitle"><roundcube:label name="advsearch" /></h1>
<h1 class="voice"><roundcube:label name="addressbook" /> : <roundcube:label name="advsearch" /></h1>
<div id="contact-details" class="boxcontent">
<roundcube:object name="searchform" id="advsearchform" class="tabbed" size=30 />
<p class="formbuttons">
<roundcube:button command="save" type="input" class="button mainaction" label="search" />
</p>
</div>
<roundcube:include file="/includes/footer.html" />

@ -4,31 +4,12 @@
<title><roundcube:object name="pagetitle" /></title>
<roundcube:include file="/includes/links.html" />
</head>
<roundcube:if condition="env:extwin" /><body class="extwin"><roundcube:else /><body><roundcube:endif />
<roundcube:include file="/includes/header.html" />
<div id="mainscreen">
<body class="iframe fullheight">
<h1 class="voice"><roundcube:label name="addressbook" /> : <roundcube:label name="importcontacts" /></h1>
<h2 id="aria-label-toolbar" class="voice"><roundcube:label name="arialabeltoolbar" /></h2>
<div id="addressbooktoolbar" class="toolbar" role="toolbar" aria-labelledby="aria-label-toolbar">
<roundcube:button command="list" type="link" class="button back disabled" classAct="button back" classSel="button back pressed" label="back" />
</div>
<div id="mainscreencontent" class="uibox contentbox">
<h2 class="boxtitle"><roundcube:label name="importcontacts" /></h2>
<div id="import-box" class="boxcontent">
<roundcube:object name="importstep" class="propform" />
<br/>
<p class="formbuttons">
<roundcube:object name="importnav" class="button" />
</p>
</div>
</div>
<div class="boxcontent">
<roundcube:object name="importstep" class="propform" />
</div>
<roundcube:include file="/includes/footer.html" />

Loading…
Cancel
Save