Contacts improvements (Added URL and Nickname fields)

This commit is contained in:
RainLoop Team 2014-05-01 04:01:31 +04:00
parent f36cb72b82
commit ef880319c6
42 changed files with 831 additions and 279 deletions

View file

@ -2465,6 +2465,15 @@ class Actions
$oImapClient->Disconnect();
$bImapResult = true;
}
catch (\MailSo\Net\Exceptions\SocketCanNotConnectToHostException $oException)
{
$this->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR);
$sImapErrorDesc = $oException->getSocketMessage();
if (empty($sImapErrorDesc))
{
$sImapErrorDesc = $oException->getMessage();
}
}
catch (\Exception $oException)
{
$this->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR);
@ -2482,6 +2491,15 @@ class Actions
$oSmtpClient->Disconnect();
$bSmtpResult = true;
}
catch (\MailSo\Net\Exceptions\SocketCanNotConnectToHostException $oException)
{
$this->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR);
$sSmtpErrorDesc = $oException->getSocketMessage();
if (empty($sSmtpErrorDesc))
{
$sSmtpErrorDesc = $oException->getMessage();
}
}
catch (\Exception $oException)
{
$this->Logger()->WriteException($oException, \MailSo\Log\Enumerations\Type::ERROR);

View file

@ -220,6 +220,9 @@ class Contact
case PropertyType::NICK_NAME:
$oVCard->NICKNAME = $oProperty->Value;
break;
case PropertyType::NOTE:
$oVCard->NOTE = $oProperty->Value;
break;
case PropertyType::FIRST_NAME:
$sFirstName = $oProperty->Value;
break;
@ -511,11 +514,11 @@ class Contact
$aProperties[] = new Property(PropertyType::NICK_NAME, $sValue);
}
// if (isset($oVCard->NOTE) && '' !== \trim($oVCard->NOTE))
// {
// $sValue = $this->getPropertyValueHelper($oVCard->NOTE, $bOldVersion);
// $aProperties[] = new Property(PropertyType::NOTE, $sValue);
// }
if (isset($oVCard->NOTE) && '' !== \trim($oVCard->NOTE))
{
$sValue = $this->getPropertyValueHelper($oVCard->NOTE, $bOldVersion);
$aProperties[] = new Property(PropertyType::NOTE, $sValue);
}
if (isset($oVCard->N))
{

View file

@ -21,6 +21,8 @@ class PropertyType
// const MOBILE = 32;
// const FAX = 33;
const WEB_PAGE = 32;
const BIRTHDAY = 40;
const FACEBOOK = 90;
const SKYPE = 91;

View file

@ -923,7 +923,7 @@ class PdoAddressBook
$iUserID = $this->getUserId($sEmail);
$sTypes = implode(',', array(
PropertyType::EMAIl, PropertyType::FIRST_NAME, PropertyType::LAST_NAME
PropertyType::EMAIl, PropertyType::FIRST_NAME, PropertyType::LAST_NAME, PropertyType::NICK_NAME
));
$sSql = 'SELECT id_contact, id_prop, prop_type, prop_value FROM rainloop_ab_properties '.
@ -961,9 +961,14 @@ class PdoAddressBook
$aIdContacts[$iIdContact] = $iIdContact;
$aIdProps[$iIdProp] = $iIdProp;
if (\in_array($iType, array(PropertyType::LAST_NAME, PropertyType::FIRST_NAME)))
if (\in_array($iType, array(PropertyType::LAST_NAME, PropertyType::FIRST_NAME, PropertyType::NICK_NAME)))
{
$aContactAllAccess[$iIdContact] = $iIdContact;
if (!isset($aContactAllAccess[$iIdContact]))
{
$aContactAllAccess[$iIdContact] = array();
}
$aContactAllAccess[$iIdContact][] = $iType;
}
}
}
@ -977,7 +982,7 @@ class PdoAddressBook
$oStmt->closeCursor();
$sTypes = \implode(',', array(
PropertyType::EMAIl, PropertyType::FIRST_NAME, PropertyType::LAST_NAME
PropertyType::EMAIl, PropertyType::FIRST_NAME, PropertyType::LAST_NAME, PropertyType::NICK_NAME
));
$sSql = 'SELECT id_prop, id_contact, prop_type, prop_value FROM rainloop_ab_properties '.
@ -990,6 +995,7 @@ class PdoAddressBook
if (\is_array($aFetch) && 0 < \count($aFetch))
{
$aNames = array();
$aNicks = array();
$aEmails = array();
foreach ($aFetch as $aItem)
@ -1000,7 +1006,11 @@ class PdoAddressBook
$iIdProp = (int) $aItem['id_prop'];
$iType = (int) $aItem['prop_type'];
if (\in_array($iType, array(PropertyType::LAST_NAME, PropertyType::FIRST_NAME)))
if (PropertyType::NICK_NAME === $iType)
{
$aNicks[$iIdContact] = $aItem['prop_value'];
}
else if (\in_array($iType, array(PropertyType::LAST_NAME, PropertyType::FIRST_NAME)))
{
if (!isset($aNames[$iIdContact]))
{
@ -1024,12 +1034,28 @@ class PdoAddressBook
foreach ($aEmails as $iId => $aItems)
{
$aNameItem = isset($aNames[$iId]) && \is_array($aNames[$iId]) ? $aNames[$iId] : array('', '');
$sNameItem = \trim($aNameItem[0].' '.$aNameItem[1]);
foreach ($aItems as $sEmail)
if (isset($aContactAllAccess[$iId]))
{
$aResult[] = array($sEmail, $sNameItem);
$bName = \in_array(PropertyType::FIRST_NAME, $aContactAllAccess[$iId]) || \in_array(PropertyType::LAST_NAME, $aContactAllAccess[$iId]);
$bNick = \in_array(PropertyType::NICK_NAME, $aContactAllAccess[$iId]);
$aNameItem = isset($aNames[$iId]) && \is_array($aNames[$iId]) ? $aNames[$iId] : array('', '');
$sNameItem = \trim($aNameItem[0].' '.$aNameItem[1]);
$sNickItem = isset($aNicks[$iId]) ? $aNicks[$iId] : '';
foreach ($aItems as $sEmail)
{
if ($bName)
{
$aResult[] = array($sEmail, $sNameItem);
}
if ($bNick)
{
$aResult[] = array($sEmail, $sNickItem);
}
}
}
}
}

View file

@ -9,7 +9,7 @@
</a>
</div>
<div class="btn-group">&nbsp;</div>
<div class="btn-group dropdown" data-bind="registrateBootstrapDropdown: true, openDropdownTrigger: moveDropdownTrigger">
<div class="btn-group dropdown colored-toggle" data-bind="registrateBootstrapDropdown: true, openDropdownTrigger: moveDropdownTrigger">
<a id="move-dropdown-id" href="#" tabindex="-1" class="btn btn-dark-disabled-border dropdown-toggle buttonMove" data-toggle="dropdown" data-tooltip-placement="bottom" data-bind="command: moveCommand, tooltip: 'MESSAGE_LIST/BUTTON_MOVE_TO'">
<i class="icon-folder"></i>
&nbsp;&nbsp;
@ -40,7 +40,7 @@
</a>
</div>
<div class="btn-group">&nbsp;</div>
<div class="btn-group dropdown" data-bind="registrateBootstrapDropdown: true, openDropdownTrigger: moreDropdownTrigger">
<div class="btn-group dropdown colored-toggle" data-bind="registrateBootstrapDropdown: true, openDropdownTrigger: moreDropdownTrigger">
<a id="more-list-dropdown-id" class="btn btn-dark-disabled-border dropdown-toggle buttonMore" href="#" tabindex="-1" data-toggle="dropdown" data-tooltip-placement="bottom" data-bind="tooltip: 'MESSAGE_LIST/BUTTON_MORE'">
<i class="icon-list"></i>
</a>

View file

@ -38,7 +38,7 @@
</a>
</div>
<div class="btn-group">&nbsp;</div>
<div class="btn-group dropdown" data-bind="registrateBootstrapDropdown: true, openDropdownTrigger: moreDropdownTrigger">
<div class="btn-group dropdown colored-toggle" data-bind="registrateBootstrapDropdown: true, openDropdownTrigger: moreDropdownTrigger">
<a id="more-view-dropdown-id" class="btn btn-dark-disabled-border dropdown-toggle buttonMore" href="#" tabindex="-1" data-toggle="dropdown" data-tooltip-placement="bottom" data-bind="command: messageVisibilityCommand, tooltip: 'MESSAGE/BUTTON_MORE'">
<i class="icon-list"></i>
</a>

View file

@ -107,7 +107,7 @@
<span class="i18n" data-i18n-text="COMPOSE/ATTACH_DROP_FILES_DESC"></span>
</div>
<div class="pull-right">
<div class="btn-group pull-right">
<div class="btn-group dropdown colored-toggle pull-right">
<a class="btn dropdown-toggle buttonMore" data-toggle="dropdown">
<i class="icon-list"></i>
</a>

View file

@ -27,7 +27,7 @@
</a>
</div>
<div class="btn-group dropdown" data-bind="registrateBootstrapDropdown: true">
<div class="btn-group dropdown colored-toggle" data-bind="registrateBootstrapDropdown: true">
<a id="contacts-more-dropdown-id" class="btn dropdown-toggle buttonMore" href="#" tabindex="-1" data-toggle="dropdown">
<i data-bind="css: {'icon-list': !contacts.importing() && !contacts.syncing(),
'icon-spinner animated': contacts.importing() || contacts.syncing()}"></i>
@ -128,12 +128,30 @@
<label class="control-label remove-padding-top fix-width">
<i class="icon-user iconsize24"></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" placeholder=""
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: value, hasFocus: focused, valueUpdate: 'keyup', attr: {'placeholder': placeholderValue}" />
<div class="controls fix-width">
<div data-bind="foreach: viewPropertiesNames">
<div class="property-line">
<span class="contactValueStatic" data-bind="text: value" />
<input type="text" class="contactValueInput" placeholder=""
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: value, hasFocus: focused, valueUpdate: 'keyup', attr: {'placeholder': placeholderValue}" />
</div>
</div>
<div data-bind="visible: 0 < viewPropertiesOther().length, foreach: viewPropertiesOther">
<div class="property-line">
<!-- ko if: !largeValue() -->
<span class="contactValueStatic" data-bind="text: value" />
<input type="text" class="contactValueInput" placeholder=""
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: value, hasFocus: focused, valueUpdate: 'keyup', attr: {'placeholder': placeholderValue}" />
<!-- /ko -->
<!-- ko if: largeValue -->
<span class="contactValueTextAreaStatic" data-bind="text: value" />
<textarea class="contactValueTextArea" placeholder=""
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: value, hasFocus: focused, valueUpdate: 'keyup', attr: {'placeholder': placeholderValue}"></textarea>
<!-- /ko -->
</div>
</div>
</div>
</div>
@ -145,7 +163,7 @@
<div data-bind="foreach: viewPropertiesEmails">
<div class="property-line">
<span class="contactValueStatic" data-bind="text: value" />
<input type="email" class="contactValueInput"
<input type="email" class="contactValueInput" placeholder=""
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: value, hasFocus: focused, valueUpdate: 'keyup'" />
</div>
@ -153,7 +171,7 @@
<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" data-bind="visible: !viewReadOnly() || 0 < viewPropertiesPhones().length">
<div class="control-group" data-bind="visible: 0 < viewPropertiesPhones().length">
<label class="control-label remove-padding-top fix-width">
<i class="icon-telephone iconsize24" data-tooltip-placement="left" data-bind="tooltip: 'CONTACTS/LABEL_PHONE'"></i>
</label>
@ -161,12 +179,11 @@
<div data-bind="foreach: viewPropertiesPhones">
<div class="property-line">
<span class="contactValueStatic" data-bind="text: value" />
<input type="text" class="contactValueInput"
<input type="text" class="contactValueInput" placeholder=""
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: value, hasFocus: focused, valueUpdate: 'keyup'" />
</div>
</div>
<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="visible: 0 < viewPropertiesWeb().length">
@ -176,8 +193,8 @@
<div class="controls fix-width">
<div data-bind="foreach: viewPropertiesWeb">
<div class="property-line">
<span class="contactValueStatic" data-bind="text: value" />
<input type="text" class="contactValueInput"
<span class="contactValueLargeStatic" data-bind="text: value" />
<input type="text" class="contactValueInputLarge" placeholder="http://"
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: value, hasFocus: focused, valueUpdate: 'keyup'" />
</div>
@ -192,9 +209,9 @@
</div>
</div>
<div class="e-read-only-sign">
<!-- <div class="e-read-only-sign">
<i class="icon-lock iconsize24" data-tooltip-placement="left" data-bind="tooltip: 'CONTACTS/LABEL_READ_ONLY'"></i>
</div>
</div>-->
<button class="btn button-save-contact" data-bind="command: saveCommand, css: {'dirty': watchDirty}">
<i data-bind="css: {'icon-ok': !viewSaving(), 'icon-spinner animated': viewSaving()}"></i>
@ -202,6 +219,42 @@
<span class="i18n" data-i18n-text="CONTACTS/BUTTON_CREATE_CONTACT" data-bind="visible: '' === viewID()"></span>
<span class="i18n" data-i18n-text="CONTACTS/BUTTON_UPDATE_CONTACT" data-bind="visible: '' !== viewID()"></span>
</button>
<div class="btn-group pull-right dropdown colored-toggle button-add-prop" data-bind="registrateBootstrapDropdown: true">
<a id="button-add-prop-dropdown-id" href="#" tabindex="-1" class="btn dropdown-toggle" data-toggle="dropdown">
<span class="i18n" data-i18n-text="CONTACTS/ADD_MENU_LABEL"></span>
&nbsp;&nbsp;
<span class="caret"></span>
</a>
<ul class="dropdown-menu g-ui-menu" tabindex="-1" role="menu" aria-labelledby="button-add-prop-dropdown-id">
<li class="e-item" role="presentation">
<a class="e-link menuitem" href="#" tabindex="-1" data-bind="click: addNewEmail">
<span class="i18n" data-i18n-text="CONTACTS/ADD_MENU_EMAIL"></span>
</a>
</li>
<li class="e-item" role="presentation">
<a class="e-link menuitem" href="#" tabindex="-1" data-bind="click: addNewPhone">
<span class="i18n" data-i18n-text="CONTACTS/ADD_MENU_PHONE"></span>
</a>
</li>
<li class="e-item" role="presentation">
<a class="e-link menuitem" href="#" tabindex="-1" data-bind="click: addNewWeb">
<span class="i18n" data-i18n-text="CONTACTS/ADD_MENU_URL"></span>
</a>
</li>
<li class="divider" role="presentation"></li>
<li class="e-item" role="presentation">
<a class="e-link menuitem" href="#" tabindex="-1" data-bind="click: addNewNickname">
<span class="i18n" data-i18n-text="CONTACTS/ADD_MENU_NICKNAME"></span>
</a>
</li>
<!-- <li class="e-item" role="presentation">
<a class="e-link menuitem" href="#" tabindex="-1" data-bind="click: addNewAddress">
<span class="i18n" data-i18n-text="CONTACTS/ADD_MENU_ADDRESS"></span>
</a>
</li>-->
</ul>
</div>
</div>
</div>
</div>

View file

@ -9,7 +9,7 @@
<div class="btn-group pull-right">
&nbsp;&nbsp;&nbsp;
</div>-->
<div class="btn-group pull-right dropdown" data-bind="registrateBootstrapDropdown: true, openDropdownTrigger: accountMenuDropdownTrigger">
<div class="btn-group pull-right dropdown colored-toggle" data-bind="registrateBootstrapDropdown: true, openDropdownTrigger: accountMenuDropdownTrigger">
<a id="top-system-dropdown-id" href="#" tabindex="-1" class="btn btn-ellipsis btn-block dropdown-toggle system-dropdown"
data-toggle="dropdown" data-tooltip-placement="left"
data-tooltip-class="tooltip-big" data-bind="tooltip2: emailTitle">