mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-10 06:58:27 +03:00
Merged from sub repository (filters - step 4)
This commit is contained in:
parent
67e45a6a6f
commit
e4b286e257
58 changed files with 1176 additions and 236 deletions
|
|
@ -1180,14 +1180,13 @@
|
|||
if (window.google && window.google.picker)
|
||||
{
|
||||
var drivePicker = new window.google.picker.PickerBuilder()
|
||||
.addView(
|
||||
new window.google.picker.DocsView()
|
||||
.setIncludeFolders(true)
|
||||
)
|
||||
// .addView(window.google.picker.ViewId.FOLDERS)
|
||||
.addView(window.google.picker.ViewId.DOCS)
|
||||
.setAppId(Settings.settingsGet('GoogleClientID'))
|
||||
.setOAuthToken(oOauthToken.access_token)
|
||||
.setCallback(_.bind(self.driveCallback, self, oOauthToken.access_token))
|
||||
.enableFeature(window.google.picker.Feature.NAV_HIDDEN)
|
||||
// .setOrigin(window.location.protocol + '//' + window.location.host)
|
||||
.build()
|
||||
;
|
||||
|
||||
|
|
@ -1205,14 +1204,9 @@
|
|||
|
||||
window.gapi.load('auth', {'callback': function () {
|
||||
|
||||
var oAuthToken = window.gapi.auth.getToken();
|
||||
if (!oAuthToken)
|
||||
{
|
||||
window.gapi.auth.authorize({
|
||||
'client_id': Settings.settingsGet('GoogleClientID'),
|
||||
'scope': 'https://www.googleapis.com/auth/drive.readonly',
|
||||
'immediate': true
|
||||
}, function (oAuthResult) {
|
||||
var
|
||||
oAuthToken = window.gapi.auth.getToken(),
|
||||
fResult = function (oAuthResult) {
|
||||
if (oAuthResult && !oAuthResult.error)
|
||||
{
|
||||
var oAuthToken = window.gapi.auth.getToken();
|
||||
|
|
@ -1220,23 +1214,29 @@
|
|||
{
|
||||
self.driveCreatePiker(oAuthToken);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
return false;
|
||||
}
|
||||
;
|
||||
|
||||
if (!oAuthToken)
|
||||
{
|
||||
window.gapi.auth.authorize({
|
||||
'client_id': Settings.settingsGet('GoogleClientID'),
|
||||
'scope': 'https://www.googleapis.com/auth/drive.readonly',
|
||||
'immediate': true
|
||||
}, function (oAuthResult) {
|
||||
|
||||
if (!fResult(oAuthResult))
|
||||
{
|
||||
window.gapi.auth.authorize({
|
||||
'client_id': Settings.settingsGet('GoogleClientID'),
|
||||
'scope': 'https://www.googleapis.com/auth/drive.readonly',
|
||||
'immediate': false
|
||||
}, function (oAuthResult) {
|
||||
if (oAuthResult && !oAuthResult.error)
|
||||
{
|
||||
var oAuthToken = window.gapi.auth.getToken();
|
||||
if (oAuthToken)
|
||||
{
|
||||
self.driveCreatePiker(oAuthToken);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, fResult);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
ko = require('ko'),
|
||||
|
||||
Consts = require('Common/Consts'),
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
|
||||
Data = require('Storage/User/Data'),
|
||||
|
|
@ -24,28 +25,102 @@
|
|||
{
|
||||
AbstractView.call(this, 'Popups', 'PopupsFilter');
|
||||
|
||||
this.isNew = ko.observable(true);
|
||||
|
||||
this.fTrueCallback = null;
|
||||
this.filter = ko.observable(null);
|
||||
|
||||
this.selectedFolderValue = ko.observable(Consts.Values.UnuseOptionValue);
|
||||
this.folderSelectList = Data.folderMenuForMove;
|
||||
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
|
||||
|
||||
this.saveFilter = Utils.createCommand(this, function () {
|
||||
|
||||
if (this.filter())
|
||||
{
|
||||
if ('' === this.filter().name())
|
||||
{
|
||||
this.filter().name.error(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.fTrueCallback)
|
||||
{
|
||||
this.fTrueCallback(this.filter());
|
||||
}
|
||||
|
||||
if (this.modalVisibility())
|
||||
{
|
||||
Utils.delegateRun(this, 'closeCommand');
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
this.actionTypeOptions = [
|
||||
{'id': Enums.FiltersAction.None, 'name': 'None @i18n'},
|
||||
{'id': Enums.FiltersAction.Move, 'name': ' Move to @i18n'},
|
||||
// {'id': Enums.FiltersAction.Forward, 'name': 'Forward to @i18n'},
|
||||
{'id': Enums.FiltersAction.Discard, 'name': 'Discard @i18n'}
|
||||
];
|
||||
|
||||
this.fieldOptions = [
|
||||
{'id': Enums.FilterConditionField.From, 'name': 'From @i18n'},
|
||||
{'id': Enums.FilterConditionField.Recipient, 'name': 'Recipient (To or CC) @i18n'},
|
||||
{'id': Enums.FilterConditionField.Subject, 'name': 'Subject @i18n'}
|
||||
];
|
||||
|
||||
this.typeOptions = [
|
||||
{'id': Enums.FilterConditionType.EqualTo, 'name': 'Equal To @i18n'},
|
||||
{'id': Enums.FilterConditionType.NotEqualTo, 'name': 'Not Equal To @i18n'},
|
||||
{'id': Enums.FilterConditionType.Contains, 'name': 'Contains @i18n'},
|
||||
{'id': Enums.FilterConditionType.NotContains, 'name': 'Not Contains @i18n'}
|
||||
];
|
||||
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
kn.extendAsViewModel(['View/Popup/Filter', 'PopupsFilterViewModel'], FilterPopupView);
|
||||
_.extend(FilterPopupView.prototype, AbstractView.prototype);
|
||||
|
||||
FilterPopupView.prototype.clearPopup = function ()
|
||||
FilterPopupView.prototype.removeCondition = function (oConditionToDelete)
|
||||
{
|
||||
// TODO
|
||||
if (this.filter())
|
||||
{
|
||||
this.filter().removeCondition(oConditionToDelete);
|
||||
}
|
||||
};
|
||||
|
||||
FilterPopupView.prototype.onShow = function (oFilter)
|
||||
FilterPopupView.prototype.clearPopup = function ()
|
||||
{
|
||||
this.isNew(true);
|
||||
|
||||
this.fTrueCallback = null;
|
||||
this.filter(null);
|
||||
};
|
||||
|
||||
FilterPopupView.prototype.onShow = function (oFilter, fTrueCallback, bEdit)
|
||||
{
|
||||
this.clearPopup();
|
||||
|
||||
this.fTrueCallback = fTrueCallback;
|
||||
this.filter(oFilter);
|
||||
|
||||
this.isNew(!bEdit);
|
||||
|
||||
if (!bEdit && oFilter)
|
||||
{
|
||||
oFilter.name.focused(true);
|
||||
}
|
||||
};
|
||||
|
||||
FilterPopupView.prototype.onFocus = function ()
|
||||
{
|
||||
if (this.isNew() && this.filter())
|
||||
{
|
||||
this.filter().name.focused(true);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = FilterPopupView;
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@
|
|||
}
|
||||
|
||||
var
|
||||
oEl = Utils.draggeblePlace(),
|
||||
oEl = Utils.draggablePlace(),
|
||||
aUids = Data.messageListCheckedOrSelectedUidsWithSubMails()
|
||||
;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue