Added image.php to permit fully dynamic image path
[ldapsaisie.git] / public_html / includes / js / LSformElement_rss.js
1 var LSformElement_rss = new Class({
2     initialize: function(){
3       this.initialiseLSformElement_rss();
4       if (typeof(varLSform) != "undefined") {
5         varLSform.addModule("LSformElement_rss",this);
6       }
7     },
8     
9     initialiseLSformElement_rss: function(el) {
10       if (typeof(el) == 'undefined') {
11         el = document;
12       }
13       el.getElements('input.LSformElement_rss').each(function(input) {
14         this.addBtnAfter.bind(this)(input);
15       }, this);
16       el.getElements('a.LSformElement_rss').each(function(a) {
17         this.addBtnAfter.bind(this)(a);
18       }, this);
19     },
20     
21     addBtnAfter: function(el) {
22       var btn = new Element('img');
23       btn.setProperties({
24         src:    varLSdefault.imagePath('rss'),
25         alt:    'File RSS'
26       });
27       btn.addClass('btn');
28       btn.injectAfter(el);
29       btn.addEvent('click',this.onBtnClick.bind(this,btn));
30       varLSdefault.addHelpInfo(btn,'LSformElement_rss','display');
31     },
32     
33     reinitialize: function(el) {
34       varLSform.initializeModule('LSformElement_text',el);
35       this.initialiseLSformElement_rss(el);
36     },
37     
38     onBtnClick: function(btn) {
39       var href = btn.getParent().getFirst().href;
40       if (typeof(href)=="undefined") {
41         href = btn.getParent().getFirst().value;
42       }
43       if (href!="") {
44         window.open(href,'_blank');
45       }
46     }
47 });
48 window.addEvent(window.ie ? 'load' : 'domready', function() {
49   varLSformElement_rss = new LSformElement_rss();
50 });