var protocol = "http://";
if (self.location.href.match(/^https\:\/\//)) {
protocol = "https://";
}
var domain_path_topbar = 'http://apps2.hkedcity.net';
domain_path_topbar = domain_path_topbar.replace('http://', protocol);
var domain_path_footer = 'http://apps2.hkedcity.net/tools/footer';
domain_path_footer = domain_path_footer.replace('http://', protocol);
var domain_path_extjs = 'http://apps.hkedcity.net';
domain_path_extjs = domain_path_extjs.replace('http://', protocol);
var domain_path_resource = 'http://apps.hkedcity.net';
domain_path_resource = domain_path_resource.replace('http://', protocol);
Ext.ns('Ext.ux.window');
/**
* An object that represents a group of {@link Ext.ux.window.MessageWindow} instances
* and provides position management in addition to the standard Window Group features.
* @class Ext.ux.window.MessageWindowGroup
* @extends Ext.WindowGroup
* @constructor
*/
Ext.ux.window.MessageWindowGroup = function (config) {
config = config || {};
var mgr = new Ext.WindowGroup();
mgr.positions = [];
Ext.apply(mgr, config);
return mgr;
};
/**
* The default global Message Window group that is available automatically. To have
* more than one group of Message Windows to utilize separate positioning in addition
* to the standard Window Manager features create additional instances of
* {@link Ext.ux.window.MessageWindowGroup} as needed.
* @class Ext.ux.window.MessageWindowMgr
* @extends Ext.ux.window.MessageWindowGroup
* @singleton
*/
Ext.ux.window.MessageWindowMgr = Ext.ux.window.MessageWindowGroup();
/**
*
If you are looking for a lightweight implementation of Toast or Notification windows this is
* NOT the class you want. This class builds upon the implementation by Edouard Fattal.
* This class creates a specialized Window for notification messages and offers the following features:
*
* Demo link: here
* Forum thread: here
*
* Features:
*
*
+ Message windows may be bound to any element through configuration.
*
+ A single Message Window may be reused or multiple Message Windows may be used simultaneously.
*
+ Message windows can be managed by groups.
*
+ Several configurable options.
*
++ By default, Message Window will not steal focus.
*
*
* Known issues/caveats/bugs/roadmap:
*
*
+ config for custom showFx incomplete
*
+ vertical location of subsequent windows may overlap if height changes.
*
+ add config to limit drag options (for example lock x or y axis, etc.)
*
* @class Ext.ux.window.MessageWindow
* @extends Ext.Window
* @author Michael LeComte (mjlecomte), inspired by Ext.ux.Notification\ToastWindow (Edouard Fattal)
* @license LGPL 3.0
* @version 0.3 - April 20, 2009
* @donate
*/
Ext.ux.window.MessageWindow = Ext.extend(Ext.Window, {
/**
* @cfg {String} hideAction
* The action to take after the message window has been hidden. The default is 'close' which
* will close() the window. The other supported value is 'hide' which will keep the window
* available to be redisplayed via the {@link #show} method.
*/
hideAction: 'close',
/**
* @cfg {Boolean} autoHide
* {@link #autoHide}
* True to have message window automatically hide itself (defaults to true).
*/
autoHide: true,
/**
* @cfg {Boolean} autoHeight
* True to use height:'auto', false to use fixed height (defaults to false).
*/
autoHeight: false,
/**
* @cfg {String} bodyStyle
* Custom CSS styles to be applied to the body element in the format expected by
* Ext.Element.applyStyles (defaults to 'text-align:left;padding:10px;').
*/
bodyStyle: 'text-align:left;padding:10px;',
/**
* @cfg {String} baseCls
* The base CSS class to apply to this panel's element (defaults to 'x-window').
*/
/**
* @cfg {String} buttonAlign
* The alignment of any buttons added to this panel. Valid values are 'right', 'left',
* and 'center' (defaults to 'center').
*/
buttonAlign: 'center',
/**
* @cfg {String} cls
* An optional extra CSS class that will be added to this component's Element (defaults
* to 'x-notification'). This can be useful for adding customized styles to the component
* or any of its children using standard CSS rules.
*/
cls: 'x-notification',
/**
* @cfg {Boolean} constrain
* True to constrain the window to the viewport, false to allow it to fall outside of
* the viewport (defaults to true). Optionally the header only can be constrained using
* {@link #constrainHeader}.
*/
constrain: true,
/**
* @cfg {Boolean} constrainHeader
* True to constrain the window header to the viewport, allowing the window body to fall
* outside of the viewport, false to allow the header to fall outside the viewport (defaults
* to true). Optionally the entire window can be constrained using {@link #constrain}.
*/
constrainHeader: true,
/**
* @cfg {Boolean} draggable
* True to allow the window to be dragged by the header bar, false to disable dragging
* (defaults to true). Note that by default the window will be centered in the viewport,
* so if dragging is disabled the window may need to be positioned programmatically after
* render (e.g., myWindow.setPosition(100, 100);).
*/
draggable: true,
/** @cfg {Boolean} floating */
/** @private */
floating: true,
/**
* @cfg {Boolean} focusOnShow
* True to focus the window when shown (defaults to false).
*/
/** @cfg {Boolean} frame */
/** @private */
frame: true,
/**
* @cfg {Ext.ux.window.MessageWindowGroup} manager
* A reference to the MessageWindowGroup that should manage this Message Window (defaults
* to {@link Ext.ux.window.MessageWindowMgr}). Specify a reference to an instance unless
* you want a new manager for each instance:
*
* var group2 = new Ext.ux.window.MessageWindowGroup({
* //override any defaults or add to base class instance
* groupId: 2, //groupId not implemented at this time
* zseed: 2000 //change the zseed (default = 9000)
* });
* var mw1 = new Ext.ux.window.MessageWindow({
* manager: group2//specify the MessageWindowGroup manager (instead of using default manager)
* });
* var mw2 = new Ext.ux.window.MessageWindow({
* manager: group2//specify the MessageWindowGroup manager (instead of using default manager)
* });
* var mw3 = new Ext.ux.window.MessageWindow({
* //will use default manager
* });
*
*/
/**
* @cfg {Function} handleHelp
* Handler function when the help tool is clicked (defaults to {@link Ext#emptyFn}).
* @param {Object} event The click event.
* @param {Object} toolEl The tool Element.
* @param {Object} panel The host Panel.
*/
handleHelp: Ext.emptyFn,
/**
* @cfg {Boolean} help
* True to display tools for help. Defaults to true.
*/
help: true,
/**
* @cfg {Object} hideFx
* Config object for hide effects settings. An example with defaults shown:
*
* hideFx: {
* delay: 5000, //time in milliseconds to delay the start of the effect
* duration: 0.25, //duration of the effect
* mode: 'standard', // null = will not hide
* // 'standard' = traditional window hide (vanish)
* // 'standard' = traditional window hide (vanish)
* // anything else will use the default of ghost
* useProxy: true //default is false to hide window instead
* }
*
*/
hideFx: {
delay: 5000
},
/**
* @cfg {String} hoverCls
* An extra CSS class that will be added to this component's Element when
* hovering over (defaults to 'msg-over').
*/
hoverCls: 'msg-over',
/**
* @cfg {String} iconCls
* A CSS class that will provide a background image to be used as the header icon (defaults
* to 'x-icon-information'). An example custom icon class would be something like:
* .my-icon { background: url(../images/my-icon.gif) 0 6px no-repeat !important;}
*/
iconCls: 'x-icon-information',
/**
* @cfg {Boolean} maximizable
* True to display the 'maximize' tool button and allow the user to maximize the window, false to hide the button
* and disallow maximizing the window (defaults to false). Note that when a window is maximized, the tool button
* will automatically change to a 'restore' button with the appropriate behavior already built-in that will
* restore the window to its previous size.
*/
/**
* @cfg {Boolean} minimizable
* True to display the 'minimize' tool button and allow the user to minimize the window, false to hide the button
* and disallow minimizing the window (defaults to false). Note that this button provides no implementation --
* the behavior of minimizing a window is implementation-specific, so the minimize event must be handled and a
* custom minimize behavior implemented for this option to be useful.
*/
/**
* @cfg {Number} minHeight
* The minimum height in pixels allowed for this window (defaults to 100). Only applies when resizable = true.
*/
minHeight: 40,
/**
* @cfg {Number} minWidth
* The minimum width in pixels allowed for this window (defaults to 200). Only applies when resizable = true.
*/
minWidth: 200,
/**
* @cfg {Boolean} modal
* True to make the window modal and mask everything behind it when displayed, false to display it without
* restricting access to other UI elements (defaults to false).
*/
/**
* @cfg {Array} msgs
* An array to hold the message queue for refreshing messages. Body of the message window will be updated
* from the text element.
* Example:
*
* The first message that will be displayed uses the Title and html config options.
*/
msgs: [],
/**
* @cfg {Boolean} monitorResize
* This is automatically managed based on the value of constrain and constrainToHeader
*/
monitorResize : true,
/**
* @cfg {Function} onEsc
* Allows override of the built-in processing for the escape key. Default action
* is to close the Window (performing whatever action is specified in {@link #closeAction}.
* To prevent the Window closing when the escape key is pressed, specify this as
* Ext.emptyFn (See {@link Ext#emptyFn}).
*/
/**
* @cfg {Object} origin
* Config object for the message origin with the following sample of default properties:
* Example:
*
* //configure a different origin than the default bottom right corner of the window:
* origin: {
* //get window's Ext.element:
* el: Ext.get('northRegion'), //element to align to (defaults to document)
* increment: true, // default is to increment position of subsequent messages
* pos: "bl-bl", // position to align to (see {@link Ext.Element#alignTo} for more details defaults to "br-br").
* offX: 10, // amount to offset horizontally (-20 by default)
* offY: 0 // amount to offset vertically (-20 by default)
* spaY: 5 // vertical spacing between adjacent messages (5 by default)
* },
*
*/
/**
* @cfg {Boolean} pinOnClick
* True to display the 'pin' tool button and allow the user to pin the window, false
* to hide the button and disallow pinning the window (defaults to true).
*/
pinOnClick: true,
/**
* @cfg {String} pinState
* Specify the initial pin state when the window is first shown. Specify null, 'pin', or the default
* 'unpin'.
* pinState effect
* -------- ------
* null window will show/hide itself, user can not control
* 'pin' window will initially show itself in pinned state, user will need to click unpin to hide
* 'unpin' window will initially show itself in unpinned state, user will need to click pin to keep open
*
*/
pinState: 'unpin',
/**
* @cfg {Boolean} plain
* True to render the window body with a transparent background so that it will blend into the framing
* elements, false to add a lighter background color to visually highlight the body element and separate it
* more distinctly from the surrounding frame (defaults to false).
*/
plain: false,
/**
* @cfg {Boolean} resizable
* True to allow user resizing at each edge and corner of the window, false to disable resizing (defaults to false).
*/
resizable: false,
/**
* @cfg {String} resizeHandles
* A valid {@link Ext.Resizable} handles config string (defaults to 'all'). Only applies when resizable = true.
*/
/**
* @cfg {String} textHelp
* Qtip text to display for help tool (defaults to 'Get hel'). Only applicable if help = true.
*/
textHelp: 'Get help',
/**
* @cfg {String} textPin
* Qtip text to display for pin tool. Only applicable if {@link pinState} == 'pin' or 'unpin'.
*/
textPin: 'Pin this to prevent closing',
/**
* @cfg {String} textUnpin
* Qtip text to display for unpin tool. Only applicable if {@link pinState} == 'pin' or 'unpin'.
*/
textUnpin: 'Unpin this to close',
/**
* @cfg {Number} x
* The X position of the left edge of the Window on initial showing. Defaults to centering the Window within
* the width of the Window's container {@link Ext.Element Element) (The Element that the Window is rendered to).
*/
/**
* @cfg {Number} y
* The Y position of the top edge of the Window on initial showing. Defaults to centering the Window within
* the height of the Window's container {@link Ext.Element Element) (The Element that the Window is rendered to).
*/
/** @private */
initHidden : true,
/** @private */
initComponent : function () {
Ext.apply(this, {
collapsible: false,
footer: false,
minHeight: 20,
stateful: false
});
//if interval is specified automatically show message windows
if (this.interval) {
this.startAutoRefresh();
}
//set up automatic hide/close of window if so configured
if (this.autoHide) {
if (this.pinState === 'unpin') {
this.task = new Ext.util.DelayedTask( this[this.hideAction], this, [this.animateTarget]);
}
}
//new
else {
this.closable = true;
}
//added this.closable
//call parent
Ext.ux.window.MessageWindow.superclass.initComponent.call(this);
//add listeners
this.on({
mouseout: {
scope: this,
fn: this.onMouseout
}
});
//add events
this.addEvents(
/**
* @event activate
* Fires after the window has been visually activated via {@link setActive}.
* @param {Ext.ux.window.MessageWindow} this
*/
/**
* @event deactivate
* Fires after the window has been visually deactivated via {@link setActive}.
* @param {Ext.ux.window.MessageWindow} this
*/
/**
* @event resize
* Fires after the window has been resized.
* @param {Ext.ux.window.MessageWindow} this
* @param {Number} width The window's new width
* @param {Number} height The window's new height
*/
/**
* @event maximize
* Fires after the window has been maximized.
* @param {Ext.ux.window.MessageWindow} this
*/
/**
* @event minimize
* Fires after the window has been minimized.
* @param {Ext.ux.window.MessageWindow} this
*/
/**
* @event restore
* Fires after the window has been restored to its original size after being maximized.
* @param {Ext.ux.window.MessageWindow} this
*/
/**
* @event pinned
* Fires after the window has been pinned.
* @param {Ext.ux.window.MessageWindow} this
*/
'afterpin',
/**
* @event unpinned
* Fires after the window has been unpinned.
* @param {Ext.ux.window.MessageWindow} this
*/
'afterunpin',
/**
* @event click
* Fires after the window has been clicked.
* @param {Ext.ux.window.MessageWindow} this
* @param {Ext.ux.window.MessageWindow} msg The message from the message array if configured.
*/
'click');
this.initFx();
},
//override
/** @private */
initEvents: function () {
//use a slighly enhanced Ext.ux.window.MessageWindowMgr instead of the default WindowMgr
this.manager = this.manager || Ext.ux.window.MessageWindowMgr;
//the parent class will register, so no need to do it here:
//this.manager = this.manager || Ext.WindowMgr;
Ext.ux.window.MessageWindow.superclass.initEvents.call(this);
},
focus: function () {
Ext.ux.window.MessageWindow.superclass.focus.call(this);
},
/** @private */
toFront: function () {
if(this.manager.bringToFront(this)){
//only focus if configured as such
if(this.focusOnShow){
this.focus();
}
}
return this;
},
/** @private */
initTools: function () {
if (this.pinOnClick) {
this.addTool({
id: 'unpin', // image points left
handler: this.handlePin,
//set initial visibility (also check if pinState is null)
hidden: (!this.pinState || this.pinState === 'pin'),
qtip: this.textPin,
scope: this
});
this.addTool({
id: 'pin',// image points down
handler: this.handleUnpin,
hidden: (!this.pinState || this.pinState === 'unpin'),
qtip: this.textUnpin,
scope: this
});
}
if (this.help) {
this.addTool({
id: 'help',
handler: this.handleHelp,
qtip: this.textHelp,
scope: this
});
}
if (this.closable) {
this.addTool({
id: 'close',
handler: this.close,
qtip: "",
scope: this
});
}
},
/** @private */
onRender: function (ct, position) {
Ext.ux.window.MessageWindow.superclass.onRender.call(this, ct, position);
//after call to parent class onRender this.el exists.
//clip part of the window (for example the recurring messages that
//eject from a border have the bottom rounded edge, etc. clipped off.
if (this.clip) {
switch (this.clip) {
case 'bottom':
Ext.destroy(this.getEl().child('.' + this.baseCls + '-bl'));
break;
}
}
//add a class when hovering over in order to disable
//any updates to the window while hovering over
if (true) {
this.el.addClassOnOver(this.hoverCls);
}
//add click listener to body
Ext.fly(this.body.dom).on('click', this.handleClick, this);
},
////////////////////////////////
// Temporary override?
/**
* Closes the window, removes it from the DOM and destroys the window object. The beforeclose event is fired
* before the close happens and will cancel the close action if it returns false.
*/
// close : function(){
close : function(animateTarget){
if(this.fireEvent("beforeclose", this) !== false){
// this.hide(null, function(){
this.hide(animateTarget, function(){
this.fireEvent('close', this);
this.destroy();
}, this);
}
},
/////////////////////////////////
/**
* Toggles the active pin state.
*/
togglePinState: function (event) {
if (this.pinOnClick) {
//check which tool is visible
if (this.tools.unpin.isVisible()) {
this.handlePin(event, this.tools.unpin, this);
} else {
this.handleUnpin(event, this.tools.pin, this);
}
}
},
/**
* Override to the Panel Class createElement method. This method is called by
* Panel Class' onRender(). Normally the panel class will create a header in the
* *-tc class, to utilize the default box class for styling we'll move the header
* inside the *-mc class to utilize
Ext.Element.boxMarkup:
##HEADER##
CONTAINER
###############
Title
Message
* @param {Object} name
* @param {Object} pnode
*///override panel class method:
// private
createElement : function (name, pnode) {
if (this.shiftHeader) {
switch (name) {
case 'header':
//don't create header yet if putting inside mc, do it when tbar is done
return;
case 'tbar':
Ext.ux.window.MessageWindow.superclass.createElement.call(this, 'header', pnode);
Ext.ux.window.MessageWindow.superclass.createElement.call(this, name, pnode);
return;
}
}
//caught the ones we needed to, call the default implementation
Ext.ux.window.MessageWindow.superclass.createElement.call(this, name, pnode);
},
//override/disable focus, see above.
focus: Ext.emptyFn,
/** @private */
getState : function () {
return Ext.apply(Ext.ux.window.MessageWindow.superclass.getState.call(this) || {}, this.getBox());
},
/**
* Handler for when the message window body is clicked
* @param {Object} event The click event.
*/
handleClick: function (event) {
this.fireEvent('click', this, this.msg);
this.togglePinState(event);
},
/**
* Handler for when pin button is clicked
* @param {Object} event The click event.
* @param {Object} toolEl The tool Element.
* @param {Object} panel The host Panel.
*/
handlePin: function (event, toolEl, panel) {
//hide the unpin button
toolEl.hide();
//show the pin button
this.tools.pin.show();
this.cancelHiding();
this.fireEvent('afterpin', this);
},
/**
* Handler for when pin button is clicked
* @param {Object} event The click event.
* @param {Object} toolEl The tool Element.
* @param {Object} panel The host Panel.
*/
handleUnpin: function (event, toolEl, panel) {
//hide the pin button
toolEl.hide();
//show the unpin button
this.tools.unpin.show();
this[this.hideAction](this.animateTarget);
this.fireEvent('afterunpin', this);
},
/**
* cancel hiding of the window if {@link #autoHide} is true
*/
cancelHiding: function () {
this.addClass('fixed');
if (this.autoHide) {
if (this.pinState === 'unpin') {
this.task.cancel();
}
}
//show the pin button
this.tools.pin.show();
//make sure the unpin button is hidden
this.tools.unpin.hide();
},
/** @private */
initFx : function () {
this.showFx = this.showFx || {};
Ext.applyIf(this.showFx, {
align: 'b',
duration: 1,
callback: this.afterShow,
scope: this
});
this.hideFx = this.hideFx || {};
Ext.applyIf(this.hideFx, {
block: false,//default for window is true
callback: this.afterHide,
easing: 'easeOut',//'easeNone';
remove: true,
scope: this
});
this.origin = this.origin || {};
Ext.applyIf(this.origin, {
el: Ext.getDoc(), //defaults to document
increment: true, //whether to increment position of subsequent messages
pos: "br-br",//position to align to (see {@link Ext.Element#alignTo} for more details defaults to "br-br").
offX: -20, //amount to offset horizontally
offY: -20, //amount to offset vertically
spaY: 5 //vertical spacing between adjacent messages
});
},
getAnimEl : function (fx) {
var animEl;
//animate using a proxy instead of actual element if so configured
if (fx.useProxy) {
animEl = this.proxy;
this.proxy.setOpacity(0.5);
this.proxy.show();
var tb = this.getBox(false);
this.proxy.setBox(tb);
this.el.hide();
//Ext.apply(fx, tb);
} else {
animEl = this.el;
}
return animEl;
},
//override parent method
/** @private */
animHide : function () {
//remove the position of this element from the manager
this.manager.positions.remove(this.pos);
// configured Fx and element to hide
var fx = this.hideFx, w = this.getAnimEl(fx);
switch (fx.mode) {
case 'none':
break;
case 'slideIn':
w[fx.mode]("b", fx);
//w.slideIn("b", fx);
break;
case 'custom':
Ext.callback(fx.callback, fx.scope, [this, w, fx]);//callback(cb,scope,args,delay)
break;
case 'standard':
fx.duration = fx.duration || 0.25;
fx.opacity = 0;
w.shift(fx);
break;
default:
fx.duration = fx.duration || 1;
w.ghost("b", fx);
break;
}
},
//override parent method
/** @private */
afterShow: function () {
Ext.ux.window.MessageWindow.superclass.afterShow.call(this);
//if user moves remove from position manager and cancel hiding
this.on('move', function(){
//remove the position of this element from the manager
this.manager.positions.remove(this.pos);
this.cancelHiding();
}, this);
if (this.autoHide) {
if (this.pinState === 'unpin') {
this.task.delay(this.hideFx.delay);
}
}
},
/** @private */
animShow: function () {
//don't update if hovering over message
//check if visible so it will show initially
if (this.el.isVisible() && this.el.hasClass(this.hoverCls)) {
return;
}
if (this.msgs.length > 1) {
this.updateMsg();
}
//element to hide and configured Fx
var fx = this.showFx, el = this.el;
this.position(el);
el.slideIn(fx.align, fx);
},
/**
* some cleanup still needed this method
* sizing / placement issues when height of windows changes
* should recalculate placement based on window height
*/
position : function (el) {
var y,
// push down instead of up if align top
dir = (this.showFx.align.substr(0,1) == 't') ? 1 : -1;
//track positions of each instance
this.pos = 0;
if (this.origin.increment) {
while (this.manager.positions.indexOf(this.pos) > -1) {
this.pos++;
}
this.manager.positions.push(this.pos);
}
//set the window size
this.setSize(this.width || this.minWidth, this.height || this.minHeight);
//increment the vertical position of the window
if (this.origin.increment) {
y = this.origin.offY + ((this.getSize().height + this.origin.spaY) * this.pos * dir);
} else {
y = 0;
}
el.alignTo(
this.origin.el, // element to align to.
this.origin.pos, // position to align to (see {@link Ext.Element#alignTo} for more details).
[ this.origin.offX, y ] // Offset the positioning by [x, y]:
);
},
onMouseout: function () {
//console.info('in onMouseout');
//console.info(arguments);
},
/**
* @param {Object} el
* @param {Object} x
* @param {Object} y
* @private
*/
positionPanel: function (el, x, y) {
if(x && typeof x[1] == 'number'){
y = x[1];
x = x[0];
}
el.pageX = x;
el.pageY = y;
if(x === undefined || y === undefined){ // cannot translate undefined points
return;
}
if(y < 0){ y = 10; }
var p = el.translatePoints(x, y);
el.setLocation(p.left, p.top);
return el;
},
/**
* Specify the message to be shown
* @param {String} msg Message to update the body with.
*/
setMessage: function (msg) {
this.body.update(msg);
},
/**
* Set the title of the message window
* @param {String} title Title of Window
* @param {String} iconCls icon to use in header area
*/
setTitle: function (title, iconCls) {
Ext.ux.window.MessageWindow.superclass.setTitle.call(this, title, iconCls || this.iconCls);
},
/**
* Start recurring messages
* @param {Boolean} update Whether to update the message before starting automatic refreshes.
*/
startAutoRefresh : function(update){
if(update){
this.updateMsg(true);
}
if(this.autoRefreshProcId){
clearInterval(this.autoRefreshProcId);
}
// native javascript function to delay for a specified time before triggering the
// execution of a specific function. After triggering the called function the command
// doesn't complete. Instead it waits for the specified time again and then triggers
// the function again and continues to repeat this process of triggering the function
// at the specified intervals until either the web page is unloaded or the clearInterval
// function is called.
this.autoRefreshProcId = setInterval(this.animShow.createDelegate(this, []), this.interval);
},
/**
* Stop recurring messages
*/
stopAutoRefresh : function(){
if(this.autoRefreshProcId){
clearInterval(this.autoRefreshProcId);
}
},
/**
* Update the message
* @param {String} msg The updated msg
*/
updateMsg: function (msg) {
//don't update if hovering over message
if (this.el && !this.el.hasClass(this.hoverCls)) {
if (msg) {
// console.info('message passed');
} else {
this.msgIndex = this.msgs[this.msgIndex + 1] ? this.msgIndex + 1 : 0;
this.msg = this.msgs[this.msgIndex];
}
//update the innerHTML of element
//this.el.dom.update(this.msg.text);
this.body.update(this.msg.text);
} else {
//console.info('hovering');
}
}
});
//register the xtype
Ext.reg('message-window', Ext.ux.window.MessageWindow);/**
*
* Base64 encode / decode
* http://www.webtoolkit.info/
*
**/
var Base64 = {
// private property
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// public method for encoding
encode : function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = Base64._utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output +
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
}
return output;
},
// public method for decoding
decode : function (input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = this._keyStr.indexOf(input.charAt(i++));
enc2 = this._keyStr.indexOf(input.charAt(i++));
enc3 = this._keyStr.indexOf(input.charAt(i++));
enc4 = this._keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = Base64._utf8_decode(output);
return output;
},
// private method for UTF-8 encoding
_utf8_encode : function (string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
},
// private method for UTF-8 decoding
_utf8_decode : function (utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
while ( i < utftext.length ) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
}
else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
}
else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
}
//document.write("");
//document.write("");
document.write("");
var footer_activation_msg = "";
var footer_current_lang = "";
function footer_init() {
if (typeof get_topbar_city_id == 'function') {
if (get_topbar_city_id() !== false) {
extjs_ready();
footer_get_bestview();
footer_initMuseum(); footer_checkURL();
return;
}
}
setTimeout("footer_init();", 100);
return;
}
function footer_activation_close() {
if(confirm(footer_activation_msg)) {
logout_app();
return true;
}
return false;
}
function footer_invitation_shown() {
Ext.onReady(function(){
var readerObj = new Ext.data.Record.create([
{ id: "id" },
{ name: "output" }
] );
// var url = domain_path_footer + '/handler1.php?city_id=' + get_topbar_city_id() + '&actionID=CHECK&cmd=invitation_shown&url=' + encodeURI(top.location.href);
var url = domain_path_footer + '/handler1.php?city_id=' + get_topbar_city_id() + '&actionID=CHECK&cmd=invitation_shown&url=' + Base64.encode(top.location.href);
var reader = new Ext.data.JsonReader({
totalProperty: "results",
root: "data",
id: "id"
}, readerObj);
var proxy = new Ext.data.ScriptTagProxy({
url: url
});
var ds = new Ext.data.Store({
proxy: proxy,
reader: reader
});
ds.on({
'load':{
fn: function(store, records, options){
}
, scope: this
}
});
ds.load();
});
}
function footer_get_bestview()
{
Ext.onReady(function() {
var readerObj = new Ext.data.Record.create([
{ id: "id" },
{ name: "output" }
] );
var url = domain_path_footer + '/handler1.php?actionID=CHECK&cmd=GET_BEST_VIEW&url=' + Base64.encode(top.location.href) + '&lang_code=' + footer_current_lang;
var reader = new Ext.data.JsonReader({
totalProperty: "results",
root: "data",
id: "id"
}, readerObj);
var proxy = new Ext.data.ScriptTagProxy({
url: url
});
var ds = new Ext.data.Store({
proxy: proxy,
reader: reader
});
ds.on({
'load':{
fn: function(store, records, options){
var formItemObj = document.getElementById('old_footer_div');
var output = records[0].get("output");
if (output != "no" && formItemObj) {
formItemObj.innerHTML = output + formItemObj.innerHTML;
}
}
, scope: this
}
});
ds.load();
return;
});
}
function footer_checkURL() {
Ext.onReady(function() {
var link = new Array();
var page_url = window.location.href;
Ext.select('a').each(function(el, self, i) {
if (el.getAttributeNS('','href') != null) {
link.push(el.getAttributeNS('','href'));
}
});
var link_url = link.join("\r\n");
Ext.Ajax.request({
url: '/hkectopbar/footer/handler.php?actionID=CHECK_URL',
method: 'POST',
params: {'page_url': page_url, 'link_url': link_url},
success: function(msg){
}
});
});
}
function footer_initMuseum() {
var check_url = '/hkectopbar/footer/handler.php?actionID=IS_MUSEUM&url=' + Base64.encode(window.location.href) + '&lang_code=' + this.lang_code;
Ext.Ajax.request({
url: check_url,
method: 'GET',
success: function(data){
footer_showMuseum(data.responseText);
}
});
}
function footer_showMuseum(data) {
museum_msg_b5 = Base64.decode('PGRpdiBzdHlsZT0iZmxvYXQ6cmlnaHQ7Ij4KCTxhIGhyZWY9IiMiIG9uY2xpY2s9ImphdmFzY3JpcHQ6RXh0LmdldCgnbXVzZXVtQmxvY2snKS5oaWRlKCk7IHJldHVybiBmYWxzZTsiPjxzcGFuIHN0eWxlPSJjb2xvcjp3aGl0ZTsgdGV4dC1kZWNvcmF0aW9uOnVuZGVybGluZTsiPumXnOmWiTwvc3Bhbj48L2E+CjwvZGl2Pgo8Zm9udCBjb2xvcj0iI0ZGRkZGRiI+PHA+5q2k57ay6aCB5bey5pqr5YGc5pu05pawPC9wPgo8cD7mraTntrLpoIHlhaflrrnnj77lt7Lkv53lrZjkvZzlj4PogIPkuYvnlKjvvIzkuKbmmqvlgZzlrprmnJ/mm7TmlrDjgILlpoLmnInku7vkvZXmn6XoqaLvvIzmraHov47pm7vpg7Xoh7MgPGEgaHJlZj0ibWFpbHRvOnN1cHBvcnRAaGtlZGNpdHkubmV0Ij5zdXBwb3J0QGhrZWRjaXR5Lm5ldDwvYT4g6IiH5oiR5YCR6IGv57Wh44CCPC9wPjwvZm9udD4K');
museum_msg_gb = Base64.decode('PGRpdiBzdHlsZT0iZmxvYXQ6cmlnaHQiPgoJPGEgaHJlZj0iIyIgb25jbGljaz0iamF2YXNjcmlwdDpFeHQuZ2V0KCdtdXNldW1CbG9jaycpLmhpZGUoKTsgcmV0dXJuIGZhbHNlOyI+PHNwYW4gc3R5bGU9ImNvbG9yOndoaXRlOyB0ZXh0LWRlY29yYXRpb246dW5kZXJsaW5lOyI+5YWz6ZetPC9zcGFuPjwvYT4KPC9kaXY+Cjxmb250IGNvbG9yPSIjRkZGRkZGIj48cD7mraTnvZHpobXlt7LmmoLlgZzmm7TmlrA8L3A+CjxwPuatpOe9kemhteWGheWuueeOsOW3suS/neWtmOS9nOWPguiAg+S5i+eUqO+8jOW5tuaaguWBnOWumuacn+abtOaWsOOAguWmguacieS7u+S9leafpeivou+8jOasoui/jueUtemCruiHsyA8YSBocmVmPSJtYWlsdG86c3VwcG9ydEBoa2VkY2l0eS5uZXQiPnN1cHBvcnRAaGtlZGNpdHkubmV0PC9hPiDkuI7miJHku6zogZTnu5zjgII8L3A+PC9mb250Pgo=');
museum_msg_eng = Base64.decode('PGRpdiBzdHlsZT0iZmxvYXQ6cmlnaHQiPgoJPGEgaHJlZj0iIyIgb25jbGljaz0iamF2YXNjcmlwdDpFeHQuZ2V0KCdtdXNldW1CbG9jaycpLmhpZGUoKTsgcmV0dXJuIGZhbHNlOyI+PHNwYW4gc3R5bGU9ImNvbG9yOndoaXRlOyB0ZXh0LWRlY29yYXRpb246dW5kZXJsaW5lOyI+Q2xvc2U8L3NwYW4+PC9hPgo8L2Rpdj4KPGZvbnQgY29sb3I9IiNGRkZGRkYiPgo8cD5ObyBVcGRhdGUgb24gVGhpcyBXZWIgUGFnZTwvcD4KPHA+VGhlIHdlYiBwYWdlIGNvbnRlbnQgeW91IGFyZSBjdXJyZW50bHkgYnJvd3NpbmcgaGFzIGJlZW4gcmVzZXJ2ZWQgZm9yIHJlZmVyZW5jZSBwdXJwb3NlIHN1c3BlbmRlZCBmcm9tIHJlZ3VsYXIgdXBkYXRlcy4gRm9yIGVucXVpcmVzIHBsZWFzZSBlbWFpbCB1cyBhdCA8YSBocmVmPSJtYWlsdG86c3VwcG9ydEBoa2VkY2l0eS5uZXQiPnN1cHBvcnRAaGtlZGNpdHkubmV0PC9hPi48L3A+PC9mb250Pgo=');
if (data == "yes") {
var top_px = 61;
var newdiv = document.createElement('div');
newdiv.setAttribute('id', 'museumBlock');
newdiv.style.width = '100%';
newdiv.style.height = '200px';
newdiv.style.position = "absolute";
newdiv.style.top = '61px';
newdiv.style.left = '0px';
newdiv.style.zIndex = 99999;
newdiv.style.backgroundColor = '#000000';
if(newdiv.style.opacity == undefined) {
newdiv.style.filter = "alpha(opacity=60)";
} else {
newdiv.style.opacity = .6;
}
if (this.lang_code == "eng") {
newdiv.innerHTML = museum_msg_eng;
}
else if (this.lang_code == "gb") {
newdiv.innerHTML = museum_msg_gb;
}
else {
newdiv.innerHTML = museum_msg_b5;
}
document.body.appendChild(newdiv);
window.onscroll = function() {
if (document.body && document.body.scrollTop) {
var topHeight = document.body.scrollTop;
} else if (document.documentElement && document.documentElement.scrollTop) {
var topHeight = document.documentElement.scrollTop;
} else {
var topHeight = 0;
}
if (topHeight <= top_px) {
topHeight = 0;
} else {
topHeight -= top_px;
}
newdiv.style.top = (topHeight+top_px) + "px";
};
}
}
function extjs_ready() {
Ext.onReady(function(){
var current_id = 0;
var j = 0;
var k = 0;
var msg_windows = new Array();
var msg_windows_modaless = new Array();
var msg_windows_top = null;
var readerObj = new Ext.data.Record.create(
[
{ name: "width"},
{ name: "height"},
{ name: "x"},
{ name: "y"},
{ name: "start_date"},
{ name: "expire_date"},
{ name: "display_times"},
{ name: "delay"},
{ name: "e_title"},
{ name: "e_content"},
{ name: "e_template_path"},
{ name: "e_button_type"},
{ name: "c_title"},
{ name: "c_content"},
{ name: "c_template_path"},
{ name: "c_button_type"},
{ name: "window_mode"},
{ name: "active_url"},
{ name: "title"},
{ name: "content"},
{ name: "button_type"},
{ name: "resize", type: "boolean"},
{ name: "auto_hide", type: "boolean"},
{ name: "close_text"},
{ name: "alert_msg"},
{ name: "close_act"},
{ name: "body_style"},
{ name: "window_show"}
] );
// var url = domain_path_footer + '/handler1.php?city_id=' + get_topbar_city_id() + '&actionID=CHECK&cmd=list&url=' + encodeURI(top.location.href);
var url = domain_path_footer + '/handler1.php?city_id=' + get_topbar_city_id() + '&actionID=CHECK&cmd=list&url=' + Base64.encode(top.location.href);
//alert(url);
var reader = new Ext.data.JsonReader({
totalProperty: "results",
root: "data",
id: "id"
}, readerObj);
var proxy = new Ext.data.ScriptTagProxy({
url: url
});
var ds = new Ext.data.Store({
proxy: proxy,
reader: reader
});
ds.on({
'load':{
fn: function(store, records, options){
var record_size = records.length;
for(var i = 0; i < record_size; i++){
set_window(records[i]);
}
//Modal window - activation or T & C
//Modaless window - suspend website and invitation/notice
if(msg_windows.length > 0){
//Modal Window
msg_windows[current_id].show();
}else{
if(msg_windows_top != null){
//Modaless Window - suspend website
msg_windows_top.show(Ext.getDoc());
}
if(msg_windows_modaless.length > 0){
//Modaless Window - invitation / notice
display_modaless();
}
}
}
}
});
ds.load();
function set_window(window_property){
var auto_hide;
if(window_property.get("auto_hide") == "undefined"){
auto_hide = true;
}else{
auto_hide = window_property.get("auto_hide");
}
if(window_property.get("alert_msg") != "undefined" && window_property.get("alert_msg") != ""){
footer_activation_msg = window_property.get("alert_msg");
}
switch(window_property.get("window_mode")){
case "modal":
var win = new Ext.Window(
{
title: window_property.get("title"),
html: window_property.get("content"),
autoHeight: false,
width: window_property.get("width"),
height: window_property.get("height"),
resizable: window_property.get("resize"),
modal: true,
closable: true,
closeAction: 'hide',
listeners:{
beforehide: function(winObj){
action_type = window_property.get("close_act");
return window_control(action_type, this);
}
}
}
);
if(window_property.get("x") != "undefined" && window_property.get("x") != ""){
win.x = window_property.get("x");
}
if(window_property.get("y") != "undefined" && window_property.get("y") != ""){
win.y = window_property.get("y");
}
msg_windows[j] = win;
j++;
break;
case "modaless":
var delay = parseInt(window_property.get("delay"));
if (isNaN(delay) || delay <= 0) {
delay = 5000;
}
var body_style = window_property.get("body_style");
if (!body_style) {
body_style = "text-align:center";
}
var win = new Ext.ux.window.MessageWindow({
title: window_property.get("title"),
autoDestroy: true,//default = true
width: window_property.get("width"),
autoHeight: true,
autoHide: auto_hide ,//default = true
bodyStyle: body_style,
buttonAlign: 'right',
pinOnClick: true,
help: false,
closable: true,
closeAction: 'hide',
listeners:{
beforehide: function(winObj){
action_type = window_property.get("close_act");
return window_control(action_type, this);
}
},
hideFx: {
delay: delay,
//duration: 0.25,
mode: 'standard',//null,'standard','custom',or default ghost
useProxy: false //default is false to hide window instead
},
html: window_property.get("content"),
/*
buttons:[{
text: window_property.get("close_text"),
listeners:{
click: function(){
win.close();
}
}
}],
*/
/*
//optionally enable sound...see http://efattal.fr/extjs/examples/toastwindow/
//if you want to enable sound with this
listeners: {
'beforerender': function(){
Sound.enable();
Sound.play('notify.wav');
Sound.disable();
}
}
*/
showFx: {
delay: 0,
//duration: 0.5, //defaults to 1 second
mode: 'standard',//null,'standard','custom',or default ghost
useProxy: false //default is false to hide window instead
},
width: window_property.get("width") //optional (can also set minWidth which = 200 by default)
});
msg_windows_modaless[k] = win;
k++;
break;
case "museum":
var win = new Ext.ux.window.MessageWindow({
resizable: window_property.get("resize"),
width: window_property.get("width"), //optional (can also set minWidth which = 200 by default)
html: window_property.get("content"),
autoHide: false, //default = true
closable: false,
help: false,
autoDestroy: true, //default = true
autoHeight: true,
pinOnClick: true,
bodyStyle: 'text-align:center',
iconCls: 'x-icon-error',
origin: {
//get window's Ext.element:
pos: "t-t", //position to align to (see {@link Ext.Element#alignTo} for more details defaults to "br-br").
offX: 0, //amount to offset vertically (-20 by default)
offY: 0, //amount to offset vertically (-20 by default)
spaY: 5 //vertical spacing between adjacent messages
},
hideFx: {
delay: 5000,
duration: 0.25,
mode: 'standard', //null,'standard','custom',or default ghost
useProxy: false //default is false to hide window instead
},
listeners:{
close: function(){
action_type = window_property.get("close_act");
window_control(action_type, this);
}
},
showFx: {
align: 't',
delay: 0,
duration: 0.5, //defaults to 1 second
mode: 'standard', //null,'standard','custom',or default ghost
useProxy: false //default is false to hide window instead
},
closeAction: 'hide',
listeners:{
beforehide: function(winObj){
action_type = window_property.get("close_act");
return window_control(action_type, this);
}
}
});
msg_windows_top = win;
break;
default:
break;
}
}
//Handle user click "cross" button
function window_control(action_flag, obj){
if(action_flag == undefined || action_flag == ""){
return true;
}
if(action_flag == "CLOSE"){
//obj.close();
return true;
}else if (action_flag.search("^func_") != -1){
eval("var result = " + action_flag.replace("func_", "") + "();");
return result;
}else{
top.location.href = action_flag;
return true;
}
}
//Auto display modaless windows
function display_modaless(){
msg_windows_modaless[current_id].show(Ext.getDoc());
current_id = current_id + 1;
if(current_id < msg_windows_modaless.length){
setTimeout(function(){display_modaless();}, 2000);
}else{
}
}
}) // Ext.onReady
return;
}// extjs_ready
// original footer codes
// Define channel name in chinese
// Convert to Unicode from http://www.hot-tips.co.uk/useful/unicode_converter.HTML
var zh_channel1 = "\u6559\u57ce\u7e3d\u90e8";
var zh_channel2 = "\u6559\u57ce\u8cfc\u7269\u5340";
var zh_channel3 = "\u8cc7\u6e90\u4e2d\u5fc3";
var zh_channel4 = "\u5b78\u751f\u4e2d\u5fc3";
var zh_channel5 = "\u6559\u5e2b\u5c08\u696d\u7db2";
var zh_channel6 = "\u5bb6\u9577\u4e2d\u5fc3";
var zh_channel9 = "\u5716\u66f8\u9928";
var zh_channel10 = "\u5b78\u79d1\u5927\u6a13";
var zh_channel11 = "\u5b78\u6821\u6982\u89bd";
var zh_channel12 = "\u5927\u540c\u5b78\u7fd2\u6751";
var zh_channel13 = "\u5c0f\u6821\u5712";
var zh_channel14 = "\u0045\u006e\u0067\u006c\u0069\u0073\u0068\u0020\u0043\u0061\u006d\u0070\u0075\u0073";
var zh_channel15 = "\u5c79\u7acb\u4e0d\u8ced\u884c\u52d5";
var zh_channel16 = "\u9999\u6e2f\u95b1\u8b80\u57ce";
var zh_channel17 = "\u7d14\u6587\u5b57\u7d22\u5f15";
//var channel_zh = new Array(zh_channel1, zh_channel2, zh_channel3, zh_channel4, zh_channel5, zh_channel6, zh_channel7, zh_channel8, zh_channel9, zh_channel10, zh_channel11, zh_channel12, zh_channel13, zh_channel14, zh_channel15, zh_channel16, zh_channel17);
var channel_zh = new Array(zh_channel1, zh_channel2, zh_channel3, zh_channel4, zh_channel5, zh_channel6, zh_channel9, zh_channel10, zh_channel11, zh_channel12, zh_channel13, zh_channel14, zh_channel15, zh_channel16, zh_channel17);
var en_channel1 = "Headquarters";
var en_channel2 = "Ed-Mall";
var en_channel3 = "Resources Library";
var en_channel4 = "Students' Channel";
var en_channel5 = "Teachers Net";
var en_channel6 = "Parents' Corner";
//var en_channel7 = "Media Campus";
//var en_channel8 = "Cultural Centre";
var en_channel9 = "Library";
var en_channel10 = "Learning Centre";
var en_channel11 = "School Directory";
var en_channel12 = "Inclusive Village";
var en_channel13 = "Small Campus";
var en_channel14 = "English Campus";
var en_channel15 = "Say NO to GAMBLING";
var en_channel16 = "HKReading City";
var en_channel17 = "Text-only Index";
//var channel_en = new Array(en_channel1, en_channel2, en_channel3, en_channel4, en_channel5, en_channel6, en_channel7, en_channel8, en_channel9, en_channel10, en_channel11, en_channel12, en_channel13, en_channel14, en_channel15, en_channel16, en_channel17);
var channel_en = new Array(en_channel1, en_channel2, en_channel3, en_channel4, en_channel5, en_channel6, en_channel9, en_channel10, en_channel11, en_channel12, en_channel13, en_channel14, en_channel15, en_channel16, en_channel17);
var zn_channel1 = "\u6559\u57ce\u603b\u90e8";
var zn_channel2 = "\u6559\u57ce\u8d2d\u7269\u533a";
var zn_channel3 = "\u8d44\u6e90\u4e2d\u5fc3";
var zn_channel4 = "\u5b66\u751f\u4e2d\u5fc3";
var zn_channel5 = "\u6559\u5e2b\u5c08\u696d\u7db2";
var zn_channel6 = "\u5bb6\u957f\u4e2d\u5fc3";
//var zn_channel7 = "\u4f20\u5a92\u5b66\u56ed";
//var zn_channel8 = "\u6587\u5316\u90e8\u5c4b";
var zn_channel9 = "\u56fe\u4e66\u9986";
var zn_channel10 = "\u5b66\u79d1\u5927\u697c";
var zn_channel11 = "\u5b66\u6821\u6982\u89c8";
var zn_channel12 = "\u5927\u540c\u5b66\u4e60\u6751";
var zn_channel13 = "\u5c0f\u6821\u56ed";
var zn_channel14 = "English Campus";
var zn_channel15 = "\u5c79\u7acb\u4e0d\u8d4c\u884c\u52a8";
var zn_channel16 = "\u9999\u6e2f\u9605\u8bfb\u57ce";
var zn_channel17 = "\u7eaf\u6587\u5b57\u7d22\u5f15";
//var channel_zn = new Array(zn_channel1, zn_channel2, zn_channel3, zn_channel4, zn_channel5, zn_channel6, zn_channel7, zn_channel8, zn_channel9, zn_channel10, zn_channel11, zn_channel12, zn_channel13, zn_channel14, zn_channel15, zn_channel16, zn_channel17);
var channel_zn = new Array(zn_channel1, zn_channel2, zn_channel3, zn_channel4, zn_channel5, zn_channel6, zn_channel9, zn_channel10, zn_channel11, zn_channel12, zn_channel13, zn_channel14, zn_channel15, zn_channel16, zn_channel17);
// Define Link for each channel
var channel_lnk1 = "http://www.hkedcity.net/article/main_info/info/index.phtml?chg_lang=%langNum%";
var channel_lnk2 = "http://newedmall.hkedcity.net/EdMallWeb/zh-HK/Home/Index.aspx";
var channel_lnk3 = "http://www.hkedcity.net/resources/";
var channel_lnk4 = "http://www.hkedcity.net/student/index.phtml";
var channel_lnk5 = "http://www.hkedcity.net/teachernet/";
var channel_lnk6 = "http://www.hkedcity.net/parent/index.phtml";
//var channel_lnk7 = "http://www.hkedcity.net/mediaed/";
//var channel_lnk8 = "http://www.hkedcity.net/culture/";
var channel_lnk9 = "http://www.hkedcity.net/library/";
var channel_lnk10 = "http://www.hkedcity.net/learning/";
var channel_lnk11 = "http://www.hkedcity.net/school/";
var channel_lnk12 = "http://www.hkedcity.net/specialed/";
var channel_lnk13 = "http://www.hkedcity.net/smallcampus/";
var channel_lnk14 = "http://www.hkedcity.net/english";
var channel_lnk15 = "http://www.saynotogambling.net/";
var channel_lnk16 = "http://www.hkreadingcity.net/";
var channel_lnk17 = "http://www.hkedcity.net/textonly/";
//var hyperLink = new Array(channel_lnk1, channel_lnk2, channel_lnk3, channel_lnk4, channel_lnk5, channel_lnk6, channel_lnk7, channel_lnk8, channel_lnk9, channel_lnk10, channel_lnk11, channel_lnk12, channel_lnk13, channel_lnk14, channel_lnk15, channel_lnk16, channel_lnk17);
var hyperLink = new Array(channel_lnk1, channel_lnk2, channel_lnk3, channel_lnk4, channel_lnk5, channel_lnk6, channel_lnk9, channel_lnk10, channel_lnk11, channel_lnk12, channel_lnk13, channel_lnk14, channel_lnk15, channel_lnk16, channel_lnk17);
// Define style for each channel
var channel_css1 = "main_build";
var channel_css2 = "icommerce";
var channel_css3 = "resources";
var channel_css4 = "student";
var channel_css5 = "teacher";
var channel_css6 = "parent";
//var channel_css7 = "mediaed";
//var channel_css8 = "museum";
var channel_css9 = "library";
var channel_css10 = "learning";
var channel_css11 = "school";
var channel_css12 = "specialed";
var channel_css13 = "smallcampus";
var channel_css14 = "english";
var channel_css15 = "nogamble";
var channel_css16 = "specialed";
var channel_css17 = "student";
//var channel_css = new Array(channel_css1, channel_css2, channel_css3, channel_css4, channel_css5, channel_css6, channel_css7, channel_css8, channel_css9, channel_css10, channel_css11, channel_css12, channel_css13, channel_css14, channel_css15, channel_css16, channel_css17);
var channel_css = new Array(channel_css1, channel_css2, channel_css3, channel_css4, channel_css5, channel_css6, channel_css9, channel_css10, channel_css11, channel_css12, channel_css13, channel_css14, channel_css15, channel_css16, channel_css17);
// Define chinese general footer
var zh_general1 = "\u79c1\u96b1\u653f\u7b56\u8072\u660e";
var zh_general2 = "\u7248\u6b0a\u53ca\u77e5\u8b58\u7522\u6b0a";
var zh_general3 = "\u514d\u8cac\u8072\u660e";
var zh_general4 = "\u4f7f\u7528\u689d\u6b3e\u53ca\u689d\u4ef6";
var zh_general5 = "\u806f\u7d61\u6211\u5011";
var zh_general6 = "\u5e38\u898b\u554f\u984c";
var zh_general_list = new Array(zh_general1, zh_general2, zh_general3, zh_general4, zh_general5, zh_general6);
// Definer chinese general footer link
var zh_general_lnk1 = "http://www.hkedcity.net/notices/tc_chinese.php#s1";
var zh_general_lnk2 = "http://www.hkedcity.net/notices/tc_chinese.php#s2";
var zh_general_lnk3 = "http://www.hkedcity.net/notices/tc_chinese.php#s3";
var zh_general_lnk4 = "http://www.hkedcity.net/notices/tc_chinese.php#s4";
var zh_general_lnk5 = "http://www.hkedcity.net/article/main_info/contactus/";
var zh_general_lnk6 = "http://www.hkedcity.net/article/main_info/faq/";
var zh_general_lnk_list = new Array(zh_general_lnk1, zh_general_lnk2, zh_general_lnk3, zh_general_lnk4, zh_general_lnk5, zh_general_lnk6);
// Define english general footer
var en_general1 = "Privacy Policy Statement";
var en_general2 = "Copyright and Intellectual Property Rights";
var en_general3 = "Disclaimer";
var en_general4 = "Terms and Conditions of Use";
var en_general5 = "Contact Us";
var en_general6 = "FAQs";
var en_general_list = new Array(en_general1, en_general2, en_general3, en_general4, en_general5, en_general6);
// Define english general footer link
var en_general_lnk1 = "http://www.hkedcity.net/notices/tc_english.php#s1";
var en_general_lnk2 = "http://www.hkedcity.net/notices/tc_english.php#s2";
var en_general_lnk3 = "http://www.hkedcity.net/notices/tc_english.php#s3";
var en_general_lnk4 = "http://www.hkedcity.net/notices/tc_english.php#s4";
var en_general_lnk5 = "http://www.hkedcity.net/article/main_info/contactus/";
var en_general_lnk6 = "http://www.hkedcity.net/article/main_info/faq/";
var en_general_lnk_list = new Array(en_general_lnk1, en_general_lnk2, en_general_lnk3, en_general_lnk4, en_general_lnk5, en_general_lnk6);
// Define simplified chinese footer
var zn_general1 = "\u79c1\u9690\u653f\u7b56\u58f0\u660e";
var zn_general2 = "\u7248\u6743\u53ca\u77e5\u8bc6\u4ea7\u6743";
var zn_general3 = "\u514d\u8d23\u58f0\u660e";
var zn_general4 = "\u4f7f\u7528\u6761\u6b3e\u53ca\u6761\u4ef6";
var zn_general5 = "\u8054\u7cfb\u6211\u4eec";
var zn_general6 = "\u5e38\u89c1\u95ee\u9898";
var zn_general_list = new Array(zn_general1, zn_general2, zn_general3, zn_general4, zn_general5, zn_general6);
// Define simplified general footer link
var zn_general_lnk1 = "http://www.hkedcity.net/notices/tc_chinese.php#s1";
var zn_general_lnk2 = "http://www.hkedcity.net/notices/tc_chinese.php#s2";
var zn_general_lnk3 = "http://www.hkedcity.net/notices/tc_chinese.php#s3";
var zn_general_lnk4 = "http://www.hkedcity.net/notices/tc_chinese.php#s4";
var zn_general_lnk5 = "http://www.hkedcity.net/article/main_info/contactus/";
var zn_general_lnk6 = "http://www.hkedcity.net/article/main_info/faq/";
var zn_general_lnk_list = new Array(zn_general_lnk1, zn_general_lnk2, zn_general_lnk3, zn_general_lnk4, zn_general_lnk5, zn_general_lnk6);
var zh_HK = "zh-HK";
var en_US = "en-US";
var zn_CN = "zn-CN";
var copyright_css = "copyright_text";
var RESOURCE_PATH = domain_path_resource + "/js/disclaimer";
function hkec_topbar_load_cssjs(urls, type) {
var i, resObj;
for (i = 0; i < urls.length; i++) {
switch (type) {
case "css":
resObj = document.createElement("link");
resObj.type = "text/css";
resObj.rel = "stylesheet";
resObj.href = urls[i];
document.getElementsByTagName("head")[0].appendChild(resObj);
break;
case "js":
resObj = document.createElement("script");
resObj.type = "text/javascript";
resObj.src = urls[i];
document.getElementsByTagName("head")[0].appendChild(resObj);
break;
}
}
return;
}
function generateFooter(lang, domain, app_css, table_width, disclaimer_space, show_channel){
//alert(lang);
var css_lang_prefix = setCssLangPrefix(lang);
// Define the css
defineCSS(app_css, css_lang_prefix);
// Draw the horizontal line if disclaimer_space is not null and greater than 0
if(disclaimer_space != null && disclaimer_space > 0){
document.write("");
}
createFooter(table_width, lang, domain, show_channel);
var footer_lang = 0;
if(lang=='en-US') footer_lang = 1;
if(typeof($)=='undefined') hkec_topbar_load_cssjs(['/hkecmodule/mbox/js/jquery-1.9.1.min.js'], 'js');
hkec_topbar_load_cssjs([
'/hkectopbar/topbar_footer.js.php?init=1&for_old=1&lang='+footer_lang+'&homeURL='+encodeURI(location.href)
], 'js');
}
// Apply application css to the caller page. The css file to be applied is based on the application id and lang
function defineCSS(app_css, lang){
if(app_css != null && app_css.length > 0){
document.write("");
document.write("");
}
else{
document.write("");
document.write("");
}
}
function setCssLangPrefix(lang){
if(lang == zh_HK){
footer_current_lang = "b5";
return zh_HK;
}
else{
if(lang == en_US){
footer_current_lang = "eng";
return en_US;
}
else{
if(lang == zn_CN){
footer_current_lang = "gb";
return zn_CN;
}
else{
footer_current_lang = "b5";
return zh_HK;
}
}
}
}
// Create Footer
function createFooter(table_width, lang, domain, show_channel){
// Use table to bound the footer or not
document.write("");
}
// Create channel list footer
function createChannelList(lang, domain){
if(lang == en_US){
// Create english channel list
for(var i = 0; i < channel_en.length; ++i){
// Create channel anchor
document.write(createChannelAnchor(channel_en[i].toString(), hyperLink[i], domain, channel_css[i], lang));
if(Math.ceil((channel_en.length / 2) - 1) == i){
document.write(" ");
}
else{
if(i < channel_en.length - 1){
document.write(" | ");
}
}
}
}
else if(lang == zn_CN){
// Create english channel list
for(var i = 0; i < channel_zn.length; ++i){
// Create channel anchor
document.write(createChannelAnchor(channel_zn[i].toString(), hyperLink[i], domain, channel_css[i], lang));
if(Math.ceil((channel_zn.length / 2) - 1) == i){
document.write(" ");
}
else{
if(i < channel_zn.length - 1){
document.write("|");
}
}
}
}
else{
// Create chinese channel list
for(var i = 0; i < channel_zh.length; ++i){
// Create channel anchor
document.write(createChannelAnchor(channel_zh[i].toString(), hyperLink[i], domain, channel_css[i], lang));
if(Math.ceil((channel_zh.length / 2) - 1) == i){
document.write(" ");
}
else{
if(i < channel_zh.length - 1){
document.write(" | ");
}
}
}
}
document.write("