summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2014-11-12 16:22:04 (GMT)
committerRenato Botelho <garga@FreeBSD.org>2014-11-12 16:22:04 (GMT)
commit61dec0b0788eeb669f87a29e897719bcbea24454 (patch)
tree1a227690e633ddcc454acb7a92b86bec8cb93e91
parent2951a06ad89fc207a709af362ddc42069fdee172 (diff)
downloadunivnautes-61dec0b0788eeb669f87a29e897719bcbea24454.zip
univnautes-61dec0b0788eeb669f87a29e897719bcbea24454.tar.gz
univnautes-61dec0b0788eeb669f87a29e897719bcbea24454.tar.bz2
Make sure empty group or user are not created when editing
-rw-r--r--usr/local/www/system_groupmanager.php10
-rw-r--r--usr/local/www/system_usermanager.php10
2 files changed, 20 insertions, 0 deletions
diff --git a/usr/local/www/system_groupmanager.php b/usr/local/www/system_groupmanager.php
index 04381b3..e6230aa 100644
--- a/usr/local/www/system_groupmanager.php
+++ b/usr/local/www/system_groupmanager.php
@@ -198,6 +198,14 @@ function setall_selected(id) {
selbox.options[index].selected = true;
}
+function delete_empty(id) {
+ selbox = document.getElementById(id);
+ count = selbox.options.length;
+ for (index = 0; index<count; index++)
+ if (selbox.options[index].value == '')
+ selbox.remove(index);
+}
+
function clear_selected(id) {
selbox = document.getElementById(id);
count = selbox.options.length;
@@ -239,6 +247,8 @@ function move_selected(srcid, dstid) {
}
function presubmit() {
+ delete_empty('members');
+ delete_empty('notmembers');
clear_selected('notmembers');
setall_selected('members');
}
diff --git a/usr/local/www/system_usermanager.php b/usr/local/www/system_usermanager.php
index 98d261b..daf7df2 100644
--- a/usr/local/www/system_usermanager.php
+++ b/usr/local/www/system_usermanager.php
@@ -385,6 +385,14 @@ function setall_selected(id) {
selbox.options[index].selected = true;
}
+function delete_empty(id) {
+ selbox = document.getElementById(id);
+ count = selbox.options.length;
+ for (index = 0; index<count; index++)
+ if (selbox.options[index].value == '')
+ selbox.remove(index);
+}
+
function clear_selected(id) {
selbox = document.getElementById(id);
count = selbox.options.length;
@@ -426,6 +434,8 @@ function move_selected(srcid, dstid) {
}
function presubmit() {
+ delete_empty('groups');
+ delete_empty('notgroups');
clear_selected('notgroups');
setall_selected('groups');
}