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

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

View file

@ -8,10 +8,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);
}
/**
@ -55,6 +59,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']))
{
@ -65,6 +72,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;
}
@ -106,6 +117,10 @@ ContactModel.prototype.lineAsCcc = function ()
{
aResult.push('checked');
}
if (this.shared())
{
aResult.push('shared');
}
return aResult.join(' ');
};

View file

@ -171,6 +171,13 @@
float: left;
padding: 0 8px 0 6px;
}
.shareParent {
display: none;
float: right;
position: relative;
margin: 2px 8px 0 5px;
}
.nameParent {
display: block;
@ -196,6 +203,10 @@
margin: 0 5px;
}
&.shared .shareParent {
display: inline-block;
}
&.checked {
z-index: 101;
@ -231,6 +242,26 @@
-webkit-overflow-scrolling: touch;
}
.contactValueStatic {
height: 20px;
line-height: 20px;
font-size: 18px;
display: inline-block;
padding: 5px 7px;
color: #555;
display: none;
}
&.read-only {
.contactValueStatic {
display: inline-block;
}
.contactValueInput {
display: none;
}
}
.b-contact-view-desc {
text-align: center;
font-size: 24px;
@ -254,26 +285,73 @@
.add-link {
padding-top: 5px;
padding-left: 7px;
font-size: 12px;
color: #aaa;
}
.contactValueStatic {
font-size: 18px;
display: none;
}
.contactValueInput {
.box-shadow(none);
border-color: #fff;
font-size: 18px;
width: 250px;
&:hover {
.box-shadow(inset 0 1px 1px rgba(0, 0, 0, 0.075));
border-color: #ccc;
}
&:focus {
.box-shadow(inset 0 1px 1px rgba(0, 0, 0, 0.075));
border-color: #999;
}
}
.hasError {
.contactValueInput {
color: #ee5f5b;
border: 1px solid #ee5f5b;
border-color: #ee5f5b;
}
}
.e-read-only-sign {
display: none;
position: absolute;
top: 20px;
right: 40px;
}
.e-share-sign {
position: absolute;
top: 60px;
right: 20px;
cursor: pointer;
}
.button-save-contact {
position: absolute;
top: 20px;
right: 20px;
}
&.read-only {
.e-read-only-sign {
display: inline-block;
}
.e-share-sign {
display: none;
}
.button-save-contact {
display: none;
}
}
}
}

View file

@ -46,6 +46,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) {
@ -56,6 +59,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
@ -236,8 +257,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;
@ -354,6 +378,9 @@ PopupsContactsViewModel.prototype.populateViewContact = function (oContact)
;
this.emptySelection(false);
this.viewReadOnly(false);
this.viewScopeType(Enums.ContactScopeType.Default);
this.viewScopeValue('');
if (oContact)
{
@ -372,6 +399,10 @@ PopupsContactsViewModel.prototype.populateViewContact = function (oContact)
}
});
}
this.viewReadOnly(!!oContact.readOnly);
this.viewScopeType(oContact.scopeType);
this.viewScopeValue(oContact.scopeValue);
}
if (!bHasName)

View file

@ -5927,6 +5927,9 @@ class Actions
/* @var $mResponse \RainLoop\Providers\PersonalAddressBook\Classes\Contact */
'IdContact' => $mResponse->IdContact,
'Display' => \MailSo\Base\Utils::Utf8Clear($mResponse->Display),
'ReadOnly' => $mResponse->ReadOnly,
'ScopeType' => $mResponse->ScopeType,
'ScopeValue' => $mResponse->ScopeValue,
'IdPropertyFromSearch' => $mResponse->IdPropertyFromSearch,
'Properties' => $this->responseObject($mResponse->Properties, $sParent, $aParameters)
));

View file

@ -29,6 +29,11 @@ class Contact
*/
public $ScopeType;
/**
* @var string
*/
public $ScopeValue;
/**
* @var int
*/
@ -44,6 +49,11 @@ class Contact
*/
public $Properties;
/**
* @var array
*/
public $ReadOnly;
public function __construct()
{
$this->Clear();
@ -57,9 +67,11 @@ class Contact
$this->DisplayName = '';
$this->DisplayEmail = '';
$this->ScopeType = \RainLoop\Providers\PersonalAddressBook\Enumerations\ScopeType::DEFAULT_;
$this->ScopeValue = '';
$this->Changed = \time();
$this->IdPropertyFromSearch = 0;
$this->Properties = array();
$this->ReadOnly = false;
}
public function UpdateDependentValues()
@ -72,6 +84,7 @@ class Contact
if ($oProperty)
{
$oProperty->ScopeType = $this->ScopeType;
$oProperty->ScopeValue = $this->ScopeValue;
$oProperty->UpdateDependentValues();
if ('' === $sDisplayName && \RainLoop\Providers\PersonalAddressBook\Enumerations\PropertyType::FULLNAME === $oProperty->Type &&

View file

@ -21,6 +21,11 @@ class Property
*/
public $ScopeType;
/**
* @var string
*/
public $ScopeValue;
/**
* @var string
*/
@ -52,6 +57,7 @@ class Property
$this->Type = PropertyType::UNKNOWN;
$this->ScopeType = \RainLoop\Providers\PersonalAddressBook\Enumerations\ScopeType::DEFAULT_;
$this->ScopeValue = '';
$this->TypeCustom = '';
$this->Value = '';

View file

@ -6,5 +6,7 @@ class ScopeType
{
const DEFAULT_ = 0;
const AUTO = 1;
const SHARE = 2;
const SHARE_ALL = 2;
const SHARE_DOMAIN = 3;
const SHARE_EMAIL = 4;
}

View file

@ -111,7 +111,7 @@ class PdoPersonalAddressBook
$aFreq = $this->getContactFreq($iUserID, $iIdContact);
$sSql = 'UPDATE rainloop_pab_contacts SET display = :display, display_name = :display_name, display_email = :display_email, '.
'scope_type = :scope_type, changed = :changed WHERE id_user = :id_user AND id_contact = :id_contact';
'scope_type = :scope_type, scope_value = :scope_value, changed = :changed WHERE id_user = :id_user AND id_contact = :id_contact';
$this->prepareAndExecute($sSql,
array(
@ -121,6 +121,7 @@ class PdoPersonalAddressBook
':display_name' => array($oContact->DisplayName, \PDO::PARAM_STR),
':display_email' => array($oContact->DisplayEmail, \PDO::PARAM_STR),
':scope_type' => array($oContact->ScopeType, \PDO::PARAM_INT),
':scope_value' => array($oContact->ScopeValue, \PDO::PARAM_STR),
':changed' => array($oContact->Changed, \PDO::PARAM_INT),
)
);
@ -137,8 +138,8 @@ class PdoPersonalAddressBook
else
{
$sSql = 'INSERT INTO rainloop_pab_contacts '.
'( id_user, display, display_name, display_email, scope_type, changed) VALUES '.
'(:id_user, :display, :display_name, :display_email, :scope_type, :changed)';
'( id_user, display, display_name, display_email, scope_type, scope_value, changed) VALUES '.
'(:id_user, :display, :display_name, :display_email, :scope_type, :scope_value, :changed)';
$this->prepareAndExecute($sSql,
array(
@ -147,6 +148,7 @@ class PdoPersonalAddressBook
':display_name' => array($oContact->DisplayName, \PDO::PARAM_STR),
':display_email' => array($oContact->DisplayEmail, \PDO::PARAM_STR),
':scope_type' => array($oContact->ScopeType, \PDO::PARAM_INT),
':scope_value' => array($oContact->ScopeValue, \PDO::PARAM_STR),
':changed' => array($oContact->Changed, \PDO::PARAM_INT)
)
);
@ -174,6 +176,7 @@ class PdoPersonalAddressBook
':id_contact' => array($iIdContact, \PDO::PARAM_INT),
':id_user' => array($iUserID, \PDO::PARAM_INT),
':scope_type' => array($oContact->ScopeType, \PDO::PARAM_INT),
':scope_value' => array($oContact->ScopeValue, \PDO::PARAM_STR),
':prop_type' => array($oProp->Type, \PDO::PARAM_INT),
':prop_type_custom' => array($oProp->TypeCustom, \PDO::PARAM_STR),
':prop_value' => array($oProp->Value, \PDO::PARAM_STR),
@ -183,8 +186,8 @@ class PdoPersonalAddressBook
}
$sSql = 'INSERT INTO rainloop_pab_properties '.
'( id_contact, id_user, prop_type, prop_type_custom, prop_value, prop_value_custom, scope_type, prop_frec) VALUES '.
'(:id_contact, :id_user, :prop_type, :prop_type_custom, :prop_value, :prop_value_custom, :scope_type, :prop_frec)';
'( id_contact, id_user, prop_type, prop_type_custom, prop_value, prop_value_custom, scope_type, scope_value, prop_frec) VALUES '.
'(:id_contact, :id_user, :prop_type, :prop_type_custom, :prop_value, :prop_value_custom, :scope_type, :scope_value, :prop_frec)';
$this->prepareAndExecute($sSql, $aParams, true);
}
@ -286,7 +289,10 @@ class PdoPersonalAddressBook
$iLimit = 0 < $iLimit ? (int) $iLimit : 20;
$sSearch = \trim($sSearch);
$iUserID = $this->getUserId($oAccount->ParentEmailHelper());
$sEmail = $oAccount->ParentEmailHelper();
$sDomain = \MailSo\Base\Utils::GetDomainFromEmail($sEmail);
$iUserID = $this->getUserId($sEmail);
$iCount = 0;
$aSearchIds = array();
@ -294,15 +300,24 @@ class PdoPersonalAddressBook
if (0 < \strlen($sSearch))
{
$sSql = 'SELECT id_prop, id_contact FROM rainloop_pab_properties WHERE id_user = :id_user'.
' AND scope_type = :scope_type AND prop_value LIKE :search ESCAPE \'=\' GROUP BY id_contact, id_prop';
$sSql = 'SELECT id_user, id_prop, id_contact FROM rainloop_pab_properties '.
'WHERE ('.
'(id_user = :id_user)'.
' OR (scope_type = :scope_type_share_all)'.
' OR (scope_type = :scope_type_share_domain AND scope_value = :scope_value_domain)'.
' OR (scope_type = :scope_type_share_email AND scope_value = :scope_value_email)'.
') AND prop_value LIKE :search ESCAPE \'=\' GROUP BY id_contact, id_prop';
$aParams = array(
':id_user' => array($iUserID, \PDO::PARAM_INT),
':scope_type' => array($iScopeType, \PDO::PARAM_INT),
':scope_type_share_all' => array(\RainLoop\Providers\PersonalAddressBook\Enumerations\ScopeType::SHARE_ALL, \PDO::PARAM_INT),
':scope_type_share_domain' => array(\RainLoop\Providers\PersonalAddressBook\Enumerations\ScopeType::SHARE_DOMAIN, \PDO::PARAM_INT),
':scope_type_share_email' => array(\RainLoop\Providers\PersonalAddressBook\Enumerations\ScopeType::SHARE_EMAIL, \PDO::PARAM_INT),
':scope_value_domain' => array($sDomain, \PDO::PARAM_STR),
':scope_value_email' => array($sEmail, \PDO::PARAM_STR),
':search' => array($this->specialConvertSearchValue($sSearch, '='), \PDO::PARAM_STR)
);
$oStmt = $this->prepareAndExecute($sSql, $aParams);
if ($oStmt)
{
@ -325,10 +340,22 @@ class PdoPersonalAddressBook
}
else
{
$sSql = 'SELECT COUNT(DISTINCT id_contact) as contact_count FROM rainloop_pab_properties WHERE id_user = :id_user AND scope_type = :scope_type';
$sSql = 'SELECT COUNT(DISTINCT id_contact) as contact_count FROM rainloop_pab_properties '.
'WHERE ('.
'(id_user = :id_user)'.
' OR (scope_type = :scope_type_share_all)'.
' OR (scope_type = :scope_type_share_domain AND scope_value = :scope_value_domain)'.
' OR (scope_type = :scope_type_share_email AND scope_value = :scope_value_email)'.
')'
;
$aParams = array(
':id_user' => array($iUserID, \PDO::PARAM_INT),
':scope_type' => array($iScopeType, \PDO::PARAM_INT)
':scope_type_share_all' => array(\RainLoop\Providers\PersonalAddressBook\Enumerations\ScopeType::SHARE_ALL, \PDO::PARAM_INT),
':scope_type_share_domain' => array(\RainLoop\Providers\PersonalAddressBook\Enumerations\ScopeType::SHARE_DOMAIN, \PDO::PARAM_INT),
':scope_type_share_email' => array(\RainLoop\Providers\PersonalAddressBook\Enumerations\ScopeType::SHARE_EMAIL, \PDO::PARAM_INT),
':scope_value_domain' => array($sDomain, \PDO::PARAM_STR),
':scope_value_email' => array($sEmail, \PDO::PARAM_STR)
);
$oStmt = $this->prepareAndExecute($sSql, $aParams);
@ -346,10 +373,22 @@ class PdoPersonalAddressBook
if (0 < $iCount)
{
$sSql = 'SELECT * FROM rainloop_pab_contacts WHERE id_user = :id_user AND scope_type = :scope_type';
$sSql = 'SELECT * FROM rainloop_pab_contacts '.
'WHERE ('.
'(id_user = :id_user)'.
' OR (scope_type = :scope_type_share_all)'.
' OR (scope_type = :scope_type_share_domain AND scope_value = :scope_value_domain)'.
' OR (scope_type = :scope_type_share_email AND scope_value = :scope_value_email)'.
')'
;
$aParams = array(
':id_user' => array($iUserID, \PDO::PARAM_INT),
':scope_type' => array($iScopeType, \PDO::PARAM_INT)
':scope_type_share_all' => array(\RainLoop\Providers\PersonalAddressBook\Enumerations\ScopeType::SHARE_ALL, \PDO::PARAM_INT),
':scope_type_share_domain' => array(\RainLoop\Providers\PersonalAddressBook\Enumerations\ScopeType::SHARE_DOMAIN, \PDO::PARAM_INT),
':scope_type_share_email' => array(\RainLoop\Providers\PersonalAddressBook\Enumerations\ScopeType::SHARE_EMAIL, \PDO::PARAM_INT),
':scope_value_domain' => array($sDomain, \PDO::PARAM_STR),
':scope_value_email' => array($sEmail, \PDO::PARAM_STR)
);
if (0 < \count($aSearchIds))
@ -384,7 +423,9 @@ class PdoPersonalAddressBook
$oContact->DisplayEmail = isset($aItem['display_email']) ? (string) $aItem['display_email'] : '';
$oContact->ScopeType = isset($aItem['scope_type']) ? (int) $aItem['scope_type'] :
\RainLoop\Providers\PersonalAddressBook\Enumerations\ScopeType::DEFAULT_;
$oContact->ScopeValue = isset($aItem['scope_value']) ? (string) $aItem['scope_value'] : '';
$oContact->Changed = isset($aItem['changed']) ? (int) $aItem['changed'] : 0;
$oContact->ReadOnly = $iUserID !== (isset($aItem['id_user']) ? (int) $aItem['id_user'] : 0);
$oContact->IdPropertyFromSearch = isset($aPropertyFromSearchIds[$iIdContact]) &&
0 < $aPropertyFromSearchIds[$iIdContact] ? $aPropertyFromSearchIds[$iIdContact] : 0;
@ -400,10 +441,8 @@ class PdoPersonalAddressBook
{
$oStmt->closeCursor();
$sSql = 'SELECT * FROM rainloop_pab_properties WHERE id_user = :id_user AND id_contact IN ('.\implode(',', $aIdContacts).')';
$oStmt = $this->prepareAndExecute($sSql, array(
':id_user' => array($iUserID, \PDO::PARAM_INT)
));
$sSql = 'SELECT * FROM rainloop_pab_properties WHERE id_contact IN ('.\implode(',', $aIdContacts).')';
$oStmt = $this->prepareAndExecute($sSql);
if ($oStmt)
{
@ -421,6 +460,7 @@ class PdoPersonalAddressBook
$oProperty->IdProperty = (int) $aItem['id_prop'];
$oProperty->ScopeType = isset($aItem['scope_type']) ? (int) $aItem['scope_type'] :
\RainLoop\Providers\PersonalAddressBook\Enumerations\ScopeType::DEFAULT_;
$oProperty->ScopeValue = isset($aItem['scope_value']) ? (string) $aItem['scope_value'] : '';
$oProperty->Type = (int) $aItem['prop_type'];
$oProperty->TypeCustom = isset($aItem['prop_type_custom']) ? (string) $aItem['prop_type_custom'] : '';
$oProperty->Value = (string) $aItem['prop_value'];
@ -467,18 +507,32 @@ class PdoPersonalAddressBook
}
$this->Sync();
$iUserID = $this->getUserId($oAccount->ParentEmailHelper());
$sEmail = $oAccount->ParentEmailHelper();
$sDomain = \MailSo\Base\Utils::GetDomainFromEmail($sEmail);
$iUserID = $this->getUserId($sEmail);
$sTypes = implode(',', array(
PropertyType::EMAIl_PERSONAL, PropertyType::EMAIl_BUSSINES, PropertyType::EMAIl_OTHER, PropertyType::FULLNAME
));
$sSql = 'SELECT id_contact, id_prop, prop_type, prop_value FROM rainloop_pab_properties '.
'WHERE id_user = :id_user AND prop_type IN ('.$sTypes.') AND prop_value LIKE :search ESCAPE \'=\'';
'WHERE ('.
'(id_user = :id_user)'.
' OR (scope_type = :scope_type_share_all)'.
' OR (scope_type = :scope_type_share_domain AND scope_value = :scope_value_domain)'.
' OR (scope_type = :scope_type_share_email AND scope_value = :scope_value_email)'.
') AND prop_type IN ('.$sTypes.') AND prop_value LIKE :search ESCAPE \'=\'';
$aParams = array(
':id_user' => array($iUserID, \PDO::PARAM_INT),
':limit' => array($iLimit, \PDO::PARAM_INT),
':scope_type_share_all' => array(\RainLoop\Providers\PersonalAddressBook\Enumerations\ScopeType::SHARE_ALL, \PDO::PARAM_INT),
':scope_type_share_domain' => array(\RainLoop\Providers\PersonalAddressBook\Enumerations\ScopeType::SHARE_DOMAIN, \PDO::PARAM_INT),
':scope_type_share_email' => array(\RainLoop\Providers\PersonalAddressBook\Enumerations\ScopeType::SHARE_EMAIL, \PDO::PARAM_INT),
':scope_value_domain' => array($sDomain, \PDO::PARAM_STR),
':scope_value_email' => array($sEmail, \PDO::PARAM_STR),
':search' => array($this->specialConvertSearchValue($sSearch, '='), \PDO::PARAM_STR)
);
@ -537,11 +591,9 @@ class PdoPersonalAddressBook
));
$sSql = 'SELECT id_prop, id_contact, prop_type, prop_value FROM rainloop_pab_properties '.
'WHERE id_user = :id_user AND prop_type IN ('.$sTypes.') AND id_contact IN ('.\implode(',', $aIdContacts).')';
'WHERE prop_type IN ('.$sTypes.') AND id_contact IN ('.\implode(',', $aIdContacts).')';
$oStmt = $this->prepareAndExecute($sSql, array(
':id_user' => array($iUserID, \PDO::PARAM_INT)
));
$oStmt = $this->prepareAndExecute($sSql);
if ($oStmt)
{
$aFetch = $oStmt->fetchAll(\PDO::FETCH_ASSOC);
@ -990,15 +1042,27 @@ SQLITEINITIAL;
{
case 'mysql':
return $this->dataBaseUpgrade($this->sDsnType.'-pab-version', array(
1 => $this->getInitialTablesArray($this->sDsnType)
1 => $this->getInitialTablesArray($this->sDsnType),
2 => array(
'ALTER TABLE rainloop_pab_contacts ADD scope_value varchar(128) NOT NULL DEFAULT \'\' AFTER scope_type',
'ALTER TABLE rainloop_pab_properties ADD scope_value varchar(128) NOT NULL DEFAULT \'\' AFTER scope_type'
)
));
case 'pgsql':
return $this->dataBaseUpgrade($this->sDsnType.'-pab-version', array(
1 => $this->getInitialTablesArray($this->sDsnType)
1 => $this->getInitialTablesArray($this->sDsnType),
2 => array(
'ALTER TABLE rainloop_pab_contacts ADD scope_value varchar(128) NOT NULL DEFAULT \'\'',
'ALTER TABLE rainloop_pab_properties ADD scope_value varchar(128) NOT NULL DEFAULT \'\''
)
));
case 'sqlite':
return $this->dataBaseUpgrade($this->sDsnType.'-pab-version', array(
1 => $this->getInitialTablesArray($this->sDsnType)
1 => $this->getInitialTablesArray($this->sDsnType),
2 => array(
'ALTER TABLE rainloop_pab_contacts ADD scope_value text NOT NULL default \'\'',
'ALTER TABLE rainloop_pab_properties ADD scope_value text NOT NULL default \'\''
)
));
}

View file

@ -68,6 +68,9 @@
<div class="checkedParent">
<i class="checkboxItem" data-bind="css: checked() || selected() ? 'checkboxMessage icon-checkbox-checked' : 'checkboxMessage icon-checkbox-unchecked'"></i>
</div>
<div class="shareParent actionHandle">
<i class="icon-share"></i>
</div>
<div class="nameParent actionHandle">
<span class="listName" data-bind="text: display"></span>
&nbsp;
@ -83,7 +86,7 @@
<!-- ko template: { name: 'Pagenator', data: contactsPagenator } --><!-- /ko -->
</div>
</div>
<div class="b-view-content" data-bind="nano: true">
<div class="b-view-content" data-bind="nano: true, css: {'read-only': viewReadOnly}">
<div class="content g-scrollbox">
<div class="content-wrapper">
<div class="b-contact-view-desc" data-bind="visible: emptySelection">
@ -91,40 +94,43 @@
</div>
<div data-bind="visible: !emptySelection()">
<div class="form-horizontal top-part">
<div class="control-group">
<div class="control-group" data-bind="visible: !viewReadOnly() || 0 < viewPropertiesNames().length">
<label class="control-label remove-padding-top fix-width">
<i class="icon-user iconsize24" data-placement="left" data-bind="tooltip: 'CONTACTS/LABEL_DISPLAY_NAME'"></i>
</label>
<div class="controls fix-width" data-bind="foreach: viewPropertiesNames">
<div class="property-line">
<span class="contactValueStatic" data-bind="text: value" />
<input type="text" class="contactValueInput" data-bind="value: value, hasFocus: focused, valueUpdate: 'keyup'" />
</div>
</div>
</div>
<div class="control-group">
<div class="control-group" data-bind="visible: !viewReadOnly() || 0 < viewPropertiesEmails().length">
<label class="control-label remove-padding-top fix-width">
<i class="icon-at iconsize24" data-placement="left" data-bind="tooltip: 'CONTACTS/LABEL_EMAIL'"></i>
</label>
<div class="controls fix-width">
<div data-bind="foreach: viewPropertiesEmails">
<div class="property-line">
<span class="contactValueStatic" data-bind="text: value" />
<input type="email" class="contactValueInput" data-bind="value: value, hasFocus: focused, valueUpdate: 'keyup'" />
</div>
</div>
<a href="javascript:void(0);" class="g-ui-link add-link i18n" data-bind="click: addNewEmail" data-i18n-text="CONTACTS/LINK_ADD_EMAIL"></a>
<a href="javascript:void(0);" class="g-ui-link add-link i18n" data-bind="visible: !viewReadOnly(), click: addNewEmail" data-i18n-text="CONTACTS/LINK_ADD_EMAIL"></a>
</div>
</div>
<div class="control-group">
<div class="control-group" data-bind="visible: !viewReadOnly() || 0 < viewPropertiesPhones().length">
<label class="control-label remove-padding-top fix-width">
<i class="icon-telephone iconsize24" data-placement="left" data-bind="tooltip: 'CONTACTS/LABEL_PHONE'"></i>
</label>
<div class="controls fix-width">
<div data-bind="foreach: viewPropertiesPhones">
<div class="property-line">
<span class="contactValueStatic" data-bind="text: value" />
<input type="text" class="contactValueInput" data-bind="value: value, hasFocus: focused, valueUpdate: 'keyup'" />
</div>
</div>
<a href="javascript:void(0);" class="g-ui-link add-link i18n" data-bind="click: addNewPhone" data-i18n-text="CONTACTS/LINK_ADD_PHONE"></a>
<a href="javascript:void(0);" class="g-ui-link add-link i18n" data-bind="visible: !viewReadOnly(), click: addNewPhone" data-i18n-text="CONTACTS/LINK_ADD_PHONE"></a>
</div>
</div>
<!-- <div class="control-group" data-bind="foreach: viewPropertiesOther">
@ -133,6 +139,7 @@
</label>
<div class="controls fix-width">
<div class="property-line">
<span class="contactValueStatic" data-bind="text: value" />
<input type="text" class="contactValueInput" data-bind="value: value, hasFocus: focused, valueUpdate: 'keyup'" />
</div>
</div>
@ -145,6 +152,43 @@
</div>
</div>
<div class="e-read-only-sign" style="display: none">
<i class="icon-lock iconsize24" data-placement="left" data-bind="tooltip: 'CONTACTS/LABEL_READ_ONLY'"></i>
</div>
<div class="e-share-sign" style="display: none">
<div class="btn-group pull-right">
<a class="btn dropdown-toggle" data-placement="left" data-toggle="dropdown" data-bind="tooltip: 'CONTACTS/LABEL_SHARE'">
<i class="icon-share"></i>
&nbsp;&nbsp;
<span class="caret"></span>
</a>
<ul class="dropdown-menu g-ui-menu">
<li class="e-item">
<a class="e-link" data-bind="css: {'selected': this.shareToNone}">
<i class="icon-none"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n-text="CONTACTS/BUTTON_SHARE_NONE"></span>
</a>
</li>
<li class="e-item">
<a class="e-link" data-bind="css: {'selected': this.shareToDomain}">
<i class="icon-none"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n-text="CONTACTS/BUTTON_SHARE_DOMAIN"></span>
</a>
</li>
<li class="e-item">
<a class="e-link" data-bind="css: {'selected': this.shareToAll}">
<i class="icon-none"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n-text="CONTACTS/BUTTON_SHARE_ALL"></span>
</a>
</li>
</ul>
</div>
</div>
<button class="btn button-save-contact" data-bind="command: saveCommand">
<i data-bind="css: {'icon-ok': !viewSaving(), 'icon-spinner animated': viewSaving()}"></i>
&nbsp;&nbsp;

View file

@ -144,6 +144,11 @@ LABEL_EMAIL = "Email"
LABEL_PHONE = "Phone"
LINK_ADD_EMAIL = "Add an email address"
LINK_ADD_PHONE = "Add a phone"
LABEL_READ_ONLY = "Read only"
LABEL_SHARE = "Share"
BUTTON_SHARE_NONE = "None"
BUTTON_SHARE_ALL = "All"
BUTTON_SHARE_DOMAIN = "Domain"
[COMPOSE]
TITLE_FROM = "From"

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