Bugfix on permissions verification (on domain admin was able to access any domain :p)

Added help tips when filling forms (domain, mailbox, etc.)
French translation update.

Tips class added to mootools-more.js is not the official version (1.2.4.2). There are some bugs with this version so I've decided to integrate modifications coming from here : https://mootools.lighthouseapp.com/projects/24057/tickets/167-tips-class-issues-in-more-1242
This commit is contained in:
tonio
2009-10-30 11:28:40 +01:00
parent f05cd1ffeb
commit 3fe149adb0
22 changed files with 451 additions and 108 deletions
-1
View File
@@ -55,7 +55,6 @@ window.addEvent('domready', function() {
});
$('body').addEvent('submit', function(event) {
alert("newodm submit");
target = event.target;
if (target.get('tag') == 'form') {
name = target.get('name');
+8
View File
@@ -50,4 +50,12 @@ window.addEvent("domready", function() {
if ($("chpwdform"))
$("chpwdform").addEvent("submit", chpassword_submit);
$$("input[type!=submit]", "select").each(function(elt) {
elt.store("tip:title", gettext("Help"));
if ($(elt.name + "_helptext")) {
elt.store("tip:text", $(elt.name + "_helptext").get("html"));
}
});
var tip = new Tips($$("input[type!=submit]", "select"));
});
+202 -5
View File
@@ -23,8 +23,8 @@ provides: [MooTools.More]
*/
MooTools.More = {
'version': '1.2.4.2dev',
'build': '%build%'
'version': '1.2.4.2',
'build': 'bd5a93c0913cce25917c48cbdacde568e15e02ef'
};
/*
@@ -53,7 +53,8 @@ Fx.Slide = new Class({
Extends: Fx,
options: {
mode: 'vertical'
mode: 'vertical',
hideOverflow: true
},
initialize: function(element, options){
@@ -64,9 +65,10 @@ Fx.Slide = new Class({
this.element = this.subject = document.id(element);
this.parent(options);
var wrapper = this.element.retrieve('wrapper');
var styles = this.element.getStyles('margin', 'position', 'overflow');
if (this.options.hideOverflow) styles = $extend(styles, {overflow: 'hidden'});
this.wrapper = wrapper || new Element('div', {
styles: $extend(this.element.getStyles('margin', 'position'), {overflow: 'hidden'})
/*styles: this.element.getStyles('margin', 'position', 'overflow', 'hidden')*/
styles: styles
}).wraps(this.element);
this.element.store('wrapper', this.wrapper).setStyle('margin', 0);
this.now = [];
@@ -178,3 +180,198 @@ Element.implement({
}
});
/*
---
script: Tips.js
description: Class for creating nice tips that follow the mouse cursor when hovering an element.
license: MIT-style license
authors:
- Valerio Proietti
- Christoph Pojer
requires:
- core:1.2.4/Options
- core:1.2.4/Events
- core:1.2.4/Element.Event
- core:1.2.4/Element.Style
- core:1.2.4/Element.Dimensions
- /MooTools.More
provides: [Tips]
...
*/
(function(){
var read = function(option, element){
return (option) ? ($type(option) == 'function' ? option(element) : element.get(option)) : '';
};
this.Tips = new Class({
Implements: [Events, Options],
options: {
/*
onAttach: $empty(element),
onDetach: $empty(element),
*/
onShow: function(){
this.tip.setStyle('display', 'block');
},
onHide: function(){
this.tip.setStyle('display', 'none');
},
title: 'title',
text: function(element){
return element.get('rel') || element.get('href');
},
showDelay: 100,
hideDelay: 100,
className: 'tip-wrap',
offset: {x: 16, y: 16},
fixed: false
},
initialize: function(){
var params = Array.link(arguments, {options: Object.type, elements: $defined});
this.setOptions(params.options);
document.id(this);
if (params.elements) this.attach(params.elements);
},
toElement: function(){
if (this.tip) return this.tip;
this.container = new Element('div', {'class': 'tip'});
return this.tip = new Element('div', {
'class': this.options.className,
styles: {
position: 'absolute',
top: 0,
left: 0,
visibility: 'hidden',
display: 'none'
}
}).adopt(
new Element('div', {'class': 'tip-top'}),
this.container,
new Element('div', {'class': 'tip-bottom'})
).inject(document.body);
},
attach: function(elements){
$$(elements).each(function(element){
var title = read(this.options.title, element),
text = read(this.options.text, element);
element.erase('title').store('tip:native', title).retrieve('tip:title', title);
element.retrieve('tip:text', text);
this.fireEvent('attach', [element]);
var events = ['enter', 'leave'];
if (!this.options.fixed) events.push('move');
events.each(function(value){
var event = element.retrieve('tip:' + value);
if (!event) event = this['element' + value.capitalize()].bindWithEvent(this, element);
element.store('tip:' + value, event).addEvent('mouse' + value, event);
}, this);
element.addEvent('mouseout', this.hide.bind(this, element)); // firefox doesn't handle mouseleave correct
}, this);
return this;
},
detach: function(elements){
$$(elements).each(function(element){
['enter', 'leave', 'move'].each(function(value){
element.removeEvent('mouse' + value, element.retrieve('tip:' + value)).eliminate('tip:' + value);
});
this.fireEvent('detach', [element]);
if (this.options.title == 'title'){ // This is necessary to check if we can revert the title
var original = element.retrieve('tip:native');
if (original) element.set('title', original);
}
}, this);
return this;
},
elementEnter: function(event, element){
this.container.empty();
['title', 'text'].each(function(value){
var content = element.retrieve('tip:' + value);
if (content) this.fill(new Element('div', {'class': 'tip-' + value}).inject(this.container), content);
}, this);
$clear(this.timer);
this.timer = this.show.delay(this.options.showDelay, this, [element, event]);
},
elementLeave: function(event, element){
this.tip.setStyle('visibility', 'hidden');
$clear(this.timer);
this.timer = this.hide.delay(this.options.hideDelay, this, element);
this.fireForParent(event, element);
},
fireForParent: function(event, element){
var element = $(element);
if (!element) return;
parentNode = element.getParent();
if (parentNode == document.body) return;
if (parentNode.retrieve('tip:enter')) parentNode.fireEvent('mouseenter', event);
else this.fireForParent(event, parentNode);
},
elementMove: function(event, element) {
this.position(event);
},
position: function(event){
if (this.tip.getStyle('display') != 'block') return;
var size = window.getSize(), scroll = window.getScroll(),
tip = {x: this.tip.offsetWidth, y: this.tip.offsetHeight},
props = {x: 'left', y: 'top'},
obj = {};
for (var z in props){
obj[props[z]] = event.page[z] + this.options.offset[z];
if ((obj[props[z]] + tip[z] - scroll[z]) > size[z]) obj[props[z]] = event.page[z] - this.options.offset[z] - tip[z];
}
this.tip.setStyles(obj);
this.tip.setStyle('visibility', 'visible');
},
fill: function(element, contents){
if(typeof contents == 'string') element.set('html', contents);
else element.adopt(contents);
},
show: function(element, event) {
this.fireEvent('show', [this.tip, element]);
this.position((this.options.fixed) ? {page: element.getPosition()} : event);
},
hide: function(element){
this.fireEvent('hide', [this.tip, element]);
}
});
})();
+5
View File
@@ -337,3 +337,8 @@ body {
float: left;
font-style: italic;
}
#notifybox {
margin: 20px;
font-weight: bold;
}
+25 -1
View File
@@ -101,4 +101,28 @@ input:hover {
#dlg-buttons input {
width: 90px;
}
}
/* Mootools tooltips */
.tip {
color: #fff;
width: 139px;
z-index: 13000;
border: 1px solid #cccccc;
}
.tip-title {
font-weight: bold;
font-size: 11px;
margin: 0;
color: #9FD4FF;
padding: 8px 8px 4px;
background: #eee;
}
.tip-text {
font-size: 11px;
padding: 4px 8px 8px;
background: #eee;
color: black;
}