Skip to content

Commit

Permalink
DASH-99
Browse files Browse the repository at this point in the history
Added ajax success messages to language bundles.


git-svn-id: https://source.sakaiproject.org/svn/dashboard/trunk@313034 66ffb92e-73f9-0310-93c1-f5514f145a0a
  • Loading branch information
jimeng committed Nov 15, 2011
1 parent 91ddd99 commit ec8718e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
5 changes: 5 additions & 0 deletions dashboard/bundles/resources/dash_entity.properties
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,9 @@ dash.date.yesterday = Yesterday
dash.date.yesterday.time = Yesterday {0}
dash.date.unknown.time = Unknown time

dash.ajax.hide.success = Item is now hidden
dash.ajax.show.success = Item is no longer hidden
dash.ajax.star.success = Item is now starred
dash.ajax.unstar.success = Item is no longer starred


Original file line number Diff line number Diff line change
Expand Up @@ -296,18 +296,20 @@ public void onClick(AjaxRequestTarget target) {
// need to keep one item
logger.info(calendarItemId);
//logger.info(this.getModelObject());

String sakaiUserId = sakaiProxy.getCurrentUserId();
boolean success = dashboardLogic.unkeepCalendarItem(sakaiUserId, calendarItemId);

// if success adjust UI, else report failure?
if(success) {
target.addComponent(CalendarLinksPanel.this);
if(TAB_ID_STARRED.equals(selectedCalendarTab)) {
ResourceLoader rl = new ResourceLoader("dash_entity");

CalendarItem changedItem = dashboardLogic.getCalendarItem(calendarItemId);
JsonHelper jsonHelper = new JsonHelper(dashboardLogic);
String jsonStr = jsonHelper.getJsonObjectFromCalendarItem(changedItem).toString();
String javascript = "reportSuccess('item is no longer starred.'," + jsonStr + ",'" + "not-sure-about-url-yet" + "');";
String javascript = "reportSuccess('" + rl.getString("dash.ajax.unstar.success") + "'," + jsonStr + ",'" + "not-sure-about-url-yet" + "');";
target.appendJavascript(javascript);
target.appendJavascript("resizeFrame('grow');");
}
Expand Down Expand Up @@ -357,6 +359,8 @@ public void onClick(AjaxRequestTarget target) {
logger.info(calendarItemId);
//logger.info(this.getModelObject());

ResourceLoader rl = new ResourceLoader("dash_entity");

String sakaiUserId = sakaiProxy.getCurrentUserId();
boolean success = dashboardLogic.keepCalendarItem(sakaiUserId, calendarItemId);

Expand Down Expand Up @@ -415,11 +419,13 @@ public void onClick(AjaxRequestTarget target) {

// if success adjust UI, else report failure?
if(success) {
ResourceLoader rl = new ResourceLoader("dash_entity");

target.addComponent(CalendarLinksPanel.this);
CalendarItem changedItem = dashboardLogic.getCalendarItem(calendarItemId);
JsonHelper jsonHelper = new JsonHelper(dashboardLogic);
String jsonStr = jsonHelper.getJsonObjectFromCalendarItem(changedItem).toString();
String javascript = "reportSuccess('item is no longer hidden.'," + jsonStr + ",'" + "not-sure-about-url-yet" + "');";
String javascript = "reportSuccess('" + rl.getString("dash.ajax.show.success") + "'," + jsonStr + ",'" + "not-sure-about-url-yet" + "');";
target.appendJavascript(javascript );
target.appendJavascript("resizeFrame('grow');");
}
Expand Down Expand Up @@ -472,11 +478,12 @@ public void onClick(AjaxRequestTarget target) {

// if success adjust UI, else report failure?
if(success) {
ResourceLoader rl = new ResourceLoader("dash_entity");
target.addComponent(CalendarLinksPanel.this);
CalendarItem changedItem = dashboardLogic.getCalendarItem(calendarItemId);
JsonHelper jsonHelper = new JsonHelper(dashboardLogic);
String jsonStr = jsonHelper.getJsonObjectFromCalendarItem(changedItem).toString();
String javascript = "reportSuccess('item is now hidden.'," + jsonStr + ",'" + "not-sure-about-url-yet" + "');";
String javascript = "reportSuccess('" + rl.getString("dash.ajax.hide.success") + "'," + jsonStr + ",'" + "not-sure-about-url-yet" + "');";
target.appendJavascript(javascript );
target.appendJavascript("resizeFrame('grow');");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,11 @@ public void onClick(AjaxRequestTarget target) {
if(success) {
target.addComponent(NewsLinksPanel.this);
if(TAB_ID_STARRED.equals(selectedNewsTab)) {
ResourceLoader rl = new ResourceLoader("dash_entity");
NewsItem changedItem = dashboardLogic.getNewsItem(newsItemId);
JsonHelper jsonHelper = new JsonHelper(dashboardLogic);
String jsonStr = jsonHelper.getJsonObjectFromNewsItem(changedItem).toString();
String javascript = "reportSuccess('item is no longer starred.'," + jsonStr + ",'" + "not-sure-about-url-yet" + "');";
String javascript = "reportSuccess('" + rl.getString("dash.ajax.unstar.success") + "'," + jsonStr + ",'" + "not-sure-about-url-yet" + "');";
target.appendJavascript(javascript );
}
target.appendJavascript("resizeFrame('grow');");
Expand Down Expand Up @@ -369,11 +370,12 @@ public void onClick(AjaxRequestTarget target) {

// if success adjust UI, else report failure?
if(success) {
ResourceLoader rl = new ResourceLoader("dash_entity");
target.addComponent(NewsLinksPanel.this);
NewsItem changedItem = dashboardLogic.getNewsItem(newsItemId);
JsonHelper jsonHelper = new JsonHelper(dashboardLogic);
String jsonStr = jsonHelper.getJsonObjectFromNewsItem(changedItem).toString();
String javascript = "reportSuccess('item is no longer hidden.'," + jsonStr + ",'" + "not-sure-about-url-yet" + "');";
String javascript = "reportSuccess('" + rl.getString("dash.ajax.show.success") + "'," + jsonStr + ",'" + "not-sure-about-url-yet" + "');";
target.appendJavascript(javascript );
}
target.appendJavascript("resizeFrame('grow');");
Expand Down Expand Up @@ -426,11 +428,12 @@ public void onClick(AjaxRequestTarget target) {

// if success adjust UI, else report failure?
if(success) {
ResourceLoader rl = new ResourceLoader("dash_entity");
target.addComponent(NewsLinksPanel.this);
NewsItem changedItem = dashboardLogic.getNewsItem(newsItemId);
JsonHelper jsonHelper = new JsonHelper(dashboardLogic);
String jsonStr = jsonHelper.getJsonObjectFromNewsItem(changedItem).toString();
String javascript = "reportSuccess('item is now hidden.'," + jsonStr + ",'" + "not-sure-about-url-yet" + "');";
String javascript = "reportSuccess('" + rl.getString("dash.ajax.hide.success") + "'," + jsonStr + ",'" + "not-sure-about-url-yet" + "');";
target.appendJavascript(javascript );
}
target.appendJavascript("resizeFrame('grow');");
Expand Down

0 comments on commit ec8718e

Please sign in to comment.