Add "remember password" option

This commit is contained in:
Aleksander Machniak 2014-10-17 07:59:38 -04:00
parent 538edd1707
commit fa20f96c30
7 changed files with 47 additions and 5 deletions

View file

@ -385,6 +385,10 @@ function kolab_files_folder_mount_dialog()
}
});
$('.auth-options input', dialog).each(function() {
args[this.name] = this.type == 'checkbox' && !this.checked ? '' : this.value;
});
file_api.folder_mount(args);
kolab_dialog_close(this);
};
@ -1025,7 +1029,7 @@ function kolab_files_ui()
elem.html('').append(list);
this.env.folders = this.folder_list_parse(response.result ? response.result.list : []);
this.env.folders = this.folder_list_parse(response.result && response.result.list ? response.result.list : response.result);
$.each(this.env.folders, function(i, f) {
list.append(file_api.folder_list_row(i, f));
@ -1835,13 +1839,13 @@ function kolab_files_ui()
content = this.folder_list_auth_form(driver);
dialog.find('table.propform').remove();
dialog.append(content);
$('.options', dialog).before(content);
args.buttons[this.t('kolab_files.save')] = function() {
var data = {folder: label, list: 1};
$('input', dialog).each(function() {
data[this.name] = this.value;
data[this.name] = this.type == 'checkbox' && !this.checked ? '' : this.value;
});
file_api.open_dialog = this;

View file

@ -123,6 +123,7 @@ class kolab_files_engine
$this->rc->output->add_handlers(array(
'folder-create-form' => array($this, 'folder_create_form'),
'folder-mount-form' => array($this, 'folder_mount_form'),
'folder-auth-options'=> array($this, 'folder_auth_options'),
'file-search-form' => array($this, 'file_search_form'),
'file-edit-form' => array($this, 'file_edit_form'),
'filelist' => array($this, 'file_list'),
@ -243,7 +244,7 @@ class kolab_files_engine
$table->add(array('id' => $id, 'colspan' => 2, 'class' => 'source'), $row);
}
$out = $table->show();
$out = $table->show() . $this->folder_auth_options(array('suffix' => '-form'));
// add form tag around text field
if (empty($attrib['form'])) {
@ -258,6 +259,23 @@ class kolab_files_engine
return $out;
}
/**
* Template object for folder authentication options
*/
public function folder_auth_options($attrib)
{
$checkbox = new html_checkbox(array(
'name' => 'store_passwords',
'value' => '1',
'id' => 'auth-pass-checkbox' . $attrib['suffix'],
));
return html::div('auth-options', $checkbox->show(). ' '
. html::label('auth-pass-checkbox' . $attrib['suffix'], $this->plugin->gettext('storepasswords'))
. html::span('description', $this->plugin->gettext('storepasswordsdesc'))
);
}
/**
* Template object for file_edit form
*/

View file

@ -81,6 +81,9 @@ $labels['fileoverwrite'] = 'Overwrite';
$labels['fileoverwriteall'] = 'Overwrite all';
$labels['filemoveconfirm'] = 'This action is going to overwrite the destination file: <b>$file</b>.';
$labels['storepasswords'] = 'remember password';
$labels['storepasswordsdesc'] = 'Stored passwords will be encrypted. Enable this if you do not want to be asked for the password on every login or you want this storage to be available via WebDAV.';
$labels['arialabelsearchform'] = 'Files search form';
$labels['arialabelquicksearchbox'] = 'Search input';
$labels['arialabellistoptions'] = 'Files list options';

View file

@ -365,7 +365,6 @@ ul.toolbarmenu li span.saveas {
background: url(images/buttons.png) -5px -253px no-repeat;
}
table.propform td.source.selected {
background-color: #c7e3ef;
}
@ -400,3 +399,18 @@ table.propform td.source table.propform td {
padding: 2px 10px;
background-color: inherit;
}
.auth-options {
margin-top: 5px;
}
.auth-options .description {
color: #666;
display: block;
margin: 3px 0 0 25px;
}
.auth-options input,
.auth-options label {
vertical-align: middle;
}

View file

@ -28,4 +28,5 @@
<div id="files-folder-auth-dialog" role="dialog" aria-labelledby="aria-label-folderauthform" aria-hidden="true">
<h3 id="aria-label-folderauthform" class="voice"><roundcube:label name="kolab_files.arialabelfolderauthform" /></h3>
<roundcube:object name="folder-auth-options">
</div>

View file

@ -82,6 +82,7 @@
</div>
<div id="files-folder-auth-dialog" role="dialog" aria-labelledby="aria-label-folderauthform" aria-hidden="true">
<h3 id="aria-label-folderauthform" class="voice"><roundcube:label name="kolab_files.arialabelfolderauthform" /></h3>
<roundcube:object name="folder-auth-options">
</div>
<div id="listoptions" class="propform popupdialog" data-editable="true" role="dialog" aria-labelledby="aria-label-listoptions" aria-hidden="true">

View file

@ -20,6 +20,7 @@
<div id="files-folder-auth-dialog" role="dialog" aria-labelledby="aria-label-folderauthform" aria-hidden="true">
<h3 id="aria-label-folderauthform" class="voice"><roundcube:label name="kolab_files.arialabelfolderauthform" /></h3>
<roundcube:object name="folder-auth-options">
</div>
<script src="plugins/kolab_files/skins/larry/ui.js" type="text/javascript"></script>