Support option values as strings as well
authorJoey Schulze <joey@infodrom.org>
Sun, 28 Feb 2010 18:40:41 +0000 (19:40 +0100)
committerJoey Schulze <joey@infodrom.org>
Sun, 28 Feb 2010 18:40:41 +0000 (19:40 +0100)
ajax/ajax.php
masks/sys_mask.php

index a5a8a12..5095ca6 100644 (file)
@@ -74,7 +74,7 @@ function save($mask)
 
     if ($info['type'] == 'boolean') {
       $update[] = sprintf("%s=%d", $field, $_POST[$field] == 'on'?1:0);
 
     if ($info['type'] == 'boolean') {
       $update[] = sprintf("%s=%d", $field, $_POST[$field] == 'on'?1:0);
-    } elseif ($info['type'] == 'number' || $info['type'] == 'select') {
+    } elseif ($info['type'] == 'number' || ($info['type'] == 'select' && $info['options_string'] !== true)) {
       if (empty($_POST[$field]) && $info['null'] === true)
         $update[] = sprintf("%s=NULL", $field);
       else
       if (empty($_POST[$field]) && $info['null'] === true)
         $update[] = sprintf("%s=NULL", $field);
       else
@@ -123,7 +123,7 @@ function insert($mask)
     if ($info['type'] == 'boolean') {
       $fields[] = $field;
       $values[] = $_POST[$field] == 'on'?1:0;
     if ($info['type'] == 'boolean') {
       $fields[] = $field;
       $values[] = $_POST[$field] == 'on'?1:0;
-    } elseif ($info['type'] == 'number' || $info['type'] == 'select') {
+    } elseif ($info['type'] == 'number' || ($info['type'] == 'select' && $info['options_string'] !== true)) {
       $fields[] = $field;
       if (empty($_POST[$field]) && $info['null'] === true)
        $values[] = 'NULL';
       $fields[] = $field;
       if (empty($_POST[$field]) && $info['null'] === true)
        $values[] = 'NULL';
index 70707b4..09a9110 100644 (file)
@@ -82,6 +82,7 @@ $mask = array(
                                            'name' => 'Dateiname',
                                            'type' => 'select',
                                            'options' => discover_masks(),
                                            'name' => 'Dateiname',
                                            'type' => 'select',
                                            'options' => discover_masks(),
+                                           'options_string' => true,
                                            ),
                              'title' => array(
                                            'name' => 'Beschreibung',
                                            ),
                              'title' => array(
                                            'name' => 'Beschreibung',