Support regex extension (SIEVE) (#1043)

+ Update jquery
This commit is contained in:
RainLoop Team 2016-05-27 00:38:39 +03:00
parent 2fefad437e
commit c0ab236440
8 changed files with 31 additions and 12 deletions

View file

@ -345,6 +345,7 @@ export const FilterConditionType = {
'NotContains': 'NotContains',
'EqualTo': 'EqualTo',
'NotEqualTo': 'NotEqualTo',
'Regex': 'Regex',
'Over': 'Over',
'Under': 'Under'
};

View file

@ -149,6 +149,11 @@
{'id': Enums.FilterConditionType.NotEqualTo, 'name': Translator.i18n('POPUPS_FILTER/SELECT_TYPE_NOT_EQUAL_TO')}
]);
if (oModules && oModules.regex)
{
this.typeOptions.push({'id': Enums.FilterConditionType.Regex, 'name': 'Regex'});
}
this.typeOptionsSize([
{'id': Enums.FilterConditionType.Over, 'name': Translator.i18n('POPUPS_FILTER/SELECT_TYPE_OVER')},
{'id': Enums.FilterConditionType.Under, 'name': Translator.i18n('POPUPS_FILTER/SELECT_TYPE_UNDER')}

View file

@ -17,12 +17,11 @@ export default (App) => {
Globals.__APP__ = App;
Globals.$win
.keydown(Utils.kill_CtrlA_CtrlS)
.unload(function () {
Globals.bUnload = true;
})
;
Globals.$win.on('keydown', Utils.kill_CtrlA_CtrlS);
Globals.$win.on('unload', function () {
Globals.bUnload = true;
});
Globals.$html
.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile')

View file

@ -170,7 +170,8 @@ cfg.paths.js = {
name: 'libs.js',
src: [
'vendors/underscore/1.6.0/underscore-min.js',
'vendors/jquery/jquery-1.12.3.min.js',
'vendors/jquery/jquery-2.2.4.min.js',
// 'vendors/jquery/jquery-3.0.0-rc1.min.js',
'vendors/jquery-ui/js/jquery-ui-1.10.3.custom.min.js',
'vendors/jquery-cookie/jquery.cookie-1.4.0.min.js',
'vendors/jquery-finger/jquery.finger.min.js',
@ -299,6 +300,7 @@ gulp.task('js:libs', function() {
return gulp.src(cfg.paths.js.libs.src)
.pipe(concat(cfg.paths.js.libs.name, {separator: '\n\n'}))
.pipe(eol('\n', true))
.pipe(replace(/sourceMappingURL=[a-z0-9\.\-_]{1,20}\.map/ig, ''))
.pipe(gulp.dest(cfg.paths.staticMinJS));
});

View file

@ -2,7 +2,7 @@
"name": "RainLoop",
"title": "RainLoop Webmail",
"version": "1.10.1",
"release": "120",
"release": "121",
"private": true,
"ownCloudPackageVersion": "4.17",
"description": "Simple, modern & fast web-based email client",

View file

@ -8,6 +8,7 @@ class ConditionType
const NOT_EQUAL_TO = 'NotEqualTo';
const CONTAINS = 'Contains';
const NOT_CONTAINS = 'NotContains';
const REGEX = 'Regex';
const OVER = 'Over';
const UNDER = 'Under';
}

View file

@ -96,6 +96,9 @@ class SieveStorage implements \RainLoop\Providers\Filters\FiltersInterface
'Capa' => $bAllowRaw ? $aModules : array(),
'Modules' => array(
'redirect' => \in_array('fileinto', $aModules),
'regex' => \in_array('regex', $aModules),
'relational' => \in_array('relational', $aModules),
'date' => \in_array('date', $aModules),
'moveto' => \in_array('fileinto', $aModules),
'reject' => \in_array('reject', $aModules),
'vacation' => \in_array('vacation', $aModules),
@ -161,7 +164,7 @@ class SieveStorage implements \RainLoop\Providers\Filters\FiltersInterface
*
* @return string
*/
private function conditionToSieveScript($oCondition)
private function conditionToSieveScript($oCondition, &$aCapa)
{
$sResult = '';
$sTypeWord = '';
@ -192,6 +195,10 @@ class SieveStorage implements \RainLoop\Providers\Filters\FiltersInterface
case \RainLoop\Providers\Filters\Enumerations\ConditionType::CONTAINS:
$sTypeWord = ':contains';
break;
case \RainLoop\Providers\Filters\Enumerations\ConditionType::REGEX:
$sTypeWord = ':regex';
$aCapa['regex'] = true;
break;
default:
$bTrue = false;
$sResult = '/* @Error: unknown type value */ false';
@ -284,7 +291,7 @@ class SieveStorage implements \RainLoop\Providers\Filters\FiltersInterface
foreach ($aConditions as $oCond)
{
$bTrim = true;
$sCons = $this->conditionToSieveScript($oCond);
$sCons = $this->conditionToSieveScript($oCond, $aCapa);
if (!empty($sCons))
{
$aResult[] = $sTab.$sCons.',';
@ -302,7 +309,7 @@ class SieveStorage implements \RainLoop\Providers\Filters\FiltersInterface
$aResult[] = 'if allof(';
foreach ($aConditions as $oCond)
{
$aResult[] = $sTab.$this->conditionToSieveScript($oCond).',';
$aResult[] = $sTab.$this->conditionToSieveScript($oCond, $aCapa).',';
}
$aResult[\count($aResult) - 1] = \rtrim($aResult[\count($aResult) - 1], ',');
@ -311,7 +318,7 @@ class SieveStorage implements \RainLoop\Providers\Filters\FiltersInterface
}
else if (1 === \count($aConditions))
{
$aResult[] = 'if '.$this->conditionToSieveScript($aConditions[0]).'';
$aResult[] = 'if '.$this->conditionToSieveScript($aConditions[0], $aCapa).'';
}
else
{

4
vendors/jquery/jquery-2.2.4.min.js vendored Normal file

File diff suppressed because one or more lines are too long