sogo/UI/Templates/PreferencesUI/UIxFilterEditor.wox

186 lines
7.9 KiB
XML

<?xml version="1.0" standalone="yes"?>
<!DOCTYPE container>
<container
xmlns="http://www.w3.org/1999/xhtml"
xmlns:var="http://www.skyrix.com/od/binding"
xmlns:const="http://www.skyrix.com/od/constant"
xmlns:label="OGo:label"
xmlns:rsrc="OGo:url"
xmlns:uix="OGo:uix"><var:string var:value="doctype" const:escapeHTML="NO" />
<md-dialog flex="50" flex-sm="80" flex-xs="100">
<form id="filterForm" name="filterForm" ng-submit="filterEditor.save(filterForm)">
<md-toolbar>
<div class="md-toolbar-tools">
<md-icon class="material-icons sg-icon-toolbar-bg">filter_list</md-icon>
<md-input-container class="md-block md-flex">
<label><var:string label:value="Filter name"/></label>
<input class="md-title"
type="text"
md-autofocus="true"
ng-model="filterEditor.filter.name"
required="required"/>
</md-input-container>
</div>
</md-toolbar>
<md-dialog-content class="md-dialog-content">
<script type="text/javascript">
var filterId = '<var:string value="filterId"/>';
var sieveFolderEncoding = '<var:string value="sieveFolderEncoding"/>';
var mailTags = <var:string value="labels" const:escapeHTML="NO"/>;
</script>
<div layout="row" layout-align="start center">
<p><var:string label:value="For incoming messages that"/></p>
<md-input-container class="md-flex">
<md-select ng-model="filterEditor.filter.match">
<md-option const:value="all">
<var:string label:value="match all of the following rules"/>
</md-option>
<md-option const:value="any">
<var:string label:value="match any of the following rules"/>
</md-option>
<md-option const:value="allmessages">
<var:string label:value="match all messages"/>
</md-option>
</md-select>
</md-input-container>
</div>
<!-- CONDITIONS -->
<div layout="column">
<div id="filterRules"><!-- empty --></div>
<div layout="row"
ng-repeat="rule in filterEditor.filter.rules">
<md-input-container class="md-block" flex="25">
<md-select ng-model="rule.field">
<md-option ng-value="key" ng-repeat="(key, value) in filterEditor.fieldLabels">{{ value }}</md-option>
</md-select>
</md-input-container>
<md-input-container class="md-block" flex="25" ng-if="rule.field == 'header'">
<input type="text" ng-model="rule.custom_header" required="required"/>
</md-input-container>
<md-input-container class="md-block" flex="25" ng-if="rule.field == 'size'">
<md-select ng-model="rule.operator">
<md-option ng-value="key" ng-repeat="(key, value) in filterEditor.numberOperatorLabels">
{{ value }}
</md-option>
</md-select>
</md-input-container>
<md-input-container class="md-block" flex="25" ng-if="rule.field != 'size'">
<md-select ng-model="rule.operator">
<md-option ng-value="key" ng-repeat="(key, value) in filterEditor.textOperatorLabels">
{{ value }}
</md-option>
</md-select>
</md-input-container>
<md-input-container class="md-block md-flex" md-no-float="md-no-float">
<label><var:string label:value="Value"/></label>
<input type="text" ng-model="rule.value" required="required"/>
</md-input-container>
<md-button class="md-icon-button" type="button"
ng-click="filterEditor.removeMailFilterRule($index)">
<md-icon>remove_circle</md-icon>
</md-button>
</div>
<div layout="row" layout-align="end center">
<label class="button-label"><var:string label:value="Add a condition"/></label>
<md-button class="md-icon-button" type="button"
ng-click="filterEditor.addMailFilterRule($event)">
<md-icon>add_circle</md-icon>
</md-button>
</div>
</div>
<!-- ACTIONS -->
<div layout="column">
<p><var:string label:value="Perform these actions"/></p>
<div id="filterActions"><!-- empty --></div>
<div layout="row"
ng-repeat="action in filterEditor.filter.actions">
<md-input-container class="md-block md-flex">
<md-select ng-model="action.method">
<md-option ng-value="key" ng-repeat="(key, value) in filterEditor.methodLabels">{{ value }}</md-option>
</md-select>
</md-input-container>
<!-- FORWARD MESSAGE TO -->
<md-input-container class="md-block" flex="50" ng-if="action.method == 'redirect'" >
<label><var:string label:value="Email"/></label>
<input type="text" ng-model="action.argument" required="required"/>
</md-input-container>
<!-- DISCARD -->
<!-- nada -->
<!-- KEEP -->
<!-- nada -->
<!-- SEND REJECT MESSAGE -->
<md-input-container class="md-block" flex="50" ng-if="action.method == 'reject'">
<label><var:string label:value="Message"/></label>
<input type="text" ng-model="action.argument" required="required"/>
</md-input-container>
<!-- FILE INTO -->
<md-input-container class="md-block" flex="50" ng-if="action.method == 'fileinto'">
<label><var:string label:value="Mailbox"/></label>
<md-select ng-model="action.argument" required="required">
<md-option ng-value="item.path" ng-repeat="item in filterEditor.mailboxes">
<div ng-class="'sg-child-level-' + item.level">
{{ item.name }}
</div>
</md-option>
</md-select>
</md-input-container>
<!-- FLAG WITH -->
<md-input-container class="md-block" flex="50" ng-if="action.method == 'addflag'">
<label><var:string label:value="Flag"/></label>
<md-select ng-model="action.argument" required="required">
<md-option value="seen"><var:string label:value="Seen"/></md-option>
<md-option value="deleted"><var:string label:value="Deleted"/></md-option>
<md-option value="answered"><var:string label:value="Answered"/></md-option>
<md-option value="flagged"><var:string label:value="Flagged"/></md-option>
<md-option value="junk"><var:string label:value="Junk"/></md-option>
<md-option value="not_junk"><var:string label:value="Not Junk"/></md-option>
<md-option ng-value="key" ng-repeat="(key, value) in labels">{{ value[0] }}</md-option>
</md-select>
</md-input-container>
<!-- STOP -->
<!-- nada -->
<md-button class="md-icon-button" type="button"
ng-click="filterEditor.removeMailFilterAction($index)">
<md-icon>remove_circle</md-icon>
</md-button>
</div>
<div layout="row" layout-align="end center">
<label class="button-label"><var:string label:value="Add an action"/></label>
<md-button class="md-icon-button" type="button"
ng-click="filterEditor.addMailFilterAction($event)">
<md-icon>add_circle</md-icon>
</md-button>
</div>
</div>
</md-dialog-content>
<md-dialog-actions>
<md-button type="button" ng-click="filterEditor.cancel()"><var:string label:value="Cancel"/></md-button>
<md-button type="submit"
ng-disabled="filterForm.$invalid || !filterEditor.hasRulesAndActions()"
ng-bind="::'OK' | loc"><!-- OK --></md-button>
</md-dialog-actions>
</form>
</md-dialog>
</container>