mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-26 11:52:59 +01:00
- LSform :
-> Redimentionnement des dt pour laisser plus de place aux labels - LSformElement_boolean, LSformElement_select : Ajout d'un bouton clear - L'ajout des boutons javascript a été déporté dans le code javascript : -> LSformElement_url -> LSformElement_mail -> LSformElement_rss -> LSformElement_xmp - LSformElement_select_object -> Activation du champ de formulaire directement dans le javascript
This commit is contained in:
parent
b88fca55cb
commit
ab7120b589
17 changed files with 254 additions and 61 deletions
|
@ -45,14 +45,15 @@ class LSformElement_boolean extends LSformElement {
|
||||||
if (!$this -> isFreeze()) {
|
if (!$this -> isFreeze()) {
|
||||||
$return['html'] = "<ul class='LSform'>\n";
|
$return['html'] = "<ul class='LSform'>\n";
|
||||||
if (empty($this -> values)) {
|
if (empty($this -> values)) {
|
||||||
$return['html'] .= "<li>".$this -> getEmptyField()."</li>\n";
|
$return['html'] .= "<li class='LSformElement_boolean'>".$this -> getEmptyField()."</li>\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
foreach ($this -> values as $value) {
|
foreach ($this -> values as $value) {
|
||||||
$return['html'] .= "<li><input type='radio' value='1' name='".$this -> name."[0]' ".(($this -> isTrue($this -> values))?'checked':'')." /> "._('Oui')."<input type='radio' value='0' name='".$this -> name."[0]' ".(($this -> isTrue($this -> values))?'':'checked')." /> "._('Non')."</li>\n";
|
$return['html'] .= "<li class='LSformElement_boolean'><input type='radio' value='1' name='".$this -> name."[0]' ".(($this -> isTrue($this -> values))?'checked':'')." /> "._('Oui')."<input type='radio' value='0' name='".$this -> name."[0]' ".(($this -> isTrue($this -> values))?'':'checked')." /> "._('Non')."</li>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$return['html'] .= "</ul>\n";
|
$return['html'] .= "</ul>\n";
|
||||||
|
$GLOBALS['LSsession'] -> addJSscript('LSformElement_boolean.js');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$return['html'] = "<ul class='LSform LSformElement_text'>\n";
|
$return['html'] = "<ul class='LSform LSformElement_text'>\n";
|
||||||
|
|
|
@ -51,7 +51,7 @@ class LSformElement_mail extends LSformElement {
|
||||||
foreach ($this -> values as $value) {
|
foreach ($this -> values as $value) {
|
||||||
$multiple = $this -> getMultipleData();
|
$multiple = $this -> getMultipleData();
|
||||||
$id = "LSform_".$this -> name."_".rand();
|
$id = "LSform_".$this -> name."_".rand();
|
||||||
$return['html'] .= "<li><input type='text' name='".$this -> name."[]' value=\"".$value."\" id='".$id."'><img src='templates/images/mail.png' class='LSformElement_mail_btn btn' alt='"._('Envoyer un mail.')."' title='"._('Envoyer un mail.')."'/>".$multiple."</li>\n";
|
$return['html'] .= "<li><input class='LSformElement_mail' type='text' name='".$this -> name."[]' value=\"".$value."\" id='".$id."'>$multiple</li>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$return['html'] .= "</ul>\n";
|
$return['html'] .= "</ul>\n";
|
||||||
|
@ -63,7 +63,7 @@ class LSformElement_mail extends LSformElement {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
foreach ($this -> values as $value) {
|
foreach ($this -> values as $value) {
|
||||||
$return['html'] .= "<li><a href='mailto:".$value."'>".$value."</a><img src='templates/images/mail.png' alt='"._('Envoyer un mail.')."' title='"._('Envoyer un mail.')."' class='LSformElement_mail_btn btn'></li>\n";
|
$return['html'] .= "<li><a class='LSformElement_mail' href='mailto:".$value."'>".$value."</a></li>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$return['html'] .= "</ul>\n";
|
$return['html'] .= "</ul>\n";
|
||||||
|
@ -84,7 +84,7 @@ class LSformElement_mail extends LSformElement {
|
||||||
*/
|
*/
|
||||||
function getEmptyField() {
|
function getEmptyField() {
|
||||||
$multiple = $this -> getMultipleData();
|
$multiple = $this -> getMultipleData();
|
||||||
return "<input type='text' name='".$this -> name."[]' id='LSform_".$this -> name."_".rand()."'><img src='templates/images/mail.png' class='LSformElement_mail_btn btn' alt='"._('Envoyer un mail.')."' title='"._('Envoyer un mail.')."'/>".$multiple;
|
return "<input type='text' class='LSformElement_mail' name='".$this -> name."[]' id='LSform_".$this -> name."_".rand()."'/>".$multiple;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ class LSformElement_rss extends LSformElement {
|
||||||
foreach ($this -> values as $value) {
|
foreach ($this -> values as $value) {
|
||||||
$multiple = $this -> getMultipleData();
|
$multiple = $this -> getMultipleData();
|
||||||
$id = "LSform_".$this -> name."_".rand();
|
$id = "LSform_".$this -> name."_".rand();
|
||||||
$return['html'] .= "<li><input type='text' name='".$this -> name."[]' value=\"".$value."\" id='".$id."'><img src='templates/images/rss.png' class='LSformElement_rss_btn btn' alt='"._('Afficher la file RSS.')."' title='"._('Afficher la file RSS.')."'/>".$multiple."</li>\n";
|
$return['html'] .= "<li><input class='LSformElement_rss' type='text' name='".$this -> name."[]' value=\"".$value."\" id='".$id."'>$multiple</li>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$return['html'] .= "</ul>\n";
|
$return['html'] .= "</ul>\n";
|
||||||
|
@ -64,7 +64,7 @@ class LSformElement_rss extends LSformElement {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
foreach ($this -> values as $value) {
|
foreach ($this -> values as $value) {
|
||||||
$return['html'] .= "<li><a href='".$value."'>".$value."</a><img src='templates/images/rss.png' alt='"._('Afficher la file RSS.')."' title='"._('Afficher la file RSS.')."' class='LSformElement_rss_btn btn'></li>\n";
|
$return['html'] .= "<li><a class='LSformElement_rss' href='".$value."'>".$value."</a></li>\n";
|
||||||
$GLOBALS['LSsession'] -> addJSscript('LSformElement_rss.js');
|
$GLOBALS['LSsession'] -> addJSscript('LSformElement_rss.js');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ class LSformElement_rss extends LSformElement {
|
||||||
*/
|
*/
|
||||||
function getEmptyField() {
|
function getEmptyField() {
|
||||||
$multiple = $this -> getMultipleData();
|
$multiple = $this -> getMultipleData();
|
||||||
return "<input type='text' name='".$this -> name."[]' id='LSform_".$this -> name."_".rand()."'><img src='templates/images/rss.png' class='LSformElement_rss_btn btn' alt='"._('Afficher la file RSS.')."' title='"._('Afficher la file RSS.')."'/>".$multiple;
|
return "<input class='LSformElement_rss' type='text' name='".$this -> name."[]' id='LSform_".$this -> name."_".rand()."'>".$multiple;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ class LSformElement_select extends LSformElement {
|
||||||
$return['html'].="<option value=\"".$choice_value."\"$selected>$choice_text</option>\n";
|
$return['html'].="<option value=\"".$choice_value."\"$selected>$choice_text</option>\n";
|
||||||
}
|
}
|
||||||
$return['html'].="</select>\n";
|
$return['html'].="</select>\n";
|
||||||
|
$GLOBALS['LSsession'] -> addJSscript('LSformElement_select.js');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$return['html']="<ul class='LSform'>\n";
|
$return['html']="<ul class='LSform'>\n";
|
||||||
|
|
|
@ -46,27 +46,36 @@ class LSformElement_select_object extends LSformElement {
|
||||||
}
|
}
|
||||||
$return = $this -> getLabelInfos();
|
$return = $this -> getLabelInfos();
|
||||||
// value
|
// value
|
||||||
$id=rand();
|
|
||||||
|
|
||||||
|
|
||||||
|
$params=array();
|
||||||
if (!$this -> isFreeze()) {
|
if (!$this -> isFreeze()) {
|
||||||
$addBtn="<li class='LSformElement_select_object_addBtn'>
|
$params['addBtn']=array(
|
||||||
<a href='select.php?LSobject=".$this -> selectableObject."' class='LSformElement_select_object LSformElement_select_object_addBtn' id='a_LSformElement_select_object_".$this -> name."_$id'>"._('Modifier')."</a>\n
|
'href' => "select.php?LSobject=".$this -> selectableObject,
|
||||||
<input type='hidden' name='LSformElement_select_object_objecttype' id='LSformElement_select_object_objecttype_$id' value='".$this -> selectableObject."' />\n
|
'id' => "a_LSformElement_select_object_".$this -> name,
|
||||||
</li>\n";
|
'label' => _('Modifier')
|
||||||
$delete=" <img src='templates/images/delete.png' alt='"._('Supprimer')."' class='LSformElement_select_object_deleteBtn'/>";
|
);
|
||||||
$class='LSformElement_select_object';
|
$params['inputHidden'] = array(
|
||||||
|
'id' => "LSformElement_select_object_objecttype_".$this -> name,
|
||||||
|
'name' => 'LSformElement_select_object_objecttype_'.$this -> name,
|
||||||
|
'value' => $this -> selectableObject
|
||||||
|
);
|
||||||
|
$params['deleteBtns'] = array(
|
||||||
|
'alt' => _('Supprimer')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$ul_id="LSformElement_select_object_".$this -> name;
|
||||||
|
$params['freeze'] = $this -> isFreeze();
|
||||||
|
$GLOBALS['LSsession'] -> addJSconfigParam($ul_id,$params);
|
||||||
|
|
||||||
|
$return['html']="<ul class='LSform LSformElement_select_object' id='$ul_id'>\n";
|
||||||
|
if (empty($this -> values)) {
|
||||||
|
$return['html'] .= "<li>"._('Aucune valeur definie')."</li>\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$class='';
|
foreach ($this -> values as $value => $txt) {
|
||||||
$delete='';
|
$return['html'].="<li><a href='view.php?LSobject=".$this -> selectableObject."&dn=".$value."' title='"._('Voir')." ' class='LSformElement_select_object'>".$txt."</a><input type='hidden' class='LSformElement_select_object' name='".$this -> name."[]' value='".$value."' /></li>\n";
|
||||||
$addBtn='';
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$return['html']="<ul class='LSform ".$class."' id='LSformElement_select_object_".$this -> name."_$id'>\n";
|
|
||||||
$return['html'].=$addBtn;
|
|
||||||
foreach ($this -> values as $value => $txt) {
|
|
||||||
$return['html'].="<li class='".$class."'><a href='view.php?LSobject=".$this -> selectableObject."&dn=".$value."' title='"._('Voir')." ' class='LSformElement_select_object'>".$txt."</a><input type='hidden' class='LSformElement_select_object' name='".$this -> name."[]' value='".$value."' />$delete</li>\n";
|
|
||||||
}
|
}
|
||||||
$return['html'].="</ul>\n";
|
$return['html'].="</ul>\n";
|
||||||
if (!$this -> isFreeze()) {
|
if (!$this -> isFreeze()) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ class LSformElement_url extends LSformElement {
|
||||||
foreach ($this -> values as $value) {
|
foreach ($this -> values as $value) {
|
||||||
$multiple = $this -> getMultipleData();
|
$multiple = $this -> getMultipleData();
|
||||||
$id = "LSform_".$this -> name."_".rand();
|
$id = "LSform_".$this -> name."_".rand();
|
||||||
$return['html'] .= "<li><input type='text' name='".$this -> name."[]' value=\"".$value."\" id='".$id."' title=\"".$this -> getTitle()."\"><img src='templates/images/url_go.png' class='LSformElement_url_go_btn btn' alt='"._('Suivre le lien.')."' title='"._('Suivre le lien.')."'/> <img src='templates/images/url_add.png' class='LSformElement_url_add_favorite_btn btn' alt='"._('Ajouter aux favoris.')."' title='"._('Ajouter aux favoris.')."'/>".$multiple."</li>\n";
|
$return['html'] .= "<li><input class='LSformElement_url' type='text' name='".$this -> name."[]' value=\"".$value."\" id='".$id."' title=\"".$this -> getTitle()."\">$multiple</li>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$return['html'] .= "</ul>\n";
|
$return['html'] .= "</ul>\n";
|
||||||
|
@ -64,7 +64,7 @@ class LSformElement_url extends LSformElement {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
foreach ($this -> values as $value) {
|
foreach ($this -> values as $value) {
|
||||||
$return['html'] .= "<li><a href='".$value."' title=\"".$this -> getTitle()."\">".$value."</a><img src='templates/images/url_go.png' class='LSformElement_url_go_btn btn' alt='"._('Suivre le lien.')."' title='"._('Suivre le lien.')."'> <img src='templates/images/url_add.png' class='LSformElement_url_add_favorite_btn btn' alt='"._('Ajouter aux favoris.')."' title='"._('Ajouter aux favoris.')."'/></li>\n";
|
$return['html'] .= "<li><a class='LSformElement_url' href='".$value."' title=\"".$this -> getTitle()."\">".$value."</a></li>\n";
|
||||||
}
|
}
|
||||||
$GLOBALS['LSsession'] -> addJSscript('LSformElement_url.js');
|
$GLOBALS['LSsession'] -> addJSscript('LSformElement_url.js');
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ class LSformElement_url extends LSformElement {
|
||||||
*/
|
*/
|
||||||
function getEmptyField() {
|
function getEmptyField() {
|
||||||
$multiple = $this -> getMultipleData();
|
$multiple = $this -> getMultipleData();
|
||||||
return "<input type='text' name='".$this -> name."[]' id='LSform_".$this -> name."_".rand()."' title=\"".$this -> getTitle()."\"><img src='templates/images/url_go.png' class='LSformElement_url_go_btn btn' alt='"._('Suivre le lien.')."' title='"._('Suivre le lien.')."'/> <img src='templates/images/url_add.png' class='LSformElement_url_add_favorite_btn btn' alt='"._('Ajouter aux favoris.')."' title='"._('Ajouter aux favoris.')."'/>".$multiple;
|
return "<input class='LSformElement_url' type='text' name='".$this -> name."[]' id='LSform_".$this -> name."_".rand()."' title=\"".$this -> getTitle()."\">".$multiple;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ class LSformElement_xmpp extends LSformElement {
|
||||||
foreach ($this -> values as $value) {
|
foreach ($this -> values as $value) {
|
||||||
$multiple = $this -> getMultipleData();
|
$multiple = $this -> getMultipleData();
|
||||||
$id = "LSform_".$this -> name."_".rand();
|
$id = "LSform_".$this -> name."_".rand();
|
||||||
$return['html'] .= "<li><input type='text' name='".$this -> name."[]' value=\"".$value."\" id='".$id."'><img src='templates/images/xmpp.png' class='LSformElement_xmpp_btn btn' alt='"._('Dialoguer')."' title='"._('Dialoguer')."'/>".$multiple."</li>\n";
|
$return['html'] .= "<li><input class='LSformElement_xmpp' type='text' name='".$this -> name."[]' value=\"".$value."\" id='".$id."'>$multiple</li>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$return['html'] .= "</ul>\n";
|
$return['html'] .= "</ul>\n";
|
||||||
|
@ -64,7 +64,7 @@ class LSformElement_xmpp extends LSformElement {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
foreach ($this -> values as $value) {
|
foreach ($this -> values as $value) {
|
||||||
$return['html'] .= "<li><a href='xmpp:".$value."'>".$value."</a><img src='templates/images/xmpp.png' alt='"._('Dialoguer')."' title='"._('Dialoguer')."' class='LSformElement_xmpp_btn btn'></li>\n";
|
$return['html'] .= "<li><a class='LSformElement_xmpp' href='xmpp:".$value."'>".$value."</a></li>\n";
|
||||||
$GLOBALS['LSsession'] -> addJSscript('LSformElement_xmpp.js');
|
$GLOBALS['LSsession'] -> addJSscript('LSformElement_xmpp.js');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ class LSformElement_xmpp extends LSformElement {
|
||||||
*/
|
*/
|
||||||
function getEmptyField() {
|
function getEmptyField() {
|
||||||
$multiple = $this -> getMultipleData();
|
$multiple = $this -> getMultipleData();
|
||||||
return "<input type='text' name='".$this -> name."[]' id='LSform_".$this -> name."_".rand()."'><img src='templates/images/xmpp.png' class='LSformElement_xmpp_btn btn' alt='"._('Dialoguer')."' title='"._('Dialoguer')."'/>".$multiple;
|
return "<input class='LSformElement_xmpp' type='text' name='".$this -> name."[]' id='LSform_".$this -> name."_".rand()."'>".$multiple;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
30
trunk/includes/js/LSformElement_boolean.js
Normal file
30
trunk/includes/js/LSformElement_boolean.js
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
var LSformElement_boolean = new Class({
|
||||||
|
initialize: function(){
|
||||||
|
this.initialiseLSformElement_boolean();
|
||||||
|
},
|
||||||
|
|
||||||
|
initialiseLSformElement_boolean: function() {
|
||||||
|
$$('li.LSformElement_boolean').each(function(el) {
|
||||||
|
var btn = new Element('img');
|
||||||
|
btn.setProperties({
|
||||||
|
src: 'templates/images/clear.png',
|
||||||
|
alt: 'Reset',
|
||||||
|
title: 'Reset'
|
||||||
|
});
|
||||||
|
btn.addClass('btn');
|
||||||
|
btn.setStyle('vertical-align','top');
|
||||||
|
btn.addEvent('click',this.onClearBtnClick.bind(this,btn));
|
||||||
|
btn.injectInside(el);
|
||||||
|
}, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
onClearBtnClick: function(btn) {
|
||||||
|
var li = btn.getParent();
|
||||||
|
li.getElements('input').each(function(input) {
|
||||||
|
input.checked=false;
|
||||||
|
},this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
window.addEvent(window.ie ? 'load' : 'domready', function() {
|
||||||
|
varLSformElement_boolean = new LSformElement_boolean();
|
||||||
|
});
|
|
@ -11,9 +11,24 @@ var LSformElement_mail = new Class({
|
||||||
if (typeof(el) == 'undefined') {
|
if (typeof(el) == 'undefined') {
|
||||||
el = document;
|
el = document;
|
||||||
}
|
}
|
||||||
el.getElements('img.LSformElement_mail_btn').each(function(btn) {
|
el.getElements('input.LSformElement_mail').each(function(input) {
|
||||||
btn.addEvent('click',this.onBtnClick.bind(this,btn));
|
this.addBtnAfter.bind(this)(input);
|
||||||
}, this);
|
}, this);
|
||||||
|
el.getElements('a.LSformElement_mail').each(function(a) {
|
||||||
|
this.addBtnAfter.bind(this)(a);
|
||||||
|
}, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
addBtnAfter: function(el) {
|
||||||
|
var btn = new Element('img');
|
||||||
|
btn.setProperties({
|
||||||
|
src: 'templates/images/mail.png',
|
||||||
|
alt: 'Envoyer un mail',
|
||||||
|
title: 'Envoyer un mail'
|
||||||
|
});
|
||||||
|
btn.addClass('btn');
|
||||||
|
btn.injectAfter(el);
|
||||||
|
btn.addEvent('click',this.onBtnClick.bind(this,btn));
|
||||||
},
|
},
|
||||||
|
|
||||||
reinitialize: function(el) {
|
reinitialize: function(el) {
|
||||||
|
|
|
@ -10,9 +10,24 @@ var LSformElement_rss = new Class({
|
||||||
if (typeof(el) == 'undefined') {
|
if (typeof(el) == 'undefined') {
|
||||||
el = document;
|
el = document;
|
||||||
}
|
}
|
||||||
el.getElements('img.LSformElement_rss_btn').each(function(btn) {
|
el.getElements('input.LSformElement_rss').each(function(input) {
|
||||||
btn.addEvent('click',this.onBtnClick.bind(this,btn));
|
this.addBtnAfter.bind(this)(input);
|
||||||
}, this);
|
}, this);
|
||||||
|
el.getElements('a.LSformElement_rss').each(function(a) {
|
||||||
|
this.addBtnAfter.bind(this)(a);
|
||||||
|
}, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
addBtnAfter: function(el) {
|
||||||
|
var btn = new Element('img');
|
||||||
|
btn.setProperties({
|
||||||
|
src: 'templates/images/rss.png',
|
||||||
|
alt: 'File RSS',
|
||||||
|
title: 'File RSS'
|
||||||
|
});
|
||||||
|
btn.addClass('btn');
|
||||||
|
btn.injectAfter(el);
|
||||||
|
btn.addEvent('click',this.onBtnClick.bind(this,btn));
|
||||||
},
|
},
|
||||||
|
|
||||||
reinitialize: function(el) {
|
reinitialize: function(el) {
|
||||||
|
|
34
trunk/includes/js/LSformElement_select.js
Normal file
34
trunk/includes/js/LSformElement_select.js
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
var LSformElement_select = new Class({
|
||||||
|
initialize: function(){
|
||||||
|
this.initialiseLSformElement_select();
|
||||||
|
},
|
||||||
|
|
||||||
|
initialiseLSformElement_select: function() {
|
||||||
|
$$('select.LSform').each(function(el) {
|
||||||
|
var btn = new Element('img');
|
||||||
|
btn.setProperties({
|
||||||
|
src: 'templates/images/clear.png',
|
||||||
|
alt: 'Reset',
|
||||||
|
title: 'Reset'
|
||||||
|
});
|
||||||
|
btn.addClass('btn');
|
||||||
|
btn.setStyle('vertical-align','top');
|
||||||
|
btn.addEvent('click',this.onClearBtnClick.bind(this,btn));
|
||||||
|
btn.injectAfter(el);
|
||||||
|
}, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
onClearBtnClick: function(btn) {
|
||||||
|
var select = btn.getPrevious();
|
||||||
|
this.resetSelect(select);
|
||||||
|
},
|
||||||
|
|
||||||
|
resetSelect: function(select) {
|
||||||
|
for(var i=0;i<select.length;i++) {
|
||||||
|
select[i].selected=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
window.addEvent(window.ie ? 'load' : 'domready', function() {
|
||||||
|
varLSformElement_select = new LSformElement_select();
|
||||||
|
});
|
|
@ -3,32 +3,81 @@ var LSformElement_select_object = new Class({
|
||||||
this.initialiseLSformElement_select_object();
|
this.initialiseLSformElement_select_object();
|
||||||
},
|
},
|
||||||
|
|
||||||
initialiseLSformElement_select_object: function() {
|
initialiseLSformElement_select_object: function(el) {
|
||||||
$$('a.LSformElement_select_object_addBtn').each(function(el) {
|
if (!$type(el)) {
|
||||||
el.addEvent('click',this.onLSformElement_select_object_addBtnClick.bindWithEvent(this,el));
|
el = document;
|
||||||
}, this);
|
}
|
||||||
|
el.getElements('ul.LSformElement_select_object').each(function(ul) {
|
||||||
|
var params = varLSdefault.LSjsConfig[ul.id];
|
||||||
|
if ($type(params)) {
|
||||||
|
if (!params.freeze) {
|
||||||
|
// Class du UL
|
||||||
|
ul.addClass('LSformElement_select_object_edit');
|
||||||
|
|
||||||
|
// Delete btns
|
||||||
|
ul.getElements('a.LSformElement_select_object').each(function(a){
|
||||||
|
var btn = new Element('img');
|
||||||
|
btn.addClass('btn');
|
||||||
|
btn.setProperties({
|
||||||
|
src: 'templates/images/delete.png',
|
||||||
|
alt: params.deleteBtns.alt
|
||||||
|
});
|
||||||
|
btn.addEvent('click',this.LSformElement_select_object_deleteBtn.bind(this,btn));
|
||||||
|
btn.injectAfter(a);
|
||||||
|
},this);
|
||||||
|
|
||||||
|
// li
|
||||||
|
ul.getElements('li').each(function(li){
|
||||||
|
li.addClass('LSformElement_select_object');
|
||||||
|
},this);
|
||||||
|
|
||||||
|
// Head
|
||||||
|
var li = new Element('li');
|
||||||
|
li.addClass('LSformElement_select_object_addBtn');
|
||||||
|
|
||||||
|
var addBtn = new Element('a');
|
||||||
|
addBtn.addClass('LSformElement_select_object');
|
||||||
|
addBtn.addClass('LSformElement_select_object_addBtn');
|
||||||
|
addBtn.setProperties({
|
||||||
|
href: params.addBtn.href,
|
||||||
|
id: params.addBtn.id
|
||||||
|
});
|
||||||
|
addBtn.set('html',params.addBtn.label);
|
||||||
|
addBtn.addEvent('click',this.onLSformElement_select_object_addBtnClick.bindWithEvent(this,addBtn));
|
||||||
|
addBtn.injectInside(li);
|
||||||
|
|
||||||
|
var input = new Element('input');
|
||||||
|
input.setProperties({
|
||||||
|
type: 'hidden',
|
||||||
|
name: params.inputHidden.name,
|
||||||
|
id: params.inputHidden.id,
|
||||||
|
value: params.inputHidden.value,
|
||||||
|
});
|
||||||
|
input.injectInside(li);
|
||||||
|
li.inject(ul,'top');
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$$('img.LSformElement_select_object_deleteBtn').each(function(el) {
|
|
||||||
el.addEvent('click',this.LSformElement_select_object_deleteBtn.bind(this,el));
|
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
onLSformElement_select_object_addBtnClick: function(event,a) {
|
onLSformElement_select_object_addBtnClick: function(event,a) {
|
||||||
new Event(event).stop();
|
new Event(event).stop();
|
||||||
var getFieldId = /a_(.*)/
|
var getAttrName = /a_LSformElement_select_object_(.*)/
|
||||||
var fieldId = getFieldId.exec(a.id)[1];
|
var attrName = getAttrName.exec(a.id)[1];
|
||||||
var getId = /a_LSformElement_select_object_.*_([0-9]*)$/
|
var fieldId = 'LSformElement_select_object_'+attrName;
|
||||||
var Id = getId.exec(a.id)[1];
|
|
||||||
|
|
||||||
values = new Array();
|
values = new Array();
|
||||||
$$('input.LSformElement_select_object').each(function(el) {
|
a.getParent().getParent().getElements('input.LSformElement_select_object').each(function(el) {
|
||||||
values.push(el.getProperty('value'));
|
values.push(el.getProperty('value'));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
template: 'LSselect',
|
template: 'LSselect',
|
||||||
action: 'refreshSession',
|
action: 'refreshSession',
|
||||||
objecttype: $('LSformElement_select_object_objecttype_'+Id).value,
|
objecttype: $('LSformElement_select_object_objecttype_'+attrName).value,
|
||||||
values: JSON.encode(values),
|
values: JSON.encode(values),
|
||||||
href: a.href
|
href: a.href
|
||||||
};
|
};
|
||||||
|
@ -49,7 +98,7 @@ var LSformElement_select_object = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
onLSsmoothboxValid: function() {
|
onLSsmoothboxValid: function() {
|
||||||
var getAttrName = /LSformElement_select_object_(.*)_[0-9]*/
|
var getAttrName = /LSformElement_select_object_(.*)/
|
||||||
var attrName = getAttrName.exec(this.refreshFields)[1];
|
var attrName = getAttrName.exec(this.refreshFields)[1];
|
||||||
var data = {
|
var data = {
|
||||||
template: 'LSform',
|
template: 'LSform',
|
||||||
|
@ -67,8 +116,9 @@ var LSformElement_select_object = new Class({
|
||||||
onLSsmoothboxValidComplete: function(responseText, responseXML) {
|
onLSsmoothboxValidComplete: function(responseText, responseXML) {
|
||||||
var data = JSON.decode(responseText);
|
var data = JSON.decode(responseText);
|
||||||
if ( varLSdefault.checkAjaxReturn(data) ) {
|
if ( varLSdefault.checkAjaxReturn(data) ) {
|
||||||
$(this.refreshFields).getParent().set('html',data.html);
|
var dd = $(this.refreshFields).getParent();
|
||||||
this.initialiseLSformElement_select_object();
|
dd.set('html',data.html);
|
||||||
|
this.initialiseLSformElement_select_object(dd);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,36 @@ var LSformElement_url = new Class({
|
||||||
if (typeof(el) == 'undefined') {
|
if (typeof(el) == 'undefined') {
|
||||||
el = document;
|
el = document;
|
||||||
}
|
}
|
||||||
el.getElements('img.LSformElement_url_go_btn').each(function(btn) {
|
el.getElements('input.LSformElement_url').each(function(input) {
|
||||||
btn.addEvent('click',this.onGoBtnClick.bind(this,btn));
|
this.addBtnAfter.bind(this)(input);
|
||||||
}, this);
|
}, this);
|
||||||
el.getElements('img.LSformElement_url_add_favorite_btn').each(function(btn) {
|
el.getElements('a.LSformElement_url').each(function(a) {
|
||||||
btn.addEvent('click',this.onAddFavoriteBtnClick.bind(this,btn));
|
this.addBtnAfter.bind(this)(a);
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
addBtnAfter: function(el) {
|
||||||
|
var btn_go = new Element('img');
|
||||||
|
btn_go.setProperties({
|
||||||
|
src: 'templates/images/url_go.png',
|
||||||
|
alt: 'Suivre le lien',
|
||||||
|
title: 'Suivre le lien'
|
||||||
|
});
|
||||||
|
btn_go.addClass('btn');
|
||||||
|
btn_go.injectAfter(el);
|
||||||
|
btn_go.addEvent('click',this.onGoBtnClick.bind(this,btn_go));
|
||||||
|
|
||||||
|
var btn_fav = new Element('img');
|
||||||
|
btn_fav.setProperties({
|
||||||
|
src: 'templates/images/url_add.png',
|
||||||
|
alt: 'Ajouter aux favoris',
|
||||||
|
title: 'Ajouter aux favoris'
|
||||||
|
});
|
||||||
|
btn_fav.addClass('btn');
|
||||||
|
btn_fav.injectAfter(btn_go);
|
||||||
|
btn_fav.addEvent('click',this.onAddFavoriteBtnClick.bind(this,btn_fav));
|
||||||
|
},
|
||||||
|
|
||||||
reinitialize: function(el) {
|
reinitialize: function(el) {
|
||||||
this.initialiseLSformElement_url(el);
|
this.initialiseLSformElement_url(el);
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,9 +10,24 @@ var LSformElement_xmpp = new Class({
|
||||||
if (typeof(el) == 'undefined') {
|
if (typeof(el) == 'undefined') {
|
||||||
el = document;
|
el = document;
|
||||||
}
|
}
|
||||||
el.getElements('img.LSformElement_xmpp_btn').each(function(btn) {
|
el.getElements('input.LSformElement_xmpp').each(function(input) {
|
||||||
btn.addEvent('click',this.onBtnClick.bind(this,btn));
|
this.addBtnAfter.bind(this)(input);
|
||||||
}, this);
|
}, this);
|
||||||
|
el.getElements('a.LSformElement_xmpp').each(function(a) {
|
||||||
|
this.addBtnAfter.bind(this)(a);
|
||||||
|
}, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
addBtnAfter: function(el) {
|
||||||
|
var btn = new Element('img');
|
||||||
|
btn.setProperties({
|
||||||
|
src: 'templates/images/xmpp.png',
|
||||||
|
alt: 'Chat',
|
||||||
|
title: 'Chat'
|
||||||
|
});
|
||||||
|
btn.addClass('btn');
|
||||||
|
btn.injectAfter(el);
|
||||||
|
btn.addEvent('click',this.onBtnClick.bind(this,btn));
|
||||||
},
|
},
|
||||||
|
|
||||||
reinitialize: function(el) {
|
reinitialize: function(el) {
|
||||||
|
|
|
@ -17,14 +17,14 @@ dl.LSform {
|
||||||
position: relative;
|
position: relative;
|
||||||
left: 0.2em;
|
left: 0.2em;
|
||||||
top: 1.2em;
|
top: 1.2em;
|
||||||
width: 12em;
|
width: 15em;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
color: #0072b8;
|
color: #0072b8;
|
||||||
}
|
}
|
||||||
|
|
||||||
dd.LSform {
|
dd.LSform {
|
||||||
margin-left: 13em;
|
margin-left: 15em;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +81,6 @@ img.LSform-add-field-btn, img.LSform-remove-field-btn {
|
||||||
background: #333;
|
background: #333;
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
-moz-border-radius: 2px;
|
-moz-border-radius: 2px;
|
||||||
width: 200px;
|
max-width: 500px;
|
||||||
text-align: justify;
|
text-align: justify;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ a.LSformElement_select_object {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.LSformElement_select_object {
|
ul.LSformElement_select_object_edit {
|
||||||
border: 1px solid #b5e4f6;
|
border: 1px solid #b5e4f6;
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
|
|
|
@ -32,6 +32,7 @@ hr {
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
margin: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue