- Passage à Mootools v1.2templates/LSrelations.tpl

-> config.inc.php : 
		- Deux fichiers js à include au lieu d'un seul
		- Suppression du Debugger (Debugger.js incompatible)
		- LSformElement_image : refonte de l'affichage
- Templates : 
	- LSview-action : Passage aux balises ul/li plutôt que p/a
	- select.tpl : correction d'un bug concernant la sélection du subDn actif
- Création de LSconfirmBox : module de confirmation
- JS :
	-> LSform.js : Modularisation du code :
		- LSformElement_select_object.js
		- LSformElement_image.js
		- LSformElement_password.js
- CSS : 
	-> Modularisation :
		- LSselect.css
		- LSrelation.css
- LSrelation : 
	-> Refonte du mécanisme JS
	-> Modification de l'affichage
	-> Ajout d'une confirmation à la suppresion (LSconfirmBox)
- LSsmoothbox : Refonte profonde
- view.php : 
 - Correction d'un bug : la colone action était vide lors de la mise en cache
   par LSselect.
- LSldapObject :
	- getDisplayValue() : ajout d'une possibilité de l'affichage du subDn en plus
	du nom
- LSsession : ajout d'un méthode haveSubDn()
- JS : 
 - Modularisation de la verification d'une requete Ajax
 	-> LSdefault : nouvelles méthodes :
		-> checkAjaxReturn() : Pour les retours JSON
		-> ajaxDisplayDebugAndError() : Pour les retours HTML (Type LSselect)
This commit is contained in:
Benjamin Renard 2008-07-05 20:28:49 +00:00
parent b92c7d281a
commit 8d8ede930c
38 changed files with 6632 additions and 8316 deletions

View file

@ -107,14 +107,11 @@ define('LS_TMP_DIR', 'tmp/');
// Javascript // Javascript
$GLOBALS['defaultJSscipts']=array( $GLOBALS['defaultJSscipts']=array(
'mootools.js', 'mootools-core.js',
'mootools-more.js',
'LSdefault.js' 'LSdefault.js'
); );
if ($GLOBALS['LSdebug']['active']) {
$GLOBALS['defaultJSscipts'][]='Debugger.js';
}
// PHP values // PHP values
ini_set( 'magic_quotes_gpc', 'off' ); ini_set( 'magic_quotes_gpc', 'off' );
ini_set( 'magic_quotes_sybase', 'off' ); ini_set( 'magic_quotes_sybase', 'off' );

View file

@ -47,23 +47,24 @@ class LSformElement_image extends LSformElement {
if (!$this -> isFreeze()) { if (!$this -> isFreeze()) {
$id=$this -> name.'_'.rand(); $id=$this -> name.'_'.rand();
$return = $this -> getLabelInfos(); $return = $this -> getLabelInfos();
$return['html'] = "<input type='file' name='".$this -> name."' class='LSform' id='$id' />\n"; $return['html'] = "<input type='file' name='".$this -> name."' class='LSform' id='LSformElement_image_input_$id' />\n";
$this -> form -> setMaxFileSize(MAX_SEND_FILE_SIZE); $this -> form -> setMaxFileSize(MAX_SEND_FILE_SIZE);
} }
if (!empty($this -> values[0])) { if (!empty($this -> values[0])) {
$img_path = $GLOBALS['LSsession'] -> getTmpFile($this -> values[0]); $img_path = $GLOBALS['LSsession'] -> getTmpFile($this -> values[0]);
$GLOBALS['Smarty'] -> assign('LSform_image',array( $GLOBALS['Smarty'] -> assign('LSformElement_image',array(
'img' => $img_path, 'img' => $img_path,
'id' => $id, 'id' => $id,
)); ));
if (!$this -> isFreeze()) { if (!$this -> isFreeze()) {
$GLOBALS['Smarty'] -> assign('LSform_image_actions','delete'); $GLOBALS['Smarty'] -> assign('LSformElement_image_actions','delete');
} }
if ($this -> form -> definedError($this -> name)) { if ($this -> form -> definedError($this -> name)) {
$GLOBALS['Smarty'] -> assign('LSform_image_errors',true); $GLOBALS['Smarty'] -> assign('LSformElement_image_errors',true);
} }
$GLOBALS['LSsession'] -> addJSscript('LSformElement_image.js');
} }
return $return; return $return;
} }

View file

@ -97,6 +97,8 @@ class LSformElement_password extends LSformElement {
if (!empty($this -> values)) { if (!empty($this -> values)) {
$return['html'] .= "* "._('Modification uniquement')."."; $return['html'] .= "* "._('Modification uniquement').".";
} }
$GLOBALS['LSsession'] -> addJSscript('LSformElement_password.js');
} }
else { else {
if (empty($this -> values)) { if (empty($this -> values)) {

View file

@ -69,10 +69,14 @@ class LSformElement_select_object extends LSformElement {
} }
$return['html'].="</ul>\n"; $return['html'].="</ul>\n";
if (!$this -> isFreeze()) { if (!$this -> isFreeze()) {
$GLOBALS['LSsession'] -> addJSscript('LSformElement_select_object.js');
$GLOBALS['LSsession'] -> addJSscript('LSform.js'); $GLOBALS['LSsession'] -> addJSscript('LSform.js');
$GLOBALS['LSsession'] -> addJSscript('LSselect.js'); $GLOBALS['LSsession'] -> addJSscript('LSselect.js');
$GLOBALS['LSsession'] -> addCssFile('LSselect.css');
$GLOBALS['LSsession'] -> addJSscript('LSsmoothbox.js'); $GLOBALS['LSsession'] -> addJSscript('LSsmoothbox.js');
$GLOBALS['LSsession'] -> addCssFile('LSsmoothbox.css'); $GLOBALS['LSsession'] -> addCssFile('LSsmoothbox.css');
$GLOBALS['LSsession'] -> addJSscript('LSconfirmBox.js');
$GLOBALS['LSsession'] -> addCssFile('LSconfirmBox.css');
} }
return $return; return $return;
} }

View file

@ -136,14 +136,20 @@ class LSldapObject {
* @author Benjamin Renard <brenard@easter-eggs.com> * @author Benjamin Renard <brenard@easter-eggs.com>
* *
* @param[in] $spe [<i>optionnel</i>] string Format d'affichage de l'objet * @param[in] $spe [<i>optionnel</i>] string Format d'affichage de l'objet
* @param[in] $full [<i>optionnel</i>] boolean True pour afficher en plus le
* subDnName
* *
* @retval string Valeur descriptive d'affichage de l'objet * @retval string Valeur descriptive d'affichage de l'objet
*/ */
function getDisplayValue($spe='') { function getDisplayValue($spe='',$full=false) {
if ($spe=='') { if ($spe=='') {
$spe = $this -> getDisplayAttributes(); $spe = $this -> getDisplayAttributes();
} }
return $this -> getFData($spe,&$this -> attrs,'getDisplayValue'); $val = $this -> getFData($spe,&$this -> attrs,'getDisplayValue');
if ($GLOBALS['LSsession'] -> haveSubDn() && $full) {
$val.=' ('.$this -> getSubDnName().')';
}
return $val;
} }
/** /**

View file

@ -822,7 +822,6 @@ class LSsession {
// Css // Css
$Css_txt="<link rel='stylesheet' type='text/css' href='templates/css/LSdefault.css' />\n"; $Css_txt="<link rel='stylesheet' type='text/css' href='templates/css/LSdefault.css' />\n";
$Css_txt="<link rel='stylesheet' type='text/css' href='templates/css/LSdefault.css' />\n";
foreach ($this -> CssFiles as $file) { foreach ($this -> CssFiles as $file) {
$Css_txt.="<link rel='stylesheet' type='text/css' href='templates/css/$file' />\n"; $Css_txt.="<link rel='stylesheet' type='text/css' href='templates/css/$file' />\n";
} }
@ -848,8 +847,8 @@ class LSsession {
} }
if ($this -> ajaxDisplay) { if ($this -> ajaxDisplay) {
$GLOBALS['Smarty'] -> assign('error_txt',json_encode($GLOBALS['LSerror']->getErrors())); $GLOBALS['Smarty'] -> assign('LSerror_txt',$GLOBALS['LSerror']->getErrors());
$GLOBALS['Smarty'] -> assign('debug_txt',json_encode(debug_print(true))); $GLOBALS['Smarty'] -> assign('LSdebug_txt',debug_print(true));
} }
else { else {
$GLOBALS['LSerror'] -> display(); $GLOBALS['LSerror'] -> display();
@ -1362,7 +1361,7 @@ class LSsession {
} }
/** /**
* Retourne si un type d'objet est dans le menu courant * Indique si un type d'objet est dans le menu courant
* *
* @retval boolean true si le type d'objet est dans le menu, false sinon * @retval boolean true si le type d'objet est dans le menu, false sinon
*/ */
@ -1372,6 +1371,15 @@ class LSsession {
} }
return isset($this -> LSaccess[$topDn][$LSobject]); return isset($this -> LSaccess[$topDn][$LSobject]);
} }
/**
* Indique si le serveur LDAP courant a des subDn
*
* @retval boolean true si le serveur LDAP courant a des subDn, false sinon
*/
function haveSubDn() {
return (is_array($this -> ldapServer['subDn']));
}
} }
?> ?>

View file

@ -1,395 +0,0 @@
/*
Script: Debugger.js
Creates Firebug <http://www.getfirebug.com> style debugger for browsers without Firebug.
License:
MIT-style license.
*/
var debug = {
timers: {},
pre: function(content, color, bgcolor){
if (debug.disabled) return;
if (!debug._body) debug.create();
var pre = new Element('pre').setStyles({
'padding': '3px 5px',
'margin': '0',
'font': '11px Andale Mono, Monaco, Courier New',
'border-bottom': '1px solid #eee',
'color': color || '#222',
'background-color': bgcolor || '#fff'
});
if ($type(content) == "string") pre.appendText(content);
else pre.adopt(content);
pre.injectInside(debug._contents);
debug._scroll.toBottom();
},
error: function(error){
debug.pre(error.name + ': ' + error.message, '#c92f2f', '#fffef0');
},
register: function(text){
debug.messages.remove(text);
debug.messages.push(text);
debug.idx = debug.messages.length;
var toCookie = debug.messages.join('-:-:-').replace(/;/g, '%%%');
Cookie.set('mootools-debugger-history', toCookie, {duration: {days: 2}});
},
result: function(args, spacer){
spacer = $type(spacer) ? spacer : ' ';
var chunks = [];
$each(args, function(argument){
var type = $type(argument);
if (type){
if ((type != 'string') && (type != 'element')){
try {
argument = Json.toString(argument);
} catch(e) {
argument = 'object not compatible with Json parser';
}
}
chunks.push({'type': type, 'message': argument});
}
});
var holder = new Element('div');
if (!chunks.length) return;
chunks.each(function(chunk){
var color = '#222';
switch(chunk.type){
case 'object': color = '#612fc9'; break;
case 'string': color = '#85b23e'; break;
case 'element':
color = '#3e72b2';
chunk.message = this.makeElementMsg(chunk.message);
break;
case 'boolean': color = '#ff3300'; break;
case 'array': color = '#953eb2'; break;
}
switch(chunk.type){
case 'element':
chunk.message.setStyle('color', color).injectInside(holder);
holder.appendText(spacer);
break;
case 'string':
new Element('span').appendText(chunk.message + spacer).setStyle('color', color).injectInside(holder);
break;
default:
new Element('span').setHTML(chunk.message + spacer).setStyle('color', color).injectInside(holder);
}
}, this);
debug.pre(holder);
},
makeElementMsg: function(el){
var a = new Element('a').addEvent('click', function(e){
new Fx.Style(el, 'opacity').start(0,1);
e.stop();
}.bindWithEvent()).setStyles({'cursor': 'pointer', 'text-decoration': 'none'}).setProperty('href', 'javascript:void(0)');
var htm = ['&lt;' + el.tagName.toLowerCase()];
['id', 'className', 'name', 'href', 'title', 'rel', 'type'].each(function(attr){
if (el[attr]) htm.push(attr + '="' + el[attr] + '"');
});
a.innerHTML = htm.join(' ') + '&gt;';
return a;
},
/*
Property: log
sends a message to the debugger.
Arguments:
messages - any number of strings, objects, etc. to print out
Note:
The debugger will allow firebug style log messages:
%s - String
%d, %i - Integer (numeric formatting is not yet supported)
%f - Floating point number (numeric formatting is not yet supported)
%o - Object hyperlink
Example:
>console.log("the value of x is %s and this paragraph is %o", x, $('id'));
> the value of x is <some value> and this paragraph is <p>
*/
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('&nbsp;|&nbsp;').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('&nbsp;|&nbsp;').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("&gt;&gt;&gt;").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){}
}
}
});
}
}

View file

@ -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();
}
});

View file

@ -3,26 +3,33 @@ var LSdefault = new Class({
this.LSdebug = $('LSdebug'); this.LSdebug = $('LSdebug');
this.LSdebugInfos = $('LSdebug_infos'); this.LSdebugInfos = $('LSdebug_infos');
this.LSdebug.setOpacity(0); this.LSdebug.setOpacity(0);
if (this.LSdebugInfos.innerHTML != '') {
this.displayDebugBox();
}
this.LSdebugHidden = $('LSdebug_hidden'); this.LSdebugHidden = $('LSdebug_hidden');
this.LSdebugHidden.addEvent('click',this.onLSdebugHiddenClick.bindWithEvent(this)); this.LSdebugHidden.addEvent('click',this.onLSdebugHiddenClick.bindWithEvent(this));
this.LSerror = $('LSerror'); this.LSerror = $('LSerror');
this.LSerror.setOpacity(0); this.LSerror.setOpacity(0);
if (this.LSerror.innerHTML != '') {
this.displayLSerror();
}
this.loading_img=[]; this.loading_img=[];
LSdebug(this.loading_img);
this.loading_img_id=-1; this.loading_img_id=-1;
this.LSsession_topDn = $('LSsession_topDn'); this.LSsession_topDn = $('LSsession_topDn');
if (this.LSsession_topDn) { if (this.LSsession_topDn) {
this.LSsession_topDn.addEvent('change',this.onLSsession_topDnChange.bind(this)); 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() { onLSsession_topDnChange: function() {
@ -31,29 +38,55 @@ var LSdefault = new Class({
onLSdebugHiddenClick: function(event){ onLSdebugHiddenClick: function(event){
new Event(event).stop(); new Event(event).stop();
new Fx.Style(this.LSdebug,'opacity',{duration:500}).start(0.8,0); this.fx.LSdebug.start(0.8,0);
},
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.set('html',html);
this.displayErrorBox();
},
displayDebug: function(html) {
this.LSdebugInfos.set('html',html);
this.displayDebugBox();
},
displayErrorBox: function() {
this.LSerror.setStyle('top',getScrollTop()+10);
this.fx.LSerror.start(0,0.8);
(function(){this.fx.LSerror.start(0.8,0);}).delay(10000, this);
}, },
displayDebugBox: function() { displayDebugBox: function() {
this.LSdebug.setStyle('top',getScrollTop()+10); this.LSdebug.setStyle('top',getScrollTop()+10);
new Fx.Style(this.LSdebug,'opacity',{duration:500}).start(0,0.8); this.fx.LSdebug.start(0,0.8);
},
displayError: function(html) {
this.LSerror.empty();
this.LSerror.setHTML(html);
this.displayLSerror();
},
displayDebug: function(html) {
this.LSdebugInfos.setHTML(html);
this.displayDebugBox();
},
displayLSerror: 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);
}, },
loadingImgDisplay: function(el,position,size) { loadingImgDisplay: function(el,position,size) {
@ -72,7 +105,6 @@ var LSdefault = new Class({
else { else {
this.loading_img[this.loading_img_id].injectAfter(el); this.loading_img[this.loading_img_id].injectAfter(el);
} }
LSdebug(this.loading_img_id);
return this.loading_img_id; return this.loading_img_id;
}, },
@ -80,12 +112,30 @@ var LSdefault = new Class({
if (isNaN(id)) { if (isNaN(id)) {
this.loading_img.each(function(el) { this.loading_img.each(function(el) {
if (typeof(el) != 'undefined') if (typeof(el) != 'undefined')
el.remove(); el.destroy();
},this); },this);
this.loading_img_id=-1; this.loading_img_id=-1;
} }
else { 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());
}
} }
} }

View file

@ -7,68 +7,9 @@ var LSform = new Class({
$$('img.LSform-remove-field-btn').each(function(el) { $$('img.LSform-remove-field-btn').each(function(el) {
el.addEvent('click',this.onRemoveFieldBtnClick.bind(this,el)); el.addEvent('click',this.onRemoveFieldBtnClick.bind(this,el));
}, this); }, 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){ onAddFieldBtnClick: function(img){
var getAttrName = /LSform_add_field_btn_(.*)_.*/ var getAttrName = /LSform_add_field_btn_(.*)_.*/
var attrName = getAttrName.exec(img.id)[1]; var attrName = getAttrName.exec(img.id)[1];
LSdebug(attrName); LSdebug(attrName);
@ -84,31 +25,23 @@ var LSform = new Class({
}; };
LSdebug(data); LSdebug(data);
data.imgload = varLSdefault.loadingImgDisplay(img); 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) { onAddFieldBtnClickComplete: function(responseText, responseXML) {
var data = Json.evaluate(responseText); var data = JSON.decode(responseText);
LSdebug(data); LSdebug(data);
if ( data ) { if ( varLSdefault.checkAjaxReturn(data) ) {
if ( typeof(data.LSerror) != "undefined" ) { var li = new Element('li');
varLSdefault.loadingImgHide(data.imgload); var img = $(data.img);
varLSdefault.displayError(data.LSerror); li.set('html',data.html);
return; li.injectAfter(img.getParent());
} li.getElements('img[class=LSform-add-field-btn]').each(function(el) {
else { el.addEvent('click',this.onAddFieldBtnClick.bind(this,el));
varLSdefault.loadingImgHide(data.imgload); }, this);
var li = new Element('li'); li.getElements('img[class=LSform-remove-field-btn]').each(function(el) {
var img = $(data.img); el.addEvent('click',this.onRemoveFieldBtnClick.bind(this,el));
li.setHTML(data.html); }, this);
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=''; img.getPrevious().getPrevious().value='';
} }
else { 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() { window.addEvent(window.ie ? 'load' : 'domready', function() {
varLSform = new LSform(); varLSform = new LSform();

View file

@ -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();
});

View file

@ -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();
});

View file

@ -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();
});

View file

@ -4,6 +4,7 @@ var LSrelation = new Class({
this.deleteBtn = []; this.deleteBtn = [];
this.deleteBtnId = 0; this.deleteBtnId = 0;
this.refreshRelation=0; this.refreshRelation=0;
this._confirmDelete=1;
$$('a.LSrelation_modify').each(function(el) { $$('a.LSrelation_modify').each(function(el) {
this.edit=1; this.edit=1;
el.addEvent('click',this.onLSrelationModifyBtnClick.bindWithEvent(this,el)); el.addEvent('click',this.onLSrelationModifyBtnClick.bindWithEvent(this,el));
@ -15,7 +16,7 @@ var LSrelation = new Class({
initializeBtn: function() { initializeBtn: function() {
$$('img.LSrelation-btn').each(function(el) { $$('img.LSrelation-btn').each(function(el) {
el.remove(); el.destroy();
}, this); }, this);
this.deleteBtnId = 0; this.deleteBtnId = 0;
$$('li.LSrelation').each(function(li) { $$('li.LSrelation').each(function(li) {
@ -31,43 +32,48 @@ var LSrelation = new Class({
}, },
onDeleteBtnClick: function(img) { onDeleteBtnClick: function(img) {
li = img.getParent(); if (this._confirmDelete) {
ul = li.getParent(); var li = img.getParent();
img.remove(); 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); LSdebug(ul.id);
var getId = /LSrelation_ul_([0-9]*)/ var getId = /LSrelation_ul_([0-9]*)/
var id = getId.exec(ul.id)[1]; var id = getId.exec(ul.id)[1];
var data = { var data = {
template: 'LSrelation', template: 'LSrelation',
action: 'deleteByDisplayValue', action: 'deleteByDn',
id: id, id: id,
value: li.innerHTML dn: span.id
}; };
this.deleteLi = li;
data.imgload=varLSdefault.loadingImgDisplay(li.id,'inside'); data.imgload=varLSdefault.loadingImgDisplay(li.id,'inside');
LSdebug(data); new Request({url: 'index_ajax.php', data: data, onSuccess: this.deleteFromImgComplete.bind(this)}).send();
new Ajax('index_ajax.php', {data: data, onComplete: this.onDeleteBtnClickComplete.bind(this)}).request();
}, },
onDeleteBtnClickComplete: function(responseText, responseXML) { deleteFromImgComplete: function(responseText, responseXML) {
var data = Json.evaluate(responseText); var data = JSON.decode(responseText);
LSdebug(data); if ( varLSdefault.checkAjaxReturn(data) ) {
if ( data ) { try {
if ( typeof(data.LSerror) != "undefined" ) { $(data.dn).getParent().destroy();
if (data.imgload!='') { }
varLSdefault.loadingImgHide(data.imgload); catch(e) {
} LSdebug('Erreur durant la suppression du li du DN : '+data.dn);
else { }
varLSdefault.loadingImgHide();
}
varLSdefault.displayError(data.LSerror);
return;
}
else {
varLSdefault.loadingImgHide(data.imgload);
this.deleteLi.remove();
}
} }
}, },
@ -84,27 +90,14 @@ var LSrelation = new Class({
LSdebug(data); LSdebug(data);
this.refreshRelation=a.id; this.refreshRelation=a.id;
data.imgload=varLSdefault.loadingImgDisplay('LSrelation_title_'+a.id,'inside'); 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) { onLSrelationModifyBtnClickComplete: function(responseText, responseXML) {
var data = Json.evaluate(responseText); var data = JSON.decode(responseText);
LSdebug(data); if ( varLSdefault.checkAjaxReturn(data) ) {
if ( data ) { varLSsmoothbox.setRefreshElement(this);
if ( typeof(data.LSerror) != "undefined" ) { varLSsmoothbox.openURL(data.href,{startElement: $(data.id), width: 615});
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);
}
} }
}, },
@ -117,28 +110,14 @@ var LSrelation = new Class({
LSdebug(data); LSdebug(data);
data.imgload=varLSdefault.loadingImgDisplay('LSrelation_title_'+this.refreshRelation,'inside'); 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) { onRrefreshComplete: function(responseText, responseXML) {
var data = Json.evaluate(responseText); var data = JSON.decode(responseText);
LSdebug(data); if ( varLSdefault.checkAjaxReturn(data) ) {
if ( data ) { $('LSrelation_ul_'+this.refreshRelation).set('html',data.html);
if ( typeof(data.LSerror) != "undefined" ) { this.initializeBtn();
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();
}
} }
} }
@ -147,5 +126,3 @@ var LSrelation = new Class({
window.addEvent(window.ie ? 'load' : 'domready', function() { window.addEvent(window.ie ? 'load' : 'domready', function() {
varLSrelation = new LSrelation(); varLSrelation = new LSrelation();
}); });
LSdebug('titi');

View file

@ -9,6 +9,8 @@ var LSselect = new Class({
input.setProperty('type','hidden'); input.setProperty('type','hidden');
input.injectInside(this.LSselect_search_form); input.injectInside(this.LSselect_search_form);
this.tempInput = [];
this.LSselect_search_form.addEvent('submit',this.onSubmitSearchForm.bindWithEvent(this)); this.LSselect_search_form.addEvent('submit',this.onSubmitSearchForm.bindWithEvent(this));
this.LSselect_topDn = $('LSselect_topDn'); this.LSselect_topDn = $('LSselect_topDn');
@ -56,13 +58,12 @@ var LSselect = new Class({
objecttype: $('LSselect-object').getProperties('caption').caption objecttype: $('LSselect-object').getProperties('caption').caption
}; };
} }
LSdebug(data);
data.imgload=varLSdefault.loadingImgDisplay(checkbox.getParent().getNext(),'inside'); 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) { oncheckboxChangeComplete: function(responseText, responseXML) {
var data = Json.evaluate(responseText); var data = JSON.decode(responseText);
varLSdefault.loadingImgHide(data.imgload); varLSdefault.loadingImgHide(data.imgload);
}, },
@ -72,12 +73,12 @@ var LSselect = new Class({
ajax: true ajax: true
}; };
this.searchImgload = varLSdefault.loadingImgDisplay($('title'),'inside'); 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) { onChangePageClickComplete: function(responseText, responseXML) {
varLSdefault.loadingImgHide(this.searchImgload); varLSdefault.loadingImgHide(this.searchImgload);
this.content.setHTML(responseText); this.content.set('html',responseText);
this.initializeContent(); this.initializeContent();
}, },
@ -91,47 +92,45 @@ var LSselect = new Class({
}, },
submitSearchForm: function() { submitSearchForm: function() {
var imgload = varLSdefault.loadingImgDisplay($('title'),'inside'); this.searchImgload = varLSdefault.loadingImgDisplay($('title'),'inside');
this.LSselect_search_form.send({ this.LSselect_search_form.set('send',{
update: this.content, data: this.LSselect_search_form,
onComplete: this.onSubmitSearchFormComplete.bind(this,imgload), evalScripts: true,
evalScripts: true onSuccess: this.onSubmitSearchFormComplete.bind(this),
url: this.LSselect_search_form.get('action')
}); });
this.LSselect_search_form.send();
}, },
onSubmitSearchFormComplete: function(imgload) { onSubmitSearchFormComplete: function(responseText, responseXML) {
varLSdefault.loadingImgHide(imgload); varLSdefault.loadingImgHide(this.searchImgload);
if (typeof(debug_txt)!="undefined") {
var debug = Json.evaluate(debug_txt); this.content.set('html',responseText);
if (debug) {
varLSdefault.displayDebug(debug.toString()); varLSdefault.ajaxDisplayDebugAndError();
}
} this.tempInput.each(function(el) {
if (typeof(error_txt)!="undefined") { el.destroy();
var error=Json.evaluate(error_txt); },this);
if (error) {
varLSdefault.displayDebug(error.toString());
}
}
this.initializeContent(); this.initializeContent();
}, },
onClickLSselect_refresh_btn: function() { onClickLSselect_refresh_btn: function() {
var input = new Element('input'); this.tempInput['refresh'] = new Element('input');
input.setProperty('name','refresh'); this.tempInput['refresh'].setProperty('name','refresh');
input.setProperty('type','hidden'); this.tempInput['refresh'].setProperty('type','hidden');
input.injectInside(this.LSselect_search_form); this.tempInput['refresh'].setProperty('value',1);
this.tempInput['refresh'].injectInside(this.LSselect_search_form);
this.submitSearchForm(); this.submitSearchForm();
input.remove();
}, },
sortBy: function(value) { sortBy: function(value) {
var input = new Element('input'); this.tempInput['sortBy'] = new Element('input');
input.setProperty('name','orderby'); this.tempInput['sortBy'].setProperty('name','orderby');
input.setProperty('type','hidden'); this.tempInput['sortBy'].setProperty('type','hidden');
input.setProperty('value',value); this.tempInput['sortBy'].setProperty('value',value);
input.injectInside(this.LSselect_search_form); this.tempInput['sortBy'].injectInside(this.LSselect_search_form);
this.submitSearchForm(); this.submitSearchForm();
input.remove();
} }
}); });

View file

@ -30,26 +30,18 @@ var LSsession_login = new Class({
server: server, server: server,
imgload: imgload 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){ onLdapServerChangedComplete: function(responseText, responseXML){
varLSdefault.loadingImgHide(); varLSdefault.loadingImgHide();
var data = Json.evaluate(responseText); var data = JSON.decode(responseText);
LSdebug(data); LSdebug(data);
if ( data ) { if ( varLSdefault.checkAjaxReturn(data) ) {
if (data.LSdebug) {
varLSdefault.displayDebug(data.LSdebug);
}
if (data.LSerror) {
varLSdefault.displayError(data.LSerror);
this.loginformLevelHide();
return;
}
if (data.list_topDn) { if (data.list_topDn) {
$('LSsession_topDn').getParent().setHTML(data.list_topDn); $('LSsession_topDn').getParent().set('html',data.list_topDn);
LSdebug($('LSsession_topDn').innerHTML); LSdebug($('LSsession_topDn').innerHTML);
$('LSsession_topDn_label').setHTML(data.levelLabel); $('LSsession_topDn_label').set('html',data.levelLabel);
$$('.loginform-level').each(function(el) { $$('.loginform-level').each(function(el) {
el.setStyle('display','block'); el.setStyle('display','block');
}); });

View file

@ -3,12 +3,14 @@ var LSsmoothbox = new Class({
this.over = new Element('div'); this.over = new Element('div');
this.over.setProperty('id','over-LSsmoothbox'); this.over.setProperty('id','over-LSsmoothbox');
this.over.setStyles({ this.over.setStyles({
width: '100%', position: 'absolute',
height: '100%', left: '0px',
opacity: '0.5', top: '0px',
position: 'absolute', width: '100%',
top: Window.getScrollTop(), height: '100%',
visibility: 'hidden' zIndex: 2,
backgroundColor: '#000',
opacity: 0
}); });
this.over.injectInside(document.body); this.over.injectInside(document.body);
@ -19,11 +21,21 @@ var LSsmoothbox = new Class({
this.frame = new Element('div'); this.frame = new Element('div');
this.frame.setProperty('id','frame-LSsmoothbox'); this.frame.setProperty('id','frame-LSsmoothbox');
this.pnav = new Element('p');
this.pnav.setProperty('id','pnav-LSsmoothbox');
this.frame.injectInside(this.win); this.frame.injectInside(this.win);
this.pnav.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) { $$('a.LSsmoothbox').each(function(el) {
el.addEvent('click',this.clickA.bindWithEvent(this,el)); el.addEvent('click',this.clickA.bindWithEvent(this,el));
@ -34,135 +46,161 @@ var LSsmoothbox = new Class({
el.setStyle('cursor','pointer'); el.setStyle('cursor','pointer');
},this); },this);
this.fx = { this.fx = {
over: this.over.effect('opacity', {duration: 300}).hide(), over: new Fx.Tween(this.over, {property: 'opacity', duration: 300}),
win: this.win.effect('opacity', {duration: 300}).hide() 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)})
},
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
}; };
new Ajax(href, options).request(); this._open=0;
this.display(); window.addEvent('resize', this.position.bind(this));
}, },
openImg: function(src) { position: function(){
var margin = 25 if (this._open==1) {
this.img = new Element('img'); this.overPosition();
this.img.setProperty('src',src);
if (((this.img.height+margin) > window.getHeight())||(this.img.width>window.getWidth())) { var endStyles = this.getEndStyles();
var rH = window.getHeight() / (this.img.height+margin); this.fx.winOpen.start({
var rW = window.getWidth() / (this.img.width); width: endStyles.width,
if (rH > rW) { height: endStyles.height,
// W top: endStyles.top,
this.img.height = Math.floor(this.img.height*window.getWidth()/this.img.width); left: endStyles.left
this.img.width = window.getWidth(); });
} }
else { },
// H
this.img.width = Math.floor(this.img.width*(window.getHeight()-margin)/this.img.height); overPosition: function() {
this.img.height = window.getHeight() - margin; 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 endStyles = {
var winLeft = (window.getWidth() - this.img.width) /2; width: w.toInt(),
this.win.setStyles({ height: h.toInt(),
width: this.img.width, top: ((window.getHeight()/2)-(h/2)-this.win.getStyle('border').toInt()+window.getScrollTop()).toInt(),
height: this.img.height+margin-5, left: ((window.getWidth()/2)-(w/2)-this.win.getStyle('border').toInt()).toInt()
position: 'absolute', };
top: winTop, return endStyles;
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();
}, },
close: function(event,refresh) {
new Event(event).stop(); open: function() {
this.fx.win.start(0); 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.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) { if (refresh) {
try { try {
this.refreshElement.refresh(); this.refreshElement.refresh();
@ -171,9 +209,106 @@ var LSsmoothbox = new Class({
console.log('rater'); 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() { window.addEvent(window.ie ? 'load' : 'domready', function() {
varLSsmoothbox = new LSsmoothbox(); varLSsmoothbox = new LSsmoothbox();

View file

@ -22,7 +22,7 @@ var LSview = new Class({
}, },
onTdLSobjectListNamesOut: function(td) { onTdLSobjectListNamesOut: function(td) {
td.imgEdit.remove(); td.imgEdit.destroy();
} }
}); });

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -181,7 +181,7 @@ if (!isset($_ERRORS)) {
$list = $objRel -> $relationConf['list_function']($object); $list = $objRel -> $relationConf['list_function']($object);
if (is_array($list)) { if (is_array($list)) {
foreach($list as $o) { foreach($list as $o) {
$data['html'].= "<li class='LSrelation'>".$o -> getDisplayValue()."</li>\n"; $data['html'].= "<li class='LSrelation'><span id='".$o -> getDn()."'>".$o -> getDisplayValue()."</span></li>\n";
} }
} }
else { else {
@ -223,8 +223,8 @@ if (!isset($_ERRORS)) {
} }
} }
break; break;
case 'deleteByDisplayValue': case 'deleteByDn':
if ((isset($_REQUEST['id'])) && (isset($_REQUEST['value']))) { if ((isset($_REQUEST['id'])) && (isset($_REQUEST['dn']))) {
if (isset($_SESSION['LSrelation'][$_REQUEST['id']])) { if (isset($_SESSION['LSrelation'][$_REQUEST['id']])) {
$conf = $_SESSION['LSrelation'][$_REQUEST['id']]; $conf = $_SESSION['LSrelation'][$_REQUEST['id']];
if ($GLOBALS['LSsession']->loadLSobject($conf['objectType'])) { if ($GLOBALS['LSsession']->loadLSobject($conf['objectType'])) {
@ -239,7 +239,7 @@ if (!isset($_ERRORS)) {
if (is_array($list)) { if (is_array($list)) {
$ok=false; $ok=false;
foreach($list as $o) { foreach($list as $o) {
if($o -> getDisplayValue() == $_REQUEST['value']) { if($o -> getDn() == $_REQUEST['dn']) {
if (!$o -> deleteOneMember($object)) { if (!$o -> deleteOneMember($object)) {
$GLOBALS['LSerror'] -> addErrorCode(1015,$conf['relationName']); $GLOBALS['LSerror'] -> addErrorCode(1015,$conf['relationName']);
} }
@ -249,8 +249,14 @@ if (!isset($_ERRORS)) {
} }
} }
if (!$ok) { if (!$ok) {
debug($_REQUEST['value']." introuvé parmi la liste");
$GLOBALS['LSerror'] -> addErrorCode(1015,$conf['relationName']); $GLOBALS['LSerror'] -> addErrorCode(1015,$conf['relationName']);
} }
else {
$data=array(
'dn' => $_REQUEST['dn']
);
}
} }
else { else {
$GLOBALS['LSerror'] -> addErrorCode(1015,$conf['relationName']); $GLOBALS['LSerror'] -> addErrorCode(1015,$conf['relationName']);

View file

@ -40,17 +40,16 @@ if($LSsession -> startLSsession()) {
$filter = $_SESSION['LSsession']['LSsearch'][$LSobject]['filter']; $filter = $_SESSION['LSsession']['LSsearch'][$LSobject]['filter'];
if (isCompatibleDNs($_SESSION['LSsession']['LSsearch'][$LSobject]['topDn'],$GLOBALS['LSsession'] -> topDn)) { if (isCompatibleDNs($_SESSION['LSsession']['LSsearch'][$LSobject]['topDn'],$GLOBALS['LSsession'] -> topDn)) {
$topDn = $_SESSION['LSsession']['LSsearch'][$LSobject]['topDn']; $topDn = $_SESSION['LSsession']['LSsearch'][$LSobject]['topDn'];
debug("topDn from cache : ".$topDn); $selectedTopDn = $_SESSION['LSsession']['LSsearch'][$LSobject]['selectedTopDn'];
} }
else { else {
$selectedTopDn = $GLOBALS['LSsession'] -> topDn;
$topDn = $object -> config['container_dn'].','.$GLOBALS['LSsession'] -> topDn; $topDn = $object -> config['container_dn'].','.$GLOBALS['LSsession'] -> topDn;
debug("topDn from cache : ".$topDn);
} }
$params = $_SESSION['LSsession']['LSsearch'][$LSobject]['params']; $params = $_SESSION['LSsession']['LSsearch'][$LSobject]['params'];
$pattern = $_SESSION['LSsession']['LSsearch'][$LSobject]['pattern']; $pattern = $_SESSION['LSsession']['LSsearch'][$LSobject]['pattern'];
$recur = $_SESSION['LSsession']['LSsearch'][$LSobject]['recur']; $recur = $_SESSION['LSsession']['LSsearch'][$LSobject]['recur'];
$approx = $_SESSION['LSsession']['LSsearch'][$LSobject]['approx']; $approx = $_SESSION['LSsession']['LSsearch'][$LSobject]['approx'];
$selectedTopDn = $_SESSION['LSsession']['LSsearch'][$LSobject]['selectedTopDn'];
$orderby = $_SESSION['LSsession']['LSsearch'][$LSobject]['orderby']; $orderby = $_SESSION['LSsession']['LSsearch'][$LSobject]['orderby'];
$ordersense = $_SESSION['LSsession']['LSsearch'][$LSobject]['ordersense']; $ordersense = $_SESSION['LSsession']['LSsearch'][$LSobject]['ordersense'];
$doSubDn = $_SESSION['LSsession']['LSsearch'][$LSobject]['doSubDn']; $doSubDn = $_SESSION['LSsession']['LSsearch'][$LSobject]['doSubDn'];
@ -70,7 +69,7 @@ if($LSsession -> startLSsession()) {
} }
if (isset($_REQUEST['LSview_search_submit'])) { if (isset($_REQUEST['LSview_search_submit'])) {
if (isset($_REQUEST['LSview_pattern']) && ($_REQUEST['LSview_pattern']!=$pattern)) { if ( $_REQUEST['LSview_pattern']!=$pattern ) {
$pattern = $_REQUEST['LSview_pattern']; $pattern = $_REQUEST['LSview_pattern'];
} }
@ -181,8 +180,6 @@ if($LSsession -> startLSsession()) {
) )
); );
if (($GLOBALS['LSsession'] -> cacheSearch()) && isset($_SESSION['LSsession']['LSsearch'][$hash]) && (!isset($_REQUEST['refresh']))) { if (($GLOBALS['LSsession'] -> cacheSearch()) && isset($_SESSION['LSsession']['LSsearch'][$hash]) && (!isset($_REQUEST['refresh']))) {
// On affiche à partir du cache // On affiche à partir du cache
$searchData=$_SESSION['LSsession']['LSsearch'][$hash]; $searchData=$_SESSION['LSsession']['LSsearch'][$hash];

View file

@ -1,13 +1,13 @@
<h1 id='LSrelation_title_{$item.id}'>{$item.label}</h1> <h1 id='LSrelation_title_{$item.id}'>{$item.label}</h1>
{if $item.actions!=''} {if $item.actions!=''}
<p class='LSview-actions'> <ul class='LSview-actions'>
{foreach from=$item.actions item=action} {foreach from=$item.actions item=action}
<a href='{$action.url}' class='LSview-actions LSrelation_modify' id='{$item.id}'><img src='templates/images/{$action.action}.png' alt='{$action.label}' title='{$action.label}' /> {$action.label}</a> <li class='LSview-actions'><a href='{$action.url}' class='LSview-actions LSrelation_modify' id='{$item.id}'><img src='templates/images/{$action.action}.png' alt='{$action.label}' title='{$action.label}' /> {$action.label}</a></li>
{/foreach} {/foreach}
</p> </ul>
{/if} {/if}
<ul id='LSrelation_ul_{$item.id}' class='LSrelation'> <ul id='LSrelation_ul_{$item.id}' class='LSrelation'>
{foreach from=$item.objectList item=object} {foreach from=$item.objectList item=object}
<li class='LSrelation'>{$object}</li> <li class='LSrelation'><span id='{$object.dn}'>{$object.text}</span></li>
{/foreach} {/foreach}
</ul> </ul>

View file

@ -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;
}

View file

@ -9,6 +9,10 @@
z-index: 100; z-index: 100;
} }
#LSerror_txt {
display: none;
}
#LSdebug { #LSdebug {
width: 50%; width: 50%;
position: absolute; position: absolute;
@ -20,6 +24,10 @@
z-index: 100; z-index: 100;
} }
#LSdebug_txt {
display: none;
}
#LSdebug_hidden { #LSdebug_hidden {
float: right; float: right;
color: #fff; color: #fff;

View file

@ -1,3 +1,12 @@
/*
******************
* LSForm
******************
*/
/*
* Architecture
*/
dl.LSform { dl.LSform {
margin: 0; margin: 0;
margin-left: 2em; margin-left: 2em;
@ -19,6 +28,19 @@ dd.LSform {
padding: 0; 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 { .LSform input, .LSform select, .LSform textarea {
border: 1px inset #ccc; border: 1px inset #ccc;
width: 300px; width: 300px;
@ -32,25 +54,25 @@ input[type='submit'].LSform {
width: 8em; width: 8em;
} }
ul.LSform {
list-style-type: none;
padding: 0;
margin: 0;
}
li.LSform {
overflow: auto;
}
.LSform-errors { .LSform-errors {
color: #fff; color: #fff;
background-color: #f59a67; background-color: #f59a67;
} }
/* Bouton JS */
img.LSform-add-field-btn, img.LSform-remove-field-btn { img.LSform-add-field-btn, img.LSform-remove-field-btn {
cursor: pointer; cursor: pointer;
} }
/*
************************
* LSformElement
************************
*/
/*
* LSformElement_select_object
*/
a.LSformElement_select_object_addBtn { a.LSformElement_select_object_addBtn {
text-decoration: none; text-decoration: none;
color: #000; color: #000;
@ -74,6 +96,47 @@ li.LSformElement_select_object_addBtn {
text-align: center; 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; 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;
}

View file

@ -0,0 +1,8 @@
/*
***********************
* LSrelation
***********************
*/
img.LSrelation-btn {
margin-left: 0.5em;
}

View file

@ -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;
}

View file

@ -7,26 +7,49 @@
#win-LSsmoothbox { #win-LSsmoothbox {
background-color: #fff; background-color: #fff;
border: 3px solid #000; border: 10px solid #000;
-moz-border-radius: 5px;
margin: auto; margin: auto;
} position: absolute;
z-index: 3;
#pnav-LSsmoothbox { display: none;
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%;
} }
#frame-LSsmoothbox { #frame-LSsmoothbox {
overflow: auto; 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;
} }

View file

@ -14,7 +14,7 @@ a:hover {
h1 { h1 {
margin: 0.5em; margin: 0.5em;
margin-bottom: 0em; margin-bottom: 1px;
border-bottom: 1px solid #0072b8; border-bottom: 1px solid #0072b8;
color: #0072b8; color: #0072b8;
clear: left; clear: left;
@ -30,12 +30,18 @@ hr {
height: 0px; height: 0px;
} }
.btn {
cursor: pointer;
}
/*
* Interface
*/
#main { #main {
width: 1000px; width: 1000px;
margin: auto; margin: auto;
border: 1px solid #52bce5; border: 1px solid #52bce5;
background: #fff url(../images/fd_menu.png) repeat-y scroll left top; background: #fff url(../images/fd_menu.png) repeat-y scroll left top;
height: 100%;
} }
#left { #left {
@ -65,7 +71,13 @@ hr {
padding: 0.3em; padding: 0.3em;
} }
#user_name {
font-weight: bold;
}
/*
* LSsession
*/
#LSsession_topDn { #LSsession_topDn {
height: 1.5em; height: 1.5em;
width: 150px; width: 150px;
@ -77,10 +89,11 @@ hr {
color: #fff; color: #fff;
} }
#user_name { /*
font-weight: bold; ******************
} * Menu
******************
*/
ul.menu { ul.menu {
list-style-image: url(../images/puce.png); list-style-image: url(../images/puce.png);
} }
@ -94,6 +107,12 @@ a.menu {
text-decoration: none; text-decoration: none;
} }
/*
****************
* LSobject-list
****************
*/
table.LSobject-list { table.LSobject-list {
margin-left: 1em; margin-left: 1em;
margin-top: 0.5em; margin-top: 0.5em;
@ -103,15 +122,9 @@ table.LSobject-list {
clear: both; clear: both;
} }
td.LSobject-list { /*
border: 1px solid #52bce5; * th
padding: 0.1em; */
}
td.LSobject-list-without-result {
text-align: center;
}
th.LSobject-list { th.LSobject-list {
background-color: #52bce5; background-color: #52bce5;
color: #fff; color: #fff;
@ -125,15 +138,40 @@ th.LSobject-list-subdn {
width: 15em; width: 15em;
} }
img.LSobject-list-ordersense {
vertical-align: middle;
}
th.LSobject-list a {
color: #fff;
text-decoration: none;
}
/*
* tr
*/
tr.LSobject-list-bis { tr.LSobject-list-bis {
background-color: #ecf8fd; 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 { a.LSobject-list {
color: #000; color: #000;
text-decoration: none; text-decoration: none;
} }
/* Action */
a.LSobject-list-actions { a.LSobject-list-actions {
color: #0072b8; color: #0072b8;
text-decoration: none; text-decoration: none;
@ -144,17 +182,21 @@ a.LSobject-list-actions:hover {
} }
td.LSobject-list-actions { td.LSobject-list-actions {
width: 7em; width: 5em;
} }
/* Name */
td.LSobject-list-names { td.LSobject-list-names {
cursor: pointer; cursor: pointer;
} }
/*
* Liste des pages
*/
p.LSobject-list-page { p.LSobject-list-page {
text-align: center; text-align: center;
margin: 0.5em; margin: 0.5em;
width: 30em; //width: 100%;
} }
a.LSobject-list-page { a.LSobject-list-page {
@ -170,25 +212,42 @@ strong.LSobject-list-page {
color: #0072b8; color: #0072b8;
} }
p.LSview-actions { /*
*******************
* LSview-actions
*******************
*/
a.LSview-actions {
text-decoration: none;
color: #000;
}
ul.LSview-actions {
clear: both; clear: both;
text-align: right; text-align: right;
font-size: 0.8em; font-size: 0.8em;
margin: 0; margin: 0;
margin-top: 0.3em; margin-top: 0.4em;
margin-right: 3em; margin-right: 3em;
margin-bottom: 0.8em; margin-bottom: 0.8em;
color: #0072b8; color: #0072b8;
} }
a.LSview-actions { li.LSview-actions {
text-decoration: none; text-decoration: none;
color: #000; color: #000;
border: 1px solid #0072b8; border: 1px solid #0072b8;
border-top: 0; border-top: 0;
padding: 0.4em; padding: 0.4em;
display: inline;
margin-right: 1px;
} }
/*
*******************
* question
*******************
*/
p.question { p.question {
margin-left: 3em; margin-left: 3em;
} }
@ -199,37 +258,11 @@ a.question {
color: #0072b8; color: #0072b8;
} }
div.LSform_image { /*
float: right; *********************
clear: both; * LSview_search
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;
}
form.LSview_search { form.LSview_search {
float: right; float: right;
margin: 0; margin: 0;
@ -237,14 +270,6 @@ form.LSview_search {
margin-right: 2em; margin-right: 2em;
} }
form.LSselect_search {
float: none;
}
div.LSselect_search {
float: right;
}
#LSview_search_param { #LSview_search_param {
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
@ -265,53 +290,3 @@ input[type='submit'].LSview_search {
background-color: #52bce5; background-color: #52bce5;
color: #fff; 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;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 B

View file

@ -1,24 +1,24 @@
{include file='top.tpl'} {include file='top.tpl'}
{if $pagetitle != ''}<h1>{$pagetitle}</h1>{/if} {if $pagetitle != ''}<h1>{$pagetitle}</h1>{/if}
{if $LSview_actions != ''} {if $LSview_actions != ''}
<p class='LSview-actions'> <ul class='LSview-actions'>
{foreach from=$LSview_actions item=item} {foreach from=$LSview_actions item=item}
<a href='{$item.url}' class='LSview-actions'><img src='templates/images/{$item.action}.png' alt='{$item.label}' title='{$item.label}' /> {$item.label}</a> <li class='LSview-actions'><a href='{$item.url}' class='LSview-actions'><img src='templates/images/{$item.action}.png' alt='{$item.label}' title='{$item.label}' /> {$item.label}</a></li>
{/foreach} {/foreach}
</p> </ul>
{/if} {/if}
{if $LSform_image!=''} {if $LSformElement_image!=''}
<div class='LSform_image{if $LSform_image_errors} LSform_image_errors{/if}'> <div class='LSformElement_image{if $LSformElement_image_errors} LSformElement_image_errors{/if}'>
{if $LSform_image_actions!='' && !$LSform_image_errors} {if $LSformElement_image_actions!='' && !$LSformElement_image_errors}
<ul class='LSform_image_actions'> <ul class='LSformElement_image_actions'>
<li><img src='templates/images/zoom.png' class='LSform_image_actions LSform_image_action_zoom' id='LSform_image_action_zoom_{$LSform_image.id}' /></li> <li><img src='templates/images/zoom.png' class='LSformElement_image_actions LSformElement_image_action_zoom' id='LSformElement_image_action_zoom_{$LSformElement_image.id}' /></li>
{foreach from=$LSform_image_actions item=item} {foreach from=$LSformElement_image_actions item=item}
<li><img src='templates/images/{$item}.png' class='LSform_image_actions LSform_image_action_{$item}' id='LSform_image_action_{$item}_{$LSform_image.id}' /></li> <li><img src='templates/images/{$item}.png' class='LSformElement_image_actions LSformElement_image_action_{$item}' id='LSformElement_image_action_{$item}_{$LSformElement_image.id}' /></li>
{/foreach} {/foreach}
</ul> </ul>
{/if} {/if}
<img src='{$LSform_image.img}' class='LSform_image LSsmoothbox' /> <img src='{$LSformElement_image.img}' class='LSformElement_image LSsmoothbox' id='LSformElement_image_{$LSformElement_image.id}' />
</div> </div>
{/if} {/if}

View file

@ -11,7 +11,7 @@
{if $LSsession_subDn!=""} {if $LSsession_subDn!=""}
<label id='LSselect_topDn_label'>{$label_level} <label id='LSselect_topDn_label'>{$label_level}
<select name='LSselect_topDn' id='LSselect_topDn'> <select name='LSselect_topDn' id='LSselect_topDn'>
{html_options values=$LSsession_subDn_indexes output=$LSsession_subDn_names selected=$LSselect_subDn} {html_options values=$LSsession_subDn_indexes output=$LSsession_subDn_names selected=$LSselect_topDn}
</select> </select>
</label> </label>
{/if} {/if}

View file

@ -28,7 +28,5 @@
{/section} {/section}
</p> </p>
{/if} {/if}
<script type='text/javascript'> <div id='LSdebug_txt'>{$LSdebug_txt}</div>
debug_txt = {$debug_txt}; <div id='LSerror_txt'>{$LSerror_txt}</div>
error_txt = {$error_txt};
</script>

View file

@ -1,15 +1,15 @@
{include file='top.tpl'} {include file='top.tpl'}
{if $pagetitle != ''}<h1>{$pagetitle}</h1>{/if} {if $pagetitle != ''}<h1>{$pagetitle}</h1>{/if}
{if $LSview_actions != ''} {if $LSview_actions != ''}
<p class='LSview-actions'> <ul class='LSview-actions'>
{foreach from=$LSview_actions item=item} {foreach from=$LSview_actions item=item}
<a href='{$item.url}' class='LSview-actions'><img src='templates/images/{$item.action}.png' alt='{$item.label}' title='{$item.label}' /> {$item.label}</a> <li class='LSview-actions'><a href='{$item.url}' class='LSview-actions' ><img src='templates/images/{$item.action}.png' alt='{$item.label}' title='{$item.label}' /> {$item.label}</a></li>
{/foreach} {/foreach}
</p> </ul>
{/if} {/if}
{if $LSform_image!=''} {if $LSformElement_image!=''}
<div class='LSform_image'> <div class='LSformElement_image'>
<a href='{$LSform_image.img}'><img src='{$LSform_image.img}' class='LSform_image LSsmoothbox' /></a> <a href='{$LSformElement_image.img}.png' rel='rien ici' title='comment' class='mb'><img src='{$LSformElement_image.img}' class='LSformElement_image LSsmoothbox' id='LSformElement_image_{$LSformElement_image.id}' /></a>
</div> </div>
{/if} {/if}
<dl class='LSform'> <dl class='LSform'>

View file

@ -15,11 +15,11 @@
</h1> </h1>
{if $LSview_actions != ''} {if $LSview_actions != ''}
<p class='LSview-actions'> <ul class='LSview-actions'>
{foreach from=$LSview_actions item=item} {foreach from=$LSview_actions item=item}
<a href='{$item.url}' class='LSview-actions'><img src='templates/images/{$item.action}.png' alt='{$item.label}' title='{$item.label}' /> {$item.label}</a> <li class='LSview-actions'><a href='{$item.url}' class='LSview-actions'><img src='templates/images/{$item.action}.png' alt='{$item.label}' title='{$item.label}' /> {$item.label}</a></li>
{/foreach} {/foreach}
</p> </ul>
{/if} {/if}
<table class='LSobject-list'> <table class='LSobject-list'>

View file

@ -78,7 +78,7 @@ if($LSsession -> startLSsession()) {
$view = $object -> getView(); $view = $object -> getView();
$view -> displayView(); $view -> displayView();
// Relations // Relations
if (is_array($object -> config['relations'])) { if (is_array($object -> config['relations'])) {
$LSrelations=array(); $LSrelations=array();
foreach($object -> config['relations'] as $relationName => $relationConf) { foreach($object -> config['relations'] as $relationName => $relationConf) {
@ -101,16 +101,23 @@ if($LSsession -> startLSsession()) {
} }
$GLOBALS['LSsession'] -> addJSscript('LSselect.js'); $GLOBALS['LSsession'] -> addJSscript('LSselect.js');
$GLOBALS['LSsession'] -> addCssFile('LSselect.css');
$GLOBALS['LSsession'] -> addJSscript('LSsmoothbox.js'); $GLOBALS['LSsession'] -> addJSscript('LSsmoothbox.js');
$GLOBALS['LSsession'] -> addCssFile('LSsmoothbox.css'); $GLOBALS['LSsession'] -> addCssFile('LSsmoothbox.css');
$GLOBALS['LSsession'] -> addJSscript('LSrelation.js'); $GLOBALS['LSsession'] -> addJSscript('LSrelation.js');
$GLOBALS['LSsession'] -> addCssFile('LSrelation.css');
if($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) { if($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) {
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) { if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
$objRel = new $relationConf['LSobject'](); $objRel = new $relationConf['LSobject']();
$list = $objRel -> $relationConf['list_function']($object); $list = $objRel -> $relationConf['list_function']($object);
if (is_array($list)) { if (is_array($list)) {
foreach($list as $o) { foreach($list as $o) {
$return['objectList'][] = $o -> getDisplayValue(); $o_infos = array(
'text' => $o -> getDisplayValue(NULL,true),
'dn' => $o -> getDn()
);
$return['objectList'][] = $o_infos;
} }
} }
else { else {
@ -127,6 +134,8 @@ if($LSsession -> startLSsession()) {
} }
} }
} }
$GLOBALS['LSsession'] -> addJSscript('LSconfirmBox.js');
$GLOBALS['LSsession'] -> addCssFile('LSconfirmBox.css');
$GLOBALS['Smarty'] -> assign('LSrelations',$LSrelations); $GLOBALS['Smarty'] -> assign('LSrelations',$LSrelations);
} }
@ -303,42 +312,11 @@ if($LSsession -> startLSsession()) {
$subDn_name = $thisObject -> getSubDnName(); $subDn_name = $thisObject -> getSubDnName();
} }
$nbObjects++; $nbObjects++;
unset($actions);
$actions[] = array(
'label' => _('Voir'),
'url' =>'view.php?LSobject='.$LSobject.'&amp;dn='.$thisObject -> getValue('dn'),
'action' => 'view'
);
if ($GLOBALS['LSsession'] -> canEdit($LSobject,$thisObject->getValue('dn'))) {
$actions[]=array(
'label' => _('Modifier'),
'url' => 'modify.php?LSobject='.$LSobject.'&amp;dn='.$thisObject->getValue('dn'),
'action' => 'modify'
);
}
if ($canCopy) {
$actions[] = array(
'label' => _('Copier'),
'url' =>'create.php?LSobject='.$LSobject.'&amp;load='.$thisObject -> getValue('dn'),
'action' => 'copy'
);
}
if ($GLOBALS['LSsession'] -> canRemove($thisObject -> getType(),$thisObject -> getValue('dn'))) {
$actions[] = array (
'label' => _('Supprimer'),
'url' => 'remove.php?LSobject='.$LSobject.'&amp;dn='.$thisObject -> getValue('dn'),
'action' => 'delete'
);
}
$objectList[]=array( $objectList[]=array(
'dn' => $thisObject->getValue('dn'), 'dn' => $thisObject->getValue('dn'),
'displayValue' => $thisObject->getDisplayValue(), 'displayValue' => $thisObject->getDisplayValue(),
'actions' => $actions,
'subDn' => $subDn_name 'subDn' => $subDn_name
); );
} }
@ -348,8 +326,44 @@ if($LSsession -> startLSsession()) {
$searchData['objectList']=$objectList; $searchData['objectList']=$objectList;
$searchData['LSview_actions'] = $LSview_actions; $searchData['LSview_actions'] = $LSview_actions;
if ($GLOBALS['LSsession'] -> cacheSearch()) {
$_SESSION['LSsession']['LSsearch'][$hash]=$searchData; }
if ((!isset($searchData['objectList'][0]['actions']))&&(!empty($searchData['objectList']))) {
debug('Load actions');
for($i=0;$i<$searchData['LSobject_list_nbresult'];$i++) {
$actions=array();
$actions[] = array(
'label' => _('Voir'),
'url' =>'view.php?LSobject='.$LSobject.'&amp;dn='.$searchData['objectList'][$i]['dn'],
'action' => 'view'
);
if ($GLOBALS['LSsession'] -> canEdit($LSobject,$searchData['objectList'][$i]['dn'])) {
$actions[]=array(
'label' => _('Modifier'),
'url' => 'modify.php?LSobject='.$LSobject.'&amp;dn='.$searchData['objectList'][$i]['dn'],
'action' => 'modify'
);
}
if ($canCopy) {
$actions[] = array(
'label' => _('Copier'),
'url' =>'create.php?LSobject='.$LSobject.'&amp;load='.$searchData['objectList'][$i]['dn'],
'action' => 'copy'
);
}
if ($GLOBALS['LSsession'] -> canRemove($LSobject,$searchData['objectList'][$i]['dn'])) {
$actions[] = array (
'label' => _('Supprimer'),
'url' => 'remove.php?LSobject='.$LSobject.'&amp;dn='.$searchData['objectList'][$i]['dn'],
'action' => 'delete'
);
}
$searchData['objectList'][$i]['actions']=$actions;
} }
} }
@ -378,11 +392,14 @@ if($LSsession -> startLSsession()) {
if (!uasort($searchData['objectList'],'sortBy')) { if (!uasort($searchData['objectList'],'sortBy')) {
debug('Erreur durant le trie.'); debug('Erreur durant le trie.');
} }
$_SESSION['LSsession']['LSsearch'][$hash]=$searchData;
} }
$GLOBALS['Smarty']->assign('LSobject_list_orderby',$orderby); $GLOBALS['Smarty']->assign('LSobject_list_orderby',$orderby);
$GLOBALS['Smarty']->assign('LSobject_list_ordersense',$ordersense); $GLOBALS['Smarty']->assign('LSobject_list_ordersense',$ordersense);
if ($GLOBALS['LSsession'] -> cacheSearch()) {
$_SESSION['LSsession']['LSsearch'][$hash]=$searchData;
}
// Pagination // Pagination
if ($searchData['LSobject_list_nbresult'] > NB_LSOBJECT_LIST) { if ($searchData['LSobject_list_nbresult'] > NB_LSOBJECT_LIST) {
if (isset($_REQUEST['page'])) { if (isset($_REQUEST['page'])) {