Mise jour de scriptaculous (version 1.7.1_beta3) seul compatible avec Prototype 1.5.1

Dbut ajout de tooltips "Prototip", essai en cours sur les lignes produits d'une propale, ce tooltip est actif et montre la description produit lorsque cette dernire est dsactive en visualisation dans les formulaires.
This commit is contained in:
Regis Houssin
2007-07-30 19:03:25 +00:00
parent 180dbf84b6
commit 71207a0035
14 changed files with 1421 additions and 492 deletions

View File

@@ -1064,11 +1064,19 @@ if ($_GET['propalid'] > 0)
{ {
print '<td>'; print '<td>';
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'; $text = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">';
if ($objp->fk_product_type==1) print img_object($langs->trans('ShowService'),'service'); if ($objp->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service');
else print img_object($langs->trans('ShowProduct'),'product'); else $text.= img_object($langs->trans('ShowProduct'),'product');
print ' '.$objp->ref.'</a>'; $text.= ' '.$objp->ref.'</a>';
print ' - '.nl2br(stripslashes($objp->product)); $text.= ' - '.nl2br(stripslashes($objp->product));
if ($conf->global->PRODUIT_DESC_IN_FORM)
{
print $text;
}
else
{
print $html->textwithtooltip($text,$objp->description,4,'','',$i+1,$objp->ref.' - '.nl2br(stripslashes($objp->product)));
}
print_date_range($objp->date_start,$objp->date_end); print_date_range($objp->date_start,$objp->date_end);
if ($conf->global->PRODUIT_DESC_IN_FORM) if ($conf->global->PRODUIT_DESC_IN_FORM)

View File

@@ -713,8 +713,8 @@ else
print '<input class="flat" type="text" size="40" name="search_societe" value="'.$_GET['search_societe'].'">'; print '<input class="flat" type="text" size="40" name="search_societe" value="'.$_GET['search_societe'].'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" colspan="1" align="right">'; print '<td class="liste_titre" colspan="1" align="right">';
print 'mois : ' . '<input class="flat" type="text" size="3" name="month" value="'.$month.'">'; print $langs->trans('Month').' : ' . '<input class="flat" type="text" size="3" name="month" value="'.$month.'">';
print '&nbsp;ann&eacute;e : ' . '<input class="flat" type="text" size="5" name="year" value="'.$year.'">'; print '&nbsp;'.$langs->trans('Year').' : ' . '<input class="flat" type="text" size="5" name="year" value="'.$year.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$_GET['search_montant_ht'].'">'; print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$_GET['search_montant_ht'].'">';

View File

@@ -66,14 +66,14 @@ class Form
/** /**
\brief Affiche un texte+picto avec tooltip sur texte ou sur picto \brief Affiche un texte+picto avec tooltip sur texte ou sur picto
\param text Texte <20> afficher \param text Texte <20> afficher
\param htmltext Contenu html du tooltip, cod<6F> en html \param htmltext Contenu html du tooltip, cod<6F> en html
\param tooltipon 1=tooltip sur texte, 2=tooltip sur picto, 3=tooltip sur les 2 \param tooltipon 1=tooltip sur texte, 2=tooltip sur picto, 3=tooltip sur les 2, 4=tooltip ajax
\param direction -1=Le picto est avant, 0=pas de picto, 1=le picto est apr<70>s \param direction -1=Le picto est avant, 0=pas de picto, 1=le picto est apr<70>s
\param img Code img du picto \param img Code img du picto
\return string Code html du texte,picto \return string Code html du texte,picto
*/ */
function textwithtooltip($text,$htmltext,$tooltipon=1,$direction=0,$img='') function textwithtooltip($text,$htmltext,$tooltipon=1,$direction=0,$img='',$i=1,$option='')
{ {
global $conf; global $conf;
@@ -86,12 +86,17 @@ class Form
$htmltext=ereg_replace("'","\'",$htmltext); $htmltext=ereg_replace("'","\'",$htmltext);
$htmltext=ereg_replace("&#039;","\'",$htmltext); $htmltext=ereg_replace("&#039;","\'",$htmltext);
if ($conf->use_ajax && $tooltipon == 4) if ($conf->use_ajax && $conf->global->PRODUIT_DESC_IN_FORM && $tooltipon == 4)
{ {
$s = '<script type=\'text/javascript\'> $s = '<script type=\'text/javascript\'>
new Tip(\'tip1\', \''.$htmltext.'\');'; function init() {
//<![CDATA[
new Tip(\'tip'.$i.'\', \''.$htmltext.'\',{title : \''.$option.'\'});
//]]>
}
Event.observe(window, \'load\', init, false);';
$s.= '</script>'; $s.= '</script>';
$s.= '<span id="tip1">'.$text.'</span>'; $s.= '<span id="tip'.$i.'">'.$text.'</span>';
} }
else else
{ {

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
// script.aculo.us builder.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 // script.aculo.us builder.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007
// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// //
// script.aculo.us is freely distributable under the terms of an MIT-style license. // script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/ // For details, see the script.aculo.us web site: http://script.aculo.us/
@@ -48,7 +48,8 @@ var Builder = {
// attributes (or text) // attributes (or text)
if(arguments[1]) if(arguments[1])
if(this._isStringOrNumber(arguments[1]) || if(this._isStringOrNumber(arguments[1]) ||
(arguments[1] instanceof Array)) { (arguments[1] instanceof Array) ||
arguments[1].tagName) {
this._children(element, arguments[1]); this._children(element, arguments[1]);
} else { } else {
var attrs = this._attributes(arguments[1]); var attrs = this._attributes(arguments[1]);
@@ -66,7 +67,7 @@ var Builder = {
} }
if(element.tagName.toUpperCase() != elementName) if(element.tagName.toUpperCase() != elementName)
element = parentElement.getElementsByTagName(elementName)[0]; element = parentElement.getElementsByTagName(elementName)[0];
} }
} }
// text, or array of children // text, or array of children
@@ -88,10 +89,14 @@ var Builder = {
var attrs = []; var attrs = [];
for(attribute in attributes) for(attribute in attributes)
attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) + attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) +
'="' + attributes[attribute].toString().escapeHTML() + '"'); '="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'&quot;') + '"');
return attrs.join(" "); return attrs.join(" ");
}, },
_children: function(element, children) { _children: function(element, children) {
if(children.tagName) {
element.appendChild(children);
return;
}
if(typeof children=='object') { // array can hold nodes and text if(typeof children=='object') { // array can hold nodes and text
children.flatten().each( function(e) { children.flatten().each( function(e) {
if(typeof e=='object') if(typeof e=='object')
@@ -101,8 +106,8 @@ var Builder = {
element.appendChild(Builder._text(e)); element.appendChild(Builder._text(e));
}); });
} else } else
if(Builder._isStringOrNumber(children)) if(Builder._isStringOrNumber(children))
element.appendChild(Builder._text(children)); element.appendChild(Builder._text(children));
}, },
_isStringOrNumber: function(param) { _isStringOrNumber: function(param) {
return(typeof param=='string' || typeof param=='number'); return(typeof param=='string' || typeof param=='number');

View File

@@ -1,8 +1,8 @@
// script.aculo.us controls.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 // script.aculo.us controls.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007
// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// (c) 2005, 2006 Ivan Krstic (http://blogs.law.harvard.edu/ivan) // (c) 2005-2007 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
// (c) 2005, 2006 Jon Tirsen (http://www.tirsen.com) // (c) 2005-2007 Jon Tirsen (http://www.tirsen.com)
// Contributors: // Contributors:
// Richard Livsey // Richard Livsey
// Rahul Bhargava // Rahul Bhargava
@@ -43,7 +43,8 @@ var Autocompleter = {}
Autocompleter.Base = function() {}; Autocompleter.Base = function() {};
Autocompleter.Base.prototype = { Autocompleter.Base.prototype = {
baseInitialize: function(element, update, options) { baseInitialize: function(element, update, options) {
this.element = $(element); element = $(element)
this.element = element;
this.update = $(update); this.update = $(update);
this.hasFocus = false; this.hasFocus = false;
this.changed = false; this.changed = false;
@@ -83,15 +84,20 @@ Autocompleter.Base.prototype = {
Element.hide(this.update); Element.hide(this.update);
Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this)); Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this));
Event.observe(this.element, "keypress", this.onKeyPress.bindAsEventListener(this)); Event.observe(this.element, 'keypress', this.onKeyPress.bindAsEventListener(this));
// Turn autocomplete back on when the user leaves the page, so that the
// field's value will be remembered on Mozilla-based browsers.
Event.observe(window, 'beforeunload', function(){
element.setAttribute('autocomplete', 'on');
});
}, },
show: function() { show: function() {
if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
if(!this.iefix && if(!this.iefix &&
(navigator.appVersion.indexOf('MSIE')>0) && (Prototype.Browser.IE) &&
(navigator.userAgent.indexOf('Opera')<0) &&
(Element.getStyle(this.update, 'position')=='absolute')) { (Element.getStyle(this.update, 'position')=='absolute')) {
new Insertion.After(this.update, new Insertion.After(this.update,
'<iframe id="' + this.update.id + '_iefix" '+ '<iframe id="' + this.update.id + '_iefix" '+
@@ -141,17 +147,17 @@ Autocompleter.Base.prototype = {
case Event.KEY_UP: case Event.KEY_UP:
this.markPrevious(); this.markPrevious();
this.render(); this.render();
if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event); if(Prototype.Browser.WebKit) Event.stop(event);
return; return;
case Event.KEY_DOWN: case Event.KEY_DOWN:
this.markNext(); this.markNext();
this.render(); this.render();
if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event); if(Prototype.Browser.WebKit) Event.stop(event);
return; return;
} }
else else
if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
(navigator.appVersion.indexOf('AppleWebKit') > 0 && event.keyCode == 0)) return; (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return;
this.changed = true; this.changed = true;
this.hasFocus = true; this.hasFocus = true;
@@ -197,7 +203,6 @@ Autocompleter.Base.prototype = {
this.index==i ? this.index==i ?
Element.addClassName(this.getEntry(i),"selected") : Element.addClassName(this.getEntry(i),"selected") :
Element.removeClassName(this.getEntry(i),"selected"); Element.removeClassName(this.getEntry(i),"selected");
if(this.hasFocus) { if(this.hasFocus) {
this.show(); this.show();
this.active = true; this.active = true;
@@ -299,7 +304,6 @@ Autocompleter.Base.prototype = {
onObserverEvent: function() { onObserverEvent: function() {
this.changed = false; this.changed = false;
if(this.getToken().length>=this.options.minChars) { if(this.getToken().length>=this.options.minChars) {
this.startIndicator();
this.getUpdatedChoices(); this.getUpdatedChoices();
} else { } else {
this.active = false; this.active = false;
@@ -340,7 +344,9 @@ Object.extend(Object.extend(Ajax.Autocompleter.prototype, Autocompleter.Base.pro
}, },
getUpdatedChoices: function() { getUpdatedChoices: function() {
entry = encodeURIComponent(this.options.paramName) + '=' + this.startIndicator();
var entry = encodeURIComponent(this.options.paramName) + '=' +
encodeURIComponent(this.getToken()); encodeURIComponent(this.getToken());
this.options.parameters = this.options.callback ? this.options.parameters = this.options.callback ?
@@ -348,7 +354,7 @@ Object.extend(Object.extend(Ajax.Autocompleter.prototype, Autocompleter.Base.pro
if(this.options.defaultParams) if(this.options.defaultParams)
this.options.parameters += '&' + this.options.defaultParams; this.options.parameters += '&' + this.options.defaultParams;
new Ajax.Request(this.url, this.options); new Ajax.Request(this.url, this.options);
}, },
@@ -477,9 +483,14 @@ Ajax.InPlaceEditor.prototype = {
this.options = Object.extend({ this.options = Object.extend({
paramName: "value", paramName: "value",
okButton: true, okButton: true,
okLink: false,
okText: "ok", okText: "ok",
cancelButton: false,
cancelLink: true, cancelLink: true,
cancelText: "cancel", cancelText: "cancel",
textBeforeControls: '',
textBetweenControls: '',
textAfterControls: '',
savingText: "Saving...", savingText: "Saving...",
clickToEditText: "Click to edit", clickToEditText: "Click to edit",
okText: "ok", okText: "ok",
@@ -567,23 +578,52 @@ Ajax.InPlaceEditor.prototype = {
var br = document.createElement("br"); var br = document.createElement("br");
this.form.appendChild(br); this.form.appendChild(br);
} }
if (this.options.textBeforeControls)
this.form.appendChild(document.createTextNode(this.options.textBeforeControls));
if (this.options.okButton) { if (this.options.okButton) {
okButton = document.createElement("input"); var okButton = document.createElement("input");
okButton.type = "submit"; okButton.type = "submit";
okButton.value = this.options.okText; okButton.value = this.options.okText;
okButton.className = 'editor_ok_button'; okButton.className = 'editor_ok_button';
this.form.appendChild(okButton); this.form.appendChild(okButton);
} }
if (this.options.okLink) {
var okLink = document.createElement("a");
okLink.href = "#";
okLink.appendChild(document.createTextNode(this.options.okText));
okLink.onclick = this.onSubmit.bind(this);
okLink.className = 'editor_ok_link';
this.form.appendChild(okLink);
}
if (this.options.textBetweenControls &&
(this.options.okLink || this.options.okButton) &&
(this.options.cancelLink || this.options.cancelButton))
this.form.appendChild(document.createTextNode(this.options.textBetweenControls));
if (this.options.cancelButton) {
var cancelButton = document.createElement("input");
cancelButton.type = "submit";
cancelButton.value = this.options.cancelText;
cancelButton.onclick = this.onclickCancel.bind(this);
cancelButton.className = 'editor_cancel_button';
this.form.appendChild(cancelButton);
}
if (this.options.cancelLink) { if (this.options.cancelLink) {
cancelLink = document.createElement("a"); var cancelLink = document.createElement("a");
cancelLink.href = "#"; cancelLink.href = "#";
cancelLink.appendChild(document.createTextNode(this.options.cancelText)); cancelLink.appendChild(document.createTextNode(this.options.cancelText));
cancelLink.onclick = this.onclickCancel.bind(this); cancelLink.onclick = this.onclickCancel.bind(this);
cancelLink.className = 'editor_cancel'; cancelLink.className = 'editor_cancel editor_cancel_link';
this.form.appendChild(cancelLink); this.form.appendChild(cancelLink);
} }
if (this.options.textAfterControls)
this.form.appendChild(document.createTextNode(this.options.textAfterControls));
}, },
hasHTMLLineBreaks: function(string) { hasHTMLLineBreaks: function(string) {
if (!this.options.handleLineBreaks) return false; if (!this.options.handleLineBreaks) return false;

View File

@@ -1,7 +1,7 @@
// script.aculo.us dragdrop.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 // script.aculo.us dragdrop.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007
// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// (c) 2005, 2006 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz) // (c) 2005-2007 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
// //
// script.aculo.us is freely distributable under the terms of an MIT-style license. // script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/ // For details, see the script.aculo.us web site: http://script.aculo.us/
@@ -112,8 +112,10 @@ var Droppables = {
Position.prepare(); Position.prepare();
if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active)) if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
if (this.last_active.onDrop) if (this.last_active.onDrop) {
this.last_active.onDrop(element, this.last_active.element, event); this.last_active.onDrop(element, this.last_active.element, event);
return true;
}
}, },
reset: function() { reset: function() {
@@ -245,6 +247,7 @@ Draggable.prototype = {
}, },
zindex: 1000, zindex: 1000,
revert: false, revert: false,
quiet: false,
scroll: false, scroll: false,
scrollSensitivity: 20, scrollSensitivity: 20,
scrollSpeed: 15, scrollSpeed: 15,
@@ -353,8 +356,12 @@ Draggable.prototype = {
updateDrag: function(event, pointer) { updateDrag: function(event, pointer) {
if(!this.dragging) this.startDrag(event); if(!this.dragging) this.startDrag(event);
Position.prepare();
Droppables.show(pointer, this.element); if(!this.options.quiet){
Position.prepare();
Droppables.show(pointer, this.element);
}
Draggables.notify('onDrag', this, event); Draggables.notify('onDrag', this, event);
this.draw(pointer); this.draw(pointer);
@@ -382,13 +389,19 @@ Draggable.prototype = {
} }
// fix AppleWebKit rendering // fix AppleWebKit rendering
if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0); if(Prototype.Browser.WebKit) window.scrollBy(0,0);
Event.stop(event); Event.stop(event);
}, },
finishDrag: function(event, success) { finishDrag: function(event, success) {
this.dragging = false; this.dragging = false;
if(this.options.quiet){
Position.prepare();
var pointer = [Event.pointerX(event), Event.pointerY(event)];
Droppables.show(pointer, this.element);
}
if(this.options.ghosting) { if(this.options.ghosting) {
Position.relativize(this.element); Position.relativize(this.element);
@@ -396,7 +409,12 @@ Draggable.prototype = {
this._clone = null; this._clone = null;
} }
if(success) Droppables.fire(event, this.element); var dropped = false;
if(success) {
dropped = Droppables.fire(event, this.element);
if (!dropped) dropped = false;
}
if(dropped && this.options.onDropped) this.options.onDropped(this.element);
Draggables.notify('onEnd', this, event); Draggables.notify('onEnd', this, event);
var revert = this.options.revert; var revert = this.options.revert;
@@ -404,8 +422,9 @@ Draggable.prototype = {
var d = this.currentDelta(); var d = this.currentDelta();
if(revert && this.options.reverteffect) { if(revert && this.options.reverteffect) {
this.options.reverteffect(this.element, if (dropped == 0 || revert != 'failure')
d[1]-this.delta[1], d[0]-this.delta[0]); this.options.reverteffect(this.element,
d[1]-this.delta[1], d[0]-this.delta[0]);
} else { } else {
this.delta = d; this.delta = d;
} }
@@ -614,10 +633,17 @@ var Sortable = {
delay: 0, delay: 0,
hoverclass: null, hoverclass: null,
ghosting: false, ghosting: false,
quiet: false,
scroll: false, scroll: false,
scrollSensitivity: 20, scrollSensitivity: 20,
scrollSpeed: 15, scrollSpeed: 15,
format: this.SERIALIZE_RULE, format: this.SERIALIZE_RULE,
// these take arrays of elements or ids and can be
// used for better initialization performance
elements: false,
handles: false,
onChange: Prototype.emptyFunction, onChange: Prototype.emptyFunction,
onUpdate: Prototype.emptyFunction onUpdate: Prototype.emptyFunction
}, arguments[1] || {}); }, arguments[1] || {});
@@ -628,6 +654,7 @@ var Sortable = {
// build options for the draggables // build options for the draggables
var options_for_draggable = { var options_for_draggable = {
revert: true, revert: true,
quiet: options.quiet,
scroll: options.scroll, scroll: options.scroll,
scrollSpeed: options.scrollSpeed, scrollSpeed: options.scrollSpeed,
scrollSensitivity: options.scrollSensitivity, scrollSensitivity: options.scrollSensitivity,
@@ -681,10 +708,9 @@ var Sortable = {
options.droppables.push(element); options.droppables.push(element);
} }
(this.findElements(element, options) || []).each( function(e) { (options.elements || this.findElements(element, options) || []).each( function(e,i) {
// handles are per-draggable var handle = options.handles ? $(options.handles[i]) :
var handle = options.handle ? (options.handle ? $(e).getElementsByClassName(options.handle)[0] : e);
$(e).down('.'+options.handle,0) : e;
options.draggables.push( options.draggables.push(
new Draggable(e, Object.extend(options_for_draggable, { handle: handle }))); new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
Droppables.add(e, options_for_droppable); Droppables.add(e, options_for_droppable);
@@ -921,7 +947,7 @@ Element.isParent = function(child, element) {
return Element.isParent(child.parentNode, element); return Element.isParent(child.parentNode, element);
} }
Element.findChildren = function(element, only, recursive, tagName) { Element.findChildren = function(element, only, recursive, tagName) {
if(!element.hasChildNodes()) return null; if(!element.hasChildNodes()) return null;
tagName = tagName.toUpperCase(); tagName = tagName.toUpperCase();
if(only) only = [only].flatten(); if(only) only = [only].flatten();

View File

@@ -1,6 +1,6 @@
// script.aculo.us effects.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 // script.aculo.us effects.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007
// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// Contributors: // Contributors:
// Justin Palmer (http://encytemedia.com/) // Justin Palmer (http://encytemedia.com/)
// Mark Pilgrim (http://diveintomark.org/) // Mark Pilgrim (http://diveintomark.org/)
@@ -45,18 +45,10 @@ Element.collectTextNodesIgnoreClass = function(element, className) {
Element.setContentZoom = function(element, percent) { Element.setContentZoom = function(element, percent) {
element = $(element); element = $(element);
element.setStyle({fontSize: (percent/100) + 'em'}); element.setStyle({fontSize: (percent/100) + 'em'});
if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0); if(Prototype.Browser.WebKit) window.scrollBy(0,0);
return element; return element;
} }
Element.getOpacity = function(element){
return $(element).getStyle('opacity');
}
Element.setOpacity = function(element, value){
return $(element).setStyle({opacity:value});
}
Element.getInlineOpacity = function(element){ Element.getInlineOpacity = function(element){
return $(element).style.opacity || ''; return $(element).style.opacity || '';
} }
@@ -89,7 +81,7 @@ var Effect = {
throw("Effect.tagifyText requires including script.aculo.us' builder.js library"); throw("Effect.tagifyText requires including script.aculo.us' builder.js library");
var tagifyStyle = 'position:relative'; var tagifyStyle = 'position:relative';
if(/MSIE/.test(navigator.userAgent) && !window.opera) tagifyStyle += ';zoom:1'; if(Prototype.Browser.IE) tagifyStyle += ';zoom:1';
element = $(element); element = $(element);
$A(element.childNodes).each( function(child) { $A(element.childNodes).each( function(child) {
@@ -152,7 +144,8 @@ Effect.Transitions = {
return 1-pos; return 1-pos;
}, },
flicker: function(pos) { flicker: function(pos) {
return ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4; var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
return (pos > 1 ? 1 : pos);
}, },
wobble: function(pos) { wobble: function(pos) {
return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5; return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
@@ -179,7 +172,7 @@ Effect.ScopedQueue = Class.create();
Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), { Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), {
initialize: function() { initialize: function() {
this.effects = []; this.effects = [];
this.interval = null; this.interval = null;
}, },
_each: function(iterator) { _each: function(iterator) {
this.effects._each(iterator); this.effects._each(iterator);
@@ -213,7 +206,7 @@ Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), {
if(!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit)) if(!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
this.effects.push(effect); this.effects.push(effect);
if(!this.interval) if(!this.interval)
this.interval = setInterval(this.loop.bind(this), 15); this.interval = setInterval(this.loop.bind(this), 15);
}, },
remove: function(effect) { remove: function(effect) {
@@ -226,7 +219,7 @@ Object.extend(Object.extend(Effect.ScopedQueue.prototype, Enumerable), {
loop: function() { loop: function() {
var timePos = new Date().getTime(); var timePos = new Date().getTime();
for(var i=0, len=this.effects.length;i<len;i++) for(var i=0, len=this.effects.length;i<len;i++)
if(this.effects[i]) this.effects[i].loop(timePos); this.effects[i] && this.effects[i].loop(timePos);
} }
}); });
@@ -246,7 +239,7 @@ Effect.Queue = Effect.Queues.get('global');
Effect.DefaultOptions = { Effect.DefaultOptions = {
transition: Effect.Transitions.sinoidal, transition: Effect.Transitions.sinoidal,
duration: 1.0, // seconds duration: 1.0, // seconds
fps: 60.0, // max. 60fps due to Effect.Queue implementation fps: 100, // 100= assume 66fps max.
sync: false, // true for combining sync: false, // true for combining
from: 0.0, from: 0.0,
to: 1.0, to: 1.0,
@@ -258,11 +251,35 @@ Effect.Base = function() {};
Effect.Base.prototype = { Effect.Base.prototype = {
position: null, position: null,
start: function(options) { start: function(options) {
function codeForEvent(options,eventName){
return (
(options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') +
(options[eventName] ? 'this.options.'+eventName+'(this);' : '')
);
}
if(options.transition === false) options.transition = Effect.Transitions.linear;
this.options = Object.extend(Object.extend({},Effect.DefaultOptions), options || {}); this.options = Object.extend(Object.extend({},Effect.DefaultOptions), options || {});
this.currentFrame = 0; this.currentFrame = 0;
this.state = 'idle'; this.state = 'idle';
this.startOn = this.options.delay*1000; this.startOn = this.options.delay*1000;
this.finishOn = this.startOn + (this.options.duration*1000); this.finishOn = this.startOn+(this.options.duration*1000);
this.fromToDelta = this.options.to-this.options.from;
this.totalTime = this.finishOn-this.startOn;
this.totalFrames = this.options.fps*this.options.duration;
eval('this.render = function(pos){ '+
'if(this.state=="idle"){this.state="running";'+
codeForEvent(options,'beforeSetup')+
(this.setup ? 'this.setup();':'')+
codeForEvent(options,'afterSetup')+
'};if(this.state=="running"){'+
'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+
'this.position=pos;'+
codeForEvent(options,'beforeUpdate')+
(this.update ? 'this.update(pos);':'')+
codeForEvent(options,'afterUpdate')+
'}}');
this.event('beforeStart'); this.event('beforeStart');
if(!this.options.sync) if(!this.options.sync)
Effect.Queues.get(typeof this.options.queue == 'string' ? Effect.Queues.get(typeof this.options.queue == 'string' ?
@@ -278,31 +295,14 @@ Effect.Base.prototype = {
this.event('afterFinish'); this.event('afterFinish');
return; return;
} }
var pos = (timePos - this.startOn) / (this.finishOn - this.startOn); var pos = (timePos - this.startOn) / this.totalTime,
var frame = Math.round(pos * this.options.fps * this.options.duration); frame = Math.round(pos * this.totalFrames);
if(frame > this.currentFrame) { if(frame > this.currentFrame) {
this.render(pos); this.render(pos);
this.currentFrame = frame; this.currentFrame = frame;
} }
} }
}, },
render: function(pos) {
if(this.state == 'idle') {
this.state = 'running';
this.event('beforeSetup');
if(this.setup) this.setup();
this.event('afterSetup');
}
if(this.state == 'running') {
if(this.options.transition) pos = this.options.transition(pos);
pos *= (this.options.to-this.options.from);
pos += this.options.from;
this.position = pos;
this.event('beforeUpdate');
if(this.update) this.update(pos);
this.event('afterUpdate');
}
},
cancel: function() { cancel: function() {
if(!this.options.sync) if(!this.options.sync)
Effect.Queues.get(typeof this.options.queue == 'string' ? Effect.Queues.get(typeof this.options.queue == 'string' ?
@@ -358,7 +358,7 @@ Object.extend(Object.extend(Effect.Opacity.prototype, Effect.Base.prototype), {
this.element = $(element); this.element = $(element);
if(!this.element) throw(Effect._elementDoesNotExistError); if(!this.element) throw(Effect._elementDoesNotExistError);
// make this work on IE on elements without 'layout' // make this work on IE on elements without 'layout'
if(/MSIE/.test(navigator.userAgent) && !window.opera && (!this.element.currentStyle.hasLayout)) if(Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
this.element.setStyle({zoom: 1}); this.element.setStyle({zoom: 1});
var options = Object.extend({ var options = Object.extend({
from: this.element.getOpacity() || 0.0, from: this.element.getOpacity() || 0.0,
@@ -953,7 +953,7 @@ Object.extend(Object.extend(Effect.Morph.prototype, Effect.Base.prototype), {
effect.element.addClassName(effect.options.style); effect.element.addClassName(effect.options.style);
effect.transforms.each(function(transform) { effect.transforms.each(function(transform) {
if(transform.style != 'opacity') if(transform.style != 'opacity')
effect.element.style[transform.style.camelize()] = ''; effect.element.style[transform.style] = '';
}); });
} }
} else this.style = options.style.parseStyle(); } else this.style = options.style.parseStyle();
@@ -969,26 +969,28 @@ Object.extend(Object.extend(Effect.Morph.prototype, Effect.Base.prototype), {
}); });
} }
this.transforms = this.style.map(function(pair){ this.transforms = this.style.map(function(pair){
var property = pair[0].underscore().dasherize(), value = pair[1], unit = null; var property = pair[0], value = pair[1], unit = null;
if(value.parseColor('#zzzzzz') != '#zzzzzz') { if(value.parseColor('#zzzzzz') != '#zzzzzz') {
value = value.parseColor(); value = value.parseColor();
unit = 'color'; unit = 'color';
} else if(property == 'opacity') { } else if(property == 'opacity') {
value = parseFloat(value); value = parseFloat(value);
if(/MSIE/.test(navigator.userAgent) && !window.opera && (!this.element.currentStyle.hasLayout)) if(Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
this.element.setStyle({zoom: 1}); this.element.setStyle({zoom: 1});
} else if(Element.CSS_LENGTH.test(value)) } else if(Element.CSS_LENGTH.test(value)) {
var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/), var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/);
value = parseFloat(components[1]), unit = (components.length == 3) ? components[2] : null; value = parseFloat(components[1]);
unit = (components.length == 3) ? components[2] : null;
}
var originalValue = this.element.getStyle(property); var originalValue = this.element.getStyle(property);
return $H({ return {
style: property, style: property.camelize(),
originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
targetValue: unit=='color' ? parseColor(value) : value, targetValue: unit=='color' ? parseColor(value) : value,
unit: unit unit: unit
}); };
}.bind(this)).reject(function(transform){ }.bind(this)).reject(function(transform){
return ( return (
(transform.originalValue == transform.targetValue) || (transform.originalValue == transform.targetValue) ||
@@ -1000,17 +1002,19 @@ Object.extend(Object.extend(Effect.Morph.prototype, Effect.Base.prototype), {
}); });
}, },
update: function(position) { update: function(position) {
var style = $H(), value = null; var style = {}, transform, i = this.transforms.length;
this.transforms.each(function(transform){ while(i--)
value = transform.unit=='color' ? style[(transform = this.transforms[i]).style] =
$R(0,2).inject('#',function(m,v,i){ transform.unit=='color' ? '#'+
return m+(Math.round(transform.originalValue[i]+ (Math.round(transform.originalValue[0]+
(transform.targetValue[i] - transform.originalValue[i])*position)).toColorPart() }) : (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() +
(Math.round(transform.originalValue[1]+
(transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() +
(Math.round(transform.originalValue[2]+
(transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() :
transform.originalValue + Math.round( transform.originalValue + Math.round(
((transform.targetValue - transform.originalValue) * position) * 1000)/1000 + transform.unit; ((transform.targetValue - transform.originalValue) * position) * 1000)/1000 + transform.unit;
style[transform.style] = value; this.element.setStyle(style, true);
});
this.element.setStyle(style);
} }
}); });
@@ -1057,14 +1061,14 @@ Element.CSS_PROPERTIES = $w(
Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
String.prototype.parseStyle = function(){ String.prototype.parseStyle = function(){
var element = Element.extend(document.createElement('div')); var element = document.createElement('div');
element.innerHTML = '<div style="' + this + '"></div>'; element.innerHTML = '<div style="' + this + '"></div>';
var style = element.down().style, styleRules = $H(); var style = element.childNodes[0].style, styleRules = $H();
Element.CSS_PROPERTIES.each(function(property){ Element.CSS_PROPERTIES.each(function(property){
if(style[property]) styleRules[property] = style[property]; if(style[property]) styleRules[property] = style[property];
}); });
if(/MSIE/.test(navigator.userAgent) && !window.opera && this.indexOf('opacity') > -1) { if(Prototype.Browser.IE && this.indexOf('opacity') > -1) {
styleRules.opacity = this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]; styleRules.opacity = this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1];
} }
return styleRules; return styleRules;
@@ -1075,13 +1079,13 @@ Element.morph = function(element, style) {
return element; return element;
}; };
['setOpacity','getOpacity','getInlineOpacity','forceRerendering','setContentZoom', ['getInlineOpacity','forceRerendering','setContentZoom',
'collectTextNodes','collectTextNodesIgnoreClass','morph'].each( 'collectTextNodes','collectTextNodesIgnoreClass','morph'].each(
function(f) { Element.Methods[f] = Element[f]; } function(f) { Element.Methods[f] = Element[f]; }
); );
Element.Methods.visualEffect = function(element, effect, options) { Element.Methods.visualEffect = function(element, effect, options) {
s = effect.gsub(/_/, '-').camelize(); s = effect.dasherize().camelize();
effect_class = s.charAt(0).toUpperCase() + s.substring(1); effect_class = s.charAt(0).toUpperCase() + s.substring(1);
new Effect[effect_class](element, options); new Effect[effect_class](element, options);
return $(element); return $(element);

View File

@@ -1,6 +1,6 @@
// script.aculo.us scriptaculous.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 // script.aculo.us scriptaculous.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007
// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
@@ -24,25 +24,32 @@
// For details, see the script.aculo.us web site: http://script.aculo.us/ // For details, see the script.aculo.us web site: http://script.aculo.us/
var Scriptaculous = { var Scriptaculous = {
Version: '1.7.0', Version: '1.7.1_beta3',
require: function(libraryName) { require: function(libraryName) {
// inserting via DOM fails in Safari 2.0, so brute force approach // inserting via DOM fails in Safari 2.0, so brute force approach
document.write('<script type="text/javascript" src="'+libraryName+'"></script>'); document.write('<script type="text/javascript" src="'+libraryName+'"></script>');
}, },
REQUIRED_PROTOTYPE: '1.5.1',
load: function() { load: function() {
function convertVersionString(versionString){
var r = versionString.split('.');
return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
}
if((typeof Prototype=='undefined') || if((typeof Prototype=='undefined') ||
(typeof Element == 'undefined') || (typeof Element == 'undefined') ||
(typeof Element.Methods=='undefined') || (typeof Element.Methods=='undefined') ||
parseFloat(Prototype.Version.split(".")[0] + "." + (convertVersionString(Prototype.Version) <
Prototype.Version.split(".")[1]) < 1.5) convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
throw("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0"); throw("script.aculo.us requires the Prototype JavaScript framework >= " +
Scriptaculous.REQUIRED_PROTOTYPE);
$A(document.getElementsByTagName("script")).findAll( function(s) { $A(document.getElementsByTagName("script")).findAll( function(s) {
return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/)) return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
}).each( function(s) { }).each( function(s) {
var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,''); var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
var includes = s.src.match(/\?.*load=([a-z,]*)/); var includes = s.src.match(/\?.*load=([a-z,]*)/);
(includes ? includes[1] : 'builder,effects,dragdrop,controls,slider').split(',').each( (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each(
function(include) { Scriptaculous.require(path+include+'.js') }); function(include) { Scriptaculous.require(path+include+'.js') });
}); });
} }

View File

@@ -1,6 +1,6 @@
// script.aculo.us slider.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 // script.aculo.us slider.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007
// Copyright (c) 2005, 2006 Marty Haught, Thomas Fuchs // Copyright (c) 2005-2007 Marty Haught, Thomas Fuchs
// //
// script.aculo.us is freely distributable under the terms of an MIT-style license. // script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/ // For details, see the script.aculo.us web site: http://script.aculo.us/
@@ -242,8 +242,7 @@ Control.Slider.prototype = {
if(this.active) { if(this.active) {
if(!this.dragging) this.dragging = true; if(!this.dragging) this.dragging = true;
this.draw(event); this.draw(event);
// fix AppleWebKit rendering if(Prototype.Browser.WebKit) window.scrollBy(0,0);
if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
Event.stop(event); Event.stop(event);
} }
}, },

View File

@@ -0,0 +1,60 @@
// script.aculo.us sound.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//
// Based on code created by Jules Gravinese (http://www.webveteran.com/)
//
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/
Sound = {
tracks: {},
_enabled: true,
template:
new Template('<embed style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>'),
enable: function(){
Sound._enabled = true;
},
disable: function(){
Sound._enabled = false;
},
play: function(url){
if(!Sound._enabled) return;
var options = Object.extend({
track: 'global', url: url, replace: false
}, arguments[1] || {});
if(options.replace && this.tracks[options.track]) {
$R(0, this.tracks[options.track].id).each(function(id){
var sound = $('sound_'+options.track+'_'+id);
sound.Stop && sound.Stop();
sound.remove();
})
this.tracks[options.track] = null;
}
if(!this.tracks[options.track])
this.tracks[options.track] = { id: 0 }
else
this.tracks[options.track].id++;
options.id = this.tracks[options.track].id;
if (Prototype.Browser.IE) {
var sound = document.createElement('bgsound');
sound.setAttribute('id','sound_'+options.track+'_'+options.id);
sound.setAttribute('src',options.url);
sound.setAttribute('loop','1');
sound.setAttribute('autostart','true');
$$('body')[0].appendChild(sound);
}
else
new Insertion.Bottom($$('body')[0], Sound.template.evaluate(options));
}
};
if(Prototype.Browser.Gecko && navigator.userAgent.indexOf("Win") > 0){
if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('QuickTime') != -1 }))
Sound.template = new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>')
else
Sound.play = function(){}
}

View File

@@ -1,8 +1,8 @@
// script.aculo.us unittest.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 // script.aculo.us unittest.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007
// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// (c) 2005, 2006 Jon Tirsen (http://www.tirsen.com) // (c) 2005-2007 Jon Tirsen (http://www.tirsen.com)
// (c) 2005, 2006 Michael Schuerig (http://www.schuerig.de/michael/) // (c) 2005-2007 Michael Schuerig (http://www.schuerig.de/michael/)
// //
// script.aculo.us is freely distributable under the terms of an MIT-style license. // script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/ // For details, see the script.aculo.us web site: http://script.aculo.us/

View File

@@ -1269,12 +1269,13 @@ form.inplaceeditor-form a { /* The cancel link */
/* Ajax - Tooltip */ /* Ajax - Tooltip */
/* ============================================================================== */ /* ============================================================================== */
.tooltip { .tooltip {
width: 150px; width: 500px;
color: #fff; color: #fff;
} }
.tooltip .title { .tooltip .title {
background: #0F6788; background: #0F6788;
font: italic 17px Georgia, serif; font: 15px Arial, Helvetica, sans-serif;
font-weight: bold;
padding: 5px; padding: 5px;
} }
.tooltip .content { .tooltip .content {

View File

@@ -1355,3 +1355,21 @@ div.menuFleche
} }
/* ============================================================================== */
/* Ajax - Tooltip */
/* ============================================================================== */
.tooltip {
width: 500px;
color: #fff;
}
.tooltip .title {
background: #0F6788;
font: 15px Arial, Helvetica, sans-serif;
font-weight: bold;
padding: 5px;
}
.tooltip .content {
background: dodgerblue;
font: 11px Arial, Helvetica, sans-serif;
padding: 5px;
}