From f139cf4cddd37c8a165edf7eb30ef98afb25d42c Mon Sep 17 00:00:00 2001 From: Dmitry Bergstein Date: Thu, 5 Sep 2013 20:28:36 +0400 Subject: [PATCH] 7.20.0 --- composer.json | 4 +-- src/Drivers/Entity.php | 4 ++- src/Drivers/Entity/Form.php | 10 +++---- .../View/HTML/Widget/Form/Radiogroup.php | 30 ++++++++++++------- src/Drivers/View/HTML/Widget/Form/Select.php | 4 +-- src/Options/Mixins/CRUD.json | 2 +- src/Options/User/Entity.json | 2 +- 7 files changed, 33 insertions(+), 23 deletions(-) diff --git a/composer.json b/composer.json index 9f368417b..93ffdd46a 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "keywords": ["framework", "oop sucks", "fp rules"], "homepage": "http://one2team.ru/project/Codeine", "license": "BSD-2-Clause", - "version": "7.10.3", + "version": "7.20.0", "authors": [ { "name": "Dmitry Bergstein", @@ -31,7 +31,7 @@ "type": "package", "package": { "name": "one2team/codeine", - "version": "7.10.3", + "version": "7.20.0", "dist": { "url": "http://deb.one2team.ru/", "type": "deb" diff --git a/src/Drivers/Entity.php b/src/Drivers/Entity.php index 41ca12161..a7bb08908 100644 --- a/src/Drivers/Entity.php +++ b/src/Drivers/Entity.php @@ -24,7 +24,9 @@ else F::Log('Model for '.$Call['Entity'].' not found', LOG_CRIT); - $Call = F::Hook('afterEntityLoad', $Call); + $Call = F::Hook('afterEntityLoad', $Call); + + $Call['entity'] = strtolower($Call['Entity']); return $Call; }); diff --git a/src/Drivers/Entity/Form.php b/src/Drivers/Entity/Form.php index 7e86f029d..f71ebf38b 100644 --- a/src/Drivers/Entity/Form.php +++ b/src/Drivers/Entity/Form.php @@ -49,6 +49,11 @@ if($IC == 0) $Widget['Autofocus'] = true; + if (isset($Widget['Options'])) + $Widget['Options'] = F::Live($Widget['Options']); + else + $Widget['Options'] = []; + if (isset($Node['Localized']) && $Node['Localized']) $Widget['Label'] = $Call['Entity'].'.Entity:'.$Name.'.Label'; else @@ -69,11 +74,6 @@ if (isset($Call['Data'])) $Widget['Data'] = $Call['Data']; - if (isset($Widget['Options'])) - $Widget['Options'] = F::Live($Widget['Options']); - else - $Widget['Options'] = []; - // Если есть значение, добавляем if (($Widget['Value'] = F::Dot($Call['Data'], $Name)) === null) { diff --git a/src/Drivers/View/HTML/Widget/Form/Radiogroup.php b/src/Drivers/View/HTML/Widget/Form/Radiogroup.php index 959db6ee0..2778529d9 100644 --- a/src/Drivers/View/HTML/Widget/Form/Radiogroup.php +++ b/src/Drivers/View/HTML/Widget/Form/Radiogroup.php @@ -10,19 +10,27 @@ setFn('Make', function ($Call) { $Call['Radios'] = ''; + foreach($Call['Options'] as $IX => $Value) + { + if (isset($Call['Localized']) && $Call['Localized']) + $lValue = ''.$Call['Entity'].'.Entity:'.$Call['Key'].'.'.$Value.''; + else + $lValue = $Value; + $Call['Radios'] .= F::Run('View', 'Load', - [ - 'Scope' => $Call['Widget Set'].'/Widgets', - 'ID' => 'Form/Radio', - 'Data' => - F::Merge ($Call, - [ - 'Value' => $Value, - 'Checked' => ($IX == $Call['Value']? 'checked': '') - ]) - ] - ); + [ + 'Scope' => $Call['Widget Set'].'/Widgets', + 'ID' => 'Form/Radio', + 'Data' => + F::Merge ($Call, + [ + 'Value' => $lValue, + 'Checked' => ($IX == $Call['Value']? 'checked': '') + ]) + ] + ); + } return $Call; }); \ No newline at end of file diff --git a/src/Drivers/View/HTML/Widget/Form/Select.php b/src/Drivers/View/HTML/Widget/Form/Select.php index 7d57da048..63484834d 100755 --- a/src/Drivers/View/HTML/Widget/Form/Select.php +++ b/src/Drivers/View/HTML/Widget/Form/Select.php @@ -29,9 +29,9 @@ $Value = $Option; if (isset($Call['Localized']) && $Call['Localized']) - $lValue = ''.$Call['Entity'].'.Entity:'.$Call['Node'].'.'.$Value.''; + $lValue = ''.$Call['Entity'].'.Entity:'.$Call['Key'].'.'.$Value.''; else - $lValue = $Value; + $lValue = ''.$Call['Entity'].'.Entity:'.$Call['Key'].'.'.$Value.''; if ($Key == $Call['Value'] || $Value == $Call['Value'] || (is_array($Call['Value']) && in_array($Key, $Call['Value']))) $Options[] = ''; diff --git a/src/Options/Mixins/CRUD.json b/src/Options/Mixins/CRUD.json index f03e16f0f..1be75df49 100644 --- a/src/Options/Mixins/CRUD.json +++ b/src/Options/Mixins/CRUD.json @@ -17,7 +17,7 @@ "Method": "Redirect", "Call": { - "Location": "/user/$Data.ID" + "Location": "/$entity/$Data.ID" } } }, diff --git a/src/Options/User/Entity.json b/src/Options/User/Entity.json index 3120b168d..ff7f431d5 100755 --- a/src/Options/User/Entity.json +++ b/src/Options/User/Entity.json @@ -39,7 +39,7 @@ "Type": "List.Enum", "Default": 0, "Options": ["M", "F"], - "Localizable": true, + "Localized": true, "Widgets": { "Write":