What is it: Fortis is a windowing environment that runs in a single
dynamic IE DHTML page. It can be used by itself or with
other page components as it is minimally intrusive. It boasts
a window bar (like in MS Windows 9x), global menu and status
bar, and windows that can contain other (arbitrary) web pages.
It can be used for easily creating web applications, either
by generating API calls and windows content on the fly from a
server, for static client-server applicatins, or for
client-only solutions. For more information and documentation
visit www.esaurito.com/fortis.
Requirements: Microsoft Internet Explorer 5 or later.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Installation: add these elements to your page anywhere within your BODY
tag and before your code.
var MAXWIN = 100;
for(var i = 0; i < MAXWIN; i++)
document.write('<DIV ID="FORTIS_W'+ i +'" STYLE="position: absolute"></DIV>');
The value of MAXWIN determines the maximum number of windows that
can be created. Change it at will, but a very large number will slow
down page loading.
You may want to adjust the URL for the modules if they reside in a
different directory than your page.
// FORTIS CLASS SINGLETON
// !!NOT CODE-ENFORCED!! This is the ONLY instance of the environment, DO NOT change the
// variable name because plenty of code relies on it.
window.fortis = new FortisEnvironment();
// You should leave this here as well
fortis.init();
// Fortis Environment class
// The environment. Contains and handles windows and settings.
//
// Params: none (the constructor is called above for you)
//
// Properties/Objects for public use:
// statusbar: a status bar at the bottom of the window
//
// Exported classes for publis use:
// Window: for window creation and handling
// WinStyle: for window styling
//
// Exported constants: see Constants section in constructor
//
// Methods for public use:
// setStyle: sets default style for new windows
// setMenu: sets system menu
// setBackground: sets background image
// showAll: shows all windows
// hideAll: hides all winodws
// minimizeAll: minimizes all open windows
// restoreAll: restores all minimized winodws
// endModal: comes out of any modal windows state
// function FortisEnvironment()
{
// Containers and counters: this.winArray = []; // Holds all window objects created this.divCount = 0; // Keeps count of layers with id's created
// (to generate unique id's) this.winCount = 0; // Holds position of last DIV that was
// a window; this.zidx = 1; // Z-index tracker this.shadowDivs = []; // Holds ID's of divs used in dragging
this.maxiwin = []; // Holds all maximized windows
this.topUsed = 0; // Pixels used on the top of the page by system windows this.botUsed = 0; // Pixels used on the bottom of the page by system windows
// Constants
// Window Style masks this.WS_IFRAME = 1; // prepares an IFRAME as the contnent of the window this.WS_TITLE = 2; // adds a draggable title bar this.WS_CLOSE = 4; // adds a close button* this.WS_MAX = 8; // adds a maximize button* this.WS_MIN = 16; // adds a minimize button* this.WS_SIZE_NS = 32; // allows the window to be resized North-South** this.WS_SIZE_EW = 64; // allows the window to be resized East-West** this.WS_WORKS = 127; // IFRAME, close, minimize, maximize, both size (DEFAULT) this.WS_BLANK = 128; // Blank window
//* : if selected, title bar is also created
//** : if selected, IFRAME is also created
// Environment classes
// -- Window class --
// Manages windows.
//
// Params:
// title: the title of the window
// src: the URL of the page this window will contain
// left: the position in pixels from the left margin (or 'center')
// top: the position in pixels from the top margin (or 'center')
// width: the width of the window in pixels
// height: the width of the window in pixels
// style: the style of the window (a fortis.WinStyle object)
// - default: use Environment settings.
//
// Properties for public use:
// winN: the position in the array of of DIV's of the page.
// div: reference to the DIV object in the DOM. Can be used
// to manipulate the window arbitrarly.
// winId: the string that, using fortis.winArray, can be evaluated
// anywhere to return a reference to the Window object. Used
// to refer to the window in generic event programming.
// title: the HTML contained in the title bar.
// style: the style of the class (a fortis.WinStyle object)
//
// Methods for public use:
// (see at the top of each declaration for details)
//
// addComponent: adds a component to the window
// setStyle: sets the window style
// applyStyle: applies the style to the window
// hide: hides the window
// show: show the window
// refresh: refreshes the IFRAME and focuses
// lock: does not allow window closing
// unlock: inverts lock effect
// moveTo: moves the window to a coordinate or position
// moveBy: moves the window by some amount
// setSize: sets the size of the window
// min: minimizes the window
// maxrestore: maximizes or restores the maximized window
// goModal: makes the window modal
// addButton: adds a custom button to the window
function Window(title, src, left, top, width, height, style)
{
// Finds the next DIV to take over
var d = document.all.tags('DIV'); this.winN = fortis.winCount++; this.div = d['FORTIS_W' + this.winN];
// Registers in the winArray
var winPos = fortis.winArray.length;
fortis.winArray[winPos] = this; this.winId = "fortis.winArray[" + winPos + "]";
// function Window.prototype.startDrag
// This function is meant to be called by an event handler and
// enables window dragging. It is not meant to be called by itself.
// function Window.prototype.startResize
// This function is meant to be called by an event handler and
// enables window resiziong. It is not meant to be called by itself.
// -- Window method: lock --
// Does not allow a window to be closed and executes some other
// code instead
//
// Params: code: JScript code to be executed instead of closing
//
// Returns: undefined
function Window.prototype.lock(code)
{ this.isLocked = true; this.lockedCode = code;
}
// -- Window method: show --
// Shows the window and adds it to the window bar
// or brings it to focus if it is already visible.
//
// Params: none
//
// Returns: undefined
// -- Window method: refresh --
// Refreshes the IFRAME of the window with the specified title
// (if it exists) with the specified URL. The window must already
// contain IFRAME capabilities in its style.
//
// Params: url: URL to set the IFRAME's SRC at
//
// Returns: undefined
// -- Window method: moveTo --
// Moves the window to the indicated client co-ordinates
//
// Params: x, y: position to move to. Each can be
// - a positive number : pixel coordinates
// - 'center': centered in the browser window on
// the corresponding axis. Position is not enforced
// after this function call.
//
// Returns: undefined