Index: lams_central/web/includes/javascript/groupDisplay.js
===================================================================
RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/groupDisplay.js,v
diff -u -r1.37.2.14 -r1.37.2.15
--- lams_central/web/includes/javascript/groupDisplay.js 16 Mar 2016 12:14:10 -0000 1.37.2.14
+++ lams_central/web/includes/javascript/groupDisplay.js 21 Apr 2016 09:13:16 -0000 1.37.2.15
@@ -15,6 +15,8 @@
$("#actionAccord").accordion({
'heightStyle' : 'content'
});
+
+ refreshPrivateNotificationCount();
}
function loadOrgTab(orgTab, refresh) {
@@ -198,7 +200,7 @@
+ 'home.do?method=addLesson&organisationID='
+ $(this).dialog('option', 'orgID'));
- //in case of mobile devices allow iframe scrolling
+ // in case of mobile devices allow iframe scrolling
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
setTimeout(function() {
$('.dialogContainer').css('overflow-y','scroll');
@@ -280,8 +282,7 @@
'open' : function() {
var dialog = $(this),
lessonID = dialog.dialog('option', 'lessonID');
- // if lesson ID is given, use lesson view; otherwise
- // use course view
+ // if lesson ID is given, use lesson view; otherwise use course view
if (lessonID) {
// load contents after opening the dialog
$('iframe', dialog).attr('src', LAMS_URL
@@ -297,6 +298,127 @@
}, true);
}
+
+function showPrivateNotificationsDialog(){
+ showDialog("dialogPrivateNotifications", {
+ 'height' : 470,
+ 'width' : 600,
+ 'title' : LABELS.PRIVATE_NOTIFICATIONS_TITLE,
+ 'close' : function(){
+ refreshPrivateNotificationCount();
+ // completely delete the dialog
+ $(this).remove();
+ },
+ 'open' : function() {
+ // build the table from the scratch
+ var dialog = $(this),
+ table = $('
').appendTo(dialog),
+ // table header
+ headerRow = $('
').appendTo(table);
+ $(' | ').text(LABELS.PRIVATE_NOTIFICATIONS_MESSAGES).appendTo(headerRow);
+ // click it to mark all notifications as read
+ $(' | ').text(LABELS.PRIVATE_NOTIFICATIONS_READ)
+ .attr('title', LABELS.PRIVATE_NOTIFICATIONS_READ_ALL_HINT)
+ .click(markAllPrivateNotificationsAsRead)
+ .appendTo(headerRow);
+ $('iframe', dialog).remove();
+ $.ajax({
+ cache : false,
+ url : LAMS_URL + "notification.do",
+ dataType : 'json',
+ data : {
+ 'method' : 'getNotificationSubscriptions',
+ // maybe it will change for paging; "offset" param is also available
+ 'limit' : 10
+ },
+ success : function(notifications) {
+ if (!notifications) {
+ return;
+ }
+
+ // build notification rows one by one
+ $.each(notifications, function(){
+ var notification = this,
+ row = $('
').attr('id', 'subscription-' + notification.subscriptionUid)
+ .appendTo(table),
+ messageCell = $(' | ').appendTo(row),
+ readCell = $(' | ')
+ .appendTo(row);
+ // is it a link?
+ if (notification.message.indexOf(' td')
+ // message cell
+ .first().removeClass('notificationsPendingCell')
+ // read cell
+ .next().html('✔').removeClass('notificationsClickableCell').attr('title', null).off('click');
+ }
+ });
+}
+
+function refreshPrivateNotificationCount(){
+ $.ajax({
+ cache : false,
+ url : LAMS_URL + "notification.do",
+ dataType : 'text',
+ data : {
+ 'method' : 'getPendingNotificationCount'
+ },
+ success : function(count) {
+ $('#notificationsPendingCount').text(count == 0 ? '' : '(' + count + ')');
+ }
+ });
+}
+
function showGradebookCourseDialog(orgID){
var id = "dialoGradebookCourse" + orgID;
showDialog(id, {
@@ -431,12 +553,15 @@
// check if the LD was created successfully
if (learningDesignID) {
var frame = $('iframe', dialog);
- // disable previous onload handler, set in showAddSingleActivityLessonDialog()
+ // disable previous onload handler, set in
+ // showAddSingleActivityLessonDialog()
frame.off('load').load(function(){
- // disable current onload handler as closing the dialog reloads the iframe
+ // disable current onload handler as closing the dialog
+ // reloads the iframe
frame.off('load');
- // call svgGenerator.jsp code to store LD SVG on the server
+ // call svgGenerator.jsp code to store LD SVG on the
+ // server
var win = frame[0].contentWindow || frame[0].contentDocument;
win.GeneralLib.saveLearningDesignImage();
@@ -463,7 +588,6 @@
$("#" + id).dialog('close');
}
-
/**
* Loads contents to already open organisation groups dialog.
*/
@@ -486,7 +610,8 @@
}
/**
- * Called from within Course Groups dialog, it saves groups and loads grouping page.
+ * Called from within Course Groups dialog, it saves groups and loads grouping
+ * page.
*/
function saveOrgGroups() {
var groupsSaved = $('#dialogOrgGroup iframe')[0].contentWindow.saveGroups();