Code cleanup

SVN:trunk[5973]
This commit is contained in:
Guillaume Lajarige
2018-07-25 07:23:52 +00:00
parent d0322b471d
commit e71ad536a9
15 changed files with 102 additions and 71 deletions

View File

@@ -21,13 +21,14 @@ namespace Combodo\iTop\Renderer\Console\FieldRenderer;
use AttributeDate;
use AttributeDateTime;
use AttributeDuration;
use Combodo\iTop\Form\Field\TextAreaField;
use Combodo\iTop\Renderer\FieldRenderer;
use Combodo\iTop\Renderer\RenderingOutput;
use DateTimeFormat;
use Dict;
use InlineImage;
use UserRights;
use utils;
use Combodo\iTop\Form\Field\TextAreaField;
use Combodo\iTop\Renderer\FieldRenderer;
use Combodo\iTop\Renderer\RenderingOutput;
class ConsoleSimpleFieldRenderer extends FieldRenderer
{
@@ -161,13 +162,13 @@ EOF
if ((count($aChoices)== 1) && $bMandatory)
{
// When there is only once choice, select it by default
$sSelected = ' checked';
$sSelected = 'checked';
}
else
{
$sSelected = ($value == $sChoice) ? ' checked' : '';
$sSelected = ($value == $sChoice) ? 'checked' : '';
}
$oOutput->AddHtml("<input type=\"radio\" id=\"{$sId}_{$idx}\" name=\"radio_$sId\" onChange=\"$('#{$sId}').val(this.value).trigger('change');\" value=\"".htmlentities($sChoice, ENT_QUOTES, 'UTF-8')."\"$sSelected><label class=\"radio\" for=\"{$sId}_{$idx}\">&nbsp;".htmlentities($sLabel, ENT_QUOTES, 'UTF-8')."</label>&nbsp;");
$oOutput->AddHtml("<input type=\"radio\" id=\"{$sId}_{$idx}\" name=\"radio_$sId\" onChange=\"$('#{$sId}').val(this.value).trigger('change');\" value=\"".htmlentities($sChoice, ENT_QUOTES, 'UTF-8')."\" $sSelected><label class=\"radio\" for=\"{$sId}_{$idx}\">&nbsp;".htmlentities($sLabel, ENT_QUOTES, 'UTF-8')."</label>&nbsp;");
if ($bVertical)
{
$oOutput->AddHtml("<br>\n");
@@ -219,8 +220,6 @@ EOF
{
case 'Combodo\\iTop\\Form\\Field\\DateTimeField':
$sDateTimeFormat = $this->oField->GetPHPDateTimeFormat();
$oFormat = new DateTimeFormat($sDateTimeFormat);
$sDatePickerFormat = $oFormat->ToDatePicker();
$sJSDaysMin = json_encode(array(Dict::S('DayOfWeek-Sunday-Min'), Dict::S('DayOfWeek-Monday-Min'), Dict::S('DayOfWeek-Tuesday-Min'), Dict::S('DayOfWeek-Wednesday-Min'),
Dict::S('DayOfWeek-Thursday-Min'), Dict::S('DayOfWeek-Friday-Min'), Dict::S('DayOfWeek-Saturday-Min')));
$sJSMonthsShort = json_encode(array(Dict::S('Month-01-Short'), Dict::S('Month-02-Short'), Dict::S('Month-03-Short'), Dict::S('Month-04-Short'), Dict::S('Month-05-Short'), Dict::S('Month-06-Short'),
@@ -230,7 +229,6 @@ EOF
$sTimeFormat = AttributeDateTime::GetFormat()->ToTimeFormat();
$oTimeFormat = new DateTimeFormat($sTimeFormat);
$sJSTimeFormat = json_encode($oTimeFormat->ToDatePicker());
$sJSLangShort = json_encode(strtolower(substr(Dict::GetUserLanguage(), 0, 2)));
$sJSOk = json_encode(Dict::S('UI:Button:Ok'));
if ($this->oField->IsDateOnly())
{