fixed an infamous comma error (makes the javascript crash in Explorer...)
[cxgn-jslib.git] / CXGN / Base.js
blob2c0bce876dd04ece835579a1c69ec7063c6975a9
1 JSAN.use('MochiKit.Logging');
3 /*
5 =head1 NAME
7 CXGN.Base
9 =head1 SYNOPSIS
11 Basic SGN javascript functions to export to all pages
13 =head1 AUTHOR
15 Christopher Carpita <csc32@cornell.edu>
17 =cut
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.
27 =cut
31 function alertBeta(content) {
32 var notification = "======== Developer Error Box ======== \n";
33 notification += "There was a problem in the Javascript:\n";
34 notification += content;
35 alert(notification);
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.
45 =cut
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);
56 return false;
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";
62 return true;
63 //The box will take care of closing itself (setting display to "none")
68 =head1 alert()
70 Redefine the javascript function. An sgn user should never see an alert
71 box. Instead, write the alert to the MochiKit Logger.