1 JSAN.use('MochiKit.Logging');
11 Basic SGN javascript functions to export to all pages
15 Christopher Carpita <csc32@cornell.edu>
23 =head2 alertBeta(content)
25 Special Alert for development sites with beta users, same pop-up alert box, but other information pre-pended, telling the beta user that the alert box is temporary and stuff.
31 function alertBeta(content) {
32 var notification = "======== Developer Error Box ======== \n";
33 notification += "There was a problem in the Javascript:\n";
34 notification += content;
40 =head2 notify(content)
42 Set the notification in a closable box at the top of the page.
43 Similar to the Undo notifications on GMail. For make benefit glorious user.
49 function notify(content) {
50 var NOTIFY_BOX_ID = "SGN_NOTIFY_BOX"; //site-wide standard
51 var NOTIFY_CONTENT_ID = "SGN_NOTIFY_CONTENT";
52 document.getElementById("SGN_NOTIFY_BOX").style.display = "block";
53 if(!document.getElementById(NOTIFY_CONTENT_ID) || !document.getElementById(NOTIFY_BOX_ID)){
54 var warning = "The developer should have used the notify box at the top\nof the page, but the notifier page element with the\nIDs: '" + NOTIFY_BOX_ID + "' or '" + NOTIFY_CONTENT_ID + "' were not found.\n\nNotification: ";
55 alertBeta(warning + content);
58 var notify_content = document.getElementById(NOTIFY_CONTENT_ID);
59 notify_content.innerHTML = content;
60 var notify_box = document.getElementById(NOTIFY_BOX_ID);
61 notify_box.style.display = "block";
63 //The box will take care of closing itself (setting display to "none")
70 Redefine the javascript function. An sgn user should never see an alert
71 box. Instead, write the alert to the MochiKit Logger.