mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-27 02:59:21 +03:00
Get the Sieve GUI partially working
This commit is contained in:
parent
55c5910590
commit
7e45ffab74
11 changed files with 33 additions and 8 deletions
|
|
@ -40,7 +40,7 @@ export class AddressTest extends TestCommand
|
|||
this.header_list = new GrammarStringList;
|
||||
this.key_list = new GrammarStringList;
|
||||
// rfc5260#section-6
|
||||
this.index = new GrammarNumber;
|
||||
this.index = new GrammarNumber('');
|
||||
this.last = false;
|
||||
// rfc5703#section-6
|
||||
// this.mime
|
||||
|
|
@ -234,7 +234,7 @@ export class HeaderTest extends TestCommand
|
|||
this.header_names = new GrammarStringList;
|
||||
this.key_list = new GrammarStringList;
|
||||
// rfc5260#section-6
|
||||
this.index = new GrammarNumber;
|
||||
this.index = new GrammarNumber('');
|
||||
this.last = false;
|
||||
// rfc5703#section-6
|
||||
this.mime = false;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { AbstractModel } from 'Sieve/Model/Abstract';
|
||||
import { FilterModel } from 'Sieve/Model/Filter';
|
||||
import { koArrayWithDestroy } from 'Sieve/Utils';
|
||||
import { parseScript } from 'Sieve/Parser';
|
||||
|
||||
const SIEVE_FILE_NAME = 'rainloop.user';
|
||||
|
||||
|
|
@ -299,6 +300,10 @@ export class SieveScriptModel extends AbstractModel
|
|||
return SIEVE_FILE_NAME === this.name();
|
||||
}
|
||||
|
||||
parse() {
|
||||
return parseScript(this.body(), this.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* @static
|
||||
* @param {FetchJsonScript} json
|
||||
|
|
|
|||
|
|
@ -291,5 +291,6 @@ export const parseScript = (script, name = 'script.sieve') => {
|
|||
}
|
||||
|
||||
tree.requires = requires;
|
||||
tree.toString = () => tree.join('\r\n');
|
||||
return tree;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -132,6 +132,11 @@ export class SieveScriptPopupView extends rl.pluginPopupView {
|
|||
});
|
||||
}
|
||||
|
||||
templateName(obj) {
|
||||
const id = 'Sieve' + obj.constructor.name;
|
||||
return document.getElementById(id) ? id : null;
|
||||
}
|
||||
|
||||
beforeShow(oScript) {
|
||||
// onShow(oScript) {
|
||||
this.sieveCapabilities(capa.join(' '));
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
<!-- rfc5228 -->
|
||||
allof
|
||||
<div data-bind="template: { name: 'SieveTest', foreach: tests, as: 'test' }"></div>
|
||||
<div data-bind="foreach: tests">
|
||||
<div data-bind="template: {name: $root.templateName($data)}"></div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
<!-- rfc5228 -->
|
||||
anyof
|
||||
<div data-bind="template: { name: 'SieveTest', foreach: tests, as: 'test' }"></div>
|
||||
<div data-bind="foreach: tests">
|
||||
<div data-bind="template: {name: $root.templateName($data)}"></div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ elsif
|
|||
this.test
|
||||
</div>
|
||||
{
|
||||
<div data-bind="template: { name: 'SieveCommand', foreach: commands, as: 'command' }"></div>
|
||||
<div data-bind="foreach: commands">
|
||||
<div data-bind="template: {name: $root.templateName($data)}"></div>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<!-- rfc5228 -->
|
||||
else
|
||||
{
|
||||
<div data-bind="template: { name: 'SieveCommand', foreach: commands, as: 'command' }"></div>
|
||||
<div data-bind="foreach: commands">
|
||||
<div data-bind="template: {name: $root.templateName($data)}"></div>
|
||||
</div>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,5 +4,7 @@ if
|
|||
this.test
|
||||
</div>
|
||||
{
|
||||
<div data-bind="template: { name: 'SieveCommand', foreach: commands, as: 'command' }"></div>
|
||||
<div data-bind="foreach: commands">
|
||||
<div data-bind="template: {name: $root.templateName($data)}"></div>
|
||||
</div>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
<!-- rfc5228 -->
|
||||
not
|
||||
<div data-bind="template: { name: 'SieveTest', as: 'test' }"></div>
|
||||
<div data-bind="template: {name: $root.templateName(test)}"></div>
|
||||
|
|
|
|||
|
|
@ -37,6 +37,10 @@
|
|||
<pre data-bind="text: $root.availableTests"></pre>
|
||||
</details>
|
||||
<textarea style="width:100%;height:60vh" data-bind="value: body, valueUpdate: 'input'"></textarea>
|
||||
|
||||
<div data-bind="foreach: parse()">
|
||||
<div data-bind="template: {name: $root.templateName($data)}"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div data-bind="visible: !$root.rawActive()">
|
||||
<table class="table table-hover list-table filters-list g-ui-user-select-none">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue