summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 401c703)
raw | patch | inline | side by side (parent: 401c703)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 10 Mar 2010 08:35:57 +0000 (08:35 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 10 Mar 2010 08:35:57 +0000 (08:35 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@16364 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/class_filterEditor.inc | patch | blob | history | |
gosa-core/include/class_filterEditorEntry.inc | patch | blob | history |
index 521eab71cd7d3bda99a4dcac48e5f26df596e6af..92a0621e9bb2cf253dca2a2e9e77c7164cb59b7a 100644 (file)
$this->dialog->save_object();
$msgs = $this->dialog->check();
if(count($msgs)){
- msg_dialog::display_checks($msgs);
+ msg_dialog::displayChecks($msgs);
}else{
$orig_name = $this->dialog->getOriginalName();
$new_name = $this->dialog->getCurrentName();
- // Remove old entry
- if($orig_name != "") unset($this->filters[$orig_name]);
-
- $this->filters[$new_name] = $this->dialog->save();
- $this->dialog = NULL;
- $this->filterWidget->setListData($this->filters, $this->convertFilterList());
- $this->filterWidget->update();
+ // The object was renamed and
+ if($orig_name != $new_name && isset($this->filters[$new_name])){
+ $msgs = array(msgPool::duplicated(_("Name")));
+ msg_dialog::displayChecks($msgs);
+ }else{
+
+ // Remove old entry if filter was renamed
+ if($orig_name != "" && isset($this->filters[$orig_name])){
+ unset($this->filters[$orig_name]);
+ }
+
+ // Now append the new filter object.
+ $this->filters[$new_name] = $this->dialog->save();
+ $this->dialog = NULL;
+ $this->filterWidget->setListData($this->filters, $this->convertFilterList());
+ $this->filterWidget->update();
+ }
}
}
diff --git a/gosa-core/include/class_filterEditorEntry.inc b/gosa-core/include/class_filterEditorEntry.inc
index e1ca3012f0b4b84ce3952b804304524a7f698743..76e0bcb249df248bc933c6a3e4f06ab06a3d3ceb 100644 (file)
}
}
+
+ /*! \brief Validate user input
+ * @return Array An Array containing potential error messages
+ */
+ function check()
+ {
+ $msgs = plugin::check();
+
+ // Check if the name is given
+ if(empty($this->name)){
+ $msgs[] = msgPool::required(_("Name"));
+ }elseif(preg_match("/[^a-z0-9\-_ ]/i", $this->name)){
+
+ // Check for a valid name, no special chars here - in particular no ;
+ $msgs[] = msgPool::invalid(_("Name"), $this->name,"/[a-z0-9\-_ ]/i");
+ }
+
+ return($msgs);
+ }
+
/*! \brief Transforms the entered values into a filter object (array) which is useable
* for the filterEditor overview dialog.