Changeset ebb2047 in github


Ignore:
Timestamp:
Jul 23, 2012 4:24:16 AM (10 months ago)
Author:
Aleksander Machniak <alec@…>
Children:
7eba085
Parents:
114cf12
Message:

Added GUI for variables setting - RFC5229 (patch from Paweł Słowik)

Location:
plugins/managesieve
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • plugins/managesieve/Changelog

    r7dc7eb1 rebb2047  
     1- Added GUI for variables setting - RFC5229 (patch from Paweł Słowik) 
     2 
    13* version 5.1 [2012-06-21] 
    24----------------------------------------------------------- 
  • plugins/managesieve/localization/en_GB.inc

    r48e9c14 rebb2047  
    9494$labels['flagflagged'] = 'Flagged'; 
    9595$labels['flagdraft'] = 'Draft'; 
     96$labels['setvariable'] = 'Set variable'; 
     97$labels['setvarname'] = 'Variable name:'; 
     98$labels['setvarvalue'] = 'Variable value:'; 
     99$labels['setvarmodifiers'] = 'Modifiers:'; 
    96100$labels['filtercreate'] = 'Create filter'; 
    97101$labels['usedata'] = 'Use following data in the filter:'; 
  • plugins/managesieve/localization/en_US.inc

    r48e9c14 rebb2047  
    7979$labels['flagflagged'] = 'Flagged'; 
    8080$labels['flagdraft'] = 'Draft'; 
     81$labels['setvariable'] = 'Set variable'; 
     82$labels['setvarname'] = 'Variable name:'; 
     83$labels['setvarvalue'] = 'Variable value:'; 
     84$labels['setvarmodifiers'] = 'Modifiers:'; 
    8185$labels['filtercreate'] = 'Create filter'; 
    8286$labels['usedata'] = 'Use following data in the filter:'; 
  • plugins/managesieve/localization/pl_PL.inc

    re88e20c rebb2047  
    108108$labels['flagflagged'] = 'Oflagowana'; 
    109109$labels['flagdraft'] = 'Szkic'; 
     110$labels['setvariable'] = 'Ustaw zmiennÄ 
     111'; 
     112$labels['setvarname'] = 'Nazwa zmiennej:'; 
     113$labels['setvarvalue'] = 'Wartość zmiennej:'; 
     114$labels['setvarmodifiers'] = 'Modyfikatory:'; 
    110115$labels['filtercreate'] = 'Utwórz filtr'; 
    111116$labels['usedata'] = 'UÅŒyj następujÄ 
  • plugins/managesieve/managesieve.js

    r8d8f7a7 rebb2047  
    639639      target_area: document.getElementById('action_target_area' + id), 
    640640      flags: document.getElementById('action_flags' + id), 
    641       vacation: document.getElementById('action_vacation' + id) 
     641      vacation: document.getElementById('action_vacation' + id), 
     642      set: document.getElementById('action_set' + id) 
    642643    }; 
    643644 
     
    656657  else if (obj.value == 'vacation') { 
    657658    enabled.vacation = 1; 
     659  } 
     660  else if (obj.value == 'set') { 
     661    enabled.set = 1; 
    658662  } 
    659663 
  • plugins/managesieve/managesieve.php

    r7dc7eb1 rebb2047  
    616616            $subject        = get_input_value('_action_subject', RCUBE_INPUT_POST, true); 
    617617            $flags          = get_input_value('_action_flags', RCUBE_INPUT_POST); 
     618            $varnames       = get_input_value('_action_varname', RCUBE_INPUT_POST); 
     619            $varvalues      = get_input_value('_action_varvalue', RCUBE_INPUT_POST); 
     620            $varmods        = get_input_value('_action_varmods', RCUBE_INPUT_POST); 
    618621 
    619622            // we need a "hack" for radiobuttons 
     
    849852                    if ($this->form['actions'][$i]['days'] && !preg_match('/^[0-9]+$/', $this->form['actions'][$i]['days'])) 
    850853                        $this->errors['actions'][$i]['days'] = $this->gettext('forbiddenchars'); 
     854                    break; 
     855 
     856                case 'set': 
     857                    if (empty($varnames[$idx])) { 
     858                        $this->errors['actions'][$i]['name'] = $this->gettext('cannotbeempty'); 
     859                    } 
     860                    if (empty($varvalues[$idx])) { 
     861                        $this->errors['actions'][$i]['value'] = $this->gettext('cannotbeempty'); 
     862                    } 
     863                    foreach ($varmods[$idx] as $v_m) { 
     864                        $this->form['actions'][$i][$v_m] = true; 
     865                    } 
     866                    $this->form['actions'][$i]['name'] = $varnames[$idx]; 
     867                    $this->form['actions'][$i]['value'] = $varvalues[$idx]; 
    851868                    break; 
    852869                } 
     
    14481465            $select_action->add(Q($this->gettext('removeflags')), 'removeflag'); 
    14491466        } 
     1467        if (in_array('variables', $this->exts)) { 
     1468            $select_action->add(Q($this->gettext('setvariable')), 'set'); 
     1469        } 
    14501470        $select_action->add(Q($this->gettext('rulestop')), 'stop'); 
    14511471 
     
    15111531        $out .= '</div>'; 
    15121532 
     1533        // set variable 
     1534        $set_modifiers = array( 
     1535            'lower', 
     1536            'upper', 
     1537            'lowerfirst', 
     1538            'upperfirst', 
     1539            'quotewildcard', 
     1540            'length' 
     1541        ); 
     1542 
     1543        $out .= '<div id="action_set' .$id.'" style="display:' .($action['type']=='set' ? 'inline' : 'none') .'">'; 
     1544        $out .= '<span class="label">' .Q($this->gettext('setvarname')) . '</span><br />' 
     1545            .'<input type="text" name="_action_varname['.$id.']" id="action_varname'.$id.'" ' 
     1546            .'value="' . Q($action['name']) . '" size="35" ' 
     1547            . $this->error_class($id, 'action', 'name', 'action_varname') .' />'; 
     1548        $out .= '<br /><span class="label">' .Q($this->gettext('setvarvalue')) . '</span><br />' 
     1549            .'<input type="text" name="_action_varvalue['.$id.']" id="action_varvalue'.$id.'" ' 
     1550            .'value="' . Q($action['value']) . '" size="35" ' 
     1551            . $this->error_class($id, 'action', 'value', 'action_varvalue') .' />'; 
     1552        $out .= '<br /><span class="label">' .Q($this->gettext('setvarmodifiers')) . '</span><br />'; 
     1553        foreach ($set_modifiers as $j => $s_m) { 
     1554            $s_m_id = 'action_varmods' . $id . $s_m; 
     1555            $out .= sprintf('<input type="checkbox" name="_action_varmods[%s][]" value="%s" id="%s"%s />%s<br>', 
     1556                $id, $s_m, $s_m_id, (array_key_exists($s_m, (array)$action) && $action[$s_m] ? ' checked="checked"' : ''), $s_m); 
     1557        } 
     1558        $out .= '</div>'; 
     1559 
    15131560        // mailbox select 
    15141561        if ($action['type'] == 'fileinto') 
Note: See TracChangeset for help on using the changeset viewer.