mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Code cleanup
SVN:trunk[5973]
This commit is contained in:
@@ -49,7 +49,7 @@
|
||||
{
|
||||
$('#brick_mosaic_overlay').hide();
|
||||
$("#brick_content_mosaic").show();
|
||||
}
|
||||
};
|
||||
// Show the requested level
|
||||
var showLevel = function(sLevelAlias, sItemId)
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
var sNodeCollapsedClass = 'glyphicon-menu-right';
|
||||
var sNodeExpandedClass = 'glyphicon-menu-down';
|
||||
var sNodeLoadingClass = 'glyphicon-refresh keep-spinning';
|
||||
var iSearchDelay = 500
|
||||
var iSearchDelay = 500;
|
||||
var sBrowseMode = '{{ sBrowseMode }}';
|
||||
var oLevelsProperties = {{ aLevelsProperties|raw }};
|
||||
var oRawDatas = {{ aItems|raw }};
|
||||
@@ -76,7 +76,7 @@
|
||||
{
|
||||
$('#brick_tree_overlay').hide();
|
||||
$("#brick_content_tree").show();
|
||||
}
|
||||
};
|
||||
// Registers the toggle listeners on the tree nodes. Used after every AJAX calls.
|
||||
var registerToggleListeners = function()
|
||||
{
|
||||
|
||||
@@ -225,7 +225,7 @@
|
||||
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip()
|
||||
})
|
||||
});
|
||||
|
||||
showTableLoader($('#table-{{ sAreaId }}'));
|
||||
var oTable{{ sAreaId }} = $('#table-{{ sAreaId }}').DataTable({
|
||||
|
||||
@@ -397,11 +397,11 @@
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
var GetContentLoaderTemplate = function()
|
||||
{
|
||||
return '<div class="content_loader"><div class="icon glyphicon glyphicon-refresh"></div><div class="message">{{ 'Page:PleaseWait'|dict_s }}</div></div>';
|
||||
}
|
||||
};
|
||||
var ShowLoginDialog = function()
|
||||
{
|
||||
var oModalElem = $('#modal-for-alert').clone();
|
||||
|
||||
@@ -104,6 +104,8 @@ function ExportRun(data) {
|
||||
$('#export-error').html(data.message);
|
||||
$('#export-cancel').hide();
|
||||
$('#export-close').show();
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ $(function()
|
||||
options:
|
||||
{
|
||||
on_validation_callback: function(me, oResult){
|
||||
me.element.removeClass('has-success has-warning has-error')
|
||||
me.element.removeClass('has-success has-warning has-error');
|
||||
me.element.find('.help-block').html('');
|
||||
if(!oResult.is_valid)
|
||||
{
|
||||
|
||||
@@ -197,13 +197,18 @@ class CriterionToOQL extends CriterionConversionAbstract
|
||||
return "({$sRef} != '')";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DBObjectSearch $oSearch
|
||||
* @param $sRef
|
||||
* @param $aCriteria
|
||||
*
|
||||
* @return mixed|string
|
||||
*/
|
||||
/**
|
||||
* @param \DBObjectSearch $oSearch
|
||||
* @param string $sRef
|
||||
* @param array $aCriteria
|
||||
*
|
||||
* @return mixed|string
|
||||
*
|
||||
* @throws \CoreException
|
||||
* @throws \MissingQueryArgument
|
||||
* @throws \MySQLException
|
||||
* @throws \MySQLHasGoneAwayException
|
||||
*/
|
||||
protected static function InToOql($oSearch, $sRef, $aCriteria)
|
||||
{
|
||||
$sAttCode = $aCriteria['code'];
|
||||
|
||||
@@ -271,11 +271,13 @@ class SearchForm
|
||||
return $sHtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DBObjectSet $oSet
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
/**
|
||||
* @param \DBObjectSet $oSet
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function GetFields($oSet)
|
||||
{
|
||||
$oSearch = $oSet->GetFilter();
|
||||
@@ -470,17 +472,17 @@ class SearchForm
|
||||
return array('values' => $aAllowedValues);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DBObjectSearch $oSearch
|
||||
* @param array $aFields
|
||||
*
|
||||
* @param array $aArgs
|
||||
*
|
||||
* @param bool $bIsRemovable
|
||||
*
|
||||
* @return array
|
||||
* @throws \MissingQueryArgument
|
||||
*/
|
||||
/**
|
||||
* @param \DBObjectSearch $oSearch
|
||||
* @param array $aFields
|
||||
* @param array $aArgs
|
||||
* @param bool $bIsRemovable
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws \CoreException
|
||||
* @throws \MissingQueryArgument
|
||||
*/
|
||||
public function GetCriterion($oSearch, $aFields, $aArgs = array(), $bIsRemovable = true)
|
||||
{
|
||||
$aOrCriterion = array();
|
||||
@@ -593,16 +595,21 @@ class SearchForm
|
||||
return $aFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sClass
|
||||
* @param $sClassAlias
|
||||
* @param $sAttCode
|
||||
* @param AttributeDefinition $oAttDef
|
||||
* @param $aFields
|
||||
* @param bool $bHasIndex
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sClassAlias
|
||||
* @param string $sAttCode
|
||||
* @param \AttributeDefinition $oAttDef
|
||||
* @param array $aFields
|
||||
* @param bool $bHasIndex
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \CoreException
|
||||
* @throws \MissingQueryArgument
|
||||
* @throws \MySQLException
|
||||
* @throws \MySQLHasGoneAwayException
|
||||
*/
|
||||
private function AppendField($sClass, $sClassAlias, $sAttCode, $oAttDef, $aFields, $bHasIndex = false)
|
||||
{
|
||||
if (!is_null($oAttDef) && ($oAttDef->GetSearchType() != AttributeDefinition::SEARCH_WIDGET_TYPE_RAW))
|
||||
@@ -680,12 +687,14 @@ class SearchForm
|
||||
return $aFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DBObjectSearch $oSearch
|
||||
* @param $aContextParams
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
/**
|
||||
* @param \DBObjectSearch $oSearch
|
||||
* @param array $aContextParams
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws \CoreException
|
||||
*/
|
||||
protected function GetDefaultCriterion($oSearch, &$aContextParams = array())
|
||||
{
|
||||
$aAndCriterion = array();
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use Closure;
|
||||
|
||||
/**
|
||||
* A field for Dates and Date & Times, supporting custom formats
|
||||
*/
|
||||
@@ -32,7 +34,7 @@ class DateTimeField extends StringField
|
||||
* Overloaded constructor
|
||||
*
|
||||
* @param string $sId
|
||||
* @param Closure $onFinalizeCallback (Used in the $oForm->AddField($sId, ..., function() use ($oManager, $oForm, '...') { ... } ); )
|
||||
* @param \Closure $onFinalizeCallback (Used in the $oForm->AddField($sId, ..., function() use ($oManager, $oForm, '...') { ... } ); )
|
||||
*/
|
||||
public function __construct($sId, Closure $onFinalizeCallback = null)
|
||||
{
|
||||
@@ -52,13 +54,13 @@ class DateTimeField extends StringField
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $sDateTimeFormat
|
||||
* @param string $sPHPDateTimeFormat
|
||||
*
|
||||
* @return \Combodo\iTop\Form\Field\DateTimeField
|
||||
*/
|
||||
public function SetPHPDateTimeFormat($sDateTimeFormat)
|
||||
public function SetPHPDateTimeFormat($sPHPDateTimeFormat)
|
||||
{
|
||||
$this->sPHPDateTimeFormat = $sDateTimeFormat;
|
||||
$this->sPHPDateTimeFormat = $sPHPDateTimeFormat;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -68,18 +70,18 @@ class DateTimeField extends StringField
|
||||
*/
|
||||
public function GetJSDateTimeFormat()
|
||||
{
|
||||
return $this->sDateTimeFormat;
|
||||
return $this->sJSDateTimeFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $sDateTimeFormat
|
||||
* @param string $sJSDateTimeFormat
|
||||
*
|
||||
* @return \Combodo\iTop\Form\Field\DateTimeField
|
||||
*/
|
||||
public function SetJSDateTimeFormat($sDateTimeFormat)
|
||||
public function SetJSDateTimeFormat($sJSDateTimeFormat)
|
||||
{
|
||||
$this->sDateTimeFormat = $sDateTimeFormat;
|
||||
$this->sJSDateTimeFormat = $sJSDateTimeFormat;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ abstract class MultipleChoicesField extends Field
|
||||
{
|
||||
if (array_key_exists($value, $this->currentValue))
|
||||
{
|
||||
unset($this->currentValue[$sId]);
|
||||
unset($this->currentValue[$value]);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \Combodo\iTop\Form\Field\TextField;
|
||||
class StringField extends TextField
|
||||
{
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use Str;
|
||||
use Closure;
|
||||
|
||||
/**
|
||||
* Description of UrlField
|
||||
@@ -36,7 +37,7 @@ class UrlField extends StringField
|
||||
* Default constructor
|
||||
*
|
||||
* @param string $sId
|
||||
* @param Closure $onFinalizeCallback (Used in the $oForm->AddField($sId, ..., function() use ($oManager, $oForm, '...') { ... } ); )
|
||||
* @param \Closure $onFinalizeCallback (Used in the $oForm->AddField($sId, ..., function() use ($oManager, $oForm, '...') { ... } ); )
|
||||
*/
|
||||
public function __construct($sId, Closure $onFinalizeCallback = null)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,17 @@ use Combodo\iTop\Form\Field\SelectObjectField;
|
||||
|
||||
class ConsoleSelectObjectFieldRenderer extends FieldRenderer
|
||||
{
|
||||
public function Render()
|
||||
/**
|
||||
* @return RenderingOutput
|
||||
*
|
||||
* @throws \Exception
|
||||
* @throws \CoreException
|
||||
* @throws \CoreUnexpectedValue
|
||||
* @throws \MissingQueryArgument
|
||||
* @throws \MySQLException
|
||||
* @throws \MySQLHasGoneAwayException
|
||||
*/
|
||||
public function Render()
|
||||
{
|
||||
$oOutput = new RenderingOutput();
|
||||
|
||||
@@ -124,13 +134,13 @@ class ConsoleSelectObjectFieldRenderer extends FieldRenderer
|
||||
if (($iCount == 1) && $bMandatory)
|
||||
{
|
||||
// When there is only once choice, select it by default
|
||||
$sSelected = ' checked';
|
||||
$sSelected = 'checked';
|
||||
}
|
||||
else
|
||||
{
|
||||
$sSelected = ($value == $iObject) ? ' checked' : '';
|
||||
$sSelected = ($value == $iObject) ? 'checked' : '';
|
||||
}
|
||||
$oOutput->AddHtml("<input type=\"radio\" id=\"{$sId}_{$iObject}\" name=\"radio_$sId\" onChange=\"$('#{$sId}').val(this.value).trigger('change');\" value=\"$iObject\"$sSelected><label class=\"radio\" for=\"{$sId}_{$iObject}\"> ".htmlentities($sLabel, ENT_QUOTES, 'UTF-8')."</label> ");
|
||||
$oOutput->AddHtml("<input type=\"radio\" id=\"{$sId}_{$iObject}\" name=\"radio_$sId\" onChange=\"$('#{$sId}').val(this.value).trigger('change');\" value=\"$iObject\" $sSelected><label class=\"radio\" for=\"{$sId}_{$iObject}\"> ".htmlentities($sLabel, ENT_QUOTES, 'UTF-8')."</label> ");
|
||||
if ($bVertical)
|
||||
{
|
||||
$oOutput->AddHtml("<br>\n");
|
||||
|
||||
@@ -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}\"> ".htmlentities($sLabel, ENT_QUOTES, 'UTF-8')."</label> ");
|
||||
$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}\"> ".htmlentities($sLabel, ENT_QUOTES, 'UTF-8')."</label> ");
|
||||
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())
|
||||
{
|
||||
|
||||
@@ -24,7 +24,12 @@ use Combodo\iTop\Renderer\RenderingOutput;
|
||||
|
||||
class ConsoleSubFormFieldRenderer extends FieldRenderer
|
||||
{
|
||||
public function Render()
|
||||
/**
|
||||
* @return RenderingOutput
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function Render()
|
||||
{
|
||||
$oOutput = new RenderingOutput();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user