Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-138: If notice.txt exists in the base directory, that is shown to the end user on startup

Mike McGann38d1105e1e8a
diff --git a/js/Worldview.js b/js/Worldview.js
index 29c229671..f51857afe 100644
--- a/js/Worldview.js
+++ b/js/Worldview.js
@@ -83,7 +83,38 @@
});
}
};
+
+ /**
+ * Function: notify
+ * Displays a message to the end user in a dialog box.
+ *
+ * Parameters:
+ * message - The message to display to the user.
+ * title - Title for the dialog box (optional). If not specified, the
+ * title will be "Notice".
+ */
+ ns.notify = function(message, title) {
+ log.info(message);
+ if ( window.YAHOO && window.YAHOO.widget &&
+ window.YAHOO.widget.Panel ) {
+ o = new YAHOO.widget.Panel("WVerror", {
+ width: "300px",
+ zIndex: 1020,
+ visible: false
+ });
+ title = title || "Notice";
+ o.setHeader('    ' + title);
+ o.setBody(message);
+ o.render(document.body);
+ o.show();
+ o.center();
+ o.hideEvent.subscribe(function(i) {
+ setTimeout(function() {o.destroy();}, 25);
+ });
+ }
+ };
+
/**
* Function: size
* Gets the number of properties in an object. This only includes
diff --git a/js/main.js b/js/main.js
index 87f9ed4c3..5f6b7752a 100644
--- a/js/main.js
+++ b/js/main.js
@@ -2,6 +2,11 @@ window.onload = function(){// Initialize "static" vars
var entryPoint = function() {
var log = Logging.Logger();
+
+ $.get("notice.txt", function(message) {
+ var html = message.replace(/\n/g, "<br/>");
+ Worldview.notify(html);
+ });
this.selector = new YAHOO.widget.Panel("selector", { zIndex:1019, visible:false } );
this.selector.setBody("<div id='selectorbox'></div>");