CS and indent fixes, added $task property definition

pull/5288/head
Aleksander Machniak 8 years ago
parent 796bb4ccbb
commit 4f0abbf5fe

@ -65,5 +65,5 @@ if (window.rcmail) {
if (result.update) if (result.update)
rcmail.command('list'); // refresh list rcmail.command('list'); // refresh list
}); });
}) });
} }

@ -12,6 +12,9 @@
*/ */
class archive extends rcube_plugin class archive extends rcube_plugin
{ {
public $task = 'settings|mail';
function init() function init()
{ {
$rcmail = rcmail::get_instance(); $rcmail = rcmail::get_instance();
@ -23,8 +26,9 @@ class archive extends rcube_plugin
&& ($archive_folder = $rcmail->config->get('archive_mbox')) && ($archive_folder = $rcmail->config->get('archive_mbox'))
) { ) {
$skin_path = $this->local_skin_path(); $skin_path = $this->local_skin_path();
if (is_file($this->home . "/$skin_path/archive.css")) if (is_file($this->home . "/$skin_path/archive.css")) {
$this->include_stylesheet("$skin_path/archive.css"); $this->include_stylesheet("$skin_path/archive.css");
}
$this->include_script('archive.js'); $this->include_script('archive.js');
$this->add_texts('localization', true); $this->add_texts('localization', true);
@ -55,6 +59,7 @@ class archive extends rcube_plugin
} }
else if ($rcmail->task == 'settings') { else if ($rcmail->task == 'settings') {
$dont_override = $rcmail->config->get('dont_override', array()); $dont_override = $rcmail->config->get('dont_override', array());
if (!in_array('archive_mbox', $dont_override)) { if (!in_array('archive_mbox', $dont_override)) {
$this->add_hook('preferences_list', array($this, 'prefs_table')); $this->add_hook('preferences_list', array($this, 'prefs_table'));
$this->add_hook('preferences_save', array($this, 'save_prefs')); $this->add_hook('preferences_save', array($this, 'save_prefs'));
@ -73,11 +78,14 @@ class archive extends rcube_plugin
// set localized name for the configured archive folder // set localized name for the configured archive folder
if ($archive_folder && !$show_real_name) { if ($archive_folder && !$show_real_name) {
if (isset($p['list'][$archive_folder])) if (isset($p['list'][$archive_folder])) {
$p['list'][$archive_folder]['name'] = $this->gettext('archivefolder'); $p['list'][$archive_folder]['name'] = $this->gettext('archivefolder');
else // search in subfolders }
else {
// search in subfolders
$this->_mod_folder_name($p['list'], $archive_folder, $this->gettext('archivefolder')); $this->_mod_folder_name($p['list'], $archive_folder, $this->gettext('archivefolder'));
} }
}
return $p; return $p;
} }
@ -91,10 +99,14 @@ class archive extends rcube_plugin
if ($item['id'] == $folder) { if ($item['id'] == $folder) {
$list[$idx]['name'] = $new_name; $list[$idx]['name'] = $new_name;
return true; return true;
} else if (!empty($item['folders'])) }
if ($this->_mod_folder_name($list[$idx]['folders'], $folder, $new_name)) else if (!empty($item['folders'])) {
if ($this->_mod_folder_name($list[$idx]['folders'], $folder, $new_name)) {
return true; return true;
} }
}
}
return false; return false;
} }
@ -112,11 +124,11 @@ class archive extends rcube_plugin
$archive_folder = $rcmail->config->get('archive_mbox'); $archive_folder = $rcmail->config->get('archive_mbox');
$archive_type = $rcmail->config->get('archive_type', ''); $archive_type = $rcmail->config->get('archive_type', '');
$current_mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST); $current_mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST);
$search_request = rcube_utils::get_input_value('_search', rcube_utils::INPUT_GPC);
$uids = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST);
$result = array('reload' => false, 'update' => false, 'errors' => array()); $result = array('reload' => false, 'update' => false, 'errors' => array());
$folders = array(); $folders = array();
$uids = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST);
$search_request = rcube_utils::get_input_value('_search', rcube_utils::INPUT_GPC);
if ($uids == '*') { if ($uids == '*') {
$index = $storage->index(null, rcmail_sort_column(), rcmail_sort_order()); $index = $storage->index(null, rcmail_sort_column(), rcmail_sort_order());
@ -243,6 +255,8 @@ class archive extends rcube_plugin
$this->add_texts('localization'); $this->add_texts('localization');
$rcmail = rcmail::get_instance(); $rcmail = rcmail::get_instance();
$mbox = $rcmail->config->get('archive_mbox');
$type = $rcmail->config->get('archive_type');
// load folders list when needed // load folders list when needed
if ($CURR_SECTION) { if ($CURR_SECTION) {
@ -261,7 +275,7 @@ class archive extends rcube_plugin
$args['blocks']['main']['options']['archive_mbox'] = array( $args['blocks']['main']['options']['archive_mbox'] = array(
'title' => $this->gettext('archivefolder'), 'title' => $this->gettext('archivefolder'),
'content' => $select->show($rcmail->config->get('archive_mbox'), array('name' => "_archive_mbox")) 'content' => $select->show($mbox, array('name' => "_archive_mbox"))
); );
// add option for structuring the archive folder // add option for structuring the archive folder
@ -276,7 +290,7 @@ class archive extends rcube_plugin
'name' => rcube::Q($this->gettext('settingstitle')), 'name' => rcube::Q($this->gettext('settingstitle')),
'options' => array('archive_type' => array( 'options' => array('archive_type' => array(
'title' => $this->gettext('archivetype'), 'title' => $this->gettext('archivetype'),
'content' => $archive_type->show($rcmail->config->get('archive_type')) 'content' => $archive_type->show($type)
) )
) )
); );
@ -292,8 +306,8 @@ class archive extends rcube_plugin
{ {
if ($args['section'] == 'folders') { if ($args['section'] == 'folders') {
$args['prefs']['archive_type'] = rcube_utils::get_input_value('_archive_type', rcube_utils::INPUT_POST); $args['prefs']['archive_type'] = rcube_utils::get_input_value('_archive_type', rcube_utils::INPUT_POST);
return $args;
}
} }
return $args;
}
} }

Loading…
Cancel
Save