Use templates engine for plugin dialogs content

This commit is contained in:
Aleksander Machniak 2013-02-19 15:29:43 +01:00
parent fab095205e
commit 2850592d9c
6 changed files with 34 additions and 11 deletions

View file

@ -15,9 +15,6 @@ window.rcmail && rcmail.addEventListener('init', function() {
input.val(rcmail.gettext('kolab_files.fromcloud'))
.click(function() { kolab_files_selector_dialog(); })
.appendTo(elem);
var dialog = $('<div id="files-compose-dialog"></div>').hide();
$('body').append(dialog);
}
// mail preview
else if (rcmail.env.action == 'show' || rcmail.env.action == 'preview') {
@ -28,9 +25,6 @@ window.rcmail && rcmail.addEventListener('init', function() {
.text(rcmail.gettext('kolab_files.saveall'))
.click(function() { kolab_directory_selector_dialog(); })
.appendTo(attachment_list);
var dialog = $('<div id="files-dialog"></div>').hide();
$('body').append(dialog);
}
}
@ -84,7 +78,7 @@ function kolab_directory_selector_dialog()
minHeight: 300,
height: 250,
width: 250
}).html('<div id="files-folder-selector"></div>').show();
}).show();
file_api.folder_selector();
};
@ -134,7 +128,7 @@ function kolab_files_selector_dialog()
minHeight: 300,
width: 600,
height: 400
}).html('<div id="files-folder-selector"></div><div id="files-file-selector"><table id="filelist"><tbody></tbody></table></div>').show();
}).show();
file_api.folder_selector();
};

View file

@ -103,8 +103,8 @@ class kolab_files extends rcube_plugin
*/
public function actions()
{
$this->load_config();
$engine = $this->engine();
if ($engine = $this->engine()) {
$engine->actions();
}
}
}

View file

@ -51,6 +51,21 @@ class kolab_files_engine
$this->plugin->include_stylesheet($this->url . '/skins/default/images/mimetypes/style.css');
$this->plugin->include_script($this->url . '/js/files_api.js');
$this->plugin->include_script('kolab_files.js');
// add dialogs
if ($this->rc->task = 'mail') {
if ($this->rc->action == 'compose') {
$template = 'compose_plugin';
}
else if ($this->rc->action == 'show' || $this->rc->action == 'preview') {
$template = 'message_plugin';
}
}
if (!empty($template)) {
$this->rc->output->add_footer(
$this->rc->output->parse('kolab_files.' . $template, false, false));
}
}
/**

View file

@ -1,3 +1,8 @@
#files-dialog,
#files-compose-dialog {
display: none;
}
#files-folder-selector {
position: absolute;
top: 5px;

View file

@ -0,0 +1,6 @@
<div id="files-compose-dialog" class="uidialog">
<div id="files-folder-selector"></div>
<div id="files-file-selector">
<table id="filelist"><tbody></tbody></table>
</div>
</div>

View file

@ -0,0 +1,3 @@
<div id="files-dialog" class="uidialog">
<div id="files-folder-selector"></div>
</div>