adding zend project folders into old campcaster.

This commit is contained in:
naomiaro 2010-12-07 14:19:27 -05:00
parent 56abfaf28e
commit 7ef0c18b26
4045 changed files with 1054952 additions and 0 deletions

View file

@ -0,0 +1,163 @@
<?php
/**
* patForms Rule Match
*
* This rule matches the field value against a regEx pattern. It successfully
* validates the passed value if the value *does* match the pattern.
*
* @package patForms
* @subpackage Rules
* @author Sven Fuchs <svenfuchs@artweb-design.de>
* @license LGPL, see license.txt for details
* @link http://www.php-tools.net
*/
class patForms_Rule_Match extends patForms_Rule
{
/**
* script that will be displayed only once
*
* @access private
* @var array
*/
var $globalScript = array(
'html' => "/* patForms::Rule::Match */
function pFRC_Match(field) {
this.field = eval('pfe_' + field);
}
pFRC_Match.prototype.validate = function() {
value = this.field.getValue();
if (!value.match(this.pattern)) {
alert('This is an invalid value.');
}
}
pFRC_Match.prototype.setValue = function(pattern) {
this.pattern = pattern;
}
/* END: patForms::Rule::Match */
"
);
/**
* javascript that will be displayed once per instance
*
* @access private
* @var array
*/
var $instanceScript = array(
'html' => "var pfr_[RULE::ID] = new pFRC_Match('[CONTAINER::NAME]');\n"
);
/**
* properties that have to be replaced in the instance script.
*
* @access private
* @var array
*/
var $scriptPlaceholders = array(
'RULE::SOURCE' => '_source',
);
/**
* name of the rule
*
* @abstract
* @access private
*/
var $ruleName = 'Match';
/**
* define error codes and messages for the rule
*
* @access private
* @var array $validatorErrorCodes
* @todo translate error messages
*/
var $validatorErrorCodes = array(
"C" => array(
1 => "This is an invalid value.",
),
"de" => array(
1 => "Dies ist ein ungültiger Wert.",
),
"fr" => array(
1 => "This is an invalid value.",
)
);
/**
* the regEx pattern
* @access private
* @var string
*/
var $_pattern;
/**
* field id that is used
* @access private
* @var string
*/
var $_field;
private $value = 10;
public function __construct($params) {
parent::__construct();
extract($params);
$this->_pattern = $value;
}
/**
* prepare the rule
*
* @access public
* @param object patForms
*/
function prepareRule(&$container) {
patForms_Rule::prepareRule($container);
$onChange = $container->getAttribute('onchange');
$newHandler = sprintf('pfr_%s.validate();', $this->_id);
$container->setAttribute('onchange', $newHandler . $onChange);
return true;
}
/**
* method called by patForms or any patForms_Element to validate the
* element or the form.
*
* @access public
* @param object patForms form object
*/
function applyRule(&$element, $type = PATFORMS_RULE_AFTER_VALIDATION) {
if (preg_match($this->_pattern, $element->getValue()) != 0){
return true;
}
$this->addValidationError(1);
return false;
}
/**
*
*
* @access public
*/
function registerJavascripts(&$form) {
parent::registerJavascripts($form);
$script = sprintf("pfr_%s.setValue(%s);\n", $this->_id, $this->_pattern);
$form->registerInstanceJavascript($script);
}
}

View file

@ -0,0 +1,161 @@
<?php
/**
* patForms Rule MaxLength
*
* This is just a simple rule, that checks for a required minimum length of a field
*
* @package patForms
* @subpackage Rules
* @author Sven Fuchs <svenfuchs@artweb-design.de>
* @license LGPL, see license.txt for details
* @link http://www.php-tools.net
*/
class patForms_Rule_MaxLength extends patForms_Rule
{
/**
* script that will be displayed only once
*
* @access private
* @var array
*/
var $globalScript = array(
'html' => "/* patForms::Rule::MaxLength */
function pFRC_MaxLength(field) {
this.field = eval('pfe_' + field);
}
pFRC_MaxLength.prototype.validate = function() {
value = this.field.getValue();
if (value.length > this.value) {
alert('Please enter a value that is max. ' + this.value + ' characters long.');
}
}
pFRC_MaxLength.prototype.setValue = function(value) {
this.value = value;
}
/* END: patForms::Rule::MaxLength */
"
);
/**
* javascript that will be displayed once per instance
*
* @access private
* @var array
*/
var $instanceScript = array(
'html' => "var pfr_[RULE::ID] = new pFRC_MaxLength('[CONTAINER::NAME]');\n"
);
/**
* properties that have to be replaced in the instance script.
*
* @access private
* @var array
*/
var $scriptPlaceholders = array(
'RULE::SOURCE' => '_source',
);
/**
* name of the rule
*
* @abstract
* @access private
*/
var $ruleName = 'MaxLength';
/**
* define error codes and messages for the rule
*
* @access private
* @var array $validatorErrorCodes
* @todo translate error messages
*/
var $validatorErrorCodes = array(
"C" => array(
1 => "Please enter a value that is max. [VALUE] characters long.",
),
"de" => array(
1 => "Bitte geben Sie einen max. [VALUE] Zeichen langen Wert ein.",
),
"fr" => array(
1 => "Please enter a value that is max. [VALUE] characters long.",
)
);
/**
* possible values
* @access private
* @var array
*/
var $_values;
/**
* field id that is used
* @access private
* @var string
*/
var $_field;
private $value = 10;
public function __construct($params) {
parent::__construct();
extract($params);
$this->value = $value;
}
/**
* prepare the rule
*
* @access public
* @param object patForms
*/
function prepareRule(&$container) {
patForms_Rule::prepareRule($container);
$onChange = $container->getAttribute('onchange');
$newHandler = sprintf('pfr_%s.validate();', $this->_id);
$container->setAttribute('onchange', $newHandler . $onChange);
return true;
}
/**
* method called by patForms or any patForms_Element to validate the
* element or the form.
*
* @access public
* @param object patForms form object
*/
function applyRule(&$element, $type = PATFORMS_RULE_AFTER_VALIDATION) {
if (strlen($element->getValue()) <= $this->value) {
return true;
}
$this->addValidationError(1, array('value' => $this->value));
return false;
}
/**
*
*
* @access public
*/
function registerJavascripts(&$form) {
parent::registerJavascripts($form);
$script = sprintf("pfr_%s.setValue(%s);\n", $this->_id, $this->value);
$form->registerInstanceJavascript($script);
}
}

View file

@ -0,0 +1,163 @@
<?php
/**
* patForms Rule MaxValue
*
* This rule simply checks for a required maximum value (number) of a field
*
* @package patForms
* @subpackage Rules
* @author Sven Fuchs <svenfuchs@artweb-design.de>
* @license LGPL, see license.txt for details
* @link http://www.php-tools.net
*/
class patForms_Rule_MaxValue extends patForms_Rule
{
/**
* script that will be displayed only once
*
* @access private
* @var array
*/
var $globalScript = array(
'html' => "/* patForms::Rule::MaxValue */
function pFRC_MaxValue(field) {
this.field = eval('pfe_' + field);
}
pFRC_MaxValue.prototype.validate = function() {
value = this.field.getValue();
if (parseInt(value) != value) {
alert('Please enter a number that is less or equal to ' + this.value);
}
if (parseInt(value) > this.value) {
alert('Please enter a number that is less or equal to ' + this.value);
}
}
pFRC_MaxValue.prototype.setMaxValue = function(value) {
this.value = value;
}
/* END: patForms::Rule::MaxValue */
"
);
/**
* javascript that will be displayed once per instance
*
* @access private
* @var array
*/
var $instanceScript = array(
'html' => "var pfr_[RULE::ID] = new pFRC_MaxValue('[CONTAINER::NAME]');\n"
);
/**
* properties that have to be replaced in the instance script.
*
* @access private
* @var array
*/
var $scriptPlaceholders = array(
'RULE::SOURCE' => '_source',
);
/**
* name of the rule
*
* @abstract
* @access private
*/
var $ruleName = 'MaxValue';
/**
* define error codes and messages for the rule
*
* @access private
* @var array $validatorErrorCodes
* @todo translate error messages
*/
var $validatorErrorCodes = array(
"C" => array(
1 => "Please enter a number that is less or equal to [VALUE].",
),
"de" => array(
1 => "Bitte geben Sie eine Zahl kleiner oder gleich [VALUE] ein.",
),
"fr" => array(
1 => "Please enter a number that is less or equal to [VALUE].",
)
);
/**
* the regEx pattern
* @access private
* @var string
*/
var $_value;
/**
* field id that is used
* @access private
* @var string
*/
var $_field;
public function __construct($params) {
parent::__construct();
extract($params);
$this->_value = $value;
}
/**
* prepare the rule
*
* @access public
* @param object patForms
*/
function prepareRule(&$container) {
patForms_Rule::prepareRule($container);
$onChange = $container->getAttribute('onchange');
$newHandler = sprintf('pfr_%s.validate();', $this->_id);
$container->setAttribute('onchange', $newHandler . $onChange);
return true;
}
/**
* method called by patForms or any patForms_Element to validate the
* element or the form.
*
* @access public
* @param object patForms form object
*/
function applyRule(&$element, $type = PATFORMS_RULE_AFTER_VALIDATION) {
if (intval($element->getValue()) <= intval($this->_value)){
return true;
}
$this->addValidationError(1, array('value' => $this->_value));
return false;
}
/**
*
*
* @access public
*/
function registerJavascripts(&$form) {
parent::registerJavascripts($form);
$script = sprintf("pfr_%s.setMaxValue(%s);\n", $this->_id, $this->_value);
$form->registerInstanceJavascript($script);
}
}

View file

@ -0,0 +1,161 @@
<?php
/**
* patForms Rule MinLength
*
* This is just a simple rule, that checks for a required minimum length of a field
*
* @package patForms
* @subpackage Rules
* @author Sven Fuchs <svenfuchs@artweb-design.de>
* @license LGPL, see license.txt for details
* @link http://www.php-tools.net
*/
class patForms_Rule_MinLength extends patForms_Rule
{
/**
* script that will be displayed only once
*
* @access private
* @var array
*/
var $globalScript = array(
'html' => "/* patForms::Rule::MinLength */
function pFRC_MinLength(field) {
this.field = eval('pfe_' + field);
}
pFRC_MinLength.prototype.validate = function() {
value = this.field.getValue();
if (value.length < this.value) {
alert('Please enter a value that is at least ' + this.value + ' characters long.');
}
}
pFRC_MinLength.prototype.setValue = function(value) {
this.value = value;
}
/* END: patForms::Rule::MinLength */
"
);
/**
* javascript that will be displayed once per instance
*
* @access private
* @var array
*/
var $instanceScript = array(
'html' => "var pfr_[RULE::ID] = new pFRC_MinLength('[CONTAINER::NAME]');\n"
);
/**
* properties that have to be replaced in the instance script.
*
* @access private
* @var array
*/
var $scriptPlaceholders = array(
'RULE::SOURCE' => '_source',
);
/**
* name of the rule
*
* @abstract
* @access private
*/
var $ruleName = 'MinLength';
/**
* define error codes and messages for the rule
*
* @access private
* @var array $validatorErrorCodes
* @todo translate error messages
*/
var $validatorErrorCodes = array(
"C" => array(
1 => "Please enter a value that is at least [VALUE] characters long.",
),
"de" => array(
1 => "Bitte geben Sie einen mindestens [VALUE] Zeichen langen Wert ein.",
),
"fr" => array(
1 => "Please enter a value that is at least [VALUE] characters long.",
)
);
/**
* possible values
* @access private
* @var array
*/
var $_values;
/**
* field id that is used
* @access private
* @var string
*/
var $_field;
private $value = 10;
public function __construct($params) {
parent::__construct();
extract($params);
$this->value = $value;
}
/**
* prepare the rule
*
* @access public
* @param object patForms
*/
function prepareRule(&$container) {
patForms_Rule::prepareRule($container);
$onChange = $container->getAttribute('onchange');
$newHandler = sprintf('pfr_%s.validate();', $this->_id);
$container->setAttribute('onchange', $newHandler . $onChange);
return true;
}
/**
* method called by patForms or any patForms_Element to validate the
* element or the form.
*
* @access public
* @param object patForms form object
*/
function applyRule(&$element, $type = PATFORMS_RULE_AFTER_VALIDATION) {
if (strlen($element->getValue()) >= $this->value) {
return true;
}
$this->addValidationError(1, array('value' => $this->value));
return false;
}
/**
*
*
* @access public
*/
function registerJavascripts(&$form) {
parent::registerJavascripts($form);
$script = sprintf("pfr_%s.setValue(%s);\n", $this->_id, $this->value);
$form->registerInstanceJavascript($script);
}
}

View file

@ -0,0 +1,165 @@
<?php
/**
* patForms Rule MinValue
*
* This rule simply checks for a required minimum value (number) of a field
*
* @package patForms
* @subpackage Rules
* @author Sven Fuchs <svenfuchs@artweb-design.de>
* @license LGPL, see license.txt for details
* @link http://www.php-tools.net
*/
class patForms_Rule_MinValue extends patForms_Rule
{
/**
* script that will be displayed only once
*
* @access private
* @var array
*/
var $globalScript = array(
'html' => "/* patForms::Rule::MinValue */
function pFRC_MinValue(field) {
this.field = eval('pfe_' + field);
}
pFRC_MinValue.prototype.validate = function() {
value = this.field.getValue();
if (parseInt(value) != value) {
alert('Please enter a number that is greater or equal to ' + this.value);
}
if (parseInt(value) < this.value) {
alert('Please enter a number that is greater or equal to ' + this.value);
}
}
pFRC_MinValue.prototype.setMinValue = function(value) {
this.value = value;
}
/* END: patForms::Rule::MinValue */
"
);
/**
* javascript that will be displayed once per instance
*
* @access private
* @var array
*/
var $instanceScript = array(
'html' => "var pfr_[RULE::ID] = new pFRC_MinValue('[CONTAINER::NAME]');\n"
);
/**
* properties that have to be replaced in the instance script.
*
* @access private
* @var array
*/
var $scriptPlaceholders = array(
'RULE::SOURCE' => '_source',
);
/**
* name of the rule
*
* @abstract
* @access private
*/
var $ruleName = 'MinValue';
/**
* define error codes and messages for the rule
*
* @access private
* @var array $validatorErrorCodes
* @todo translate error messages
*/
var $validatorErrorCodes = array(
"C" => array(
1 => "Please enter a number that is greater or equal to [VALUE].",
),
"de" => array(
1 => "Bitte geben Sie eine Zahl größer oder gleich [VALUE] ein.",
),
"fr" => array(
1 => "Please enter a number that is greater or equal to [VALUE].",
)
);
/**
* the regEx pattern
* @access private
* @var string
*/
var $_value;
/**
* field id that is used
* @access private
* @var string
*/
var $_field;
private $value = 10;
public function __construct($params) {
parent::__construct();
extract($params);
$this->_value = $value;
}
/**
* prepare the rule
*
* @access public
* @param object patForms
*/
function prepareRule(&$container) {
patForms_Rule::prepareRule($container);
$onChange = $container->getAttribute('onchange');
$newHandler = sprintf('pfr_%s.validate();', $this->_id);
$container->setAttribute('onchange', $newHandler . $onChange);
return true;
}
/**
* method called by patForms or any patForms_Element to validate the
* element or the form.
*
* @access public
* @param object patForms form object
*/
function applyRule(&$element, $type = PATFORMS_RULE_AFTER_VALIDATION) {
if (intval($element->getValue()) >= intval($this->_value)){
return true;
}
$this->addValidationError(1, array('value' => $this->_value));
return false;
}
/**
*
*
* @access public
*/
function registerJavascripts(&$form) {
parent::registerJavascripts($form);
$script = sprintf("pfr_%s.setMinValue(%s);\n", $this->_id, $this->_value);
$form->registerInstanceJavascript($script);
}
}

View file

@ -0,0 +1,163 @@
<?php
/**
* patForms Rule NotMatch
*
* This rule matches the field value against a regEx pattern. It successfully
* validates the passed value if the value does *not* match the pattern.
*
* @package patForms
* @subpackage Rules
* @author Sven Fuchs <svenfuchs@artweb-design.de>
* @license LGPL, see license.txt for details
* @link http://www.php-tools.net
*/
class patForms_Rule_NotMatch extends patForms_Rule
{
/**
* script that will be displayed only once
*
* @access private
* @var array
*/
var $globalScript = array(
'html' => "/* patForms::Rule::NotMatch */
function pFRC_NotMatch(field) {
this.field = eval('pfe_' + field);
}
pFRC_NotMatch.prototype.validate = function() {
value = this.field.getValue();
if (value.match(this.pattern)) {
alert('This is an invalid value.');
}
}
pFRC_NotMatch.prototype.setValue = function(pattern) {
this.pattern = pattern;
}
/* END: patForms::Rule::NotMatch */
"
);
/**
* javascript that will be displayed once per instance
*
* @access private
* @var array
*/
var $instanceScript = array(
'html' => "var pfr_[RULE::ID] = new pFRC_NotMatch('[CONTAINER::NAME]');\n"
);
/**
* properties that have to be replaced in the instance script.
*
* @access private
* @var array
*/
var $scriptPlaceholders = array(
'RULE::SOURCE' => '_source',
);
/**
* name of the rule
*
* @abstract
* @access private
*/
var $ruleName = 'NotMatch';
/**
* define error codes and messages for the rule
*
* @access private
* @var array $validatorErrorCodes
* @todo translate error messages
*/
var $validatorErrorCodes = array(
"C" => array(
1 => "This is an invalid value.",
),
"de" => array(
1 => "Dies ist ein ungültiger Wert.",
),
"fr" => array(
1 => "This is an invalid value.",
)
);
/**
* the regEx pattern
* @access private
* @var string
*/
var $_pattern;
/**
* field id that is used
* @access private
* @var string
*/
var $_field;
private $value = 10;
public function __construct($params) {
parent::__construct();
extract($params);
$this->_pattern = $value;
}
/**
* prepare the rule
*
* @access public
* @param object patForms
*/
function prepareRule(&$container) {
patForms_Rule::prepareRule($container);
$onChange = $container->getAttribute('onchange');
$newHandler = sprintf('pfr_%s.validate();', $this->_id);
$container->setAttribute('onchange', $newHandler . $onChange);
return true;
}
/**
* method called by patForms or any patForms_Element to validate the
* element or the form.
*
* @access public
* @param object patForms form object
*/
function applyRule(&$element, $type = PATFORMS_RULE_AFTER_VALIDATION) {
if (preg_match($this->_pattern, $element->getValue()) == 0){
return true;
}
$this->addValidationError(1);
return false;
}
/**
*
*
* @access public
*/
function registerJavascripts(&$form) {
parent::registerJavascripts($form);
$script = sprintf("pfr_%s.setValue(%s);\n", $this->_id, $this->_pattern);
$form->registerInstanceJavascript($script);
}
}

View file

@ -0,0 +1,182 @@
<?php
/**
* patForms Rule ValidValues
*
* This is just a simple rule, that checks for a required minimum length of a field
*
* @package patForms
* @subpackage Rules
* @author Sven Fuchs <svenfuchs@artweb-design.de>
* @license LGPL, see license.txt for details
* @link http://www.php-tools.net
*/
class patForms_Rule_ValidValues extends patForms_Rule
{
/**
* script that will be displayed only once
*
* @access private
* @var array
*/
var $globalScript = array(
'html' => "/* patForms::Rule::ValidValues */
Array.prototype.inArray = function(value) {
var i;
for (i=0; i < this.length; i++) {
if (this[i] === value) {
return true;
}
}
return false;
};
function pFRC_ValidValue(field) {
this.field = eval('pfe_' + field);
}
pFRC_ValidValue.prototype.validate = function() {
value = this.field.getValue();
for (var i = 0; i < this.values.length; i++) {
if (this.values[i] === value) {
return true;
}
}
var msg = 'Please enter one of the following values: ';
for (var i = 0; i < this.values.length; i++) {
msg = msg + this.values[i];
if (i < this.values.length - 1) {
msg = msg + ', ';
}
}
alert(msg);
}
pFRC_ValidValue.prototype.setValues = function(values) {
this.values = values;
}
/* END: patForms::Rule::ValidValue */
"
);
/**
* javascript that will be displayed once per instance
*
* @access private
* @var array
*/
var $instanceScript = array(
'html' => "var pfr_[RULE::ID] = new pFRC_ValidValue('[CONTAINER::NAME]');\n"
);
/**
* properties that have to be replaced in the instance script.
*
* @access private
* @var array
*/
var $scriptPlaceholders = array(
'RULE::SOURCE' => '_source',
);
/**
* name of the rule
*
* @abstract
* @access private
*/
var $ruleName = 'ValidValue';
/**
* define error codes and messages for the rule
*
* @access private
* @var array $validatorErrorCodes
* @todo translate error messages
*/
var $validatorErrorCodes = array(
"C" => array(
1 => "Please enter one of the following values: [VALUES].",
),
"de" => array(
1 => "Bitte geben Sie einen der folgenden Werte ein: [VALUES].",
),
"fr" => array(
1 => "Please enter one of the following values: [VALUES].",
)
);
/**
* possible values
* @access private
* @var array
*/
var $_values;
/**
* field id that is used
* @access private
* @var string
*/
var $_field;
public function __construct($params) {
parent::__construct();
extract($params);
$this->_values = explode('|', $value);
}
/**
* prepare the rule
*
* @access public
* @param object patForms
*/
function prepareRule(&$container) {
patForms_Rule::prepareRule($container);
$onChange = $container->getAttribute('onchange');
$newHandler = sprintf('pfr_%s.validate();', $this->_id);
$container->setAttribute('onchange', $newHandler . $onChange);
return true;
}
/**
* method called by patForms or any patForms_Element to validate the
* element or the form.
*
* @access public
* @param object patForms form object
*/
function applyRule(&$element, $type = PATFORMS_RULE_AFTER_VALIDATION) {
if (in_array($element->getValue(), $this->_values)) {
return true;
}
$this->addValidationError(1, array('values' => implode(', ', $this->_values)));
return false;
}
/**
*
*
* @access public
*/
function registerJavascripts(&$form) {
parent::registerJavascripts($form);
foreach ($this->_values as $value) {
$values[] = "'$value'";
}
$script = sprintf("pfr_%s.setValues(new Array(%s));\n", $this->_id, implode(', ', $values));
$form->registerInstanceJavascript($script);
}
}