Advanced search improvements (#32)

This commit is contained in:
RainLoop Team 2013-12-16 20:08:05 +04:00
parent c8a5d45f37
commit efeef4b143
19 changed files with 101 additions and 22 deletions

View file

@ -137,7 +137,7 @@ WebMailAjaxRemoteStorage.prototype.messageList = function (fCallback, sFolderFul
iLimit = Utils.isUnd(iOffset) ? 20 : Utils.pInt(iLimit);
sSearch = Utils.pString(sSearch);
if ('' !== sFolderHash)
if ('' !== sFolderHash && ('' === sSearch || -1 === sSearch.indexOf('has:')))
{
this.defaultRequest(fCallback, 'MessageList', {},
'' === sSearch ? Consts.Defaults.DefaultAjaxTimeout : Consts.Defaults.SearchAjaxTimeout,

View file

@ -15,7 +15,10 @@ function PopupsAdvancedSearchViewModel()
this.subject = ko.observable('');
this.text = ko.observable('');
this.selectedDateValue = ko.observable(-1);
this.hasAttachments = ko.observable(false);
this.starred = ko.observable(false);
this.unseen = ko.observable(false);
this.searchCommand = Utils.createCommand(this, function () {
@ -50,7 +53,8 @@ PopupsAdvancedSearchViewModel.prototype.buildSearchString = function ()
sFrom = Utils.trim(this.from()),
sTo = Utils.trim(this.to()),
sSubject = Utils.trim(this.subject()),
sText = Utils.trim(this.text())
sText = Utils.trim(this.text()),
aHas = []
;
if (sFrom && '' !== sFrom)
@ -70,7 +74,22 @@ PopupsAdvancedSearchViewModel.prototype.buildSearchString = function ()
if (this.hasAttachments())
{
aResult.push('has:attachments');
aHas.push('attachments');
}
if (this.unseen())
{
aHas.push('unseen');
}
if (this.starred())
{
aHas.push('flag');
}
if (0 < aHas.length)
{
aResult.push('has:' + aHas.join(','));
}
if (-1 < this.selectedDateValue())
@ -95,6 +114,8 @@ PopupsAdvancedSearchViewModel.prototype.clearPopup = function ()
this.selectedDateValue(-1);
this.hasAttachments(false);
this.starred(false);
this.unseen(false);
this.fromFocus(true);
};

View file

@ -1051,14 +1051,14 @@ class MailClient
{
$oSearchBuilder->AddAnd('HEADER CONTENT-TYPE', '"MULTIPART/MIXED"');
}
// if (false !== strpos($sRawValue, 'flag'))
// {
// $oSearchBuilder->AddAnd('FLAGGED');
// }
// if (false !== strpos($sRawValue, 'unseen'))
// {
// $oSearchBuilder->AddAnd('UNSEEN');
// }
if (false !== strpos($sRawValue, 'flag') || false !== strpos($sRawValue, 'star'))
{
$oSearchBuilder->AddAnd('FLAGGED');
}
if (false !== strpos($sRawValue, 'unseen'))
{
$oSearchBuilder->AddAnd('UNSEEN');
}
break;
case 'DATE':
$iDateStampFrom = $iDateStampTo = 0;

View file

@ -7,6 +7,7 @@
</h3>
</div>
<div class="modal-body">
<br />
<form class="form-horizontal" action="#/" autocomplete="off" onsubmit="return false;" data-bind="command: searchCommand">
<div class="row">
<div class="span4">
@ -34,8 +35,6 @@
<input class="uiInput inputFrom" type="text" data-bind="value: subject, onEnter: searchCommand, onEsc: cancelCommand" />
</div>
</div>
</div>
<div class="span4">
<div class="control-group">
<label class="control-label">
<span class="i18n" data-i18n-text="SEARCH/LABEL_ADV_TEXT"></span>
@ -44,6 +43,8 @@
<input class="uiInput inputFrom" type="text" data-bind="value: text, onEnter: searchCommand, onEsc: cancelCommand" />
</div>
</div>
</div>
<div class="span4">
<div class="control-group">
<label class="control-label">
<span class="i18n" data-i18n-text="SEARCH/LABEL_ADV_DATE"></span>
@ -64,6 +65,16 @@
<label class="control-label">
</label>
<div class="controls">
<label data-bind="click: function () { unseen(!unseen()); }">
<i data-bind="css: unseen() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n-text="SEARCH/LABEL_ADV_UNSEEN"></span>
</label>
<label data-bind="click: function () { starred(!starred()); }">
<i data-bind="css: starred() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n-text="SEARCH/LABEL_ADV_FLAGGED"></span>
</label>
<label data-bind="click: function () { hasAttachments(!hasAttachments()); }">
<i data-bind="css: hasAttachments() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
&nbsp;&nbsp;

View file

@ -21,6 +21,8 @@ LABEL_ADV_TO = "An"
LABEL_ADV_SUBJECT = "Thema"
LABEL_ADV_TEXT = "Text"
LABEL_ADV_HAS_ATTACHMENTS = "Anhangdateien vorhanden"
LABEL_ADV_FLAGGED = "Flagged"
LABEL_ADV_UNSEEN = "Unseen"
LABEL_ADV_DATE = "Datum"
LABEL_ADV_DATE_ALL = "Alle"
LABEL_ADV_DATE_3_DAYS = "Nicht älter als 3 Tage"

View file

@ -21,6 +21,8 @@ LABEL_ADV_TO = "To"
LABEL_ADV_SUBJECT = "Subject"
LABEL_ADV_TEXT = "Text"
LABEL_ADV_HAS_ATTACHMENTS = "Has attachments"
LABEL_ADV_FLAGGED = "Flagged"
LABEL_ADV_UNSEEN = "Unseen"
LABEL_ADV_DATE = "Date"
LABEL_ADV_DATE_ALL = "All"
LABEL_ADV_DATE_3_DAYS = "Up to 3 days old"

View file

@ -21,6 +21,8 @@ LABEL_ADV_TO = "Para"
LABEL_ADV_SUBJECT = "Asunto"
LABEL_ADV_TEXT = "Texto"
LABEL_ADV_HAS_ATTACHMENTS = "Tiene adjuntos"
LABEL_ADV_FLAGGED = "Flagged"
LABEL_ADV_UNSEEN = "Unseen"
LABEL_ADV_DATE = "Fecha"
LABEL_ADV_DATE_ALL = "Todos"
LABEL_ADV_DATE_3_DAYS = "Hasta 3 días de antiguedad"

View file

@ -21,6 +21,8 @@ LABEL_ADV_TO = "A"
LABEL_ADV_SUBJECT = "Sujet"
LABEL_ADV_TEXT = "Texte"
LABEL_ADV_HAS_ATTACHMENTS = "Pièces jointes"
LABEL_ADV_FLAGGED = "Flagged"
LABEL_ADV_UNSEEN = "Unseen"
LABEL_ADV_DATE = "Date"
LABEL_ADV_DATE_ALL = "Tous"
LABEL_ADV_DATE_3_DAYS = "Jusqu'à 3 jours"

View file

@ -21,6 +21,8 @@ LABEL_ADV_TO = "Til"
LABEL_ADV_SUBJECT = "Viðfangsefni"
LABEL_ADV_TEXT = "Texti"
LABEL_ADV_HAS_ATTACHMENTS = "Hefur viðhengi"
LABEL_ADV_FLAGGED = "Flagged"
LABEL_ADV_UNSEEN = "Unseen"
LABEL_ADV_DATE = "Dagsetning"
LABEL_ADV_DATE_ALL = "Allt"
LABEL_ADV_DATE_3_DAYS = "Uppað 3 daga gömlu"

View file

@ -21,6 +21,8 @@ LABEL_ADV_TO = "받는 이"
LABEL_ADV_SUBJECT = "제목"
LABEL_ADV_TEXT = "본문"
LABEL_ADV_HAS_ATTACHMENTS = "첨부파일이 있는 메시지"
LABEL_ADV_FLAGGED = "Flagged"
LABEL_ADV_UNSEEN = "Unseen"
LABEL_ADV_DATE = "수신일"
LABEL_ADV_DATE_ALL = "모두"
LABEL_ADV_DATE_3_DAYS = "3일 이내"

View file

@ -21,6 +21,8 @@ LABEL_ADV_TO = "Kam"
LABEL_ADV_SUBJECT = "Tēma"
LABEL_ADV_TEXT = "Teksts"
LABEL_ADV_HAS_ATTACHMENTS = "Ir pielikumi"
LABEL_ADV_FLAGGED = "Flagged"
LABEL_ADV_UNSEEN = "Unseen"
LABEL_ADV_DATE = "Datums"
LABEL_ADV_DATE_ALL = "Viss periods"
LABEL_ADV_DATE_3_DAYS = "Līdz 3 dienas vecs"

View file

@ -21,6 +21,8 @@ LABEL_ADV_TO = "Naar"
LABEL_ADV_SUBJECT = "Onderwerp"
LABEL_ADV_TEXT = "Tekst"
LABEL_ADV_HAS_ATTACHMENTS = "Heeft bijlages"
LABEL_ADV_FLAGGED = "Flagged"
LABEL_ADV_UNSEEN = "Unseen"
LABEL_ADV_DATE = "Datum"
LABEL_ADV_DATE_ALL = "Alles"
LABEL_ADV_DATE_3_DAYS = "Meer dan 3 dagen oud"

View file

@ -21,6 +21,8 @@ LABEL_ADV_TO = "Do"
LABEL_ADV_SUBJECT = "Temat"
LABEL_ADV_TEXT = "Tekst"
LABEL_ADV_HAS_ATTACHMENTS = "Ma załączniki"
LABEL_ADV_FLAGGED = "Flagged"
LABEL_ADV_UNSEEN = "Unseen"
LABEL_ADV_DATE = "Data"
LABEL_ADV_DATE_ALL = "Wszystkie"
LABEL_ADV_DATE_3_DAYS = "Do 3 dni"

View file

@ -21,6 +21,8 @@ LABEL_ADV_TO = "Para"
LABEL_ADV_SUBJECT = "Assunto"
LABEL_ADV_TEXT = "Texto"
LABEL_ADV_HAS_ATTACHMENTS = "Tem Anexos"
LABEL_ADV_FLAGGED = "Flagged"
LABEL_ADV_UNSEEN = "Unseen"
LABEL_ADV_DATE = "Data"
LABEL_ADV_DATE_ALL = "Todos"
LABEL_ADV_DATE_3_DAYS = "Até 3 dias atrás"

View file

@ -21,6 +21,8 @@ LABEL_ADV_TO = "Para"
LABEL_ADV_SUBJECT = "Assunto"
LABEL_ADV_TEXT = "Texto"
LABEL_ADV_HAS_ATTACHMENTS = "Tem Anexos"
LABEL_ADV_FLAGGED = "Flagged"
LABEL_ADV_UNSEEN = "Unseen"
LABEL_ADV_DATE = "Data"
LABEL_ADV_DATE_ALL = "Todos"
LABEL_ADV_DATE_3_DAYS = "Até 3 dias atrás"

View file

@ -21,6 +21,8 @@ LABEL_ADV_TO = "Кому"
LABEL_ADV_SUBJECT = "Тема"
LABEL_ADV_TEXT = "Текст"
LABEL_ADV_HAS_ATTACHMENTS = "С файлами"
LABEL_ADV_FLAGGED = "Помеченные"
LABEL_ADV_UNSEEN = "Непрочитанные"
LABEL_ADV_DATE = "Дата"
LABEL_ADV_DATE_ALL = "За все время"
LABEL_ADV_DATE_3_DAYS = "За три дня"

View file

@ -21,6 +21,8 @@ LABEL_ADV_TO = "发送到"
LABEL_ADV_SUBJECT = "主题"
LABEL_ADV_TEXT = "内容"
LABEL_ADV_HAS_ATTACHMENTS = "有附件"
LABEL_ADV_FLAGGED = "Flagged"
LABEL_ADV_UNSEEN = "Unseen"
LABEL_ADV_DATE = "日期"
LABEL_ADV_DATE_ALL = "所有邮件"
LABEL_ADV_DATE_3_DAYS = "3天以内"

View file

@ -9781,7 +9781,10 @@ function PopupsAdvancedSearchViewModel()
this.subject = ko.observable('');
this.text = ko.observable('');
this.selectedDateValue = ko.observable(-1);
this.hasAttachments = ko.observable(false);
this.starred = ko.observable(false);
this.unseen = ko.observable(false);
this.searchCommand = Utils.createCommand(this, function () {
@ -9816,7 +9819,8 @@ PopupsAdvancedSearchViewModel.prototype.buildSearchString = function ()
sFrom = Utils.trim(this.from()),
sTo = Utils.trim(this.to()),
sSubject = Utils.trim(this.subject()),
sText = Utils.trim(this.text())
sText = Utils.trim(this.text()),
aHas = []
;
if (sFrom && '' !== sFrom)
@ -9836,7 +9840,22 @@ PopupsAdvancedSearchViewModel.prototype.buildSearchString = function ()
if (this.hasAttachments())
{
aResult.push('has:attachments');
aHas.push('attachments');
}
if (this.unseen())
{
aHas.push('unseen');
}
if (this.starred())
{
aHas.push('flag');
}
if (0 < aHas.length)
{
aResult.push('has:' + aHas.join(','));
}
if (-1 < this.selectedDateValue())
@ -9861,6 +9880,8 @@ PopupsAdvancedSearchViewModel.prototype.clearPopup = function ()
this.selectedDateValue(-1);
this.hasAttachments(false);
this.starred(false);
this.unseen(false);
this.fromFocus(true);
};
@ -14442,7 +14463,7 @@ WebMailAjaxRemoteStorage.prototype.messageList = function (fCallback, sFolderFul
iLimit = Utils.isUnd(iOffset) ? 20 : Utils.pInt(iLimit);
sSearch = Utils.pString(sSearch);
if ('' !== sFolderHash)
if ('' !== sFolderHash && ('' === sSearch || -1 === sSearch.indexOf('has:')))
{
this.defaultRequest(fCallback, 'MessageList', {},
'' === sSearch ? Consts.Defaults.DefaultAjaxTimeout : Consts.Defaults.SearchAjaxTimeout,

File diff suppressed because one or more lines are too long