forked from sakaiproject/sakai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LSNBLDR-701 created Lessons component to show latest announcements. (s…
…akaiproject#3106) Added new dialog for Announcements in ShowPage.html ,related variables and function are added in 'SimplePageBean.java' to create/edit SimplePageItem of type ANNOUNCEMENTS for Announcements summary widget. 'messages.properties' is edited to add new texts. For merged announcements, if user has no access to the site get public messages from the site.Added method 'getMessagesPublic' to fetch all public messages from the channel.
- Loading branch information
Showing
10 changed files
with
349 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
$(function(){ | ||
//get all divs with class announcementType | ||
$(".announcements-div").each(function(){ | ||
var rightColDiv = $(this).parent().parent(); | ||
//Get parameters for each announcements div | ||
var number = rightColDiv.find('.numberOfAnnouncements').text().replace(/'/g,""); | ||
var url = rightColDiv.find(".announcements-site-url").text().replace(/'/g,""); | ||
var tool_href = rightColDiv.find(".announcements-view-url").text().replace(/'/g,""); | ||
showAnnouncements(url, tool_href, number, $(this)); | ||
}); | ||
}); | ||
|
||
function showAnnouncements(url, tool_href, number, announcementsDiv){ | ||
//only make ajax request if announcement widget is added | ||
if(url.length){ | ||
var announcementsUrl = url + ".json?n=" + number; | ||
//get the announcement tool url | ||
var link_to_tool = tool_href.split("?", 1); | ||
var title = msg("simplepage.announcements-header-title"); | ||
var text_for_announcements = '<div class="announcementsHeaderDiv"><h3 class="announcementSummaryHeader"><span aria-hidden="true" class="fa-item-text icon-sakai-announcements"></span><a href="'+link_to_tool+'" target="_top" class="announcementLink" title ="'+title+'">'+title+'</a></h3></div>'; | ||
//Get announcements | ||
$.ajax({ | ||
url: announcementsUrl, | ||
dataType: 'json', | ||
cache: false, | ||
success: function(data) { | ||
if($(data["announcement_collection"]).size() === 0) { | ||
//ie no announcements | ||
text_for_announcements += '<p>'+msg("simplepage.announcements-no-message")+'</p>'; | ||
} | ||
else { | ||
$(data["announcement_collection"]).each(function(){ | ||
//create a new javascript Date object based on the timestamp | ||
date = new Date(this["createdOn"]); | ||
var hour = date.getHours() < 10 ? '0' + date.getHours() : date.getHours(); | ||
var min = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes(); | ||
//using javascript's toLocaleDateString() to include user's locale and local time zone | ||
date_time = hour +":"+min+ " " + date.toLocaleDateString(); | ||
text_for_announcements += '<div class="itemDiv">'; | ||
var href = tool_href + this["announcementId"]+"&sakai_action=doShowmetadata"; | ||
var entityTitle = this["entityTitle"].replace(/&/g, '&').replace(/>/g, '>').replace(/</g, '<').replace(/"/g, '"'); | ||
var createdByDisplayName = this["createdByDisplayName"].replace(/&/g, '&').replace(/>/g, '>').replace(/</g, '<').replace(/"/g, '"'); | ||
text_for_announcements += '<div class="itemTitle"><a href="'+href+'" target="_top">'+ entityTitle +'</a> by '+ createdByDisplayName +'</div>'; | ||
text_for_announcements += '<div class="itemDate">'+date_time+'</div>'; | ||
text_for_announcements += '</div>'; | ||
}); | ||
} | ||
announcementsDiv.html(text_for_announcements); | ||
}, | ||
error: function(xhr, textStatus, errorThrown){ | ||
var err = textStatus + ", " + errorThrown; | ||
text_for_announcements += '<p>'+ msg("simplepage.announcements-error-message") + err +'</p>'; | ||
announcementsDiv.html(text_for_announcements); | ||
} | ||
}); | ||
} | ||
} |
Oops, something went wrong.