Folder unread count view fix.

Add MailSo HtmlUtils ClearHtmlSimple function
This commit is contained in:
RainLoop Team 2013-12-16 19:43:04 +04:00
parent e0d6c9bb34
commit c8a5d45f37
9 changed files with 52 additions and 6270 deletions

1
.gitignore vendored
View file

@ -1,6 +1,7 @@
/.idea /.idea
/nbproject /nbproject
/npm-debug.log /npm-debug.log
/rainloop/v/0.0.0/static/css/less.css
/node_modules /node_modules
/build/local /build/local
/build/dist /build/dist

View file

@ -77,6 +77,7 @@
} }
.count { .count {
position: relative;
display: none; display: none;
margin-top: 5px; margin-top: 5px;
line-height: 19px; line-height: 19px;

View file

@ -147,10 +147,11 @@ class HtmlUtils
* @param array $aFoundCIDs * @param array $aFoundCIDs
* @param array $aContentLocationUrls * @param array $aContentLocationUrls
* @param array $aFoundedContentLocationUrls * @param array $aFoundedContentLocationUrls
* @param bool $bDoNotReplaceExternalUrl = false
* *
* @return string * @return string
*/ */
public static function ClearStyle($sStyle, $oElement, &$bHasExternals, &$aFoundCIDs, $aContentLocationUrls, &$aFoundedContentLocationUrls) public static function ClearStyle($sStyle, $oElement, &$bHasExternals, &$aFoundCIDs, $aContentLocationUrls, &$aFoundedContentLocationUrls, $bDoNotReplaceExternalUrl = false)
{ {
$sStyle = \trim($sStyle); $sStyle = \trim($sStyle);
$aOutStyles = array(); $aOutStyles = array();
@ -215,21 +216,24 @@ class HtmlUtils
if (\preg_match('/http[s]?:\/\//i', $sUrl)) if (\preg_match('/http[s]?:\/\//i', $sUrl))
{ {
$bHasExternals = true; $bHasExternals = true;
if (\in_array($sName, array('background-image', 'list-style-image', 'content'))) if (!$bDoNotReplaceExternalUrl)
{ {
$sStyleItem = ''; if (\in_array($sName, array('background-image', 'list-style-image', 'content')))
{
$sStyleItem = '';
}
$sTemp = '';
if ($oElement->hasAttribute('data-x-style-url'))
{
$sTemp = \trim($oElement->getAttribute('data-x-style-url'));
}
$sTemp = empty($sTemp) ? '' : (';' === \substr($sTemp, -1) ? $sTemp.' ' : $sTemp.'; ');
$oElement->setAttribute('data-x-style-url', \trim($sTemp.
('background' === $sName ? 'background-image' : $sName).': '.$sFullUrl, ' ;'));
} }
$sTemp = '';
if ($oElement->hasAttribute('data-x-style-url'))
{
$sTemp = \trim($oElement->getAttribute('data-x-style-url'));
}
$sTemp = empty($sTemp) ? '' : (';' === \substr($sTemp, -1) ? $sTemp.' ' : $sTemp.'; ');
$oElement->setAttribute('data-x-style-url', \trim($sTemp.
('background' === $sName ? 'background-image' : $sName).': '.$sFullUrl, ' ;'));
} }
else if ('data:image/' !== \strtolower(\substr(\trim($sUrl), 0, 11))) else if ('data:image/' !== \strtolower(\substr(\trim($sUrl), 0, 11)))
{ {
@ -257,17 +261,36 @@ class HtmlUtils
return \implode(';', $aOutStyles); return \implode(';', $aOutStyles);
} }
/**
* @param string $sHtml
* @param bool $bDoNotReplaceExternalUrl = false
*
* @return string
*/
public static function ClearHtmlSimple($sHtml, $bDoNotReplaceExternalUrl = false)
{
$bHasExternals = false;
$aFoundCIDs = array();
$aContentLocationUrls = array();
$aFoundedContentLocationUrls = array();
return \MailSo\Base\HtmlUtils::ClearHtml($sHtml, $bHasExternals, $aFoundCIDs,
$aContentLocationUrls, $aFoundedContentLocationUrls, $bDoNotReplaceExternalUrl);
}
/** /**
* @param string $sHtml * @param string $sHtml
* @param bool $bHasExternals = false * @param bool $bHasExternals = false
* @param array $aFoundCIDs = array() * @param array $aFoundCIDs = array()
* @param array $aContentLocationUrls = array() * @param array $aContentLocationUrls = array()
* @param array $aFoundedContentLocationUrls = array() * @param array $aFoundedContentLocationUrls = array()
* @param bool $bDoNotReplaceExternalUrl = false
* *
* @return string * @return string
*/ */
public static function ClearHtml($sHtml, &$bHasExternals = false, &$aFoundCIDs = array(), public static function ClearHtml($sHtml, &$bHasExternals = false, &$aFoundCIDs = array(),
$aContentLocationUrls = array(), &$aFoundedContentLocationUrls = array()) $aContentLocationUrls = array(), &$aFoundedContentLocationUrls = array(), $bDoNotReplaceExternalUrl = false)
{ {
$sHtml = null === $sHtml ? '' : (string) $sHtml; $sHtml = null === $sHtml ? '' : (string) $sHtml;
$sHtml = \trim($sHtml); $sHtml = \trim($sHtml);
@ -402,7 +425,15 @@ class HtmlUtils
{ {
if (\preg_match('/http[s]?:\/\//i', $sSrc)) if (\preg_match('/http[s]?:\/\//i', $sSrc))
{ {
$oElement->setAttribute('data-x-src', $sSrc); if ($bDoNotReplaceExternalUrl)
{
$oElement->setAttribute('src', $sSrc);
}
else
{
$oElement->setAttribute('data-x-src', $sSrc);
}
$bHasExternals = true; $bHasExternals = true;
} }
else if ('data:image/' === \strtolower(\substr(\trim($sSrc), 0, 11))) else if ('data:image/' === \strtolower(\substr(\trim($sSrc), 0, 11)))
@ -446,7 +477,7 @@ class HtmlUtils
{ {
$oElement->setAttribute('style', $oElement->setAttribute('style',
\MailSo\Base\HtmlUtils::ClearStyle($oElement->getAttribute('style'), $oElement, $bHasExternals, \MailSo\Base\HtmlUtils::ClearStyle($oElement->getAttribute('style'), $oElement, $bHasExternals,
$aFoundCIDs, $aContentLocationUrls, $aFoundedContentLocationUrls)); $aFoundCIDs, $aContentLocationUrls, $aFoundedContentLocationUrls, $bDoNotReplaceExternalUrl));
} }
} }

View file

@ -6201,6 +6201,7 @@ html.rl-no-preview-pane #rl-right .ui-resizable-handle {
color: grey; color: grey;
} }
.b-folders .e-item .e-link .count { .b-folders .e-item .e-link .count {
position: relative;
display: none; display: none;
margin-top: 5px; margin-top: 5px;
line-height: 19px; line-height: 19px;

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 613 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 845 B