|
|
@ -36,28 +36,28 @@ class swipe extends rcube_plugin
|
|
|
|
private $actions = array(
|
|
|
|
private $actions = array(
|
|
|
|
'messagelist' => array(
|
|
|
|
'messagelist' => array(
|
|
|
|
'vertical' => array(
|
|
|
|
'vertical' => array(
|
|
|
|
'checkmail' => 'checkmail'
|
|
|
|
'checkmail' => array('label' => 'checkmail')
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'horizontal' => array(
|
|
|
|
'horizontal' => array(
|
|
|
|
'archive' => 'archive.buttontext',
|
|
|
|
'archive' => array('label' => 'archive.buttontext', 'plugin' => true, 'condition' => 'env:archive_folder'),
|
|
|
|
'delete' => 'delete',
|
|
|
|
'delete' => array('label' => 'delete'),
|
|
|
|
'forward' => 'forward',
|
|
|
|
'forward' => array('label' => 'forward'),
|
|
|
|
'markasjunk' => 'markasjunk.markasjunk',
|
|
|
|
'markasjunk' => array('label' => 'markasjunk.markasjunk', 'plugin' => true),
|
|
|
|
'move' => 'moveto',
|
|
|
|
'move' => array('label' => 'moveto'),
|
|
|
|
'reply' => 'reply',
|
|
|
|
'reply' => array('label' => 'reply'),
|
|
|
|
'reply-all' => 'replyall',
|
|
|
|
'reply-all' => array('label' => 'replyall'),
|
|
|
|
'swipe-flagged' => 'swipe.markasflagged',
|
|
|
|
'swipe-flagged' => array('label' => 'swipe.markasflagged'),
|
|
|
|
'swipe-read' => 'swipe.markasread',
|
|
|
|
'swipe-read' => array('label' => 'swipe.markasread'),
|
|
|
|
'swipe-select' => 'select'
|
|
|
|
'swipe-select' => array('label' => 'select')
|
|
|
|
)
|
|
|
|
)
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'contactlist' => array(
|
|
|
|
'contactlist' => array(
|
|
|
|
'vertical' => array(),
|
|
|
|
'vertical' => array(),
|
|
|
|
'horizontal' => array(
|
|
|
|
'horizontal' => array(
|
|
|
|
'vcard_attachments' => 'vcard_attachments.forwardvcard',
|
|
|
|
'vcard_attachments' => array('label' => 'vcard_attachments.forwardvcard', 'plugin' => true),
|
|
|
|
'compose' => 'compose',
|
|
|
|
'compose' => array('label' => 'compose'),
|
|
|
|
'delete' => 'delete',
|
|
|
|
'delete' => array('label' => 'delete'),
|
|
|
|
'swipe-select' => 'select'
|
|
|
|
'swipe-select' => array('label' => 'select')
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -76,9 +76,12 @@ class swipe extends rcube_plugin
|
|
|
|
|
|
|
|
|
|
|
|
public function setup()
|
|
|
|
public function setup()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if ($this->rcube->action != '') {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$this->_load_config();
|
|
|
|
$this->_load_config();
|
|
|
|
|
|
|
|
|
|
|
|
if ($this->rcube->output->type == 'html' && $this->rcube->action == '') {
|
|
|
|
|
|
|
|
$this->menu_file = '/' . $this->local_skin_path() . '/includes/menu.html';
|
|
|
|
$this->menu_file = '/' . $this->local_skin_path() . '/includes/menu.html';
|
|
|
|
$filepath = slashify($this->home) . $this->menu_file;
|
|
|
|
$filepath = slashify($this->home) . $this->menu_file;
|
|
|
|
if (is_file($filepath) && is_readable($filepath)) {
|
|
|
|
if (is_file($filepath) && is_readable($filepath)) {
|
|
|
@ -113,7 +116,6 @@ class swipe extends rcube_plugin
|
|
|
|
$this->rcube->output->add_footer($html);
|
|
|
|
$this->rcube->output->add_footer($html);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function options_list($args)
|
|
|
|
public function options_list($args)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -126,12 +128,12 @@ class swipe extends rcube_plugin
|
|
|
|
$data = rcube::get_instance()->plugins->exec_hook('swipe_actions_list', array('actions' => $swipe_actions, 'direction' => $args['direction']));
|
|
|
|
$data = rcube::get_instance()->plugins->exec_hook('swipe_actions_list', array('actions' => $swipe_actions, 'direction' => $args['direction']));
|
|
|
|
|
|
|
|
|
|
|
|
$options = array();
|
|
|
|
$options = array();
|
|
|
|
foreach ($data['actions'] as $action => $text) {
|
|
|
|
foreach ($data['actions'] as $action => $info) {
|
|
|
|
if (!$this->_allowed_action($args['direction'], $action)) {
|
|
|
|
if (!$this->_allowed_action($args['direction'], $action, $info)) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$options[$action] = $this->gettext($text);
|
|
|
|
$options[$action] = $this->gettext($info['label']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
asort($options);
|
|
|
|
asort($options);
|
|
|
|
|
|
|
|
|
|
|
@ -164,6 +166,8 @@ class swipe extends rcube_plugin
|
|
|
|
|
|
|
|
|
|
|
|
public function save_settings()
|
|
|
|
public function save_settings()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
$this->_load_config();
|
|
|
|
|
|
|
|
|
|
|
|
$save = false;
|
|
|
|
$save = false;
|
|
|
|
foreach (array('left', 'right', 'down') as $direction) {
|
|
|
|
foreach (array('left', 'right', 'down') as $direction) {
|
|
|
|
if (($prop = rcube_utils::get_input_value('swipe_' . $direction, rcube_utils::INPUT_POST)) && $this->_allowed_action($direction)) {
|
|
|
|
if (($prop = rcube_utils::get_input_value('swipe_' . $direction, rcube_utils::INPUT_POST)) && $this->_allowed_action($direction)) {
|
|
|
@ -193,15 +197,18 @@ class swipe extends rcube_plugin
|
|
|
|
|
|
|
|
|
|
|
|
// remove disabled actions
|
|
|
|
// remove disabled actions
|
|
|
|
foreach ($config as $list => $opts) {
|
|
|
|
foreach ($config as $list => $opts) {
|
|
|
|
foreach ($opts as $dirction => $action) {
|
|
|
|
foreach ($opts as $direction => $action) {
|
|
|
|
if ($this->_allowed_action($dirction, $action)) {
|
|
|
|
$axis = $direction == 'down' ? 'vertical' : 'horizontal';
|
|
|
|
$this->config[$list][$dirction] = $action;
|
|
|
|
$opts = !empty($this->actions[$list][$axis][$action]) ? $this->actions[$list][$axis][$action] : null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($this->_allowed_action($direction, $action, $opts)) {
|
|
|
|
|
|
|
|
$this->config[$list][$direction] = $action;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private function _allowed_action($direction, $action = '')
|
|
|
|
private function _allowed_action($direction, $action = '', $opts = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$result = true;
|
|
|
|
$result = true;
|
|
|
|
|
|
|
|
|
|
|
@ -214,15 +221,42 @@ class swipe extends rcube_plugin
|
|
|
|
else if (in_array($action, $this->disabled_actions) || in_array($this->rcube->task . $action, $this->disabled_actions)) {
|
|
|
|
else if (in_array($action, $this->disabled_actions) || in_array($this->rcube->task . $action, $this->disabled_actions)) {
|
|
|
|
$result = false;
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (in_array($action, array('markasjunk', 'vcard_attachments')) && !in_array($action, $this->laoded_plugins)) {
|
|
|
|
else if (isset($opts['plugin']) && !in_array($action, $this->laoded_plugins)) {
|
|
|
|
// check plugin is enabled
|
|
|
|
// check plugin is enabled
|
|
|
|
$result = false;
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ($action == 'archive' && !$this->rcube->output->env['archive_folder']) {
|
|
|
|
|
|
|
|
// archive plugin
|
|
|
|
// check for special conditions
|
|
|
|
|
|
|
|
if ($result && !empty($opts['condition']) && !$this->_eval_expression($opts['condition'])) {
|
|
|
|
$result = false;
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function _eval_expression($expression)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// from rcmail_output_html::eval_expression()
|
|
|
|
|
|
|
|
$expression = preg_replace(
|
|
|
|
|
|
|
|
array(
|
|
|
|
|
|
|
|
'/session:([a-z0-9_]+)/i',
|
|
|
|
|
|
|
|
'/config:([a-z0-9_]+)(:([a-z0-9_]+))?/i',
|
|
|
|
|
|
|
|
'/env:([a-z0-9_]+)/i',
|
|
|
|
|
|
|
|
'/request:([a-z0-9_]+)/i',
|
|
|
|
|
|
|
|
'/cookie:([a-z0-9_]+)/i',
|
|
|
|
|
|
|
|
'/browser:([a-z0-9_]+)/i',
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
array(
|
|
|
|
|
|
|
|
"\$_SESSION['\\1']",
|
|
|
|
|
|
|
|
"\$this->rcube->config->get('\\1',rcube_utils::get_boolean('\\3'))",
|
|
|
|
|
|
|
|
"\$this->rcube->output->env['\\1']",
|
|
|
|
|
|
|
|
"rcube_utils::get_input_value('\\1', rcube_utils::INPUT_GPC)",
|
|
|
|
|
|
|
|
"\$_COOKIE['\\1']",
|
|
|
|
|
|
|
|
"\$this->rcmail->output->browser->{'\\1'}",
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
$expression
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return eval("return ($expression);");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|