New: Replaced completely PWC with JQuery

This commit is contained in:
Laurent Destailleur 2010-08-18 19:17:58 +00:00
parent 666c2fc965
commit 76c2dccb70
12 changed files with 8 additions and 2824 deletions

View File

@ -29,7 +29,6 @@ OdtPHP 1.0.1 GPL 2.0 Yes Library
PHP_WriteExcel 0.3.0 LGPL 2.1 Yes Excel files generation
PHP_ExcelReader 2.21 MIT License Yes Parse and retrieve information from XLS files
Prototype 1.6.1 MIT License Yes Ajax library
PWC 1.3 MIT License Yes Ajax library
Scriptaculous 1.8.3 MIT License Yes Ajax library
Smarty 2.6.26 LGPL 2.1 Yes Templates engine used by some pages
SMTPs 1.15 GPL Yes SMTPS library

View File

@ -1,19 +0,0 @@
Copyright (c) 2006 Sébastien Gruhier (http://xilinus.com, http://itseb.com)
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,182 +0,0 @@
== Installation/Usage
Just copy windows.js in your javascript directory, and default.css + default directory in your stylesheets directory
See samples/index.html for more details and go on my web page : http://prototype-window.xilinus.com
== Change log
- 04/23/07 V 1.3
- Added: getTitle
- Added: blur/focus function on Windows module
- Added: onBlur event
- Fixed: WindowCloseKey works with URL content (iframe)
- Fixed: Modal window with a parent != document.body
- Updated: prototype 1.5RC3
- Updated: Dialog handle resizable,minimizable, maximizable, draggable and closable options
- 02/27/07 V 1.2
- Added: gridX and gridY constructor's options to snap move and resize
- Added: Effect on modal overlay (fade/appear) only if effects.js in included.
You can change effect options (Windows.overlayShowEffectOptions and Windows.overlayHideEffectOptions).
- Fixed: Multimodal mode.
- Fixed: Works on WebKit.
- Beta: effects on minimize and maximize. You need to include window_effects.js to have them.
- 02/17/07 V 1.1
- Constructor has been simplified, now you can just do win = new Window(). By default id is automatically generated and can be passed as options
win = new Window({id: "my_id", width: 100, height: 100})
Backward compatibility with old constructor win = new Window("my_id", {width: 100, height: 100})
- Observer event can be passed as window option: win = new Window({onClose: function() {alert('close')}})
- parent option can be id or element
- delegate has been removed (not really usefull) and0 setCloseCallback has been addedinstead. (It could be also passed as a constructor's option closeCallback: your_callcabck)
your_callcabck must return true to be able to close the window
- add onMove event
- fix constraint for minimized window
- destroyOnClose could be passed as constructor's option: win = new Window({destroyOnClose: true})
- constraint works for maximized windows
- Dialog ok and cancel parameters has been renamed to onOk and onCancel for coherence (ok and cancel still works)
- Update to Prototype 1.5 and script.aculo.us 1.7
- 01/14/07 V 1.00
- add changeClassName to change look and feel dynamically.
- add constraint move. Constraint can be on a div or document.
- full top and bottom bar are use to move window.
- fixed computation of window width or height.
- add setURL/getURL/refresh and setHTMLContent. Content can be change dynamically.
- add tooltip.js add on. It's an add-on to add dynamically tooltips on a webpage (see samples/tooltips/tooltip.html)
Thanks to Jonathan Modell of 2moromedia.com.
- 12/06/06 V 0.99
- remove addClass that automatically tries to include default.css
- add wired move/resize
- fix recenterAuto
- add show to WindowStore to be able to open a window the first time, wihtout any cookie (check samples/window_store/html)
- 11/06/06 V 0.98
- new optional behavior for multi-level modal window.
- Two new add-ons (in window_ext.js file)
+ WindowStore to save open/close window status.
+ WindowCloseKey to handle escape key (or any keys) to close windows/dialogs
- 10/26/06 V 0.97
- add recenterModal to constructor
- setAjaxContent eval response request
- modal window multi level
- fix close/closeAll issues
- add addCss (auto add default.css)
- 09/26/06 V 0.96.3
- Fixed onClose, no more memory leak and nore issues with sound on IE (even on dialogs)
- add getLocation
- Debug select problem on Firefox
- change mouseup event to onclick event
- Fixed event propagation on mininize/maximize/close
- Add frameborder=0
- Add prototype_window_class_helper.rb by Jorge Díaz (http://xurde.info)
- 07/22/06 V 0.96.2
- Fixed select issue in modal window
- 07/15/06 V 0.96.1
- Bugs fixed
- Add isVisible()
- Update debug.js
- 07/11/06 V 0.96
- New events onShow, onHide, onFocus
- isVisible()
- Autofit width or height if width or (NOT AND) height is set to null in the constructor
- updateWidth / updateHeight if you need to update width or height (useful after changing window content if you do not want scrollbars)
- Add top, left to showCenter(modal, top, left) optional arguments if you need to center only left or top value.
- 06/30/06 V 0.95
- Now you can set windows or dialogs content with an Ajax request!!
- Fixed IE issue when you destroy window with an url that embeds mp3.
- Fixed buttonClass issue for Dialog.
- Update samples
- 06/24/06 V 0.90
- Valid XHTML 1.0 Strict!
- Fixed minimize function
- Fixed destroy on window without hide effects
- No more text selection while dragging
- Add onMinimize/onMaximize event
- 06/19/06 V 0.85.2
- Remove undeclared vars
- Set top/left to 0 if not specify
- Destroy objet after hide effect instead of before effect instead
- getSize
- add extended_debug.js (from Jason Pollard)
- 06/13/06 V 0.85.1
- IE bug fixed
- 06/12/06 V 0.85
- Autofit width or height for Dialog
- Better Move/Resize over
- Allow select in modal window (even on IE)
- WARNING, ok callback for Dialog should returns true to close the dialog
- better window HTML code (no more div inside the td)
- Add themes
- 05/23/06 V 0.80
- Add setTitle
- Add setStatusBar
- Store minimize/maximize in the cookie (Thanks to Ifran)
- Add onload constructor parameter (Thanks to Ifran)
- Add button class for dialog (Thanks to Felix Shnir)
- 05/09/06 V 0.75
- Update with Script.aculo.us 1.6.1 and Prototype 1.5.0_rc1
- Remove PNG for dialog overlay, use opacity as done in lightbox V2
- Add Windows.focusedWindow and Windows.closeAll
- Add name to iframe in case of url window
- Clean up code, use _ for private function (just name convention)
- Add Dialog.info function, usefull for for submit or notice info (in Rails)
- Add minimize and maximize buttons
- Add alert_lite.css without any images
- Debug
- 04/15/06 V 0.70
- Add autoposition in setContent. The window will at the element location
- Add draggable/closable parameter if you need to specify is the window is draggable/closable or not
- Add parent parameter if you need a specific parent instead of body
- Better resize
- Add setCookie to store window location/size in a cookie
- Add parent.html sample
- 04/05/06 V 0.65
- Update to Prototype 1.5.0_pre1, script.aculo.us 1.6.0
- Add setDestoyOnClose
- Add Windows Observer with onStartResize(), onEndResize(), onStartMove(), onEndMove(), onClose(), onDestroy() events
- Add setContent(id, autoresize)
- 03/29/06 V 0.6
- Add Window delegate to manage close action
- Add modal mode and Dialog class with common panels: alert, confirm
- Clean HTML code and change caracters to lowercase to be XHTML compliant (thanks to nuxygen and Joseph)
- Add showEffectOptions, hideEffectOptions, effectOptions to Window constructor (thanks to Jon)
- Fix checkbox IE bug (big thanks to JCA)
- Fix other little bugs (thanks to nuxygen, Dennis, and all who sent me emails)
- Update samples/index.html
- Add new sample usng frame (samples/inset.html and samples/inframe.html but use only samples/inset.html)
- 03/27/06 V 0.51
- New CSS theme structure
- Add url: constructor parameter to have a window with an URL content
- Add bottom/right constructor parameters
- Update sample files.
- 03/24/06 V 0.50 Initial revision
== License
it is licensed under the terms of the MIT License, see the included MIT-LICENSE file.
== Thanks
To all of you who sent me bugs, patches and feature requests
http://www.ciudadmovil.com.co/q/mod/mapa/conexion.php
http://www.desyr.net/

View File

@ -1,137 +0,0 @@
var debugWindow = null;
function debug(text, reverse) {
if (debugWindow == null)
return;
time = "-"; //new Date();
if (reverse) {
$('debug').innerHTML = time + " " + text + "<br>"+ $('debug').innerHTML;
debugWindow.getContent().scrollTop=0;
}
else {
$('debug').innerHTML += time + " " + text + "<br>";
debugWindow.getContent().scrollTop=10000; // Far away
}
}
function hideDebug() {
if (debugWindow) {
debugWindow.destroy();
debugWindow = null;
}
}
function showDebug(bShow) {
if (debugWindow == null) {
debugWindow = new Window('debug_window', {className: 'dialog',width:250, height:100, right:4, bottom:42, zIndex:1000, opacity:1, showEffect: Element.show, resizable: true, title: "Debug"})
debugWindow.getContent().innerHTML = "<style>#debug_window .dialog_content {background:#000;}</style> <div id='debug'></div>";
date=new Date;
date.setMonth(date.getMonth()+3);
//debugWindow.setCookie(null, date);
}
if( typeof bShow == 'undefined' || bShow)debugWindow.show()
}
function clearDebug() {
if (debugWindow == null)
return;
$('debug').innerHTML = "";
}
/**
* document.createElement convenience wrapper
*
* The data parameter is an object that must have the "tag" key, containing
* a string with the tagname of the element to create. It can optionally have
* a "children" key which can be: a string, "data" object, or an array of "data"
* objects to append to this element as children. Any other key is taken as an
* attribute to be applied to this tag.
*
* Available under an MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* @param {Object} data The data representing the element to create
* @return {Element} The element created.
*/
function $E(data) {
var el;
if ('string'==typeof data) {
el=document.createTextNode(data);
} else {
//create the element
el=document.createElement(data.tag);
delete(data.tag);
//append the children
if ('undefined'!=typeof data.children) {
if ('string'==typeof data.children ||'undefined'==typeof data.children.length) {
//strings and single elements
el.appendChild($E(data.children));
} else {
//arrays of elements
for (var i=0, child=null; 'undefined'!=typeof (child=data.children[i]); i++) {
el.appendChild($E(child));
}
}
delete(data.children);
}
//any other data is attributes
for (attr in data) {
el[attr]=data[attr];
}
}
return el;
}
// FROM Nick Hemsley
var Debug = {
inspectOutput: function (container, within) {
within = within || debugWindow.getContent()
if (debugWindow == null)
return;
within.appendChild(container)
},
inspect: function(object) {
var cont = $E({tag: "div", className: "inspector"})
Debug.inspectObj(object, cont)
debugWindow.getContent().appendChild(cont)
},
inspectObj: function (object, container) {
for (prop in object) {
Debug.inspectOutput(Debug.inspectable(object, prop), container)
}
},
inspectable: function(object, prop) {
cont = $E({tag: 'div', className: 'inspectable', children: [prop + " value: " + object[prop] ]})
cont.toInspect = object[prop]
Event.observe(cont, 'click', Debug.inspectClicked, false)
return cont
},
inspectClicked: function(e) {
Debug.inspectContained(Event.element(e))
Event.stop(e)
},
inspectContained: function(container) {
if (container.opened) {
container.parentNode.removeChild(container.opened)
delete(container.opened)
} else {
sibling = container.parentNode.insertBefore($E({tag: "div", className: "child"}), container.nextSibling)
if (container.toInspect)
Debug.inspectObj(container.toInspect, sibling)
container.opened = sibling
}
}
}
var inspect = Debug.inspect;

View File

@ -1,113 +0,0 @@
var commandHistory;
var historyIndex;
function showExtendedDebug() {
if (debugWindow != null) {
hideDebug();
}
if (debugWindow == null) {
commandHistory = new Array();
historyIndex = 0;
debugWindow = new Window('debug_window', {className: 'dialog',width:250, height:100, right:4, minWidth:250, bottom:42, zIndex:1000, opacity:1, showEffect: Element.show, resizable: true, title: "Debug"})
debugWindow.getContent().innerHTML = "<style>#debug_window .dialog_content {background:#000;}</style> <div font='monaco' id='debug' style='padding:3px;color:#0F0;font-family:monaco'></div>";
//create hourglass icon and attach events to it.
var cont = "<div id=\"debug_window_inspect\" style=\"width: 15px; height: 15px; background: transparent url(themes/default/inspect.gif) no-repeat 0 0; position:absolute; top:5px; left:70px; cursor:pointer; z-index:3000;\"></div>";
new Insertion.After('debug_window_maximize', cont);
Event.observe('debug_window_inspect', 'click', enterInspectionMode, false);
//create command text box
cont = "Eval:<input id=\"debug_window_command\" type=\"textbox\" style=\"width:150px; height: 12px; color: black;\">"
debugWindow.setStatusBar(cont);
Event.observe('debug_window_command', 'mousedown', donothing);
Event.observe('debug_window_command', 'keypress', evalJS, false);
}
debugWindow.show();
}
function donothing(evt){
Field.activate('debug_window_command');
return false;
}
function evalJS(evt){
if(evt.keyCode == Event.KEY_RETURN){
var js = $F('debug_window_command');
try{
var ret = eval(js);
if(ret != null)
debug(ret);
}catch(e){
debug(e);
}
$('debug_window_command').value = '';
Field.activate('debug_window_command');
commandHistory.push(js);
historyIndex = 0;
}
if(evt.keyCode == Event.KEY_UP){
if(commandHistory.length > historyIndex){
historyIndex++;
var js = commandHistory[commandHistory.length-historyIndex];
$('debug_window_command').value = js;
Event.stop(evt);
Field.activate('debug_window_command');
}
}
if(evt.keyCode == Event.KEY_DOWN){
if(commandHistory.length >= historyIndex && historyIndex > 1){
historyIndex--;
var js = commandHistory[commandHistory.length-historyIndex];
$('debug_window_command').value = js;
Event.stop(evt);
Field.activate('debug_window_command');
}
}
}
function enterInspectionMode(evt){
//stop observing magnifying glass
Event.stopObserving('debug_window_inspect', 'click', enterInspectionMode, false);
//change pointer
document.body.style.cursor='help';
//start observing mouse clicks
Event.observe(window, 'click', inspectItem, false);
}
function inspectItem(evt){
// the element that triggered the event
var element = Event.element(evt);
if(element.id!="debug_window_inspect"){
clearDebug()
//change pointer
document.body.style.cursor='default';
debug(element.id);
inspect(element);
//stop observing mouse clicks
Event.stopObserving(window, 'click', inspectItem, false);
//alert('doing something');
//start observing mag
Event.observe('debug_window_inspect', 'click', enterInspectionMode, false);
}
}
function clearDebug() {
var win = $('debug');
if (win == null)
return;
win.innerHTML=" ";
//clear inspections too
var divs = document.getElementsByClassName('inspector');
divs.each(function(div){
Element.remove(div);
});
}

View File

@ -1,241 +0,0 @@
// Singleton class TooltipWindow
// This class works with special className. The tooltip content could be in your HTML page as an hidden element or
// can be retreive by an AJAX call.
//
// To work, You just need to set two class name on elements that should show tooltips
// - One to say to TooltipManager that this element must have a tooltip ('tooltip' by default)
// - Another to indicate how to find the tooltip content
// It could be html_XXXX if tootltip content is somewhere hidden in your page, XXX must be DOM ID of this hidden element
// It could be ajax_XXXX if tootltip content must be find by an ajax request, XXX will be the string send as id parameter to your server.
// Check samples/tooltips/tooltip.html to see how it works
//
TooltipManager = {
options: {cssClassName: 'tooltip', delayOver: 200, delayOut: 1000, shiftX: 10, shiftY: 10,
className: 'alphacube', width: 200, height: null,
draggable: false, minimizable: false, maximizable: false, showEffect: Element.show, hideEffect: Element.hide},
ajaxInfo: null,
elements: null,
showTimer: null,
hideTimer: null,
// Init tooltip manager
// parameters:
// - cssClassName (string) : CSS class name where tooltip should be shown.
// - ajaxOptions (hash) : Ajax options for ajax tooltip.
// For examples {url: "/tooltip/get.php", options: {method: 'get'}}
// see Ajax.Request documentation for details
//- tooltipOptions (hash) : available keys
// - delayOver: int in ms (default 10) delay before showing tooltip
// - delayOut: int in ms (default 1000) delay before hidding tooltip
// - shiftX: int in pixels (default 10) left shift of the tooltip window
// - shiftY: int in pixels (default 10) top shift of the tooltip window
// and All window options like showEffect: Element.show, hideEffect: Element.hide to remove animation
// default: {className: 'alphacube', width: 200, height: null, draggable: false, minimizable: false, maximizable: false}
init: function(cssClassName, ajaxInfo, tooltipOptions) {
TooltipManager.options = Object.extend(TooltipManager.options, tooltipOptions || {});
cssClassName = TooltipManager.options.cssClassName || "tooltip";
TooltipManager.ajaxInfo = ajaxInfo;
TooltipManager.elements = $$("." + cssClassName);
TooltipManager.elements.each(function(element) {
element = $(element)
var info = TooltipManager._getInfo(element);
if (info.ajax) {
element.ajaxId = info.id;
element.ajaxInfo = ajaxInfo;
}
else {
element.tooltipElement = $(info.id);
}
element.observe("mouseover", TooltipManager._mouseOver);
element.observe("mouseout", TooltipManager._mouseOut);
});
Windows.addObserver(this);
},
addHTML: function(element, tooltipElement) {
element = $(element);
tooltipElement = $(tooltipElement);
element.tooltipElement = tooltipElement;
element.observe("mouseover", TooltipManager._mouseOver);
element.observe("mouseout", TooltipManager._mouseOut);
},
addAjax: function(element, ajaxInfo) {
element = $(element);
element.ajaxInfo = ajaxInfo;
element.observe("mouseover", TooltipManager._mouseOver);
element.observe("mouseout", TooltipManager._mouseOut);
},
addURL: function(element, url, width, height) {
element = $(element);
element.url = url;
element.frameWidth = width;
element.frameHeight = height;
element.observe("mouseover", TooltipManager._mouseOver);
element.observe("mouseout", TooltipManager._mouseOut);
},
close: function() {
if (TooltipManager.tooltipWindow)
TooltipManager.tooltipWindow.hide();
},
preloadImages: function(path, images, extension) {
if (!extension)
extension = ".gif";
//preload images
$A(images).each(function(i) {
var image = new Image();
image.src= path + "/" + i + extension;
});
},
_showTooltip: function(element) {
if (this.element == element)
return;
// Get original element
while (element && (!element.tooltipElement && !element.ajaxInfo && !element.url))
element = element.parentNode;
this.element = element;
TooltipManager.showTimer = null;
if (TooltipManager.hideTimer)
clearTimeout(TooltipManager.hideTimer);
var position = Position.cumulativeOffset(element);
var dimension = element.getDimensions();
if (! this.tooltipWindow)
this.tooltipWindow = new Window("__tooltip__", TooltipManager.options);
this.tooltipWindow.hide();
this.tooltipWindow.setLocation(position[1] + dimension.height + TooltipManager.options.shiftY, position[0] + TooltipManager.options.shiftX);
Event.observe(this.tooltipWindow.element, "mouseover", function(event) {TooltipManager._tooltipOver(event, element)});
Event.observe(this.tooltipWindow.element, "mouseout", function(event) {TooltipManager._tooltipOut(event, element)});
// Reset width/height for computation
this.tooltipWindow.height = TooltipManager.options.height;
this.tooltipWindow.width = TooltipManager.options.width;
// Ajax content
if (element.ajaxInfo) {
var p = element.ajaxInfo.options.parameters;
var saveParam = p;
// Set by CSS
if (element.ajaxId) {
if (p)
p += "&id=" + element.ajaxId;
else
p = "id=" + element.ajaxId;
}
element.ajaxInfo.options.parameters = p || "";
this.tooltipWindow.setHTMLContent("");
this.tooltipWindow.setAjaxContent(element.ajaxInfo.url, element.ajaxInfo.options);
element.ajaxInfo.options.parameters = saveParam;
}
// URL content
else if (element.url) {
this.tooltipWindow.setURL(element.url);
this.tooltipWindow.setSize(element.frameWidth, element.frameHeight);
// Set tooltip size
this.tooltipWindow.height = element.frameHeight;
this.tooltipWindow.width = element.frameWidth;
}
// HTML content
else
this.tooltipWindow.setHTMLContent(element.tooltipElement.innerHTML);
if (!element.ajaxInfo) {
this.tooltipWindow.show();
this.tooltipWindow.toFront();
}
},
_hideTooltip: function(element) {
if (this.tooltipWindow) {
this.tooltipWindow.hide();
this.element = null;
}
},
_mouseOver: function (event) {
var element = Event.element(event);
if (TooltipManager.showTimer)
clearTimeout(TooltipManager.showTimer);
TooltipManager.showTimer = setTimeout(function() {TooltipManager._showTooltip(element)}, TooltipManager.options.delayOver)
},
_mouseOut: function(event) {
var element = Event.element(event);
if (TooltipManager.showTimer) {
clearTimeout(TooltipManager.showTimer);
TooltipManager.showTimer = null;
return;
}
if (TooltipManager.tooltipWindow)
TooltipManager.hideTimer = setTimeout(function() {TooltipManager._hideTooltip(element)}, TooltipManager.options.delayOut)
},
_tooltipOver: function(event, element) {
if (TooltipManager.hideTimer) {
clearTimeout(TooltipManager.hideTimer);
TooltipManager.hideTimer = null;
}
},
_tooltipOut: function(event, element) {
if (TooltipManager.hideTimer == null)
TooltipManager.hideTimer = setTimeout(function() {TooltipManager._hideTooltip(element)}, TooltipManager.options.delayOut)
},
_getInfo: function(element) {
// Find html_ for static content
var id = element.className.split(' ').detect(function(name) {return name.indexOf("html_") == 0});
var ajax = true;
if (id)
ajax = false;
else
// Find ajax_ for ajax content
id = element.className.split(' ').detect(function(name) {return name.indexOf("ajax_") == 0});
id = id.substr(id.indexOf('_')+1, id.length)
return id ? {ajax: ajax, id: id} : null;
},
onBeforeShow: function(eventName, win) {
var top = parseFloat(win.getLocation().top);
var dim = win.element.getDimensions();
if (top + dim.height > TooltipManager._getScrollTop() + TooltipManager._getPageHeight()) {
var position = Position.cumulativeOffset(this.element);
var top = position[1] - TooltipManager.options.shiftY - dim.height;
win.setLocation(top, position[0] + TooltipManager.options.shiftX)
}
},
_getPageWidth: function(){
return window.innerWidth || document.documentElement.clientWidth || 0;
},
_getPageHeight: function(){
return window.innerHeight || document.documentElement.clientHeight || 0;
},
_getScrollTop: function(){
return document.documentElement.scrollTop || window.pageYOffset || 0;
},
_getScrollLeft: function(){
return document.documentElement.scrollLeft || window.pageXOffset || 0;
}
};

File diff suppressed because it is too large Load Diff

View File

@ -1,157 +0,0 @@
Effect.ResizeWindow = Class.create();
Object.extend(Object.extend(Effect.ResizeWindow.prototype, Effect.Base.prototype), {
initialize: function(win, top, left, width, height) {
this.window = win;
this.window.resizing = true;
var size = win.getSize();
this.initWidth = parseFloat(size.width);
this.initHeight = parseFloat(size.height);
var location = win.getLocation();
this.initTop = parseFloat(location.top);
this.initLeft = parseFloat(location.left);
this.width = width != null ? parseFloat(width) : this.initWidth;
this.height = height != null ? parseFloat(height) : this.initHeight;
this.top = top != null ? parseFloat(top) : this.initTop;
this.left = left != null ? parseFloat(left) : this.initLeft;
this.dx = this.left - this.initLeft;
this.dy = this.top - this.initTop;
this.dw = this.width - this.initWidth;
this.dh = this.height - this.initHeight;
this.r2 = $(this.window.getId() + "_row2");
this.content = $(this.window.getId() + "_content");
this.contentOverflow = this.content.getStyle("overflow") || "auto";
this.content.setStyle({overflow: "hidden"});
// Wired mode
if (this.window.options.wiredDrag) {
this.window.currentDrag = win._createWiredElement();
this.window.currentDrag.show();
this.window.element.hide();
}
this.start(arguments[5]);
},
update: function(position) {
var width = Math.floor(this.initWidth + this.dw * position);
var height = Math.floor(this.initHeight + this.dh * position);
var top = Math.floor(this.initTop + this.dy * position);
var left = Math.floor(this.initLeft + this.dx * position);
if (window.ie) {
if (Math.floor(height) == 0)
this.r2.hide();
else if (Math.floor(height) >1)
this.r2.show();
}
this.r2.setStyle({height: height});
this.window.setSize(width, height);
this.window.setLocation(top, left);
},
finish: function(position) {
// Wired mode
if (this.window.options.wiredDrag) {
this.window._hideWiredElement();
this.window.element.show();
}
this.window.setSize(this.width, this.height);
this.window.setLocation(this.top, this.left);
this.r2.setStyle({height: null});
this.content.setStyle({overflow: this.contentOverflow});
this.window.resizing = false;
}
});
Effect.ModalSlideDown = function(element) {
var windowScroll = WindowUtilities.getWindowScroll();
var height = element.getStyle("height");
element.setStyle({top: - (parseFloat(height) - windowScroll.top) + "px"});
element.show();
return new Effect.Move(element, Object.extend({ x: 0, y: parseFloat(height) }, arguments[1] || {}));
};
Effect.ModalSlideUp = function(element) {
var height = element.getStyle("height");
return new Effect.Move(element, Object.extend({ x: 0, y: -parseFloat(height) }, arguments[1] || {}));
};
PopupEffect = Class.create();
PopupEffect.prototype = {
initialize: function(htmlElement) {
this.html = $(htmlElement);
this.options = Object.extend({className: "popup_effect", duration: 0.4}, arguments[1] || {});
},
show: function(element, options) {
var position = Position.cumulativeOffset(this.html);
var size = this.html.getDimensions();
var bounds = element.win.getBounds();
this.window = element.win;
// Create a div
if (!this.div) {
this.div = document.createElement("div");
this.div.className = this.options.className;
this.div.style.height = size.height + "px";
this.div.style.width = size.width + "px";
this.div.style.top = position[1] + "px";
this.div.style.left = position[0] + "px";
this.div.style.position = "absolute"
document.body.appendChild(this.div);
}
if (this.options.fromOpacity)
this.div.setStyle({opacity: this.options.fromOpacity})
this.div.show();
var style = "top:" + bounds.top + ";left:" +bounds.left + ";width:" + bounds.width +";height:" + bounds.height;
if (this.options.toOpacity)
style += ";opacity:" + this.options.toOpacity;
new Effect.Morph(this.div ,{style: style, duration: this.options.duration, afterFinish: this._showWindow.bind(this)});
},
hide: function(element, options) {
var position = Position.cumulativeOffset(this.html);
var size = this.html.getDimensions();
this.window.visible = true;
var bounds = this.window.getBounds();
this.window.visible = false;
this.window.element.hide();
this.div.style.height = bounds.height;
this.div.style.width = bounds.width;
this.div.style.top = bounds.top;
this.div.style.left = bounds.left;
if (this.options.toOpacity)
this.div.setStyle({opacity: this.options.toOpacity})
this.div.show();
var style = "top:" + position[1] + "px;left:" + position[0] + "px;width:" + size.width +"px;height:" + size.height + "px";
if (this.options.fromOpacity)
style += ";opacity:" + this.options.fromOpacity;
new Effect.Morph(this.div ,{style: style, duration: this.options.duration, afterFinish: this._hideDiv.bind(this)});
},
_showWindow: function() {
this.div.hide();
this.window.element.show();
},
_hideDiv: function() {
this.div.hide();
}
}

View File

@ -1,115 +0,0 @@
// Copyright (c) 2006 Sébastien Gruhier (http://xilinus.com, http://itseb.com)
// YOU MUST INCLUDE window.js BEFORE
//
// Object to store hide/show windows status in a cookie
// Just add at the end of your HTML file this javascript line: WindowStore.init()
WindowStore = {
doSetCookie: false,
cookieName: "__window_store__",
expired: null,
// Init function with two optional parameters
// - cookieName (default = __window_store__)
// - expiration date (default 3 years from now)
init: function(cookieName, expired) {
WindowStore.cookieName = cookieName || WindowStore.cookieName
if (! expired) {
var today = new Date();
today.setYear(today.getYear()+1903);
WindowStore.expired = today;
}
else
WindowStore.expired = expired;
Windows.windows.each(function(win) {
win.setCookie(win.getId(), WindowStore.expired);
});
// Create observer on show/hide events
var myObserver = {
onShow: function(eventName, win) {
WindowStore._saveCookie();
},
onClose: function(eventName, win) {
WindowStore._saveCookie();
},
onHide: function(eventName, win) {
WindowStore._saveCookie();
}
}
Windows.addObserver(myObserver);
WindowStore._restoreWindows();
WindowStore._saveCookie();
},
show: function(win) {
eval("var cookie = " + WindowUtilities.getCookie(WindowStore.cookieName));
if (cookie != null) {
if (cookie[win.getId()])
win.show();
}
else
win.show();
},
// Function to store windows show/hide status in a cookie
_saveCookie: function() {
if (!doSetCookie)
return;
var cookieValue = "{";
Windows.windows.each(function(win) {
if (cookieValue != "{")
cookieValue += ","
cookieValue += win.getId() + ": " + win.isVisible();
});
cookieValue += "}"
WindowUtilities.setCookie(cookieValue, [WindowStore.cookieName, WindowStore.expired]);
},
// Function to restore windows show/hide status from a cookie if exists
_restoreWindows: function() {
eval("var cookie = " + WindowUtilities.getCookie(WindowStore.cookieName));
if (cookie != null) {
doSetCookie = false;
Windows.windows.each(function(win) {
if (cookie[win.getId()])
win.show();
});
}
doSetCookie = true;
}
}
// Object to set a close key an all windows
WindowCloseKey = {
keyCode: Event.KEY_ESC,
init: function(keyCode) {
if (keyCode)
WindowCloseKey.keyCode = keyCode;
Event.observe(document, 'keydown', this._closeCurrentWindow.bindAsEventListener(this));
},
_closeCurrentWindow: function(event) {
var e = event || window.event
var characterCode = e.which || e.keyCode;
// Check if there is a top window (it means it's an URL content)
var win = top.Windows.focusedWindow;
if (characterCode == WindowCloseKey.keyCode && win) {
if (win.cancelCallback)
top.Dialog.cancelCallback();
else if (win.okCallback)
top.Dialog.okCallback();
else
top.Windows.close(top.Windows.focusedWindow.getId());
}
}
}

Binary file not shown.

View File

@ -649,6 +649,7 @@ function cleanSerialize(expr) {
Author: Regis Houssin, Laurent Destailleur
Licence: GPL
==================================================================*/
/* @deprecated Replaced by jquery code
function dialogConfirm(title,linkurlyes,linkurlno,message,ok,cancel,objectID) {
Dialog.confirm(message, {
width:560,
@ -661,6 +662,7 @@ function dialogConfirm(title,linkurlyes,linkurlno,message,ok,cancel,objectID) {
cancel:function(win) { if (linkurlno!='') { window.location.href=linkurlno; return true; } }
});
}
*/
/*=================================================================
Purpose: Affiche une fenetre (Use PWC)
@ -668,6 +670,7 @@ function dialogConfirm(title,linkurlyes,linkurlno,message,ok,cancel,objectID) {
Author: Regis Houssin
Licence: GPL
==================================================================*/
/* @deprecated Replaced by jquery code
function dialogWindow(message,windowTitle) {
var win = new Window({className: "dialog",
width:600,
@ -679,11 +682,10 @@ var win = new Window({className: "dialog",
hideEffect: Effect.SwitchOff,
draggable:true
})
/*win.setHTMLContent(message);*/
/*win.getContent().innerHTML = message;*/
win.getContent().update(message);
win.showCenter();
}
*/
/*=================================================================

View File

@ -799,12 +799,10 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
}
}
if (! defined('DISABLE_JQUERY') && $conf->global->MAIN_USE_JQUERY)
if (! defined('DISABLE_JQUERY'))
{
print '<!-- Includes for JQuery (Ajax library) -->'."\n";
print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/jquery/themes/base/jquery-ui.css" type="text/css" />'."\n";
print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/jquery/themes/base/jquery.ui.all.css" type="text/css" />'."\n";
print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/jquery/themes/base/jquery.ui.autocomplete.css" type="text/css" />'."\n";
print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/jquery/css/smoothness/jquery-ui-1.8.4.custom.css" type="text/css" />'."\n";
}
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="top" title="'.$langs->trans("Home").'" href="'.(DOL_URL_ROOT?DOL_URL_ROOT:'/').'">'."\n";
@ -829,27 +827,19 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
// This one is required for all Ajax features
if (! defined('DISABLE_PROTOTYPE'))
{
print '<!-- Includes for Prototype (Used by Scriptaculous and PWC) -->'."\n";
print '<!-- Includes for Prototype (Used by Scriptaculous) -->'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/lib/prototype'.$mini.$ext.'"></script>'."\n";
}
// This one is required for boxes
if (! defined('DISABLE_SCRIPTACULOUS'))
{
print '<!-- Includes for Scriptaculous (Used by Drag and drop and PWC) -->'."\n";
print '<!-- Includes for Scriptaculous (Used by Drag and Drop) -->'."\n";
//print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/scriptaculous.js"></script>'."\n";
//print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/scriptaculous.js?load=builder,effects,dragdrop,controls,slider,sound"></script>'."\n";
$listofscripts='effects,dragdrop';
if ($conf->global->COMPANY_USE_SEARCH_TO_SELECT) $listofscripts.=',controls'; // For Ajax.Autocompleter
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/src/scriptaculous.js?load='.$listofscripts.'"></script>'."\n";
}
// Those ones are required only with option "confirm by ajax popup"
if (! defined('DISABLE_PWC') && $conf->global->MAIN_CONFIRM_AJAX)
{
print '<!-- Includes for PWC (Used for confirm popup) -->'."\n";
// PWC js
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/pwc/window'.$mini.$ext.'"></script>'."\n";
}
}
// Output module javascript