mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-07-03 02:33:18 +02:00
This commit wraps up:
-Better Navbar formatting -AJAX delete confirmation -Enhanced validation feedback on admin pages
This commit is contained in:
@ -46,22 +46,24 @@ class ControllerLdapList extends Controller {
|
||||
if($this->model_saas_ldap->update($this->request->post) == 1) {
|
||||
$this->data['x'] = $this->data['text_successfully_modified'];
|
||||
} else {
|
||||
$this->template = "common/error.tpl";
|
||||
$this->data['errorstring'] = $this->data['text_failed_to_modify'];
|
||||
// set ldap ID to be the submitted id
|
||||
if (isset($this->request->post['id'])) { $this->data['id'] = $this->request->post['id']; }
|
||||
}
|
||||
}
|
||||
else {
|
||||
if($this->model_saas_ldap->add($this->request->post) == 1) {
|
||||
$this->data['x'] = $this->data['text_successfully_added'];
|
||||
} else {
|
||||
$this->template = "common/error.tpl";
|
||||
$this->data['errorstring'] = $this->data['text_failed_to_add'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->template = "common/error.tpl";
|
||||
$this->data['errorstring'] = array_pop($this->error);
|
||||
$this->data['errorstring'] = $this->data['text_error_message'];
|
||||
$this->data['errors'] = $this->error;
|
||||
// set ldap ID to be the submitted id
|
||||
if (isset($this->request->post['id'])) { $this->data['id'] = $this->request->post['id']; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +73,13 @@ class ControllerLdapList extends Controller {
|
||||
else {
|
||||
$this->data['entries'] = $this->model_saas_ldap->get();
|
||||
}
|
||||
|
||||
|
||||
if ( isset($this->data['errorstring']) ) {
|
||||
// use posted values if they differ from database values (ie - form was submitted but failed validation)
|
||||
if (isset($this->request->post['ldap_type'])) { $this->data['a']['ldap_type'] = $this->request->post['ldap_type'];}
|
||||
if (isset($this->request->post['description'])) { $this->data['a']['description'] = $this->request->post['description'];}
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
$this->template = "common/error.tpl";
|
||||
@ -84,25 +92,25 @@ class ControllerLdapList extends Controller {
|
||||
|
||||
|
||||
private function validate() {
|
||||
|
||||
// description is required and must be 1 or more characters in length to meet this
|
||||
if(!isset($this->request->post['description']) || strlen($this->request->post['description']) < 1) {
|
||||
$this->error['description'] = $this->data['text_invalid_data'];
|
||||
$this->error['description'] = $this->data['text_field_required'];
|
||||
}
|
||||
|
||||
// ldap_host is required and must be 1 or more characters in length to meet this
|
||||
if(!isset($this->request->post['ldap_host']) || strlen($this->request->post['ldap_host']) < 1) {
|
||||
$this->error['ldap_host'] = $this->data['text_invalid_data'];
|
||||
$this->error['ldap_host'] = $this->data['text_field_required'];
|
||||
}
|
||||
|
||||
// ldap_base_dn is required and must be 1 or more characters in length to meet this
|
||||
if(!isset($this->request->post['ldap_base_dn']) || strlen($this->request->post['ldap_base_dn']) < 1) {
|
||||
$this->error['ldap_base_dn'] = $this->data['text_invalid_data'];
|
||||
$this->error['ldap_base_dn'] = $this->data['text_field_required'];
|
||||
}
|
||||
|
||||
// ldap_bind_dn is required and must be 1 or more characters in length to meet this
|
||||
if(!isset($this->request->post['ldap_bind_dn']) || strlen($this->request->post['ldap_bind_dn']) < 1) {
|
||||
$this->error['ldap_bind_dn'] = $this->data['text_invalid_data'];
|
||||
$this->error['ldap_bind_dn'] = $this->data['text_field_required'];
|
||||
}
|
||||
|
||||
// ldap_bind_pw is required and must be 1 or more characters in length to meet this
|
||||
if(!isset($this->request->post['ldap_bind_pw']) || strlen($this->request->post['ldap_bind_pw']) < 1) {
|
||||
$this->error['ldap_bind_pw'] = $this->data['text_invalid_data'];
|
||||
$this->error['ldap_bind_pw'] = $this->data['text_field_required'];
|
||||
}
|
||||
|
||||
if (!$this->error) {
|
||||
|
@ -24,7 +24,7 @@ class ControllerLdapRemove extends Controller {
|
||||
$this->data['username'] = Registry::get('username');
|
||||
|
||||
$this->data['id'] = $this->request->get['id'];
|
||||
$this->data['description'] = $this->request->get['description'];
|
||||
$this->data['description'] = $this->request->get['name'];
|
||||
$this->data['confirmed'] = (int)$this->request->get['confirmed'];
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ class ControllerLdapRemove extends Controller {
|
||||
$this->error['admin'] = $this->data['text_you_are_not_admin'];
|
||||
}
|
||||
|
||||
if(!isset($this->request->get['description']) || strlen($this->request->get['description']) < 1) {
|
||||
if(!isset($this->request->get['name']) || strlen($this->request->get['name']) < 1) {
|
||||
$this->error['description'] = $this->data['text_invalid_data'];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user