Skip to content

Commit

Permalink
Fixed: proper v9 compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
yagasoft committed Dec 8, 2021
1 parent 840173f commit 3c89ff7
Show file tree
Hide file tree
Showing 140 changed files with 2,707 additions and 1,763 deletions.
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/yagasoft/DynamicsCrm-NotificationCentre?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

### Version: 3.1.1.1
### Version: 4.1.1.1
---

A CRM solution that injects a button into CRM's navigation bar, which shows notifications in near real-time from within CRM.
Expand All @@ -19,17 +19,27 @@ A CRM solution that injects a button into CRM's navigation bar, which shows noti

### Guide

I will post a complete guide soon.
+ Install
+ Enable the Notifications Centre (NC) functionality in the Common Configuration entity (switch to NC Form after first save)
+ Create a default NC Configuration record, or override for a specific user
+ Assign the users the NC User/Admin security role
+ Refresh

### Dependencies
### Install

+ Import solution found at [Dynamics365-YsCommonSolution](https://github.com/yagasoft/Dynamics365-YsCommonSolution).
+ Import NC solutions from this repository

## Screenshots

![File](https://github.com/yagasoft/DynamicsCrm-NotificationCentre/raw/master/imgs/nc-new-notification.png)

![File](https://github.com/yagasoft/DynamicsCrm-NotificationCentre/raw/master/imgs/nc-menu.png)

+ Common.cs
+ Can be found in the [DynamicsCrm-Libraries](https://github.com/yagasoft/DynamicsCrm-Libraries) repository
+ Generic Base solution ([DynamicsCrm-BaseSolution](https://github.com/yagasoft/DynamicsCrm-BaseSolution))
+ CRM Logger solution ([DynamicsCrm-CrmLogger](https://github.com/yagasoft/DynamicsCrm-CrmLogger))

## Changes

#### _v4.1.1.1 (2021-12-08)_
+ Fixed: proper v9 compatibility
#### _v3.1.1.1 (2019-02-28)_
+ Changed: moved to a new namespace
#### _v2.1.1.1 (2018-09-11)_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@

/*#region Icon */

#ncMainContainer
{
/*width: 42px;*/
}

#ncQuickCreate
{
/*text-shadow: 1px 1px 1px #cecece;
Expand Down Expand Up @@ -72,7 +67,7 @@
margin-right: -10px;
}

#ncCounter
.nc-counter-old
{
font-size: 0.76em;
text-align: center;
Expand All @@ -93,6 +88,28 @@
z-index: 99999;
}

.nc-counter
{
font-size: 0.76em;
color: white;
text-align: center;
vertical-align: middle;
left: 25px;
top: -31px;
position: absolute;
padding-top: 0px;
padding-left: 3px;
padding-right: 3px;
padding-bottom: 1px;
box-shadow: 0px 0px 5px #444;
border-radius: 2px;
background: #BF0000; /* Old browsers */
background: -moz-linear-gradient(45deg, #BF0000 0%, #ED3434 70%, #F2797B 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(45deg, #BF0000 0%, #ED3434 70%, #F2797B 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(45deg, #BF0000 0%, #ED3434 70%, #F2797B 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
z-index: 99999;
}

/*#endregion Icon */

/*#region Popup */
Expand Down Expand Up @@ -167,10 +184,6 @@
box-shadow: 0px 1px 6px #000;
}

#ncNewIconContainer
{
}

#ncNewIcon
{
height: 17px;
Expand All @@ -183,6 +196,7 @@
{
margin-left: 2px;
float: right;
color: #111;
}

#ncListContainer
Expand All @@ -206,7 +220,7 @@

.ncSeparator
{
margin: 0;
margin: 0.5px;
}

/*#endregion List */
Expand All @@ -217,16 +231,29 @@
{
padding: 2px;
margin: 0;
color: #111;
}

.ncMessageTitle
.ncMessageTitle-old
{
position: relative;
top: 50%;
font-weight: bold;
font-size: 1.1em;
}

.ncMessageTitle
{
position: relative;
top: 50%;
font-weight: bold;
}

.nc-message-body
{
font-size: 0.9em;
}

.ncSourceIcon
{
margin: 0px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ function InitRefreshInterval()
}
}

function NcIsNew()
{
return !!$('.nc-new').length;
}

function CreatePalette()
{
try
Expand Down Expand Up @@ -452,7 +457,7 @@ var NcMenu = function()
'</div>' +
'</div>')
.css({
top: pos.top + 62 + 'px',
top: pos.top + (NcIsNew() ? 29 : 62) + 'px',
left: pos.left - 2 + 'px'
});
$('body').append(ncFrame);
Expand All @@ -479,7 +484,7 @@ var NcMenu = function()
{
try
{
if (element.scrollTop() + element.innerHeight() >= element[0].scrollHeight)
if (element.scrollTop() + element.innerHeight() + 0.5 >= element[0].scrollHeight)
{
showNextBatch();
}
Expand Down Expand Up @@ -551,7 +556,8 @@ var NcMenu = function()
if (!$(event.target).closest('#ncFrame').length
&& !$(event.target).closest('#ncIcon').length)
{
for (var i = 0; i < iframes.length; i++)
// TODO
for (var i = 1000000; i < iframes.length; i++)
{
var contentWindow = iframes[i].contentWindow;

Expand Down Expand Up @@ -703,7 +709,7 @@ var NcMenu = function()
{
pagingInfo.PagingCookie = data.NewCookie;

var results = JSON.parse(data.Messages);
var results = JSON.parse((data.Messages).replace(/\\"/g, '\"'));
var newMessages = [];

for (var i = 0; i < results.length; i++)
Expand Down Expand Up @@ -922,7 +928,7 @@ function GetUnreadMessages(callback)
{
try
{
var results = JSON.parse(data.Messages);
var results = JSON.parse((data.Messages).replace(/\\"/g, '\"'));
var unread = $.map(results,
function(e)
{
Expand Down Expand Up @@ -993,7 +999,7 @@ function GetMessage(id, callback)
{
try
{
var message = JSON.parse(data.Messages)[0];
var message = JSON.parse((data.Messages).replace(/\\"/g, '\"'))[0];

if (message)
{
Expand Down Expand Up @@ -1079,7 +1085,7 @@ function BuildMessageElement(message, width, parentFrameJq, suffix)

var titleElement = $('<div style="position:relative;">' +
(sourceImage ? '<img class="ncSourceIcon" src="' + NcSource[message.source] + '" />' : '') +
'<div style="width:' + (width - 45) + 'px;" class="ncMessageTitle ncEllipsis">' +
'<div style="width:' + (width - 45) + `px;" class="ncMessageTitle${NcIsNew() ? '' : '-old'} ncEllipsis">` +
message.title +
'</div>' +
'</div>');
Expand Down Expand Up @@ -1150,7 +1156,7 @@ function BuildMessageElement(message, width, parentFrameJq, suffix)
titleElement.append(readAnchorElement);
}

var bodyElement = $('<div class="ncEllipsis">' +
var bodyElement = $(`<div class="${NcIsNew() ? 'nc-message-body ' : ''}ncEllipsis">` +
(IsHtml(message.message)
? '(Message is in HTML format; hover to view)'
: message.message) +
Expand Down Expand Up @@ -1355,7 +1361,7 @@ function SetMessageRead(readAnchorElement, messageElement, messageid)

function GetValueFromLocalStorage(key)
{
return JSON.parse(localStorage.getItem(key));
return JSON.parse((localStorage.getItem(key)).replace(/\\"/g, '\"'));
}

function StoreValueInLocalStorage(key, value)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/// <reference path="../../../../Yagasoft.Libraries/Yagasoft.Libraries.Common/Scripts/ldv_CommonGeneric.js" />
/// <reference path="../Refs/Xrm.Page.js" />
/// <reference path="../../../../Yagasoft.Libraries/Yagasoft.Libraries.Common/CrmSchemaJs.js" />
/// <reference path="../Refs/Xrm.Page.js" />

function OnLoad()
function OnLoad(executionContext)
{
SetAnchoredExecutionContext(executionContext);

if (!GetFieldValue(Sdk.NotificationsCentreConfig.Name))
{
SetFieldValue(Sdk.NotificationsCentreConfig.Name,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/// <reference path="../../../../Yagasoft.Libraries/Yagasoft.Libraries.Common/Scripts/ldv_CommonGeneric.js" />
/// <reference path="../Refs/Xrm.Page.js" />
/// <reference path="../../../../Yagasoft.Libraries/Yagasoft.Libraries.Common/CrmSchemaJs.js" />
/// <reference path="../Refs/Xrm.Page.js" />

function OnLoad()
function OnLoad(executionContext)
{
SetAnchoredExecutionContext(executionContext);

if (GetFormType() === FormType.Create || GetFormType() === FormType.QuickCreate)
{
SetFieldValue(Sdk.NotificationMessage.NotificationSource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,25 @@ function AddNotificationsIcon()
'<a href="#" class="navTabButtonLink" onkeypress="return true;" onclick="return false;" unselectable="on">' +
'<span id="ncIcon" class="navTabButtonImageContainer" unselectable="on">' +
'<img id="ncIconImage" src="' + Xrm.Page.context.getClientUrl() + '/WebResources/ldv_GlobePng52">' +
'<span id="ncCounter" class="ncHiddenKeepSpace"></span>' +
'<span id="ncCounter" class="ncHiddenKeepSpace nc-counter-old"></span>' +
//'<img id="ncQuickCreate" src="' + Xrm.Page.context.getClientUrl() + '/WebResources/ldv_PlusGreyIconPng25" />' +
'</a>' +
'<span id="ncTabDividerContainer" class="navTabButtonImageContainer" unselectable="on">' +
'<img class="navTabDivider" alt="|" src="/_imgs/NavBar/NavBarDivider.png" unselectable="on">' +
'</span>' +
'</span>');


NcParent.$('div[data-id="topBar"]').children(":last").children(":first")
.prepend('<div id="ncMainContainer" class="navTabButton nc-new">' +
'<a href="#" class="navTabButtonLink" onkeypress="return true;" onclick="return false;" unselectable="on">' +
'<span id="ncIcon" class="navTabButtonImageContainer" unselectable="on">' +
'<img id="ncIconImage" src="' + Xrm.Page.context.getClientUrl() + '/WebResources/ldv_GlobePng52">' +
'<span id="ncCounter" class="ncHiddenKeepSpace nc-counter"></span>' +
//'<img id="ncQuickCreate" src="' + Xrm.Page.context.getClientUrl() + '/WebResources/ldv_PlusGreyIconPng25" />' +
'</a>' +
'</div>');
NcParent.$('#ncMainContainer').addClass(NcParent.$('[data-id="searchLauncher"]').attr('class'));
}
catch (e)
{
Expand Down Expand Up @@ -211,11 +223,11 @@ function FetchConfiguration(callback)
{
try
{
NcParent.NcSettings.CountPerPage = config["ldv_countperpage"];
NcParent.NcSettings.RefreshInterval = config["ldv_refreshinterval"];
NcParent.NcSettings.CounterLimit = config["ldv_counterlimit"];
NcParent.NcSettings.CountPerPage = config["ldv_countperpage"] || 10;
NcParent.NcSettings.RefreshInterval = config["ldv_refreshinterval"] || 5;
NcParent.NcSettings.CounterLimit = config["ldv_counterlimit"] || 10;
NcParent.NcSettings.IsPopupEnabled = config["ldv_ispopupenabled"];
NcParent.NcSettings.PopupTimeout = config["ldv_popuptimeout"];
NcParent.NcSettings.PopupTimeout = config["ldv_popuptimeout"] || 5;
}
catch (e)
{
Expand Down
Loading

0 comments on commit 3c89ff7

Please sign in to comment.