Permalink
Browse files

Contao 2.10.3 kompatible

- *.xhtml and *.html5 templates
- REQUEST_TOKEN insert
- ATENSION: only compatible with <= Ajax 1.1.1 - Contao-Extention
  • Loading branch information...
1 parent 5ec6268 commit 9a7ac244463d4596cf3edbfaf37df6acde17f09a @srhinow committed Nov 9, 2011
View
14 ModuleRandomNumber.php 100644 → 100755
@@ -99,13 +99,13 @@ protected function compile()
$inputAnz->maxlength = '5';
$inputAnz->style = 'width:60px; margin:10px 0;';
- $zufallszahl = 0;
+ $zufallszahl = '';
if($this->Input->post('FORM_SUBMIT')=='random_number')
{
$anz = $this->Input->post('anz');
$inputAnz->validate();
-
+
//anz auf Fehler pruefen
if(strlen($inputAnz->getErrorAsString())) $this->error = true;
@@ -162,6 +162,7 @@ protected function compile()
}
}
+
$pageId = ($this->m2u_jumpTo)? $this->m2u_jumpTo : $objPage->id;
$this->Template->action = $pageId;
$this->Template->inputAnz = $inputAnz;
@@ -170,11 +171,12 @@ protected function compile()
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/randomNumber/html/ajax.js';
- if ($this->Input->get('isAjax') == '1')
+ if ($this->Input->get('isAjax')==1)
{
- print $zufallszahl;
- exit; // IMPORTANT!
- }
+ $return = array('zahl'=>$zufallszahl, 'token'=>REQUEST_TOKEN);
+ print json_encode($return);
+ exit(); // IMPORTANT!
+ }
}
View
18 ModuleRandomNumber.php~ 100644 → 100755
@@ -96,14 +96,16 @@ class ModuleRandomNumber extends Module
$inputAnz->name = 'anz';
$inputAnz->label = 'Passwortlänge';
$inputAnz->value = '7';
+ $inputAnz->maxlength = '5';
+ $inputAnz->style = 'width:60px; margin:10px 0;';
$zufallszahl = 0;
if($this->Input->post('FORM_SUBMIT')=='random_number')
{
$anz = $this->Input->post('anz');
$inputAnz->validate();
-
+
//anz auf Fehler pruefen
if(strlen($inputAnz->getErrorAsString())) $this->error = true;
@@ -160,6 +162,7 @@ class ModuleRandomNumber extends Module
}
}
+
$pageId = ($this->m2u_jumpTo)? $this->m2u_jumpTo : $objPage->id;
$this->Template->action = $pageId;
$this->Template->inputAnz = $inputAnz;
@@ -168,13 +171,12 @@ class ModuleRandomNumber extends Module
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/randomNumber/html/ajax.js';
- if ($this->Input->get('isAjax') == '1')
- {
-
-
- print $zufallszahl;
- exit; // IMPORTANT!
- }
+ if ($this->Input->get('isAjax')==1)
+ {
+ $return = array('zahl'=>$zufallszahl, 'token'=>REQUEST_TOKEN);
+ print json_encode($return);
+ exit(); // IMPORTANT!
+ }
}
View
0 config/.htaccess 100644 → 100755
File mode changed.
View
0 config/config.php 100644 → 100755
File mode changed.
View
0 config/config.php~ 100644 → 100755
File mode changed.
View
0 dca/.htaccess 100644 → 100755
File mode changed.
View
0 dca/tl_module.php 100644 → 100755
File mode changed.
View
0 dca/tl_module.php~ 100644 → 100755
File mode changed.
View
5 html/ajax.js 100644 → 100755
@@ -10,8 +10,11 @@ var doAjax = function(e){
},
onSuccess: function(r){
// the 'r' is response from server
+ var resObj = JSON.decode(r);
+
$('number_box').setStyle('display','block');
- $('generate_number').set('html', r).fade('in');
+ $('generate_number').set('html', resObj.zahl).fade('in');
+ $('form_random_number').getElements('input[name=REQUEST_TOKEN]').set('value',resObj.token);
}
}).send();
}
View
0 languages/.htaccess 100644 → 100755
File mode changed.
View
0 templates/.htaccess 100644 → 100755
File mode changed.
View
16 templates/mod_randomnumber.html5
@@ -0,0 +1,16 @@
+<section style="border: 1px solid rgb(153, 153, 153); padding: 10px;">
+ <form action="{{link_url::<?php echo $this->action; ?>}}" id="form_random_number" method="post">
+ <input type="hidden" name="FORM_SUBMIT" value="random_number" />
+ <input type="hidden" name="REQUEST_TOKEN" value="{{request_token}}">
+ <div><strong><?php echo $this->inputCharTypes->generateLabel();?>:</strong><?php echo $this->inputCharTypes->generate();?></div>
+ <div><strong><?php echo $this->inputAnz->generateLabel();?>: </strong><?php echo $this->inputAnz->generate();?></div>
+ <div style="text-align:center;"><input type="submit" name="senden" value="generieren"></div>
+ </form>
+
+ <div id="number_box" style="<?php if($this->randomNumber === 0): ?>display:none;<?php endif; ?>">
+ <strong>generierte Zeichenfolge: </strong>
+ <div style="font-size:18; font-weight:bold; color:#308F00; overflow:auto; width:600px;" id="generate_number"><?php echo $this->randomNumber;?></div>
+ </div>
+
+</section>
+
View
16 templates/mod_randomnumber.html5~
@@ -0,0 +1,16 @@
+<section style="border: 1px solid rgb(153, 153, 153); padding: 10px;">
+ <form action="{{link_url::<?php echo $this->action; ?>}}#random_number" id="form_random_number" method="post">
+ <input type="hidden" name="FORM_SUBMIT" value="random_number" />
+ <input type="hidden" name="REQUEST_TOKEN" value="{{request_token}}">
+ <div><strong><?php echo $this->inputCharTypes->generateLabel();?>:</strong><?php echo $this->inputCharTypes->generate();?></div>
+ <div><strong><?php echo $this->inputAnz->generateLabel();?>: </strong><?php echo $this->inputAnz->generate();?></div>
+ <div style="text-align:center;"><input type="submit" name="senden" value="generieren"></div>
+ </form>
+
+ <div id="number_box" style="<?php if($this->randomNumber === 0): ?>display:none;<?php endif; ?>">
+ <strong>generierte Zeichenfolge: </strong>
+ <div style="font-size:18; font-weight:bold; color:#308F00; overflow:auto; width:600px;" id="generate_number"><?php echo $this->randomNumber;?></div>
+ </div>
+
+</section>
+
View
3 templates/mod_randomnumber.tpl 100644 → 100755
@@ -1,6 +1,7 @@
<div style="border: 1px solid rgb(153, 153, 153); padding: 10px;">
<form action="{{link_url::<?php echo $this->action; ?>}}#random_number" id="form_random_number" method="post">
- <input type="hidden" name="FORM_SUBMIT" value="random_number" />
+ <input type="hidden" name="FORM_SUBMIT" value="random_number" />
+ <input type="hidden" name="REQUEST_TOKEN" value="{{request_token}}">
<div><strong><?php echo $this->inputCharTypes->generateLabel();?>:</strong><?php echo $this->inputCharTypes->generate();?></div>
<div><strong><?php echo $this->inputAnz->generateLabel();?>: </strong><?php echo $this->inputAnz->generate();?></div>
<div style="text-align:center;"><input type="submit" name="senden" value="generieren"></div>
View
16 templates/mod_randomnumber.xhtml
@@ -0,0 +1,16 @@
+<div style="border: 1px solid rgb(153, 153, 153); padding: 10px;">
+ <form action="{{link_url::<?php echo $this->action; ?>}}#random_number" id="form_random_number" method="post">
+ <input type="hidden" name="FORM_SUBMIT" value="random_number" />
+ <input type="hidden" name="REQUEST_TOKEN" value="{{request_token}}">
+ <div><strong><?php echo $this->inputCharTypes->generateLabel();?>:</strong><?php echo $this->inputCharTypes->generate();?></div>
+ <div><strong><?php echo $this->inputAnz->generateLabel();?>: </strong><?php echo $this->inputAnz->generate();?></div>
+ <div style="text-align:center;"><input type="submit" name="senden" value="generieren"></div>
+ </form>
+
+ <div id="number_box" style="<?php if($this->randomNumber === 0): ?>display:none;<?php endif; ?>">
+ <strong>generierte Zeichenfolge: </strong>
+ <div style="font-size:18; font-weight:bold; color:#308F00; overflow:auto; width:600px;" id="generate_number"><?php echo $this->randomNumber;?></div>
+ </div>
+
+</div>
+

0 comments on commit 9a7ac24

Please sign in to comment.