From dc4f16fbe4d5a617cc2e453d5626b53dab649972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Mon, 22 Aug 2016 01:33:14 +0200 Subject: [PATCH] [core] remove JSON based paramter definition related code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bye bye JSON Signed-off-by: Pierre Mazière --- lib/HTMLUtils.php | 48 ++++++++++++++++------------------------------- 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/lib/HTMLUtils.php b/lib/HTMLUtils.php index bf150fbb..330ce6fa 100644 --- a/lib/HTMLUtils.php +++ b/lib/HTMLUtils.php @@ -45,18 +45,10 @@ CARD; $hasGlobalParameter = array_key_exists('global', $bridgeElement->parameters); if($hasGlobalParameter){ - if(is_array($bridgeElement->parameters['global'])){ - $globalParameters = $bridgeElement->parameters['global']; - }else{ - $globalParameters = json_decode($bridgeElement->parameters['global'], true); - } + $globalParameters = $bridgeElement->parameters['global']; } foreach($bridgeElement->parameters as $parameterName => $parameter){ - if(!is_array($parameter)){ - $parameter = json_decode($parameter, true); - } - if(!is_numeric($parameterName) && $parameterName == 'global') continue; @@ -86,48 +78,40 @@ CARD; if(!isset($inputEntry['defaultValue'])) $inputEntry['defaultValue'] = ''; - $idArg = 'arg-' . urlencode($bridgeName) . '-' . urlencode($parameterName) . '-' . (isset($inputEntry['identifier'])?urlencode($inputEntry['identifier']):urlencode($id)); + $idArg = 'arg-' . urlencode($bridgeName) . '-' . urlencode($parameterName) . '-' . urlencode($id); $card .= '' . PHP_EOL; if(!isset($inputEntry['type']) || $inputEntry['type'] == 'text') { - $card .= '
' . PHP_EOL; + $card .= '
' . PHP_EOL; } else if($inputEntry['type'] == 'number') { - $card .= '
' . PHP_EOL; + $card .= '
' . PHP_EOL; } else if($inputEntry['type'] == 'list') { - $card .= ''; foreach($inputEntry['values'] as $name=>$value) { - if(is_array($value) && is_numeric($name)){ - $listValues=$value; - if($inputEntry['defaultValue'] === $listValues['name'] || $inputEntry['defaultValue'] === $listValues['value']) - $card .= ''; - else - $card .= ''; - }else{ - if(is_array($value)){ - $card.=''; - foreach($value as $subname=>$subvalue){ + if(is_array($value)){ + $card.=''; + foreach($value as $subname=>$subvalue){ if($inputEntry['defaultValue'] === $subname || $inputEntry['defaultValue'] === $subvalue) $card .= ''; else $card .= ''; - } - $card.=''; - }else{ - if($inputEntry['defaultValue'] === $name || $inputEntry['defaultValue'] === $value) - $card .= ''; - else - $card .= ''; } + $card.=''; + }else{ + if($inputEntry['defaultValue'] === $name || $inputEntry['defaultValue'] === $value) + $card .= ''; + else + $card .= ''; } } $card .= '
'; } else if($inputEntry['type'] == 'checkbox') { if($inputEntry['defaultValue'] === 'checked') - $card .= '
' . PHP_EOL; + $card .= '
' . PHP_EOL; else - $card .= '
' . PHP_EOL; + $card .= '
' . PHP_EOL; } }