AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 07.08.2009, 16:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
Все о Microsoft Dynamics CRM: Пользовательские уведомления в MS Dynamics CRM 4.0
Источник: http://ms-dynamics-crm.com.ua/2009/0...notifications/
==============

Обычно, чтобы предупредить пользователя о чем-то, используют алерты, но это не всегда удобно, можно пользоваться своими уведомлениями:

пользовательские уведомления



как, например, это по умолчанию сделано в CRM:

Например, при создании продукта


Marco Amoedo предложил код,  который можно использовать для вставки своих уведомлений. Вот пример:


/*============== addNotification function =============Adds a warning message on the top of the entity form usingthe same visual style as Microsoft CRMParams: message to be shown to the user=======================================================*/addNotification = function(message) { var notificationHTML = '' + message + '
'
; var notificationsArea = document.getElementById('Notifications'); if (notificationsArea == null) return; notificationsArea.innerHTML += notificationHTML; notificationsArea.style.display = 'block';}/*============= END addNotification function ===========*///Example of utilizationsaddNotification('Пример уведомления');


А Dejan Dular быстро добавил туда  разные типы уведомлений:

/*============== addNotification function =============



Parameters:

message - message to be shown to the user

messageType - Type of the message: 1 - critical, 2 - info, 3 - warning

notificationId - ID of the notification (needed for updating purposes)



Created by:

Marco Amoedo (http://marcoamoedo.com) - the idea and initial function

Dejan Dular (http://a-crm.blogspot.com) - upgraded functionality (different icons, updating and deleting notifications)



=======================================================*/

addNotification = function(message, messageType, notificationId){ var notificationsArea = document.getElementById('Notifications'); if (notificationsArea == null) { //Don't display message when deleting a notification. if (messageType != 4) { //Sorry. Notifications are not possible on this form. //Display a message box instead of notification. alert(message); } return; } var notificationDIV = document.getElementById('NotificationDiv_' + notificationId);

//Delete the notification if (messageType == 4) { if (notificationDIV != null) { //Remove the notification notificationsArea.removeChild(notificationDIV); } return; } //Get the notification image. The default is info image. var notificationImage; switch (messageType) { case 1: notificationImage = '/_imgs/error/notif_icn_crit16.png'; break; case 2: notificationImage = '/_imgs/error/notif_icn_info16.png'; break; case 3: notificationImage = '/_imgs/error/notif_icn_warn16.png'; break; default: notificationImage = '/_imgs/error/notif_icn_info16.png'; } //Create notification var notificationTable = '' + message +''; //Check if the notification with same ID already exists if (notificationDIV == null) { //Create a new notification var notificationHTML = '' + notificationTable + '
'
; notificationsArea.innerHTML += notificationHTML; notificationsArea.style.display = 'block'; } else { //Update the notification. notificationDIV.innerHTML = notificationTable; }}/*============= END addNotification function ===========*/Эта функция добавляется на событие Onload, а ее вызов можно делать там, где вам нужно.

addNotification(string message, int messageType, string notificationId)Параметры:

message -Текст уведомления

messageType - Тип уведомления (1-critical, 2-info, 3- warning, 4-delete the notification)

notificationId - строка с информацией. Если фунция будет вызвана позже с существующим notificationId, уведомление будет обновлено.





Источник: http://ms-dynamics-crm.com.ua/2009/0...notifications/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Microsoft Dynamics CRM Team Blog: Building Rich-Client Dashboards for Microsoft Dynamics CRM with Windows Presentation Foundation Blog bot Dynamics CRM: Blogs 1 31.03.2009 13:24
Microsoft Dynamics CRM Team Blog: Rolling out CRM: Who should take ownership? Blog bot Dynamics CRM: Blogs 0 25.11.2008 02:08
Мир CRM: Документ по методологии внедрения Microsoft Dynamics CRM (так называемый Sure Step) Blog bot Dynamics CRM: Blogs 0 24.10.2008 01:05
Microsoft Dynamics CRM Team Blog: Are You Certifiable? Blog bot Dynamics CRM: Blogs 0 24.07.2008 01:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 18:02.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.