Implementation of share contacts (begin)

This commit is contained in:
RainLoop Team 2013-12-18 20:05:30 +04:00
parent 5198dcfa20
commit 026839d864
17 changed files with 469 additions and 50 deletions

View file

@ -7244,6 +7244,12 @@ html.rl-message-fullscreen .messageView .b-content .buttonFull {
float: left;
padding: 0 8px 0 6px;
}
.b-contacts-content.modal .b-list-content .e-contact-item .shareParent {
display: none;
float: right;
position: relative;
margin: 2px 8px 0 5px;
}
.b-contacts-content.modal .b-list-content .e-contact-item .nameParent {
display: block;
overflow: hidden;
@ -7266,6 +7272,9 @@ html.rl-message-fullscreen .messageView .b-content .buttonFull {
position: relative;
margin: 0 5px;
}
.b-contacts-content.modal .b-list-content .e-contact-item.shared .shareParent {
display: inline-block;
}
.b-contacts-content.modal .b-list-content .e-contact-item.checked {
z-index: 101;
}
@ -7293,6 +7302,21 @@ html.rl-message-fullscreen .messageView .b-content .buttonFull {
.b-contacts-content.modal .b-view-content .content {
-webkit-overflow-scrolling: touch;
}
.b-contacts-content.modal .b-view-content .contactValueStatic {
height: 20px;
line-height: 20px;
font-size: 18px;
display: inline-block;
padding: 5px 7px;
color: #555;
display: none;
}
.b-contacts-content.modal .b-view-content.read-only .contactValueStatic {
display: inline-block;
}
.b-contacts-content.modal .b-view-content.read-only .contactValueInput {
display: none;
}
.b-contacts-content.modal .b-view-content .b-contact-view-desc {
text-align: center;
font-size: 24px;
@ -7312,18 +7336,64 @@ html.rl-message-fullscreen .messageView .b-content .buttonFull {
}
.b-contacts-content.modal .b-view-content .add-link {
padding-top: 5px;
padding-left: 7px;
font-size: 12px;
color: #aaa;
}
.b-contacts-content.modal .b-view-content .contactValueStatic {
font-size: 18px;
display: none;
}
.b-contacts-content.modal .b-view-content .contactValueInput {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
border-color: #fff;
font-size: 18px;
width: 250px;
}
.b-contacts-content.modal .b-view-content .contactValueInput:hover {
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
border-color: #ccc;
}
.b-contacts-content.modal .b-view-content .contactValueInput:focus {
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
border-color: #999;
}
.b-contacts-content.modal .b-view-content .hasError .contactValueInput {
color: #ee5f5b;
border: 1px solid #ee5f5b;
border-color: #ee5f5b;
}
.b-contacts-content.modal .b-view-content .e-read-only-sign {
display: none;
position: absolute;
top: 20px;
right: 40px;
}
.b-contacts-content.modal .b-view-content .e-share-sign {
position: absolute;
top: 60px;
right: 20px;
cursor: pointer;
}
.b-contacts-content.modal .b-view-content .button-save-contact {
position: absolute;
top: 20px;
right: 20px;
}
.b-contacts-content.modal .b-view-content.read-only .e-read-only-sign {
display: inline-block;
}
.b-contacts-content.modal .b-view-content.read-only .e-share-sign {
display: none;
}
.b-contacts-content.modal .b-view-content.read-only .button-save-contact {
display: none;
}
.b-contacts-content .e-contact-item {
position: relative;
height: 55px;

File diff suppressed because one or more lines are too long

View file

@ -489,6 +489,20 @@ Enums.InterfaceAnimation = {
'Full': 'Full'
};
/**
* @enum {number}
*/
Enums.ContactScopeType = {
'Default': 0,
'Auto': 1,
'ShareAll': 2,
'ShareDomain': 3,
'ShareEmail': 4
};
/**
* @enum {number}
*/

File diff suppressed because one or more lines are too long

View file

@ -489,6 +489,20 @@ Enums.InterfaceAnimation = {
'Full': 'Full'
};
/**
* @enum {number}
*/
Enums.ContactScopeType = {
'Default': 0,
'Auto': 1,
'ShareAll': 2,
'ShareDomain': 3,
'ShareEmail': 4
};
/**
* @enum {number}
*/
@ -5776,10 +5790,14 @@ function ContactModel()
this.idContact = 0;
this.display = '';
this.properties = [];
this.readOnly = false;
this.scopeType = Enums.ContactScopeType.Default;
this.scopeValue = '';
this.checked = ko.observable(false);
this.selected = ko.observable(false);
this.deleted = ko.observable(false);
this.shared = ko.observable(false);
}
/**
@ -5823,6 +5841,9 @@ ContactModel.prototype.parse = function (oItem)
{
this.idContact = Utils.pInt(oItem['IdContact']);
this.display = Utils.pString(oItem['Display']);
this.readOnly = !!oItem['ReadOnly'];
this.scopeType = Utils.pInt(oItem['ScopeType']);
this.scopeValue = Utils.pString(oItem['ScopeValue']);
if (Utils.isNonEmptyArray(oItem['Properties']))
{
@ -5833,6 +5854,10 @@ ContactModel.prototype.parse = function (oItem)
}
}, this);
}
this.shared(-1 < Utils.inArray(this.scopeType, [
Enums.ContactScopeType.ShareAll, Enums.ContactScopeType.ShareDomain, Enums.ContactScopeType.ShareEmail
]));
bResult = true;
}
@ -5874,6 +5899,10 @@ ContactModel.prototype.lineAsCcc = function ()
{
aResult.push('checked');
}
if (this.shared())
{
aResult.push('shared');
}
return aResult.join(' ');
};
@ -9316,6 +9345,9 @@ function PopupsContactsViewModel()
this.viewClearSearch = ko.observable(false);
this.viewID = ko.observable('');
this.viewReadOnly = ko.observable(false);
this.viewScopeType = ko.observable(Enums.ContactScopeType.Default);
this.viewScopeValue = ko.observable('');
this.viewProperties = ko.observableArray([]);
this.viewPropertiesNames = this.viewProperties.filter(function(oProperty) {
@ -9326,6 +9358,24 @@ function PopupsContactsViewModel()
return -1 < Utils.inArray(oProperty.type(), aEmailTypes);
});
this.shareToNone = ko.computed(function() {
return -1 === Utils.inArray(this.viewScopeType(), [
Enums.ContactScopeType.ShareAll, Enums.ContactScopeType.ShareDomain, Enums.ContactScopeType.ShareEmail
]);
}, this);
this.shareToAll = ko.computed(function() {
return Enums.ContactScopeType.ShareAll === this.viewScopeType();
}, this);
this.shareToDomain = ko.computed(function() {
return Enums.ContactScopeType.ShareDomain === this.viewScopeType();
}, this);
this.shareToEmail = ko.computed(function() {
return Enums.ContactScopeType.ShareEmail === this.viewScopeType();
}, this);
this.viewHasNonEmptyRequaredProperties = ko.computed(function() {
var
@ -9506,8 +9556,11 @@ function PopupsContactsViewModel()
}, sRequestUid, this.viewID(), aProperties);
}, function () {
var bV = this.viewHasNonEmptyRequaredProperties();
return !this.viewSaving() && bV;
var
bV = this.viewHasNonEmptyRequaredProperties(),
bReadOnly = this.viewReadOnly()
;
return !this.viewSaving() && bV && !bReadOnly;
});
this.bDropPageAfterDelete = false;
@ -9624,6 +9677,9 @@ PopupsContactsViewModel.prototype.populateViewContact = function (oContact)
;
this.emptySelection(false);
this.viewReadOnly(false);
this.viewScopeType(Enums.ContactScopeType.Default);
this.viewScopeValue('');
if (oContact)
{
@ -9642,6 +9698,10 @@ PopupsContactsViewModel.prototype.populateViewContact = function (oContact)
}
});
}
this.viewReadOnly(!!oContact.readOnly);
this.viewScopeType(oContact.scopeType);
this.viewScopeValue(oContact.scopeValue);
}
if (!bHasName)

File diff suppressed because one or more lines are too long