home *** CD-ROM | disk | FTP | other *** search
- /*
- * dialog.js
- *
- * Copyright (c) 1997 Netscape Communications Corporation, All Rights Reserved
- *
- * Utility functions for dealing with dialog boxes in Netcaster
- */
-
- /* Globals */
-
- var gTabShowing = "";
-
- /* Display utilities */
-
- /* ShowTab
- *
- * In : the name of the pane (layer) to display
- *
- * Out: None
- *
- * ShowTab uses layers to implement a tabbed dialog box
- *
- * Each tabbed area should have two layers, one which is the set to the
- * size of the display area (beneath the tab) and one which is the tab
- * itself, positioned at the correct location it would occur in the
- * unopened state. The tab layer should named with the name of the
- * content area, plus the word "Tab". So if there were a "general" pane,
- * its tab layer would be named "generalTab".
-
- * The tab's onclick behavior should call showTab with the name of the pane to
- * display (in the above example, "General").
- */
-
- function showTab(tabName)
- {
- var tabLayerName;
-
- if (gTabShowing == tabName) {
- return;
- }
-
- if (gTabShowing != "") {
- var tabLayerName = gTabShowing + "Tab";
-
- if (document.layers[gTabShowing].document.hiding) {
- if (!document.layers[gTabShowing].document.hiding())
- return;
- }
-
- document.layers[gTabShowing].visibility="hide";
-
- if ( document.layers[gTabShowing].hideChildren )
- document.layers[gTabShowing].hideChildren();
-
- document.layers[tabLayerName].clip.height -= 3;
- document.layers[tabLayerName].y += 2;
- document.layers[tabLayerName].clip.width -= 2;
- }
-
- document.layers[tabName].visibility="show";
- if ( document.layers[tabName].showChildren )
- document.layers[tabName].showChildren();
-
- tabLayerName = tabName + "Tab";
- document.layers[tabLayerName].y -= 2;
- document.layers[tabLayerName].clip.height += 3;
-
- if (gTabShowing != "") {
- document.layers[tabLayerName].clip.width += 2;
- }
-
- gTabShowing = tabName;
-
- if (document.layers[gTabShowing].document.showing) {
- document.layers[gTabShowing].document.showing();
- }
-
- return;
- }
-
-
-
- /* Interaction utilities */
-
- function handleHelp(topic)
- {
- if ((topic == null) || (topic == ""))
- topic = "net_main_about";
-
- self.location.href = "nethelp:netscape/netcastr:" + topic;
- }
-
-
- // handleCancel simply dismisses the dialog, optionally calling
- // a callback function.
-
-
- function handleCancel()
- {
- if (self.closing && self.closing != null) {
- self.closing();
- }
-
- self.close();
- }
-
-
- /* Data validation utilities */
-
- function trimString(jsString)
- {
- var tempStr = new java.lang.String(jsString);
- tempStr.trim();
-
- return tempStr.toString();
- }
-
- function fieldEmpty(field)
- {
- if ((field == null) || (field.value == null) || (field.value == ""))
- return true;
-
- var tempStr = trimString(field.value);
-
- if (tempStr == "")
- return true;
-
- return false;
- }
-
-
- /* Test functions */
-
- function getKey(e)
- {
- alert("The key: " + e.which);
-
- }
-
- function getDrag(e)
- {
- var fileNames = e.data;
-
- alert("File: " + e.data[0]);
- for (var i=0; i< fileNames.length; i++) {
- alert("Dragged: fileNames[0]");
- }
-
- return false;
-
- }
-
- void(0);