client-side validation

This commit is contained in:
Roland Gruber 2011-10-19 17:57:57 +00:00
parent d9b75e50fc
commit 89316df9c9
7 changed files with 48 additions and 13 deletions

View File

@ -825,6 +825,7 @@ class asteriskAccount extends baseModule implements passwordService {
$AstAccountPort = $this->attributes['AstAccountPort'][0];
}
$AstAccountPortInput = new htmlTableExtendedInputField(_("Port"), 'AstAccountPort', $AstAccountPort, 'AstAccountPort');
$AstAccountPortInput->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$return->addElement($AstAccountPortInput, true);
}
// qualify
@ -852,6 +853,7 @@ class asteriskAccount extends baseModule implements passwordService {
$AstAccountRTPTimeout = $this->attributes['AstAccountRTPTimeout'][0];
}
$AstAccountRTPTimeoutInput = new htmlTableExtendedInputField(_("RTP timeout"), 'AstAccountRTPTimeout', $AstAccountRTPTimeout, 'AstAccountRTPTimeout');
$AstAccountRTPTimeoutInput->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$return->addElement($AstAccountRTPTimeoutInput, true);
}
// RTP hold timeout
@ -861,6 +863,7 @@ class asteriskAccount extends baseModule implements passwordService {
$AstAccountRTPHoldTimeout = $this->attributes['AstAccountRTPHoldTimeout'][0];
}
$AstAccountRTPHoldTimeoutInput = new htmlTableExtendedInputField(_("RTP hold timeout"), 'AstAccountRTPHoldTimeout', $AstAccountRTPHoldTimeout, 'AstAccountRTPHoldTimeout');
$AstAccountRTPHoldTimeoutInput->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$return->addElement($AstAccountRTPHoldTimeoutInput, true);
}
// disallowed codec

View File

@ -303,13 +303,17 @@ class kolabUser extends baseModule {
if (isset($this->attributes['cyrus-userquota'][0])) {
$userquota = $this->attributes['cyrus-userquota'][0];
}
$basicPartContainer->addElement(new htmlTableExtendedInputField(_('Mail quota'), 'quota', $userquota, 'quota'), true);
$userquotaInput = new htmlTableExtendedInputField(_('Mail quota'), 'quota', $userquota, 'quota');
$userquotaInput->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$basicPartContainer->addElement($userquotaInput, true);
// free/busy future
$freebusyfuture = '';
if (isset($this->attributes['kolabFreeBusyFuture'][0])) {
$freebusyfuture = $this->attributes['kolabFreeBusyFuture'][0];
}
$basicPartContainer->addElement(new htmlTableExtendedInputField(_('Free/Busy interval'), 'freeBusy', $freebusyfuture, 'freeBusy'), true);
$freebusyfutureInput = new htmlTableExtendedInputField(_('Free/Busy interval'), 'freeBusy', $freebusyfuture, 'freeBusy');
$freebusyfutureInput->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$basicPartContainer->addElement($freebusyfutureInput, true);
$return->addElement($basicPartContainer, true);
// invitation policies
$return->addElement(new htmlSubTitle(_('Invitation policy')), true);

View File

@ -1091,6 +1091,7 @@ class posixAccount extends baseModule implements passwordService {
if (isset($this->attributes['uidNumber'][0])) $uidNumber = $this->attributes['uidNumber'][0];
$uidNumberInput = new htmlTableExtendedInputField(_('UID number'), 'uidNumber', $uidNumber, 'uidNumber');
$uidNumberInput->setFieldMaxLength(20);
$uidNumberInput->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$return->addElement($uidNumberInput, true);
$gecos = '';
if (isset($this->attributes['gecos'][0])) $gecos = $this->attributes['gecos'][0];

View File

@ -175,6 +175,7 @@ class posixGroup extends baseModule implements passwordService {
}
$gidNumberInput = new htmlTableExtendedInputField(_('GID number'), 'gidNumber', $gidNumber, 'gidNumber');
$gidNumberInput->setFieldMaxLength(20);
$gidNumberInput->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$return->addElement($gidNumberInput, true);
// description
$description = '';

View File

@ -412,20 +412,24 @@ class quota extends baseModule {
$sbLimitInput = new htmlInputField($i . '_2_' . $id, $this->quota[$server][$i][2]);
$sbLimitInput->setFieldSize(12);
$sbLimitInput->setFieldMaxLength(20);
$sbLimitInput->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$return->addElement($sbLimitInput);
$hbLimit = new htmlInputField($i . '_3_' . $id, $this->quota[$server][$i][3]);
$hbLimit->setFieldSize(12);
$hbLimit->setFieldMaxLength(20);
$hbLimit->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$return->addElement($hbLimit);
$return->addElement(new htmlOutputText($this->quota[$server][$i][4]));
$return->addElement(new htmlOutputText($this->quota[$server][$i][5]));
$siLimit = new htmlInputField($i . '_6_' . $id, $this->quota[$server][$i][6]);
$siLimit->setFieldMaxLength(20);
$siLimit->setFieldSize(12);
$siLimit->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$return->addElement($siLimit);
$hiLimit = new htmlInputField($i . '_7_' . $id, $this->quota[$server][$i][7]);
$hiLimit->setFieldMaxLength(20);
$hiLimit->setFieldSize(12);
$hiLimit->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$return->addElement($hiLimit);
$return->addElement(new htmlOutputText($this->quota[$server][$i][8]));
$return->addNewLine();

View File

@ -1419,11 +1419,17 @@ class sambaSamAccount extends baseModule implements passwordService {
// working dir
$return->addElement(new htmlTableExtendedInputField(_('Working directory'), 'tsWorkDirectory', $mDial->ctx['CtxWorkDirectory'], 'tsWorkDirectory'), true);
// connection time limit
$return->addElement(new htmlTableExtendedInputField(_('Connection time limit'), 'tsConnectionLimit', $mDial->ctx['CtxMaxConnectionTime'], 'tsTimeLimit'), true);
$tsConnectionLimit = new htmlTableExtendedInputField(_('Connection time limit'), 'tsConnectionLimit', $mDial->ctx['CtxMaxConnectionTime'], 'tsTimeLimit');
$tsConnectionLimit->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$return->addElement($tsConnectionLimit, true);
// disconnection time limit
$return->addElement(new htmlTableExtendedInputField(_('Disconnection time limit'), 'tsDisconnectionLimit', $mDial->ctx['CtxMaxDisconnectionTime'], 'tsTimeLimit'), true);
$tsDisconnectionLimit = new htmlTableExtendedInputField(_('Disconnection time limit'), 'tsDisconnectionLimit', $mDial->ctx['CtxMaxDisconnectionTime'], 'tsTimeLimit');
$tsDisconnectionLimit->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$return->addElement($tsDisconnectionLimit, true);
// idle time limit
$return->addElement(new htmlTableExtendedInputField(_('Idle time limit'), 'tsIdleLimit', $mDial->ctx['CtxMaxIdleTime'], 'tsTimeLimit'), true);
$tsIdleLimit = new htmlTableExtendedInputField(_('Idle time limit'), 'tsIdleLimit', $mDial->ctx['CtxMaxIdleTime'], 'tsTimeLimit');
$tsIdleLimit->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$return->addElement($tsIdleLimit, true);
// connect client drives
$return->addElement(new htmlTableExtendedInputCheckbox('tsConnectDrives', $mDial->getConnectClientDrives(), _('Connect client drives'), 'tsConnectDrives'), true);
// connect client printers

View File

@ -129,26 +129,42 @@ class systemQuotas extends baseModule {
$parts = explode(',', $this->attributes['quota'][$i]);
$container->addElement(new htmlInputField('path_' . $i, $parts[0], 20));
$container->addElement($spacer);
$container->addElement(new htmlInputField('softBlock_' . $i, $parts[1], 10));
$softBlockInput = new htmlInputField('softBlock_' . $i, $parts[1], 10);
$softBlockInput->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$container->addElement($softBlockInput);
$container->addElement($spacer);
$container->addElement(new htmlInputField('hardBlock_' . $i, $parts[2], 10));
$hardBlockInput = new htmlInputField('hardBlock_' . $i, $parts[2], 10);
$hardBlockInput->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$container->addElement($hardBlockInput);
$container->addElement($spacer);
$container->addElement(new htmlInputField('softInode_' . $i, $parts[3], 10));
$softInodeInput = new htmlInputField('softInode_' . $i, $parts[3], 10);
$softInodeInput->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$container->addElement($softInodeInput);
$container->addElement($spacer);
$container->addElement(new htmlInputField('hardInode_' . $i, $parts[4], 10));
$hardInodeInput = new htmlInputField('hardInode_' . $i, $parts[4], 10);
$hardInodeInput->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$container->addElement($hardInodeInput);
$container->addElement(new htmlButton('del_' . $i, 'del.png', true), true);
}
}
// new entry
$container->addElement(new htmlInputField('path', null, 20));
$container->addElement($spacer);
$container->addElement(new htmlInputField('softBlock', 0, 10));
$newSoftBlockInput = new htmlInputField('softBlock', 0, 10);
$newSoftBlockInput->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$container->addElement($newSoftBlockInput);
$container->addElement($spacer);
$container->addElement(new htmlInputField('hardBlock', 0, 10));
$newHardBlockInput = new htmlInputField('hardBlock', 0, 10);
$newHardBlockInput->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$container->addElement($newHardBlockInput);
$container->addElement($spacer);
$container->addElement(new htmlInputField('softInode', 0, 10));
$newSoftInodeInput = new htmlInputField('softInode', 0, 10);
$newSoftInodeInput->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$container->addElement($newSoftInodeInput);
$container->addElement($spacer);
$container->addElement(new htmlInputField('hardInode', 0, 10));
$newHardInodeInput = new htmlInputField('hardInode', 0, 10);
$newHardInodeInput->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$container->addElement($newHardInodeInput);
$container->addElement(new htmlButton('add', 'add.png', true));
return $container;
}