From 8d8ede930caaa351570838e3b1ee65ea13550a78 Mon Sep 17 00:00:00 2001
From: Benjamin Renard
- */
-
- log: function(){
- var args = $A(arguments);
- var spacer = ' ';
- if ($type(args[0]) == 'string'){
- spacer = '';
- var logCollection = [], lastIndex = 0;
- var regexp = /%[sdifo]/gi;
- for (var i = 1; (i < args.length) && (token = regexp.exec(args[0])); i++){
- logCollection.push(args[0].substring(lastIndex, token.index), args[i]);
- lastIndex = regexp.lastIndex;
- }
- regexp.lastIndex = 0;
- if (!lastIndex) return debug.result(args);
- logCollection.push(args[0].substring(lastIndex));
- args = logCollection;
- }
- return debug.result(args, spacer);
- },
-
- /*
- Property: assert
- Tests that an expression is true. If not, logs a message and throws an error.
-
- Arguments:
- condition - a boolean expression. If false, message will be logged and an error will be thrown.
- messages - optional, any number of strings, objects, etc. to print out when thruth is false.
-
- Example:
- >console.assert((value > 0) && (value <= max), "value (%i) was not properly initialized", value);
- */
-
- assert: function(condition){
- if (!condition){
- var args = $A(arguments, 1);
- debug.log.apply(debug, args.length ? args : ["Assertion Failure"]);
- throw new Error("Assertion Failure");
- }
- },
-
- /*
- Property: time
- Starts a timer.
- Argument:
- name - the name of the timer
- */
-
- time: function(name){
- debug.timers[name] = new Date().getTime();
- },
-
- /*
- Property: timeEnd
- Ends a timer and logs that value to the console.
- Argument:
- name - the name of the timer
- */
-
- timeEnd: function(name){
- if (debug.timers[name]) debug.log('%s: %s', name, new Date().getTime() - debug.timers[name]);
- else debug.log('no such timer: %s', name);
- },
-
- /*
- Property: create
- Displays the console area.
- */
- create: function(){
- //main element
- debug._body = new Element('div').setStyles({
- 'position': window.ie6 ? 'absolute' : 'fixed',
- 'background': '#fff',
- 'font': '11px Andale Mono, Monaco, Courier New',
- 'z-index': '996'
- }).injectInside(document.body);
-
- //links
- debug._actions = new Element('div').setStyles({
- 'text-align': 'right',
- 'background-color': '#f5f5f5',
- 'border-bottom': '1px solid #ddd',
- 'border-top': '1px solid #ddd',
- 'padding': '2px 10px',
- 'margin': '0px',
- 'font-size': '10px'
- }).injectInside(debug._body);
- new Element('span').setHTML('CLEAR').injectInside(debug._actions).addEvent('click', function(){
- debug._contents.setHTML('');
- }).setStyle('cursor', 'pointer');
- new Element('span').setHTML(' | ').injectInside(debug._actions);
- debug._minLink = new Element('span').setHTML('MIN').injectInside(debug._actions).addEvent('click', function(){
- debug.minmax();
- }).setStyle('cursor', 'pointer');
- debug._maxLink = new Element('span').setHTML('MAX').injectInside(debug._actions).addEvent('click', function(){
- debug.minmax(true);
- }).setStyle('cursor', 'pointer');
-
- var debuggerStatus = Cookie.get('mootools-debugger-status');
- ((debuggerStatus && (debuggerStatus.toInt() < 50)) ? debug._minLink : debug._maxLink).setStyle('display', 'none');
-
- new Element('span').setHTML(' | ').injectInside(debug._actions);
- new Element('span').setHTML('CLOSE').injectInside(debug._actions).addEvent('click', function(){
- window.removeEvent('resize', debug.resize);
- debug._body.remove();
- debug._body = false;
- }).setStyle('cursor', 'pointer');
-
- //messages container
- debug._contents = new Element('div').setStyles({
- 'position': 'relative',
- 'z-index': '9997',
- 'height': debuggerStatus || '112px',
- 'border-bottom': '1px solid #ddd',
- 'overflow': 'auto',
- 'background': '#fff'
- }).injectInside(debug._body);
- if (window.ie6) debug._contents.setStyle('width', '100%');
-
- //input box
- debug._input = new Element('input').setProperty('type', 'text').setStyles({
- 'z-index': '9996',
- 'width': '98%',
- 'background': '#fff',
- 'color': '#222',
- 'font': '12px Andale Mono, Monaco, Courier New',
- 'height': '16px',
- 'border': '0',
- 'padding': '2px 2px 2px 31px',
- 'position': 'relative',
- 'margin-top': '-1px'
- }).injectInside(debug._body);
-
- //>>>
- debug._gts = new Element('div').setHTML(">>>").setStyles({
- 'color': '#3e72b2',
- 'padding': '2px 5px',
- 'background': '#fff',
- 'z-index': '9999',
- 'position': 'absolute',
- 'left': '0'
- }).injectInside(debug._body);
-
- if (window.webkit){
- debug._input.setStyles({
- 'margin-top': '-2px',
- 'margin-left': '29px',
- 'font-size': '12px',
- 'opacity': '0.99'
- });
- };
-
- debug._scroll = new Fx.Scroll(debug._contents, {duration: 300, wait: false});
- debug.resetHeight();
- window.addEvent('resize', debug.resize);
- if (window.ie6) window.addEvent('scroll', debug.resetHeight);
-
- debug._input.onkeydown = debug.parseKey.bindWithEvent(debug);
- },
-
- resetHeight: function(){
- debug._hgt = debug._body.offsetHeight;
- if (!window.webkit) debug._hgt -= 3;
- else debug._hgt -= 1;
- debug._gts.setStyle('top', (debug._hgt - debug._gts.offsetHeight - 1));
- debug.resize();
- debug._scroll.toBottom();
- },
-
- resize: function(){
- if (window.ie6){
- debug._body.setStyles({
- 'top': (window.getScrollTop() + window.getHeight() - debug._hgt - 5),
- 'width': (window.getWidth() - 16)
- });
- } else {
- debug._body.setStyles({
- 'top': (window.getHeight() - debug._hgt + 1),
- 'width': (window.getWidth())
- });
- }
-
- },
-
- minmax: function(maximize){
- debug._maxLink.setStyle('display', maximize ? 'none' : '');
- debug._minLink.setStyle('display', maximize ? '' : 'none');
- var size = maximize ? '112px' : '18px';
- debug._contents.style.height = size;
- Cookie.set('mootools-debugger-status', size);
- debug.resetHeight();
- },
-
- parseKey: function(e){
- var value = debug._input.value;
-
- switch(e.key){
- case 'enter':
- if (!value) return;
- debug._input.value = '';
- switch(value){
- case 'exit': debug._body.remove(); debug._body = false; return;
- case 'clear':
- case 'clr': debug._contents.setHTML(''); return;
- case 'max': this.minmax(true); return;
- case 'min': this.minmax(); return;
- }
-
- debug.pre('>>> ' + value, '#3e72b2');
-
- try {
- var evaluation = eval(value);
- if (evaluation !== undefined) debug.result([evaluation]);
- } catch (err){
- debug.error(err);
- }
- debug.register(value);
- break;
-
- case 'up':
- e.stop();
- var i = debug.idx - 1;
- if (debug.messages[i]){
- debug._input.value = debug.messages[i];
- debug.idx = i;
- }
- break;
-
- case 'down':
- e.stop();
- var i = debug.idx + 1;
- if (debug.messages[i]){
- debug._input.value = debug.messages[i];
- debug.idx = i;
- } else {
- debug._input.value = '';
- debug.idx = debug.messages.length;
- }
- }
- }
-
-};
-
-debug.messages = Cookie.get('mootools-debugger-history');
-debug.messages = debug.messages ? debug.messages.replace(/%%%/g, ';').split('-:-:-') : [];
-debug.idx = debug.messages.length;
-
-if ((typeof console == 'undefined') || !console.warn){
- var console = debug;
- window.onerror = function(msg, url, line){
- console.error({
- 'message': msg + '\n >>>>> ' + url + ' (' + line + ')',
- 'name': 'Run Time Error'
- });
- };
- if (typeof Ajax != 'undefined'){
- Ajax = Ajax.extend({
-
- onStateChange: function(){
- this.parent();
- this.log();
- },
-
- log: function(){
- if (this.transport.readyState == 4){
- try {
- if (debug._body){
- var txt = this.transport.responseText;
- if ($chk(txt)){
- if (txt.length > 100) txt = txt.substring(0, 100) + " ...";
- } else {
- txt = 'undefined';
- }
- debug.log("%s: %s"+"\n"+"status: %s"+"\n"+"responseText: %s", this.options.method, this.url, this.transport.status, txt);
- }
- } catch(e){}
- }
- }
- });
- }
-}
-
-
diff --git a/trunk/includes/js/LSconfirmBox.js b/trunk/includes/js/LSconfirmBox.js
new file mode 100644
index 00000000..ea10ce90
--- /dev/null
+++ b/trunk/includes/js/LSconfirmBox.js
@@ -0,0 +1,157 @@
+var LSconfirmBox = new Class({
+ initialize: function(options) {
+ this._options = options;
+ this.create();
+ this.display();
+ },
+
+ create: function() {
+ this.box = new Element('div');
+ this.box.setProperty('id','box-LSconfirmBox');
+ this.box.injectInside(document.body);
+
+ this.title = new Element('p');
+ this.title.setProperty('id','title-LSconfirmBox');
+ if (this._options.title) {
+ this.title.set('html',this._options.title);
+ }
+ else {
+ this.title.set('html','Comfirmation');
+ };
+ this.title.injectInside(this.box)
+
+ this.closeBtn = new Element('span');
+ this.closeBtn.setProperty('id','closeBtn-LSconfirmBox');
+ this.closeBtn.injectInside(this.box);
+ this.closeBtn.addEvent('click',this.cancel.bind(this));
+
+ this.text = new Element('p');
+ this.text.setProperty('id','text-LSconfirmBox');
+ if (this._options.text) {
+ this.text.set('html',this._options.text);
+ }
+ else {
+ this.text.set('html','Comfirmez-vous votre choix ?');
+ }
+ this.text.injectInside(this.box);
+
+ this.btnsBox = new Element('p');
+ this.btnsBox.setProperty('id','btnsBox-LSconfirmBox');
+ this.btnsBox.injectInside(this.box);
+
+ this.confirmBtn = new Element('span');
+ this.confirmBtn.addClass('btn-LSconfirmBox');
+ this.confirmBtn.set('html','Valider');
+ this.confirmBtn.injectInside(this.btnsBox);
+ this.confirmBtn.addEvent('click',this.confirm.bind(this));
+
+ this.cancelBtn = new Element('span');
+ this.cancelBtn.addClass('btn-LSconfirmBox');
+ this.cancelBtn.set('html','Annuler');
+ this.cancelBtn.injectInside(this.btnsBox);
+ this.cancelBtn.addEvent('click',this.cancel.bind(this));
+
+ this._purge=0;
+
+ this.fx = {
+ open: new Fx.Morph(this.box, {duration: 500, transition: Fx.Transitions.Sine.easeOut, onComplete: this.displayContent.bind(this)}),
+ close: new Fx.Morph(this.box, {duration: 500, transition: Fx.Transitions.Sine.easeOut, onComplete: this.onClose.bind(this)}),
+ };
+ },
+
+ display: function() {
+ this.box.setStyle('display','block');
+ this.position(true);
+ window.addEvent('resize', this.position.bind(this));
+ },
+
+ displayContent: function() {
+ [this.title, this.closeBtn, this.text, this.btnsBox].each(function(el) {
+ var fx = new Fx.Tween(el,{duration: 200});
+ fx.start('opacity',0,1);
+ },this);
+ },
+
+ hide: function() {
+ this.box.empty();
+ this.fx.close.start(this.getStartStyles());
+ window.removeEvent('resize', this.position.bind(this));
+ },
+
+ onClose: function() {
+ this.box.setStyle('display','none');
+ this.purge();
+ },
+
+ purge: function() {
+ this._purge=1;
+ this.box.empty();
+ this.box.destroy();
+ delete this.fx;
+ delete this;
+ },
+
+ getStartStyles: function() {
+ if (typeof(this._options.startElement) != 'undefined') {
+ var startStyles = {
+ top: this._options.startElement.getCoordinates().top,
+ left: this._options.startElement.getCoordinates().left,
+ width: this._options.startElement.getStyle('width').toInt(),
+ opacity: 0
+ };
+ }
+ else {
+ var startStyles = {
+ top: '0px',
+ left: '0px',
+ width: '0px',
+ opacity: 0
+ };
+ }
+ return startStyles;
+ },
+
+ getEndStyles: function() {
+ if (this._options.width) {
+ w = this._options.width;
+ }
+ else {
+ w = 300;
+ }
+
+ var endStyles = {
+ width: w.toInt()+'px',
+ top: ((window.getHeight()/2)-(this.box.getStyle('height').toInt()/2)-this.box.getStyle('border').toInt()+window.getScrollTop()).toInt(),
+ left: ((window.getWidth()/2)-(w/2)-this.box.getStyle('border').toInt()).toInt(),
+ opacity: 1
+ };
+ return endStyles;
+ },
+
+ position: function(start) {
+ if (this._purge==0) {
+ var endStyles = this.getEndStyles();
+ if (start) {
+ this.box.setStyles(this.getStartStyles());
+ }
+ this.fx.open.start(endStyles);
+ }
+ },
+
+ confirm: function() {
+ if (this._options.onConfirm) {
+ try {
+ this._options.onConfirm();
+ }
+ catch (e){
+ console.log('onConfirm : rater');
+ }
+ }
+ this.hide();
+ },
+
+ cancel: function() {
+ this.hide();
+ }
+
+});
diff --git a/trunk/includes/js/LSdefault.js b/trunk/includes/js/LSdefault.js
index 74df8524..56686957 100644
--- a/trunk/includes/js/LSdefault.js
+++ b/trunk/includes/js/LSdefault.js
@@ -3,26 +3,33 @@ var LSdefault = new Class({
this.LSdebug = $('LSdebug');
this.LSdebugInfos = $('LSdebug_infos');
this.LSdebug.setOpacity(0);
- if (this.LSdebugInfos.innerHTML != '') {
- this.displayDebugBox();
- }
this.LSdebugHidden = $('LSdebug_hidden');
this.LSdebugHidden.addEvent('click',this.onLSdebugHiddenClick.bindWithEvent(this));
+
this.LSerror = $('LSerror');
this.LSerror.setOpacity(0);
- if (this.LSerror.innerHTML != '') {
- this.displayLSerror();
- }
-
+
this.loading_img=[];
- LSdebug(this.loading_img);
this.loading_img_id=-1;
this.LSsession_topDn = $('LSsession_topDn');
if (this.LSsession_topDn) {
this.LSsession_topDn.addEvent('change',this.onLSsession_topDnChange.bind(this));
}
+
+ this.fx = {
+ LSdebug: new Fx.Tween(this.LSdebug,{property: 'opacity',duration:600}),
+ LSerror: new Fx.Tween(this.LSerror,{property: 'opacity',duration:500})
+ };
+
+ if (this.LSdebugInfos.innerHTML != '') {
+ this.displayDebugBox();
+ }
+
+ if (this.LSerror.innerHTML != '') {
+ this.displayErrorBox.bind(this);
+ }
},
onLSsession_topDnChange: function() {
@@ -31,29 +38,55 @@ var LSdefault = new Class({
onLSdebugHiddenClick: function(event){
new Event(event).stop();
- new Fx.Style(this.LSdebug,'opacity',{duration:500}).start(0.8,0);
+ this.fx.LSdebug.start(0.8,0);
},
- displayDebugBox: function() {
- this.LSdebug.setStyle('top',getScrollTop()+10);
- new Fx.Style(this.LSdebug,'opacity',{duration:500}).start(0,0.8);
+ checkAjaxReturn: function(data) {
+ if (typeof(data) == 'object') {
+ if (typeof(data.imgload) != "undefined") {
+ this.loadingImgHide(data.imgload);
+ }
+ else {
+ this.loadingImgHide();
+ }
+
+ if (typeof(data.LSdebug) != "undefined") {
+ LSdebug(data.LSdebug);
+ this.displayDebug(data.LSdebug);
+ }
+
+ if (typeof(data.LSerror) != "undefined") {
+ this.displayError(data.LSerror);
+ return;
+ }
+ return true;
+ }
+ else {
+ LSdebug('retour non-interprétable');
+ this.loadingImgHide();
+ return;
+ }
},
displayError: function(html) {
- this.LSerror.empty();
- this.LSerror.setHTML(html);
- this.displayLSerror();
+ this.LSerror.set('html',html);
+ this.displayErrorBox();
},
displayDebug: function(html) {
- this.LSdebugInfos.setHTML(html);
+ this.LSdebugInfos.set('html',html);
this.displayDebugBox();
},
- displayLSerror: function() {
+ displayErrorBox: function() {
this.LSerror.setStyle('top',getScrollTop()+10);
- new Fx.Style(this.LSerror,'opacity',{duration:500}).start(0,0.8);
- (function(){new Fx.Style(this.LSerror,'opacity',{duration:500}).start(0.8,0);}).delay(5000, this);
+ this.fx.LSerror.start(0,0.8);
+ (function(){this.fx.LSerror.start(0.8,0);}).delay(10000, this);
+ },
+
+ displayDebugBox: function() {
+ this.LSdebug.setStyle('top',getScrollTop()+10);
+ this.fx.LSdebug.start(0,0.8);
},
loadingImgDisplay: function(el,position,size) {
@@ -72,7 +105,6 @@ var LSdefault = new Class({
else {
this.loading_img[this.loading_img_id].injectAfter(el);
}
- LSdebug(this.loading_img_id);
return this.loading_img_id;
},
@@ -80,12 +112,30 @@ var LSdefault = new Class({
if (isNaN(id)) {
this.loading_img.each(function(el) {
if (typeof(el) != 'undefined')
- el.remove();
+ el.destroy();
},this);
this.loading_img_id=-1;
}
else {
- this.loading_img[id].remove();
+ this.loading_img[id].destroy();
+ }
+ },
+
+ ajaxDisplayDebugAndError: function() {
+ var LSdebug_txt = $('LSdebug_txt');
+ if (LSdebug_txt) {
+ var debug = LSdebug_txt.innerHTML;
+ if (debug) {
+ this.displayDebug(debug.toString());
+ }
+ }
+
+ var LSerror_txt = $('LSerror_txt');
+ if (LSerror_txt) {
+ var error=LSerror_txt.innerHTML;
+ if (error) {
+ this.displayError(error.toString());
+ }
}
}
diff --git a/trunk/includes/js/LSform.js b/trunk/includes/js/LSform.js
index d377f9f3..0f9ca468 100644
--- a/trunk/includes/js/LSform.js
+++ b/trunk/includes/js/LSform.js
@@ -7,68 +7,9 @@ var LSform = new Class({
$$('img.LSform-remove-field-btn').each(function(el) {
el.addEvent('click',this.onRemoveFieldBtnClick.bind(this,el));
}, this);
-
- $$('div.LSform_image').each(function(el) {
- el.addEvent('mouseenter',this.onMouseEnterImage.bind(this));
- }, this);
-
- $$('div.LSform_image').each(function(el) {
- el.addEvent('mouseleave',this.onMouseLeaveImage.bind(this));
- }, this);
-
- $$('img.LSform_image_action_zoom').each(function(el) {
- el.addEvent('click',this.zoomImg.bindWithEvent(this,el.getParent().getParent().getNext().src));
- }, this);
-
- $$('img.LSform_image_action_delete').each(function(el) {
- el.addEvent('click',this.onImageDeleteBtnClick.bind(this,el));
- }, this);
-
- this.LSformElement_password_generate_inputHistory = [];
- $$('img.LSformElement_password_generate_btn').each(function(el) {
- el.addEvent('click',this.onLSformElement_password_generate_btnClick.bind(this,el));
- }, this);
-
- $$('img.LSformElement_password_view_btn').each(function(el) {
- el.addEvent('click',this.onLSformElement_password_view_btnClick.bind(this,el));
- }, this);
-
- this.LSformElement_password_background_color = [];
-
- this.initialiseLSformElement_password_generate();
-
- $$('img.LSformElement_password_verify_btn').each(function(el) {
- el.addEvent('click',this.onLSformElement_password_verify_btnClick.bind(this,el));
- }, this);
-
- this.initialiseLSformElement_select_object();
},
- initialiseLSformElement_select_object: function() {
- $$('a.LSformElement_select_object_addBtn').each(function(el) {
- el.addEvent('click',this.onLSformElement_select_object_addBtnClick.bindWithEvent(this,el));
- }, this);
-
- $$('img.LSformElement_select_object_deleteBtn').each(function(el) {
- el.addEvent('click',this.LSformElement_select_object_deleteBtn.bind(this,el));
- }, this);
- },
-
- initialiseLSformElement_password_generate: function() {
- $$('input.LSformElement_password_generate').each(function(el) {
- this.LSformElement_password_background_color[el.id] = el.getStyle('background-color');
- el.addEvent('click',this.onLSformElement_password_verify_inputClick.bind(this,el));
- el.addEvent('keyup',this.onLSformElement_password_generate_inputKeyUp.bind(this,el));
- }, this);
- },
-
- zoomImg: function(event, src) {
- new Event(event).stop();
- varLSsmoothbox.openImg(src);
- },
-
onAddFieldBtnClick: function(img){
-
var getAttrName = /LSform_add_field_btn_(.*)_.*/
var attrName = getAttrName.exec(img.id)[1];
LSdebug(attrName);
@@ -84,31 +25,23 @@ var LSform = new Class({
};
LSdebug(data);
data.imgload = varLSdefault.loadingImgDisplay(img);
- new Ajax('index_ajax.php', {data: data, onComplete: this.onAddFieldBtnClickComplete.bind(this)}).request();
+ new Request({url: 'index_ajax.php', data: data, onSuccess: this.onAddFieldBtnClickComplete.bind(this)}).send();
},
onAddFieldBtnClickComplete: function(responseText, responseXML) {
- var data = Json.evaluate(responseText);
+ var data = JSON.decode(responseText);
LSdebug(data);
- if ( data ) {
- if ( typeof(data.LSerror) != "undefined" ) {
- varLSdefault.loadingImgHide(data.imgload);
- varLSdefault.displayError(data.LSerror);
- return;
- }
- else {
- varLSdefault.loadingImgHide(data.imgload);
- var li = new Element('li');
- var img = $(data.img);
- li.setHTML(data.html);
- li.injectAfter(img.getParent());
- li.getElements('img[class=LSform-add-field-btn]').each(function(el) {
- el.addEvent('click',this.onAddFieldBtnClick.bind(this,el));
- }, this);
- li.getElements('img[class=LSform-remove-field-btn]').each(function(el) {
- el.addEvent('click',this.onRemoveFieldBtnClick.bind(this,el));
- }, this);
- }
+ if ( varLSdefault.checkAjaxReturn(data) ) {
+ var li = new Element('li');
+ var img = $(data.img);
+ li.set('html',data.html);
+ li.injectAfter(img.getParent());
+ li.getElements('img[class=LSform-add-field-btn]').each(function(el) {
+ el.addEvent('click',this.onAddFieldBtnClick.bind(this,el));
+ }, this);
+ li.getElements('img[class=LSform-remove-field-btn]').each(function(el) {
+ el.addEvent('click',this.onRemoveFieldBtnClick.bind(this,el));
+ }, this);
}
},
@@ -117,249 +50,9 @@ var LSform = new Class({
img.getPrevious().getPrevious().value='';
}
else {
- img.getParent().remove();
+ img.getParent().destroy();
}
- },
-
- onMouseEnterImage: function() {
- $$('ul.LSform_image_actions').each(function(el) {
- el.setStyle('visibility','visible');
- }, this);
- },
-
- onMouseLeaveImage: function() {
- $$('ul.LSform_image_actions').each(function(el) {
- el.setStyle('visibility','hidden');
- }, this);
- },
-
- onImageDeleteBtnClick: function(img) {
- $$('form.LSform').each(function(el) {
- var input = new Element('input');
- input.type = 'hidden';
- var getInputId = /LSform_image_action_delete_(.*)/
- input.name = $(getInputId.exec(img.id)[1]).name + '_delete';
- input.value='delete';
- input.injectInside(el);
- },this);
- img.getParent().getParent().getParent().remove();
- },
-
- onLSformElement_select_object_addBtnClick: function(event,a) {
- new Event(event).stop();
- var getFieldId = /a_(.*)/
- var fieldId = getFieldId.exec(a.id)[1];
- var getId = /a_LSformElement_select_object_.*_([0-9]*)$/
- var Id = getId.exec(a.id)[1];
-
- values = new Array();
- $$('input.LSformElement_select_object').each(function(el) {
- values.push(el.getProperty('value'));
- }, this);
-
- var data = {
- template: 'LSselect',
- action: 'refreshSession',
- objecttype: $('LSformElement_select_object_objecttype_'+Id).value,
- values: Json.toString(values),
- href: a.href
- };
-
- LSdebug(data);
-
- data.imgload=varLSdefault.loadingImgDisplay(a,'inside');
- this.refreshFields=fieldId;
- new Ajax('index_ajax.php', {data: data, onComplete: this.onLSformElement_select_object_addBtnClickComplete.bind(this)}).request();
- },
-
- onLSformElement_select_object_addBtnClickComplete: function(responseText, responseXML) {
- var data = Json.evaluate(responseText);
- if ( data ) {
- if ( typeof(data.LSerror) != "undefined" ) {
- varLSdefault.displayError(data.LSerror);
- return;
- }
- else {
- varLSdefault.loadingImgHide(data.imgload);
- varLSsmoothbox.openURL(data.href,this);
- }
- }
- },
-
- refresh: function() {
- var getAttrName = /LSformElement_select_object_(.*)_[0-9]*/
- var attrName = getAttrName.exec(this.refreshFields)[1];
- var data = {
- template: 'LSform',
- action: 'refreshField',
- attribute: attrName,
- objecttype: $('LSform_objecttype').value,
- objectdn: $('LSform_objectdn').value,
- idform: $('LSform_idform').value,
- ul: this.refreshFields
- };
- LSdebug(data);
- data.imgload=varLSdefault.loadingImgDisplay($('a_' + this.refreshFields));
- new Ajax('index_ajax.php', {data: data, onComplete: this.onRefreshComplete.bind(this)}).request();
- },
-
- onRefreshComplete: function(responseText, responseXML) {
- var data = Json.evaluate(responseText);
- if ( data ) {
- if ( typeof(data.LSerror) != "undefined" ) {
- varLSdefault.loadingImgHide(data.imgload);
- varLSdefault.displayError(data.LSerror);
- return;
- }
- else {
- varLSdefault.loadingImgHide(data.imgload);
- $(this.refreshFields).getParent().setHTML(data.html);
- this.initialiseLSformElement_select_object();
- }
- }
- },
-
- LSformElement_select_object_deleteBtn: function(img) {
- img.getParent().remove();
- },
-
- onLSformElement_password_generate_btnClick: function(img) {
- var getAttrNameAndId = /LSformElement_password_generate_btn_(.*)_([0-9]*)/
- var getAttrNameAndIdValues = getAttrNameAndId.exec(img.id);
- var attrName = getAttrNameAndIdValues[1];
- var fieldId = 'LSformElement_password_' + attrName + '_' + getAttrNameAndIdValues[2];
- var viewBtnId = 'LSformElement_password_view_btn_' + attrName + '_' + getAttrNameAndIdValues[2];
-
- var data = {
- template: 'LSform',
- action: 'generatePassword',
- attribute: attrName,
- objecttype: $('LSform_objecttype').value,
- idform: $('LSform_idform').value,
- viewBtnId: viewBtnId,
- fieldId: fieldId
- };
- data.imgload=varLSdefault.loadingImgDisplay(img);
- new Ajax('index_ajax.php', {data: data, onComplete: this.onLSformElement_password_generate_btnClickComplete.bind(this)}).request();
- },
-
- onLSformElement_password_generate_btnClickComplete: function(responseText, responseXML) {
- var data = Json.evaluate(responseText);
- if ( data ) {
- if ( typeof(data.LSerror) != "undefined" ) {
- varLSdefault.loadingImgHide(data.imgload);
- varLSdefault.displayError(data.LSerror);
- return;
- }
- else {
- varLSdefault.loadingImgHide(data.imgload);
- this.changeInputType($(data.fieldId),'text');
- $(data.fieldId).value=data.generatePassword;
- $(data.viewBtnId).setProperty('src','templates/images/hide.png');
- this.LSformElement_password_generate_inputHistory[data.fieldId]=data.generatePassword;
- }
- }
- },
-
- onLSformElement_password_generate_inputKeyUp: function(input) {
- if (input.type=='text') {
- if((this.LSformElement_password_generate_inputHistory[input.id]!=input.value)&&(typeof(this.LSformElement_password_generate_inputHistory[input.id])!='undefined')&&(this.LSformElement_password_generate_inputHistory[input.id]!='')) {
- this.onLSformElement_password_generate_inputModify(input);
- }
- }
- },
-
- onLSformElement_password_generate_inputModify: function(input) {
- input.value='';
- input = this.changeInputType(input,'password');
- var getAttrNameAndId = /LSformElement_password_(.*)_([0-9]*)/
- var attrNameAndId = getAttrNameAndId.exec(input.id);
- var viewBtnId = 'LSformElement_password_view_btn_' + attrNameAndId[1] + '_' + attrNameAndId[2];
- $(viewBtnId).setProperty('src','templates/images/view.png');
- this.LSformElement_password_generate_inputHistory[input.id]='';
- input.focus();
- },
-
- onLSformElement_password_view_btnClick: function(img) {
- var getAttrNameAndId = /LSformElement_password_view_btn_(.*)_([0-9]*)/
- var getAttrNameAndIdValues = getAttrNameAndId.exec(img.id);
- var attrName = getAttrNameAndIdValues[1];
- var fieldId = 'LSformElement_password_' + attrName + '_' + getAttrNameAndIdValues[2];
-
- input = $(fieldId);
-
- if (input.type=='password') {
- input = this.changeInputType(input,'text');
- img.setProperty('src','templates/images/hide.png');
- }
- else {
- input = this.changeInputType(input,'password');
- img.setProperty('src','templates/images/view.png');
- }
- input.focus();
- },
-
- changeInputType: function(input,newType) {
- var newInput = new Element('input');
- newInput.setProperty('name',input.getProperty('name'));
- newInput.setProperty('type',newType);
- newInput.setProperty('class',input.getProperty('class'));
- newInput.setProperty('id',input.getProperty('id'));
- newInput.setProperty('value',input.getProperty('value'));
- newInput.injectAfter(input);
- input.remove();
- this.initialiseLSformElement_password_generate();
- return newInput;
- },
-
- onLSformElement_password_verify_btnClick: function(img) {
- var getAttrNameAndId = /LSformElement_password_verify_btn_(.*)_([0-9]*)/
- var getAttrNameAndIdValues = getAttrNameAndId.exec(img.id);
- var attrName = getAttrNameAndIdValues[1];
- var fieldId = 'LSformElement_password_' + attrName + '_' + getAttrNameAndIdValues[2];
- var verifyBtnId = 'LSformElement_password_verify_btn_' + attrName + '_' + getAttrNameAndIdValues[2];
-
- var data = {
- template: 'LSform',
- action: 'verifyPassword',
- attribute: attrName,
- objecttype: $('LSform_objecttype').value,
- idform: $('LSform_idform').value,
- fieldId: fieldId,
- fieldValue: $(fieldId).value,
- objectdn: $('LSform_objectdn').value
- };
- LSdebug(data);
- data.imgload=varLSdefault.loadingImgDisplay(img);
- new Ajax('index_ajax.php', {data: data, onComplete: this.onLSformElement_password_verify_btnClickComplete.bind(this)}).request();
- },
-
- onLSformElement_password_verify_btnClickComplete: function(responseText, responseXML) {
- var data = Json.evaluate(responseText);
- if ( data ) {
- if ( typeof(data.LSerror) != "undefined" ) {
- varLSdefault.loadingImgHide(data.imgload);
- varLSdefault.displayError(data.LSerror);
- return;
- }
- else {
- varLSdefault.loadingImgHide(data.imgload);
- if (data.verifyPassword) {
- // ok
- $(data.fieldId).setStyle('background-color','#73F386');
- }
- else {
- // nok
- $(data.fieldId).setStyle('background-color','#f59a67');
- }
- }
- }
- },
-
- onLSformElement_password_verify_inputClick: function(input) {
- input.setStyle('background-color',this.LSformElement_password_background_color[input.id]);
}
-
});
window.addEvent(window.ie ? 'load' : 'domready', function() {
varLSform = new LSform();
diff --git a/trunk/includes/js/LSformElement_image.js b/trunk/includes/js/LSformElement_image.js
new file mode 100644
index 00000000..17a010d6
--- /dev/null
+++ b/trunk/includes/js/LSformElement_image.js
@@ -0,0 +1,62 @@
+var LSformElement_image = new Class({
+ initialize: function(){
+ $$('div.LSformElement_image').each(function(el) {
+ el.addEvent('mouseenter',this.onMouseEnterImage.bind(this));
+ }, this);
+
+ $$('div.LSformElement_image').each(function(el) {
+ el.addEvent('mouseleave',this.onMouseLeaveImage.bind(this));
+ }, this);
+
+ $$('img.LSformElement_image_action_zoom').each(function(el) {
+ var getId = /LSformElement_image_action_zoom_(.*)/
+ var id = getId.exec(el.id)[1];
+ var img = $('LSformElement_image_' + id);
+ var src = img.src;
+ el.addEvent('click',this.zoomImg.bindWithEvent(this,img));
+ }, this);
+
+ $$('img.LSformElement_image_action_delete').each(function(el) {
+ el.addEvent('click',this.onImageDeleteBtnClick.bind(this,el));
+ }, this);
+ },
+
+ zoomImg: function(event, img) {
+ new Event(event).stop();
+ varLSsmoothbox.hideValidBtn();
+ varLSsmoothbox.openImg(img.src,{startElement: img});
+ },
+
+ onMouseEnterImage: function() {
+ $$('ul.LSformElement_image_actions').each(function(el) {
+ el.setStyle('visibility','visible');
+ }, this);
+ },
+
+ onMouseLeaveImage: function() {
+ $$('ul.LSformElement_image_actions').each(function(el) {
+ el.setStyle('visibility','hidden');
+ }, this);
+ },
+
+ onImageDeleteBtnClick: function(img) {
+ $$('form.LSform').each(function(el) {
+ var input = new Element('input');
+ input.type = 'hidden';
+ var getInputId = /LSformElement_image_action_delete_(.*)/
+ var id = 'LSformElement_image_input_' + getInputId.exec(img.id)[1];
+ input.name = $(id).name + '_delete';
+ input.value='delete';
+ input.injectInside(el);
+ },this);
+
+ var main = img.getParent().getParent().getParent();
+ var hidder = new Fx.Tween(main,{property: 'opacity',duration:600,onComplete:main.dispose.bind(this)});
+ hidder.start(1,0);
+ //img.getParent().getParent().getParent().destroy();
+ }
+
+});
+window.addEvent(window.ie ? 'load' : 'domready', function() {
+ varLSformElement_image = new LSformElement_image();
+});
diff --git a/trunk/includes/js/LSformElement_password.js b/trunk/includes/js/LSformElement_password.js
new file mode 100644
index 00000000..b1adf655
--- /dev/null
+++ b/trunk/includes/js/LSformElement_password.js
@@ -0,0 +1,151 @@
+var LSformElement_password = new Class({
+ initialize: function(){
+ this.LSformElement_password_generate_inputHistory = [];
+ $$('img.LSformElement_password_generate_btn').each(function(el) {
+ el.addEvent('click',this.onLSformElement_password_generate_btnClick.bind(this,el));
+ }, this);
+
+ $$('img.LSformElement_password_view_btn').each(function(el) {
+ el.addEvent('click',this.onLSformElement_password_view_btnClick.bind(this,el));
+ }, this);
+
+ this.LSformElement_password_background_color = [];
+
+ $$('img.LSformElement_password_verify_btn').each(function(el) {
+ el.addEvent('click',this.onLSformElement_password_verify_btnClick.bind(this,el));
+ }, this);
+ this.initialiseLSformElement_password_generate();
+ },
+
+ initialiseLSformElement_password_generate: function() {
+ $$('input.LSformElement_password_generate').each(function(el) {
+ this.LSformElement_password_background_color[el.id] = el.getStyle('background-color');
+ el.addEvent('click',this.onLSformElement_password_verify_inputClick.bind(this,el));
+ el.addEvent('keyup',this.onLSformElement_password_generate_inputKeyUp.bind(this,el));
+ }, this);
+ },
+
+ onLSformElement_password_generate_btnClick: function(img) {
+ var getAttrNameAndId = /LSformElement_password_generate_btn_(.*)_([0-9]*)/
+ var getAttrNameAndIdValues = getAttrNameAndId.exec(img.id);
+ var attrName = getAttrNameAndIdValues[1];
+ var fieldId = 'LSformElement_password_' + attrName + '_' + getAttrNameAndIdValues[2];
+ var viewBtnId = 'LSformElement_password_view_btn_' + attrName + '_' + getAttrNameAndIdValues[2];
+
+ var data = {
+ template: 'LSform',
+ action: 'generatePassword',
+ attribute: attrName,
+ objecttype: $('LSform_objecttype').value,
+ idform: $('LSform_idform').value,
+ viewBtnId: viewBtnId,
+ fieldId: fieldId
+ };
+ data.imgload=varLSdefault.loadingImgDisplay(img);
+ new Request({url: 'index_ajax.php', data: data, onSuccess: this.onLSformElement_password_generate_btnClickComplete.bind(this)}).send();
+ },
+
+ onLSformElement_password_generate_btnClickComplete: function(responseText, responseXML) {
+ var data = JSON.decode(responseText);
+ if ( varLSdefault.checkAjaxReturn(data) ) {
+ this.changeInputType($(data.fieldId),'text');
+ $(data.fieldId).value=data.generatePassword;
+ $(data.viewBtnId).setProperty('src','templates/images/hide.png');
+ this.LSformElement_password_generate_inputHistory[data.fieldId]=data.generatePassword;
+ }
+ },
+
+ onLSformElement_password_generate_inputKeyUp: function(input) {
+ if (input.type=='text') {
+ if((this.LSformElement_password_generate_inputHistory[input.id]!=input.value)&&(typeof(this.LSformElement_password_generate_inputHistory[input.id])!='undefined')&&(this.LSformElement_password_generate_inputHistory[input.id]!='')) {
+ this.onLSformElement_password_generate_inputModify(input);
+ }
+ }
+ },
+
+ onLSformElement_password_generate_inputModify: function(input) {
+ input.value='';
+ input = this.changeInputType(input,'password');
+ var getAttrNameAndId = /LSformElement_password_(.*)_([0-9]*)/
+ var attrNameAndId = getAttrNameAndId.exec(input.id);
+ var viewBtnId = 'LSformElement_password_view_btn_' + attrNameAndId[1] + '_' + attrNameAndId[2];
+ $(viewBtnId).setProperty('src','templates/images/view.png');
+ this.LSformElement_password_generate_inputHistory[input.id]='';
+ input.focus();
+ },
+
+ onLSformElement_password_view_btnClick: function(img) {
+ var getAttrNameAndId = /LSformElement_password_view_btn_(.*)_([0-9]*)/
+ var getAttrNameAndIdValues = getAttrNameAndId.exec(img.id);
+ var attrName = getAttrNameAndIdValues[1];
+ var fieldId = 'LSformElement_password_' + attrName + '_' + getAttrNameAndIdValues[2];
+
+ input = $(fieldId);
+
+ if (input.type=='password') {
+ input = this.changeInputType(input,'text');
+ img.setProperty('src','templates/images/hide.png');
+ }
+ else {
+ input = this.changeInputType(input,'password');
+ img.setProperty('src','templates/images/view.png');
+ }
+ input.focus();
+ },
+
+ changeInputType: function(input,newType) {
+ var newInput = new Element('input');
+ newInput.setProperty('name',input.getProperty('name'));
+ newInput.setProperty('type',newType);
+ newInput.setProperty('class',input.getProperty('class'));
+ newInput.setProperty('id',input.getProperty('id'));
+ newInput.setProperty('value',input.getProperty('value'));
+ newInput.injectAfter(input);
+ input.destroy();
+ this.initialiseLSformElement_password_generate();
+ return newInput;
+ },
+
+ onLSformElement_password_verify_btnClick: function(img) {
+ var getAttrNameAndId = /LSformElement_password_verify_btn_(.*)_([0-9]*)/
+ var getAttrNameAndIdValues = getAttrNameAndId.exec(img.id);
+ var attrName = getAttrNameAndIdValues[1];
+ var fieldId = 'LSformElement_password_' + attrName + '_' + getAttrNameAndIdValues[2];
+ var verifyBtnId = 'LSformElement_password_verify_btn_' + attrName + '_' + getAttrNameAndIdValues[2];
+
+ var data = {
+ template: 'LSform',
+ action: 'verifyPassword',
+ attribute: attrName,
+ objecttype: $('LSform_objecttype').value,
+ idform: $('LSform_idform').value,
+ fieldId: fieldId,
+ fieldValue: $(fieldId).value,
+ objectdn: $('LSform_objectdn').value
+ };
+ LSdebug(data);
+ data.imgload=varLSdefault.loadingImgDisplay(img);
+ new Request({url: 'index_ajax.php', data: data, onSuccess: this.onLSformElement_password_verify_btnClickComplete.bind(this)}).send();
+ },
+
+ onLSformElement_password_verify_btnClickComplete: function(responseText, responseXML) {
+ var data = JSON.decode(responseText);
+ if ( varLSdefault.checkAjaxReturn(data) ) {
+ if (data.verifyPassword) {
+ // ok
+ $(data.fieldId).setStyle('background-color','#73F386');
+ }
+ else {
+ // nok
+ $(data.fieldId).setStyle('background-color','#f59a67');
+ }
+ }
+ },
+
+ onLSformElement_password_verify_inputClick: function(input) {
+ input.setStyle('background-color',this.LSformElement_password_background_color[input.id]);
+ }
+});
+window.addEvent(window.ie ? 'load' : 'domready', function() {
+ varLSformElement_password = new LSformElement_password();
+});
diff --git a/trunk/includes/js/LSformElement_select_object.js b/trunk/includes/js/LSformElement_select_object.js
new file mode 100644
index 00000000..98cb5037
--- /dev/null
+++ b/trunk/includes/js/LSformElement_select_object.js
@@ -0,0 +1,80 @@
+var LSformElement_select_object = new Class({
+ initialize: function(){
+ this.initialiseLSformElement_select_object();
+ },
+
+ initialiseLSformElement_select_object: function() {
+ $$('a.LSformElement_select_object_addBtn').each(function(el) {
+ el.addEvent('click',this.onLSformElement_select_object_addBtnClick.bindWithEvent(this,el));
+ }, this);
+
+ $$('img.LSformElement_select_object_deleteBtn').each(function(el) {
+ el.addEvent('click',this.LSformElement_select_object_deleteBtn.bind(this,el));
+ }, this);
+ },
+
+ onLSformElement_select_object_addBtnClick: function(event,a) {
+ new Event(event).stop();
+ var getFieldId = /a_(.*)/
+ var fieldId = getFieldId.exec(a.id)[1];
+ var getId = /a_LSformElement_select_object_.*_([0-9]*)$/
+ var Id = getId.exec(a.id)[1];
+
+ values = new Array();
+ $$('input.LSformElement_select_object').each(function(el) {
+ values.push(el.getProperty('value'));
+ }, this);
+
+ var data = {
+ template: 'LSselect',
+ action: 'refreshSession',
+ objecttype: $('LSformElement_select_object_objecttype_'+Id).value,
+ values: JSON.encode(values),
+ href: a.href
+ };
+
+ data.imgload=varLSdefault.loadingImgDisplay(a,'inside');
+ this.refreshFields=fieldId;
+ new Request({url: 'index_ajax.php', data: data, onSuccess: this.onLSformElement_select_object_addBtnClickComplete.bind(this)}).send();
+ },
+
+ onLSformElement_select_object_addBtnClickComplete: function(responseText, responseXML) {
+ var data = JSON.decode(responseText);
+ if ( varLSdefault.checkAjaxReturn(data) ) {
+ varLSsmoothbox.setRefreshElement(this);
+ varLSsmoothbox.displayValidBtn();
+ varLSsmoothbox.openURL(data.href,{width: 615});
+ }
+ },
+
+ refresh: function() {
+ var getAttrName = /LSformElement_select_object_(.*)_[0-9]*/
+ var attrName = getAttrName.exec(this.refreshFields)[1];
+ var data = {
+ template: 'LSform',
+ action: 'refreshField',
+ attribute: attrName,
+ objecttype: $('LSform_objecttype').value,
+ objectdn: $('LSform_objectdn').value,
+ idform: $('LSform_idform').value,
+ ul: this.refreshFields
+ };
+ data.imgload=varLSdefault.loadingImgDisplay($('a_' + this.refreshFields));
+ new Request({url: 'index_ajax.php', data: data, onSuccess: this.onRefreshComplete.bind(this)}).send();
+ },
+
+ onRefreshComplete: function(responseText, responseXML) {
+ var data = JSON.decode(responseText);
+ if ( varLSdefault.checkAjaxReturn(data) ) {
+ $(this.refreshFields).getParent().set('html',data.html);
+ this.initialiseLSformElement_select_object();
+ }
+ },
+
+ LSformElement_select_object_deleteBtn: function(img) {
+ img.getParent().destroy();
+ }
+});
+window.addEvent(window.ie ? 'load' : 'domready', function() {
+ varLSformElement_select_object = new LSformElement_select_object();
+});
diff --git a/trunk/includes/js/LSrelation.js b/trunk/includes/js/LSrelation.js
index 440e7cab..162b459b 100644
--- a/trunk/includes/js/LSrelation.js
+++ b/trunk/includes/js/LSrelation.js
@@ -4,6 +4,7 @@ var LSrelation = new Class({
this.deleteBtn = [];
this.deleteBtnId = 0;
this.refreshRelation=0;
+ this._confirmDelete=1;
$$('a.LSrelation_modify').each(function(el) {
this.edit=1;
el.addEvent('click',this.onLSrelationModifyBtnClick.bindWithEvent(this,el));
@@ -15,7 +16,7 @@ var LSrelation = new Class({
initializeBtn: function() {
$$('img.LSrelation-btn').each(function(el) {
- el.remove();
+ el.destroy();
}, this);
this.deleteBtnId = 0;
$$('li.LSrelation').each(function(li) {
@@ -31,43 +32,48 @@ var LSrelation = new Class({
},
onDeleteBtnClick: function(img) {
- li = img.getParent();
- ul = li.getParent();
- img.remove();
+ if (this._confirmDelete) {
+ var li = img.getParent();
+ var span = li.getFirst('span');
+ this.confirmBox = new LSconfirmBox({
+ text: 'Etês-vous sur de vouloir supprimer "'+span.innerHTML+'" ?',
+ startElement: img,
+ onConfirm: this.deleteFromImg.bind(this,img)
+ });
+ }
+ else {
+ this.deleteFromImg(img);
+ }
+ },
+
+ deleteFromImg: function(img) {
+ var li = img.getParent();
+ var span = li.getFirst('span');
+ var ul = li.getParent();
+ img.destroy();
LSdebug(ul.id);
var getId = /LSrelation_ul_([0-9]*)/
var id = getId.exec(ul.id)[1];
var data = {
template: 'LSrelation',
- action: 'deleteByDisplayValue',
+ action: 'deleteByDn',
id: id,
- value: li.innerHTML
+ dn: span.id
};
- this.deleteLi = li;
data.imgload=varLSdefault.loadingImgDisplay(li.id,'inside');
- LSdebug(data);
- new Ajax('index_ajax.php', {data: data, onComplete: this.onDeleteBtnClickComplete.bind(this)}).request();
+ new Request({url: 'index_ajax.php', data: data, onSuccess: this.deleteFromImgComplete.bind(this)}).send();
},
- onDeleteBtnClickComplete: function(responseText, responseXML) {
- var data = Json.evaluate(responseText);
- LSdebug(data);
- if ( data ) {
- if ( typeof(data.LSerror) != "undefined" ) {
- if (data.imgload!='') {
- varLSdefault.loadingImgHide(data.imgload);
- }
- else {
- varLSdefault.loadingImgHide();
- }
- varLSdefault.displayError(data.LSerror);
- return;
- }
- else {
- varLSdefault.loadingImgHide(data.imgload);
- this.deleteLi.remove();
- }
+ deleteFromImgComplete: function(responseText, responseXML) {
+ var data = JSON.decode(responseText);
+ if ( varLSdefault.checkAjaxReturn(data) ) {
+ try {
+ $(data.dn).getParent().destroy();
+ }
+ catch(e) {
+ LSdebug('Erreur durant la suppression du li du DN : '+data.dn);
+ }
}
},
@@ -84,27 +90,14 @@ var LSrelation = new Class({
LSdebug(data);
this.refreshRelation=a.id;
data.imgload=varLSdefault.loadingImgDisplay('LSrelation_title_'+a.id,'inside');
- new Ajax('index_ajax.php', {data: data, onComplete: this.onLSrelationModifyBtnClickComplete.bind(this)}).request();
+ new Request({url: 'index_ajax.php', data: data, onSuccess: this.onLSrelationModifyBtnClickComplete.bind(this)}).send();
},
onLSrelationModifyBtnClickComplete: function(responseText, responseXML) {
- var data = Json.evaluate(responseText);
- LSdebug(data);
- if ( data ) {
- if ( typeof(data.LSerror) != "undefined" ) {
- if (data.imgload!='') {
- varLSdefault.loadingImgHide(data.imgload);
- }
- else {
- varLSdefault.loadingImgHide();
- }
- varLSdefault.displayError(data.LSerror);
- return;
- }
- else {
- varLSdefault.loadingImgHide(data.imgload);
- varLSsmoothbox.openURL(data.href,this);
- }
+ var data = JSON.decode(responseText);
+ if ( varLSdefault.checkAjaxReturn(data) ) {
+ varLSsmoothbox.setRefreshElement(this);
+ varLSsmoothbox.openURL(data.href,{startElement: $(data.id), width: 615});
}
},
@@ -117,28 +110,14 @@ var LSrelation = new Class({
LSdebug(data);
data.imgload=varLSdefault.loadingImgDisplay('LSrelation_title_'+this.refreshRelation,'inside');
- new Ajax('index_ajax.php', {data: data, onComplete: this.onRrefreshComplete.bind(this)}).request();
+ new Request({url: 'index_ajax.php', data: data, onSuccess: this.onRrefreshComplete.bind(this)}).send();
},
onRrefreshComplete: function(responseText, responseXML) {
- var data = Json.evaluate(responseText);
- LSdebug(data);
- if ( data ) {
- if ( typeof(data.LSerror) != "undefined" ) {
- if (data.imgload!='') {
- varLSdefault.loadingImgHide(data.imgload);
- }
- else {
- varLSdefault.loadingImgHide();
- }
- varLSdefault.displayError(data.LSerror);
- return;
- }
- else {
- varLSdefault.loadingImgHide(data.imgload);
- $('LSrelation_ul_'+this.refreshRelation).setHTML(data.html);
- this.initializeBtn();
- }
+ var data = JSON.decode(responseText);
+ if ( varLSdefault.checkAjaxReturn(data) ) {
+ $('LSrelation_ul_'+this.refreshRelation).set('html',data.html);
+ this.initializeBtn();
}
}
@@ -147,5 +126,3 @@ var LSrelation = new Class({
window.addEvent(window.ie ? 'load' : 'domready', function() {
varLSrelation = new LSrelation();
});
-
-LSdebug('titi');
diff --git a/trunk/includes/js/LSselect.js b/trunk/includes/js/LSselect.js
index 3c3ca177..305e415c 100644
--- a/trunk/includes/js/LSselect.js
+++ b/trunk/includes/js/LSselect.js
@@ -9,6 +9,8 @@ var LSselect = new Class({
input.setProperty('type','hidden');
input.injectInside(this.LSselect_search_form);
+ this.tempInput = [];
+
this.LSselect_search_form.addEvent('submit',this.onSubmitSearchForm.bindWithEvent(this));
this.LSselect_topDn = $('LSselect_topDn');
@@ -56,13 +58,12 @@ var LSselect = new Class({
objecttype: $('LSselect-object').getProperties('caption').caption
};
}
- LSdebug(data);
data.imgload=varLSdefault.loadingImgDisplay(checkbox.getParent().getNext(),'inside');
- new Ajax('index_ajax.php', {data: data, onComplete: this.oncheckboxChangeComplete.bind(this)}).request();
+ new Request({url: 'index_ajax.php', data: data, onSuccess: this.oncheckboxChangeComplete.bind(this)}).send();
},
oncheckboxChangeComplete: function(responseText, responseXML) {
- var data = Json.evaluate(responseText);
+ var data = JSON.decode(responseText);
varLSdefault.loadingImgHide(data.imgload);
},
@@ -72,12 +73,12 @@ var LSselect = new Class({
ajax: true
};
this.searchImgload = varLSdefault.loadingImgDisplay($('title'),'inside');
- new Ajax(a.href, {data: data, onComplete: this.onChangePageClickComplete.bind(this)}).request();
+ new Request({url: a.href, data: data, onSuccess: this.onChangePageClickComplete.bind(this)}).send();
},
onChangePageClickComplete: function(responseText, responseXML) {
varLSdefault.loadingImgHide(this.searchImgload);
- this.content.setHTML(responseText);
+ this.content.set('html',responseText);
this.initializeContent();
},
@@ -91,47 +92,45 @@ var LSselect = new Class({
},
submitSearchForm: function() {
- var imgload = varLSdefault.loadingImgDisplay($('title'),'inside');
- this.LSselect_search_form.send({
- update: this.content,
- onComplete: this.onSubmitSearchFormComplete.bind(this,imgload),
- evalScripts: true
+ this.searchImgload = varLSdefault.loadingImgDisplay($('title'),'inside');
+ this.LSselect_search_form.set('send',{
+ data: this.LSselect_search_form,
+ evalScripts: true,
+ onSuccess: this.onSubmitSearchFormComplete.bind(this),
+ url: this.LSselect_search_form.get('action')
});
+ this.LSselect_search_form.send();
},
- onSubmitSearchFormComplete: function(imgload) {
- varLSdefault.loadingImgHide(imgload);
- if (typeof(debug_txt)!="undefined") {
- var debug = Json.evaluate(debug_txt);
- if (debug) {
- varLSdefault.displayDebug(debug.toString());
- }
- }
- if (typeof(error_txt)!="undefined") {
- var error=Json.evaluate(error_txt);
- if (error) {
- varLSdefault.displayDebug(error.toString());
- }
- }
+ onSubmitSearchFormComplete: function(responseText, responseXML) {
+ varLSdefault.loadingImgHide(this.searchImgload);
+
+ this.content.set('html',responseText);
+
+ varLSdefault.ajaxDisplayDebugAndError();
+
+ this.tempInput.each(function(el) {
+ el.destroy();
+ },this);
+
this.initializeContent();
},
onClickLSselect_refresh_btn: function() {
- var input = new Element('input');
- input.setProperty('name','refresh');
- input.setProperty('type','hidden');
- input.injectInside(this.LSselect_search_form);
+ this.tempInput['refresh'] = new Element('input');
+ this.tempInput['refresh'].setProperty('name','refresh');
+ this.tempInput['refresh'].setProperty('type','hidden');
+ this.tempInput['refresh'].setProperty('value',1);
+ this.tempInput['refresh'].injectInside(this.LSselect_search_form);
this.submitSearchForm();
- input.remove();
},
sortBy: function(value) {
- var input = new Element('input');
- input.setProperty('name','orderby');
- input.setProperty('type','hidden');
- input.setProperty('value',value);
- input.injectInside(this.LSselect_search_form);
+ this.tempInput['sortBy'] = new Element('input');
+ this.tempInput['sortBy'].setProperty('name','orderby');
+ this.tempInput['sortBy'].setProperty('type','hidden');
+ this.tempInput['sortBy'].setProperty('value',value);
+ this.tempInput['sortBy'].injectInside(this.LSselect_search_form);
this.submitSearchForm();
- input.remove();
}
});
diff --git a/trunk/includes/js/LSsession_login.js b/trunk/includes/js/LSsession_login.js
index 6080f07a..148c1f24 100644
--- a/trunk/includes/js/LSsession_login.js
+++ b/trunk/includes/js/LSsession_login.js
@@ -30,26 +30,18 @@ var LSsession_login = new Class({
server: server,
imgload: imgload
};
- new Ajax('index_ajax.php', {data: data, onComplete: this.onLdapServerChangedComplete.bind(this)}).request();
+ new Request({url: 'index_ajax.php', data: data, onSuccess: this.onLdapServerChangedComplete.bind(this)}).send();
},
onLdapServerChangedComplete: function(responseText, responseXML){
varLSdefault.loadingImgHide();
- var data = Json.evaluate(responseText);
+ var data = JSON.decode(responseText);
LSdebug(data);
- if ( data ) {
- if (data.LSdebug) {
- varLSdefault.displayDebug(data.LSdebug);
- }
- if (data.LSerror) {
- varLSdefault.displayError(data.LSerror);
- this.loginformLevelHide();
- return;
- }
+ if ( varLSdefault.checkAjaxReturn(data) ) {
if (data.list_topDn) {
- $('LSsession_topDn').getParent().setHTML(data.list_topDn);
+ $('LSsession_topDn').getParent().set('html',data.list_topDn);
LSdebug($('LSsession_topDn').innerHTML);
- $('LSsession_topDn_label').setHTML(data.levelLabel);
+ $('LSsession_topDn_label').set('html',data.levelLabel);
$$('.loginform-level').each(function(el) {
el.setStyle('display','block');
});
diff --git a/trunk/includes/js/LSsmoothbox.js b/trunk/includes/js/LSsmoothbox.js
index 60d95f1e..3c1334d4 100644
--- a/trunk/includes/js/LSsmoothbox.js
+++ b/trunk/includes/js/LSsmoothbox.js
@@ -3,12 +3,14 @@ var LSsmoothbox = new Class({
this.over = new Element('div');
this.over.setProperty('id','over-LSsmoothbox');
this.over.setStyles({
- width: '100%',
- height: '100%',
- opacity: '0.5',
- position: 'absolute',
- top: Window.getScrollTop(),
- visibility: 'hidden'
+ position: 'absolute',
+ left: '0px',
+ top: '0px',
+ width: '100%',
+ height: '100%',
+ zIndex: 2,
+ backgroundColor: '#000',
+ opacity: 0
});
this.over.injectInside(document.body);
@@ -18,12 +20,22 @@ var LSsmoothbox = new Class({
this.frame = new Element('div');
this.frame.setProperty('id','frame-LSsmoothbox');
-
- this.pnav = new Element('p');
- this.pnav.setProperty('id','pnav-LSsmoothbox');
- this.frame.injectInside(this.win);
- this.pnav.injectInside(this.win);
+ this.frame.injectInside(this.win);
+
+ this._closeConfirm = true;
+
+ this.closeBtn = new Element('span');
+ this.closeBtn.setProperty('id','closeBtn-LSsmoothbox');
+ this.closeBtn.injectInside(this.win);
+ this.closeBtn.addEvent('click',this.closeConfirm.bind(this));
+
+ this._displayValidBtn = false;
+ this.validBtn = new Element('span');
+ this.validBtn.setProperty('id','validBtn-LSsmoothbox');
+ this.validBtn.set('html','Valider');
+ this.validBtn.injectInside(this.win);
+ this.validBtn.addEvent('click',this.close.bindWithEvent(this,true));
$$('a.LSsmoothbox').each(function(el) {
el.addEvent('click',this.clickA.bindWithEvent(this,el));
@@ -34,135 +46,161 @@ var LSsmoothbox = new Class({
el.setStyle('cursor','pointer');
},this);
this.fx = {
- over: this.over.effect('opacity', {duration: 300}).hide(),
- win: this.win.effect('opacity', {duration: 300}).hide()
- };
- },
-
- clickA: function(event,a) {
- new Event(event).stop();
- this.openURL(a.href);
- },
-
- clickImg: function(event,img) {
- new Event(event).stop();
- this.openImg(img.src);
- },
-
- display: function() {
- this.fx.over.start(0.5);
- this.fx.win.start(1);
- },
-
- openURL: function(href,el) {
- this.refreshElement = el;
-
- this.over.setStyle('top',Window.getScrollTop());
-
- var winTop = Window.getScrollTop() + ((window.getHeight() - (window.getHeight()*0.8)) /2);
- this.win.setStyles({
- width: '80%',
- height: '80%',
- position: 'absolute',
- top: winTop,
- left: '10%',
- visibility: 'hidden'
- });
-
- this.frame.setStyles({
- postion: 'absolute',
- width: '100%',
- height: '95%',
- border: 'none'
- });
-
- this.pnav.setStyles({
- width: '100%',
- height: '5%',
- cursor: 'pointer'
- });
-
- this.pnav.empty();
- this.cancelBtn = new Element('span');
- this.cancelBtn.setHTML('Annuler');
- this.cancelBtn.addEvent('click',this.close.bindWithEvent(this,false));
- this.cancelBtn.injectInside(this.pnav);
-
- this.closeBtn = new Element('span');
- this.closeBtn.setHTML('Valider');
- this.closeBtn.addEvent('click',this.close.bindWithEvent(this,true));
- this.closeBtn.injectInside(this.pnav);
-
- var options = {
- method: 'post',
- update: this.frame,
- evalScripts: true
+ over: new Fx.Tween(this.over, {property: 'opacity', duration: 300}),
+ winOpen: new Fx.Morph(this.win, {duration: 500, transition: Fx.Transitions.Sine.easeOut, onStart: this.hideContent.bind(this), onComplete: this.displayContent.bind(this)}),
+ winClose: new Fx.Morph(this.win, {duration: 500, transition: Fx.Transitions.Sine.easeOut, onStart: this.hideContent.bind(this), onComplete: this.resetWin.bind(this)})
};
- new Ajax(href, options).request();
- this.display();
+ this._open=0;
+ window.addEvent('resize', this.position.bind(this));
},
- openImg: function(src) {
- var margin = 25
- this.img = new Element('img');
- this.img.setProperty('src',src);
- if (((this.img.height+margin) > window.getHeight())||(this.img.width>window.getWidth())) {
- var rH = window.getHeight() / (this.img.height+margin);
- var rW = window.getWidth() / (this.img.width);
- if (rH > rW) {
- // W
- this.img.height = Math.floor(this.img.height*window.getWidth()/this.img.width);
- this.img.width = window.getWidth();
- }
- else {
- // H
- this.img.width = Math.floor(this.img.width*(window.getHeight()-margin)/this.img.height);
- this.img.height = window.getHeight() - margin;
- }
+ position: function(){
+ if (this._open==1) {
+ this.overPosition();
+
+ var endStyles = this.getEndStyles();
+ this.fx.winOpen.start({
+ width: endStyles.width,
+ height: endStyles.height,
+ top: endStyles.top,
+ left: endStyles.left
+ });
+ }
+ },
+
+ overPosition: function() {
+ var h = window.getScrollHeight()+'px';
+ var w = window.getScrollWidth()+'px';
+ this.over.setStyles({
+ top: '0px',
+ height: h,
+ width: w
+ });
+ },
+
+ getStartStyles: function() {
+ if (typeof(this.openOptions.startElement) != 'undefined') {
+ var startStyles = {
+ top: this.openOptions.startElement.getCoordinates().top,
+ left: this.openOptions.startElement.getCoordinates().left,
+ width: this.openOptions.startElement.getStyle('width'),
+ height: this.openOptions.startElement.getStyle('height')
+ };
+ }
+ else {
+ var startStyles = {
+ top: '0px',
+ left: '0px',
+ width: '0px',
+ height: '0px'
+ };
+ }
+ return startStyles;
+ },
+
+ getEndStyles: function() {
+ if (this.openOptions.width) {
+ w = this.openOptions.width;
+ }
+ else {
+ w = window.getWidth() * 0.9;
+ }
+ if (this.openOptions.height) {
+ h = this.openOptions.height;
+ }
+ else {
+ h = window.getHeight() * 0.8;
}
- var winTop = Window.getScrollTop() + ((window.getHeight() - (this.img.height+margin)) /2);
- var winLeft = (window.getWidth() - this.img.width) /2;
- this.win.setStyles({
- width: this.img.width,
- height: this.img.height+margin-5,
- position: 'absolute',
- top: winTop,
- left: winLeft,
- visibility: 'hidden'
- });
-
- this.frame.setStyles({
- postion: 'absolute',
- width: '100%',
- height: this.img.height,
- border: 'none'
- });
-
- this.pnav.setStyles({
- width: '100%',
- height: margin-5,
- cursor: 'pointer'
- });
-
-
- this.frame.empty();
- this.img.injectInside(this.frame);
-
- this.pnav.empty();
- this.closeBtn = new Element('span');
- this.closeBtn.setHTML('Fermer');
- this.closeBtn.addEvent('click',this.close.bindWithEvent(this,false));
- this.closeBtn.injectInside(this.pnav);
-
- this.display();
+ var endStyles = {
+ width: w.toInt(),
+ height: h.toInt(),
+ top: ((window.getHeight()/2)-(h/2)-this.win.getStyle('border').toInt()+window.getScrollTop()).toInt(),
+ left: ((window.getWidth()/2)-(w/2)-this.win.getStyle('border').toInt()).toInt()
+ };
+ return endStyles;
},
- close: function(event,refresh) {
- new Event(event).stop();
- this.fx.win.start(0);
+
+ open: function() {
+ this._open=1;
+ this.overPosition();
+ this.fx.over.start(0.7);
+ var startStyles = this.getStartStyles();
+ var endStyles = this.getEndStyles();
+
+
+ this.closeStyles = startStyles;
+ this.win.setStyles(startStyles);
+
+ this.fx.winOpen.setOptions({onComplete: this.displayContent.bind(this)});
+ this.win.setStyle('display','block');
+ this.fx.winOpen.start({
+ width: endStyles.width,
+ height: endStyles.height,
+ top: endStyles.top,
+ left: endStyles.left,
+ opacity: [0, 1]
+ });
+ [this.validBtn,this.closeBtn,this.frame].each(function(el){
+ el.setStyle('display','block');
+ },this);
+ },
+
+ hideContent: function() {
+ this.validBtn.setStyle('visibility','hidden');
+ this.frame.setStyle('visibility','hidden');
+ this.closeBtn.setStyle('visibility','hidden');
+ },
+
+ displayContent: function() {
+ if (this._displayValidBtn) {
+ this.validBtn.setStyle('visibility','visible');
+ }
+ this.frame.setStyle('visibility','visible');
+ this.closeBtn.setStyle('visibility','visible');
+ },
+
+ closeConfirm: function(refresh) {
+ if (this._closeConfirm && this._displayValidBtn) {
+ this.confirmBox = new LSconfirmBox({
+ text: 'Etês-vous sur de vouloir fermer cette fênetre et perdre toute les modifications apportées ?',
+ startElement: this.closeBtn,
+ onConfirm: this.close.bind(this)
+ });
+ }
+ else {
+ this.close();
+ }
+ },
+
+ close: function(refresh) {
+ if (typeof(refresh)=='undefined') {
+ refresh=false;
+ }
+ else {
+ refresh=true;
+ }
+
+ if (this._closeConfirm) {
+ delete this.confirmBox;
+ }
+
+ this.fx.over.cancel();
this.fx.over.start(0);
+ this.hideContent();
+ this.fx.winClose.start({
+ width: this.closeStyles.width,
+ height: this.closeStyles.height,
+ top: this.closeStyles.top,
+ left: this.closeStyles.left,
+ opacity: [1, 0]
+ });
+ this._open=0;
+ [this.validBtn,this.closeBtn,this.frame].each(function(el){
+ el.setStyle('display','none');
+ },this);
if (refresh) {
try {
this.refreshElement.refresh();
@@ -171,9 +209,106 @@ var LSsmoothbox = new Class({
console.log('rater');
}
}
- return true;
- }
+ },
+ resetWin: function() {
+ this.hideContent();
+ this.win.setStyles(this.getStartStyles());
+
+ },
+
+ clickA: function(event,a) {
+ new Event(event).stop();
+ this.openURL(a.href,{startElement: a});
+ },
+
+ clickImg: function(event,img) {
+ new Event(event).stop();
+ this.openImg(img.src,{startElement: img});
+ },
+
+ resize: function() {
+ var endStyles = this.getEndStyles();
+ this.fx.winOpen.cancel();
+ this.fx.winOpen.start({
+ width: endStyles.width,
+ height: endStyles.height,
+ top: endStyles.top,
+ left: endStyles.left,
+ opacity: [0, 1]
+ });
+ },
+
+ load: function() {
+ this.frame.empty();
+ this.loadingImage = new Element('img');
+ this.loadingImage.setProperty('src','templates/images/loading.gif');
+ this.loadingImage.setProperty('id','loadingImage-LSsmoothbox');
+ this.openOptions.width = 120;
+ this.openOptions.height = 120;
+ this.resize();
+ this.loadingImage.injectInside(this.frame);
+ },
+
+ endLoad: function() {
+ this.frame.empty();
+ },
+
+ openImg: function(src,openOptions) {
+ this.hideValidBtn();
+ this.openOptions=openOptions;
+ this.open();
+ this.load();
+ this.img = new Asset.image(src, {onload: this.resizeToImage.bind(this)});
+ },
+
+ resizeToImage: function() {
+ if ((this.img.height > this.win.height)||(this.img.width>this.win.width)) {
+ var rH = this.win.height / this.img.height;
+ var rW = this.win.width / this.img.width;
+ if (rH > rW) {
+ // W
+ this.img.height = Math.floor(this.img.height*this.win.width/this.img.width);
+ this.img.width = this.win.width;
+ }
+ else {
+ // H
+ this.img.width = Math.floor(this.img.width * this.win.height/this.img.height);
+ this.img.height = this.win.height;
+ }
+ }
+ this.endLoad();
+ this.openOptions.width = this.img.width;
+ this.openOptions.height = this.img.height;
+ this.resize();
+ this.img.injectInside(this.frame);
+ },
+
+ setRefreshElement: function(el) {
+ this.refreshElement = el;
+ },
+
+ displayValidBtn: function() {
+ this._displayValidBtn = true;
+ },
+
+ hideValidBtn: function() {
+ this._displayValidBtn = false;
+ },
+
+ openURL: function(href,openOptions) {
+ var options = {
+ method: 'post',
+ update: this.frame,
+ url: href,
+ evalScripts: true,
+ onComplete: varLSdefault.ajaxDisplayDebugAndError()
+ };
+ this.displayValidBtn();
+ new Request.HTML(options).send();
+ this.openOptions = openOptions;
+ this.open();
+ }
});
window.addEvent(window.ie ? 'load' : 'domready', function() {
varLSsmoothbox = new LSsmoothbox();
diff --git a/trunk/includes/js/LSview.js b/trunk/includes/js/LSview.js
index 642fa9cb..1ff699f1 100644
--- a/trunk/includes/js/LSview.js
+++ b/trunk/includes/js/LSview.js
@@ -22,7 +22,7 @@ var LSview = new Class({
},
onTdLSobjectListNamesOut: function(td) {
- td.imgEdit.remove();
+ td.imgEdit.destroy();
}
});
diff --git a/trunk/includes/js/mootools-core.js b/trunk/includes/js/mootools-core.js
new file mode 100644
index 00000000..b120ec5e
--- /dev/null
+++ b/trunk/includes/js/mootools-core.js
@@ -0,0 +1,3816 @@
+/*
+Script: Core.js
+ MooTools - My Object Oriented JavaScript Tools.
+
+License:
+ MIT-style license.
+
+Copyright:
+ Copyright (c) 2006-2007 [Valerio Proietti](http://mad4milk.net/).
+
+Code & Documentation:
+ [The MooTools production team](http://mootools.net/developers/).
+
+Inspiration:
+ - Class implementation inspired by [Base.js](http://dean.edwards.name/weblog/2006/03/base/) Copyright (c) 2006 Dean Edwards, [GNU Lesser General Public License](http://opensource.org/licenses/lgpl-license.php)
+ - Some functionality inspired by [Prototype.js](http://prototypejs.org) Copyright (c) 2005-2007 Sam Stephenson, [MIT License](http://opensource.org/licenses/mit-license.php)
+*/
+
+var MooTools = {
+ 'version': '1.2.0',
+ 'build': ''
+};
+
+var Native = function(options){
+ options = options || {};
+
+ var afterImplement = options.afterImplement || function(){};
+ var generics = options.generics;
+ generics = (generics !== false);
+ var legacy = options.legacy;
+ var initialize = options.initialize;
+ var protect = options.protect;
+ var name = options.name;
+
+ var object = initialize || legacy;
+
+ object.constructor = Native;
+ object.$family = {name: 'native'};
+ if (legacy && initialize) object.prototype = legacy.prototype;
+ object.prototype.constructor = object;
+
+ if (name){
+ var family = name.toLowerCase();
+ object.prototype.$family = {name: family};
+ Native.typize(object, family);
+ }
+
+ var add = function(obj, name, method, force){
+ if (!protect || force || !obj.prototype[name]) obj.prototype[name] = method;
+ if (generics) Native.genericize(obj, name, protect);
+ afterImplement.call(obj, name, method);
+ return obj;
+ };
+
+ object.implement = function(a1, a2, a3){
+ if (typeof a1 == 'string') return add(this, a1, a2, a3);
+ for (var p in a1) add(this, p, a1[p], a2);
+ return this;
+ };
+
+ object.alias = function(a1, a2, a3){
+ if (typeof a1 == 'string'){
+ a1 = this.prototype[a1];
+ if (a1) add(this, a2, a1, a3);
+ } else {
+ for (var a in a1) this.alias(a, a1[a], a2);
+ }
+ return this;
+ };
+
+ return object;
+};
+
+Native.implement = function(objects, properties){
+ for (var i = 0, l = objects.length; i < l; i++) objects[i].implement(properties);
+};
+
+Native.genericize = function(object, property, check){
+ if ((!check || !object[property]) && typeof object.prototype[property] == 'function') object[property] = function(){
+ var args = Array.prototype.slice.call(arguments);
+ return object.prototype[property].apply(args.shift(), args);
+ };
+};
+
+Native.typize = function(object, family){
+ if (!object.type) object.type = function(item){
+ return ($type(item) === family);
+ };
+};
+
+Native.alias = function(objects, a1, a2, a3){
+ for (var i = 0, j = objects.length; i < j; i++) objects[i].alias(a1, a2, a3);
+};
+
+(function(objects){
+ for (var name in objects) Native.typize(objects[name], name);
+})({'boolean': Boolean, 'native': Native, 'object': Object});
+
+(function(objects){
+ for (var name in objects) new Native({name: name, initialize: objects[name], protect: true});
+})({'String': String, 'Function': Function, 'Number': Number, 'Array': Array, 'RegExp': RegExp, 'Date': Date});
+
+(function(object, methods){
+ for (var i = methods.length; i--; i) Native.genericize(object, methods[i], true);
+ return arguments.callee;
+})
+(Array, ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice', 'toString', 'valueOf', 'indexOf', 'lastIndexOf'])
+(String, ['charAt', 'charCodeAt', 'concat', 'indexOf', 'lastIndexOf', 'match', 'replace', 'search', 'slice', 'split', 'substr', 'substring', 'toLowerCase', 'toUpperCase', 'valueOf']);
+
+function $chk(obj){
+ return !!(obj || obj === 0);
+};
+
+function $clear(timer){
+ clearTimeout(timer);
+ clearInterval(timer);
+ return null;
+};
+
+function $defined(obj){
+ return (obj != undefined);
+};
+
+function $empty(){};
+
+function $arguments(i){
+ return function(){
+ return arguments[i];
+ };
+};
+
+function $lambda(value){
+ return (typeof value == 'function') ? value : function(){
+ return value;
+ };
+};
+
+function $extend(original, extended){
+ for (var key in (extended || {})) original[key] = extended[key];
+ return original;
+};
+
+function $unlink(object){
+ var unlinked;
+
+ switch ($type(object)){
+ case 'object':
+ unlinked = {};
+ for (var p in object) unlinked[p] = $unlink(object[p]);
+ break;
+ case 'hash':
+ unlinked = $unlink(object.getClean());
+ break;
+ case 'array':
+ unlinked = [];
+ for (var i = 0, l = object.length; i < l; i++) unlinked[i] = $unlink(object[i]);
+ break;
+ default: return object;
+ }
+
+ return unlinked;
+};
+
+function $merge(){
+ var mix = {};
+ for (var i = 0, l = arguments.length; i < l; i++){
+ var object = arguments[i];
+ if ($type(object) != 'object') continue;
+ for (var key in object){
+ var op = object[key], mp = mix[key];
+ mix[key] = (mp && $type(op) == 'object' && $type(mp) == 'object') ? $merge(mp, op) : $unlink(op);
+ }
+ }
+ return mix;
+};
+
+function $pick(){
+ for (var i = 0, l = arguments.length; i < l; i++){
+ if (arguments[i] != undefined) return arguments[i];
+ }
+ return null;
+};
+
+function $random(min, max){
+ return Math.floor(Math.random() * (max - min + 1) + min);
+};
+
+function $splat(obj){
+ var type = $type(obj);
+ return (type) ? ((type != 'array' && type != 'arguments') ? [obj] : obj) : [];
+};
+
+var $time = Date.now || function(){
+ return new Date().getTime();
+};
+
+function $try(){
+ for (var i = 0, l = arguments.length; i < l; i++){
+ try {
+ return arguments[i]();
+ } catch(e){}
+ }
+ return null;
+};
+
+function $type(obj){
+ if (obj == undefined) return false;
+ if (obj.$family) return (obj.$family.name == 'number' && !isFinite(obj)) ? false : obj.$family.name;
+ if (obj.nodeName){
+ switch (obj.nodeType){
+ case 1: return 'element';
+ case 3: return (/\S/).test(obj.nodeValue) ? 'textnode' : 'whitespace';
+ }
+ } else if (typeof obj.length == 'number'){
+ if (obj.callee) return 'arguments';
+ else if (obj.item) return 'collection';
+ }
+ return typeof obj;
+};
+
+var Hash = new Native({
+
+ name: 'Hash',
+
+ initialize: function(object){
+ if ($type(object) == 'hash') object = $unlink(object.getClean());
+ for (var key in object) this[key] = object[key];
+ return this;
+ }
+
+});
+
+Hash.implement({
+
+ getLength: function(){
+ var length = 0;
+ for (var key in this){
+ if (this.hasOwnProperty(key)) length++;
+ }
+ return length;
+ },
+
+ forEach: function(fn, bind){
+ for (var key in this){
+ if (this.hasOwnProperty(key)) fn.call(bind, this[key], key, this);
+ }
+ },
+
+ getClean: function(){
+ var clean = {};
+ for (var key in this){
+ if (this.hasOwnProperty(key)) clean[key] = this[key];
+ }
+ return clean;
+ }
+
+});
+
+Hash.alias('forEach', 'each');
+
+function $H(object){
+ return new Hash(object);
+};
+
+Array.implement({
+
+ forEach: function(fn, bind){
+ for (var i = 0, l = this.length; i < l; i++) fn.call(bind, this[i], i, this);
+ }
+
+});
+
+Array.alias('forEach', 'each');
+
+function $A(iterable){
+ if (iterable.item){
+ var array = [];
+ for (var i = 0, l = iterable.length; i < l; i++) array[i] = iterable[i];
+ return array;
+ }
+ return Array.prototype.slice.call(iterable);
+};
+
+function $each(iterable, fn, bind){
+ var type = $type(iterable);
+ ((type == 'arguments' || type == 'collection' || type == 'array') ? Array : Hash).each(iterable, fn, bind);
+};
+
+
+/*
+Script: Browser.js
+ The Browser Core. Contains Browser initialization, Window and Document, and the Browser Hash.
+
+License:
+ MIT-style license.
+*/
+
+var Browser = new Hash({
+ Engine: {name: 'unknown', version: ''},
+ Platform: {name: (navigator.platform.match(/mac|win|linux/i) || ['other'])[0].toLowerCase()},
+ Features: {xpath: !!(document.evaluate), air: !!(window.runtime)},
+ Plugins: {}
+});
+
+if (window.opera) Browser.Engine = {name: 'presto', version: (document.getElementsByClassName) ? 950 : 925};
+else if (window.ActiveXObject) Browser.Engine = {name: 'trident', version: (window.XMLHttpRequest) ? 5 : 4};
+else if (!navigator.taintEnabled) Browser.Engine = {name: 'webkit', version: (Browser.Features.xpath) ? 420 : 419};
+else if (document.getBoxObjectFor != null) Browser.Engine = {name: 'gecko', version: (document.getElementsByClassName) ? 19 : 18};
+Browser.Engine[Browser.Engine.name] = Browser.Engine[Browser.Engine.name + Browser.Engine.version] = true;
+
+if (window.orientation != undefined) Browser.Platform.name = 'ipod';
+
+Browser.Platform[Browser.Platform.name] = true;
+
+Browser.Request = function(){
+ return $try(function(){
+ return new XMLHttpRequest();
+ }, function(){
+ return new ActiveXObject('MSXML2.XMLHTTP');
+ });
+};
+
+Browser.Features.xhr = !!(Browser.Request());
+
+Browser.Plugins.Flash = (function(){
+ var version = ($try(function(){
+ return navigator.plugins['Shockwave Flash'].description;
+ }, function(){
+ return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
+ }) || '0 r0').match(/\d+/g);
+ return {version: parseInt(version[0] || 0 + '.' + version[1] || 0), build: parseInt(version[2] || 0)};
+})();
+
+function $exec(text){
+ if (!text) return text;
+ if (window.execScript){
+ window.execScript(text);
+ } else {
+ var script = document.createElement('script');
+ script.setAttribute('type', 'text/javascript');
+ script.text = text;
+ document.head.appendChild(script);
+ document.head.removeChild(script);
+ }
+ return text;
+};
+
+Native.UID = 1;
+
+var $uid = (Browser.Engine.trident) ? function(item){
+ return (item.uid || (item.uid = [Native.UID++]))[0];
+} : function(item){
+ return item.uid || (item.uid = Native.UID++);
+};
+
+var Window = new Native({
+
+ name: 'Window',
+
+ legacy: (Browser.Engine.trident) ? null: window.Window,
+
+ initialize: function(win){
+ $uid(win);
+ if (!win.Element){
+ win.Element = $empty;
+ if (Browser.Engine.webkit) win.document.createElement("iframe"); //fixes safari 2
+ win.Element.prototype = (Browser.Engine.webkit) ? window["[[DOMElement.prototype]]"] : {};
+ }
+ return $extend(win, Window.Prototype);
+ },
+
+ afterImplement: function(property, value){
+ window[property] = Window.Prototype[property] = value;
+ }
+
+});
+
+Window.Prototype = {$family: {name: 'window'}};
+
+new Window(window);
+
+var Document = new Native({
+
+ name: 'Document',
+
+ legacy: (Browser.Engine.trident) ? null: window.Document,
+
+ initialize: function(doc){
+ $uid(doc);
+ doc.head = doc.getElementsByTagName('head')[0];
+ doc.html = doc.getElementsByTagName('html')[0];
+ doc.window = doc.defaultView || doc.parentWindow;
+ if (Browser.Engine.trident4) $try(function(){
+ doc.execCommand("BackgroundImageCache", false, true);
+ });
+ return $extend(doc, Document.Prototype);
+ },
+
+ afterImplement: function(property, value){
+ document[property] = Document.Prototype[property] = value;
+ }
+
+});
+
+Document.Prototype = {$family: {name: 'document'}};
+
+new Document(document);
+
+/*
+Script: Array.js
+ Contains Array Prototypes like copy, each, contains, and remove.
+
+License:
+ MIT-style license.
+*/
+
+Array.implement({
+
+ every: function(fn, bind){
+ for (var i = 0, l = this.length; i < l; i++){
+ if (!fn.call(bind, this[i], i, this)) return false;
+ }
+ return true;
+ },
+
+ filter: function(fn, bind){
+ var results = [];
+ for (var i = 0, l = this.length; i < l; i++){
+ if (fn.call(bind, this[i], i, this)) results.push(this[i]);
+ }
+ return results;
+ },
+
+ clean: function() {
+ return this.filter($defined);
+ },
+
+ indexOf: function(item, from){
+ var len = this.length;
+ for (var i = (from < 0) ? Math.max(0, len + from) : from || 0; i < len; i++){
+ if (this[i] === item) return i;
+ }
+ return -1;
+ },
+
+ map: function(fn, bind){
+ var results = [];
+ for (var i = 0, l = this.length; i < l; i++) results[i] = fn.call(bind, this[i], i, this);
+ return results;
+ },
+
+ some: function(fn, bind){
+ for (var i = 0, l = this.length; i < l; i++){
+ if (fn.call(bind, this[i], i, this)) return true;
+ }
+ return false;
+ },
+
+ associate: function(keys){
+ var obj = {}, length = Math.min(this.length, keys.length);
+ for (var i = 0; i < length; i++) obj[keys[i]] = this[i];
+ return obj;
+ },
+
+ link: function(object){
+ var result = {};
+ for (var i = 0, l = this.length; i < l; i++){
+ for (var key in object){
+ if (object[key](this[i])){
+ result[key] = this[i];
+ delete object[key];
+ break;
+ }
+ }
+ }
+ return result;
+ },
+
+ contains: function(item, from){
+ return this.indexOf(item, from) != -1;
+ },
+
+ extend: function(array){
+ for (var i = 0, j = array.length; i < j; i++) this.push(array[i]);
+ return this;
+ },
+
+ getLast: function(){
+ return (this.length) ? this[this.length - 1] : null;
+ },
+
+ getRandom: function(){
+ return (this.length) ? this[$random(0, this.length - 1)] : null;
+ },
+
+ include: function(item){
+ if (!this.contains(item)) this.push(item);
+ return this;
+ },
+
+ combine: function(array){
+ for (var i = 0, l = array.length; i < l; i++) this.include(array[i]);
+ return this;
+ },
+
+ erase: function(item){
+ for (var i = this.length; i--; i){
+ if (this[i] === item) this.splice(i, 1);
+ }
+ return this;
+ },
+
+ empty: function(){
+ this.length = 0;
+ return this;
+ },
+
+ flatten: function(){
+ var array = [];
+ for (var i = 0, l = this.length; i < l; i++){
+ var type = $type(this[i]);
+ if (!type) continue;
+ array = array.concat((type == 'array' || type == 'collection' || type == 'arguments') ? Array.flatten(this[i]) : this[i]);
+ }
+ return array;
+ },
+
+ hexToRgb: function(array){
+ if (this.length != 3) return null;
+ var rgb = this.map(function(value){
+ if (value.length == 1) value += value;
+ return value.toInt(16);
+ });
+ return (array) ? rgb : 'rgb(' + rgb + ')';
+ },
+
+ rgbToHex: function(array){
+ if (this.length < 3) return null;
+ if (this.length == 4 && this[3] == 0 && !array) return 'transparent';
+ var hex = [];
+ for (var i = 0; i < 3; i++){
+ var bit = (this[i] - 0).toString(16);
+ hex.push((bit.length == 1) ? '0' + bit : bit);
+ }
+ return (array) ? hex : '#' + hex.join('');
+ }
+
+});
+
+/*
+Script: Function.js
+ Contains Function Prototypes like create, bind, pass, and delay.
+
+License:
+ MIT-style license.
+*/
+
+Function.implement({
+
+ extend: function(properties){
+ for (var property in properties) this[property] = properties[property];
+ return this;
+ },
+
+ create: function(options){
+ var self = this;
+ options = options || {};
+ return function(event){
+ var args = options.arguments;
+ args = (args != undefined) ? $splat(args) : Array.slice(arguments, (options.event) ? 1 : 0);
+ if (options.event) args = [event || window.event].extend(args);
+ var returns = function(){
+ return self.apply(options.bind || null, args);
+ };
+ if (options.delay) return setTimeout(returns, options.delay);
+ if (options.periodical) return setInterval(returns, options.periodical);
+ if (options.attempt) return $try(returns);
+ return returns();
+ };
+ },
+
+ pass: function(args, bind){
+ return this.create({arguments: args, bind: bind});
+ },
+
+ attempt: function(args, bind){
+ return this.create({arguments: args, bind: bind, attempt: true})();
+ },
+
+ bind: function(bind, args){
+ return this.create({bind: bind, arguments: args});
+ },
+
+ bindWithEvent: function(bind, args){
+ return this.create({bind: bind, event: true, arguments: args});
+ },
+
+ delay: function(delay, bind, args){
+ return this.create({delay: delay, bind: bind, arguments: args})();
+ },
+
+ periodical: function(interval, bind, args){
+ return this.create({periodical: interval, bind: bind, arguments: args})();
+ },
+
+ run: function(args, bind){
+ return this.apply(bind, $splat(args));
+ }
+
+});
+
+/*
+Script: Number.js
+ Contains Number Prototypes like limit, round, times, and ceil.
+
+License:
+ MIT-style license.
+*/
+
+Number.implement({
+
+ limit: function(min, max){
+ return Math.min(max, Math.max(min, this));
+ },
+
+ round: function(precision){
+ precision = Math.pow(10, precision || 0);
+ return Math.round(this * precision) / precision;
+ },
+
+ times: function(fn, bind){
+ for (var i = 0; i < this; i++) fn.call(bind, i, this);
+ },
+
+ toFloat: function(){
+ return parseFloat(this);
+ },
+
+ toInt: function(base){
+ return parseInt(this, base || 10);
+ }
+
+});
+
+Number.alias('times', 'each');
+
+(function(math){
+ var methods = {};
+ math.each(function(name){
+ if (!Number[name]) methods[name] = function(){
+ return Math[name].apply(null, [this].concat($A(arguments)));
+ };
+ });
+ Number.implement(methods);
+})(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']);
+
+/*
+Script: String.js
+ Contains String Prototypes like camelCase, capitalize, test, and toInt.
+
+License:
+ MIT-style license.
+*/
+
+String.implement({
+
+ test: function(regex, params){
+ return ((typeof regex == 'string') ? new RegExp(regex, params) : regex).test(this);
+ },
+
+ contains: function(string, separator){
+ return (separator) ? (separator + this + separator).indexOf(separator + string + separator) > -1 : this.indexOf(string) > -1;
+ },
+
+ trim: function(){
+ return this.replace(/^\s+|\s+$/g, '');
+ },
+
+ clean: function(){
+ return this.replace(/\s+/g, ' ').trim();
+ },
+
+ camelCase: function(){
+ return this.replace(/-\D/g, function(match){
+ return match.charAt(1).toUpperCase();
+ });
+ },
+
+ hyphenate: function(){
+ return this.replace(/[A-Z]/g, function(match){
+ return ('-' + match.charAt(0).toLowerCase());
+ });
+ },
+
+ capitalize: function(){
+ return this.replace(/\b[a-z]/g, function(match){
+ return match.toUpperCase();
+ });
+ },
+
+ escapeRegExp: function(){
+ return this.replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1');
+ },
+
+ toInt: function(base){
+ return parseInt(this, base || 10);
+ },
+
+ toFloat: function(){
+ return parseFloat(this);
+ },
+
+ hexToRgb: function(array){
+ var hex = this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);
+ return (hex) ? hex.slice(1).hexToRgb(array) : null;
+ },
+
+ rgbToHex: function(array){
+ var rgb = this.match(/\d{1,3}/g);
+ return (rgb) ? rgb.rgbToHex(array) : null;
+ },
+
+ stripScripts: function(option){
+ var scripts = '';
+ var text = this.replace(/
- (end)
-
- Returns:
- email=bob@bob.com&zipCode=90210
- */
-
- toQueryString: function(){
- var queryString = [];
- this.getFormElements().each(function(el){
- var name = el.name;
- var value = el.getValue();
- if (value === false || !name || el.disabled) return;
- var qs = function(val){
- queryString.push(name + '=' + encodeURIComponent(val));
- };
- if ($type(value) == 'array') value.each(qs);
- else qs(value);
- });
- return queryString.join('&');
- }
-
-});
-
-/*
-Script: Element.Dimensions.js
- Contains Element prototypes to deal with Element size and position in space.
-
-Note:
- The functions in this script require n XHTML doctype.
-
-License:
- MIT-style license.
-*/
-
-/*
-Class: Element
- Custom class to allow all of its methods to be used with any DOM element via the dollar function <$>.
-*/
-
-Element.extend({
-
- /*
- Property: scrollTo
- Scrolls the element to the specified coordinated (if the element has an overflow)
-
- Arguments:
- x - the x coordinate
- y - the y coordinate
-
- Example:
- >$('myElement').scrollTo(0, 100)
- */
-
- scrollTo: function(x, y){
- this.scrollLeft = x;
- this.scrollTop = y;
- },
-
- /*
- Property: getSize
- Return an Object representing the size/scroll values of the element.
-
- Example:
- (start code)
- $('myElement').getSize();
- (end)
-
- Returns:
- (start code)
- {
- 'scroll': {'x': 100, 'y': 100},
- 'size': {'x': 200, 'y': 400},
- 'scrollSize': {'x': 300, 'y': 500}
- }
- (end)
- */
-
- getSize: function(){
- return {
- 'scroll': {'x': this.scrollLeft, 'y': this.scrollTop},
- 'size': {'x': this.offsetWidth, 'y': this.offsetHeight},
- 'scrollSize': {'x': this.scrollWidth, 'y': this.scrollHeight}
- };
- },
-
- /*
- Property: getPosition
- Returns the real offsets of the element.
-
- Arguments:
- overflown - optional, an array of nested scrolling containers for scroll offset calculation, use this if your element is inside any element containing scrollbars
-
- Example:
- >$('element').getPosition();
-
- Returns:
- >{x: 100, y:500};
- */
-
- getPosition: function(overflown){
- overflown = overflown || [];
- var el = this, left = 0, top = 0;
- do {
- left += el.offsetLeft || 0;
- top += el.offsetTop || 0;
- el = el.offsetParent;
- } while (el);
- overflown.each(function(element){
- left -= element.scrollLeft || 0;
- top -= element.scrollTop || 0;
- });
- return {'x': left, 'y': top};
- },
-
- /*
- Property: getTop
- Returns the distance from the top of the window to the Element.
-
- Arguments:
- overflown - optional, an array of nested scrolling containers, see Element::getPosition
- */
-
- getTop: function(overflown){
- return this.getPosition(overflown).y;
- },
-
- /*
- Property: getLeft
- Returns the distance from the left of the window to the Element.
-
- Arguments:
- overflown - optional, an array of nested scrolling containers, see Element::getPosition
- */
-
- getLeft: function(overflown){
- return this.getPosition(overflown).x;
- },
-
- /*
- Property: getCoordinates
- Returns an object with width, height, left, right, top, and bottom, representing the values of the Element
-
- Arguments:
- overflown - optional, an array of nested scrolling containers, see Element::getPosition
-
- Example:
- (start code)
- var myValues = $('myElement').getCoordinates();
- (end)
-
- Returns:
- (start code)
- {
- width: 200,
- height: 300,
- left: 100,
- top: 50,
- right: 300,
- bottom: 350
- }
- (end)
- */
-
- getCoordinates: function(overflown){
- var position = this.getPosition(overflown);
- var obj = {
- 'width': this.offsetWidth,
- 'height': this.offsetHeight,
- 'left': position.x,
- 'top': position.y
- };
- obj.right = obj.left + obj.width;
- obj.bottom = obj.top + obj.height;
- return obj;
- }
-
-});
-
-/*
-Script: Window.DomReady.js
- Contains the custom event domready, for window.
-
-License:
- MIT-style license.
-*/
-
-/* Section: Custom Events */
-
-/*
-Event: domready
- executes a function when the dom tree is loaded, without waiting for images. Only works when called from window.
-
-Credits:
- (c) Dean Edwards/Matthias Miller/John Resig, remastered for MooTools.
-
-Arguments:
- fn - the function to execute when the DOM is ready
-
-Example:
- > window.addEvent('domready', function(){
- > alert('the dom is ready');
- > });
-*/
-
-Element.Events.domready = {
-
- add: function(fn){
- if (window.loaded){
- fn.call(this);
- return;
- }
- var domReady = function(){
- if (window.loaded) return;
- window.loaded = true;
- window.timer = $clear(window.timer);
- this.fireEvent('domready');
- }.bind(this);
- if (document.readyState && window.webkit){
- window.timer = function(){
- if (['loaded','complete'].contains(document.readyState)) domReady();
- }.periodical(50);
- } else if (document.readyState && window.ie){
- if (!$('ie_ready')){
- var src = (window.location.protocol == 'https:') ? '://0' : 'javascript:void(0)';
- document.write('
- (end)
- */
-
- send: function(options){
- return new Ajax(this.getProperty('action'), $merge({data: this.toQueryString()}, options, {method: 'post'})).request();
- }
-
-});
-
-/*
-Script: Cookie.js
- A cookie reader/creator
-
-Credits:
- based on the functions by Peter-Paul Koch (http://quirksmode.org)
-*/
-
-/*
-Class: Cookie
- Class for creating, getting, and removing cookies.
-*/
-
-var Cookie = new Abstract({
-
- options: {
- domain: false,
- path: false,
- duration: false,
- secure: false
- },
-
- /*
- Property: set
- Sets a cookie in the browser.
-
- Arguments:
- key - the key (name) for the cookie
- value - the value to set, cannot contain semicolons
- options - an object representing the Cookie options. See Options below. Default values are stored in Cookie.options.
-
- Options:
- domain - the domain the Cookie belongs to. If you want to share the cookie with pages located on a different domain, you have to set this value. Defaults to the current domain.
- path - the path the Cookie belongs to. If you want to share the cookie with pages located in a different path, you have to set this value, for example to "/" to share the cookie with all pages on the domain. Defaults to the current path.
- duration - the duration of the Cookie before it expires, in days.
- If set to false or 0, the cookie will be a session cookie that expires when the browser is closed. This is default.
- secure - Stored cookie information can be accessed only from a secure environment.
-
- Returns:
- An object with the options, the key and the value. You can give it as first parameter to Cookie.remove.
-
- Example:
- >Cookie.set('username', 'Harald'); // session cookie (duration is false), or ...
- >Cookie.set('username', 'JackBauer', {duration: 1}); // save this for 1 day
-
- */
-
- set: function(key, value, options){
- options = $merge(this.options, options);
- value = encodeURIComponent(value);
- if (options.domain) value += '; domain=' + options.domain;
- if (options.path) value += '; path=' + options.path;
- if (options.duration){
- var date = new Date();
- date.setTime(date.getTime() + options.duration * 24 * 60 * 60 * 1000);
- value += '; expires=' + date.toGMTString();
- }
- if (options.secure) value += '; secure';
- document.cookie = key + '=' + value;
- return $extend(options, {'key': key, 'value': value});
- },
-
- /*
- Property: get
- Gets the value of a cookie.
-
- Arguments:
- key - the name of the cookie you wish to retrieve.
-
- Returns:
- The cookie string value, or false if not found.
-
- Example:
- >Cookie.get("username") //returns JackBauer
- */
-
- get: function(key){
- var value = document.cookie.match('(?:^|;)\\s*' + key.escapeRegExp() + '=([^;]*)');
- return value ? decodeURIComponent(value[1]) : false;
- },
-
- /*
- Property: remove
- Removes a cookie from the browser.
-
- Arguments:
- cookie - the name of the cookie to remove or a previous cookie (for domains)
- options - optional. you can also pass the domain and path here. Same as options in
+
+
-
- (end)
-
-Note:
- The title of the element will always be used as the tooltip body. If you put :: on your title, the text before :: will become the tooltip title.
-*/
-
-var Tips = new Class({
-
- options: {
- onShow: function(tip){
- tip.setStyle('visibility', 'visible');
- },
- onHide: function(tip){
- tip.setStyle('visibility', 'hidden');
- },
- maxTitleChars: 30,
- showDelay: 100,
- hideDelay: 100,
- className: 'tool',
- offsets: {'x': 16, 'y': 16},
- fixed: false
- },
-
- initialize: function(elements, options){
- this.setOptions(options);
- this.toolTip = new Element('div', {
- 'class': this.options.className + '-tip',
- 'styles': {
- 'position': 'absolute',
- 'top': '0',
- 'left': '0',
- 'visibility': 'hidden'
- }
- }).inject(document.body);
- this.wrapper = new Element('div').inject(this.toolTip);
- $$(elements).each(this.build, this);
- if (this.options.initialize) this.options.initialize.call(this);
- },
-
- build: function(el){
- el.$tmp.myTitle = (el.href && el.getTag() == 'a') ? el.href.replace('http://', '') : (el.rel || false);
- if (el.title){
- var dual = el.title.split('::');
- if (dual.length > 1){
- el.$tmp.myTitle = dual[0].trim();
- el.$tmp.myText = dual[1].trim();
- } else {
- el.$tmp.myText = el.title;
- }
- el.removeAttribute('title');
- } else {
- el.$tmp.myText = false;
- }
- if (el.$tmp.myTitle && el.$tmp.myTitle.length > this.options.maxTitleChars) el.$tmp.myTitle = el.$tmp.myTitle.substr(0, this.options.maxTitleChars - 1) + "…";
- el.addEvent('mouseenter', function(event){
- this.start(el);
- if (!this.options.fixed) this.locate(event);
- else this.position(el);
- }.bind(this));
- if (!this.options.fixed) el.addEvent('mousemove', this.locate.bindWithEvent(this));
- var end = this.end.bind(this);
- el.addEvent('mouseleave', end);
- el.addEvent('trash', end);
- },
-
- start: function(el){
- this.wrapper.empty();
- if (el.$tmp.myTitle){
- this.title = new Element('span').inject(new Element('div', {'class': this.options.className + '-title'}).inject(this.wrapper)).setHTML(el.$tmp.myTitle);
- }
- if (el.$tmp.myText){
- this.text = new Element('span').inject(new Element('div', {'class': this.options.className + '-text'}).inject(this.wrapper)).setHTML(el.$tmp.myText);
- }
- $clear(this.timer);
- this.timer = this.show.delay(this.options.showDelay, this);
- },
-
- end: function(event){
- $clear(this.timer);
- this.timer = this.hide.delay(this.options.hideDelay, this);
- },
-
- position: function(element){
- var pos = element.getPosition();
- this.toolTip.setStyles({
- 'left': pos.x + this.options.offsets.x,
- 'top': pos.y + this.options.offsets.y
- });
- },
-
- locate: function(event){
- var win = {'x': window.getWidth(), 'y': window.getHeight()};
- var scroll = {'x': window.getScrollLeft(), 'y': window.getScrollTop()};
- var tip = {'x': this.toolTip.offsetWidth, 'y': this.toolTip.offsetHeight};
- var prop = {'x': 'left', 'y': 'top'};
- for (var z in prop){
- var pos = event.page[z] + this.options.offsets[z];
- if ((pos + tip[z] - scroll[z]) > win[z]) pos = event.page[z] - this.options.offsets[z] - tip[z];
- this.toolTip.setStyle(prop[z], pos);
- };
- },
-
- show: function(){
- if (this.options.timeout) this.timer = this.hide.delay(this.options.timeout, this);
- this.fireEvent('onShow', [this.toolTip]);
- },
-
- hide: function(){
- this.fireEvent('onHide', [this.toolTip]);
- }
-
-});
-
-Tips.implement(new Events, new Options);
-
-/*
-Script: Group.js
- For Grouping Classes or Elements Events. The Event added to the Group will fire when all of the events of the items of the group are fired.
-
-License:
- MIT-style license.
-*/
-
-/*
-Class: Group
- An "Utility" Class.
-
-Arguments:
- List of Class instances
-
-Example:
- (start code)
- xhr1 = new Ajax('data.js', {evalScript: true});
- xhr2 = new Ajax('abstraction.js', {evalScript: true});
- xhr3 = new Ajax('template.js', {evalScript: true});
-
- var group = new Group(xhr1, xhr2, xhr3);
- group.addEvent('onComplete', function(){
- alert('All Scripts loaded');
- });
-
- xhr1.request();
- xhr2.request();
- xhr3.request();
- (end)
-
-*/
-
-var Group = new Class({
-
- initialize: function(){
- this.instances = $A(arguments);
- this.events = {};
- this.checker = {};
- },
-
- /*
- Property: addEvent
- adds an event to the stack of events of the Class instances.
-
- Arguments:
- type - string; the event name (e.g. 'onComplete')
- fn - function to execute when all instances fired this event
- */
-
- addEvent: function(type, fn){
- this.checker[type] = this.checker[type] || {};
- this.events[type] = this.events[type] || [];
- if (this.events[type].contains(fn)) return false;
- else this.events[type].push(fn);
- this.instances.each(function(instance, i){
- instance.addEvent(type, this.check.bind(this, [type, instance, i]));
- }, this);
- return this;
- },
-
- check: function(type, instance, i){
- this.checker[type][i] = true;
- var every = this.instances.every(function(current, j){
- return this.checker[type][j] || false;
- }, this);
- if (!every) return;
- this.checker[type] = {};
- this.events[type].each(function(event){
- event.call(this, this.instances, instance);
- }, this);
- }
-
-});
-
-/*
-Script: Accordion.js
- Contains
{$item.label}
{if $item.actions!=''}
-
{foreach from=$item.actions item=action}
-
{$action.label}
+
{$action.label}
{foreach from=$item.objectList item=object}
-
diff --git a/trunk/templates/css/LSconfirmBox.css b/trunk/templates/css/LSconfirmBox.css
new file mode 100644
index 00000000..0cd490ae
--- /dev/null
+++ b/trunk/templates/css/LSconfirmBox.css
@@ -0,0 +1,57 @@
+#box-LSconfirmBox {
+ -moz-border-radius: 5px;
+ margin: auto;
+ position: absolute;
+ z-index: 4;
+ display: none;
+ position: absolute;
+ background-color: #000;
+ min-height: 6em;
+}
+
+#title-LSconfirmBox {
+ width: 100%;
+ font-weight: bold;
+ color: #fff;
+ padding: 0px;
+ padding-left: 0.5em;
+ margin: 0px;
+ opacity: 0;
+}
+
+#text-LSconfirmBox {
+ width: 90%;
+ padding: 0px 5% 0px 5%;
+ text-align: center;
+ font-size: 0.8em;
+ font-style: italic;
+ color: #fff;
+ opacity: 0;
+}
+
+#closeBtn-LSconfirmBox {
+ background: url(../images/close.png) no-repeat;
+ width: 20px;
+ height: 20px;
+ position: absolute;
+ top: -10px;
+ right: -10px;
+ cursor: pointer;
+ opacity: 0;
+}
+
+#btnsBox-LSconfirmBox {
+ width: 100%;
+ text-align: center;
+ opacity: 0;
+}
+
+.btn-LSconfirmBox {
+ background-color: #fff;
+ -moz-border-radius: 5px;
+ color: #000;
+ font-weight: bold;
+ padding: 3px;
+ cursor: pointer;
+ margin: 2px;
+}
diff --git a/trunk/templates/css/LSdefault.css b/trunk/templates/css/LSdefault.css
index 7b4d2661..54ffca2a 100644
--- a/trunk/templates/css/LSdefault.css
+++ b/trunk/templates/css/LSdefault.css
@@ -9,6 +9,10 @@
z-index: 100;
}
+#LSerror_txt {
+ display: none;
+}
+
#LSdebug {
width: 50%;
position: absolute;
@@ -20,6 +24,10 @@
z-index: 100;
}
+#LSdebug_txt {
+ display: none;
+}
+
#LSdebug_hidden {
float: right;
color: #fff;
diff --git a/trunk/templates/css/LSform.css b/trunk/templates/css/LSform.css
index 50773db3..b688910c 100644
--- a/trunk/templates/css/LSform.css
+++ b/trunk/templates/css/LSform.css
@@ -1,3 +1,12 @@
+/*
+ ******************
+ * LSForm
+ ******************
+ */
+
+/*
+ * Architecture
+ */
dl.LSform {
margin: 0;
margin-left: 2em;
@@ -19,6 +28,19 @@ dd.LSform {
padding: 0;
}
+ul.LSform {
+ list-style-type: none;
+ padding: 0;
+ margin: 0;
+}
+
+li.LSform {
+ overflow: auto;
+}
+
+/*
+ * Champs du formulaire
+ */
.LSform input, .LSform select, .LSform textarea {
border: 1px inset #ccc;
width: 300px;
@@ -32,25 +54,25 @@ input[type='submit'].LSform {
width: 8em;
}
-ul.LSform {
- list-style-type: none;
- padding: 0;
- margin: 0;
-}
-
-li.LSform {
- overflow: auto;
-}
-
.LSform-errors {
color: #fff;
background-color: #f59a67;
}
+/* Bouton JS */
img.LSform-add-field-btn, img.LSform-remove-field-btn {
cursor: pointer;
}
+/*
+ ************************
+ * LSformElement
+ ************************
+ */
+
+/*
+ * LSformElement_select_object
+ */
a.LSformElement_select_object_addBtn {
text-decoration: none;
color: #000;
@@ -74,6 +96,47 @@ li.LSformElement_select_object_addBtn {
text-align: center;
}
-img.LSformElement_select_object_deleteBtn, img.LSformElement_password_view_btn, img.LSformElement_password_generate_btn, img.LSformElement_password_verify_btn {
+img.LSformElement_select_object_deleteBtn {
cursor: pointer;
}
+
+/*
+ * LSformElement_password
+ */
+img.LSformElement_password_view_btn, img.LSformElement_password_generate_btn, img.LSformElement_password_verify_btn {
+ cursor: pointer;
+}
+
+/*
+ * LSformElement_image
+ */
+div.LSformElement_image {
+ float: right;
+ clear: both;
+ margin: 2em;
+ background-color: #52bce5;
+ width: 160px;
+ padding: 5px;
+ text-align: center;
+ -moz-border-radius: 1em;
+}
+
+img.LSformElement_image {
+ width: 150px;
+ border: 1px solid #fff;
+ margin: 5px;
+}
+
+div.LSformElement_image_errors {
+ background-color: #f59a67;
+}
+
+ul.LSformElement_image_actions {
+ list-style-type: none;
+ position: absolute;
+ margin-top: 8px;
+ margin-left: 135px;
+ padding: 0;
+ visibility: hidden;
+ cursor: pointer;
+}
diff --git a/trunk/templates/css/LSrelation.css b/trunk/templates/css/LSrelation.css
new file mode 100644
index 00000000..9d6b6c9c
--- /dev/null
+++ b/trunk/templates/css/LSrelation.css
@@ -0,0 +1,8 @@
+/*
+ ***********************
+ * LSrelation
+ ***********************
+ */
+img.LSrelation-btn {
+ margin-left: 0.5em;
+}
diff --git a/trunk/templates/css/LSselect.css b/trunk/templates/css/LSselect.css
new file mode 100644
index 00000000..39f0f2d5
--- /dev/null
+++ b/trunk/templates/css/LSselect.css
@@ -0,0 +1,40 @@
+/*
+ ************************
+ * LSselect
+ ************************
+ */
+
+#LSselect-object {
+ width: 570px;
+}
+
+.sortBy_displayValue, .sortBy_subDn {
+ cursor: pointer;
+}
+
+.LSobject-select-check {
+ width: 10px;
+}
+
+#LSselect_topDn_label {
+ float: left;
+ font-size: 0.8em;
+ margin-left: 1em;
+ margin-top: 0.5em;
+}
+
+ /*
+ * LSselect_search
+ */
+form.LSselect_search {
+ float: none;
+ margin-top: 0.5em;
+}
+
+div.LSselect_search {
+ float: right;
+}
+
+div.LSobject-select {
+ width: 600px;
+}
diff --git a/trunk/templates/css/LSsmoothbox.css b/trunk/templates/css/LSsmoothbox.css
index afd0d61a..7c1ce8c6 100644
--- a/trunk/templates/css/LSsmoothbox.css
+++ b/trunk/templates/css/LSsmoothbox.css
@@ -7,26 +7,49 @@
#win-LSsmoothbox {
background-color: #fff;
- border: 3px solid #000;
+ border: 10px solid #000;
+ -moz-border-radius: 5px;
margin: auto;
-}
-
-#pnav-LSsmoothbox {
- text-align: right;
- font-family: sans-serif;
- font-weight: bold;
- background-color: #777;
- margin: 0;
- margin-bottom: 0;
-}
-
-#pnav-LSsmoothbox span {
- color: #fff;
- margin: 1em;
- margin-bottom: 0;
- font-size: 100%;
+ position: absolute;
+ z-index: 3;
+ display: none;
}
#frame-LSsmoothbox {
overflow: auto;
+ height: 100%;
+ width: 100%;
+ display: none;
+}
+
+#closeBtn-LSsmoothbox {
+ background: url(../images/close.png) no-repeat;
+ width: 20px;
+ height: 20px;
+ position: absolute;
+ top: -20px;
+ right: -20px;
+ cursor: pointer;
+ display: none;
+}
+
+#validBtn-LSsmoothbox {
+ background-color: #000;
+ -moz-border-radius: 5px;
+ height: 22px;
+ font-size: 18px;
+ color: #fff;
+ font-weight: bold;
+ padding: 0px 5px 0px 5px;
+ position: absolute;
+ bottom: -25px;
+ right: 20px;
+ cursor: pointer;
+ display: none;
+}
+
+#loadingImage-LSsmoothbox {
+ width: 100px;
+ height: 100px;
+ margin: 10px;
}
diff --git a/trunk/templates/css/base.css b/trunk/templates/css/base.css
index 44f58bc1..860e4a7f 100644
--- a/trunk/templates/css/base.css
+++ b/trunk/templates/css/base.css
@@ -14,7 +14,7 @@ a:hover {
h1 {
margin: 0.5em;
- margin-bottom: 0em;
+ margin-bottom: 1px;
border-bottom: 1px solid #0072b8;
color: #0072b8;
clear: left;
@@ -30,12 +30,18 @@ hr {
height: 0px;
}
+.btn {
+ cursor: pointer;
+}
+
+/*
+ * Interface
+ */
#main {
width: 1000px;
margin: auto;
border: 1px solid #52bce5;
background: #fff url(../images/fd_menu.png) repeat-y scroll left top;
- height: 100%;
}
#left {
@@ -65,7 +71,13 @@ hr {
padding: 0.3em;
}
+#user_name {
+ font-weight: bold;
+}
+/*
+ * LSsession
+ */
#LSsession_topDn {
height: 1.5em;
width: 150px;
@@ -77,10 +89,11 @@ hr {
color: #fff;
}
-#user_name {
- font-weight: bold;
-}
-
+/*
+ ******************
+ * Menu
+ ******************
+ */
ul.menu {
list-style-image: url(../images/puce.png);
}
@@ -94,6 +107,12 @@ a.menu {
text-decoration: none;
}
+/*
+ ****************
+ * LSobject-list
+ ****************
+ */
+
table.LSobject-list {
margin-left: 1em;
margin-top: 0.5em;
@@ -103,15 +122,9 @@ table.LSobject-list {
clear: both;
}
-td.LSobject-list {
- border: 1px solid #52bce5;
- padding: 0.1em;
-}
-
-td.LSobject-list-without-result {
- text-align: center;
-}
-
+/*
+ * th
+ */
th.LSobject-list {
background-color: #52bce5;
color: #fff;
@@ -125,15 +138,40 @@ th.LSobject-list-subdn {
width: 15em;
}
+img.LSobject-list-ordersense {
+ vertical-align: middle;
+}
+
+th.LSobject-list a {
+ color: #fff;
+ text-decoration: none;
+}
+
+/*
+ * tr
+ */
tr.LSobject-list-bis {
background-color: #ecf8fd;
}
+/*
+ * td
+ */
+td.LSobject-list {
+ border: 1px solid #52bce5;
+ padding: 0.1em;
+}
+
+td.LSobject-list-without-result {
+ text-align: center;
+}
+
a.LSobject-list {
color: #000;
text-decoration: none;
}
+/* Action */
a.LSobject-list-actions {
color: #0072b8;
text-decoration: none;
@@ -144,17 +182,21 @@ a.LSobject-list-actions:hover {
}
td.LSobject-list-actions {
- width: 7em;
+ width: 5em;
}
+/* Name */
td.LSobject-list-names {
cursor: pointer;
}
+/*
+ * Liste des pages
+ */
p.LSobject-list-page {
text-align: center;
margin: 0.5em;
- width: 30em;
+ //width: 100%;
}
a.LSobject-list-page {
@@ -170,25 +212,42 @@ strong.LSobject-list-page {
color: #0072b8;
}
-p.LSview-actions {
+/*
+ *******************
+ * LSview-actions
+ *******************
+ */
+a.LSview-actions {
+ text-decoration: none;
+ color: #000;
+}
+
+ul.LSview-actions {
clear: both;
text-align: right;
font-size: 0.8em;
margin: 0;
- margin-top: 0.3em;
+ margin-top: 0.4em;
margin-right: 3em;
margin-bottom: 0.8em;
color: #0072b8;
}
-a.LSview-actions {
+li.LSview-actions {
text-decoration: none;
color: #000;
border: 1px solid #0072b8;
border-top: 0;
padding: 0.4em;
+ display: inline;
+ margin-right: 1px;
}
+/*
+ *******************
+ * question
+ *******************
+ */
p.question {
margin-left: 3em;
}
@@ -199,37 +258,11 @@ a.question {
color: #0072b8;
}
-div.LSform_image {
- float: right;
- clear: both;
- margin: 2em;
- background-color: #52bce5;
- width: 160px;
- padding: 5px;
- text-align: center;
- -moz-border-radius: 1em;
-}
-
-div.LSform_image_errors {
- background-color: #f59a67;
-}
-
-img.LSform_image {
- width: 150px;
- border: 1px solid #fff;
- margin: 5px;
-}
-
-ul.LSform_image_actions {
- list-style-type: none;
- position: absolute;
- margin-top: 8px;
- margin-left: 135px;
- padding: 0;
- visibility: hidden;
- cursor: pointer;
-}
-
+/*
+ *********************
+ * LSview_search
+ *********************
+ */
form.LSview_search {
float: right;
margin: 0;
@@ -237,14 +270,6 @@ form.LSview_search {
margin-right: 2em;
}
-form.LSselect_search {
- float: none;
-}
-
-div.LSselect_search {
- float: right;
-}
-
#LSview_search_param {
margin: 0px;
padding: 0px;
@@ -265,53 +290,3 @@ input[type='submit'].LSview_search {
background-color: #52bce5;
color: #fff;
}
-
-div.LSobject-select {
- width: 600px;
-}
-
-#LSselect-object {
- width: 570px;
-}
-
-.sortBy_displayValue, .sortBy_subDn {
- cursor: pointer;
-}
-
-.LSobject-select-check {
- width: 10px;
-}
-
-#LSselect_topDn_label {
- float: left;
- font-size: 0.8em;
- margin-left: 1em;
- margin-top: 0.5em;
-}
-
-form.LSselect_search {
- margin-top: 0.5em;
-}
-
-img.LSrelation-btn {
- margin-left: 0.5em;
-}
-
-.btn {
- cursor: pointer;
-}
-
-#LSview_subDnName {
- float: left;
- margin: 0.5em;
- margin-bottom: 0em;
-}
-
-img.LSobject-list-ordersense {
- vertical-align: middle;
-}
-
-th.LSobject-list a {
- color: #fff;
- text-decoration: none;
-}
diff --git a/trunk/templates/images/close.png b/trunk/templates/images/close.png
new file mode 100644
index 0000000000000000000000000000000000000000..fcf3b38038a23f5be1c9f532d5bea48840e43cfc
GIT binary patch
literal 632
zcmV-;0*C#HP)
{foreach from=$LSview_actions item=item}
-
{$item.label}
+
{$item.label}
+
+