Missing javascript files
26
phpgwapi/js/dJSWin/dJSWin.css
Normal file
@ -0,0 +1,26 @@
|
||||
.dJSWin_main
|
||||
{
|
||||
background-color: #e3e3e3;
|
||||
}
|
||||
|
||||
.dJSWin_title_text
|
||||
{
|
||||
background-color: #3978d6;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.dJSWin_title
|
||||
{
|
||||
background-color: #3978d6;
|
||||
}
|
||||
|
||||
.dJSWin_high
|
||||
{
|
||||
background-color: #e3e3e3;
|
||||
}
|
||||
|
||||
.dJSWin_low
|
||||
{
|
||||
background-color: #c9c9c9;
|
||||
}
|
321
phpgwapi/js/dJSWin/ie/dJSWin.js
Normal file
@ -0,0 +1,321 @@
|
||||
/****************************************************************************\
|
||||
* Dynamic JS Win - Javascript Object *
|
||||
* *
|
||||
* Written by: *
|
||||
* - Raphael Derosso Pereira <raphaelpereira@users.sourceforge.net> *
|
||||
* ------------------------------------------------------------------------ *
|
||||
* 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. *
|
||||
\****************************************************************************/
|
||||
|
||||
dJSWin.prototype.init = function(params)
|
||||
{
|
||||
if (!params || typeof(params) != 'object' || !params.id || !params.width || !params.height || !params.content_id)
|
||||
{
|
||||
throw("Can't create empty window or window without width, height or ID");
|
||||
}
|
||||
|
||||
/* Internal Variables */
|
||||
this.winContainer = document.createElement('iframe');
|
||||
this.clientArea = document.createElement('div');
|
||||
this.title = document.createElement('div');
|
||||
this.title_text = null; //document.createElement('');
|
||||
this.buttons = new Array();
|
||||
this.shadows = new Array();
|
||||
this.border = new Array();
|
||||
this.content_id = params.content_id;
|
||||
this.includedContents = params['include_contents'];
|
||||
var pixelTABLE, pixelTBODY, pixelTR, pixelTD;
|
||||
var _this = this;
|
||||
var style;
|
||||
|
||||
/* Create 1 pixel table to be able to create freely
|
||||
* sizeble DIVs on IE
|
||||
*/
|
||||
pixelTABLE = document.createElement('table');
|
||||
pixelTBODY = document.createElement('tbody');
|
||||
pixelTR = document.createElement('tR');
|
||||
pixelTD = document.createElement('td');
|
||||
|
||||
pixelTABLE.appendChild(pixelTBODY);
|
||||
pixelTBODY.appendChild(pixelTR);
|
||||
pixelTR.appendChild(pixelTD);
|
||||
|
||||
this.title_text_cont = pixelTABLE.cloneNode(true);
|
||||
this.title_text = this.title_text_cont.firstChild.firstChild.firstChild;
|
||||
|
||||
pixelTABLE.style.width = '1px';
|
||||
pixelTABLE.style.height = '1px';
|
||||
|
||||
pixelTD.style.width = '1px';
|
||||
pixelTD.style.height = '1px';
|
||||
|
||||
this.border['t'] = document.createElement('div');
|
||||
this.border['b'] = document.createElement('div');
|
||||
this.border['l'] = document.createElement('div');
|
||||
this.border['r'] = document.createElement('div');
|
||||
|
||||
this.shadows['r'] = document.createElement('div');
|
||||
this.shadows['b'] = document.createElement('div');
|
||||
|
||||
this.buttons['xDIV'] = document.createElement('div');
|
||||
|
||||
if (params['button_x_img'])
|
||||
{
|
||||
this.buttons['xIMG'] = document.createElement('IMG');
|
||||
this.buttons['xIMG'].src = params['button_x_img'];
|
||||
this.buttons['xIMG'].style.cursor = 'hand';
|
||||
this.buttons['xDIV'].appendChild(this.buttons['xIMG']);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.buttons.xDIV.innerHTML = 'X';
|
||||
}
|
||||
|
||||
/* Inicialization */
|
||||
this.title.id = params['id'];
|
||||
this.title.style.position = 'absolute';
|
||||
this.title.style.visibility = 'hidden';
|
||||
this.title.style.width = parseInt(params['width']) + 2 + 'px';
|
||||
this.title.style.height = params['title_height'] ? params['title_height'] : '18px';
|
||||
this.title.style.backgroundColor = '#3978d6';
|
||||
// this.title.className = 'dJSWin_title';
|
||||
this.title.style.top = '0px';
|
||||
this.title.style.left = '0px';
|
||||
this.title.style.zIndex = '1';
|
||||
|
||||
this.title_text_cont.id = params['id'] + '_text';
|
||||
this.title_text_cont.style.position = 'relative';
|
||||
// this.title_text_cont.border = '0';
|
||||
this.title_text_cont.style.width = '100%';
|
||||
this.title_text_cont.style.height = '100%';
|
||||
this.title_text.style.cursor = 'move';
|
||||
this.title_text_cont.className = 'dJSWin_title_text';
|
||||
this.title_text.className = 'dJSWin_title_text';
|
||||
// this.title_text.style.cursor = 'move';
|
||||
this.title_text.innerHTML = params['title'];
|
||||
this.title_text_cont.style.zIndex = '1';
|
||||
|
||||
this.winContainer.id = params['id']+'_winContainer';
|
||||
this.winContainer.style.position = 'absolute';
|
||||
this.winContainer.style.visibility = 'hidden';
|
||||
this.winContainer.style.width = params['width'];
|
||||
this.winContainer.style.height = parseInt(params['height']) + parseInt(this.title.style.height) + 'px';
|
||||
// this.winContainer.style.top = '0px';
|
||||
this.winContainer.style.top = '0px'; //this.title.style.height;
|
||||
this.winContainer.style.left = '0px';
|
||||
this.winContainer.style.zIndex = '-1';
|
||||
// this.winContainer.style.backgroundColor = params['bg_color'];
|
||||
// this.winContainer.className = params['win_class'];
|
||||
this.winContainer.src = '';
|
||||
|
||||
this.clientArea.id = params['id']+'_clientArea';
|
||||
this.clientArea.style.position = 'absolute';
|
||||
this.clientArea.style.visibility = 'hidden';
|
||||
this.clientArea.style.width = parseInt(params['width']) + 2 + 'px';
|
||||
this.clientArea.style.height = params['height'];
|
||||
this.clientArea.style.top = parseInt(this.title.style.height) + 'px';
|
||||
this.clientArea.style.left = '0px';
|
||||
// this.clientArea.style.backgroundColor = params['bg_color'];
|
||||
// this.clientArea.style.overflow = 'auto';
|
||||
this.clientArea.className = 'dJSWin_main';
|
||||
|
||||
this.buttons.xDIV.id = params['id']+'_button';
|
||||
this.buttons.xDIV.style.position = 'absolute';
|
||||
this.buttons.xDIV.style.visibility = 'hidden';
|
||||
this.buttons.xDIV.style.cursor = 'hand';
|
||||
this.buttons.xDIV.style.top = '1px';
|
||||
this.buttons.xDIV.style.left = parseInt(params['width']) - 13 + 'px';
|
||||
this.buttons.xDIV.style.zIndex = '1';
|
||||
this.buttons.xDIV.onclick = function() {_this.close();};
|
||||
|
||||
this.shadows.b.id = params['id']+'_shadowb';
|
||||
this.shadows.b.style.position = 'absolute';
|
||||
this.shadows.b.style.visibility = 'hidden';
|
||||
this.shadows.b.style.backgroundColor = '#666';
|
||||
this.shadows.b.style.width = params['width'];
|
||||
this.shadows.b.style.height = '4px';
|
||||
this.shadows.b.style.top = parseInt(this.title.style.height) + parseInt(params['height']) + 2 + 'px';
|
||||
this.shadows.b.style.left = '4px';
|
||||
this.shadows.b.appendChild(pixelTABLE.cloneNode(true));
|
||||
|
||||
this.shadows.r.id = params['id']+'_shadowr';
|
||||
this.shadows.r.style.position = 'absolute';
|
||||
this.shadows.r.style.visibility = 'hidden';
|
||||
this.shadows.r.style.backgroundColor = '#666';
|
||||
this.shadows.r.style.width = '4px';
|
||||
this.shadows.r.style.height = parseInt(params['height']) + parseInt(this.title.style.height) + 'px';
|
||||
this.shadows.r.style.top = '4px';
|
||||
this.shadows.r.style.left = params['width'];
|
||||
|
||||
this.border.t.id = params['id']+'_border_t';
|
||||
this.border.b.id = params['id']+'_border_b';
|
||||
this.border.l.id = params['id']+'_border_l';
|
||||
this.border.r.id = params['id']+'_border_r';
|
||||
|
||||
this.border.t.style.position = 'absolute';
|
||||
this.border.b.style.position = 'absolute';
|
||||
this.border.l.style.position = 'absolute';
|
||||
this.border.r.style.position = 'absolute';
|
||||
|
||||
this.border.t.style.visibility = 'hidden';
|
||||
this.border.b.style.visibility = 'hidden';
|
||||
this.border.l.style.visibility = 'hidden';
|
||||
this.border.r.style.visibility = 'hidden';
|
||||
|
||||
this.border.t.className = 'dJSWin_title';
|
||||
this.border.b.className = 'dJSWin_title';
|
||||
this.border.l.className = 'dJSWin_title';
|
||||
this.border.r.className = 'dJSWin_title';
|
||||
|
||||
this.border.t.style.border = '0px';
|
||||
this.border.b.style.border = '0px';
|
||||
this.border.l.style.border = '0px';
|
||||
this.border.r.style.border = '0px';
|
||||
|
||||
this.border.t.appendChild(pixelTABLE.cloneNode(true));
|
||||
this.border.b.appendChild(pixelTABLE.cloneNode(true));
|
||||
|
||||
if (params['border'])
|
||||
{
|
||||
this.border.t.style.width = parseInt(params['width']) + 2 + 'px';
|
||||
this.border.b.style.width = parseInt(params['width']) + 4 + 'px';
|
||||
this.border.l.style.width = '2px';
|
||||
this.border.r.style.width = '2px';
|
||||
|
||||
this.border.t.style.height = '2px';
|
||||
this.border.b.style.height = '2px';
|
||||
this.border.l.style.height = parseInt(params['height']) + parseInt(this.title.style.height) + 4 + 'px';
|
||||
this.border.r.style.height = parseInt(params['height']) + parseInt(this.title.style.height) + 4 + 'px';
|
||||
|
||||
this.border.t.style.top = '-2px';
|
||||
this.border.b.style.top = parseInt(params['height']) + parseInt(this.title.style.height) + 'px';
|
||||
this.border.l.style.top = '-2px';
|
||||
this.border.r.style.top = '-2px';
|
||||
|
||||
this.border.t.style.left = '-2px';
|
||||
this.border.b.style.left = '-2px';
|
||||
this.border.l.style.left = '-2px';
|
||||
this.border.r.style.left = params['width'];
|
||||
|
||||
this.shadows.b.style.top = parseInt(this.shadows.b.style.top) + 2 + 'px';
|
||||
this.shadows.r.style.top = parseInt(this.shadows.r.style.top) + 2 + 'px';
|
||||
this.shadows.b.style.left = parseInt(this.shadows.b.style.left) + 2 + 'px';
|
||||
this.shadows.r.style.left = parseInt(this.shadows.r.style.left) + 2 + 'px';
|
||||
|
||||
this.winContainer.style.top = '-3px';
|
||||
this.winContainer.style.left = '-2px';
|
||||
this.winContainer.style.width = parseInt(this.winContainer.style.width) + 8 + 'px';
|
||||
this.winContainer.style.height = parseInt(this.winContainer.style.height) + 10 + 'px';
|
||||
}
|
||||
else
|
||||
{
|
||||
this.border.t.style.width = '0px';
|
||||
this.border.b.style.width = '0px';
|
||||
this.border.l.style.width = '0px';
|
||||
this.border.r.style.width = '0px';
|
||||
}
|
||||
|
||||
//JsLib.postponeFunction(function(){_this._createWin();});
|
||||
this._createWin();
|
||||
}
|
||||
|
||||
dJSWin.prototype.open = function()
|
||||
{
|
||||
this.moveTo(document.body.offsetWidth/2 + document.body.scrollLeft - dd.elements[this.title.id].w/2,
|
||||
document.body.offsetHeight/2 + document.body.scrollTop - dd.elements[this.winContainer.id].h/2);
|
||||
|
||||
dd.elements[this.title.id].maximizeZ();
|
||||
dd.elements[this.title.id].show();
|
||||
}
|
||||
|
||||
dJSWin.prototype.draw = function()
|
||||
{
|
||||
if (this.drawn)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.drawn = true;
|
||||
|
||||
if (dd.elements && dd.elements[this.title.id])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ADD_DHTML(this.title.id+CURSOR_MOVE);
|
||||
ADD_DHTML(this.title_text_cont.id+NO_DRAG);
|
||||
ADD_DHTML(this.winContainer.id+NO_DRAG);
|
||||
ADD_DHTML(this.clientArea.id+NO_DRAG);
|
||||
ADD_DHTML(this.buttons.xDIV.id+NO_DRAG);
|
||||
ADD_DHTML(this.content.id+NO_DRAG);
|
||||
ADD_DHTML(this.shadows.r.id+NO_DRAG);
|
||||
ADD_DHTML(this.shadows.b.id+NO_DRAG);
|
||||
ADD_DHTML(this.border.t.id+NO_DRAG);
|
||||
ADD_DHTML(this.border.b.id+NO_DRAG);
|
||||
ADD_DHTML(this.border.l.id+NO_DRAG);
|
||||
ADD_DHTML(this.border.r.id+NO_DRAG);
|
||||
|
||||
|
||||
dd.elements[this.winContainer.id].setZ(-1);
|
||||
dd.elements[this.title.id].setZ(0);
|
||||
dd.elements[this.title.id].addChild(dd.elements[this.title_text_cont.id]);
|
||||
dd.elements[this.title.id].addChild(dd.elements[this.winContainer.id]);
|
||||
dd.elements[this.title.id].addChild(dd.elements[this.clientArea.id]);
|
||||
dd.elements[this.title.id].addChild(dd.elements[this.buttons.xDIV.id]);
|
||||
dd.elements[this.title.id].addChild(dd.elements[this.content.id]);
|
||||
dd.elements[this.title.id].addChild(dd.elements[this.shadows.r.id]);
|
||||
dd.elements[this.title.id].addChild(dd.elements[this.shadows.b.id]);
|
||||
dd.elements[this.title.id].addChild(dd.elements[this.border.t.id]);
|
||||
dd.elements[this.title.id].addChild(dd.elements[this.border.b.id]);
|
||||
dd.elements[this.title.id].addChild(dd.elements[this.border.l.id]);
|
||||
dd.elements[this.title.id].addChild(dd.elements[this.border.r.id]);
|
||||
|
||||
|
||||
if (typeof(this.includedContents) == 'object')
|
||||
{
|
||||
for (var i in this.includedContents)
|
||||
{
|
||||
ADD_DHTML(this.includedContents[i]+NO_DRAG);
|
||||
dd.elements[this.title.id].addChild(dd.elements[this.includedContents[i]]);
|
||||
}
|
||||
}
|
||||
|
||||
dd.elements[this.title.id].moveTo(document.body.offsetWidth/2 - dd.elements[this.winContainer.id].w/2,
|
||||
document.body.offsetHeight/2 - dd.elements[this.winContainer.id].h/2)
|
||||
|
||||
dd.elements[this.title.id].hide();
|
||||
}
|
||||
|
||||
dJSWin.prototype._createWin = function()
|
||||
{
|
||||
style = document.createElement('link');
|
||||
style.href = GLOBALS['serverRoot'] + "phpgwapi/js/dJSWin/dJSWin.css";
|
||||
style.rel = "stylesheet";
|
||||
style.type = "text/css";
|
||||
document.body.appendChild(style);
|
||||
|
||||
this.content = Element(this.content_id);
|
||||
this.content.style.visibility = 'hidden';
|
||||
//this.content.style.top = parseInt(this.title.style.height) + 'px';
|
||||
this.content.style.top = '0px';
|
||||
this.content.style.left = '0px';
|
||||
|
||||
this.title.appendChild(this.title_text_cont);
|
||||
this.title.appendChild(this.winContainer);
|
||||
this.title.appendChild(this.clientArea);
|
||||
this.title.appendChild(this.buttons.xDIV);
|
||||
this.title.appendChild(this.border.t);
|
||||
this.title.appendChild(this.border.b);
|
||||
this.title.appendChild(this.border.l);
|
||||
this.title.appendChild(this.border.r);
|
||||
this.title.appendChild(this.shadows.r);
|
||||
this.title.appendChild(this.shadows.b);
|
||||
this.clientArea.appendChild(this.content);
|
||||
|
||||
document.body.appendChild(this.title);
|
||||
|
||||
this.draw();
|
||||
}
|
54
phpgwapi/js/dTabs/dTabs.css
Normal file
@ -0,0 +1,54 @@
|
||||
.dTabs_noTabs
|
||||
{
|
||||
background-color: #a3a3a3;
|
||||
width: '100%';
|
||||
}
|
||||
|
||||
.dTabs_selected
|
||||
{
|
||||
background-color: #e3e3e3;
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
width: 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dTabs_unselected
|
||||
{
|
||||
background-color: #c9c9c9;
|
||||
color: black;
|
||||
font-weight: 0;
|
||||
text-align: center;
|
||||
width: 2px;
|
||||
cursor: pointer;
|
||||
cursor: hand;
|
||||
}
|
||||
|
||||
.dTabs_unselected:hover
|
||||
{
|
||||
background-color: #c9c9c9;
|
||||
color: red;
|
||||
font-weight: 0;
|
||||
text-align: center;
|
||||
width: 2px;
|
||||
cursor: pointer;
|
||||
cursor: hand;
|
||||
}
|
||||
|
||||
.dTabs_disabled
|
||||
{
|
||||
background-color: #c9c9c9;
|
||||
color: #a3a3a3;
|
||||
font-weight: 0;
|
||||
text-align: center;
|
||||
width: 2px;
|
||||
cursor: hand;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dTabs_tr_index
|
||||
{
|
||||
border-spacing: 0px;
|
||||
padding: 5px;
|
||||
}
|
234
phpgwapi/js/dTabs/ie/dTabs.js
Normal file
@ -0,0 +1,234 @@
|
||||
/****************************************************************************\
|
||||
* Dynamic Tabs - Javascript Object *
|
||||
* *
|
||||
* Written by: *
|
||||
* - Raphael Derosso Pereira <raphaelpereira@users.sourceforge.net> *
|
||||
* ------------------------------------------------------------------------ *
|
||||
* 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. *
|
||||
\****************************************************************************/
|
||||
|
||||
/*
|
||||
* Dynamic Tabs - On-The-Fly Tabs in Javascript
|
||||
*
|
||||
* Usage:
|
||||
* var tabs = new dTabsManager({'id': <DIV id to be used>, 'width': '498px'});
|
||||
*
|
||||
* tabs.addTab({'id': <ID of the Contents DIV (must be absolute)>,
|
||||
* 'name': <text to be shown on tab selector>,
|
||||
* 'selectedClass': <name of the class to be used when Tab is selected>,
|
||||
* 'unselectedClass': <name of the class to be used when Tab is not selected>});
|
||||
*/
|
||||
|
||||
dTabsManager.prototype.init = function(params)
|
||||
{
|
||||
/* Attributes definition */
|
||||
this._Tabs = new Array();
|
||||
this._Tabs['root'] = null;
|
||||
this._Tabs['tabIndexTR'] = null;
|
||||
this._Tabs['tabIndexTDs'] = new Array();
|
||||
this._Tabs['contents'] = null;
|
||||
this._Tabs['contentsDIV'] = null;
|
||||
this._selectedIndex = null;
|
||||
|
||||
this._nTabs = params['nTabs'] ? params['nTabs'] : 0;
|
||||
this._maxTabs = params['maxTabs'] ? params['maxTabs'] : 0;
|
||||
|
||||
|
||||
/* Create and insert the container */
|
||||
var table, tbody, tr, td, style;
|
||||
var _this = this;
|
||||
|
||||
style = document.createElement('link');
|
||||
style.href = GLOBALS['serverRoot'] + "phpgwapi/js/dTabs/dTabs.css";
|
||||
style.rel = "stylesheet";
|
||||
style.type = "text/css";
|
||||
|
||||
this._Tabs['root'] = document.createElement('div');
|
||||
this._Tabs['root'].id = params['id'];
|
||||
this._Tabs['root'].style.position = 'absolute';
|
||||
//this._Tabs['root'].style.visibility = 'hidden';
|
||||
this._Tabs['root'].style.top = '150px';
|
||||
this._Tabs['root'].style.left = '0px';
|
||||
this._Tabs['root'].style.width = params['width'] ? params['width'] : 0;
|
||||
|
||||
table = document.createElement('table');
|
||||
tbody = document.createElement('tbody');
|
||||
table.style.border = '0px solid black';
|
||||
table.style.width = '100%';
|
||||
table.style.height = '100%';
|
||||
table.cellpadding = '10px';
|
||||
|
||||
this._Tabs['tabIndexTR'] = document.createElement('tr');
|
||||
this._Tabs['tabIndexTR'].style.height = '30px';
|
||||
this._Tabs['tabIndexTR'].className = 'dTabs_tr_index';
|
||||
//this._Tabs['tabIndexTR'].style.width = '100%';
|
||||
|
||||
this._Tabs['emptyTab'] = document.createElement('td');
|
||||
this._Tabs['emptyTab'].className = 'dTabs_noTabs';
|
||||
this._Tabs['emptyTab'].innerHTML = ' ';
|
||||
this._Tabs['tabIndexTR'].appendChild(this._Tabs['emptyTab']);
|
||||
|
||||
tr = document.createElement('tr');
|
||||
td = document.createElement('td');
|
||||
|
||||
tr.style.width = '100%';
|
||||
tr.style.height = '100%';
|
||||
|
||||
//this._Tabs['contentsDIV'] = document.createElement('div');
|
||||
//this._Tabs['contentsDIV'].style.position = 'relative';
|
||||
this._Tabs['contentsDIV'] = td;
|
||||
|
||||
this._Tabs['root'].appendChild(table);
|
||||
table.appendChild(tbody);
|
||||
tbody.appendChild(this._Tabs['tabIndexTR']);
|
||||
tbody.appendChild(tr);
|
||||
tr.appendChild(td);
|
||||
//td.appendChild(this._Tabs['contentsDIV']);
|
||||
tr.appendChild(this._Tabs['contentsDIV']);
|
||||
|
||||
this._Tabs['contents'] = new Array();
|
||||
|
||||
var create = function ()
|
||||
{
|
||||
document.body.appendChild(style);
|
||||
document.body.appendChild(_this._Tabs['root']);
|
||||
_this.created = true;
|
||||
}
|
||||
|
||||
this.created = false;
|
||||
//JsLib.postponeFunction(create);
|
||||
create();
|
||||
}
|
||||
|
||||
/*
|
||||
@method addTab
|
||||
@abstract Inserts a tab
|
||||
*/
|
||||
dTabsManager.prototype.addTab = function (params)
|
||||
{
|
||||
var _this = this;
|
||||
|
||||
if (this.created)
|
||||
{
|
||||
return this.addTabIE(params);
|
||||
}
|
||||
|
||||
//JsLib.postponeFunction(function(){ _this.addTabIE(params);});
|
||||
}
|
||||
|
||||
dTabsManager.prototype.addTabIE = function (params)
|
||||
{
|
||||
if (typeof(params) != 'object')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!params['id'] || !Element(params['id']) ||
|
||||
Element(params['id']).tagName.toLowerCase() != 'div' ||
|
||||
Element(params['id']).style.position.toLowerCase() != 'absolute')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this._Tabs['contents'][params['id']])
|
||||
{
|
||||
this.replaceTab(params);
|
||||
return;
|
||||
}
|
||||
|
||||
//var contents, tdIndex;
|
||||
var element = Element(params['id']);
|
||||
|
||||
// element.parentNode.removeChild(element);
|
||||
element.style.top = parseInt(this._Tabs['tabIndexTR'].style.height) + 5 + 'px';
|
||||
element.style.left = this._Tabs['root'].style.left;
|
||||
element.style.zIndex = '-1';
|
||||
|
||||
this._Tabs['contents'][params['id']] = element;
|
||||
|
||||
this._Tabs.tabIndexTDs[params['id']] = document.createElement('td');
|
||||
|
||||
var _this = this;
|
||||
this._Tabs.tabIndexTDs[params['id']].innerHTML = ' '+(params['name'] ? params['name'] : 'undefined')+' ';
|
||||
this._Tabs.tabIndexTDs[params['id']].selectedClassName = 'dTabs_selected';
|
||||
this._Tabs.tabIndexTDs[params['id']].unselectedClassName = 'dTabs_unselected';
|
||||
this._Tabs.tabIndexTDs[params['id']].className = 'dTabs_unselected';
|
||||
this._Tabs.tabIndexTDs[params['id']].onclick = function() {_this._showTab(params['id']);};
|
||||
|
||||
/* Old Version
|
||||
this._Tabs.tabIndexTDs[params['id']].innerHTML = params['name'] ? params['name'] : 'undefined';
|
||||
this._Tabs.tabIndexTDs[params['id']].selectedClassName = params['selectedClass'];
|
||||
this._Tabs.tabIndexTDs[params['id']].unselectedClassName = params['unselectedClass'];
|
||||
this._Tabs.tabIndexTDs[params['id']].className = params['unselectedClass'];
|
||||
this._Tabs.tabIndexTDs[params['id']].onclick = function() {_this._showTab(params['id']);};
|
||||
*/
|
||||
|
||||
this._Tabs.tabIndexTR.removeChild(this._Tabs['emptyTab']);
|
||||
this._Tabs.tabIndexTR.appendChild(this._Tabs.tabIndexTDs[params['id']]);
|
||||
this._Tabs.tabIndexTR.appendChild(this._Tabs['emptyTab']);
|
||||
|
||||
this._Tabs.contentsDIV.appendChild(this._Tabs['contents'][params['id']]);
|
||||
|
||||
this._nTabs++;
|
||||
|
||||
if (this._nTabs == 1)
|
||||
{
|
||||
this._showTab(params['id']);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
dTabsManager.prototype.enableTab = function(id)
|
||||
{
|
||||
var _this = this;
|
||||
|
||||
var enable = function()
|
||||
{
|
||||
if (_this._Tabs.contents[id])
|
||||
{
|
||||
_this._Tabs.tabIndexTDs[id].className = 'dTabs_unselected';
|
||||
_this._Tabs.tabIndexTDs[id].onclick = function() {_this._showTab(id);};
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.created)
|
||||
{
|
||||
JsLib.postponeFunction(enable);
|
||||
}
|
||||
else
|
||||
{
|
||||
enable();
|
||||
}
|
||||
}
|
||||
|
||||
dTabsManager.prototype.disableTab = function(id)
|
||||
{
|
||||
var _this = this;
|
||||
|
||||
var disable = function ()
|
||||
{
|
||||
if (_this._Tabs.contents[id])
|
||||
{
|
||||
_this._Tabs.tabIndexTDs[id].className = 'dTabs_disabled';
|
||||
_this._Tabs.tabIndexTDs[id].onclick = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.created)
|
||||
{
|
||||
JsLib.postponeFunction(disable);
|
||||
}
|
||||
else
|
||||
{
|
||||
disable();
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************\
|
||||
* Private Methods *
|
||||
\****************************************************************************/
|
||||
|
306
phpgwapi/js/dynapi/api/ext/dragevent.js
Normal file
@ -0,0 +1,306 @@
|
||||
/*
|
||||
DynAPI Distribution
|
||||
DragEvent Class
|
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
|
||||
*/
|
||||
|
||||
// DragEvent object
|
||||
function DragEvent(type,src) {
|
||||
this.MouseEvent = MouseEvent;
|
||||
this.MouseEvent();
|
||||
this.DynEvent();
|
||||
this.isDragging = false;
|
||||
};
|
||||
var p = dynapi.setPrototype('DragEvent','MouseEvent');
|
||||
p.getX=function() {return this.x};
|
||||
p.getY=function() {return this.y};
|
||||
p.getPageX=function() {return this.pageX};
|
||||
p.getPageY=function() {return this.pageY};
|
||||
p.cancelDrag=function() {this.isDragging=false};
|
||||
|
||||
//DragEvent.dragPlay=0;
|
||||
|
||||
DragEvent.dragevent = new DragEvent();
|
||||
|
||||
DragEvent.lyrListener = {
|
||||
onmousedown : function(e) {
|
||||
var ic,o = e.getSource();
|
||||
//setup drag icon
|
||||
if(o._useDragIcon && o._dragIcon) {
|
||||
ic=o._dragIcon;
|
||||
ic._dragOrg = o;
|
||||
ic.setLocation(o.getPageX(),o.getPageY());
|
||||
ic.setSize(o.w,o.h);
|
||||
// if icon is fixed width then center at pointer
|
||||
if(ic.w!=o.w||ic.h!=o.h) ic.setLocation(e.getPageX()-(ic.w/2),e.getPageY()-(ic.h/2));
|
||||
}
|
||||
DragEvent.startDrag(e,ic);
|
||||
//e.preventDefault();
|
||||
}
|
||||
};
|
||||
|
||||
DragEvent.startDrag = function(e,dlyr) {
|
||||
var origdlyr = dlyr;
|
||||
if (!dlyr) dlyr = e.getSource();
|
||||
|
||||
if (dynapi.ua.dom) {
|
||||
dlyr.elm.ondragstart = function() { return false; };
|
||||
dlyr.elm.onselectstart = function() { return false; };
|
||||
}
|
||||
|
||||
// Initialize dragEvent object
|
||||
var de=DragEvent.dragevent;
|
||||
//de.bubble = true;
|
||||
de.src = dlyr;
|
||||
de.origin = (origdlyr)? e.origin : dlyr;
|
||||
de.x = e.getPageX()-dlyr.getPageX();
|
||||
de.y = e.getPageY()-dlyr.getPageY();
|
||||
de.pageX = e.getPageX();
|
||||
de.pageY = e.getPageY();
|
||||
de.parentPageX = dlyr.parent.getPageX();
|
||||
de.parentPageY = dlyr.parent.getPageY();
|
||||
de._mouseEvent = e._mouseEvent;
|
||||
de._browserEvent = e._browserEvent; // ns4 only
|
||||
|
||||
de.isDragging = true;
|
||||
|
||||
e.preventDefault();
|
||||
e.preventBubble();
|
||||
|
||||
//dlyr._dyndoc.addEventListener(DragEvent.docListener);
|
||||
|
||||
dlyr.invokeEvent("dragstart",de);
|
||||
if(dlyr._dragOrg) {
|
||||
dlyr.setVisible(true);
|
||||
dlyr._dragOrg.invokeEvent("dragstart",e);
|
||||
}
|
||||
};
|
||||
|
||||
DragEvent.docListener = {
|
||||
onmousemove : function(e) {
|
||||
//var x = e.getPageX();
|
||||
//var y = e.getPageY();
|
||||
//dynapi.debug.status('drag move '+e.x+' '+e.y);
|
||||
|
||||
var de = DragEvent.dragevent;
|
||||
if (de && de.isDragging) {
|
||||
|
||||
|
||||
var lyr = de.src;
|
||||
if (!lyr) return;
|
||||
|
||||
// DS: what is this?
|
||||
// Detect if we should start the drag
|
||||
/*if(DragEvent.dragPlay==0 || (Math.abs(de.pageX-e.getPageX())-DragEvent.dragPlay>0) || (Math.abs(de.pageY-e.getPageY())-DragEvent.dragPlay>0)) {
|
||||
de.isDragging=true;
|
||||
de.src.invokeEvent("dragstart",de);
|
||||
e.setBubble(de.bubble);
|
||||
}
|
||||
*/
|
||||
/*else if (!de.dragEnabled) {
|
||||
// This allows 'cancelDrag' method to fire the mouseUp as if had been released by the user
|
||||
lyr.invokeEvent("mouseup");
|
||||
return;
|
||||
}*/
|
||||
|
||||
// Properties
|
||||
de.type="dragmove";
|
||||
de.pageX=e.getPageX();
|
||||
de.pageY=e.getPageY();
|
||||
de._mouseEvent = e._mouseEvent;
|
||||
de._browserEvent = e._browserEvent; // ns4 only
|
||||
|
||||
/*if (DragEvent.stopAtDocumentEdge) {
|
||||
if (de.pageX<0) de.pageX = 0;
|
||||
if (de.pageY<0) de.pageY = 0;
|
||||
if (de.pageX>DynAPI.document.w) de.pageX = DynAPI.document.w;
|
||||
if (de.pageY>DynAPI.document.h) de.pageY = DynAPI.document.h;
|
||||
}*/
|
||||
|
||||
var x=de.pageX-de.parentPageX-de.x;
|
||||
var y=de.pageY-de.parentPageY-de.y;
|
||||
|
||||
// Respect boundary, if any
|
||||
if (lyr._dragBoundary) {
|
||||
var dB = lyr._dragBoundary;
|
||||
var t = dB.top;
|
||||
var r = dB.right;
|
||||
var b = dB.bottom;
|
||||
var l = dB.left;
|
||||
// prevent choppy dragging if child is greater than parent
|
||||
var pw = (lyr.parent.w>lyr.w)? lyr.parent.w-lyr.w:lyr.x;
|
||||
var ph = (lyr.parent.h>lyr.h)? lyr.parent.h-lyr.h:lyr.y;
|
||||
if (x<l) x = l;
|
||||
else if (x>pw-r) x = pw-r;
|
||||
if (y<t) y = t;
|
||||
else if (y>ph-b) y = ph-b;
|
||||
}
|
||||
else if (lyr._dragBoundaryA) {
|
||||
var dB = lyr._dragBoundaryA;
|
||||
var b=dB[2];
|
||||
var r=dB[1];
|
||||
var l=dB[3];
|
||||
var t=dB[0];
|
||||
var w=lyr.w;
|
||||
var h=lyr.h;
|
||||
if (x<l) x=l;
|
||||
else if (x+w>r) x=r-w;
|
||||
if (y<t) y=t;
|
||||
else if (y+h>b) y=b-h;
|
||||
}
|
||||
// Move dragged layer
|
||||
lyr.setLocation(x,y);
|
||||
lyr.invokeEvent("dragmove",de);
|
||||
// drag icon
|
||||
if(lyr._dragOrg) {
|
||||
lyr._dragOrg.invokeEvent("dragmove",e);
|
||||
}
|
||||
|
||||
|
||||
if (lyr._dragStealth==false && lyr.parent.DragOver) {
|
||||
lyr.parent.DragOver(lyr,e.getPageX(),e.getPageY());
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
e.preventBubble();
|
||||
}
|
||||
},
|
||||
onmouseup : function(e) {
|
||||
// Get, if any, the currently drag in process and the layer. If none, return
|
||||
var de=DragEvent.dragevent;
|
||||
//de.bubble = true;
|
||||
if (!de) return;
|
||||
var lyr=de.src;
|
||||
if (!lyr) return;
|
||||
|
||||
if (!de.isDragging) {
|
||||
de.type="dragend";
|
||||
de.src=null;
|
||||
//e.setBubble(true);
|
||||
return;
|
||||
}
|
||||
if (dynapi.ua.ie) lyr.doc.body.onselectstart = null;
|
||||
|
||||
// Avoid click for the dragged layer ( with MouseEvent addition )
|
||||
if (dynapi.ua.def) dynapi.wasDragging=true;
|
||||
if (lyr.parent.DragDrop) lyr.parent.DragDrop(lyr,e.getPageX(),e.getPageY());
|
||||
|
||||
// Properties for the event
|
||||
de.type="dragend";
|
||||
de.isDragging=false;
|
||||
lyr.invokeEvent("dragend",de);
|
||||
// drag icon
|
||||
if(lyr._dragOrg) {
|
||||
lyr.setVisible(false);
|
||||
lyr._dragOrg.invokeEvent("dragend",de);
|
||||
}
|
||||
|
||||
|
||||
// Clean drag stuff
|
||||
de.src=null;
|
||||
//e.preventDefault();
|
||||
e.preventBubble();
|
||||
|
||||
//lyr._dyndoc.removeEventListener(DragEvent.docListener);
|
||||
}
|
||||
};
|
||||
DragEvent.stopAtDocumentEdge = true;
|
||||
DragEvent.setDragBoundary=function(lyr,t,r,b,l) {
|
||||
if (!lyr) {dynapi.debug.print("Error: no object passed to DragEvent.setDragBoundary()"); return;}
|
||||
var a=arguments;
|
||||
if (a.length==0) return;
|
||||
if (a.length==1) {
|
||||
lyr._dragBoundary = {left:0,right:0,top:0,bottom:0};
|
||||
}
|
||||
if (a.length==2) {
|
||||
lyr._dragBoundary = arguments[1];
|
||||
}
|
||||
else if (a.length==5) lyr._dragBoundaryA = [t,r,b,l];
|
||||
};
|
||||
DragEvent.enableDragEvents=function() {
|
||||
for (var i=0;i<arguments.length;i++) {
|
||||
var lyr=arguments[i];
|
||||
if (!lyr) {dynapi.debug.print("Error: no object passed to DragEvent.enableDragEvents()"); return;}
|
||||
if (lyr.isClass('DynLayer')) lyr.addEventListener(DragEvent.lyrListener);
|
||||
}
|
||||
dynapi.document.addEventListener(DragEvent.docListener);
|
||||
dynapi.document.captureMouseEvents();
|
||||
};
|
||||
DragEvent.disableDragEvents=function() {
|
||||
for (var i=0;i<arguments.length;i++) {
|
||||
var lyr=arguments[i];
|
||||
lyr.removeEventListener(DragEvent.lyrListener);
|
||||
}
|
||||
};
|
||||
|
||||
// used mainly inside ondrop and ondragover
|
||||
DynLayer.prototype.getDragSource = function(){
|
||||
return this._dragOrg||this;
|
||||
};
|
||||
DynLayer.prototype.setDragEnabled = function(b,boundry,useIcon){
|
||||
if(!self.DragEvent) return false;
|
||||
if(boundry)DragEvent.setDragBoundary(this,boundry);
|
||||
if (b) DragEvent.enableDragEvents(this);
|
||||
else DragEvent.disableDragEvents(this);
|
||||
this._useDragIcon = useIcon;
|
||||
return true;
|
||||
};
|
||||
DynLayer.prototype.setDragIcon = function(icon){
|
||||
if(!icon) return;
|
||||
this._dragIcon = icon;
|
||||
icon.setZIndex({topmost:true});
|
||||
icon.setVisible(false);
|
||||
dynapi.document.addChild(icon);
|
||||
};
|
||||
DynLayer.prototype.setDragOverStealthMode = function(b){
|
||||
this._dragStealth=(b)? true:false;
|
||||
};
|
||||
|
||||
// Enable ondrop event
|
||||
DynElement.prototype.DragDrop=function(s,mX,mY){
|
||||
if (!this.children.length) return false;
|
||||
var ch,chX,sX,sY;
|
||||
for (var i in this.children) {
|
||||
ch=this.children[i];
|
||||
if(!ch._hasDragEvents) ch.DragDrop(s,mX,mY);
|
||||
else {
|
||||
chX=ch.getPageX();
|
||||
chY=ch.getPageY();
|
||||
//sX=s.getPageX();
|
||||
//sY=s.getPageY();
|
||||
//if (chX<sX && chX+ch.w>sX+s.w && chY<sY && chY+ch.h>sY+s.h) {
|
||||
if ((mX>=chX && mX<=chX+ch.w) && (mY>=chY && mY<=chY+ch.h)) {
|
||||
if (ch.DragDrop(s,mX,mY)) return true;
|
||||
ch.invokeEvent("drop",null,s);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// Enable ondragover event
|
||||
DynElement.prototype.DragOver=function(s,mX,mY){
|
||||
if (!this.children.length) return false;
|
||||
var ch,chX,sX,sY;
|
||||
for (var i in this.children) {
|
||||
ch=this.children[i];
|
||||
if (!ch._hasDragEvents) ch.DragOver(s,mX,mY);
|
||||
else {
|
||||
chX=ch.getPageX();
|
||||
chY=ch.getPageY();
|
||||
if ((mX>=chX && mX<=chX+ch.w) && (mY>=chY && mY<=chY+ch.h)) {
|
||||
if (ch.DragOver(s,mX,mY)) return true;
|
||||
ch._isDragOver=true;
|
||||
ch.invokeEvent("dragover",null,s);
|
||||
return true;
|
||||
}else if (ch._isDragOver) {
|
||||
ch._isDragOver=false;
|
||||
ch.invokeEvent("dragout",null,s);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
248
phpgwapi/js/dynapi/api/ext/dynkeyevent.js
Normal file
@ -0,0 +1,248 @@
|
||||
/*
|
||||
DynAPI Distribution
|
||||
DynKeyEvent Extensions
|
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
|
||||
|
||||
Requirements:
|
||||
dynapi.api
|
||||
*/
|
||||
function DynKeyEvent(type,src) {
|
||||
this.DynEvent = DynEvent;
|
||||
this.DynEvent(type,src);
|
||||
this.charKey=null;
|
||||
};
|
||||
var p=dynapi.setPrototype('DynKeyEvent','DynEvent');
|
||||
p.getKey=function() {
|
||||
return this.charKey;
|
||||
};
|
||||
DynKeyEvent._keyEventListener=function(e) {
|
||||
var dynobj=this._dynobj;
|
||||
if(!dynobj)
|
||||
return true;
|
||||
var dyndoc=dynobj.doc._dynobj;
|
||||
if(!dyndoc) return true;
|
||||
if(!e) var e=dyndoc.frame.event;
|
||||
|
||||
var evt=new DynKeyEvent(e.type,dynobj);
|
||||
evt.which=(e.keyCode)?e.keyCode:e.which;
|
||||
var key=String.fromCharCode(evt.which).toLowerCase();
|
||||
if((key>='a'&&key<='z')||(key>='0'&&key<='9')) evt.charKey=key;
|
||||
evt.spaceKey=(evt.which==32);
|
||||
evt.enterKey=(evt.which==13);
|
||||
evt.tabKey=(evt.which==9||evt.which==65289);
|
||||
evt.leftKey=(evt.which==37||evt.which==52||evt.which==100||evt.which==65460);
|
||||
evt.rightKey=(evt.which==39||evt.which==54||evt.which==102||evt.which==65462);
|
||||
evt.upKey=(evt.which==38||evt.which==56||evt.which==104||evt.which==65464);
|
||||
evt.downKey=(evt.which==40||evt.which==50||evt.which==98||evt.which==65458);
|
||||
evt.altKey=(e.modifiers)?false:(e.altKey||e.altLeft||evt.which==18||evt.which==57388);
|
||||
evt.ctrlKey=(e.modifiers)?(e.modifiers&Event.CONTROL_MASK):(e.ctrlKey||e.ctrlLeft||evt.which==17||evt.which==57391);
|
||||
evt.shiftKey=(e.modifiers)?(e.modifiers&Event.SHIFT_MASK):(e.shiftKey||e.shiftLeft||evt.which==16||evt.which==57390);
|
||||
|
||||
dynobj.invokeEvent(evt.type,evt);
|
||||
if(evt.defaultValue==false) {
|
||||
if(e.cancelBubble) e.cancelBubble=true;
|
||||
if(e.stopPropagation) e.stopPropagation();
|
||||
}
|
||||
return evt.defaultValue;
|
||||
};
|
||||
|
||||
TabManager={};
|
||||
TabManager._c=0; // Current tab manager index.
|
||||
TabManager._all=[];
|
||||
TabManager._active=false;
|
||||
TabManager._activeTimeout=function() { // Prevent duplcate keydown events in NS4.
|
||||
TabManager._active=true;
|
||||
setTimeout('TabManager._active=false;',25);
|
||||
};
|
||||
TabManager._getForm=null;
|
||||
TabManager.getForm=function(p) { // Prevent default tab focus in Mozilla.
|
||||
if(TabManager._getForm) return;
|
||||
TabManager._getForm=p;
|
||||
var html='<form name="__frm" onsubmit="return false;"><input name="__tab" size=1></form>';
|
||||
return p.addChild(new DynLayer(html),'__lyr');
|
||||
};
|
||||
TabManager._grabFocus=function() {
|
||||
var form=TabManager._getForm.__lyr;
|
||||
setTimeout(form+'.doc.forms.__frm.__tab.focus();',0);
|
||||
};
|
||||
TabManager._el={};
|
||||
TabManager._el.onkeydown=function(e) {
|
||||
if(TabManager._getForm) { // User must have inserted TabManager form.
|
||||
if(TabManager._active) return;
|
||||
TabManager._activeTimeout();
|
||||
}
|
||||
var i1,o1,l1,i2,o2,l2;
|
||||
var nextKey=(e.tabKey||e.rightKey);
|
||||
var prevKey=((e.shiftKey&&e.tabKey)||e.leftKey);
|
||||
var submitKey=(e.enterKey||e.spaceKey);
|
||||
i1=TabManager._c; o1=TabManager._all[i1]; l1=TabManager._all.length;
|
||||
i2=o1._tabGroup._c; o2=o1._tabGroup._all[i2]; l2=o1._tabGroup._all.length;
|
||||
if(nextKey||prevKey) { // Cycle group.
|
||||
if(o2._hasFocusEvents) o2.setFocus(false,o2._focusBubble);
|
||||
else o2.invokeEvent('blur');
|
||||
if(prevKey) i2=(i2==0)?l2-1:i2-1;
|
||||
else i2=(i2==l2-1)?0:i2+1;
|
||||
o2=o1._tabGroup._all[i2]; o1._tabGroup._c=i2;
|
||||
if(o2._hasFocusEvents) o2.setFocus(true,o2._focusBubble);
|
||||
else o2.invokeEvent('focus');
|
||||
}
|
||||
else if(e.upKey||e.downKey) { // Cycle manager.
|
||||
if(o2._hasFocusEvents) o2.setFocus(false,o2._focusBubble);
|
||||
else o2.invokeEvent('blur');
|
||||
if(e.upKey) i1=(i1==0)?l1-1:i1-1;
|
||||
else i1=(i1==l1-1)?0:i1+1;
|
||||
o1=TabManager._all[i1]; TabManager._c=i1;
|
||||
i2=o1._tabGroup._c;
|
||||
o2=o1._tabGroup._all[i2];
|
||||
if(o2._hasFocusEvents) o2.setFocus(true,o2._focusBubble);
|
||||
else o2.invokeEvent('focus');
|
||||
} else if(submitKey) {
|
||||
o2.invokeEvent('submit');
|
||||
}
|
||||
e.preventDefault();
|
||||
if(TabManager._getForm) TabManager._grabFocus();
|
||||
};
|
||||
DynElement.prototype.createTabManager=function() {
|
||||
var p=this, c=p.children; if(!c) return;
|
||||
var args=(arguments.length)?arguments:c;
|
||||
var l=args.length, s; if(!l) return;
|
||||
if(p._tabGroup) delete p._tabGroup;
|
||||
p._tabGroup={ _c:0, _all:[] };
|
||||
for(var i=0;i<l;i++) {
|
||||
c=args[i];
|
||||
p._tabGroup._all[i]=c;
|
||||
c._hasTabManager=true;
|
||||
if(!c._submitFn) {
|
||||
s=c.id.replace(/-/g,'.')+'()'; // Element id callback.
|
||||
c._submitFn=s;
|
||||
}
|
||||
}
|
||||
l=TabManager._all.length; TabManager._all[l]=p;
|
||||
if(l==0) dynapi.onLoad(function() {
|
||||
dynapi.document.addEventListener(TabManager._el);
|
||||
});
|
||||
};
|
||||
DynElement.prototype.updateTabManager=function() {
|
||||
var tm=TabManager, all=tm._all[TabManager._c]; if(!all) return;
|
||||
var old=all._tabGroup; if(!old||old._all[old._c]==this) return;
|
||||
var p=this.parent, l;
|
||||
var tg=(p&&p._tabGroup)?p._tabGroup:null; if(!tg) return;
|
||||
l=tg._all.length;
|
||||
for(var i=0;i<l;i++) if(tg._all[i]==this) { tg._c=i; break; }
|
||||
l=tm._all.length;
|
||||
for(var i=0;i<l;i++) if(tm._all[i]==p) { tm._c=i; break; }
|
||||
};
|
||||
DynElement.prototype.addTabListeners=function(el) {
|
||||
if(el&&this._tabGroup) {
|
||||
var a=this._tabGroup._all;
|
||||
for(var i in a) a[i].addEventListener(el);
|
||||
}
|
||||
};
|
||||
DynElement.prototype.addSubmitFn=function(fn) {
|
||||
if(fn) this._submitFn=fn;
|
||||
};
|
||||
DynElement.prototype.callSubmitFn=function() {
|
||||
var f=this._submitFn;
|
||||
if(typeof(f)=='function') f();
|
||||
else if(typeof(f)=='string') eval(f);
|
||||
};
|
||||
|
||||
DynElement.prototype.captureKeyEvents=function() {
|
||||
// This impossibilitates Inheritance... changing to the same aproach as captureMouseEvents
|
||||
//var elm=(this.getClassName()=='DynLayer')?this.elm:this.doc;
|
||||
var elm;
|
||||
|
||||
if (this.getKeyEventElement) elm = this.getKeyEventElement();
|
||||
else elm=(this.getClassName()=='DynDocument')?this.doc:this.elm;
|
||||
|
||||
//if(!elm||this._hasKeyEvents) return true;
|
||||
if (!elm) return true;
|
||||
if(elm.addEventListener) {
|
||||
elm.addEventListener("keydown",DynKeyEvent._keyEventListener,false);
|
||||
elm.addEventListener("keypress",DynKeyEvent._keyEventListener,false);
|
||||
elm.addEventListener("keyup",DynKeyEvent._keyEventListener,false);
|
||||
elm.addEventListener("blur",DynKeyEvent._keyEventListener,false);
|
||||
elm.addEventListener("focus",DynKeyEvent._keyEventListener,false);
|
||||
}
|
||||
else {
|
||||
if(elm.captureEvents)
|
||||
elm.captureEvents(Event.KEYPRESS|Event.KEYDOWN|Event.KEYUP);
|
||||
elm.onblur=elm.onfocus=elm.onkeydown=elm.onkeypress=elm.onkeyup=DynKeyEvent._keyEventListener;
|
||||
}
|
||||
this._hasKeyEvents=true;
|
||||
return false;
|
||||
};
|
||||
DynElement.prototype.releaseKeyEvents=function() {
|
||||
var elm=(this.getClassName()=='DynLayer')?this.elm:this.doc;
|
||||
if(!elm||!this._hasKeyEvents) return true;
|
||||
if(elm.removeEventListener) {
|
||||
elm.removeEventListener("keydown",DynKeyEvent._keyEventListener,false);
|
||||
elm.removeEventListener("keypress",DynKeyEvent._keyEventListener,false);
|
||||
elm.removeEventListener("keyup",DynKeyEvent._keyEventListener,false);
|
||||
}
|
||||
else {
|
||||
if(elm.releaseEvents)
|
||||
elm.releaseEvents(Event.KEYPRESS|Event.KEYDOWN|Event.KEYUP);
|
||||
elm.onkeydown=elm.onkeypress=elm.onkeyup=null;
|
||||
}
|
||||
this._hasKeyEvents=false;
|
||||
return false;
|
||||
};
|
||||
|
||||
DynDocument.prototype.captureHotKey = function(key,fn){
|
||||
var klst=((key+'').toLowerCase()).split('+');
|
||||
klst.sort();
|
||||
key=klst.join('+');
|
||||
if(!this._hotKeys){
|
||||
this._hotKeys={};
|
||||
this._keyDn={};
|
||||
this._keyLst='';
|
||||
this.captureKeyEvents();
|
||||
this.addEventListener({
|
||||
onkeydown:function(e){
|
||||
var k = e.which;
|
||||
var o = e.getSource();
|
||||
// to-do: add opera v7 key code (57xxx), e.g 57388
|
||||
if (k==13) k="enter";
|
||||
else if(k==27) k="esc";
|
||||
else if(k==45) k="insert";
|
||||
else if(k==46) k="delete";
|
||||
else if(k==36) k="home";
|
||||
else if(k==35) k="end";
|
||||
else if(k==33) k="pgup";
|
||||
else if(k==34) k="pgdn";
|
||||
else if(k==38) k="up";
|
||||
else if(k==40) k="down";
|
||||
else if(k==37) k="left";
|
||||
else if(k==39) k="right";
|
||||
else if(e.altKey && !o._keyDn['alt']) k="alt";
|
||||
else if(e.ctrlKey && !o._keyDn['ctrl']) k="ctrl";
|
||||
else if(e.shiftKey && !o._keyDn['shift']) k="shift";
|
||||
else k=(String.fromCharCode(k)).toLowerCase();
|
||||
if(!o._keyDn[k]) {
|
||||
// store new key in keyDn array
|
||||
o._keyLst+=(((o._keyLst)? '+':'')+k); // build key list
|
||||
var ar=o._keyLst.split('+');
|
||||
ar.sort();
|
||||
o._keyLst=ar.join('+');
|
||||
o._keyDn[k]=true;
|
||||
}
|
||||
k=o._hotKeys[o._keyLst];
|
||||
if(k){
|
||||
o._keyLst='';o._keyDn={};
|
||||
if(typeof(k)=='string') return eval(k); else return k();
|
||||
}
|
||||
},
|
||||
onkeyup:function(e){
|
||||
var o=e.getSource();
|
||||
o._keyLst='';o._keyDn={};
|
||||
}
|
||||
});
|
||||
}
|
||||
this._hotKeys[key]=fn;
|
||||
};
|
||||
DynDocument.prototype.releaseHotKey = function(key){
|
||||
if(this._hotKeys) delete this._hotKeys[key];
|
||||
};
|
||||
|
124
phpgwapi/js/dynapi/api/ext/dynlayer.inline.js
Normal file
@ -0,0 +1,124 @@
|
||||
/*
|
||||
DynAPI Distribution
|
||||
DynLayer Inline Extension
|
||||
|
||||
The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
|
||||
|
||||
requires: dynapi.api.DynLayer
|
||||
*/
|
||||
|
||||
var DynLayerInline = {};
|
||||
|
||||
DynLayer.getInline = function (id, p) {
|
||||
var elm;
|
||||
var pobj;
|
||||
if (!p) pobj = dynapi.document;
|
||||
else if (p.isClass && p.isClass('DynElement')) pobj = p;
|
||||
|
||||
if (pobj) {
|
||||
if (dynapi.ua.ns4) elm = pobj.doc.layers[id];
|
||||
else if (dynapi.ua.ie) elm = pobj.doc.all[id];
|
||||
else if (dynapi.ua.dom) elm = pobj.doc.getElementById(id);
|
||||
}
|
||||
if (!elm) return alert("DynLayerInline Error: did not find element "+id);
|
||||
|
||||
var dlyr = new DynLayer();
|
||||
dlyr.setID(id);
|
||||
dlyr.parent = pobj;
|
||||
dlyr.elm = elm;
|
||||
if (dynapi.ua.ns4) dlyr.doc = elm.document;
|
||||
DynLayer._importInlineValues(dlyr);
|
||||
DynLayer._assignElement(dlyr,elm);
|
||||
DynElement._flagCreate(dlyr);
|
||||
return dlyr;
|
||||
};
|
||||
|
||||
DynLayer.prototype._createInline = function (divs) {
|
||||
if (this.parent && !this.elm) {
|
||||
var ch=this.children;
|
||||
DynLayer._assignElement(this,null,divs);
|
||||
DynLayer._importInlineValues(this);
|
||||
for (var i=0;i<ch.length;i++) DynLayer._importInlineValues(ch[i]);
|
||||
DynElement._flagCreate(this);
|
||||
}
|
||||
};
|
||||
|
||||
DynLayer._importInlineValues = function(dlyr) {
|
||||
if(dlyr && dlyr._noInlineValues) return;
|
||||
if (dynapi.ua.def) {
|
||||
if (dynapi.ua.ie) {
|
||||
var css = dlyr.elm.currentStyle;
|
||||
dlyr.x = parseInt(css.left);
|
||||
dlyr.y = parseInt(css.top);
|
||||
dlyr.w = dynapi.ua.ie4? css.pixelWidth : dlyr.elm.offsetWidth;
|
||||
dlyr.h = dynapi.ua.ie4? css.pixelHeight : dlyr.elm.offsetHeight;
|
||||
dlyr.bgImage = css.backgroundImage;
|
||||
dlyr.bgColor = css.backgroundColor;
|
||||
dlyr.html = dlyr.elm.innerHTML;
|
||||
}
|
||||
else if (dynapi.ua.dom) {
|
||||
var css = dlyr.elm.style;
|
||||
dlyr.x = parseInt(dlyr.elm.offsetLeft);
|
||||
dlyr.y = parseInt(dlyr.elm.offsetTop);
|
||||
dlyr.w= dlyr.elm.offsetWidth;
|
||||
dlyr.h= dlyr.elm.offsetHeight;
|
||||
dlyr.bgImage = css.backgroundImage;
|
||||
dlyr.bgColor = css.backgroundColor;
|
||||
dlyr.html = dlyr.elm.innerHTML;
|
||||
}
|
||||
|
||||
}
|
||||
else if (dynapi.ua.ns4) {
|
||||
var css = dlyr.elm;
|
||||
dlyr.x = parseInt(css.left);
|
||||
dlyr.y = parseInt(css.top);
|
||||
dlyr.w = css.clip.width;
|
||||
dlyr.h = css.clip.height;
|
||||
dlyr.clip = [css.clip.top,css.clip.right,css.clip.bottom,css.clip.left];
|
||||
dlyr.bgColor = dlyr.doc.bgColor!=''? dlyr.doc.bgColor : null;
|
||||
dlyr.bgImage = css.background.src!=''? css.background.src : null;
|
||||
dlyr.html = '';
|
||||
}
|
||||
dlyr.z = css.zIndex;
|
||||
var b = css.visibility;
|
||||
dlyr.visible = (b=="inherit" || b=="show" || b=="visible" || b=="");
|
||||
};
|
||||
|
||||
// Generate Blueprint
|
||||
DynElement.prototype.getBlueprint = function(type) {
|
||||
var i,c,ht,str =[];
|
||||
var f,ch=this.children;
|
||||
for(i=0;i<ch.length;i++) {
|
||||
c = ch[i];
|
||||
DynElement._flagPreCreate(c);
|
||||
ht=c.getOuterHTML();
|
||||
if(!type || type=='css') str[i]=ht;
|
||||
else {
|
||||
ht=ht.replace(/\'/g,'\\\'');
|
||||
ht=ht.replace(/\r/g,'\\r');
|
||||
ht=ht.replace(/\n/g,'\\n');
|
||||
str[str.length]='_bw(\''+ht+'\');';
|
||||
}
|
||||
}
|
||||
if(!type || type=='css') str=str.join('');
|
||||
else str=str.join('\n');
|
||||
if(type=='css') { // generate style sheet from blueprints
|
||||
var ar=str.split('<div');
|
||||
for(i=0;i<ar.length;i++){
|
||||
ar[i]=ar[i].replace(/(.+)id="(.+)" style="(.+)"(.+)/g,'#$2 {$3}');
|
||||
}
|
||||
str=ar.join('');
|
||||
}
|
||||
return str;
|
||||
};
|
||||
DynElement.prototype.generateBlueprint = function(type) {
|
||||
var url=dynapi.library.path+'ext/blueprint.html';
|
||||
var win=window.open(url,'blueprint','width=500,height=350,scrollbars=no,status=no,toolbar=no');
|
||||
var f=win.document.forms['frm'];
|
||||
f.txtout.value=this.getBlueprint(type);
|
||||
};
|
||||
|
||||
// Blueprint Document write
|
||||
_bw = function(str){
|
||||
document.write(str);
|
||||
};
|
BIN
phpgwapi/js/dynapi/ext/images/debug_icon.gif
Normal file
After Width: | Height: | Size: 267 B |
BIN
phpgwapi/js/dynapi/ext/images/debug_imgclear.gif
Normal file
After Width: | Height: | Size: 489 B |
BIN
phpgwapi/js/dynapi/ext/images/debug_imgclear_on.gif
Normal file
After Width: | Height: | Size: 514 B |
BIN
phpgwapi/js/dynapi/ext/images/debug_imgeval.gif
Normal file
After Width: | Height: | Size: 714 B |
BIN
phpgwapi/js/dynapi/ext/images/debug_imgeval_on.gif
Normal file
After Width: | Height: | Size: 795 B |
BIN
phpgwapi/js/dynapi/ext/images/debug_imghelp.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
phpgwapi/js/dynapi/ext/images/debug_imghelp_down.gif
Normal file
After Width: | Height: | Size: 950 B |
BIN
phpgwapi/js/dynapi/ext/images/debug_imghelp_on.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
phpgwapi/js/dynapi/ext/images/debug_imginspect.gif
Normal file
After Width: | Height: | Size: 615 B |
BIN
phpgwapi/js/dynapi/ext/images/debug_imginspect_on.gif
Normal file
After Width: | Height: | Size: 667 B |
BIN
phpgwapi/js/dynapi/ext/images/debug_imgnext.gif
Normal file
After Width: | Height: | Size: 406 B |
BIN
phpgwapi/js/dynapi/ext/images/debug_imgnext_on.gif
Normal file
After Width: | Height: | Size: 421 B |
BIN
phpgwapi/js/dynapi/ext/images/debug_imgnormal.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
phpgwapi/js/dynapi/ext/images/debug_imgnormal_down.gif
Normal file
After Width: | Height: | Size: 940 B |
BIN
phpgwapi/js/dynapi/ext/images/debug_imgnormal_on.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
phpgwapi/js/dynapi/ext/images/debug_imgprev.gif
Normal file
After Width: | Height: | Size: 408 B |
BIN
phpgwapi/js/dynapi/ext/images/debug_imgprev_on.gif
Normal file
After Width: | Height: | Size: 426 B |
BIN
phpgwapi/js/dynapi/ext/images/debug_imgreload.gif
Normal file
After Width: | Height: | Size: 444 B |
BIN
phpgwapi/js/dynapi/ext/images/debug_imgreload_on.gif
Normal file
After Width: | Height: | Size: 454 B |
BIN
phpgwapi/js/dynapi/ext/images/debug_imgwatch.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
phpgwapi/js/dynapi/ext/images/debug_imgwatch_down.gif
Normal file
After Width: | Height: | Size: 962 B |
BIN
phpgwapi/js/dynapi/ext/images/debug_imgwatch_on.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |