merge of '084a7a5ec0ad85b0c967e9425da2b4b789029549'

and '5122dba2cf6d25cecc6935ab5313e950bc38b7a8'

Monotone-Parent: 084a7a5ec0ad85b0c967e9425da2b4b789029549
Monotone-Parent: 5122dba2cf6d25cecc6935ab5313e950bc38b7a8
Monotone-Revision: 99f2e49deefdf8b448f9388104536c94d7581cbd

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2009-07-19T16:41:48
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau committed 2009-07-19 16:41:48 +00:00
commit ebeda97b74
40 files changed
+1686 -1674

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* JavaScript for SOGoContacts */
var cachedContacts = {};
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* custom extensions to the DOM api */
Element.addMethods(
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
Form.Element.Methods._replicate = function(element) {
element = $(element);
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
Element.addMethods({
getSelectedRows: function(element) {
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//HTMLUListElement.prototype.getSelectedRows = function() {
// return this.getSelectedNodes();
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
String.prototype.trim = function() {
return this.replace(/(^\s+|\s+$)/g, '');
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* JavaScript for SOGoMail */
var accounts = {};
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
var MailerUIdTreeExtension = {
elementCounter: 1,
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
var SOGoDragHandlesInterface = {
leftMargin: 180,
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
function initLogin() {
var date = new Date();
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* test */
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2005 SKYRIX Software AG
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
var resultsDiv;
var address;
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
function onCancelClick(event) {
window.close();
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
function onLoadCalendarProperties() {
var colorButton = $("colorButton");
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
function onLoadColorPicker(event) {
showColorPicker();
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
function onPopupAttendeesWindow(event) {
if (event)
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2005 SKYRIX Software AG
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
var d;
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
function onCancelClick(event) {
window.close();
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
var contactSelectorAction = 'mailer-contacts';
var attachmentCount = 0;
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
function onPrintCurrentMessage(event) {
window.print();
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2005 SKYRIX Software AG
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
function onCancelClick(event) {
window.close();
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
function onPrintCurrentMessage(event) {
window.print();
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
function onCancelButtonClick(event) {
window.close();
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
function savePreferences(sender) {
var sigList = $("signaturePlacementList");
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
var RecurrenceEditor = {
types: new Array("Daily", "Weekly", "Monthly", "Yearly"),
+2 -1
View File
@@ -1,4 +1,5 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
function initializeWindowButtons() {
var okButton = $("okButton");
var cancelButton = $("cancelButton");
+1 -1
View File
@@ -1,4 +1,4 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
var contactSelectorAction = 'calendars-contacts';
+1
View File
@@ -1,3 +1,4 @@
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*--------------------------------------------------|
| dTree 2.05 | www.destroydrop.com/javascript/tree/ |
|---------------------------------------------------|
+2 -1
View File
@@ -1,4 +1,5 @@
/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2005 SKYRIX Software AG
@@ -1,3 +1,4 @@
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/************************************************************************************************************
@fileoverview
JS Color picker
+3 -2
View File
@@ -1,3 +1,4 @@
/* X Library, Copyright (C) 2001,2002,2003,2004,2005 Michael Foster (Cross-Browser.com). Distributed under the terms of the GNU LGPL */
/* layout2or3_xlib.js compiled with XC v0.22b, see layout2or3_xlib.txt for contributor copyrights, license info and documentation */
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* X Library, Copyright (C) 2001,2002,2003,2004,2005 Michael Foster (Cross-Browser.com). Distributed under the terms of the GNU LGPL */
/* layout2or3_xlib.js compiled with XC v0.22b, see layout2or3_xlib.txt for contributor copyrights, license info and documentation */
var xVersion='4.0',xOp7,xOp5or6,xIE4Up,xIE4,xIE5,xNN4,xMoz,xMac,xUA=navigator.userAgent.toLowerCase();if (window.opera){xOp7=(xUA.indexOf('opera 7')!=-1 || xUA.indexOf('opera/7')!=-1);if (!xOp7) xOp5or6=(xUA.indexOf('opera 5')!=-1 || xUA.indexOf('opera/5')!=-1 || xUA.indexOf('opera 6')!=-1 || xUA.indexOf('opera/6')!=-1);}else if (document.all && xUA.indexOf('msie')!=-1) {xIE4Up=parseInt(navigator.appVersion)>=4;xIE4=xUA.indexOf('msie 4')!=-1;xIE5=xUA.indexOf('msie 5')!=-1;}else if (document.layers) {xNN4=true;}xMoz=xUA.indexOf('gecko')!=-1;xMac=xUA.indexOf('mac')!=-1;function xGetElementById(e){if(typeof(e)!='string') return e;if(document.getElementById) e=document.getElementById(e);else if(document.all) e=document.all[e];else e=null;return e;}function xStr(s){for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])!='string') return false;}return true;}function xScrollLeft(e, bWin){var offset=0;if (!xDef(e) || bWin) {var w = e || window;if(w.document.documentElement && w.document.documentElement.scrollLeft) offset=w.document.documentElement.scrollLeft;else if(w.document.body && xDef(w.document.body.scrollLeft)) offset=w.document.body.scrollLeft;}else {e = xGetElementById(e);if (e && xNum(e.scrollLeft)) offset = e.scrollLeft;}return offset;}function xScrollTop(e, bWin){var offset=0;if (!xDef(e) || bWin) {var w = e || window;if(w.document.documentElement && w.document.documentElement.scrollTop) offset=w.document.documentElement.scrollTop;else if(w.document.body && xDef(w.document.body.scrollTop)) offset=w.document.body.scrollTop;}else {e = xGetElementById(e);if (e && xNum(e.scrollTop)) offset = e.scrollTop;}return offset;}function xHeight(e,h){if(!(e=xGetElementById(e))) return 0;if (xNum(h)) {if (h<0) h = 0;else h=Math.round(h);}else h=-1;var css=xDef(e.style);if(css && xDef(e.offsetHeight) && xStr(e.style.height)) {if(h>=0) {var pt=0,pb=0,bt=0,bb=0;if (document.compatMode=='CSS1Compat') {var gcs = xGetComputedStyle;pt=gcs(e,'padding-top',1);if (pt != null) {pb=gcs(e,'padding-bottom',1);bt=gcs(e,'border-top-width',1);bb=gcs(e,'border-bottom-width',1);}else if(xDef(e.offsetHeight,e.style.height)){e.style.height=h+'px';pt=e.offsetHeight-h;}}h-=(pt+pb+bt+bb);if(isNaN(h)||h<0) return;else e.style.height=h+'px';}h=e.offsetHeight;}else if(css && xDef(e.style.pixelHeight)) {if(h>=0) e.style.pixelHeight=h;h=e.style.pixelHeight;}return h;}function xClientWidth(){var w=0;if(xOp5or6) w=window.innerWidth;else if(document.compatMode == 'CSS1Compat' && !window.opera && document.documentElement && document.documentElement.clientWidth)w=document.documentElement.clientWidth;else if(document.body && document.body.clientWidth)w=document.body.clientWidth;else if(xDef(window.innerWidth,window.innerHeight,document.height)) {w=window.innerWidth;if(document.height>window.innerHeight) w-=16;}return w;}function xClientHeight(){var h=0;if(xOp5or6) h=window.innerHeight;else if(document.compatMode == 'CSS1Compat' && !window.opera && document.documentElement && document.documentElement.clientHeight)h=document.documentElement.clientHeight;else if(document.body && document.body.clientHeight)h=document.body.clientHeight;else if(xDef(window.innerWidth,window.innerHeight,document.width)) {h=window.innerHeight;if(document.width>window.innerWidth) h-=16;}return h;}function xAddEventListener(e,eT,eL,cap){if(!(e=xGetElementById(e))) return;eT=eT.toLowerCase();if((!xIE4Up && !xOp7 /* && !xMoz */) && e==window) {if(eT=='resize') { window.xPCW=xClientWidth(); window.xPCH=xClientHeight(); window.xREL=eL; xResizeEvent(); return; }if(eT=='scroll') { window.xPSL=xScrollLeft(); window.xPST=xScrollTop(); window.xSEL=eL; xScrollEvent(); return; }}var eh='e.on'+eT+'=eL';if(e.addEventListener) e.addEventListener(eT,eL,cap);else if(e.attachEvent) e.attachEvent('on'+eT,eL);else eval(eh);}function xResizeEvent(){if (window.xREL) setTimeout('xResizeEvent()', 250);var cw = xClientWidth(), ch = xClientHeight();if (window.xPCW != cw || window.xPCH != ch) { window.xPCW = cw; window.xPCH = ch; if (window.xREL) window.xREL(); }}function xScrollEvent(){if (window.xSEL) setTimeout('xScrollEvent()', 250);var sl = xScrollLeft(), st = xScrollTop();if (window.xPSL != sl || window.xPST != st) { window.xPSL = sl; window.xPST = st; if (window.xSEL) window.xSEL(); }}function xGetComputedStyle(oEle, sProp, bInt){var s, p = 'undefined';var dv = document.defaultView;if(dv && dv.getComputedStyle){s = dv.getComputedStyle(oEle,'');if (s) p = s.getPropertyValue(sProp);}else if(oEle.currentStyle) {var a = sProp.split('-');sProp = a[0];for (var i=1; i<a.length; ++i) {c = a[i].charAt(0);sProp += a[i].replace(c, c.toUpperCase());} p = oEle.currentStyle[sProp];}else return null;return bInt ? (parseInt(p) || 0) : p;}function xShow(e) {return xVisibility(e,1);}function xDef(){for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])=='undefined') return false;}return true;}function xNum(){for(var i=0; i<arguments.length; ++i){if(isNaN(arguments[i]) || typeof(arguments[i])!='numbLine truncated
+1
View File
@@ -1,3 +1,4 @@
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* Prototype JavaScript framework, version 1.6.0.3
* (c) 2005-2009 Sam Stephenson
*
+1
View File
@@ -1,3 +1,4 @@
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
// Title: Tigra Calendar
// Description: See the demo at url
// URL: http://www.softcomplex.com/products/tigra_calendar/
+2
View File
@@ -1,3 +1,5 @@
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
Object.extend(TableKit, {
getHeaderCells : function(table, cell) {
if(!table) { table = $(cell).up('table'); }
+102 -100
View File
@@ -1,101 +1,103 @@
/**
* This work is licensed under a Creative Commons Attribution 3.0 License
* (http://creativecommons.org/licenses/by/3.0/).
*
* You are free:
* to Share - to copy, distribute and transmit the work
* to Remix - to adapt the work
* Under the following conditions:
* Attribution. You must attribute the work in the manner specified
* by the author or licensor (but not in any way that suggests that
* they endorse you or your use of the work).
*
* For any reuse or distribution, you must make clear to others the license
* terms of this work. The best way to do this is with a link to the
* Creative Commons web page.
*
* Any of the above conditions can be waived if you get permission from
* the copyright holder. Nothing in this license impairs or restricts
* the author's moral rights.
*
* Disclaimer
*
* Your fair dealing and other rights are in no way affected by the above.
* This is a human-readable summary of the Legal Code (the full license).
*
* The author of this work is Vlad Bailescu (http://vlad.bailescu.ro). No
* warranty or support will be provided for this work, although updates
* might be made available at http://vlad.bailescu.ro/javascript/tablekit .
*
* Licence code and basic description provided by Creative Commons.
*
*/
Object.extend(TableKit.options || {}, {
// If true table width gets recalculated on column resize
trueResize : false,
// If true table width will be kept constant on column resize
keepWidth : false
});
Object.extend(TableKit.Resizable, {
resize : function(table, index, w) {
// This part is taken from Andrew Tetlaw's original TableKit.Resizable.resize
var cell;
if(typeof index === 'number') {
if(!table || (table.tagName && table.tagName !== "TABLE")) {return;}
table = $(table);
index = Math.min(table.rows[0].cells.length, index);
index = Math.max(1, index);
index -= 1;
cell = (table.tHead && table.tHead.rows.length > 0) ? $(table.tHead.rows[table.tHead.rows.length-1].cells[index]) : $(table.rows[0].cells[index]);
} else {
cell = $(index);
table = table ? $(table) : cell.up('table');
index = TableKit.getCellIndex(cell);
}
// And now, for the fun stuff
// Read the new options values for the given table
var op = TableKit.option('trueResize keepWidth minWidth', table.id);
// Took also the minWidth as we're gonna use it later anyway
var pad = parseInt(cell.getStyle('paddingLeft'),10) + parseInt(cell.getStyle('paddingRight'),10);
// Improvement: add cell border to padding as width incorporates both
pad += parseInt(cell.getStyle('borderLeftWidth'),10) + parseInt(cell.getStyle('borderRightWidth'),10);
w = Math.max(w-pad, op.minWidth); // This will also be used later
if (!op.trueResize) {
// Original resize method
cell.setStyle({'width' : w + 'px'}); // Using previously read minWidth instead of the old way
} else {
// New stuff
var delta = (w + pad - parseInt(cell.getWidth()));
if (!op.keepWidth) {
// We'll be updating the table width
var tableWidth = parseInt(table.getWidth()) + delta;
cell.setStyle({'width' : w + 'px'});
table.setStyle({'width' : tableWidth + 'px'});
} else {
// Let's see what we have to do to keep the table width constant
var cells = TableKit.getHeaderCells(table);
if (index < 0 || index > cells.length) { return; }
var nbour;
if (index == cells.length - 1) { // Rightmost cell
nbour = cells[index - 1];
} else { // Left or inner cell
nbour = cells[index + 1];
}
var nbourWidth = parseInt(nbour.getWidth());
var nbourPad = parseInt(nbour.getStyle('paddingLeft'),10) + parseInt(nbour.getStyle('paddingRight'),10);
var proposedNbourWidth = nbourWidth - nbourPad - delta;
var newNbourWidth;
if (proposedNbourWidth < op.minWidth) {
// Don't be mean to neighbours. Step off their porch.
newNbourWidth = Math.min(nbourWidth - nbourPad, op.minWidth);
w -= newNbourWidth - proposedNbourWidth;
} else {
newNbourWidth = proposedNbourWidth;
}
nbour.setStyle({'width' : newNbourWidth + 'px'});
cell.setStyle({'width' : w + 'px'});
}
}
}
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/**
* This work is licensed under a Creative Commons Attribution 3.0 License
* (http://creativecommons.org/licenses/by/3.0/).
*
* You are free:
* to Share - to copy, distribute and transmit the work
* to Remix - to adapt the work
* Under the following conditions:
* Attribution. You must attribute the work in the manner specified
* by the author or licensor (but not in any way that suggests that
* they endorse you or your use of the work).
*
* For any reuse or distribution, you must make clear to others the license
* terms of this work. The best way to do this is with a link to the
* Creative Commons web page.
*
* Any of the above conditions can be waived if you get permission from
* the copyright holder. Nothing in this license impairs or restricts
* the author's moral rights.
*
* Disclaimer
*
* Your fair dealing and other rights are in no way affected by the above.
* This is a human-readable summary of the Legal Code (the full license).
*
* The author of this work is Vlad Bailescu (http://vlad.bailescu.ro). No
* warranty or support will be provided for this work, although updates
* might be made available at http://vlad.bailescu.ro/javascript/tablekit .
*
* Licence code and basic description provided by Creative Commons.
*
*/
Object.extend(TableKit.options || {}, {
// If true table width gets recalculated on column resize
trueResize : false,
// If true table width will be kept constant on column resize
keepWidth : false
});
Object.extend(TableKit.Resizable, {
resize : function(table, index, w) {
// This part is taken from Andrew Tetlaw's original TableKit.Resizable.resize
var cell;
if(typeof index === 'number') {
if(!table || (table.tagName && table.tagName !== "TABLE")) {return;}
table = $(table);
index = Math.min(table.rows[0].cells.length, index);
index = Math.max(1, index);
index -= 1;
cell = (table.tHead && table.tHead.rows.length > 0) ? $(table.tHead.rows[table.tHead.rows.length-1].cells[index]) : $(table.rows[0].cells[index]);
} else {
cell = $(index);
table = table ? $(table) : cell.up('table');
index = TableKit.getCellIndex(cell);
}
// And now, for the fun stuff
// Read the new options values for the given table
var op = TableKit.option('trueResize keepWidth minWidth', table.id);
// Took also the minWidth as we're gonna use it later anyway
var pad = parseInt(cell.getStyle('paddingLeft'),10) + parseInt(cell.getStyle('paddingRight'),10);
// Improvement: add cell border to padding as width incorporates both
pad += parseInt(cell.getStyle('borderLeftWidth'),10) + parseInt(cell.getStyle('borderRightWidth'),10);
w = Math.max(w-pad, op.minWidth); // This will also be used later
if (!op.trueResize) {
// Original resize method
cell.setStyle({'width' : w + 'px'}); // Using previously read minWidth instead of the old way
} else {
// New stuff
var delta = (w + pad - parseInt(cell.getWidth()));
if (!op.keepWidth) {
// We'll be updating the table width
var tableWidth = parseInt(table.getWidth()) + delta;
cell.setStyle({'width' : w + 'px'});
table.setStyle({'width' : tableWidth + 'px'});
} else {
// Let's see what we have to do to keep the table width constant
var cells = TableKit.getHeaderCells(table);
if (index < 0 || index > cells.length) { return; }
var nbour;
if (index == cells.length - 1) { // Rightmost cell
nbour = cells[index - 1];
} else { // Left or inner cell
nbour = cells[index + 1];
}
var nbourWidth = parseInt(nbour.getWidth());
var nbourPad = parseInt(nbour.getStyle('paddingLeft'),10) + parseInt(nbour.getStyle('paddingRight'),10);
var proposedNbourWidth = nbourWidth - nbourPad - delta;
var newNbourWidth;
if (proposedNbourWidth < op.minWidth) {
// Don't be mean to neighbours. Step off their porch.
newNbourWidth = Math.min(nbourWidth - nbourPad, op.minWidth);
w -= newNbourWidth - proposedNbourWidth;
} else {
newNbourWidth = proposedNbourWidth;
}
nbour.setStyle({'width' : newNbourWidth + 'px'});
cell.setStyle({'width' : w + 'px'});
}
}
}
});
+1
View File
@@ -1,3 +1,4 @@
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
*
* Copyright (c) 2007 Andrew Tetlaw & Millstream Web Software